Sun, 21 Nov 2010 21:36:26 +0000
New (passing) test, arithmetic.lua
111
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 | local _ = 0; -- To prevent constant folding |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 | assert((_ + 0) + 0 == 0) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 | assert((_ + 0) + 1 == 1) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 | assert((_ + 1) + 0 == 1) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 | assert((_ + 1) + 1 == 2) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 | |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 | assert((_ + 0) - 0 == 0) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 | assert((_ + 0) - 1 == -1) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 | assert((_ + 0) - 0 == 0) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 | assert((_ + 1) - 1 == 0) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 | |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 | assert((_ + 0) * 0 == 0) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 | assert((_ + 0) * 1 == 0) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 | assert((_ + 1) * 0 == 0) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 | assert((_ + 1) * 1 == 1) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
16 | |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 | assert((0 / 1) == 0) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 | assert((1 / 1) == 1) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 | assert((1 / 2) == 0.5) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 | assert((2 / 1) == 2) |
cb1ef8a51da4
New (passing) test, arithmetic.lua
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 |