Merge in the test suite.

Why not?

(I have a slow tide, expand into pieces, contract into units, and back
again.  This is part of a contract and unify phase.)
This commit is contained in:
sforman 2023-08-12 08:19:54 -07:00
parent 00f4bfcacd
commit 69689f8cc6
272 changed files with 310 additions and 0 deletions

44
tests/stan/Makefile Normal file
View File

@ -0,0 +1,44 @@
# The general command line is, e.g.:
#
# gmake -j
#
# To make all the tests, e.g.:
#
# gmake -j --always-make
#
# (The the g- prefix indicates that this is GNU make or compatible,
# the ``-j`` switch tells make to use multiple jobs to take advantage of
# multi-core systems.)
#
# For the explanation of how this test system works see:
# https://chrismorgan.info/blog/make-and-git-diff-test-harness/
# Set JOY to point to the joy interpreter to test.
#JOY=joy
TESTS != ls *.joy
STDOUTS = $(TESTS:.joy=.stdout)
GIT_OPTS = --exit-code
GIT_OPTS += --src-prefix=expected/ --dst-prefix=actual/
GIT_OPTS += --name-only
# N.B. I'm using FreeBSD with GNU coreutils, so gtouch rather than touch
# (for that --date opt.) It's not ideal to hard-code the g- prefix here,
# I know, but it was faster than rewriting the command to use FreeBSD's
# touch as I already had coreutils installed for other reasons. If you
# are using GNU coreutils natively on your system then you can remove the
# g- prefix here.
TOUCH = touch --date=@0
.PHONY: test
test: $(STDOUTS)
%.stdout: %.joy
@$(JOY) < $< > $@ 2> $*.stderr || ($(TOUCH) $@; false)
@git diff $(GIT_OPTS) $@ $*.stderr || ($(TOUCH) $@; false)

31
tests/stan/README.md Normal file
View File

@ -0,0 +1,31 @@
# Simple Test Set for Joy Programming Language
Each test consists of a snippet of Joy code along with the expected
output (stdout and stderr) for a (conforming) Joy implementation. They
are run with make.
For the explanation of how this test system works see:
https://chrismorgan.info/blog/make-and-git-diff-test-harness/
Set the JOY environment variable to point to the joy interpreter to test,
e.g.:
export JOY="python -m joy -q"
-or-
setenv JOY "python -m joy -q"
or whatever for your shell. Then run make.
The general command line is, e.g.:
gmake -j
To make all the tests, e.g.:
gmake -j --always-make
The the ``g-`` prefix indicates that this is GNU make (or compatible), and
the ``-j`` switch tells make to use multiple jobs to take advantage of
multi-core systems.

View File

@ -0,0 +1 @@
1 2 +

View File

View File

@ -0,0 +1 @@
3

View File

@ -0,0 +1 @@
1 -2 +

View File

View File

@ -0,0 +1 @@
-1

View File

@ -0,0 +1 @@
2 +

View File

@ -0,0 +1 @@
Not enough values on stack.

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
+

View File

@ -0,0 +1 @@
Not enough values on stack.

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
1 true +

View File

@ -0,0 +1 @@
Not an integer.

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
1 [] +

View File

@ -0,0 +1 @@
Not an integer.

View File

@ -0,0 +1 @@

1
tests/stan/bool-000.joy Normal file
View File

@ -0,0 +1 @@
true bool

View File

View File

@ -0,0 +1 @@
true

1
tests/stan/bool-001.joy Normal file
View File

@ -0,0 +1 @@
false bool

View File

View File

@ -0,0 +1 @@
false

1
tests/stan/bool-002.joy Normal file
View File

@ -0,0 +1 @@
-1 bool 0 bool 1 bool

View File

View File

@ -0,0 +1 @@
true false true

1
tests/stan/bool-003.joy Normal file
View File

@ -0,0 +1 @@
[] bool [[]] bool

View File

View File

@ -0,0 +1 @@
false true

