1 /* tests for share/contrib/unit package, derived from doc/info/unit.texi */
3 (if not ?boundp ('globalbaseunitlisting) then load ("unit.mac"), 0);
6 /* Evaluate all test inputs via TOPLEVEL-MACSYMA-EVAL, since the unit package
7 * redefines that function to call the pre- and post-processing functions,
8 * which produce the results that one would see if the input were entered
9 * at the console input prompt. The code for processing test cases
10 * (TEST-BATCH in src/mload.lisp) calls MEVAL*, not TOPLEVEL-MACSYMA-EVAL,
11 * so it misses the pre- and post-evaluation functions, and so the test
12 * outputs don't come out the same as if they were entered at the input prompt.
14 * I'm leaning towards thinking the pre- and post-evaluation functions
15 * should be called somehow from MEVAL, since as it stands, working with units
16 * within functions won't produce the same results as console inputs, since only
17 * MEVAL is called within functions and not TOPLEVEL-MACSYMA-EVAL (nor MEVAL*
18 * for that matter). Be that as it may, I will let it stand and work around
19 * the issue with explicit calls to TOPLEVEL-MACSYMA-EVAL here.
22 ?toplevel\-macsyma\-eval (N);
25 ?toplevel\-macsyma\-eval (dyn);
26 ?rat(1, 100000)*kg*m/s^2;
28 ?toplevel\-macsyma\-eval (g);
31 ?toplevel\-macsyma\-eval (centigram*inch/minutes^2);
32 ?rat(127, 1800000000000)*kg*m/s^2;
34 setunits([centigram,inch,minute]);
37 ?toplevel\-macsyma\-eval (N);
38 ?rat(1800000000000, 127)*%in*cg/%min^2;
40 ?toplevel\-macsyma\-eval (dyn);
41 ?rat(18000000, 127)*%in*cg/%min^2;
43 ?toplevel\-macsyma\-eval (g);
46 ?toplevel\-macsyma\-eval (centigram*inch/minutes^2);
52 ?toplevel\-macsyma\-eval (centigram*inch/minutes^2);
53 ?rat(127, 1800000000000)*kg*m/s^2;
58 ?toplevel\-macsyma\-eval (N);
61 ?toplevel\-macsyma\-eval (dyn);
64 ?toplevel\-macsyma\-eval (kg*m/s^2);
67 ?toplevel\-macsyma\-eval (centigram*inch/minutes^2);
68 ?rat(127, 1800000000000)*N;
73 ?toplevel\-macsyma\-eval (kg*m/s^2);
76 ?toplevel\-macsyma\-eval (centigram*inch/minutes^2);
77 ?rat(127, 18000000)*dyn;
82 ?toplevel\-macsyma\-eval (kg*m/s^2);
85 ?toplevel\-macsyma\-eval (centigram*inch/minutes^2);
86 ?rat(127, 1800000000000)*kg*m/s^2;
88 setunits([centigram,inch,minute]);
91 ?toplevel\-macsyma\-eval (centigram*inch/minutes^2);
94 uforget([cg,%in,%min]);
95 [false, false, false];
97 ?toplevel\-macsyma\-eval (centigram*inch/minutes^2);
98 ?rat(127, 1800000000000)*kg*m/s^2;
100 ?toplevel\-macsyma\-eval (kg*m/s^2);
103 ?toplevel\-macsyma\-eval (convert(kg*m/s^2,[g,km,s]));
106 ?toplevel\-macsyma\-eval (convert(kg*m/s^2,[g,inch,minute]));
107 ?rat(18000000000, 127)*%in*g/%min^2;
109 ?toplevel\-macsyma\-eval (convert(kg*m/s^2,[N]));
112 ?toplevel\-macsyma\-eval (convert(kg*m^2/s^2,[N]));
118 ?toplevel\-macsyma\-eval (convert(kg*m^2/s^2,[N]));
121 ?toplevel\-macsyma\-eval (convert(kg*m^2/s^2,[N,inch]));
122 ?rat(5000, 127)*%in*N;
124 ?toplevel\-macsyma\-eval (convert(kg*m^2/s^2,[J]));
127 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
130 setunits([g,inch,s]);
133 ?toplevel\-macsyma\-eval (kg*m/s^2);
139 ?toplevel\-macsyma\-eval (kg*m/s^2);
140 ?rat(5000000, 127)*%in*g/s^2;
142 ?toplevel\-macsyma\-eval (convert(kg*m/s^2,[g,inch,s]));
143 ?rat(5000000, 127)*%in*g/s^2;
148 /* omit examples for usersetunits, since that's hard to test */
153 ?toplevel\-macsyma\-eval (kg*m/s^2);
156 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
162 ?toplevel\-macsyma\-eval (kg*m/s^2);
165 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
166 6241509596477042688*eV;
168 ?toplevel\-macsyma\-eval (kg*m^3/s^2);
169 6241509596477042688*eV*m;
171 ?toplevel\-macsyma\-eval (kg*m*km/s^2);
172 6241509596477042688000*eV;
177 ?toplevel\-macsyma\-eval (kg*m/s^2);
180 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
189 ?toplevel\-macsyma\-eval (kg*m/s^2);
192 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
198 ?toplevel\-macsyma\-eval (kg*m/s^2);
201 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
207 ?toplevel\-macsyma\-eval (kg*m/s^2);
210 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
219 ?toplevel\-macsyma\-eval (kg*m/s^2);
222 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
228 ?toplevel\-macsyma\-eval (kg*m/s^2);
231 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
232 6241509596477042688*eV;
237 ?toplevel\-macsyma\-eval (kg*m/s^2);
240 ?toplevel\-macsyma\-eval (kg*m^2/s^2);
249 ?toplevel\-macsyma\-eval (kg*m/s^2);
252 ?toplevel\-macsyma\-eval (kg*m^2/s^2);