Skip to content

Adding yksom's lang_tests #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions IntegrationTests/Tests/arbint_double_div_err.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"
VM:
status: error
stderr:
...
Expected a numeric type but got type 'String_'.
"

arbint_double_div_err = (
run = (
(1 << 200) // 'a'
)
)
11 changes: 11 additions & 0 deletions IntegrationTests/Tests/arbint_double_div_zero_err.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"
VM:
status: error
stderr:
...
Division by zero.
"

arbint_double_div_zero_err = (
run = ( (1 << 200) // 0 )
)
13 changes: 13 additions & 0 deletions IntegrationTests/Tests/arbint_modulus_err.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"
VM:
status: error
stderr:
...
Expected a numeric type but got type 'String_'.
"

arbint_modulus_err = (
run = (
(1 << 200) % 'a'
)
)
17 changes: 17 additions & 0 deletions IntegrationTests/Tests/array_at_idx0_err.som
Original file line number Diff line number Diff line change
@@ -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.
)
)
17 changes: 17 additions & 0 deletions IntegrationTests/Tests/array_at_idx2_err.som
Original file line number Diff line number Diff line change
@@ -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.
)
)
17 changes: 17 additions & 0 deletions IntegrationTests/Tests/array_at_idx_err.som
Original file line number Diff line number Diff line change
@@ -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.
)
)
17 changes: 17 additions & 0 deletions IntegrationTests/Tests/array_at_negative_idx_err.som
Original file line number Diff line number Diff line change
@@ -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.
)
)
17 changes: 17 additions & 0 deletions IntegrationTests/Tests/array_at_put_idx.err
Original file line number Diff line number Diff line change
@@ -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'.
)
)
17 changes: 17 additions & 0 deletions IntegrationTests/Tests/array_at_put_idx0_err.som
Original file line number Diff line number Diff line change
@@ -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'.
)
)
17 changes: 17 additions & 0 deletions IntegrationTests/Tests/array_at_put_idx2_err.som
Original file line number Diff line number Diff line change
@@ -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'.
)
)
23 changes: 23 additions & 0 deletions IntegrationTests/Tests/array_literals.som
Original file line number Diff line number Diff line change
@@ -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].
)
)
34 changes: 34 additions & 0 deletions IntegrationTests/Tests/basic_arrays.som
Original file line number Diff line number Diff line change
@@ -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].
)
)
11 changes: 11 additions & 0 deletions IntegrationTests/Tests/binary_super.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"
VM:
status: error
stdout: ERROR: Method + not found in class binary_super
"

binary_super = (
run = (
super + 1.
)
)
5 changes: 5 additions & 0 deletions IntegrationTests/Tests/binary_super/superc.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
superc = (
+ i = (
^ 1 + i
)
)
15 changes: 15 additions & 0 deletions IntegrationTests/Tests/binary_super/test.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"
VM:
status: success
stdout: 2
"

test = superc (
run = (
(super + 1) println.
)

+ i = (
^ 0 + i
)
)
9 changes: 9 additions & 0 deletions IntegrationTests/Tests/block_1.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"
VM:
stdout:
Hello world
"

block_1 = (
run = ( [ 'Hello world' ] value println )
)
18 changes: 18 additions & 0 deletions IntegrationTests/Tests/block_10.som
Original file line number Diff line number Diff line change
@@ -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
)
)
27 changes: 27 additions & 0 deletions IntegrationTests/Tests/block_11.som
Original file line number Diff line number Diff line change
@@ -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.
)
)
32 changes: 32 additions & 0 deletions IntegrationTests/Tests/block_12.som
Original file line number Diff line number Diff line change
@@ -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.
)
)
12 changes: 12 additions & 0 deletions IntegrationTests/Tests/block_2.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"
VM:
stdout:
Hello world
"

block_2 = (
f = (
^([ 'Hello world' ] value)
)
run = ( self f println )
)
10 changes: 10 additions & 0 deletions IntegrationTests/Tests/block_3.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"
VM:
stdout:
Hello world
"

block_3 = (
f = ( ^[ 'Hello world' ] )
run = ( self f value println )
)
15 changes: 15 additions & 0 deletions IntegrationTests/Tests/block_4.som
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"
VM:
stdout:
woo
"

block_4 = (
run = (
|x y|
x := 'Hello world'.
[ x := 'woo'] value.
y := [ x ].
y value println.
)
)
Loading
Loading