View File

@ -0,0 +1,4 @@
true false _\/_
false true _\/_
false false _\/_
true true _\/_

View File

View File

@ -0,0 +1,4 @@
true
true true
true true false
true true false false

View File

@ -0,0 +1,2 @@
23 false _\/_
false [] _\/_

View File

@ -0,0 +1,2 @@
Not a Boolean value.
Not a Boolean value.

View File

@ -0,0 +1,2 @@

View File

@ -0,0 +1 @@
true [1] [2] branch

View File

View File

@ -0,0 +1 @@
2

View File

@ -0,0 +1 @@
false [1] [2] branch

View File

View File

@ -0,0 +1 @@
1

1
tests/stan/clear-000.joy Normal file
View File

@ -0,0 +1 @@
1 2 3 clear 4 5 6

View File

View File

@ -0,0 +1 @@
4 5 6

View File

@ -0,0 +1 @@
1 1 = 1 2 = 2 1 = -1 1 =

View File

View File

@ -0,0 +1 @@
true false false false

View File

@ -0,0 +1 @@
1 1 >= 1 2 >= 2 1 >= -1 1 >=

View File

View File

@ -0,0 +1 @@
true false true false

View File

@ -0,0 +1 @@
1 1 > 1 2 > 2 1 > -1 1 >

View File

View File

@ -0,0 +1 @@
false false true false

View File

@ -0,0 +1 @@
1 1 <= 1 2 <= 2 1 <= -1 1 <=

View File

View File

@ -0,0 +1 @@
true true false true

View File

@ -0,0 +1 @@
1 1 < 1 2 < 2 1 < -1 1 <

View File

View File

@ -0,0 +1 @@
false true false true

View File

@ -0,0 +1 @@
1 1 <> 1 2 <> 2 1 <> -1 1 <>

View File

View File

@ -0,0 +1 @@
false true true true

View File

@ -0,0 +1 @@
[1 2 3] [4 5 6] concat

View File

View File

@ -0,0 +1 @@
[1 2 3 4 5 6]

1
tests/stan/cons-000.joy Normal file
View File

@ -0,0 +1 @@
23 [18] cons

View File

View File

@ -0,0 +1 @@
[23 18]

1
tests/stan/cons-010.joy Normal file
View File

@ -0,0 +1 @@
1 2 cons

View File

@ -0,0 +1 @@
Not a list.

View File

@ -0,0 +1 @@

1
tests/stan/cons-011.joy Normal file
View File

@ -0,0 +1 @@
[] cons

View File

@ -0,0 +1 @@
Not enough values on stack.

View File

@ -0,0 +1 @@

1
tests/stan/cons-012.joy Normal file
View File

@ -0,0 +1 @@
23 cons

View File

@ -0,0 +1 @@
Not a list.

View File

@ -0,0 +1 @@

1
tests/stan/dip-000.joy Normal file
View File

@ -0,0 +1 @@
1 3 [2] dip

View File

View File

@ -0,0 +1 @@
1 2 3

1
tests/stan/dip-001.joy Normal file
View File

@ -0,0 +1 @@
1 2 [dup] dip

View File

View File

@ -0,0 +1 @@
1 1 2

1
tests/stan/dip-002.joy Normal file
View File

@ -0,0 +1 @@
1 2 [] dip

View File

View File

@ -0,0 +1 @@
1 2

1
tests/stan/dip-003.joy Normal file
View File

@ -0,0 +1 @@
[23] dip

View File

@ -0,0 +1 @@
Not enough values on stack.

View File

@ -0,0 +1 @@

1
tests/stan/dip-004.joy Normal file
View File

@ -0,0 +1 @@
dip

View File

@ -0,0 +1 @@
Not enough values on stack.

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
10 2 /

View File

View File

@ -0,0 +1 @@
5

View File

@ -0,0 +1 @@
10 -2 /

View File

Some files were not shown because too many files have changed in this diff Show More