Fixed a lazySlot bug where lazy slots in different objects end up pointing to the...
[io/quag.git] / libs / iovm / tests / NumberTest.io
blob0b91811ff281b9d746614ce59b5623c7d7a69a4e
2 NumberTest := UnitTest clone do(
4 testClone := method(
5 number := 5
6 assertEquals(number, number clone)
7 assertSame(Number, number proto)
10 testEquality := method(
11 a := 10
12 b := a
13 assertTrue(a == 10)
14 assertTrue(a == b)
17 testPrecision := method(
18 assertEquals(2.2469135782469135, 2 * 1.123456789123456789)
19 assertFalse(2 * 1.123456789123456789 == 2.246913578246913)
20 assertEquals(10, 10.49 round)
21 assertEquals(11, 10.50 round)
22 assertEquals(11, 10.51 round)
25 testPrecedence := method(
26 assertEquals(2 + (3 * 4) - (5 * 6) / 7, 2 + 3 * 4 - 5 * 6 / 7)
29 testFunctions := method(
30 assertEquals("31.6227766017", 1000 sqrt asString(0, 10))
31 assertEqualsWithinDelta(31.6227766, 1000 sqrt, 0.00000001)
32 n := -10
33 assertEquals(10, n abs)
34 knownBug(assertEquals(10, -10 abs))
35 assertEquals(10, (-10) abs)
36 assertTrue(10 between(9.9999, 10.0001))
37 assertEquals(-0.5440211108893698, 10 sin)
38 assertEquals(-0.8390715290764524, 10 cos )
41 testDirectAssignment := method(
42 a := 5
43 a = 10
44 assertEquals(10, a)
45 assertFalse(a < -10)
46 assertFalse(a <(-10))
49 testBitwiseOperations := method(
50 assertEquals(4, 2 shiftLeft(1))
51 assertEquals(1, 2 shiftRight(1))
52 assertEquals(7, 3 | (4))
53 assertEquals(7, 3 bitwiseOr(4))
54 assertEquals(0, 3 & (4))
55 assertEquals(0, 3 bitwiseAnd(4))
58 testCharacters := method(
59 assertTrue(65 isLetter)
60 assertFalse(30 isLetter)
61 assertFalse(47 isDigit)
62 assertTrue(48 isDigit)
63 assertTrue(57 isDigit)
64 assertFalse(58 isDigit)
67 testPerform := method(
68 assertEquals(-0.5440211108893698, 10 perform("sin"))
72 what was this bug supposed to be?
73 testFloatMaxBug := method(
74 knownBug((Number floatMax) asString)
75 knownBug("x = " .. (Number floatMax))