tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit 102db8f7b26c6d3f79a5f93ac95bbdb07bceedd3
parent e1e8900fbf0bbc6eb69c77760783fbb1f5eb8fe1
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Thu, 17 Oct 2019 19:07:44 -0700

Reorganize tests

Diffstat:
test.c | 78++++++++++++++++++++++++++++++------------------------------------------------
1 file changed, 30 insertions(+), 48 deletions(-)

diff --git a/test.c b/test.c @@ -40,25 +40,23 @@ char *tests[][2] = { { "-.05", "-0.05" }, { "-.0", "-0.0" }, { "-1.e6", "-1000000.0" }, + { "3/4", "3/4" }, + { "4/3", "4/3" }, + { "+1/2", "1/2" }, + { "2/1", "2" }, + { "8/+1", "8" }, + { "8/4", "2" }, + { "4/8", "1/2" }, + { "02384/7238", "1192/3619" }, + { "-1/2", "-1/2" }, + { "1/-2", "-1/2" }, + { "-6/3", "-2" }, + { "-6/-3", "2" }, { "\"foo\"", "\"foo\"" }, { "\"foo bar\"", "\"foo bar\"" }, { "t", "t" }, { "()", "()" }, - { "frac", NULL }, - { "3/4", "3/4" }, - { "4/3", "4/3" }, - { "+1/2", "1/2" }, - { "2/1", "2" }, - { "8/+1", "8" }, - { "8/4", "2" }, - { "4/8", "1/2" }, - { "02384/7238", "1192/3619" }, - { "-1/2", "-1/2" }, - { "1/-2", "-1/2" }, - { "-6/3", "-2" }, - { "-6/-3", "2" }, - { "comments", NULL }, { "; commment", "" }, { "; (+ 1 1)", "" }, @@ -234,21 +232,17 @@ char *tests[][2] = { { "(list* (sqr 3) (cube 4))", "(9 . 64)" }, { "(list* 5/4)", "5/4" }, - { "last", NULL }, - { "(last '(1 2 3))", "3" }, - { "(last (list 4 5))", "5" }, - { "(last '(a b c d e f))", "f" }, - { "(last (cons 1 (cons 2 ())))", "2" }, - - { "length", NULL }, - { "(length '(1 2 3))", "3" }, - { "(length (list .3 -3/2 12 5))", "4" }, - { "(length '(a b))", "2" }, - { "(length (list list))", "1" }, - { "(length ())", "0" }, - { "(length nil)", "0" }, - - { "nth", NULL }, + { "list get", NULL }, + { "(last '(1 2 3))", "3" }, + { "(last (list 4 5))", "5" }, + { "(last '(a b c d e f))", "f" }, + { "(last (cons 1 (cons 2 ())))", "2" }, + { "(length '(1 2 3))", "3" }, + { "(length (list .3 -3/2 12 5))", "4" }, + { "(length '(a b))", "2" }, + { "(length (list list))", "1" }, + { "(length ())", "0" }, + { "(length nil)", "0" }, { "(nth 1 '(1 2 3))", "2" }, { "(nth 2 (list 3 5/2 .332 -2))", "0.332" }, { "(nth 0 '(a b c))", "a" }, @@ -266,25 +260,21 @@ char *tests[][2] = { { "(map cadr '((1/2 .5) (\"conky\" .25) ('bubbles .125)))", "(0.5 0.25 0.125)" }, { "(map inc (list 2 4 8 (^ 2 4)))", "(3 5 9 17)" }, - { "reverse", NULL }, + { "list mod", NULL }, { "(reverse '(1 2 3 4 5))", "(5 4 3 2 1)" }, { "(reverse (list -20 5/2 .398))", "(0.398 5/2 -20)" }, { "(reverse '(a b))", "(b a)" }, { "(reverse (list \"foo\" \"bar\" \"baz\"))", "(\"baz\" \"bar\" \"foo\")" }, { "(reverse (cons 1/2 nil))", "(1/2)" }, { "(reverse ())", "()" }, + { "(append '(1 2 3) '(4 5 6))", "(1 2 3 4 5 6)" }, + { "(append (list (+ 1 2) 4) '(a b c))", "(3 4 a b c)" }, - { "append", NULL }, - { "(append '(1 2 3) '(4 5 6))", "(1 2 3 4 5 6)" }, - { "(append (list (+ 1 2) 4) '(a b c))", "(3 4 a b c)" }, - - { "zip", NULL }, + { "assoc", NULL }, { "(zip '(1 2 3 4) '(a b c d))", - "((1 . a) (2 . b) (3 . c) (4 . d))" }, + "((1 . a) (2 . b) (3 . c) (4 . d))" }, { "(zip (list 'ricky 'lahey) (list \"julian\" \"randy\"))", - "((ricky . \"julian\") (lahey . \"randy\"))" }, - - { "assoc", NULL }, + "((ricky . \"julian\") (lahey . \"randy\"))" }, { "(assoc 'baz '((foo . 3) (bar . 8) (baz . 14)))", "(baz . 14)" }, { "(assoc 'a '((a b) (3 2.1) (3.2 4/3) (3.2 3.2)))", "(a b)" }, { "(assoc 3 '((1 b)))", "()" }, @@ -354,7 +344,7 @@ char *tests[][2] = { { "(truncate -5)", "-5" }, { "(truncate 0)", "0" }, - { "add", NULL }, + { "arithmetic", NULL }, { "(+ 1 1)", "2" }, { "(+ 1 (+ 1 2))", "4" }, { "(+ 1029 283)", "1312" }, @@ -366,8 +356,6 @@ char *tests[][2] = { { "(+ 2.1 2)", "4.1" }, { "(+ 8.6 5.3)", "13.9" }, { "(+ 3.7 1/8)", "3.825" }, - - { "subtract", NULL }, { "(- 3)", "-3" }, { "(- +3)", "-3" }, { "(- -289)", "289" }, @@ -383,8 +371,6 @@ char *tests[][2] = { { "(- 2.1 2)", "0.1" }, { "(- 8.6 5.3)", "3.3" }, { "(- 3.7 1/8)", "3.575" }, - - { "multiply", NULL }, { "(* 3 2)", "6" }, { "(* -2 8.89)", "-17.78" }, { "(* 6 3/4)", "9/2" }, @@ -394,8 +380,6 @@ char *tests[][2] = { { "(* 1/3 6)", "2" }, { "(* 5/2 14.221)", "35.5525" }, { "(* 6/8 8/7)", "6/7" }, - - { "divide", NULL }, { "(/ 1 2)", "1/2" }, { "(/ 8 4)", "2" }, { "(/ 6 2.1)", "2.85714285714286" }, @@ -408,8 +392,6 @@ char *tests[][2] = { { "(/ 4/3 7)", "4/21" }, { "(/ 5/4 3.2)", "0.390625" }, { "(/ 1/3 5/4)", "4/15" }, - - { "mod", NULL }, { "(mod 10 3)", "1" }, { "(mod -11 3)", "-2" }, { "(mod 10 -3)", "1" },