diff --git a/IntegrationTests/Tests/arbint_double_div_err.som b/IntegrationTests/Tests/arbint_double_div_err.som new file mode 100644 index 00000000..81471217 --- /dev/null +++ b/IntegrationTests/Tests/arbint_double_div_err.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +arbint_double_div_err = ( + run = ( + (1 << 200) // 'a' + ) +) diff --git a/IntegrationTests/Tests/arbint_double_div_zero_err.som b/IntegrationTests/Tests/arbint_double_div_zero_err.som new file mode 100644 index 00000000..bbd17845 --- /dev/null +++ b/IntegrationTests/Tests/arbint_double_div_zero_err.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +arbint_double_div_zero_err = ( + run = ( (1 << 200) // 0 ) +) diff --git a/IntegrationTests/Tests/arbint_modulus_err.som b/IntegrationTests/Tests/arbint_modulus_err.som new file mode 100644 index 00000000..5be808fc --- /dev/null +++ b/IntegrationTests/Tests/arbint_modulus_err.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +arbint_modulus_err = ( + run = ( + (1 << 200) % 'a' + ) +) diff --git a/IntegrationTests/Tests/array_at_idx0_err.som b/IntegrationTests/Tests/array_at_idx0_err.som new file mode 100644 index 00000000..06b3335f --- /dev/null +++ b/IntegrationTests/Tests/array_at_idx0_err.som @@ -0,0 +1,17 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Index 0 not valid for array of length 0. +" + +array_at_idx0_err = ( + run = ( + | x | + + x := Array new. + x at: 0. + ) +) diff --git a/IntegrationTests/Tests/array_at_idx2_err.som b/IntegrationTests/Tests/array_at_idx2_err.som new file mode 100644 index 00000000..b1733a44 --- /dev/null +++ b/IntegrationTests/Tests/array_at_idx2_err.som @@ -0,0 +1,17 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Index 2 not valid for array of length 1. +" + +array_at_idx2_err = ( + run = ( + | x | + + x := Array new: 1. + x at: 2. + ) +) diff --git a/IntegrationTests/Tests/array_at_idx_err.som b/IntegrationTests/Tests/array_at_idx_err.som new file mode 100644 index 00000000..a5175d39 --- /dev/null +++ b/IntegrationTests/Tests/array_at_idx_err.som @@ -0,0 +1,17 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Index 1 not valid for array of length 0. +" + +array_at_idx_err = ( + run = ( + | x | + + x := Array new. + x at: 1. + ) +) diff --git a/IntegrationTests/Tests/array_at_negative_idx_err.som b/IntegrationTests/Tests/array_at_negative_idx_err.som new file mode 100644 index 00000000..b321852f --- /dev/null +++ b/IntegrationTests/Tests/array_at_negative_idx_err.som @@ -0,0 +1,17 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Can't represent as unsigned machine integer. +" + +array_at_negative_idx_err = ( + run = ( + | x | + + x := Array new. + x at: -1. + ) +) diff --git a/IntegrationTests/Tests/array_at_put_idx.err b/IntegrationTests/Tests/array_at_put_idx.err new file mode 100644 index 00000000..60b66612 --- /dev/null +++ b/IntegrationTests/Tests/array_at_put_idx.err @@ -0,0 +1,17 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Index 1 not valid for array of length 0. +" + +array_at_put_idx_err = ( + run = ( + | x | + + x := Array new. + x at: 1 put: 'a'. + ) +) diff --git a/IntegrationTests/Tests/array_at_put_idx0_err.som b/IntegrationTests/Tests/array_at_put_idx0_err.som new file mode 100644 index 00000000..461b9b28 --- /dev/null +++ b/IntegrationTests/Tests/array_at_put_idx0_err.som @@ -0,0 +1,17 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Index 0 not valid for array of length 0. +" + +array_at_put_idx0_err = ( + run = ( + | x | + + x := Array new. + x at: 0 put: 'a'. + ) +) diff --git a/IntegrationTests/Tests/array_at_put_idx2_err.som b/IntegrationTests/Tests/array_at_put_idx2_err.som new file mode 100644 index 00000000..a85dc402 --- /dev/null +++ b/IntegrationTests/Tests/array_at_put_idx2_err.som @@ -0,0 +1,17 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Index 2 not valid for array of length 1. +" + +array_at_put_idx2_err = ( + run = ( + | x | + + x := Array new: 1. + x at: 2 put: 'a'. + ) +) diff --git a/IntegrationTests/Tests/array_literals.som b/IntegrationTests/Tests/array_literals.som new file mode 100644 index 00000000..ce971f41 --- /dev/null +++ b/IntegrationTests/Tests/array_literals.som @@ -0,0 +1,23 @@ +" +VM: + status: success + stdout: + 4 + 5 + 6 + a + -7 + -8.0 + instance of Array + #b + instance of Array +" + +array_literals = ( + run = ( + | x | + + x := #(4 5 6 'a' -7 -8.0 #(9.0 #a) #b #()). + x doIndexes: [:y | (x at: y) println]. + ) +) diff --git a/IntegrationTests/Tests/basic_arrays.som b/IntegrationTests/Tests/basic_arrays.som new file mode 100644 index 00000000..18da3d2c --- /dev/null +++ b/IntegrationTests/Tests/basic_arrays.som @@ -0,0 +1,34 @@ +" +VM: + status: success + stdout: + 0 + 1 + nil + instance of Array + #a + 1 + 2 + 3 + 4 + 5 +" + +basic_arrays = ( + run = ( + | x | + + x := Array new. + x length println. + + x := Array new: 1. + x length println. + (x at: 1) println. + (x at: 1 put: #a) println. + (x at: 1) println. + + x := Array new: 5. + x doIndexes: [:y | x at: y put: y]. + x doIndexes: [:y | (x at: y) println]. + ) +) diff --git a/IntegrationTests/Tests/binary_super.som b/IntegrationTests/Tests/binary_super.som new file mode 100644 index 00000000..67fe0a4f --- /dev/null +++ b/IntegrationTests/Tests/binary_super.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stdout: ERROR: Method + not found in class binary_super +" + +binary_super = ( + run = ( + super + 1. + ) +) diff --git a/IntegrationTests/Tests/binary_super/superc.som b/IntegrationTests/Tests/binary_super/superc.som new file mode 100644 index 00000000..fdc7ba15 --- /dev/null +++ b/IntegrationTests/Tests/binary_super/superc.som @@ -0,0 +1,5 @@ +superc = ( + + i = ( + ^ 1 + i + ) +) diff --git a/IntegrationTests/Tests/binary_super/test.som b/IntegrationTests/Tests/binary_super/test.som new file mode 100644 index 00000000..7b821e08 --- /dev/null +++ b/IntegrationTests/Tests/binary_super/test.som @@ -0,0 +1,15 @@ +" +VM: + status: success + stdout: 2 +" + +test = superc ( + run = ( + (super + 1) println. + ) + + + i = ( + ^ 0 + i + ) +) diff --git a/IntegrationTests/Tests/block_1.som b/IntegrationTests/Tests/block_1.som new file mode 100644 index 00000000..35c52d07 --- /dev/null +++ b/IntegrationTests/Tests/block_1.som @@ -0,0 +1,9 @@ +" +VM: + stdout: + Hello world +" + +block_1 = ( + run = ( [ 'Hello world' ] value println ) +) diff --git a/IntegrationTests/Tests/block_10.som b/IntegrationTests/Tests/block_10.som new file mode 100644 index 00000000..5df080f1 --- /dev/null +++ b/IntegrationTests/Tests/block_10.som @@ -0,0 +1,18 @@ +" +VM: + stdout: + 7 +" + +block_10 = ( + f = ( + self g: [ :x :y | ^ (x - y) ]. + ^'b' + ) + + g: block = ( ^block value: 10 with: 3 ) + + run = ( + self f println + ) +) diff --git a/IntegrationTests/Tests/block_11.som b/IntegrationTests/Tests/block_11.som new file mode 100644 index 00000000..3da092bd --- /dev/null +++ b/IntegrationTests/Tests/block_11.som @@ -0,0 +1,27 @@ +" +VM: + stdout: + 3 + 3 +" + +block_11 = ( + f = ( + | x y | + x := 1. + y := [ + x := 2. + [ + x println. + ^ x + ] + ] value. + x := 3. + y value. + 'unreachable' println. + ) + + run = ( + self f println. + ) +) diff --git a/IntegrationTests/Tests/block_12.som b/IntegrationTests/Tests/block_12.som new file mode 100644 index 00000000..9487f139 --- /dev/null +++ b/IntegrationTests/Tests/block_12.som @@ -0,0 +1,32 @@ +" +VM: + stdout: + false 0 + instance of block_12 +" + +block_12 = ( + | i | + r: b = ( + | x | + x := i. + b ifTrue: [ + [ + 'true ' print. + x println. + ^b + ] + ] + ifFalse: [ + 'false ' print. + x println. + x := 1. + (self r: true) value + ]. + ) + + run = ( + i := 0. + (self r: false) println. + ) +) diff --git a/IntegrationTests/Tests/block_2.som b/IntegrationTests/Tests/block_2.som new file mode 100644 index 00000000..21568839 --- /dev/null +++ b/IntegrationTests/Tests/block_2.som @@ -0,0 +1,12 @@ +" +VM: + stdout: + Hello world +" + +block_2 = ( + f = ( + ^([ 'Hello world' ] value) + ) + run = ( self f println ) +) diff --git a/IntegrationTests/Tests/block_3.som b/IntegrationTests/Tests/block_3.som new file mode 100644 index 00000000..c58be88e --- /dev/null +++ b/IntegrationTests/Tests/block_3.som @@ -0,0 +1,10 @@ +" +VM: + stdout: + Hello world +" + +block_3 = ( + f = ( ^[ 'Hello world' ] ) + run = ( self f value println ) +) diff --git a/IntegrationTests/Tests/block_4.som b/IntegrationTests/Tests/block_4.som new file mode 100644 index 00000000..0cbf6cb9 --- /dev/null +++ b/IntegrationTests/Tests/block_4.som @@ -0,0 +1,15 @@ +" +VM: + stdout: + woo +" + +block_4 = ( + run = ( + |x y| + x := 'Hello world'. + [ x := 'woo'] value. + y := [ x ]. + y value println. + ) +) diff --git a/IntegrationTests/Tests/block_5.som b/IntegrationTests/Tests/block_5.som new file mode 100644 index 00000000..b3d20d4d --- /dev/null +++ b/IntegrationTests/Tests/block_5.som @@ -0,0 +1,19 @@ +" +VM: + stdout: + 2 +" + +block_5 = ( + f = ( + | x y | + x := '1'. + y := [ x ]. + x := '2'. + ^y + ) + + run = ( + self f value println + ) +) diff --git a/IntegrationTests/Tests/block_6.som b/IntegrationTests/Tests/block_6.som new file mode 100644 index 00000000..9c44291c --- /dev/null +++ b/IntegrationTests/Tests/block_6.som @@ -0,0 +1,16 @@ +" +VM: + stdout: + a +" + +block_6 = ( + f = ( + [ [ ^ 'a' ] ] value value. + ^'b' + ) + + run = ( + self f println + ) +) diff --git a/IntegrationTests/Tests/block_7.som b/IntegrationTests/Tests/block_7.som new file mode 100644 index 00000000..e6d52642 --- /dev/null +++ b/IntegrationTests/Tests/block_7.som @@ -0,0 +1,16 @@ +" +VM: + stdout: + a +" + +block_7 = ( + f = ( + [ [ ^ 'a' ] value ] value. + ^'b' + ) + + run = ( + self f println + ) +) diff --git a/IntegrationTests/Tests/block_8.som b/IntegrationTests/Tests/block_8.som new file mode 100644 index 00000000..30c2dd4b --- /dev/null +++ b/IntegrationTests/Tests/block_8.som @@ -0,0 +1,18 @@ +" +VM: + stdout: + a +" + +block_8 = ( + f = ( + self g: [ ^ 'a' ]. + ^'b' + ) + + g: block = ( ^block value ) + + run = ( + self f println + ) +) diff --git a/IntegrationTests/Tests/block_9.som b/IntegrationTests/Tests/block_9.som new file mode 100644 index 00000000..ad37c59d --- /dev/null +++ b/IntegrationTests/Tests/block_9.som @@ -0,0 +1,18 @@ +" +VM: + stdout: + a +" + +block_9 = ( + f = ( + self g: [ :x | ^ x ]. + ^'b' + ) + + g: block = ( ^block value: 'a' ) + + run = ( + self f println + ) +) diff --git a/IntegrationTests/Tests/bool1.som b/IntegrationTests/Tests/bool1.som new file mode 100644 index 00000000..a91a0483 --- /dev/null +++ b/IntegrationTests/Tests/bool1.som @@ -0,0 +1,9 @@ +" +VM: + stdout: + false +" + +bool1 = ( + run = ( true not println) +) diff --git a/IntegrationTests/Tests/bool2.som b/IntegrationTests/Tests/bool2.som new file mode 100644 index 00000000..4f834bf9 --- /dev/null +++ b/IntegrationTests/Tests/bool2.som @@ -0,0 +1,9 @@ +" +VM: + stdout: + then +" + +bool2 = ( + run = ( ( true ifTrue: [ 'then' ] ifFalse: [ 'else' ] ) println ) +) diff --git a/IntegrationTests/Tests/bool3.som b/IntegrationTests/Tests/bool3.som new file mode 100644 index 00000000..38ba76f4 --- /dev/null +++ b/IntegrationTests/Tests/bool3.som @@ -0,0 +1,15 @@ +" +VM: + stdout: + then + else +" + +bool3 = ( + f: arg = ( ( arg ifTrue: [ ^'then' ] ifFalse: [ ^'else' ] ) ) + + run = ( + (self f: true) println. + (self f: false) println. + ) +) diff --git a/IntegrationTests/Tests/bool4.som b/IntegrationTests/Tests/bool4.som new file mode 100644 index 00000000..e6e80a85 --- /dev/null +++ b/IntegrationTests/Tests/bool4.som @@ -0,0 +1,33 @@ +" +VM: + stdout: + 0 + 1 + true + false + false + false + true + false + false + false +" + +bool4 = ( + run = ( + | x | + x := 0. + false && [ x := 1 ]. + x println. + true && [ x := 1 ]. + x println. + (true && [ true ]) println. + (true && [ false ]) println. + (false && [ true ]) println. + (false && [ false ]) println. + (true && true) println. + (true && false) println. + (false && true) println. + (false && false) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/bool5.som b/IntegrationTests/Tests/bool5.som new file mode 100644 index 00000000..344ec8f3 --- /dev/null +++ b/IntegrationTests/Tests/bool5.som @@ -0,0 +1,33 @@ +" +VM: + stdout: + 0 + 1 + true + true + true + false + true + true + true + false +" + +bool5 = ( + run = ( + | x | + x := 0. + true || [ x := 1 ]. + x println. + false || [ x := 1 ]. + x println. + (true || [ true ]) println. + (true || [ false ]) println. + (false || [ true ]) println. + (false || [ false ]) println. + (true || true) println. + (true || false) println. + (false || true) println. + (false || false) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/call1.som b/IntegrationTests/Tests/call1.som new file mode 100644 index 00000000..96cad315 --- /dev/null +++ b/IntegrationTests/Tests/call1.som @@ -0,0 +1,10 @@ +" +VM: + stdout: + helloworld +" + +call1 = ( + hello: arg1 world: arg2 = ( ^ arg1 concatenate: arg2 ) + run = ( ( self hello: 'hello' world: 'world' ) println ) +) diff --git a/IntegrationTests/Tests/call2.som b/IntegrationTests/Tests/call2.som new file mode 100644 index 00000000..6726d0db --- /dev/null +++ b/IntegrationTests/Tests/call2.som @@ -0,0 +1,12 @@ +" +VM: + status: error + stderr: + ...call2.som', line 11, column 16: + m: arg1 m: arg1 = ( ) + Variable 'arg1' shadows another of the same name +" + +call2 = ( + m: arg1 m: arg1 = ( ) +) diff --git a/IntegrationTests/Tests/class_load/other.som b/IntegrationTests/Tests/class_load/other.som new file mode 100644 index 00000000..807ab16f --- /dev/null +++ b/IntegrationTests/Tests/class_load/other.som @@ -0,0 +1,3 @@ +other = ( + f = ( ^ 'other' ) +) diff --git a/IntegrationTests/Tests/class_load/test.som b/IntegrationTests/Tests/class_load/test.som new file mode 100644 index 00000000..c0ff5746 --- /dev/null +++ b/IntegrationTests/Tests/class_load/test.som @@ -0,0 +1,12 @@ +" +VM: + status: success + stdout: + other +" + +test = ( + run = ( + other new f println. + ) +) diff --git a/IntegrationTests/Tests/class_methods_fields.som b/IntegrationTests/Tests/class_methods_fields.som new file mode 100644 index 00000000..c8788b95 --- /dev/null +++ b/IntegrationTests/Tests/class_methods_fields.som @@ -0,0 +1,21 @@ +" +VM: + status: success + stdout: + #class_methods_fields + b +" + +class_methods_fields = ( + run = ( + class_methods_fields name println. + class_methods_fields set: 'b'. + class_methods_fields get println. + ) + + ------ + | f | + + get = ( ^f ) + set: o = ( f := o. ) +) diff --git a/IntegrationTests/Tests/class_names.som b/IntegrationTests/Tests/class_names.som new file mode 100644 index 00000000..c4310dbc --- /dev/null +++ b/IntegrationTests/Tests/class_names.som @@ -0,0 +1,16 @@ +" +VM: + status: success + stdout: + #Class + #Object + #class_names +" + +class_names = ( + run = ( + Class name println. + Object name println. + class_names name println. + ) +) diff --git a/IntegrationTests/Tests/class_superclass.som b/IntegrationTests/Tests/class_superclass.som new file mode 100644 index 00000000..a493bbf3 --- /dev/null +++ b/IntegrationTests/Tests/class_superclass.som @@ -0,0 +1,18 @@ +" +VM: + status: success + stdout: + Object + nil + String + nil +" + +class_superclass = ( + run = ( + Integer superclass println. + Object superclass println. + Symbol superclass println. + Class superclass superclass println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/cos.som b/IntegrationTests/Tests/cos.som new file mode 100644 index 00000000..cf016c75 --- /dev/null +++ b/IntegrationTests/Tests/cos.som @@ -0,0 +1,16 @@ +" +VM: + status: success + stdout: + 1.0 + 0.5403023058681398 + -0.4161468365471424 +" + +cos = ( + run = ( + 0.0 cos println. + 1.0 cos println. + 2.0 cos println. + ) +) diff --git a/IntegrationTests/Tests/double1.som b/IntegrationTests/Tests/double1.som new file mode 100644 index 00000000..a56e14aa --- /dev/null +++ b/IntegrationTests/Tests/double1.som @@ -0,0 +1,16 @@ +" +VM: + status: success + stdout: + 1.0 + 1.1 + 100000.19879879123 +" + +double1 = ( + run = ( + 1.0 asString println. + 1.1 asString println. + 100000.19879879123153 asString println. + ) +) diff --git a/IntegrationTests/Tests/double10.som b/IntegrationTests/Tests/double10.som new file mode 100644 index 00000000..04f18a54 --- /dev/null +++ b/IntegrationTests/Tests/double10.som @@ -0,0 +1,46 @@ +" +VM: + status: success + stdout: + false + true + true + false + false + true + false + false + false + true + true + false + true + true + true + false +" + +double10 = ( + run = ( + (1.0 = 0) println. + (1.0 = 1) println. + (1.0 <> 0) println. + (1.0 <> 1) println. + + (1.0 < 1) println. + (1.0 < 2) println. + (2.0 < 0) println. + + (1.0 > 1) println. + (1.0 > 2) println. + (2.0 > 0) println. + + (1.0 >= 1) println. + (1.0 >= 2) println. + (2.0 >= 0) println. + + (1.0 <= 1) println. + (1.0 <= 2) println. + (2.0 <= 0) println. + ) +) diff --git a/IntegrationTests/Tests/double11.som b/IntegrationTests/Tests/double11.som new file mode 100644 index 00000000..4dce49d8 --- /dev/null +++ b/IntegrationTests/Tests/double11.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected object of type 'Int' but got type 'Double'. +" + +double11 = ( + run = ( + 1 bitXor: 1.1. + ) +) diff --git a/IntegrationTests/Tests/double12.som b/IntegrationTests/Tests/double12.som new file mode 100644 index 00000000..b1bd3796 --- /dev/null +++ b/IntegrationTests/Tests/double12.som @@ -0,0 +1,14 @@ +" +VM: + status: success + stdout: + 1.1 + NaN +" + +double12 = ( + run = ( + (1.21 sqrt) println. + (-1.1 sqrt) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/double13.som b/IntegrationTests/Tests/double13.som new file mode 100644 index 00000000..18fd63e3 --- /dev/null +++ b/IntegrationTests/Tests/double13.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected object of type 'Int' but got type 'Double'. +" + +double13 = ( + run = ( + 1 & 1.1. + ) +) diff --git a/IntegrationTests/Tests/double2.som b/IntegrationTests/Tests/double2.som new file mode 100644 index 00000000..c64ededb --- /dev/null +++ b/IntegrationTests/Tests/double2.som @@ -0,0 +1,59 @@ +" +VM: + status: success + stdout: + 2.1 + 2.3 + 1073741825.1 + 1.152921504606847e18 + 0.10000000000000009 + -0.09999999999999987 + -1073741822.9 + -1.152921504606847e18 + 1.1 + 1.32 + 1181116006.4 + 1.2682136550675318e18 + 2.1 + -2.1 + 0.10000000000000009 + 1.1 + 7 + 33 + 50 + -7 + -33 + -50 +" + +double2 = ( + run = ( + (1.1 + 1) println. + (1.1 + 1.2) println. + (1.1 + (1 << 30)) println. + (1.1 + (1 << 60)) println. + + (1.1 - 1) println. + (1.1 - 1.2) println. + (1.1 - (1 << 30)) println. + (1.1 - (1 << 60)) println. + + (1.1 * 1) println. + (1.1 * 1.2) println. + (1.1 * (1 << 30)) println. + (1.1 * (1 << 60)) println. + + (1 + 1.1) println. + (-1 - 1.1) println. + (-1 - -1.1) println. + (-1 * -1.1) println. + + (10 / 1.3) println. + (10 / 0.3) println. + (10 / 0.2) println. + + (-10 / 1.3) println. + (-10 / 0.3) println. + (-10 / 0.2) println. + ) +) diff --git a/IntegrationTests/Tests/double3.som b/IntegrationTests/Tests/double3.som new file mode 100644 index 00000000..10366bb8 --- /dev/null +++ b/IntegrationTests/Tests/double3.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Can't represent as double. +" + +double3 = ( + run = ( + (0.1 + (1 << 1024)) println + ) +) diff --git a/IntegrationTests/Tests/double4.som b/IntegrationTests/Tests/double4.som new file mode 100644 index 00000000..26e350e4 --- /dev/null +++ b/IntegrationTests/Tests/double4.som @@ -0,0 +1,28 @@ +" +VM: + status: success + stdout: + 1.6069380442589903e60 + -1.6069380442589903e60 + -1.6069380442589903e60 + 1.7676318486848894e60 + 1236106187891530871397840632111672689764312345256368613097472 + 5356460147529967823014489092130522184788338220858498848129024 + 8034690221294951377709810461705813012611014968913964176506880 + -803469022129495137770981046170581301261101496891396417650688 + -803469022129495137770981046170581301261101496891396417650688 +" + +double4 = ( + run = ( + ((1 << 200) + 1.1) println. + ((-1 << 200) - 1.1) println. + ((-1 << 200) - -1.1) println. + ((-1 << 200) * -1.1) println. + ((1 << 200) / 1.3) println. + ((1 << 200) / 0.3) println. + ((1 << 200) / 0.2) println. + ((-1 << 200) / 2) println. + ((1 << 200) / -2) println. + ) +) diff --git a/IntegrationTests/Tests/double5.som b/IntegrationTests/Tests/double5.som new file mode 100644 index 00000000..e10d5c6c --- /dev/null +++ b/IntegrationTests/Tests/double5.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Can't represent as double. +" + +double5 = ( + run = ( + ((1 << 2000) + 1.1) println + ) +) diff --git a/IntegrationTests/Tests/double6.som b/IntegrationTests/Tests/double6.som new file mode 100644 index 00000000..ca54a2e7 --- /dev/null +++ b/IntegrationTests/Tests/double6.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Can't represent as double. +" + +double6 = ( + run = ( + ((1 << 2000) - 1.1) println + ) +) diff --git a/IntegrationTests/Tests/double7.som b/IntegrationTests/Tests/double7.som new file mode 100644 index 00000000..88b55a4b --- /dev/null +++ b/IntegrationTests/Tests/double7.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Can't represent as double. +" + +double7 = ( + run = ( + ((1 << 2000) * 1.1) println + ) +) diff --git a/IntegrationTests/Tests/double8.som b/IntegrationTests/Tests/double8.som new file mode 100644 index 00000000..eccc2f62 --- /dev/null +++ b/IntegrationTests/Tests/double8.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Can't represent as double. +" + +double8 = ( + run = ( + ((1 << 2000) / 1.1) println + ) +) diff --git a/IntegrationTests/Tests/double9.som b/IntegrationTests/Tests/double9.som new file mode 100644 index 00000000..1e97678e --- /dev/null +++ b/IntegrationTests/Tests/double9.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +double9 = ( + run = ( + (1 << 2000) / 0.0. + ) +) diff --git a/IntegrationTests/Tests/double_asinteger.som b/IntegrationTests/Tests/double_asinteger.som new file mode 100644 index 00000000..1d3c392d --- /dev/null +++ b/IntegrationTests/Tests/double_asinteger.som @@ -0,0 +1,26 @@ +" +VM: + status: success + stdout: + 0 + 0 + 1 + 0 + 0 + -1 + 18446744073709551616 + -18446744073709551616 +" + +double_asinteger = ( + run = ( + 0.1 asInteger println. + 0.9 asInteger println. + 1.1 asInteger println. + -0.1 asInteger println. + -0.9 asInteger println. + -1.1 asInteger println. + 18446744073709551616.0 asInteger println. + -18446744073709551616.0 asInteger println. + ) +) diff --git a/IntegrationTests/Tests/double_double_div.som b/IntegrationTests/Tests/double_double_div.som new file mode 100644 index 00000000..29c0bf05 --- /dev/null +++ b/IntegrationTests/Tests/double_double_div.som @@ -0,0 +1,24 @@ +" +VM: + status: success + stdout: + 2.0 + 12.5 + 0.25 + 6.25 + 8.034690221294951e59 + 9.334522916791713e-61 + 7.378697629483821e18 +" + +double_double_div = ( + run = ( + (5 // 2.5) println. + (5 // 0.4) println. + (0.5 // 2) println. + (2.5 // 0.4) println. + ((1 << 200) // 2.0) println. + (1.5 // (1 << 200)) println. + ((1 << 65) // 5) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/double_double_div_err.som b/IntegrationTests/Tests/double_double_div_err.som new file mode 100644 index 00000000..5ca2361c --- /dev/null +++ b/IntegrationTests/Tests/double_double_div_err.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +double_double_div_err = ( + run = ( + 1.1 // 'a' + ) +) diff --git a/IntegrationTests/Tests/double_double_div_zero_err1.som b/IntegrationTests/Tests/double_double_div_zero_err1.som new file mode 100644 index 00000000..361151f9 --- /dev/null +++ b/IntegrationTests/Tests/double_double_div_zero_err1.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +double_double_div_zero_err1 = ( + run = ( 10 // 0.0 ) +) diff --git a/IntegrationTests/Tests/double_double_div_zero_err2.som b/IntegrationTests/Tests/double_double_div_zero_err2.som new file mode 100644 index 00000000..8e95f867 --- /dev/null +++ b/IntegrationTests/Tests/double_double_div_zero_err2.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +double_double_div_zero_err2 = ( + run = ( (1 << 200) // 0.0 ) +) diff --git a/IntegrationTests/Tests/double_double_div_zero_err3.som b/IntegrationTests/Tests/double_double_div_zero_err3.som new file mode 100644 index 00000000..81274a68 --- /dev/null +++ b/IntegrationTests/Tests/double_double_div_zero_err3.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +double_double_div_zero_err3 = ( + run = ( 1.1 // 0.0 ) +) diff --git a/IntegrationTests/Tests/double_double_div_zero_err4.som b/IntegrationTests/Tests/double_double_div_zero_err4.som new file mode 100644 index 00000000..feb4751a --- /dev/null +++ b/IntegrationTests/Tests/double_double_div_zero_err4.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +double_double_div_zero_err4 = ( + run = ( 1.1 // 0 ) +) diff --git a/IntegrationTests/Tests/double_modulus.som b/IntegrationTests/Tests/double_modulus.som new file mode 100644 index 00000000..492c667c --- /dev/null +++ b/IntegrationTests/Tests/double_modulus.som @@ -0,0 +1,20 @@ +" +VM: + status: success + stdout: + 0.09999999999999987 + 1.1 + 1.1 + 0.20000000000000018 + 0.42963264371141974 +" + +double_modulus = ( + run = ( + (1.2 % 1.1) println. + (1.1 % 6) println. + (1.1 % (1 << 200)) println. + (5 % 1.2) println. + ((1 << 200) % 1.2) println. + ) +) diff --git a/IntegrationTests/Tests/double_modulus_err.som b/IntegrationTests/Tests/double_modulus_err.som new file mode 100644 index 00000000..be952a49 --- /dev/null +++ b/IntegrationTests/Tests/double_modulus_err.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +double_modulus_err = ( + run = ( + 1.1 % 'a' + ) +) diff --git a/IntegrationTests/Tests/empty_block.som b/IntegrationTests/Tests/empty_block.som new file mode 100644 index 00000000..25f0776b --- /dev/null +++ b/IntegrationTests/Tests/empty_block.som @@ -0,0 +1,11 @@ +" +VM: + status: success + stdout: nil +" + +empty_block = ( + run = ( + [] value println. + ) +) diff --git a/IntegrationTests/Tests/empty_method.som b/IntegrationTests/Tests/empty_method.som new file mode 100644 index 00000000..bf4f0f6a --- /dev/null +++ b/IntegrationTests/Tests/empty_method.som @@ -0,0 +1,13 @@ +" +VM: + status: success + stdout: instance of empty_method +" + +empty_method = ( + run = ( + self f println. + ) + + f = () +) diff --git a/IntegrationTests/Tests/error.som b/IntegrationTests/Tests/error.som new file mode 100644 index 00000000..614d8683 --- /dev/null +++ b/IntegrationTests/Tests/error.som @@ -0,0 +1,12 @@ +" +VM: + status: error + stdout: + ERROR: abc +" + +error = ( + run = ( + self error: 'abc'. + ) +) diff --git a/IntegrationTests/Tests/errorprint.som b/IntegrationTests/Tests/errorprint.som new file mode 100644 index 00000000..d1a72501 --- /dev/null +++ b/IntegrationTests/Tests/errorprint.som @@ -0,0 +1,13 @@ +" +VM: + status: success + stderr: xy + stdout: +" + +errorprint = ( + run = ( + system errorPrint: 'x'. + system errorPrint: 'y'. + ) +) diff --git a/IntegrationTests/Tests/errorprintln.som b/IntegrationTests/Tests/errorprintln.som new file mode 100644 index 00000000..8808bd24 --- /dev/null +++ b/IntegrationTests/Tests/errorprintln.som @@ -0,0 +1,12 @@ +" +VM: + status: success + stderr: x + stdout: +" + +errorprintln = ( + run = ( + system errorPrintln: 'x'. + ) +) diff --git a/IntegrationTests/Tests/escaped1.som b/IntegrationTests/Tests/escaped1.som new file mode 100644 index 00000000..093cbac5 --- /dev/null +++ b/IntegrationTests/Tests/escaped1.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stdout: + ERROR: Block has escaped and cannot be executed +" + +escaped1 = ( + f = ( ^[ ^ 'a' ] ) + + run = ( + self f value + ) +) diff --git a/IntegrationTests/Tests/escaped2.som b/IntegrationTests/Tests/escaped2.som new file mode 100644 index 00000000..ee31400b --- /dev/null +++ b/IntegrationTests/Tests/escaped2.som @@ -0,0 +1,18 @@ +" +VM: + status: success + stdout: + instance of Block1 +" + +escaped2 = ( + f = ( ^[ ^ 'a' ] ) + + run = ( + self f value + ) + + escapedBlock: block = ( + block println. + ) +) diff --git a/IntegrationTests/Tests/escaped3.som b/IntegrationTests/Tests/escaped3.som new file mode 100644 index 00000000..a921db0d --- /dev/null +++ b/IntegrationTests/Tests/escaped3.som @@ -0,0 +1,34 @@ +" +VM: + status: success + stdout: + 5 + 6 + 6 +" + +escaped3 = ( + f: x = ( + | b c | + b := [ + x := x + 1. + x + ]. + c := [ x ]. + x := x + 1. + ^(b, c) + ) + + g = ( + | a b c | + ) + + run = ( + | arr | + arr := self f: 3. + self g. + (arr at: 1) value println. + (arr at: 1) value println. + (arr at: 2) value println. + ) +) diff --git a/IntegrationTests/Tests/exit_double.som b/IntegrationTests/Tests/exit_double.som new file mode 100644 index 00000000..e4b7677a --- /dev/null +++ b/IntegrationTests/Tests/exit_double.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected object of type 'Int' but got type 'Double'. +" + +exit_double = ( + run = ( + system exit: 42.0. + ) +) diff --git a/IntegrationTests/Tests/exit_int.som b/IntegrationTests/Tests/exit_int.som new file mode 100644 index 00000000..9fd3c4cb --- /dev/null +++ b/IntegrationTests/Tests/exit_int.som @@ -0,0 +1,10 @@ +" +VM: + status: 42 +" + +exit_int = ( + run = ( + system exit: 42. + ) +) diff --git a/IntegrationTests/Tests/exit_int_too_big.som b/IntegrationTests/Tests/exit_int_too_big.som new file mode 100644 index 00000000..0d07c2fa --- /dev/null +++ b/IntegrationTests/Tests/exit_int_too_big.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Domain error. +" + +exit_int_too_big = ( + run = ( + system exit: 1 << 63. + ) +) diff --git a/IntegrationTests/Tests/exit_string.som b/IntegrationTests/Tests/exit_string.som new file mode 100644 index 00000000..190ea6aa --- /dev/null +++ b/IntegrationTests/Tests/exit_string.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected object of type 'Int' but got type 'String_'. +" + +exit_string = ( + run = ( + system exit: 'a'. + ) +) diff --git a/IntegrationTests/Tests/fast_integer_comparisons.som b/IntegrationTests/Tests/fast_integer_comparisons.som new file mode 100644 index 00000000..4937a330 --- /dev/null +++ b/IntegrationTests/Tests/fast_integer_comparisons.som @@ -0,0 +1,93 @@ +" +VM: + status: success + stdout: + true + true + true + true + true + true + false + false + false + false + false + false + false + false + false + false + false + false + true + true + true + true + true + true + false + false + false + false + false + false + true + true + true + true + true + true +" + +fast_integer_comparisons = ( + run = ( + ((-1 << 100) < 0) println. + ((-1 << 100) < -1) println. + ((-1 << 100) < 1) println. + + ((-1 << 100) <= 0) println. + ((-1 << 100) <= -1) println. + ((-1 << 100) <= 1) println. + + ((1 << 100) < 0) println. + ((1 << 100) < -1) println. + ((1 << 100) < 1) println. + + ((1 << 100) <= 0) println. + ((1 << 100) <= -1) println. + ((1 << 100) <= 1) println. + + ((-1 << 100) > 0) println. + ((-1 << 100) > -1) println. + ((-1 << 100) > 1) println. + + ((-1 << 100) >= 0) println. + ((-1 << 100) >= -1) println. + ((-1 << 100) >= 1) println. + + ((1 << 100) > 0) println. + ((1 << 100) > -1) println. + ((1 << 100) > 1) println. + + ((1 << 100) >= 0) println. + ((1 << 100) >= -1) println. + ((1 << 100) >= 1) println. + + ((-1 << 100) = 0) println. + ((-1 << 100) = -1) println. + ((-1 << 100) = 1) println. + + ((1 << 100) = 0) println. + ((1 << 100) = -1) println. + ((1 << 100) = 1) println. + + ((-1 << 100) ~= 0) println. + ((-1 << 100) ~= -1) println. + ((-1 << 100) ~= 1) println. + + ((1 << 100) ~= 0) println. + ((1 << 100) ~= -1) println. + ((1 << 100) ~= 1) println. + ) +) diff --git a/IntegrationTests/Tests/fib.som b/IntegrationTests/Tests/fib.som new file mode 100644 index 00000000..75283714 --- /dev/null +++ b/IntegrationTests/Tests/fib.som @@ -0,0 +1,27 @@ +" +VM: + status: success + stdout: + 1 + 2 + 8 + 34 +" + +fib = ( + run = ( + (self fib: 1) println. + (self fib: 2) println. + (self fib: 5) println. + (self fib: 8) println. + ) + + fib: n = ( + | fibBlock | + fibBlock := [:n | + n <= 1 + ifTrue: 1 + ifFalse: [ (fibBlock value: n - 1) + (fibBlock value: n - 2) ] ]. + ^ fibBlock value: n + ) +) diff --git a/IntegrationTests/Tests/fromstring.som b/IntegrationTests/Tests/fromstring.som new file mode 100644 index 00000000..613a4cd5 --- /dev/null +++ b/IntegrationTests/Tests/fromstring.som @@ -0,0 +1,24 @@ +" +VM: + status: success + stdout: + 0 + 1 + -1 + 9999999 + -9999999 + 1267650600228229401496703205376 + -1267650600228229401496703205376 +" + +fromstring = ( + run = ( + (Integer fromString: '0') println. + (Integer fromString: '1') println. + (Integer fromString: '-1') println. + (Integer fromString: '9999999') println. + (Integer fromString: '-9999999') println. + (Integer fromString: '1267650600228229401496703205376') println. + (Integer fromString: '-1267650600228229401496703205376') println. + ) +) diff --git a/IntegrationTests/Tests/fromstring_double.som b/IntegrationTests/Tests/fromstring_double.som new file mode 100644 index 00000000..d14d170d --- /dev/null +++ b/IntegrationTests/Tests/fromstring_double.som @@ -0,0 +1,28 @@ +" +VM: + status: success + stdout: + 0.0 + 1.0 + -1.0 + 9999999.0 + -9999999.0 + 0.1 + -0.1 + 12.34 + -12.34 +" + +fromstring_double = ( + run = ( + (Double fromString: '0') println. + (Double fromString: '1') println. + (Double fromString: '-1') println. + (Double fromString: '9999999') println. + (Double fromString: '-9999999') println. + (Double fromString: '0.1') println. + (Double fromString: '-0.1') println. + (Double fromString: '12.34') println. + (Double fromString: '-12.34') println. + ) +) diff --git a/IntegrationTests/Tests/fromstring_double_err.som b/IntegrationTests/Tests/fromstring_double_err.som new file mode 100644 index 00000000..11eb3d96 --- /dev/null +++ b/IntegrationTests/Tests/fromstring_double_err.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stderr: + Traceback... + ... + '123.b' cannot be converted to a Double. +" + +fromstring_double_err = ( + run = ( + (Double fromString: '123.b') println. + ) +) diff --git a/IntegrationTests/Tests/fromstring_err.som b/IntegrationTests/Tests/fromstring_err.som new file mode 100644 index 00000000..e3fd238b --- /dev/null +++ b/IntegrationTests/Tests/fromstring_err.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stderr: + Traceback... + ... + '123b' cannot be converted to an Integer. +" + +fromstring_err = ( + run = ( + (Integer fromString: '123b') println. + ) +) diff --git a/IntegrationTests/Tests/fullgc.som b/IntegrationTests/Tests/fullgc.som new file mode 100644 index 00000000..a5954fe8 --- /dev/null +++ b/IntegrationTests/Tests/fullgc.som @@ -0,0 +1,13 @@ +" +VM: + status: success + stdout: true +" + +fullgc = ( + run = ( + | result | + result := system fullGC. + (result == true || (result == false)) println + ) +) diff --git a/IntegrationTests/Tests/hashcode.som b/IntegrationTests/Tests/hashcode.som new file mode 100644 index 00000000..003583bb --- /dev/null +++ b/IntegrationTests/Tests/hashcode.som @@ -0,0 +1,28 @@ +" +VM: + status: success + stdout: + true + true + true + true + true + true + true +" + +hashcode = ( + run = ( + self cmp: 'a' with: 'a'. + self cmp: 123 with: 123. + self cmp: self with: self. + self cmp: (1<<200) with: (1<<200). + self cmp: hashcode with: hashcode. + self cmp: (hashcode methods) with: (hashcode methods). + self cmp: (hashcode methods at: 1) with: (hashcode methods at: 1). + ) + + cmp: x with: y = ( + ((x hashcode) = (y hashcode)) println. + ) +) diff --git a/IntegrationTests/Tests/hashcode2.som b/IntegrationTests/Tests/hashcode2.som new file mode 100644 index 00000000..0b73137e --- /dev/null +++ b/IntegrationTests/Tests/hashcode2.som @@ -0,0 +1,25 @@ +" +VM: + status: success + stdout: + true + true + true +" + +hashcode2 = ( + run = ( + | litArray block | + self cmp: 1.1 with: 1.1. + + litArray := #(). + block := []. + + self cmp: litArray with: litArray. + self cmp: block with: block. + ) + + cmp: x with: y = ( + ((x hashcode) = (y hashcode)) println. + ) +) diff --git a/IntegrationTests/Tests/hello_world1.som b/IntegrationTests/Tests/hello_world1.som new file mode 100644 index 00000000..8b057730 --- /dev/null +++ b/IntegrationTests/Tests/hello_world1.som @@ -0,0 +1,9 @@ +" +VM: + status: success + stdout: Hello world +" + +hello_world1 = ( + run = ( 'Hello world' println ) +) diff --git a/IntegrationTests/Tests/hello_world2.som b/IntegrationTests/Tests/hello_world2.som new file mode 100644 index 00000000..69644bd1 --- /dev/null +++ b/IntegrationTests/Tests/hello_world2.som @@ -0,0 +1,14 @@ +" +VM: + status: success + stdout: Hello world +" + +hello_world2 = ( + run = ( + | t1 t2 | + t1 := 'Hello '. + t2 := t1 concatenate: 'world'. + t2 println. + ) +) diff --git a/IntegrationTests/Tests/ic1.som b/IntegrationTests/Tests/ic1.som new file mode 100644 index 00000000..8152de74 --- /dev/null +++ b/IntegrationTests/Tests/ic1.som @@ -0,0 +1,27 @@ +" +VM: + status: success + stdout: + 5 + ab + 5.2 + 5 + ab + 5.2 +" + +"Test that inline caches update properly even if the receiver class at a given +location changes." + +ic1 = ( + f: lhs rhs: rhs = ( ^(lhs + rhs) ) + + run = ( + (self f: 2 rhs: 3) println. + (self f: 'a' rhs: 'b') println. + (self f: 2.1 rhs: 3.1) println. + (self f: 2 rhs: 3) println. + (self f: 'a' rhs: 'b') println. + (self f: 2.1 rhs: 3.1) println. + ) +) diff --git a/IntegrationTests/Tests/inst_var_at.som b/IntegrationTests/Tests/inst_var_at.som new file mode 100644 index 00000000..4c59d1da --- /dev/null +++ b/IntegrationTests/Tests/inst_var_at.som @@ -0,0 +1,14 @@ +" +VM: + status: success + stdout: 5 +" + +inst_var_at = ( + | x | + + run = ( + x := 5. + (self instVarAt: 1) println. + ) +) diff --git a/IntegrationTests/Tests/inst_var_at_bad_idx.som b/IntegrationTests/Tests/inst_var_at_bad_idx.som new file mode 100644 index 00000000..a4f6abcb --- /dev/null +++ b/IntegrationTests/Tests/inst_var_at_bad_idx.som @@ -0,0 +1,17 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Index 2 not valid for array of length 1. +" + +inst_var_at_bad_idx = ( + | x | + + run = ( + x := 5. + (self instVarAt: 2) println. + ) +) diff --git a/IntegrationTests/Tests/inst_var_at_put.som b/IntegrationTests/Tests/inst_var_at_put.som new file mode 100644 index 00000000..347e1233 --- /dev/null +++ b/IntegrationTests/Tests/inst_var_at_put.som @@ -0,0 +1,19 @@ +" +VM: + status: success + stdout: + 5 + instance of inst_var_at_put + 6 +" + +inst_var_at_put = ( + | x | + + run = ( + x := 5. + (self instVarAt: 1) println. + (self instVarAt: 1 put: 6) println. + x println. + ) +) diff --git a/IntegrationTests/Tests/inst_var_at_put_bad_idx.som b/IntegrationTests/Tests/inst_var_at_put_bad_idx.som new file mode 100644 index 00000000..36fe2477 --- /dev/null +++ b/IntegrationTests/Tests/inst_var_at_put_bad_idx.som @@ -0,0 +1,18 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Index 2 not valid for array of length 1. +" + +inst_var_at_put_bad_idx = ( + | x | + + run = ( + x := 5. + self instVarAt: 2 put: 6. + x println. + ) +) diff --git a/IntegrationTests/Tests/inst_var_at_put_superclass/test.som b/IntegrationTests/Tests/inst_var_at_put_superclass/test.som new file mode 100644 index 00000000..b06117ef --- /dev/null +++ b/IntegrationTests/Tests/inst_var_at_put_superclass/test.som @@ -0,0 +1,25 @@ +" +VM: + status: success + stdout: + 1 + 2 + 4 + 3 +" + +test = test_super ( + | d c | + + run = ( + self instVarAt: 1 put: 1. + self instVarAt: 2 put: 2. + self instVarAt: 3 put: 3. + self instVarAt: 4 put: 4. + + a println. + b println. + c println. + d println. + ) +) diff --git a/IntegrationTests/Tests/inst_var_at_put_superclass/test_super.som b/IntegrationTests/Tests/inst_var_at_put_superclass/test_super.som new file mode 100644 index 00000000..7b3eada6 --- /dev/null +++ b/IntegrationTests/Tests/inst_var_at_put_superclass/test_super.som @@ -0,0 +1,10 @@ +test_super = ( + | a b | + + f = ( + (self instVarAt: 1) println. + (self instVarAt: 2) println. + (self instVarAt: 3) println. + (self instVarAt: 4) println. + ) +) diff --git a/IntegrationTests/Tests/instance_fields.som b/IntegrationTests/Tests/instance_fields.som new file mode 100644 index 00000000..c8ce65c0 --- /dev/null +++ b/IntegrationTests/Tests/instance_fields.som @@ -0,0 +1,19 @@ +" +VM: + status: success + stdout: + instance of Array + true + true +" + +instance_fields = ( + | x y | + run = ( + | fds | + fds := instance_fields fields. + fds println. + (fds contains: #x) println. + (fds contains: #y) println. + ) +) diff --git a/IntegrationTests/Tests/instance_fields_overlap/test.som b/IntegrationTests/Tests/instance_fields_overlap/test.som new file mode 100644 index 00000000..709135a7 --- /dev/null +++ b/IntegrationTests/Tests/instance_fields_overlap/test.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ...test.som', line 10, column 23: + test = test_super ( | a | + Field 'a' is already defined in a superclass. +" + +test = test_super ( | a | + run = ( + ) +) diff --git a/IntegrationTests/Tests/instance_fields_overlap/test_super.som b/IntegrationTests/Tests/instance_fields_overlap/test_super.som new file mode 100644 index 00000000..f5f95b34 --- /dev/null +++ b/IntegrationTests/Tests/instance_fields_overlap/test_super.som @@ -0,0 +1,3 @@ +test_super = ( + | a | +) diff --git a/IntegrationTests/Tests/instance_fields_overlap2.som b/IntegrationTests/Tests/instance_fields_overlap2.som new file mode 100644 index 00000000..c3df4490 --- /dev/null +++ b/IntegrationTests/Tests/instance_fields_overlap2.som @@ -0,0 +1,12 @@ +" +VM: + status: error + stderr: + ...instance_fields_overlap2.som', line 11, column 9: + | a a | + Field 'a' has already been defined in this class. +" + +instance_fields_overlap2 = ( + | a a | +) diff --git a/IntegrationTests/Tests/instance_var_in_block.som b/IntegrationTests/Tests/instance_var_in_block.som new file mode 100644 index 00000000..913340ff --- /dev/null +++ b/IntegrationTests/Tests/instance_var_in_block.som @@ -0,0 +1,15 @@ +" +VM: + status: success + stdout: + 1 +" + +instance_var_in_block = ( + |y| + run = ( + y := 0. + [ y := y + 1 ] value. + y println. + ) +) diff --git a/IntegrationTests/Tests/instance_vars1.som b/IntegrationTests/Tests/instance_vars1.som new file mode 100644 index 00000000..a25ef33b --- /dev/null +++ b/IntegrationTests/Tests/instance_vars1.som @@ -0,0 +1,16 @@ +" +VM: + status: success + stdout: Hello world +" + +instance_vars1 = ( + | hello | + + assign_hello = ( hello := 'Hello' ) + + run = ( + self assign_hello. + (hello concatenate: ' world') println. + ) +) diff --git a/IntegrationTests/Tests/instance_vars_subclass/ivsc.som b/IntegrationTests/Tests/instance_vars_subclass/ivsc.som new file mode 100644 index 00000000..dffb51be --- /dev/null +++ b/IntegrationTests/Tests/instance_vars_subclass/ivsc.som @@ -0,0 +1,7 @@ +ivsc = ( + | i | + + f = ( + i := i + 1. + ) +) diff --git a/IntegrationTests/Tests/instance_vars_subclass/test.som b/IntegrationTests/Tests/instance_vars_subclass/test.som new file mode 100644 index 00000000..d0c60638 --- /dev/null +++ b/IntegrationTests/Tests/instance_vars_subclass/test.som @@ -0,0 +1,14 @@ +" +VM: + status: success + stdout: + 2 +" + +test = ivsc ( + run = ( + i := 1. + self f. + i println. + ) +) diff --git a/IntegrationTests/Tests/int1.som b/IntegrationTests/Tests/int1.som new file mode 100644 index 00000000..e9a7b17c --- /dev/null +++ b/IntegrationTests/Tests/int1.som @@ -0,0 +1,14 @@ +" +VM: + status: success + stdout: + 1 + -1 +" + +int1 = ( + run = ( + 1 println. + -1 println. + ) +) diff --git a/IntegrationTests/Tests/int10.som b/IntegrationTests/Tests/int10.som new file mode 100644 index 00000000..d85ec2ad --- /dev/null +++ b/IntegrationTests/Tests/int10.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int10 = ( + run = ( + 0 + 'a' + ) +) diff --git a/IntegrationTests/Tests/int11.som b/IntegrationTests/Tests/int11.som new file mode 100644 index 00000000..3ec34427 --- /dev/null +++ b/IntegrationTests/Tests/int11.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int11 = ( + run = ( + 0 - 'a' + ) +) diff --git a/IntegrationTests/Tests/int12.som b/IntegrationTests/Tests/int12.som new file mode 100644 index 00000000..05c16448 --- /dev/null +++ b/IntegrationTests/Tests/int12.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int12 = ( + run = ( + 0 * 'a' + ) +) diff --git a/IntegrationTests/Tests/int13.som b/IntegrationTests/Tests/int13.som new file mode 100644 index 00000000..5f154666 --- /dev/null +++ b/IntegrationTests/Tests/int13.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int13 = ( + run = ( + 0 / 'a' + ) +) diff --git a/IntegrationTests/Tests/int14.som b/IntegrationTests/Tests/int14.som new file mode 100644 index 00000000..dc2e43d8 --- /dev/null +++ b/IntegrationTests/Tests/int14.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int14 = ( + run = ( + 0 > 'a' + ) +) diff --git a/IntegrationTests/Tests/int15.som b/IntegrationTests/Tests/int15.som new file mode 100644 index 00000000..e93b81fc --- /dev/null +++ b/IntegrationTests/Tests/int15.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int15 = ( + run = ( + 0 >= 'a' + ) +) diff --git a/IntegrationTests/Tests/int16.som b/IntegrationTests/Tests/int16.som new file mode 100644 index 00000000..3ecc42e0 --- /dev/null +++ b/IntegrationTests/Tests/int16.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int16 = ( + run = ( + 0 < 'a' + ) +) diff --git a/IntegrationTests/Tests/int17.som b/IntegrationTests/Tests/int17.som new file mode 100644 index 00000000..d982d8cf --- /dev/null +++ b/IntegrationTests/Tests/int17.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int17 = ( + run = ( + 0 <= 'a' + ) +) diff --git a/IntegrationTests/Tests/int18.som b/IntegrationTests/Tests/int18.som new file mode 100644 index 00000000..f14a968f --- /dev/null +++ b/IntegrationTests/Tests/int18.som @@ -0,0 +1,18 @@ +" +VM: + status: success + stdout: + false + true + false + true +" + +int18 = ( + run = ( + (0 = 'a') println. + (0 ~= 'a') println. + ((4611686018427387904 * 2) = 'a') println. + ((4611686018427387904 * 2) ~= 'a') println. + ) +) diff --git a/IntegrationTests/Tests/int19.som b/IntegrationTests/Tests/int19.som new file mode 100644 index 00000000..e3308f79 --- /dev/null +++ b/IntegrationTests/Tests/int19.som @@ -0,0 +1,51 @@ +" +VM: + status: success + stdout: + 4 + 2147483648 + 4294967296 + 1152921504606846976 + 9223372036854775808 + 18446744073709551616 + 170141183460469231731687303715884105728 + 340282366920938463463374607431768211456 + 1606938044258990275541962092341162602522202993782792835301376 + 8148143905337944345073782753637512644205873574663745002544561797417525199053346824733589504 + -4 + -2147483648 + -4294967296 + -1152921504606846976 + -9223372036854775808 + -18446744073709551616 + -170141183460469231731687303715884105728 + -340282366920938463463374607431768211456 + -1606938044258990275541962092341162602522202993782792835301376 + -8148143905337944345073782753637512644205873574663745002544561797417525199053346824733589504 +" + +int19 = ( + run = ( + (1 << 2) println. + (1 << 31) println. + (1 << 32) println. + (1 << 60) println. + (1 << 63) println. + (1 << 64) println. + (1 << 127) println. + (1 << 128) println. + (1 << 200) println. + ((1 << 300) << 2) println. + + (-1 << 2) println. + (-1 << 31) println. + (-1 << 32) println. + (-1 << 60) println. + (-1 << 63) println. + (-1 << 64) println. + (-1 << 127) println. + (-1 << 128) println. + (-1 << 200) println. + ((-1 << 300) << 2) println. + ) +) diff --git a/IntegrationTests/Tests/int2.som b/IntegrationTests/Tests/int2.som new file mode 100644 index 00000000..971d9e52 --- /dev/null +++ b/IntegrationTests/Tests/int2.som @@ -0,0 +1,26 @@ +" +VM: + status: success + stdout: + 2 + 0 + -1 + 1 + 20 + 4 + -2 + -2 +" + +int2 = ( + run = ( + (1 + 1) println. + (1 - 1) println. + ((1 - 1) - 1) println. + (1 - (1 - 1)) println. + (2 + 3 * 4) println. + (20 / 5) println. + (4 / -2) println. + (-4 / 2) println. + ) +) diff --git a/IntegrationTests/Tests/int20.som b/IntegrationTests/Tests/int20.som new file mode 100644 index 00000000..64f5a517 --- /dev/null +++ b/IntegrationTests/Tests/int20.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Shift too big. +" + +int20 = ( + run = ( + 1 << (1 << 200). + ) +) diff --git a/IntegrationTests/Tests/int21.som b/IntegrationTests/Tests/int21.som new file mode 100644 index 00000000..bacfdc02 --- /dev/null +++ b/IntegrationTests/Tests/int21.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Negative shift. +" + +int21 = ( + run = ( + 1 << -1. + ) +) diff --git a/IntegrationTests/Tests/int22.som b/IntegrationTests/Tests/int22.som new file mode 100644 index 00000000..8cb59049 --- /dev/null +++ b/IntegrationTests/Tests/int22.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Shift too big. +" + +int22 = ( + run = ( + (1 << 200) << (1 << 150). + ) +) diff --git a/IntegrationTests/Tests/int23.som b/IntegrationTests/Tests/int23.som new file mode 100644 index 00000000..d69d0bef --- /dev/null +++ b/IntegrationTests/Tests/int23.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +int23 = ( + run = ( + 1 / 0.0 + ) +) diff --git a/IntegrationTests/Tests/int24.som b/IntegrationTests/Tests/int24.som new file mode 100644 index 00000000..a157a9e8 --- /dev/null +++ b/IntegrationTests/Tests/int24.som @@ -0,0 +1,18 @@ +" +VM: + status: success + stdout: + 1 + 1606938044258990275541962092341162602522202993782792835301377 + 176763184868488930309615830157527886277442329316107211883151360 + 17676318486848893030961583015752788627744232931610721188315137 +" + +int24 = ( + run = ( + (5 bitXor: 4) println. + ((1 << 200) bitXor: 1) println. + ((1 << 200) bitXor: (111 << 200)) println. + (1 bitXor: (11 << 200)) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/int25.som b/IntegrationTests/Tests/int25.som new file mode 100644 index 00000000..1ee0f400 --- /dev/null +++ b/IntegrationTests/Tests/int25.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected object of type 'Int' but got type 'String_'. +" + +int25 = ( + run = ( + 1 bitXor: 'a'. + ) +) diff --git a/IntegrationTests/Tests/int26.som b/IntegrationTests/Tests/int26.som new file mode 100644 index 00000000..85bb233d --- /dev/null +++ b/IntegrationTests/Tests/int26.som @@ -0,0 +1,16 @@ +" +VM: + status: success + stdout: + 5 + 1267650600228229401496703205376 + 1.7320508075688772 +" + +int26 = ( + run = ( + (25 sqrt) println. + ((1 << 200) sqrt) println. + (3 sqrt) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/int27.som b/IntegrationTests/Tests/int27.som new file mode 100644 index 00000000..3c7d4ffc --- /dev/null +++ b/IntegrationTests/Tests/int27.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Domain error. +" + +int27 = ( + run = ( + -1 sqrt. + ) +) diff --git a/IntegrationTests/Tests/int28.som b/IntegrationTests/Tests/int28.som new file mode 100644 index 00000000..b5be9811 --- /dev/null +++ b/IntegrationTests/Tests/int28.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Domain error. +" + +int28 = ( + run = ( + (-1 << 200) sqrt. + ) +) diff --git a/IntegrationTests/Tests/int29.som b/IntegrationTests/Tests/int29.som new file mode 100644 index 00000000..e55cc1d7 --- /dev/null +++ b/IntegrationTests/Tests/int29.som @@ -0,0 +1,18 @@ +" +VM: + status: success + stdout: + Integer + Integer + Double + Integer +" + +int29 = ( + run = ( + (4 sqrt class) println. + ((1 << 200) sqrt class) println. + (3 sqrt class) println. + ((1 << 199) sqrt class) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/int3.som b/IntegrationTests/Tests/int3.som new file mode 100644 index 00000000..6c3fcf7a --- /dev/null +++ b/IntegrationTests/Tests/int3.som @@ -0,0 +1,26 @@ +" +VM: + status: success + stdout: + 9223372036854775808 + 9223372036854775808 + 21267647932558653966460912964485513216 + -13835058055282163712 + -21267647932558653966460912964485513216 + 21267647932558653966460912964485513214 + 18446744073709551616 + 10633823966279326983230456482242756608 +" + +int3 = ( + run = ( + (4611686018427387904 + 4611686018427387904) println. + (4611686018427387904 * 2) println. + (4611686018427387904 * 4611686018427387904) println. + (-4611686018427387904 - 4611686018427387904 - 4611686018427387904) println. + (4611686018427387904 * -4611686018427387904) println. + ((4611686018427387904 * 4611686018427387904) - 2) println. + (4611686018427387904 * 2 * 2) println. + ((4611686018427387904 * 4611686018427387904) / 2) println. + ) +) diff --git a/IntegrationTests/Tests/int30.som b/IntegrationTests/Tests/int30.som new file mode 100644 index 00000000..d730aee1 --- /dev/null +++ b/IntegrationTests/Tests/int30.som @@ -0,0 +1,18 @@ +" +VM: + status: success + stdout: + 4 + 0 + 1606938044258990275541962092341162602522202993782792835301376 + 0 +" + +int30 = ( + run = ( + (5 & 4) println. + ((1 << 200) & 1) println. + ((1 << 200) & (111 << 200)) println. + (1 & (11 << 200)) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/int31.som b/IntegrationTests/Tests/int31.som new file mode 100644 index 00000000..340bca7b --- /dev/null +++ b/IntegrationTests/Tests/int31.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected object of type 'Int' but got type 'String_'. +" + +int31 = ( + run = ( + 1 & 'a'. + ) +) diff --git a/IntegrationTests/Tests/int32.som b/IntegrationTests/Tests/int32.som new file mode 100644 index 00000000..af4e72eb --- /dev/null +++ b/IntegrationTests/Tests/int32.som @@ -0,0 +1,36 @@ +" +VM: + status: success + stdout: + 4 + 256 + 65536 + 4294967296 + 9223372036854775808 + 18446744073709551616 + 1267650600228229401496703205376 + -128 + 256 +" + +int32 = ( + run = ( + (self raisedTo: 2 exponent: 2) println. + (self raisedTo: 2 exponent: 8) println. + (self raisedTo: 2 exponent: 16) println. + (self raisedTo: 2 exponent: 32) println. + (self raisedTo: 2 exponent: 63) println. + (self raisedTo: 2 exponent: 64) println. + (self raisedTo: 2 exponent: 100) println. + + (self raisedTo: -2 exponent: 7) println. + (self raisedTo: -2 exponent: 8) println. + ) + + raisedTo: v exponent: e = ( + | x | + x := 1. + e timesRepeat: [ x := x * v ]. + ^ x + ) +) diff --git a/IntegrationTests/Tests/int4.som b/IntegrationTests/Tests/int4.som new file mode 100644 index 00000000..9138efdf --- /dev/null +++ b/IntegrationTests/Tests/int4.som @@ -0,0 +1,32 @@ +" +VM: + status: success + stdout: + true + false + false + false + false + true + false + false + true + true + true +" + +int4 = ( + run = ( + ((4611686018427387904 * 2) = (4611686018427387904 * 2)) println. + ((4611686018427387904 * 2) = 1) println. + ((4611686018427387904 * 2) = ((4611686018427387904 * 2) - 1)) println. + ((4611686018427387904 * 2) < (4611686018427387904 * 2)) println. + ((4611686018427387904 * 2) < 1) println. + ((4611686018427387904 * 2) <= (4611686018427387904 * 2)) println. + ((4611686018427387904 * 2) <= 1) println. + ((4611686018427387904 * 2) > (4611686018427387904 * 2)) println. + ((4611686018427387904 * 2) > 1) println. + ((4611686018427387904 * 2) >= ((4611686018427387904 * 2) - 1)) println. + ((4611686018427387904 * 2) >= 1) println. + ) +) diff --git a/IntegrationTests/Tests/int5.som b/IntegrationTests/Tests/int5.som new file mode 100644 index 00000000..a23b3d6b --- /dev/null +++ b/IntegrationTests/Tests/int5.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +int5 = ( + run = ( 10 / 0 ) +) diff --git a/IntegrationTests/Tests/int6.som b/IntegrationTests/Tests/int6.som new file mode 100644 index 00000000..03e6c9d6 --- /dev/null +++ b/IntegrationTests/Tests/int6.som @@ -0,0 +1,46 @@ +" +VM: + status: success + stdout: + false + true + true + false + false + true + false + false + false + true + true + false + true + true + true + false +" + +int6 = ( + run = ( + (1 = 0) println. + (1 = 1) println. + (1 ~= 0) println. + (1 ~= 1) println. + + (1 < 1) println. + (1 < 2) println. + (2 < 0) println. + + (1 > 1) println. + (1 > 2) println. + (2 > 0) println. + + (1 >= 1) println. + (1 >= 2) println. + (2 >= 0) println. + + (1 <= 1) println. + (1 <= 2) println. + (2 <= 0) println. + ) +) diff --git a/IntegrationTests/Tests/int7.som b/IntegrationTests/Tests/int7.som new file mode 100644 index 00000000..f1bc91f9 --- /dev/null +++ b/IntegrationTests/Tests/int7.som @@ -0,0 +1,16 @@ +" +VM: + status: success + stdout: + 1 + 2 + 3 + 4 + 5 +" + +int7 = ( + run = ( + 1 to: 5 do: [ :i | i println. ]. + ) +) diff --git a/IntegrationTests/Tests/int8.som b/IntegrationTests/Tests/int8.som new file mode 100644 index 00000000..6352500c --- /dev/null +++ b/IntegrationTests/Tests/int8.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +int8 = ( + run = ( + 1 / 0 + ) +) diff --git a/IntegrationTests/Tests/int9.som b/IntegrationTests/Tests/int9.som new file mode 100644 index 00000000..861aa573 --- /dev/null +++ b/IntegrationTests/Tests/int9.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +int9 = ( + run = ( + (4611686018427387904 * 2) / 0 + ) +) diff --git a/IntegrationTests/Tests/int_double_div.som b/IntegrationTests/Tests/int_double_div.som new file mode 100644 index 00000000..d0c7cabc --- /dev/null +++ b/IntegrationTests/Tests/int_double_div.som @@ -0,0 +1,24 @@ +" +VM: + status: success + stdout: + 5.0 + 0.5 + 6.223015277861142e-61 + 2.0 + 0.5 + 8.034690221294951e59 + 2.6666666666666665 +" + +int_double_div = ( + run = ( + (10 // 2) println. + (1 // 2) println. + (1 // (1 << 200)) println. + ((1 << 200) // (1 << 199)) println. + ((1 << 199) // (1 << 200)) println. + ((1 << 200) // 2) println. + ((1 << 65) // (3 << 62)) println. + ) +) diff --git a/IntegrationTests/Tests/int_double_div_err.som b/IntegrationTests/Tests/int_double_div_err.som new file mode 100644 index 00000000..9fc6f134 --- /dev/null +++ b/IntegrationTests/Tests/int_double_div_err.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int_double_div_err = ( + run = ( + 1 // 'a' + ) +) diff --git a/IntegrationTests/Tests/int_double_div_zero_err.som b/IntegrationTests/Tests/int_double_div_zero_err.som new file mode 100644 index 00000000..904d1266 --- /dev/null +++ b/IntegrationTests/Tests/int_double_div_zero_err.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stderr: + ... + Division by zero. +" + +int_double_div_zero_err = ( + run = ( 10 // 0 ) +) diff --git a/IntegrationTests/Tests/int_modulus.som b/IntegrationTests/Tests/int_modulus.som new file mode 100644 index 00000000..2b0d9d58 --- /dev/null +++ b/IntegrationTests/Tests/int_modulus.som @@ -0,0 +1,28 @@ +" +VM: + status: success + stdout: + 1 + 0 + 1606938044258990275541962092341162602522202993782792835301376 + 1 + 1 + -2 + -1606938044258990275541962092341162602522202993782792835301373 + -2 + 9671406556917033397649408 +" + +int_modulus = ( + run = ( + (5 % 4) println. + ((1 << 200) % 1) println. + ((1 << 200) % (111 << 200)) println. + (1 % (11 << 200)) println. + (10 % 3) println. + (10 % -3) println. + (3 % (-1 << 200)) println. + ((1 << 200) % -3) println. + ((1 << 999999) % (3 << 83)) println. + ) +) diff --git a/IntegrationTests/Tests/int_modulus_err.som b/IntegrationTests/Tests/int_modulus_err.som new file mode 100644 index 00000000..b5c95acd --- /dev/null +++ b/IntegrationTests/Tests/int_modulus_err.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected a numeric type but got type 'String_'. +" + +int_modulus_err = ( + run = ( + 1 % 'a' + ) +) diff --git a/IntegrationTests/Tests/integer_asdouble.som b/IntegrationTests/Tests/integer_asdouble.som new file mode 100644 index 00000000..e746a71f --- /dev/null +++ b/IntegrationTests/Tests/integer_asdouble.som @@ -0,0 +1,20 @@ +" +VM: + status: success + stdout: + 0.0 + 1.0 + -1.0 + 1.8446744073709552e19 + -1.8446744073709552e19 +" + +integer_asdouble = ( + run = ( + 0 asDouble println. + 1 asDouble println. + -1 asDouble println. + 18446744073709551616 asDouble println. + -18446744073709551616 asDouble println. + ) +) diff --git a/IntegrationTests/Tests/is_digits.som b/IntegrationTests/Tests/is_digits.som new file mode 100644 index 00000000..2d4d4665 --- /dev/null +++ b/IntegrationTests/Tests/is_digits.som @@ -0,0 +1,26 @@ +" +VM: + status: success + stdout: + true + true + true + true + false + false + false + false +" + +is_digits = ( + run = ( + '0' isDigits println. + '1' isDigits println. + '10' isDigits println. + '987987982347829374234' isDigits println. + '0b1' isDigits println. + '0_1' isDigits println. + 'a' isDigits println. + '' isDigits println. + ) +) diff --git a/IntegrationTests/Tests/is_letters.som b/IntegrationTests/Tests/is_letters.som new file mode 100644 index 00000000..78926b69 --- /dev/null +++ b/IntegrationTests/Tests/is_letters.som @@ -0,0 +1,22 @@ +" +VM: + status: success + stdout: + true + true + true + false + false + false +" + +is_letters = ( + run = ( + 'a' isLetters println. + 'abcdrohtra' isLetters println. + 'æ' isLetters println. + 'a0' isLetters println. + '¾' isLetters println. + '' isLetters println. + ) +) diff --git a/IntegrationTests/Tests/is_whitespace.som b/IntegrationTests/Tests/is_whitespace.som new file mode 100644 index 00000000..43d82da2 --- /dev/null +++ b/IntegrationTests/Tests/is_whitespace.som @@ -0,0 +1,23 @@ +" +VM: + status: success + stdout: + true + true + true + false + false +" + +is_whitespace = ( + run = ( + "Space" + ' ' isWhiteSpace println. + "Tab" + ' ' isWhiteSpace println. + "Space and tab" + ' ' isWhiteSpace println. + ' a ' isWhiteSpace println. + '' isWhiteSpace println. + ) +) diff --git a/IntegrationTests/Tests/keyword_super/superc.som b/IntegrationTests/Tests/keyword_super/superc.som new file mode 100644 index 00000000..0c478be7 --- /dev/null +++ b/IntegrationTests/Tests/keyword_super/superc.som @@ -0,0 +1,5 @@ +superc = ( + x: i = ( + (i + 1) println. + ) +) diff --git a/IntegrationTests/Tests/keyword_super/test.som b/IntegrationTests/Tests/keyword_super/test.som new file mode 100644 index 00000000..fb47e730 --- /dev/null +++ b/IntegrationTests/Tests/keyword_super/test.som @@ -0,0 +1,15 @@ +" +VM: + status: success + stdout: 2 +" + +test = superc ( + run = ( + super x: 1. + ) + + x: i = ( + i println. + ) +) diff --git a/IntegrationTests/Tests/lexical_super/A.som b/IntegrationTests/Tests/lexical_super/A.som new file mode 100644 index 00000000..bd0c933b --- /dev/null +++ b/IntegrationTests/Tests/lexical_super/A.som @@ -0,0 +1,3 @@ +A = ( + do = ( ^ #a ) +) diff --git a/IntegrationTests/Tests/lexical_super/B.som b/IntegrationTests/Tests/lexical_super/B.som new file mode 100644 index 00000000..645e85bb --- /dev/null +++ b/IntegrationTests/Tests/lexical_super/B.som @@ -0,0 +1,4 @@ +B = A ( + do = ( ^ #b ) + test = ( ^ super do ) +) diff --git a/IntegrationTests/Tests/lexical_super/C.som b/IntegrationTests/Tests/lexical_super/C.som new file mode 100644 index 00000000..36fca98a --- /dev/null +++ b/IntegrationTests/Tests/lexical_super/C.som @@ -0,0 +1,3 @@ +C = B ( + do = ( ^ #c ) +) diff --git a/IntegrationTests/Tests/lexical_super/test.som b/IntegrationTests/Tests/lexical_super/test.som new file mode 100644 index 00000000..69700b01 --- /dev/null +++ b/IntegrationTests/Tests/lexical_super/test.som @@ -0,0 +1,12 @@ +" +VM: + status: success + stdout: + #a +" + +test = ( + run = ( + C new test println. + ) +) diff --git a/IntegrationTests/Tests/load_file.som b/IntegrationTests/Tests/load_file.som new file mode 100644 index 00000000..9410755c --- /dev/null +++ b/IntegrationTests/Tests/load_file.som @@ -0,0 +1,15 @@ +" +VM: + status: success + stdout: + ... + hello_world1 = ( + run = ( 'Hello world' println ) + ) +" + +load_file = ( + run = ( + (system loadFile: 'core-lib/IntegrationTests/Tests/hello_world1.som') println. + ) +) diff --git a/IntegrationTests/Tests/load_string.som b/IntegrationTests/Tests/load_string.som new file mode 100644 index 00000000..5ca0b84a --- /dev/null +++ b/IntegrationTests/Tests/load_string.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Expected instance of 'Symbol' but got instance of 'String'. +" + +load_string = ( + run = ( + system load: 'Array'. + ) +) diff --git a/IntegrationTests/Tests/metaclasses.som b/IntegrationTests/Tests/metaclasses.som new file mode 100644 index 00000000..eac1e21e --- /dev/null +++ b/IntegrationTests/Tests/metaclasses.som @@ -0,0 +1,52 @@ +" +VM: + status: success + stdout: + 1 + Integer + Integer class + Metaclass + Metaclass class + Metaclass + Metaclass class + Class + Object class + Class + Boolean class + Class + Object + nil + Class class + Metaclass + Object + Object class + Metaclass + Class + nil +" + +metaclasses = ( + run = ( + 1 println. + 1 class println. + 1 class class println. + 1 class class class println. + 1 class class class class println. + 1 class class class class class println. + 1 class class class class class class println. + Class println. + Class class superclass println. + Class class superclass superclass println. + True class superclass println. + Class class superclass superclass println. + Class superclass println. + Class superclass superclass println. + Class class println. + Class class class println. + Object println. + Object class println. + Object class class println. + Object class superclass println. + Object superclass println. + ) +) diff --git a/IntegrationTests/Tests/method1.som b/IntegrationTests/Tests/method1.som new file mode 100644 index 00000000..2c275e8d --- /dev/null +++ b/IntegrationTests/Tests/method1.som @@ -0,0 +1,13 @@ +" +VM: + stdout: + a +" + +method1 = ( + f = ( ^ 'a' ) + + run = ( + self f println + ) +) diff --git a/IntegrationTests/Tests/method2.som b/IntegrationTests/Tests/method2.som new file mode 100644 index 00000000..5887112f --- /dev/null +++ b/IntegrationTests/Tests/method2.som @@ -0,0 +1,13 @@ +" +VM: + stdout: + instance of method2 +" + +method2 = ( + f = ( 'irrelevant' ) + + run = ( + self f println + ) +) diff --git a/IntegrationTests/Tests/method_holder.som b/IntegrationTests/Tests/method_holder.som new file mode 100644 index 00000000..f588f201 --- /dev/null +++ b/IntegrationTests/Tests/method_holder.som @@ -0,0 +1,19 @@ +" +VM: + status: success + stdout: + method_holder>>run + method_holder>>find: +" + +method_holder = ( + run = ( + | f | + (self find: #run) println. + (self find: #find:) println. + ) + + find: sym = ( + method_holder methods do: [:e | ((e signature) == sym) ifTrue: [ ^e ]]. + ) +) diff --git a/IntegrationTests/Tests/methods.som b/IntegrationTests/Tests/methods.som new file mode 100644 index 00000000..fcdacb17 --- /dev/null +++ b/IntegrationTests/Tests/methods.som @@ -0,0 +1,30 @@ +" +VM: + status: success + stdout: + 4 + #a:c: + #f + #find: + #run +" + +methods = ( + run = ( + | ms | + ms := methods methods copy. + ms length println. + self find: #a:c:. + self find: #f. + self find: #find:. + self find: #run. + ) + + find: sym = ( + methods methods do: [:e | ((e signature) == sym) ifTrue: [ sym println ]]. + ) + + f = ( ) + + a: b c: d = ( ) +) diff --git a/IntegrationTests/Tests/mutate_fields.som b/IntegrationTests/Tests/mutate_fields.som new file mode 100644 index 00000000..c9784f4e --- /dev/null +++ b/IntegrationTests/Tests/mutate_fields.som @@ -0,0 +1,29 @@ +" +VM: + status: success + stdout: + true + true + true + true + false +" + +mutate_fields = ( + | x y | + run = ( + | fds | + fds := mutate_fields fields. + (fds contains: #x) println. + (fds contains: #y) println. + fds at: 1 put: #z. + fds := mutate_fields fields. + (fds contains: #x) println. + (fds contains: #y) println. + (fds contains: #z) println. + ) + + find: sym = ( + method_holder methods do: [:e | ((e signature) == sym) ifTrue: [ ^e ]]. + ) +) diff --git a/IntegrationTests/Tests/mutate_methods.som b/IntegrationTests/Tests/mutate_methods.som new file mode 100644 index 00000000..c463656a --- /dev/null +++ b/IntegrationTests/Tests/mutate_methods.som @@ -0,0 +1,24 @@ +" +VM: + stdout: + #b + #c +" + +mutate_methods = ( + run = ( + | g_idx h_idx ms | + self f println. + ms := mutate_methods methods. + ms doIndexes: [:i | + (((ms at: i) signature) == #g) ifTrue: [ g_idx := i ]. + (((ms at: i) signature) == #h) ifTrue: [ h_idx := i ]. + ]. + mutate_methods methods at: g_idx put: (ms at: h_idx). + self f println. + ) + + f = ( ^self g ) + g = ( ^#b. ) + h = ( ^#c. ) +) diff --git a/IntegrationTests/Tests/mutate_superclass_method/test.som b/IntegrationTests/Tests/mutate_superclass_method/test.som new file mode 100644 index 00000000..a500ac14 --- /dev/null +++ b/IntegrationTests/Tests/mutate_superclass_method/test.som @@ -0,0 +1,21 @@ +" +VM: + status: success + stdout: + #b + #c +" + +test = test_super ( + run = ( + | g_idx h_idx ms | + self f println. + ms := test_super methods. + ms doIndexes: [:i | + (((ms at: i) signature) == #g) ifTrue: [ g_idx := i ]. + (((ms at: i) signature) == #h) ifTrue: [ h_idx := i ]. + ]. + test_super methods at: g_idx put: (ms at: h_idx). + self f println. + ) +) diff --git a/IntegrationTests/Tests/mutate_superclass_method/test_super.som b/IntegrationTests/Tests/mutate_superclass_method/test_super.som new file mode 100644 index 00000000..f48b42b8 --- /dev/null +++ b/IntegrationTests/Tests/mutate_superclass_method/test_super.som @@ -0,0 +1,5 @@ +test_super = ( + f = ( ^self g ) + g = ( ^#b. ) + h = ( ^#c. ) +) diff --git a/IntegrationTests/Tests/nested_backtrace1.som b/IntegrationTests/Tests/nested_backtrace1.som new file mode 100644 index 00000000..d476c812 --- /dev/null +++ b/IntegrationTests/Tests/nested_backtrace1.som @@ -0,0 +1,21 @@ +" +VM: + status: error + stderr: + Traceback (most recent call at bottom): + ... + ...nested_backtrace1.som, line 20, column 12: + run = ( self m ) + ...nested_backtrace1.som, line 17, column 18: + ifTrue: 1 / 0 + Division by zero. +" + +nested_backtrace1 = ( + m = ( + 1 == 0 + ifTrue: 1 / 0 + ifFalse: 2 / 0. + ) + run = ( self m ) +) diff --git a/IntegrationTests/Tests/nested_backtrace2.som b/IntegrationTests/Tests/nested_backtrace2.som new file mode 100644 index 00000000..85586752 --- /dev/null +++ b/IntegrationTests/Tests/nested_backtrace2.som @@ -0,0 +1,31 @@ +" +VM: + status: error + stderr: + Traceback (most recent call at bottom): + ... + ...nested_backtrace2.som, line 30, column 12: + run = ( self m ) + ...nested_backtrace2.som, line 26, column 8: + 1 == 0 + ifTrue: [ 1 / 0 ] + ifFalse: [ 2 / 0 ]. + ...Boolean.som... + self ifFalse: [ ^falseBlock value ]. + ...False.som... + ifFalse: block = ( ^block value ) + ...Boolean.som... + self ifFalse: [ ^falseBlock value ]. + ...nested_backtrace2.som, line 28, column 21: + ifFalse: [ 2 / 0 ]. + Division by zero. +" + +nested_backtrace2 = ( + m = ( + 1 == 0 + ifTrue: [ 1 / 0 ] + ifFalse: [ 2 / 0 ]. + ) + run = ( self m ) +) diff --git a/IntegrationTests/Tests/obj1.som b/IntegrationTests/Tests/obj1.som new file mode 100644 index 00000000..a6d14257 --- /dev/null +++ b/IntegrationTests/Tests/obj1.som @@ -0,0 +1,29 @@ +" +VM: + status: success + stdout: + true + false + false + true + true + true + false + false + true +" + +obj1 = ( + run = ( + (1 == 1) println. + (1 <> 1) println. + (1 ~= 1) println. + (1 <> 2) println. + (1 ~= 2) println. + + (self == self) println. + (self <> self) println. + (self == 'a') println. + (self <> 'a') println. + ) +) diff --git a/IntegrationTests/Tests/obj2.som b/IntegrationTests/Tests/obj2.som new file mode 100644 index 00000000..3ca89385 --- /dev/null +++ b/IntegrationTests/Tests/obj2.som @@ -0,0 +1,31 @@ +" +VM: + status: success + stdout: + true + true + true + true + true + true + true + true + false + true +" + +obj2 = ( + run = ( + (1 == 1) println. + (100 == 100) println. + ((1 << 200) == (1 << 200)) println. + (1.0 == 1.0) println. + (1.0 == 1) println. + (1 == 1.0) println. + + (1.0 = 1.0) println. + (1 = 1.0) println. + (1 = 1.1) println. + (1.0 = 1) println. + ) +) diff --git a/IntegrationTests/Tests/objects_evaluate_to_themselves.som b/IntegrationTests/Tests/objects_evaluate_to_themselves.som new file mode 100644 index 00000000..6dbb4d0e --- /dev/null +++ b/IntegrationTests/Tests/objects_evaluate_to_themselves.som @@ -0,0 +1,15 @@ +" +VM: + stdout: + 1 + true + a +" + +objects_evaluate_to_themselves = ( + run = ( + 1 value println. + true value println. + 'a' value println. + ) +) diff --git a/IntegrationTests/Tests/perform.som b/IntegrationTests/Tests/perform.som new file mode 100644 index 00000000..1c630fcc --- /dev/null +++ b/IntegrationTests/Tests/perform.som @@ -0,0 +1,13 @@ +" +VM: + status: success + stdout: #a +" + +perform = ( + run = ( + (self perform: #f) println. + ) + + f = ( ^#a ) +) diff --git a/IntegrationTests/Tests/perform_in_superclass.som b/IntegrationTests/Tests/perform_in_superclass.som new file mode 100644 index 00000000..1897323e --- /dev/null +++ b/IntegrationTests/Tests/perform_in_superclass.som @@ -0,0 +1,18 @@ +" +VM: + status: success + stdout: + 2 + instance of perform_in_superclass +" + +perform_in_superclass = ( + run = ( + self println. + self perform: #println inSuperclass: Object. + ) + + println = ( + 2 println. + ) +) diff --git a/IntegrationTests/Tests/perform_in_superclass_with_args.som b/IntegrationTests/Tests/perform_in_superclass_with_args.som new file mode 100644 index 00000000..6c4b8bb3 --- /dev/null +++ b/IntegrationTests/Tests/perform_in_superclass_with_args.som @@ -0,0 +1,20 @@ +" +VM: + status: success + stdout: + 2 + 4 + instance of perform_in_superclass_with_args +" + +perform_in_superclass_with_args = ( + run = ( + (self ifNil: 2) println. + (self perform: #ifNil: withArguments: #(3) inSuperclass: Object) println. + ) + + ifNil: aBlock = ( + aBlock println. + ^ 4. + ) +) diff --git a/IntegrationTests/Tests/perform_string.som b/IntegrationTests/Tests/perform_string.som new file mode 100644 index 00000000..398f7c2b --- /dev/null +++ b/IntegrationTests/Tests/perform_string.som @@ -0,0 +1,16 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Expected instance of 'Symbol' but got instance of 'String'. +" + +perform_string = ( + run = ( + (self perform: 'f') println. + ) + + f = ( ^#a ) +) diff --git a/IntegrationTests/Tests/perform_unknown.som b/IntegrationTests/Tests/perform_unknown.som new file mode 100644 index 00000000..46bd51dd --- /dev/null +++ b/IntegrationTests/Tests/perform_unknown.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stdout: ERROR: Method f not found in class perform_unknown +" + +perform_unknown = ( + run = ( + (self perform: #f) println. + ) +) diff --git a/IntegrationTests/Tests/perform_witharguments.som b/IntegrationTests/Tests/perform_witharguments.som new file mode 100644 index 00000000..e0027f6c --- /dev/null +++ b/IntegrationTests/Tests/perform_witharguments.som @@ -0,0 +1,20 @@ +" +VM: + status: success + stdout: + 5 + 6 + 7 +" + +perform_witharguments = ( + run = ( + self perform: #f:b:c: withArguments: #(5 6 7). + ) + + f: a b: b c: c = ( + a println. + b println. + c println. + ) +) diff --git a/IntegrationTests/Tests/perform_witharguments_wrong.som b/IntegrationTests/Tests/perform_witharguments_wrong.som new file mode 100644 index 00000000..96828f77 --- /dev/null +++ b/IntegrationTests/Tests/perform_witharguments_wrong.som @@ -0,0 +1,20 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Tried passing 1 arguments to a function that requires 3. +" + +perform_witharguments_wrong = ( + run = ( + self perform: #f:b:c: withArguments: #(5). + ) + + f: a b: b c: c = ( + a println. + b println. + c println. + ) +) diff --git a/IntegrationTests/Tests/positive_infinity.som b/IntegrationTests/Tests/positive_infinity.som new file mode 100644 index 00000000..4ff5c03f --- /dev/null +++ b/IntegrationTests/Tests/positive_infinity.som @@ -0,0 +1,11 @@ +" +VM: + status: success + stdout: inf... +" + +positive_infinity = ( + run = ( + Double PositiveInfinity println. + ) +) diff --git a/IntegrationTests/Tests/remainder.som b/IntegrationTests/Tests/remainder.som new file mode 100644 index 00000000..b928d093 --- /dev/null +++ b/IntegrationTests/Tests/remainder.som @@ -0,0 +1,14 @@ +" +VM: + status: success + stdout: + 1 + 2 +" + +remainder = ( + run = ( + (10 rem: 3) println. + (20 rem: 3) println. + ) +) diff --git a/IntegrationTests/Tests/remainder_zero.som b/IntegrationTests/Tests/remainder_zero.som new file mode 100644 index 00000000..af47546d --- /dev/null +++ b/IntegrationTests/Tests/remainder_zero.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Division by zero or overflow. +" + +remainder_zero = ( + run = ( + (10 rem: 0) println. + ) +) diff --git a/IntegrationTests/Tests/round.som b/IntegrationTests/Tests/round.som new file mode 100644 index 00000000..8246dc3c --- /dev/null +++ b/IntegrationTests/Tests/round.som @@ -0,0 +1,27 @@ +" +VM: + status: success + stdout: + 1 + 1 + 2 + -1 + -1 + -2 + 1606938044258990275541962092341162602522202993782792835301376 + -1606938044258990275541962092341162602522202993782792835301376 +" + +round = ( + run = ( + 1.0 round println. + 1.1 round println. + 1.9 round println. + -1.0 round println. + -1.1 round println. + -1.9 round println. + + ((1 << 200) + 1.1) round println. + ((-1 << 200) - 1.1) round println. + ) +) diff --git a/IntegrationTests/Tests/shift_right.som b/IntegrationTests/Tests/shift_right.som new file mode 100644 index 00000000..36bcb467 --- /dev/null +++ b/IntegrationTests/Tests/shift_right.som @@ -0,0 +1,25 @@ +" +VM: + status: success + stdout: + 0 + 512 + 127 + -1 + 9223372036854775807 + 9223372036854775296 + 1 +" + +shift_right = ( + run = ( + (1 >>> 1) println. + (1024 >>> 1) println. + (1023 >>> 3) println. + (-1 >>> 0) println. + (-1 >>> 1) println. + (-1024 >>> 1) println. + + ((1 << 200) >>> 200) println. + ) +) diff --git a/IntegrationTests/Tests/shift_right_too_big.som b/IntegrationTests/Tests/shift_right_too_big.som new file mode 100644 index 00000000..e24f339e --- /dev/null +++ b/IntegrationTests/Tests/shift_right_too_big.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Shift too big. +" + +shift_right = ( + run = ( + 1 >>> (1 << 100). + ) +) diff --git a/IntegrationTests/Tests/shift_right_type_err.som b/IntegrationTests/Tests/shift_right_type_err.som new file mode 100644 index 00000000..2857f3f5 --- /dev/null +++ b/IntegrationTests/Tests/shift_right_type_err.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stderr: + Traceback... + ... + Expected a numeric type but got type 'String_'. +" + +shift_right_type_err = ( + run = ( + (1 >>> 'a') println. + ) +) diff --git a/IntegrationTests/Tests/sin.som b/IntegrationTests/Tests/sin.som new file mode 100644 index 00000000..d35586aa --- /dev/null +++ b/IntegrationTests/Tests/sin.som @@ -0,0 +1,16 @@ +" +VM: + status: success + stdout: + 0.0 + 0.8414709848078965 + 0.9092974268256817 +" + +sin = ( + run = ( + 0.0 sin println. + 1.0 sin println. + 2.0 sin println. + ) +) diff --git a/IntegrationTests/Tests/str_escape_unknown.som b/IntegrationTests/Tests/str_escape_unknown.som new file mode 100644 index 00000000..fb30ee28 --- /dev/null +++ b/IntegrationTests/Tests/str_escape_unknown.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stderr: + ...str_escape_unknown.som', line 12, column 10: + '\a'. + Unknown escape sequence '\a' +" + +str_escape_unknown = ( + run = ( + '\a' println + ) +) diff --git a/IntegrationTests/Tests/str_escapes.som b/IntegrationTests/Tests/str_escapes.som new file mode 100644 index 00000000..e44c5b99 --- /dev/null +++ b/IntegrationTests/Tests/str_escapes.som @@ -0,0 +1,15 @@ +" +VM: + status: success + stdout: + a + b + c d\' +" + +str_escapes = ( + run = ( + 'a\nb' println. + 'c\td\\\'' println. + ) +) diff --git a/IntegrationTests/Tests/string_equal_nonstring.som b/IntegrationTests/Tests/string_equal_nonstring.som new file mode 100644 index 00000000..3b305e35 --- /dev/null +++ b/IntegrationTests/Tests/string_equal_nonstring.som @@ -0,0 +1,18 @@ +" +VM: + status: success + stdout: + true + false + true + false +" + +string_equal_nonstring = ( + run = ( + ('a' = 'a') println. + ('a' = 'b') println. + ('a' = #a) println. + ('a' = 0) println. + ) +) diff --git a/IntegrationTests/Tests/string_length.som b/IntegrationTests/Tests/string_length.som new file mode 100644 index 00000000..681f5543 --- /dev/null +++ b/IntegrationTests/Tests/string_length.som @@ -0,0 +1,18 @@ +" +VM: + status: success + stdout: + 5 + 1 + 13 + 2 +" + +string_length = ( + run = ( + 'hello' length println. + '❤' length println. + 'hello ❤ world' length println. + ('abc' substringFrom: 1 to: 2) length println. + ) +) diff --git a/IntegrationTests/Tests/substring.som b/IntegrationTests/Tests/substring.som new file mode 100644 index 00000000..7faba8f3 --- /dev/null +++ b/IntegrationTests/Tests/substring.som @@ -0,0 +1,20 @@ +" +VM: + status: success + stdout: + el + hello + h + ❤ +" + +substring = ( + run = ( + | x | + x := 'hello ❤ world'. + (x substringFrom: 2 to: 3) println. + (x substringFrom: 1 to: 5) println. + (x substringFrom: 1 to: 1) println. + (x substringFrom: 7 to: 7) println. + ) +) diff --git a/IntegrationTests/Tests/substring_err.som b/IntegrationTests/Tests/substring_err.som new file mode 100644 index 00000000..b0f96e6f --- /dev/null +++ b/IntegrationTests/Tests/substring_err.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stdout: + ... + ERROR: Attempting to index string out of its bounds (start: 2 end: 1 length: 3) +" + +substring_err = ( + run = ( + 'abc' substringFrom: 2 to: 1. + ) +) diff --git a/IntegrationTests/Tests/super_var.som b/IntegrationTests/Tests/super_var.som new file mode 100644 index 00000000..28d9dfaa --- /dev/null +++ b/IntegrationTests/Tests/super_var.som @@ -0,0 +1,19 @@ +" +VM: + status: success + stdout: + instance of super_var + nil + nil +" + +super_var = ( + run = ( + | x | + self println. + x = self. + x println. + x = super. + x println. + ) +) diff --git a/IntegrationTests/Tests/symbol1.som b/IntegrationTests/Tests/symbol1.som new file mode 100644 index 00000000..5fd69847 --- /dev/null +++ b/IntegrationTests/Tests/symbol1.som @@ -0,0 +1,39 @@ +" +VM: + status: success + stdout: + #ab + true + true + true + String + Symbol + true + true + #ab: + #ab + #+ + #+-+ + #primitive +" + +symbol1 = ( + run = ( + #ab println. + (#ab == #ab) println. + ((#a + #b) == #ab) println. + (('a' + 'b') asSymbol == #ab) println. + (('a' + #ab) class) println. + ((#ab + 'a') class) println. + (#ab = 'ab') println. + ('ab' = #ab) println. + + #ab: println. + + #'ab' println. + + #+ println. + #+-+ println. + #primitive println. + ) +) diff --git a/IntegrationTests/Tests/system1.som b/IntegrationTests/Tests/system1.som new file mode 100644 index 00000000..b149d72c --- /dev/null +++ b/IntegrationTests/Tests/system1.som @@ -0,0 +1,16 @@ +" +VM: + status: success + stdout: + ab + a +" + +system1 = ( + run = ( + system printString: 'a'. + system printString: 'b'. + system printNewline. + system printString: 'a'. + ) +) diff --git a/IntegrationTests/Tests/system2.som b/IntegrationTests/Tests/system2.som new file mode 100644 index 00000000..ec847027 --- /dev/null +++ b/IntegrationTests/Tests/system2.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + Expected object of type 'String_' but got type 'Inst'. +" + +system2 = ( + run = ( + system printString: system. + ) +) diff --git a/IntegrationTests/Tests/system_global.som b/IntegrationTests/Tests/system_global.som new file mode 100644 index 00000000..dd28d795 --- /dev/null +++ b/IntegrationTests/Tests/system_global.som @@ -0,0 +1,36 @@ +" +VM: + status: success + stdout: + true + true + 42 + 42 + String + 21 + 21 + a + b + c +" + +system_global = ( + run = ( + ((system global: #Integer) == Integer) println. + system global: #Integer put: 42. + ((system global: #Integer) == Integer) println. + Integer println. + (system global: #Integer) println. + system global: #Integer put: 'a'. + Integer class println. + system global: #ab put: 21. + (system global: #ab) println. + ab println. + system global: #nil put: 'a'. + system global: #true put: 'b'. + system global: #false put: 'c'. + nil println. + true println. + false println. + ) +) diff --git a/IntegrationTests/Tests/system_global_lookup_string.som b/IntegrationTests/Tests/system_global_lookup_string.som new file mode 100644 index 00000000..96c7c548 --- /dev/null +++ b/IntegrationTests/Tests/system_global_lookup_string.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stderr: + ... + Expected instance of 'Symbol' but got instance of 'String'. +" + + +system_global_lookup_string = ( + run = ( + (system global: 'ab') println. + ) +) diff --git a/IntegrationTests/Tests/system_global_put_string.som b/IntegrationTests/Tests/system_global_put_string.som new file mode 100644 index 00000000..957c99f2 --- /dev/null +++ b/IntegrationTests/Tests/system_global_put_string.som @@ -0,0 +1,14 @@ +" +VM: + status: error + stderr: + ... + Expected instance of 'Symbol' but got instance of 'String'. +" + + +system_global_put_string = ( + run = ( + (system global: 'ab' put: 2). + ) +) diff --git a/IntegrationTests/Tests/system_global_unset_global.som b/IntegrationTests/Tests/system_global_unset_global.som new file mode 100644 index 00000000..25311553 --- /dev/null +++ b/IntegrationTests/Tests/system_global_unset_global.som @@ -0,0 +1,16 @@ +" +VM: + status: success + stdout: + nil + instance of System + 1 +" + +system_global_unset_global = ( + run = ( + (system global: #ab) println. + (system global: #ab put: 1) println. + (system global: #ab) println. + ) +) diff --git a/IntegrationTests/Tests/test_literals_limit_1.som b/IntegrationTests/Tests/test_literals_limit_1.som new file mode 100644 index 00000000..01ccd77f --- /dev/null +++ b/IntegrationTests/Tests/test_literals_limit_1.som @@ -0,0 +1,518 @@ +" +VM: + status: error + stderr: + error: The method has too many literals. You may be able to split up this method into multiple. +" + +test_literals_limit_1 = ( + run = ( + | vector | + vector := Vector new. + self buildVector: vector. + ) + + buildVector: vector = ( + vector append: 1 + vector append: 2 + vector append: 3 + vector append: 4 + vector append: 5 + vector append: 6 + vector append: 7 + vector append: 8 + vector append: 9 + vector append: 10 + vector append: 11 + vector append: 12 + vector append: 13 + vector append: 14 + vector append: 15 + vector append: 16 + vector append: 17 + vector append: 18 + vector append: 19 + vector append: 20 + vector append: 21 + vector append: 22 + vector append: 23 + vector append: 24 + vector append: 25 + vector append: 26 + vector append: 27 + vector append: 28 + vector append: 29 + vector append: 30 + vector append: 31 + vector append: 32 + vector append: 33 + vector append: 34 + vector append: 35 + vector append: 36 + vector append: 37 + vector append: 38 + vector append: 39 + vector append: 40 + vector append: 41 + vector append: 42 + vector append: 43 + vector append: 44 + vector append: 45 + vector append: 46 + vector append: 47 + vector append: 48 + vector append: 49 + vector append: 50 + vector append: 51 + vector append: 52 + vector append: 53 + vector append: 54 + vector append: 55 + vector append: 56 + vector append: 57 + vector append: 58 + vector append: 59 + vector append: 60 + vector append: 61 + vector append: 62 + vector append: 63 + vector append: 64 + vector append: 65 + vector append: 66 + vector append: 67 + vector append: 68 + vector append: 69 + vector append: 70 + vector append: 71 + vector append: 72 + vector append: 73 + vector append: 74 + vector append: 75 + vector append: 76 + vector append: 77 + vector append: 78 + vector append: 79 + vector append: 80 + vector append: 81 + vector append: 82 + vector append: 83 + vector append: 84 + vector append: 85 + vector append: 86 + vector append: 87 + vector append: 88 + vector append: 89 + vector append: 90 + vector append: 91 + vector append: 92 + vector append: 93 + vector append: 94 + vector append: 95 + vector append: 96 + vector append: 97 + vector append: 98 + vector append: 99 + vector append: 100 + vector append: 101 + vector append: 102 + vector append: 103 + vector append: 104 + vector append: 105 + vector append: 106 + vector append: 107 + vector append: 108 + vector append: 109 + vector append: 110 + vector append: 111 + vector append: 112 + vector append: 113 + vector append: 114 + vector append: 115 + vector append: 116 + vector append: 117 + vector append: 118 + vector append: 119 + vector append: 120 + vector append: 121 + vector append: 122 + vector append: 123 + vector append: 124 + vector append: 125 + vector append: 126 + vector append: 127 + vector append: 128 + vector append: 129 + vector append: 130 + vector append: 131 + vector append: 132 + vector append: 133 + vector append: 134 + vector append: 135 + vector append: 136 + vector append: 137 + vector append: 138 + vector append: 139 + vector append: 140 + vector append: 141 + vector append: 142 + vector append: 143 + vector append: 144 + vector append: 145 + vector append: 146 + vector append: 147 + vector append: 148 + vector append: 149 + vector append: 150 + vector append: 151 + vector append: 152 + vector append: 153 + vector append: 154 + vector append: 155 + vector append: 156 + vector append: 157 + vector append: 158 + vector append: 159 + vector append: 160 + vector append: 161 + vector append: 162 + vector append: 163 + vector append: 164 + vector append: 165 + vector append: 166 + vector append: 167 + vector append: 168 + vector append: 169 + vector append: 170 + vector append: 171 + vector append: 172 + vector append: 173 + vector append: 174 + vector append: 175 + vector append: 176 + vector append: 177 + vector append: 178 + vector append: 179 + vector append: 180 + vector append: 181 + vector append: 182 + vector append: 183 + vector append: 184 + vector append: 185 + vector append: 186 + vector append: 187 + vector append: 188 + vector append: 189 + vector append: 190 + vector append: 191 + vector append: 192 + vector append: 193 + vector append: 194 + vector append: 195 + vector append: 196 + vector append: 197 + vector append: 198 + vector append: 199 + vector append: 200 + vector append: 201 + vector append: 202 + vector append: 203 + vector append: 204 + vector append: 205 + vector append: 206 + vector append: 207 + vector append: 208 + vector append: 209 + vector append: 210 + vector append: 211 + vector append: 212 + vector append: 213 + vector append: 214 + vector append: 215 + vector append: 216 + vector append: 217 + vector append: 218 + vector append: 219 + vector append: 220 + vector append: 221 + vector append: 222 + vector append: 223 + vector append: 224 + vector append: 225 + vector append: 226 + vector append: 227 + vector append: 228 + vector append: 229 + vector append: 230 + vector append: 231 + vector append: 232 + vector append: 233 + vector append: 234 + vector append: 235 + vector append: 236 + vector append: 237 + vector append: 238 + vector append: 239 + vector append: 240 + vector append: 241 + vector append: 242 + vector append: 243 + vector append: 244 + vector append: 245 + vector append: 246 + vector append: 247 + vector append: 248 + vector append: 249 + vector append: 250 + vector append: 251 + vector append: 252 + vector append: 253 + vector append: 254 + vector append: 255 + vector append: 256 + vector append: 257 + vector append: 258 + vector append: 259 + vector append: 260 + vector append: 261 + vector append: 262 + vector append: 263 + vector append: 264 + vector append: 265 + vector append: 266 + vector append: 267 + vector append: 268 + vector append: 269 + vector append: 270 + vector append: 271 + vector append: 272 + vector append: 273 + vector append: 274 + vector append: 275 + vector append: 276 + vector append: 277 + vector append: 278 + vector append: 279 + vector append: 280 + vector append: 281 + vector append: 282 + vector append: 283 + vector append: 284 + vector append: 285 + vector append: 286 + vector append: 287 + vector append: 288 + vector append: 289 + vector append: 290 + vector append: 291 + vector append: 292 + vector append: 293 + vector append: 294 + vector append: 295 + vector append: 296 + vector append: 297 + vector append: 298 + vector append: 299 + vector append: 300 + vector append: 301 + vector append: 302 + vector append: 303 + vector append: 304 + vector append: 305 + vector append: 306 + vector append: 307 + vector append: 308 + vector append: 309 + vector append: 310 + vector append: 311 + vector append: 312 + vector append: 313 + vector append: 314 + vector append: 315 + vector append: 316 + vector append: 317 + vector append: 318 + vector append: 319 + vector append: 320 + vector append: 321 + vector append: 322 + vector append: 323 + vector append: 324 + vector append: 325 + vector append: 326 + vector append: 327 + vector append: 328 + vector append: 329 + vector append: 330 + vector append: 331 + vector append: 332 + vector append: 333 + vector append: 334 + vector append: 335 + vector append: 336 + vector append: 337 + vector append: 338 + vector append: 339 + vector append: 340 + vector append: 341 + vector append: 342 + vector append: 343 + vector append: 344 + vector append: 345 + vector append: 346 + vector append: 347 + vector append: 348 + vector append: 349 + vector append: 350 + vector append: 351 + vector append: 352 + vector append: 353 + vector append: 354 + vector append: 355 + vector append: 356 + vector append: 357 + vector append: 358 + vector append: 359 + vector append: 360 + vector append: 361 + vector append: 362 + vector append: 363 + vector append: 364 + vector append: 365 + vector append: 366 + vector append: 367 + vector append: 368 + vector append: 369 + vector append: 370 + vector append: 371 + vector append: 372 + vector append: 373 + vector append: 374 + vector append: 375 + vector append: 376 + vector append: 377 + vector append: 378 + vector append: 379 + vector append: 380 + vector append: 381 + vector append: 382 + vector append: 383 + vector append: 384 + vector append: 385 + vector append: 386 + vector append: 387 + vector append: 388 + vector append: 389 + vector append: 390 + vector append: 391 + vector append: 392 + vector append: 393 + vector append: 394 + vector append: 395 + vector append: 396 + vector append: 397 + vector append: 398 + vector append: 399 + vector append: 400 + vector append: 401 + vector append: 402 + vector append: 403 + vector append: 404 + vector append: 405 + vector append: 406 + vector append: 407 + vector append: 408 + vector append: 409 + vector append: 410 + vector append: 411 + vector append: 412 + vector append: 413 + vector append: 414 + vector append: 415 + vector append: 416 + vector append: 417 + vector append: 418 + vector append: 419 + vector append: 420 + vector append: 421 + vector append: 422 + vector append: 423 + vector append: 424 + vector append: 425 + vector append: 426 + vector append: 427 + vector append: 428 + vector append: 429 + vector append: 430 + vector append: 431 + vector append: 432 + vector append: 433 + vector append: 434 + vector append: 435 + vector append: 436 + vector append: 437 + vector append: 438 + vector append: 439 + vector append: 440 + vector append: 441 + vector append: 442 + vector append: 443 + vector append: 444 + vector append: 445 + vector append: 446 + vector append: 447 + vector append: 448 + vector append: 449 + vector append: 450 + vector append: 451 + vector append: 452 + vector append: 453 + vector append: 454 + vector append: 455 + vector append: 456 + vector append: 457 + vector append: 458 + vector append: 459 + vector append: 460 + vector append: 461 + vector append: 462 + vector append: 463 + vector append: 464 + vector append: 465 + vector append: 466 + vector append: 467 + vector append: 468 + vector append: 469 + vector append: 470 + vector append: 471 + vector append: 472 + vector append: 473 + vector append: 474 + vector append: 475 + vector append: 476 + vector append: 477 + vector append: 478 + vector append: 479 + vector append: 480 + vector append: 481 + vector append: 482 + vector append: 483 + vector append: 484 + vector append: 485 + vector append: 486 + vector append: 487 + vector append: 488 + vector append: 489 + vector append: 490 + vector append: 491 + vector append: 492 + vector append: 493 + vector append: 494 + vector append: 495 + vector append: 496 + vector append: 497 + vector append: 498 + vector append: 499 + vector append: 500 + ^vector. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/test_literals_limit_2.som b/IntegrationTests/Tests/test_literals_limit_2.som new file mode 100644 index 00000000..18fad2aa --- /dev/null +++ b/IntegrationTests/Tests/test_literals_limit_2.som @@ -0,0 +1,143 @@ +" +VM: + status: error + stdout: + #s127 +" + +test_literals_limit_2 = ( + run = ( + | temp | + temp := #s1. + temp := #s2. + temp := #s3. + temp := #s4. + temp := #s5. + temp := #s6. + temp := #s7. + temp := #s8. + temp := #s9. + temp := #s10. + temp := #s11. + temp := #s12. + temp := #s13. + temp := #s14. + temp := #s15. + temp := #s16. + temp := #s17. + temp := #s18. + temp := #s19. + temp := #s20. + temp := #s21. + temp := #s22. + temp := #s23. + temp := #s24. + temp := #s25. + temp := #s26. + temp := #s27. + temp := #s28. + temp := #s29. + temp := #s30. + temp := #s31. + temp := #s32. + temp := #s33. + temp := #s34. + temp := #s35. + temp := #s36. + temp := #s37. + temp := #s38. + temp := #s39. + temp := #s40. + temp := #s41. + temp := #s42. + temp := #s43. + temp := #s44. + temp := #s45. + temp := #s46. + temp := #s47. + temp := #s48. + temp := #s49. + temp := #s50. + temp := #s51. + temp := #s52. + temp := #s53. + temp := #s54. + temp := #s55. + temp := #s56. + temp := #s57. + temp := #s58. + temp := #s59. + temp := #s60. + temp := #s61. + temp := #s62. + temp := #s63. + temp := #s64. + temp := #s65. + temp := #s66. + temp := #s67. + temp := #s68. + temp := #s69. + temp := #s70. + temp := #s71. + temp := #s72. + temp := #s73. + temp := #s74. + temp := #s75. + temp := #s76. + temp := #s77. + temp := #s78. + temp := #s79. + temp := #s80. + temp := #s81. + temp := #s82. + temp := #s83. + temp := #s84. + temp := #s85. + temp := #s86. + temp := #s87. + temp := #s88. + temp := #s89. + temp := #s90. + temp := #s91. + temp := #s92. + temp := #s93. + temp := #s94. + temp := #s95. + temp := #s96. + temp := #s97. + temp := #s98. + temp := #s99. + temp := #s100. + temp := #s101. + temp := #s102. + temp := #s103. + temp := #s104. + temp := #s105. + temp := #s106. + temp := #s107. + temp := #s108. + temp := #s109. + temp := #s110. + temp := #s111. + temp := #s112. + temp := #s113. + temp := #s114. + temp := #s115. + temp := #s116. + temp := #s117. + temp := #s118. + temp := #s119. + temp := #s120. + temp := #s121. + temp := #s122. + temp := #s123. + temp := #s124. + temp := #s125. + temp := #s126. + temp := #s127. + + "Take the maximum number of Literals (Would be 128 here but println. uses a symbol)" + + temp println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/ticks.som b/IntegrationTests/Tests/ticks.som new file mode 100644 index 00000000..c7732cc8 --- /dev/null +++ b/IntegrationTests/Tests/ticks.som @@ -0,0 +1,19 @@ +" +VM: + status: success + stdout: + Integer +" + +ticks = ( + run = ( + | i start | + system ticks class println. + start := system ticks. + i := 1000. + [i ~= 0] whileTrue: [ + i := i - 1. + (start <= system ticks) ifFalse: [ system exit: 1 ]. + ]. + ) +) diff --git a/IntegrationTests/Tests/to32bits.som b/IntegrationTests/Tests/to32bits.som new file mode 100644 index 00000000..c982409a --- /dev/null +++ b/IntegrationTests/Tests/to32bits.som @@ -0,0 +1,43 @@ +" +VM: + status: success + stdout: + 0 + 1 + 4294967295 + 4294967295 + 0 + 4294967295 + 0 + 4294967295 + 0 + 1 + -1 + -1 + 0 + -1 + 0 + -1 +" + +to32bits = ( + run = ( + 0 as32BitUnsignedValue println. + 1 as32BitUnsignedValue println. + -1 as32BitUnsignedValue println. + 4294967295 as32BitUnsignedValue println. + (1 << 60) as32BitUnsignedValue println. + ((1 << 60) - 1) as32BitUnsignedValue println. + (1 << 200) as32BitUnsignedValue println. + ((1 << 200) - 1) as32BitUnsignedValue println. + + 0 as32BitSignedValue println. + 1 as32BitSignedValue println. + -1 as32BitSignedValue println. + 4294967295 as32BitSignedValue println. + (1 << 60) as32BitSignedValue println. + ((1 << 60) - 1) as32BitSignedValue println. + (1 << 200) as32BitSignedValue println. + ((1 << 200) - 1) as32BitSignedValue println. + ) +) diff --git a/IntegrationTests/Tests/unassigned_inst_var.som b/IntegrationTests/Tests/unassigned_inst_var.som new file mode 100644 index 00000000..ed6695f0 --- /dev/null +++ b/IntegrationTests/Tests/unassigned_inst_var.som @@ -0,0 +1,12 @@ +" +VM: + status: success + stdout: nil +" + +unassigned_inst_var = ( + | x | + run = ( + x println. + ) +) diff --git a/IntegrationTests/Tests/unassigned_var.som b/IntegrationTests/Tests/unassigned_var.som new file mode 100644 index 00000000..ed526724 --- /dev/null +++ b/IntegrationTests/Tests/unassigned_var.som @@ -0,0 +1,11 @@ +" +VM: + stdout: nil +" + +unassigned_var = ( + run = ( + |v| + v println. + ) +) diff --git a/IntegrationTests/Tests/unknown_field_write.som b/IntegrationTests/Tests/unknown_field_write.som new file mode 100644 index 00000000..15393c47 --- /dev/null +++ b/IntegrationTests/Tests/unknown_field_write.som @@ -0,0 +1,13 @@ +" +VM: + status: error + stderr: + ... + No such field 'unknown' in class +" + +unknown_field_write = ( + run = ( + unknown := '1'. + ) +) diff --git a/IntegrationTests/Tests/unknown_global_lookup.som b/IntegrationTests/Tests/unknown_global_lookup.som new file mode 100644 index 00000000..8c70d187 --- /dev/null +++ b/IntegrationTests/Tests/unknown_global_lookup.som @@ -0,0 +1,15 @@ +" +VM: + status: error + stdout: + 1 + + ERROR: Tried loading 'unknown' as a class, but failed. +" + +unknown_global_lookup = ( + run = ( + 1 println. + unknown. + ) +) diff --git a/IntegrationTests/Tests/unknown_method.som b/IntegrationTests/Tests/unknown_method.som new file mode 100644 index 00000000..65ed77b4 --- /dev/null +++ b/IntegrationTests/Tests/unknown_method.som @@ -0,0 +1,11 @@ +" +VM: + status: error + stdout: ERROR: Method f not found in class unknown_method +" + +unknown_method = ( + run = ( + self f. + ) +) diff --git a/IntegrationTests/Tests/unknown_method_with_args.som b/IntegrationTests/Tests/unknown_method_with_args.som new file mode 100644 index 00000000..d26a0c55 --- /dev/null +++ b/IntegrationTests/Tests/unknown_method_with_args.som @@ -0,0 +1,19 @@ +" +VM: + status: success + stdout: + #f:y: + 1 + 2 +" + +unknown_method_with_args = ( + run = ( + self f: 1 y: 2. + ) + + doesNotUnderstand: sym arguments: arguments = ( + sym println. + arguments do: [:e | e println ]. + ) +) diff --git a/IntegrationTests/Tests/unknown_method_with_cache.som b/IntegrationTests/Tests/unknown_method_with_cache.som new file mode 100644 index 00000000..9b4cad01 --- /dev/null +++ b/IntegrationTests/Tests/unknown_method_with_cache.som @@ -0,0 +1,35 @@ +" +VM: + status: success + stdout: + unknown_method_with_cache>>g + unknown_method_with_cache>>h +" + +unknown_method_with_cache = ( + | x | + + run = ( + self find: #g. + self t. + self find: #h. + self t. + ) + + find: sym = ( + | ms | + ms := unknown_method_with_cache methods. + ms doIndexes: [:i | (((ms at: i) signature) == sym) ifTrue: [ x := i ]]. + ) + + t = ( + (self f) println. + ) + + doesNotUnderstand: selector arguments: arguments = ( + ^ unknown_method_with_cache methods at: x. + ) + + g = ( ^ #g ) + h = ( ^ #h ) +) diff --git a/IntegrationTests/Tests/vars_in_nested_blocks.som b/IntegrationTests/Tests/vars_in_nested_blocks.som new file mode 100644 index 00000000..d7c71817 --- /dev/null +++ b/IntegrationTests/Tests/vars_in_nested_blocks.som @@ -0,0 +1,34 @@ +" +VM: + status: success + stdout: + 1111135 + 30 +" + +vars_in_nested_blocks = ( + | field | + method = ( ^ 5 ) + run = ( + | local | + local := nil. + [ | a | + a := 100. + a := a + [ | b | + b := 1000. + b := b + [ | c | + c := 10000. + c := c + [ | d | + d := 100000. + d := d + [ | e | + e := 1000000. + local := 30. + e := e + self method + local. + e ] value. + d ] value. + c ] value. + b ] value. + a ] value println. + local println. + ) +) diff --git a/IntegrationTests/Tests/vector_awfy.som b/IntegrationTests/Tests/vector_awfy.som new file mode 100644 index 00000000..277eb986 --- /dev/null +++ b/IntegrationTests/Tests/vector_awfy.som @@ -0,0 +1,18 @@ +" +VM: + status: success + custom_classpath: ./core-lib/Examples/AreWeFastYet/Core:./core-lib/Smalltalk + stdout: + nil + +" + +vector_awfy = ( + run = ( + | vec | + vec := Vector new. + vec append: 10. + vec append: 20. + (vec at: 20) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/vector_awfy2.som b/IntegrationTests/Tests/vector_awfy2.som new file mode 100644 index 00000000..0a214f08 --- /dev/null +++ b/IntegrationTests/Tests/vector_awfy2.som @@ -0,0 +1,18 @@ +" +VM: + status: success + custom_classpath: ./core-lib/Examples/AreWeFastYet/Core:./core-lib/Smalltalk + stdout: + nil + +" + +vector_awfy2 = ( + run = ( + | vec | + vec := Vector new. + vec append: 10. + vec append: 20. + (vec at: 51) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/vector_awfy_capacity.som b/IntegrationTests/Tests/vector_awfy_capacity.som new file mode 100644 index 00000000..32c44249 --- /dev/null +++ b/IntegrationTests/Tests/vector_awfy_capacity.som @@ -0,0 +1,27 @@ +" +VM: + status: success + custom_classpath: ./core-lib/Examples/AreWeFastYet/Core:./core-lib/Smalltalk + stdout: + 50 + 100 + 10 + +" + +vector_awfy_capacity = ( + run = ( + | vec | + vec := Vector new. + vec append: 10. + vec append: 20. + + (vec capacity) println. + + vec at: 51 put: 10. + + (vec capacity) println. + + (vec at: 51) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/vector_core_atput_err.som b/IntegrationTests/Tests/vector_core_atput_err.som new file mode 100644 index 00000000..9f4a727d --- /dev/null +++ b/IntegrationTests/Tests/vector_core_atput_err.som @@ -0,0 +1,25 @@ +" +VM: + status: success + stdout: + 50 + ERROR: Vector[1..3]: Index 51 out of bounds + +" + +vector_core_atput_err = ( + run = ( + | vec | + vec := Vector new. + vec append: 10. + vec append: 20. + + (vec capacity) println. + + vec at: 51 put: 10. + + (vec capacity) println. + + (vec at: 51) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/vector_core_err.som b/IntegrationTests/Tests/vector_core_err.som new file mode 100644 index 00000000..92cead61 --- /dev/null +++ b/IntegrationTests/Tests/vector_core_err.som @@ -0,0 +1,17 @@ +" +VM: + status: success + stdout: + ERROR: Vector[1..3]: Index 20 out of bounds + +" + +vector_core_err = ( + run = ( + | vec | + vec := Vector new. + vec append: 10. + vec append: 20. + (vec at: 20) println. + ) +) \ No newline at end of file diff --git a/IntegrationTests/Tests/while1.som b/IntegrationTests/Tests/while1.som new file mode 100644 index 00000000..69937141 --- /dev/null +++ b/IntegrationTests/Tests/while1.som @@ -0,0 +1,20 @@ +" +VM: + status: success + stdout: + 5 + 4 + 3 + 2 + 1 +" + +while1 = ( + run = ( | x | + x := 5. + [x ~= 0] whileTrue: [ + x println. + x := x - 1. + ]. + ) +) diff --git a/IntegrationTests/Tests/while2.som b/IntegrationTests/Tests/while2.som new file mode 100644 index 00000000..7ee765a1 --- /dev/null +++ b/IntegrationTests/Tests/while2.som @@ -0,0 +1,20 @@ +" +VM: + status: success + stdout: + 5 + 4 + 3 + 2 + 1 +" + +while2 = ( + run = ( | x | + x := 5. + [x = 0] whileFalse: [ + x println. + x := x - 1. + ]. + ) +) diff --git a/specification/Makefile b/specification/Makefile index abd3da50..9fafa16d 100644 --- a/specification/Makefile +++ b/specification/Makefile @@ -13,7 +13,7 @@ SOMParser.class: SOMParser.java test: are-we-fast-yet SOMParser.class set -e; \ - find .. -name '*.som' -print0 | while read -d $$'\0' i; do \ + find .. -path "../IntegrationTests" -prune -o -name '*.som' -print0 | while read -d $$'\0' i; do \ echo "$${i}"; \ OUT=`java -cp antlr.jar:. org.antlr.v4.gui.TestRig SOM classdef -diagnostics "$${i}" 2>&1`; \ if [ ! -z "$$OUT" ]; then \