authorgravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2015-12-15 13:15:07-07:00
committergravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2015-12-15 13:15:24-07:00
log1e09de0ff4a23558b159e5c432fdc88803339c01
tree07fa2b9504d462d9889416959d37a5a44eac36e0
parent2f15babbd35c8ba66261221dd345260cbfabe039

some tests for number literals


1 files changed, 66 insertions(+), 2 deletions(-)

test/run_tests.cpp+66-2
......@@ -439,10 +439,74 @@ extern {
439439}
440440
441441export fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 {
442 printf(c"0=%d\n", 0 as i32); // TODO: more tests
442 printf(c"\n");
443 printf(c"0.0: %a\n",
444 0.0 as f64);
445 printf(c"0e0: %a\n",
446 0e0 as f64);
447 printf(c"0.0e0: %a\n",
448 0.0e0 as f64);
449 printf(c"000000000000000000000000000000000000000000000000000000000.0e0: %a\n",
450 000000000000000000000000000000000000000000000000000000000.0e0 as f64);
451 printf(c"0.000000000000000000000000000000000000000000000000000000000e0: %a\n",
452 0.000000000000000000000000000000000000000000000000000000000e0 as f64);
453 printf(c"0.0e000000000000000000000000000000000000000000000000000000000: %a\n",
454 0.0e000000000000000000000000000000000000000000000000000000000 as f64);
455
456 printf(c"\n");
457
458 printf(c"0x1.0: %a\n",
459 0x1.0 as f64);
460 printf(c"0x10.0: %a\n",
461 0x10.0 as f64);
462 printf(c"0x100.0: %a\n",
463 0x100.0 as f64);
464 printf(c"0x103.0: %a\n",
465 0x103.0 as f64);
466 printf(c"0x103.7: %a\n",
467 0x103.7 as f64);
468 printf(c"0x103.70: %a\n",
469 0x103.70 as f64);
470 printf(c"0x103.70p4: %a\n",
471 0x103.70p4 as f64);
472 printf(c"0x103.70p5: %a\n",
473 0x103.70p5 as f64);
474 printf(c"0x103.70p+5: %a\n",
475 0x103.70p+5 as f64);
476 printf(c"0x103.70p-5: %a\n",
477 0x103.70p-5 as f64);
478
479 printf(c"\n");
480
481 printf(c"0b10100.00010e0: %a\n",
482 0b10100.00010e0 as f64);
483 printf(c"0o10700.00010e0: %a\n",
484 0o10700.00010e0 as f64);
485
443486 return 0;
444487}
445 )SOURCE", "0=0\n");
488 )SOURCE", R"OUTPUT(
4890.0: 0x0p+0
4900e0: 0x0p+0
4910.0e0: 0x0p+0
492000000000000000000000000000000000000000000000000000000000.0e0: 0x0p+0
4930.000000000000000000000000000000000000000000000000000000000e0: 0x0p+0
4940.0e000000000000000000000000000000000000000000000000000000000: 0x0p+0
495
4960x1.0: 0x1p+0
4970x10.0: 0x1p+4
4980x100.0: 0x1p+8
4990x103.0: 0x1.03p+8
5000x103.7: 0x1.037p+8
5010x103.70: 0x1.037p+8
5020x103.70p4: 0x1.037p+12
5030x103.70p5: 0x1.037p+13
5040x103.70p+5: 0x1.037p+13
5050x103.70p-5: 0x1.037p+3
506
5070b10100.00010e0: 0x1.41p+4
5080o10700.00010e0: 0x1.1c0001p+12
509)OUTPUT");
446510
447511 add_simple_case("structs", R"SOURCE(
448512use "std.zig";