33 #include "program_test.h" 34 #include "console_stdc.h" 35 #include "lib/charbuf.h" 36 #include "lib/ntext.h" 37 #include "lib/ntextd.h" 38 #include "main/evaluator.h" 40 void WriteOut(
const char *string);
41 void WriteOutInt(
int value);
43 TestProgram::TestProgram(
bool silent)
46 this->silent = silent;
52 Input =
new DecimalSystem(10,
'.');
55 Output =
new DecimalSystem(10,
'.');
58 TestProgram::~TestProgram()
62 void TestProgram::Start()
64 WriteOut(
"Testing " TXTVERSMSG NEWLINE);
65 WriteOut(TXTCOMPMSG NEWLINE);
72 WriteOut(
"All tests passed(");
74 WriteOut(
")" NEWLINE);
80 WriteOut(
", failed: ");
87 void TestProgram::Initialize(
int argc,
char** argv)
90 Preferences->SetRefactorNames(
true);
93 void TestProgram::Exit()
97 void TestProgram::RunTests()
115 void TestProgram::TestExpression(
const char* expression,
const char* result)
117 PerformTest(expression, result,
true,
true);
120 void TestProgram::TestStatement(
const char* statement,
const char* result)
122 PerformTest(statement, result,
false,
true);
125 void TestProgram::TestExecution(
const char* statement)
127 PerformTest(statement, EMPTYSTRING,
false,
false);
130 void TestProgram::PerformTest(
const char* input,
const char* result,
bool show,
bool check)
132 Evaluator* evaluator =
new Evaluator(input);
133 evaluator->Evaluate();
134 char* res = evaluator->GetResult();
136 CharBuffer* buf =
new CharBuffer();
137 buf->ClearAndCopy(res);
138 buf->RemoveTrailing(NEWLINE);
141 if (buf->Is(result) || !check)
147 WriteOut(show ? result : input);
148 WriteOut(
"]" NEWLINE);
158 WriteOut(
"] expected [");
160 WriteOut(
"] but got [");
161 WriteOut(buf->GetString());
162 WriteOut(
"]" NEWLINE);
169 void TestProgram::RunTestset01()
172 Output->SetDigits(9);
174 TestExpression(
"-1",
"-1 = -1");
175 TestExpression(
"-(-1)",
"1 = 1");
176 TestExpression(
"2+3*4+5",
"2+3*4+5 = 19");
177 TestExpression(
"(2+3)*(4+5)",
"(2+3)*(4+5) = 45");
178 TestExpression(
"-(-2*3)+(-5*3)",
"-(-2*3)+(-5)*3 = -9");
179 TestExpression(
"4*5+2*3",
"4*5+2*3 = 26");
180 TestExpression(
"(4*5)+(2*3)",
"4*5+2*3 = 26");
181 TestExpression(
"67 + 75 + 150 + 200",
"67+75+150+200 = 492");
182 TestExpression(
"(1-1/3+1/5)/(1/2-1/4+1/6)",
"(1-1/3+1/5)/(1/2-1/4+1/6) = 2.08");
183 TestExpression(
"1.5439",
"1.5439 = 1.5439");
184 TestExpression(
"1.123456789",
"1.12345679 = 1.12345679");
185 TestExpression(
"-1.01234567890123456789",
"-1.01234568 = -1.01234568");
186 TestExpression(
"1.1+1.1",
"1.1+1.1 = 2.2");
187 TestExpression(
"2.2*2.20",
"2.2*2.2 = 4.84");
188 TestExpression(
"3.3/1.1",
"3.3/1.1 = 3");
189 TestExpression(
"3.3/1.05",
"3.3/1.05 = 3.14285714");
190 TestExpression(
"2^3",
"2^3 = 8");
191 TestExpression(
"2^1.5",
"2^1.5 = 2.82842712");
192 TestExpression(
"10^3",
"10^3 = 1000");
193 TestExpression(
"10.2^1.2",
"10.2^1.2 = 16.230063");
194 TestExpression(
"100^0.5",
"100^0.5 = 10");
195 TestExpression(
"100^-0.3",
"100^(-0.3) = 0.251188643");
196 TestExpression(
"283500/1050",
"283500/1050 = 270");
197 TestExpression(
"|1-2|",
"|1-2| = 1");
198 TestExpression(
"|1-|1-5||",
"|1-|1-5|| = 3");
199 TestExpression(
"sgn(2.3)",
"sgn(2.3) = 1");
200 TestExpression(
"sgn(-12.7)",
"sgn(-12.7) = -1");
201 TestExpression(
"sgn(0)",
"sgn(0) = 0");
202 TestExpression(
"round(1.5461)",
"round(1.5461) = 2");
203 TestExpression(
"round(-1.5461)",
"round(-1.5461) = -2");
204 TestExpression(
"ceil(43.5461)",
"ceil(43.5461) = 44");
205 TestExpression(
"ceil(-43.5461)",
"ceil(-43.5461) = -43");
206 TestExpression(
"floor(39.9531)",
"floor(39.9531) = 39");
207 TestExpression(
"floor(-39.9531)",
"floor(-39.9531) = -40");
208 TestExpression(
"trunc(23.827)",
"trunc(23.827) = 23");
209 TestExpression(
"trunc(-23.827)",
"trunc(-23.827) = -23");
210 TestExpression(
"log(1000)",
"lg(1000) = 3");
211 TestExpression(
"log(100)",
"lg(100) = 2");
212 TestExpression(
"log(23.2)",
"lg(23.2) = 1.36548798");
213 TestExpression(
"log2(512)",
"lb(512) = 9");
214 TestExpression(
"lb(128)",
"lb(128) = 7");
215 TestExpression(
"lb(15.32)",
"lb(15.32) = 3.93734439");
216 TestExpression(
"ln(103)",
"ln(103) = 4.63472899");
217 TestExpression(
"ln(e)",
"ln(e) = 1");
218 TestExpression(
"sqrt(100)",
"sqrt(100) = 10");
219 TestExpression(
"sqrt(52.23)",
"sqrt(52.23) = 7.22703259");
220 TestExpression(
"sqrt(-43.5)",
"sqrt(-43.5) = 6.59545298i");
221 TestExpression(
"cbrt(1000)",
"cbrt(1000) = 10");
222 TestExpression(
"cbrt(52.23)",
"cbrt(52.23) = 3.73800612");
223 TestExpression(
"cbrt(1/0)",
"cbrt(1/0) = NaN");
224 TestExpression(
"cbrt(tan(pi/2))",
"cbrt(tan(pi/2)) = Inf");
225 TestExpression(
"cbrt(1e-20)",
"cbrt(1e-20) = 0.00000021544347");
226 TestExpression(
"cbrt(-1e-20)",
"cbrt(-1e-20) = 0.00000010772173+0.00000018657952i");
229 void TestProgram::RunTestset02()
232 Output->SetDigits(14);
234 TestExpression(
"pi",
"pi = 3.1415926535898");
235 TestExpression(
"pi*2",
"pi*2 = 6.2831853071796");
236 TestExpression(
"pi/2",
"pi/2 = 1.5707963267949");
237 TestExpression(
"cos(pi)",
"cos(pi) = -1");
238 TestExpression(
"cos(-pi)",
"cos(-pi) = -1");
239 TestExpression(
"cos(pi/2)",
"cos(pi/2) = 0");
240 TestExpression(
"sin(pi)",
"sin(pi) = 0");
241 TestExpression(
"sin(-pi)",
"sin(-pi) = 0");
242 TestExpression(
"sin(pi/2)",
"sin(pi/2) = 1");
243 TestExpression(
"tan(pi)",
"tan(pi) = 0");
244 TestExpression(
"tan(-pi)",
"tan(-pi) = 0");
245 TestExpression(
"tan(pi/2)",
"tan(pi/2) = Inf");
246 TestExpression(
"tan(-pi/2)",
"tan(-pi/2) = -Inf");
247 TestExpression(
"sin(1/12*pi)",
"sin(1/12*pi) = 0.25881904510252");
248 TestExpression(
"sin(11/12*pi)",
"sin(11/12*pi) = 0.25881904510252");
249 TestExpression(
"sin(1/6*pi)",
"sin(1/6*pi) = 0.5");
250 TestExpression(
"sin(5/6*pi)",
"sin(5/6*pi) = 0.5");
251 TestExpression(
"sin(1/4*pi)",
"sin(1/4*pi) = 0.70710678118655");
252 TestExpression(
"sin(3/4*pi)",
"sin(3/4*pi) = 0.70710678118655");
253 TestExpression(
"sin(1/3*pi)",
"sin(1/3*pi) = 0.86602540378444");
254 TestExpression(
"sin(2/3*pi)",
"sin(2/3*pi) = 0.86602540378444");
255 TestExpression(
"sin(5/12*pi)",
"sin(5/12*pi) = 0.96592582628907");
256 TestExpression(
"sin(7/12*pi)",
"sin(7/12*pi) = 0.96592582628907");
257 TestExpression(
"cos(0.5)",
"cos(0.5) = 0.87758256189037");
258 TestExpression(
"sin(0.5)",
"sin(0.5) = 0.4794255386042");
259 TestExpression(
"tan(0.5)",
"tan(0.5) = 0.54630248984379");
260 TestExpression(
"cot(0.5)",
"cot(0.5) = 1.8304877217125");
261 TestExpression(
"sec(0.5)",
"sec(0.5) = 1.1394939273245");
262 TestExpression(
"csc(0.5)",
"csc(0.5) = 2.0858296429335");
263 TestExpression(
"crd(0.5)",
"crd(0.5) = 0.49480791850905");
264 TestExpression(
"exsec(0.5)",
"exsec(0.5) = 0.13949392732455");
265 TestExpression(
"excsc(0.5)",
"excsc(0.5) = 1.0858296429335");
266 TestExpression(
"arccos(0.35)",
"acos(0.35) = 1.2132252231494");
267 TestExpression(
"arcsin(0.35)",
"asin(0.35) = 0.35757110364551");
268 TestExpression(
"arctan(0.35)",
"atan(0.35) = 0.33667481938673");
269 TestExpression(
"arccot(0.41)",
"acot(0.41) = 1.1816990957396");
270 TestExpression(
"arcsec(1.41)",
"asec(1.41) = 0.78240533832346");
271 TestExpression(
"arccsc(1.41)",
"acsc(1.41) = 0.78839098847143");
272 TestExpression(
"arccrd(1.41)",
"acrd(1.41) = 1.5648462916869");
273 TestExpression(
"cosh(0.56)",
"cosh(0.56) = 1.1609407820725");
274 TestExpression(
"sinh(0.56)",
"sinh(0.56) = 0.58973171822364");
275 TestExpression(
"tanh(0.56)",
"tanh(0.56) = 0.5079774328979");
276 TestExpression(
"coth(0.56)",
"coth(0.56) = 1.9685913885883");
277 TestExpression(
"sech(0.56)",
"sech(0.56) = 0.86137037775075");
278 TestExpression(
"csch(0.56)",
"csch(0.56) = 1.6956863080252");
279 TestExpression(
"arccosh(1.44)",
"acosh(1.44) = 0.90670360498911");
280 TestExpression(
"arcsinh(0.45)",
"asinh(0.45) = 0.43604966885174");
281 TestExpression(
"arctanh(0.45)",
"atanh(0.45) = 0.48470027859405");
282 TestExpression(
"arccoth(1.51)",
"acoth(1.51) = 0.79681365320373");
283 TestExpression(
"arcsech(0.51)",
"asech(0.51) = 1.2940148005294");
284 TestExpression(
"arccsch(0.51)",
"acsch(0.51) = 1.4259588665675");
285 TestExpression(
"ver(0.51)",
"ver(0.51) = 0.12725549235425");
287 TestExpression(
"cvs(0.51)",
"cvs(0.51) = 0.51182275311709");
289 TestExpression(
"hv(0.51)",
"hv(0.51) = 0.06362774617712");
291 TestExpression(
"hcv(0.51)",
"hcv(0.51) = 0.25591137655855");
293 TestExpression(
"2+3-cos(3)",
"2+3-cos(3) = 5.9899924966004");
294 TestExpression(
"(sqrt(6)-sqrt(2))/4",
"(sqrt(6)-sqrt(2))/4 = 0.25881904510252");
295 TestExpression(
"(sqrt(6)+sqrt(2))/4",
"(sqrt(6)+sqrt(2))/4 = 0.96592582628907");
296 TestExpression(
"sqrt(2)/2",
"sqrt(2)/2 = 0.70710678118655");
297 TestExpression(
"sqrt(3)/2",
"sqrt(3)/2 = 0.86602540378444");
300 void TestProgram::RunTestset03()
303 Output->SetDigits(11);
305 TestExpression(
"-(1-2i)",
"-(1-2i) = -1+2i");
306 TestExpression(
"-2i-(-3i)",
"-2i-(-3i) = 1i");
307 TestExpression(
"1-2i+5.3i-2.1",
"1-2i+(-2.1+5.3i) = -1.1+3.3i");
308 TestExpression(
"1-2i+5.3i-2.1+1.3+1.3+1.3i+2/7i",
"1-2i+5.3i-2.1+1.3+1.3+1.3i+2/7i = 1.5+4.3142857143i");
309 TestExpression(
"2.3*(2i-1)",
"2.3*(-1+2i) = -2.3+4.6i");
310 TestExpression(
"2.3*(2i-1)*3*2i",
"2.3*(-1+2i)*3*2i = -27.6-13.8i");
311 TestExpression(
"2.3i*(-1.27)",
"2.3i*(-1.27) = -2.921i");
312 TestExpression(
"4.3/3.3i",
"4.3/3.3i = -1.303030303i");
313 TestExpression(
"4.3i/3.3",
"4.3i/3.3 = 1.303030303i");
314 TestExpression(
"1/(12+7i)",
"1/(12+7i) = 0.062176165803-0.036269430052i");
315 TestExpression(
"4.3i/(2.3i+1.1)",
"4.3i/(1.1+2.3i) = 1.5215384615+0.72769230769i");
316 TestExpression(
"(2+3.2i)*(4+7i)",
"(2+3.2i)*(4+7i) = -14.4+26.8i");
317 TestExpression(
"(2-3i)*(4-7i)",
"(2-3i)*(4-7i) = -13-26i");
318 TestExpression(
"(-2+3i)*(-4+7.2i)",
"(-2+3i)*(-4+7.2i) = -13.6-26.4i");
319 TestExpression(
"(2+3i)*(-4+7i)",
"(2+3i)*(-4+7i) = -29+2i");
320 TestExpression(
"(2.3i+3)/(2.2i+9)",
"(3+2.3i)/(9+2.2i) = 0.37348555452+0.16425908667i");
321 TestExpression(
"(2.3i-3)/(2.2i+9)",
"(-3+2.3i)/(9+2.2i) = -0.2555917987+0.31803355079i");
322 TestExpression(
"(-2.3i+3)/(2.2i+9)",
"(3-2.3i)/(9+2.2i) = 0.2555917987-0.31803355079i");
323 TestExpression(
"(-2.3i-3)/(2.2i+9)",
"(-3-2.3i)/(9+2.2i) = -0.37348555452-0.16425908667i");
324 TestExpression(
"(2.3i-3)/(2.2i-9)",
"(-3+2.3i)/(-9+2.2i) = 0.37348555452-0.16425908667i");
325 TestExpression(
"(-2.3i+3)/(-2.2i+9)",
"(3-2.3i)/(9-2.2i) = 0.37348555452-0.16425908667i");
326 TestExpression(
"(-2.3i-3)/(-2.2i-9)",
"(-3-2.3i)/(-9-2.2i) = 0.37348555452+0.16425908667i");
327 TestExpression(
"abs(2.1-3.7i)",
"abs(2.1-3.7i) = 4.2544094772");
328 TestExpression(
"abs(-2.1+3.7i)",
"abs(-2.1+3.7i) = 4.2544094772");
329 TestExpression(
"abs(-2.1-3.7i)",
"abs(-2.1-3.7i) = 4.2544094772");
330 TestExpression(
"sgn(2.1-3.7i)",
"sgn(2.1-3.7i) = 1");
331 TestExpression(
"sgn(-2.1+3.7i)",
"sgn(-2.1+3.7i) = -1");
332 TestExpression(
"sgn(-2.1-3.7i)",
"sgn(-2.1-3.7i) = -1");
333 TestExpression(
"round(1.5461+2.57i)",
"round(1.5461+2.57i) = 2+3i");
334 TestExpression(
"round(-1.5461-2.57i)",
"round(-1.5461-2.57i) = -2-3i");
335 TestExpression(
"ceil(43.5461+2.57i)",
"ceil(43.5461+2.57i) = 44+3i");
336 TestExpression(
"ceil(-43.5461-2.57i)",
"ceil(-43.5461-2.57i) = -43-2i");
337 TestExpression(
"floor(39.9531+2.57i)",
"floor(39.9531+2.57i) = 39+2i");
338 TestExpression(
"floor(-39.9531-2.57i)",
"floor(-39.9531-2.57i) = -40-3i");
339 TestExpression(
"trunc(23.827+2.57i)",
"trunc(23.827+2.57i) = 23+2i");
340 TestExpression(
"trunc(-23.827-2.57i)",
"trunc(-23.827-2.57i) = -23-2i");
341 TestExpression(
"2^2.2i",
"2^2.2i = 0.045856443079+0.99894804i");
342 TestExpression(
"3i^4.4",
"3i^4.4 = 101.6930248+73.884307317i");
343 TestExpression(
"(2+4i)^2.2i",
"(2+4i)^2.2i = -0.086501993747-0.013402188424i");
344 TestExpression(
"(2-4i)^(2.2i-2)",
"(2-4i)^(-2+2.2i) = 0.40864788198-0.39910321822i");
345 TestExpression(
"sqrt(20+50i)",
"sqrt(20+50i) = 6.0766622447+4.1141006351i");
346 TestExpression(
"sqrt(20-50i)",
"sqrt(20-50i) = 6.0766622447-4.1141006351i");
347 TestExpression(
"sqrt(-20-50i)",
"sqrt(-20-50i) = 4.1141006351-6.0766622447i");
348 TestExpression(
"cbrt(120+75i)",
"cbrt(120+75i) = 5.1210176499+0.96470708458i");
349 TestExpression(
"cbrt(120-75i)",
"cbrt(120-75i) = 5.1210176499-0.96470708458i");
350 TestExpression(
"ln(20+40i)",
"ln(20+40i) = 3.8004512298+1.1071487178i");
351 TestExpression(
"ln(20-40i)",
"ln(20-40i) = 3.8004512298-1.1071487178i");
352 TestExpression(
"log2(17+35i)",
"lb(17+35i) = 5.282074745+1.6138599361i");
353 TestExpression(
"log2(17-35i)",
"lb(17-35i) = 5.282074745-1.6138599361i");
354 TestExpression(
"log(20+50i)",
"lg(20+50i) = 1.7311989989+0.51693635701i");
355 TestExpression(
"log(20-50i)",
"lg(20-50i) = 1.7311989989-0.51693635701i");
358 void TestProgram::RunTestset04()
361 Output->SetDigits(14);
363 TestExpression(
"ln(-15)",
"ln(-15) = 2.7080502011022+3.1415926535898i");
364 TestExpression(
"log2(-15)",
"lb(-15) = 3.9068905956085+4.5323601418272i");
365 TestExpression(
"log10(-15)",
"lg(-15) = 1.1760912590557+1.3643763538418i");
366 TestExpression(
"cos(1+2i)",
"cos(1+2i) = 2.0327230070197-3.0518977991518i");
367 TestExpression(
"sin(1+2i)",
"sin(1+2i) = 3.1657785132162+1.9596010414216i");
368 TestExpression(
"tan(1+2i)",
"tan(1+2i) = 0.0338128260799+1.0147936161466i");
369 TestExpression(
"cot(1+2i)",
"cot(1+2i) = 0.03279775553375-0.98432922645819i");
370 TestExpression(
"sec(1+2i)",
"sec(1+2i) = 0.15117629826558+0.22697367539372i");
371 TestExpression(
"csc(1+2i)",
"csc(1+2i) = 0.22837506559969-0.14136302161241i");
372 TestExpression(
"arccos(1+2i)",
"acos(1+2i) = 1.1437177404024-1.528570919481i");
373 TestExpression(
"arcsin(1+2i)",
"asin(1+2i) = 0.42707858639248+1.528570919481i");
374 TestExpression(
"arctan(1+2i)",
"atan(1+2i) = 1.3389725222945+0.40235947810853i");
375 TestExpression(
"arccot(1+2i)",
"acot(1+2i) = 0.2318238045004-0.40235947810853i");
376 TestExpression(
"arcsec(1+2i)",
"asec(1+2i) = 1.3844782726871+0.39656823011233i");
377 TestExpression(
"arccsc(1+2i)",
"acsc(1+2i) = 0.18631805410782-0.39656823011233i");
378 TestExpression(
"cosh(1+2i)",
"cosh(1+2i) = -0.64214812471552+1.0686074213828i");
379 TestExpression(
"sinh(1+2i)",
"sinh(1+2i) = -0.48905625904129+1.403119250622i");
380 TestExpression(
"tanh(1+2i)",
"tanh(1+2i) = 1.1667362572409-0.24345820118573i");
381 TestExpression(
"coth(1+2i)",
"coth(1+2i) = 0.82132979749385+0.17138361290919i");
382 TestExpression(
"sech(1+2i)",
"sech(1+2i) = -0.41314934426694-0.68752743865548i");
383 TestExpression(
"csch(1+2i)",
"csch(1+2i) = -0.22150093085051-0.6354937992539i");
384 TestExpression(
"arccosh(1+2i)",
"acosh(1+2i) = 1.528570919481+1.1437177404024i");
385 TestExpression(
"arcsinh(1+2i)",
"asinh(1+2i) = 1.4693517443682+1.0634400235778i");
386 TestExpression(
"arctanh(1+2i)",
"atanh(1+2i) = 0.17328679513999+1.1780972450962i");
387 TestExpression(
"arccoth(1+2i)",
"acoth(1+2i) = 0.17328679513999-0.39269908169872i");
388 TestExpression(
"arcsech(1+2i)",
"asech(1+2i) = 0.39656823011233-1.3844782726871i");
389 TestExpression(
"arccsch(1+2i)",
"acsch(1+2i) = 0.21561241855583-0.40158639166781i");
390 TestExpression(
"cos(-1.43-3.23i)",
"cos(-1.43-3.23i) = 1.7765430126591-12.495168795382i");
391 TestExpression(
"sin(-1.43-3.23i)",
"sin(-1.43-3.23i) = -12.534334855328-1.7709918453308i");
392 TestExpression(
"tan(-1.43-3.23i)",
"tan(-1.43-3.23i) = -0.00087228966374-1.003010475525i");
393 TestExpression(
"cot(-1.43-3.23i)",
"cot(-1.43-3.23i) = -0.00086706061634+0.99699780617804i");
394 TestExpression(
"sec(-1.43-3.23i)",
"sec(-1.43-3.23i) = 0.01115321045915+0.07844518613085i");
395 TestExpression(
"csc(-1.43-3.23i)",
"csc(-1.43-3.23i) = -0.07821934898722+0.01105170962818i");
396 TestExpression(
"arccos(-1.43-3.23i)",
"acos(-1.43-3.23i) = 1.9733334521871+1.9686290896497i");
397 TestExpression(
"arcsin(-1.43-3.23i)",
"asin(-1.43-3.23i) = -0.40253712539219-1.9686290896497i");
398 TestExpression(
"arctan(-1.43-3.23i)",
"atan(-1.43-3.23i) = -1.4486945189384-0.26104191221162i");
399 TestExpression(
"arccot(-1.43-3.23i)",
"acot(-1.43-3.23i) = -0.1221018078565+0.26104191221162i");
400 TestExpression(
"arcsec(-1.43-3.23i)",
"asec(-1.43-3.23i) = 1.6819282086005-0.25760781134815i");
401 TestExpression(
"arccsc(-1.43-3.23i)",
"acsc(-1.43-3.23i) = -0.11113188180565+0.25760781134815i");
402 TestExpression(
"cosh(-1.43-3.23i)",
"cosh(-1.43-3.23i) = -2.2003770462293-0.17390877229544i");
403 TestExpression(
"sinh(-1.43-3.23i)",
"sinh(-1.43-3.23i) = 1.9620027174115+0.19503789026432i");
404 TestExpression(
"tanh(-1.43-3.23i)",
"tanh(-1.43-3.23i) = -0.89309335200203-0.01805196156745i");
405 TestExpression(
"coth(-1.43-3.23i)",
"coth(-1.43-3.23i) = -1.1192464990635+0.02262316110662i");
406 TestExpression(
"sech(-1.43-3.23i)",
"sech(-1.43-3.23i) = -0.4516462791984+0.03569626853807i");
407 TestExpression(
"csch(-1.43-3.23i)",
"csch(-1.43-3.23i) = 0.50469595437383-0.05017059012838i");
408 TestExpression(
"arccosh(-1.43-3.23i)",
"acosh(-1.43-3.23i) = -1.9686290896497+1.9733334521871i");
409 TestExpression(
"arcsinh(-1.43-3.23i)",
"asinh(-1.43-3.23i) = -1.9417349567173-1.1385610418228i");
410 TestExpression(
"arctanh(-1.43-3.23i)",
"atanh(-1.43-3.23i) = -0.10773740084981-1.3144779329543i");
411 TestExpression(
"arccoth(-1.43-3.23i)",
"acoth(-1.43-3.23i) = -0.10773740084981+0.25631839384056i");
412 TestExpression(
"arcsech(-1.43-3.23i)",
"asech(-1.43-3.23i) = -0.25760781134815-1.6819282086005i");
413 TestExpression(
"arccsch(-1.43-3.23i)",
"acsch(-1.43-3.23i) = -0.1183123934959+0.2599771870207i");
414 TestExpression(
"2+3.2i*cos(-1i)+5/7",
"2+3.2i*cos(-1i)+5/7 = 2.7142857142857+4.9378580314088i");
417 void TestProgram::RunTestset05()
419 TestExecution(
"delete funtions");
420 TestStatement(
"2",
"2 = 2");
421 TestStatement(
"ins+2",
"ins+2 = 4");
422 TestStatement(
"f(x)=x*2+1", EMPTYSTRING);
423 TestStatement(
"g(y)=y^2+y*1.5+2", EMPTYSTRING);
424 TestStatement(
"h(x)=x^3-2*x^2-16*x+6", EMPTYSTRING);
425 TestStatement(
"a=2;b=3;c=a+b;", EMPTYSTRING);
426 TestStatement(
"vars",
"a = 2" NEWLINE
"b = 3" NEWLINE
"c = 5");
427 TestStatement(
"funcs",
"f(x)=x*2+1" NEWLINE
"g(y)=y^2+y*1.5+2" NEWLINE
"h(x)=x^3-2*x^2-16*x+6");
428 TestStatement(
"f(2.2)",
"f(2.2) = 5.4");
429 TestStatement(
"h(8.3)",
"h(8.3) = 307.207");
430 TestStatement(
"c+1.1",
"c+1.1 = 6.1");
431 TestStatement(
"d=1.1", EMPTYSTRING);
432 TestStatement(
"eval d=d+1",
"d=(d+1) = 2.1");
433 TestStatement(
"eval d=d+1",
"d=(d+1) = 3.1");
434 TestStatement(
"eval d=d*2",
"d=(d*2) = 6.2");
435 TestStatement(
"vars",
"a = 2" NEWLINE
"b = 3" NEWLINE
"c = 5" NEWLINE
"d = 6.2");
436 TestExecution(
"delete funtions");
437 TestExecution(
"delete variable");
440 void TestProgram::RunTestset06()
442 TestExecution(
"help");
443 TestExecution(
"help functions");
444 TestExecution(
"help trigon");
445 TestExecution(
"help hyper");
446 TestExecution(
"help complex");
447 TestExecution(
"help statements");
448 TestExecution(
"help operators");
449 TestExecution(
"help sin");
450 TestExecution(
"help help");
451 TestExecution(
"input hex");
452 TestExecution(
"input dec");
453 TestExecution(
"input oct");
454 TestExecution(
"input bin");
455 TestExecution(
"input 25");
456 TestExecution(
"output hex");
457 TestExecution(
"output dec");
458 TestExecution(
"output oct");
459 TestExecution(
"output bin");
460 TestExecution(
"output 25");
461 TestExecution(
"digits 1");
462 TestExecution(
"digits 5");
463 TestExecution(
"digits 9");
464 TestExecution(
"digits 15");
465 TestExecution(
"digits 33");
466 TestExecution(
"input");
467 TestExecution(
"output");
468 TestExecution(
"digits");
469 TestExecution(
"eval 7+7");
470 TestExecution(
"delete x");
471 TestExecution(
"delete pi");
472 TestExecution(
"eval pi/2");
473 TestExecution(
"list");
474 TestExecution(
"memory");
475 TestExecution(
"variables");
478 void TestProgram::RunTestset07()
481 Input =
new DecimalSystem(4,
',');
483 Output =
new DecimalSystem(14,
',');
485 TestExpression(
"cos(0,5)",
"cos(0,5) = 0,87758256189037");
486 TestExpression(
"sin(0,5)",
"sin(0,5) = 0,4794255386042");
489 Output =
new DecimalSystem(14,
'.');
490 TestExpression(
"cos(0,5)",
"cos(0,5) = 0.87758256189037");
491 TestExpression(
"sin(0,5)",
"sin(0,5) = 0.4794255386042");
494 Input =
new DecimalSystem(14,
'.');
495 TestExpression(
"cos(0.5)",
"cos(0.5) = 0.87758256189037");
496 TestExpression(
"sin(0.5)",
"sin(0.5) = 0.4794255386042");
499 void TestProgram::RunTestset08()
502 Output->SetDigits(9);
504 TestExpression(
"1/0",
"1/0 = NaN");
505 TestExpression(
"1.0/0",
"1/0 = NaN");
506 TestExpression(
"1i/0",
"1i/0 = NaN");
507 TestExpression(
"1.0i/0",
"1i/0 = NaN");
508 TestExpression(
"1/0.0",
"1/0 = NaN");
509 TestExpression(
"1.0/0.0",
"1/0 = NaN");
510 TestExpression(
"1i/0.0",
"1i/0 = NaN");
511 TestExpression(
"1.0i/0.0",
"1i/0 = NaN");
512 TestExpression(
"1/0i",
"1/0 = NaN");
513 TestExpression(
"1.0/0i",
"1/0 = NaN");
514 TestExpression(
"1i/0i",
"1i/0 = NaN");
515 TestExpression(
"1.0i/0i",
"1i/0 = NaN");
516 TestExpression(
"1/0.0i",
"1/0 = NaN");
517 TestExpression(
"1.0/0.0i",
"1/0 = NaN");
518 TestExpression(
"1i/0.0i",
"1i/0 = NaN");
519 TestExpression(
"1.0i/0.0i",
"1i/0 = NaN");
520 TestExpression(
"lb(0)*10",
"lb(0)*10 = NaN");
521 TestExpression(
"ln(0)*10",
"ln(0)*10 = NaN");
522 TestExpression(
"lg(0)*10",
"lg(0)*10 = NaN");
523 TestExpression(
"1+1",
"1+1 = 2");
524 TestExpression(
"1.1+1",
"1.1+1 = 2.1");
525 TestExpression(
"1i+1",
"1+1i = 1+1i");
526 TestExpression(
"1.1i+1",
"1+1.1i = 1+1.1i");
527 TestExpression(
"1+1.0",
"1+1 = 2");
528 TestExpression(
"1.1+1.0",
"1.1+1 = 2.1");
529 TestExpression(
"1i+1.0",
"1+1i = 1+1i");
530 TestExpression(
"1.1i+1.0",
"1+1.1i = 1+1.1i");
531 TestExpression(
"1+1i",
"1+1i = 1+1i");
532 TestExpression(
"1.1+1i",
"1.1+1i = 1.1+1i");
533 TestExpression(
"1i+1i",
"1i+1i = 2i");
534 TestExpression(
"1.1i+1i",
"1.1i+1i = 2.1i");
535 TestExpression(
"1+1.0i",
"1+1i = 1+1i");
536 TestExpression(
"1.1+1.0i",
"1.1+1i = 1.1+1i");
537 TestExpression(
"1i+1.0i",
"1i+1i = 2i");
538 TestExpression(
"1.1i+1.0i",
"1.1i+1i = 2.1i");
539 TestExpression(
"1i+1i",
"1i+1i = 2i");
540 TestExpression(
"1.0i+1i",
"1i+1i = 2i");
541 TestExpression(
"1i+1.0i",
"1i+1i = 2i");
542 TestExpression(
"1.0i+1.0i",
"1i+1i = 2i");
543 TestExpression(
"1-1",
"1-1 = 0");
544 TestExpression(
"1.1-1",
"1.1-1 = 0.1");
545 TestExpression(
"1i-1",
"-1+1i = -1+1i");
546 TestExpression(
"1.1i-1",
"-1+1.1i = -1+1.1i");
547 TestExpression(
"1-1.0",
"1-1 = 0");
548 TestExpression(
"1.1-1.0",
"1.1-1 = 0.1");
549 TestExpression(
"1i-1.0",
"-1+1i = -1+1i");
550 TestExpression(
"1.1i-1.0",
"-1+1.1i = -1+1.1i");
551 TestExpression(
"1-1i",
"1-1i = 1-1i");
552 TestExpression(
"1.1-1i",
"1.1-1i = 1.1-1i");
553 TestExpression(
"1i-1i",
"1i-1i = 0");
554 TestExpression(
"1.1i-1i",
"1.1i-1i = 0.1i");
555 TestExpression(
"1-1.0i",
"1-1i = 1-1i");
556 TestExpression(
"1.1-1.0i",
"1.1-1i = 1.1-1i");
557 TestExpression(
"1i-1.0i",
"1i-1i = 0");
558 TestExpression(
"1.1i-1.0i",
"1.1i-1i = 0.1i");
559 TestExpression(
"1i-1i",
"1i-1i = 0");
560 TestExpression(
"1.0i-1i",
"1i-1i = 0");
561 TestExpression(
"1i-1.0i",
"1i-1i = 0");
562 TestExpression(
"1.0i-1.0i",
"1i-1i = 0");
567 void TestProgram::RunTestset09()
570 Output->SetDigits(9);
572 TestExpression(
"lb(0)",
"lb(0) = NaN");
573 TestExpression(
"ln(0)",
"ln(0) = NaN");
574 TestExpression(
"lg(0)",
"lg(0) = NaN");
575 TestExpression(
"lb(0i)",
"lb(0) = NaN");
576 TestExpression(
"ln(0i)",
"ln(0) = NaN");
577 TestExpression(
"lg(0i)",
"lg(0) = NaN");
578 TestExpression(
"tan(0)",
"tan(0) = 0");
579 TestExpression(
"tan(pi)",
"tan(pi) = 0");
580 TestExpression(
"cot(0)",
"cot(0) = NaN");
581 TestExpression(
"cot(pi)",
"cot(pi) = NaN");
582 TestExpression(
"sec(0)",
"sec(0) = 1");
583 TestExpression(
"sec(pi)",
"sec(pi) = 1");
584 TestExpression(
"csc(0)",
"csc(0) = NaN");
585 TestExpression(
"csc(pi)",
"csc(pi) = NaN");
586 TestExpression(
"exsec(0)",
"exsec(0) = 0");
587 TestExpression(
"excsc(0)",
"excsc(0) = Inf");
588 TestExpression(
"arcsin(0)",
"asin(0) = 0");
589 TestExpression(
"arctan(0)",
"atan(0) = 0");
590 TestExpression(
"arcsec(0)",
"asec(0) = NaN");
591 TestExpression(
"arccsc(0)",
"acsc(0) = NaN");
592 TestExpression(
"aexsec(0)",
"aexsec(0) = 0");
593 TestExpression(
"cosh(0)",
"cosh(0) = 1");
594 TestExpression(
"sinh(0)",
"sinh(0) = 0");
595 TestExpression(
"tanh(0)",
"tanh(0) = 0");
596 TestExpression(
"coth(0)",
"coth(0) = NaN");
597 TestExpression(
"sech(0)",
"sech(0) = 1");
598 TestExpression(
"csch(0)",
"csch(0) = NaN");
599 TestExpression(
"arcsinh(0)",
"asinh(0) = 0");
600 TestExpression(
"arctanh(0)",
"atanh(0) = 0");
601 TestExpression(
"arccoth(0)",
"acoth(0) = NaN");
602 TestExpression(
"arcsech(0)",
"asech(0) = NaN");
603 TestExpression(
"arccsch(0)",
"acsch(0) = NaN");
606 void TestProgram::RunTestset10()
609 Output->SetDigits(9);
611 TestExpression(
"-1e-309",
"-Inf = -Inf");
612 TestExpression(
"-1e-308",
"-Inf = -Inf");
613 TestExpression(
"1e-309",
"Inf = Inf");
614 TestExpression(
"1e-308",
"Inf = Inf");
615 TestExpression(
"1e-307",
"1e-307 = 1e-307");
616 TestExpression(
"1e-300",
"1e-300 = 1e-300");
617 TestExpression(
"1e-267",
"1e-267 = 1e-267");
618 TestExpression(
"1e-165",
"1e-165 = 1e-165");
619 TestExpression(
"1e-150",
"1e-150 = 1e-150");
620 TestExpression(
"1e-75",
"1e-75 = 1e-75");
621 TestExpression(
"1e-40",
"1e-40 = 1e-40");
622 TestExpression(
"1e-20",
"1e-20 = 1e-20");
623 TestExpression(
"1e-19",
"1e-19 = 1e-19");
624 TestExpression(
"1e-18",
"1e-18 = 1e-18");
625 TestExpression(
"1e-17",
"1e-17 = 1e-17");
626 TestExpression(
"1e-16",
"1e-16 = 1e-16");
627 TestExpression(
"1e-15",
"1e-15 = 1e-15");
628 TestExpression(
"1e-14",
"1e-14 = 1e-14");
629 TestExpression(
"1e-13",
"1e-13 = 1e-13");
630 TestExpression(
"1e-12",
"1e-12 = 1e-12");
631 TestExpression(
"1e-11",
"1e-11 = 1e-11");
632 TestExpression(
"1e-10",
"1e-10 = 1e-10");
633 TestExpression(
"1e-9",
"1e-9 = 1e-9");
634 TestExpression(
"1e-8",
"0.00000001 = 0.00000001");
635 TestExpression(
"1e-7",
"0.0000001 = 0.0000001");
636 TestExpression(
"1e-6",
"0.000001 = 0.000001");
637 TestExpression(
"1e-5",
"0.00001 = 0.00001");
638 TestExpression(
"1e-4",
"0.0001 = 0.0001");
639 TestExpression(
"1e-3",
"0.001 = 0.001");
640 TestExpression(
"1e-2",
"0.01 = 0.01");
641 TestExpression(
"1e-1",
"0.1 = 0.1");
642 TestExpression(
"1e-0",
"1 = 1");
643 TestExpression(
"1e+0",
"1 = 1");
644 TestExpression(
"1e+1",
"10 = 10");
645 TestExpression(
"1e+2",
"100 = 100");
646 TestExpression(
"1e+3",
"1000 = 1000");
647 TestExpression(
"1e+4",
"10000 = 10000");
648 TestExpression(
"1e+5",
"100000 = 100000");
649 TestExpression(
"1e+6",
"1000000 = 1000000");
650 TestExpression(
"1e+7",
"10000000 = 10000000");
651 TestExpression(
"1e+8",
"100000000 = 100000000");
652 TestExpression(
"1e+9",
"1e+9 = 1e+9");
653 TestExpression(
"1e+10",
"1e+10 = 1e+10");
654 TestExpression(
"1e+11",
"1e+11 = 1e+11");
655 TestExpression(
"1e+12",
"1e+12 = 1e+12");
656 TestExpression(
"1e+13",
"1e+13 = 1e+13");
657 TestExpression(
"1e+14",
"1e+14 = 1e+14");
658 TestExpression(
"1e+15",
"1e+15 = 1e+15");
659 TestExpression(
"1e+16",
"1e+16 = 1e+16");
660 TestExpression(
"1e+17",
"1e+17 = 1e+17");
661 TestExpression(
"1e+18",
"1e+18 = 1e+18");
662 TestExpression(
"1e+19",
"1e+19 = 1e+19");
663 TestExpression(
"1e+20",
"1e+20 = 1e+20");
664 TestExpression(
"1e+40",
"1e+40 = 1e+40");
665 TestExpression(
"1e+75",
"1e+75 = 1e+75");
666 TestExpression(
"1e+150",
"1e+150 = 1e+150");
667 TestExpression(
"1e+165",
"1e+165 = 1e+165");
668 TestExpression(
"1e+267",
"1e+267 = 1e+267");
669 TestExpression(
"1e+300",
"1e+300 = 1e+300");
670 TestExpression(
"1e+306",
"1e+306 = 1e+306");
671 TestExpression(
"1e+307",
"1e+307 = 1e+307");
672 TestExpression(
"1e+308",
"1e+308 = 1e+308");
673 TestExpression(
"1e+309",
"Inf = Inf");
674 TestExpression(
"1e+310",
"Inf = Inf");
675 TestExpression(
"-1e+308",
"-1e+308 = -1e+308");
676 TestExpression(
"-1e+309",
"-Inf = -Inf");
677 TestExpression(
"-1e+310",
"-Inf = -Inf");
678 TestExpression(
"1.7e-20",
"1.7e-20 = 1.7e-20");
679 TestExpression(
"1.7e-19",
"1.7e-19 = 1.7e-19");
680 TestExpression(
"1.7e-18",
"1.7e-18 = 1.7e-18");
681 TestExpression(
"1.7e-17",
"1.7e-17 = 1.7e-17");
682 TestExpression(
"1.7e-16",
"1.7e-16 = 1.7e-16");
683 TestExpression(
"1.7e-15",
"1.7e-15 = 1.7e-15");
684 TestExpression(
"1.7e-14",
"1.7e-14 = 1.7e-14");
685 TestExpression(
"1.7e-13",
"1.7e-13 = 1.7e-13");
686 TestExpression(
"1.7e-12",
"1.7e-12 = 1.7e-12");
687 TestExpression(
"1.7e-11",
"1.7e-11 = 1.7e-11");
688 TestExpression(
"1.7e-10",
"1.7e-10 = 1.7e-10");
689 TestExpression(
"1.7e-9",
"1.7e-9 = 1.7e-9");
690 TestExpression(
"1.7e-8",
"0.000000017 = 0.000000017");
691 TestExpression(
"1.7e-7",
"0.00000017 = 0.00000017");
692 TestExpression(
"1.7e-6",
"0.0000017 = 0.0000017");
693 TestExpression(
"1.7e-5",
"0.000017 = 0.000017");
694 TestExpression(
"1.7e-4",
"0.00017 = 0.00017");
695 TestExpression(
"1.7e-3",
"0.0017 = 0.0017");
696 TestExpression(
"1.7e-2",
"0.017 = 0.017");
697 TestExpression(
"1.7e-1",
"0.17 = 0.17");
698 TestExpression(
"1.7e-0",
"1.7 = 1.7");
699 TestExpression(
"1.7e+0",
"1.7 = 1.7");
700 TestExpression(
"1.7e+1",
"17 = 17");
701 TestExpression(
"1.7e+2",
"170 = 170");
702 TestExpression(
"1.7e+3",
"1700 = 1700");
703 TestExpression(
"1.7e+4",
"17000 = 17000");
704 TestExpression(
"1.7e+5",
"170000 = 170000");
705 TestExpression(
"1.7e+6",
"1700000 = 1700000");
706 TestExpression(
"1.7e+7",
"17000000 = 17000000");
707 TestExpression(
"1.7e+8",
"170000000 = 170000000");
708 TestExpression(
"1.7e+9",
"1.7e+9 = 1.7e+9");
709 TestExpression(
"1.7e+10",
"1.7e+10 = 1.7e+10");
710 TestExpression(
"1.7e+11",
"1.7e+11 = 1.7e+11");
711 TestExpression(
"1.7e+12",
"1.7e+12 = 1.7e+12");
712 TestExpression(
"1.7e+13",
"1.7e+13 = 1.7e+13");
713 TestExpression(
"1.7e+14",
"1.7e+14 = 1.7e+14");
714 TestExpression(
"1.7e+15",
"1.7e+15 = 1.7e+15");
715 TestExpression(
"1.7e+16",
"1.7e+16 = 1.7e+16");
716 TestExpression(
"1.7e+17",
"1.7e+17 = 1.7e+17");
717 TestExpression(
"1.7e+18",
"1.7e+18 = 1.7e+18");
718 TestExpression(
"1.7e+19",
"1.7e+19 = 1.7e+19");
719 TestExpression(
"1.7e+20",
"1.7e+20 = 1.7e+20");
720 TestExpression(
"-1.7e-20",
"-1.7e-20 = -1.7e-20");
721 TestExpression(
"-1.7e-19",
"-1.7e-19 = -1.7e-19");
722 TestExpression(
"-1.7e-18",
"-1.7e-18 = -1.7e-18");
723 TestExpression(
"-1.7e-17",
"-1.7e-17 = -1.7e-17");
724 TestExpression(
"-1.7e-16",
"-1.7e-16 = -1.7e-16");
725 TestExpression(
"-1.7e-15",
"-1.7e-15 = -1.7e-15");
726 TestExpression(
"-1.7e-14",
"-1.7e-14 = -1.7e-14");
727 TestExpression(
"-1.7e-13",
"-1.7e-13 = -1.7e-13");
728 TestExpression(
"-1.7e-12",
"-1.7e-12 = -1.7e-12");
729 TestExpression(
"-1.7e-11",
"-1.7e-11 = -1.7e-11");
730 TestExpression(
"-1.7e-10",
"-1.7e-10 = -1.7e-10");
731 TestExpression(
"-1.7e-9",
"-1.7e-9 = -1.7e-9");
732 TestExpression(
"-1.7e-8",
"-0.000000017 = -0.000000017");
733 TestExpression(
"-1.7e-7",
"-0.00000017 = -0.00000017");
734 TestExpression(
"-1.7e-6",
"-0.0000017 = -0.0000017");
735 TestExpression(
"-1.7e-5",
"-0.000017 = -0.000017");
736 TestExpression(
"-1.7e-4",
"-0.00017 = -0.00017");
737 TestExpression(
"-1.7e-3",
"-0.0017 = -0.0017");
738 TestExpression(
"-1.7e-2",
"-0.017 = -0.017");
739 TestExpression(
"-1.7e-1",
"-0.17 = -0.17");
740 TestExpression(
"-1.7e-0",
"-1.7 = -1.7");
741 TestExpression(
"-1.7e+0",
"-1.7 = -1.7");
742 TestExpression(
"-1.7e+1",
"-17 = -17");
743 TestExpression(
"-1.7e+2",
"-170 = -170");
744 TestExpression(
"-1.7e+3",
"-1700 = -1700");
745 TestExpression(
"-1.7e+4",
"-17000 = -17000");
746 TestExpression(
"-1.7e+5",
"-170000 = -170000");
747 TestExpression(
"-1.7e+6",
"-1700000 = -1700000");
748 TestExpression(
"-1.7e+7",
"-17000000 = -17000000");
749 TestExpression(
"-1.7e+8",
"-170000000 = -170000000");
750 TestExpression(
"-1.7e+9",
"-1.7e+9 = -1.7e+9");
751 TestExpression(
"-1.7e+10",
"-1.7e+10 = -1.7e+10");
752 TestExpression(
"-1.7e+11",
"-1.7e+11 = -1.7e+11");
753 TestExpression(
"-1.7e+12",
"-1.7e+12 = -1.7e+12");
754 TestExpression(
"-1.7e+13",
"-1.7e+13 = -1.7e+13");
755 TestExpression(
"-1.7e+14",
"-1.7e+14 = -1.7e+14");
756 TestExpression(
"-1.7e+15",
"-1.7e+15 = -1.7e+15");
757 TestExpression(
"-1.7e+16",
"-1.7e+16 = -1.7e+16");
758 TestExpression(
"-1.7e+17",
"-1.7e+17 = -1.7e+17");
759 TestExpression(
"-1.7e+18",
"-1.7e+18 = -1.7e+18");
760 TestExpression(
"-1.7e+19",
"-1.7e+19 = -1.7e+19");
761 TestExpression(
"-1.7e+20",
"-1.7e+20 = -1.7e+20");
764 void TestProgram::RunTestset11()
767 Input =
new DecimalSystem(10,
'.');
770 Output =
new PositionalNumeralSystem(16, 13,
'.');
772 TestExpression(
"5",
"5 = 5");
773 TestExpression(
"10",
"10 = A");
774 TestExpression(
"100",
"100 = 64");
775 TestExpression(
"2000",
"2000 = 7D0");
776 TestExpression(
"50000",
"50000 = C350");
777 TestExpression(
"121254544",
"121254544 = 7.3A329e+6");
778 TestExpression(
"-5",
"-5 = -5");
779 TestExpression(
"-10",
"-10 = -A");
780 TestExpression(
"-100",
"-100 = -64");
781 TestExpression(
"-2000",
"-2000 = -7D0");
782 TestExpression(
"-50000",
"-50000 = -C350");
783 TestExpression(
"-121254544",
"-121254544 = -7.3A329e+6");
784 TestExpression(
"1.5",
"1.5 = 1.8");
785 TestExpression(
"3.546",
"3.546 = 3.8BC6A7EF9DB2");
786 TestExpression(
"-77777.843",
"-77777.843 = -12FD1.D7CED917");
789 Output =
new PositionalNumeralSystem(2, 20,
'.');
790 TestExpression(
"9",
"9 = 1001");
791 TestExpression(
"999",
"999 = 1111100111");
792 TestExpression(
"999997",
"999997 = 11110100001000111101");
793 TestExpression(
"-9",
"-9 = -1001");
794 TestExpression(
"-999",
"-999 = -1111100111");
795 TestExpression(
"-999997",
"-999997 = -11110100001000111101");
796 TestExpression(
"0.5",
"0.5 = 0.1");
797 TestExpression(
"9.45",
"9.45 = 1001.0111001100110011");
798 TestExpression(
"-0.5",
"-0.5 = -0.1");
799 TestExpression(
"-9.45",
"-9.45 = -1001.0111001100110011");