5 # First test whether the number stringification works okay.
6 # (Testing with == would exercize the IV/NV part, not the PV.)
9 print $a eq "1" ? "ok 1\n" : "not ok 1\n";
12 print $a eq "-1" ? "ok 2\n" : "not ok 2\n";
15 print $a eq "1" ? "ok 3\n" : "not ok 3\n";
18 print $a eq "-1" ? "ok 4\n" : "not ok 4\n";
21 print $a eq "0.1" ? "ok 5\n" : "not ok 5\n";
24 print $a eq "-0.1" ? "ok 6\n" : "not ok 6\n";
27 print $a eq "0.1" ? "ok 7\n" : "not ok 7\n";
30 print $a eq "-0.1" ? "ok 8\n" : "not ok 8\n";
33 print $a eq "10.01" ? "ok 9\n" : "not ok 9\n";
36 print $a eq "1000" ? "ok 10\n" : "not ok 10\n";
39 print $a eq "10010" ? "ok 11\n" : "not ok 11\n";
42 print $a eq "4" ? "ok 12\n" : "not ok 12\n";
45 print $a eq "64" ? "ok 13\n" : "not ok 13\n";
48 print $a eq "256" ? "ok 14\n" : "not ok 14\n";
51 print $a eq "1000" ? "ok 15\n" : "not ok 15\n";
53 # Okay, now test the numerics.
54 # We may be assuming too much, given the painfully well-known floating
55 # point sloppiness, but the following are still quite reasonable
56 # assumptions which if not working would confuse people quite badly.
58 $a = 1; "$a"; # Keep the stringification as a potential troublemaker.
59 print $a + 1 == 2 ? "ok 16\n" : "not ok 16\n";
62 print $a + 1 == 0 ? "ok 17\n" : "not ok 17\n";
65 print $a + 1 == 2 ? "ok 18\n" : "not ok 18\n";
68 print $a + 1 == 0 ? "ok 19\n" : "not ok 19\n";
71 print $a + 1 == 1.1 ? "ok 20\n" : "not ok 20\n";
74 print $a + 1 == 0.9 ? "ok 21\n" : "not ok 21\n";
77 print $a + 1 == 1.1 ? "ok 22\n" : "not ok 22\n";
80 print $a + 1 == 0.9 ? "ok 23\n" : "not ok 23\n";
83 print $a + 1 == 11.01 ? "ok 24\n" : "not ok 24\n";
86 print $a + 1 == 1001 ? "ok 25\n" : "not ok 25\n";
89 print $a + 1 == 10011 ? "ok 26\n" : "not ok 26\n";
92 print $a + 1 == 0b101 ? "ok 27\n" : "not ok 27\n";
95 print $a + 1 == 0101 ? "ok 28\n" : "not ok 28\n";
98 print $a + 1 == 0x101 ? "ok 29\n" : "not ok 29\n";
101 print $a + 1 == 1001 ? "ok 30\n" : "not ok 30\n";