-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Cyclic detection and update from upstream
- Loading branch information
Showing
14 changed files
with
220 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Def Ack ( | ||
Let X; | ||
Let Y; | ||
|
||
Do | ||
If Zero? X ( + 1 Y ) | ||
If Zero? Y ( Ack of - 1 X and 1 ) | ||
else ( Ack of - 1 X and Ack X and - 1 Y ) | ||
); | ||
|
||
Print If == 253 Ack 3 5 | ||
"PASS: Ackermann function" | ||
else | ||
"FAIL: Ackermann function"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Let X be Box 10; | ||
|
||
Print If == 10 Unbox X | ||
"PASS: Boxing and unboxing" | ||
else | ||
"FAIL: Boxing and unboxing"; | ||
|
||
Set X to 11; | ||
|
||
Print If == 11 Unbox X | ||
"PASS: Setting box to different value" | ||
else | ||
"FAIL: Setting box to different value"; | ||
|
||
Let L be Map (Box) over Range 1 to 100; | ||
|
||
For each in L ( Let X ; Set X to + 1 Unbox X ); | ||
|
||
Print If == 49 Unbox Index 47 L | ||
"PASS: Setting each element in list of boxes" | ||
else | ||
"FAIL: Setting each element in list of boxes"; | ||
|
||
Print If == "[11]" Show X | ||
"PASS: Printing simple box to string" | ||
else | ||
"FAIL: Printing simple box to string"; | ||
|
||
|
||
Let C be Box \waow; | ||
Set C to C; | ||
|
||
Print If == "[[...]]" Show Box C | ||
"PASS: Printing cyclic box" | ||
else | ||
"FAIL: Printing cyclic box"; | ||
|
||
Let B1 be Box 0; | ||
Let B2 be Box 1; | ||
Let B3 be Box 2; | ||
|
||
Set B1 to B2; | ||
Set B2 to B3; | ||
Set B3 to B1; | ||
|
||
Print If == "[[[...]]]" Show B1 | ||
"PASS: Printing doubly cyclic box" | ||
else | ||
"FAIL: Printing doubly cyclic box"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
Print "PASS: Skipping I/O"; | ||
~~ Let S be With "tests/io.txt" "r" ( Read-file ); | ||
Print "XFAIL: IO" | ||
~~ With \read "tests/io.txt" ( | ||
~~ | ||
~~ Print If == "foo\nbar\n" S | ||
~~ "PASS: Reading multi-line file to string" | ||
~~ else | ||
~~ "FAIL: Reading multi-line file to string"; | ||
~~ Let F be the file; | ||
~~ | ||
~~ | ||
~~ Let S be Read-file F; | ||
~~ | ||
~~ Print If == "foo\nbar\n" S | ||
~~ "PASS: Reading multi-line file to string" | ||
~~ else | ||
~~ "FAIL: Reading multi-line file to string"; | ||
~~ | ||
~~ Seek from \start to position 0 in F; | ||
~~ | ||
~~ Let L be Read-line F; | ||
~~ | ||
~~ Print If == "foo\n" L | ||
~~ "PASS: Reading first line of file to string" | ||
~~ else | ||
~~ "FAIL: Reading first line of file to string"; | ||
~~ | ||
~~ | ||
~~ ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
foo | ||
bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Print "XFAIL: Table"; | ||
~Def Factor (Zero? Modulo Swap); | ||
|
||
Def Primes ( | ||
Let U is upper bound; | ||
initially Table (); | ||
For Range 2 to U ( | ||
Let I be our potential prime; | ||
Let To-check be Range 2 to Floor + 1 Sqrt I; | ||
Insert I None (Factor of I) To-check; | ||
) | ||
); | ||
|
||
Let P be Primes up to 100; | ||
|
||
Print If And Not . 50 P . 37 P | ||
"PASS: Prime numbers using a table" | ||
else | ||
"FAIL: Prime numbers using a table";~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Print "XFAIL: Table"; | ||
~~ Let T be Table ( | ||
~~ \foo is "bar"; | ||
~~ "bar" is \foo; | ||
~~ 12 is 13; | ||
~~ ); | ||
~~ | ||
~~ Print If == "bar" . \foo T | ||
~~ "PASS: Table lookup 1" | ||
~~ else | ||
~~ "FAIL: Table lookup 1"; | ||
~~ | ||
~~ Print If == \foo . "bar" T | ||
~~ "PASS: Table lookup 2" | ||
~~ else | ||
~~ "FAIL: Table lookup 2"; | ||
~~ | ||
~~ Print If == 13 . 12 T | ||
~~ "PASS: Table lookup 3" | ||
~~ else | ||
~~ "FAIL: Table lookup 3"; | ||
~~ | ||
~~ Let T2 be Insert \foo is "baz" into T; | ||
~~ | ||
~~ Print If And == "baz" . \foo T2 and == "bar" . \foo T | ||
~~ "PASS: Table insertion" | ||
~~ else | ||
~~ "FAIL: Table insertion"; | ||
~~ | ||
~~ Print If == "{ foo:\"bar\" \"foo\":bar }" Show Table ( \foo "bar" and "foo" \bar ) | ||
~~ "PASS: Printing a table" | ||
~~ else | ||
~~ "FAIL: Printing a table"; | ||
~~ | ||
~~ Print If And Has \foo T Not Has \bar T | ||
~~ "PASS: Has" | ||
~~ else | ||
~~ "FAIL: Has"; | ||
~~ | ||
~~ ~ | ||
~~ Let T3 be Remove \foo from T; | ||
~~ | ||
~~ Print If Not Has \foo T3 | ||
~~ "PASS: Removing keys" | ||
~~ else | ||
~~ "FAIL: Removing keys"; | ||
~~ ~ | ||
~~ | ||
~~ Print If == List (12 \foo "bar") Keys T | ||
~~ "PASS: Getting list of keys in table" | ||
~~ else | ||
~~ "FAIL: Getting list of keys in table"; | ||
~~ | ||
~~ Print If == List (13 "bar" \foo) Values T | ||
~~ "PASS: Getting list of values in table" | ||
~~ else | ||
~~ "FAIL: Getting list of values in table"; | ||
~~ |