Own-Programming-Language-Tu.../tests.own

39 lines
553 B
Plaintext
Raw Normal View History

use "ounit"
def testAdditionOnNumbers() {
assertEquals(6, 0 + 1 + 2 + 3)
}
def testSubtractionOnNumbers() {
assertEquals(-6, 0 - 1 - 2 - 3)
}
def testPrefixIncrement() {
a = 8
assertEquals(9, ++a)
assertEquals(9, a)
}
def testPostfixIncrement() {
a = 8
assertEquals(8, a++)
assertEquals(9, a)
}
def testStringReversing() {
assertEquals("tset", -"test")
}
def testStringMultiplication() {
assertEquals("******", "*" * 6)
}
def testTypes() {
assertSameType(0, 0.0)
}
def testFail() {
assertTrue(false)
}
println runTests()