Author: bernhard
Date: Wed Jun 13 12:24:01 2007
New Revision: 18985

Modified:
   trunk/languages/lisp/cl.pir
   trunk/languages/lisp/t/atoms.t
   trunk/languages/lisp/t/basic.t

Log:
[languages/lisp]
add tests for some more functions from cl.pir


Modified: trunk/languages/lisp/cl.pir
==============================================================================
--- trunk/languages/lisp/cl.pir (original)
+++ trunk/languages/lisp/cl.pir Wed Jun 13 12:24:01 2007
@@ -307,6 +307,7 @@
 
 .sub _char
  .param pmc args
+
  .local pmc retval
  .local pmc ke
  .local string str

Modified: trunk/languages/lisp/t/atoms.t
==============================================================================
--- trunk/languages/lisp/t/atoms.t      (original)
+++ trunk/languages/lisp/t/atoms.t      Wed Jun 13 12:24:01 2007
@@ -78,6 +78,14 @@
       'T',
       'string 999 is an atom'
     ],
+    [ q{ (atom ( + 1 2 )) },
+      'T',
+      'result of an addition is an atom'
+    ],
+    [ q{ (atom '( + 1 2 )) },
+      'NIL',
+      'a quoted addition is not an atom'
+    ],
 );
 
 Test::More::plan( tests => scalar @test_cases );

Modified: trunk/languages/lisp/t/basic.t
==============================================================================
--- trunk/languages/lisp/t/basic.t      (original)
+++ trunk/languages/lisp/t/basic.t      Wed Jun 13 12:24:01 2007
@@ -24,32 +24,63 @@
 use Parrot::Test;
 
 my @test_cases = (
-    [ q{  (print '(1 2)) },
+    [ q{ (print '(1 2)) },
       q{(1 . (2 . NIL))},
-      q{function apply},
+      q{quoting a list},
     ],
     [ q{ ( setq my_function '+) ( print (apply my_function '(1 2)) ) },
       q{3},
       q{function apply},
       todo => 'apply does not evaluate',
     ],
-    [ q{ ( print ( list 1 2 ) ) },
-      q{(1 . (2 . NIL))},
+    [ q{ ( setq my_function '+) ( print (boundp 'my_function) ) },
+      q{T},
+      q{boundp on a bound variable},
+    ],
+    [ q{ ( setq my_function '+) ( print (boundp 'your_function) ) },
+      q{NIL},
+      q{boundp on an unbound variable},
     ],
     [ q{ ( print ( car ( list 1 2 )) ) },
       q{1},
     ],
+    [ q{ ( print ( car ( cons 1 2 )) ) },
+      q{1},
+    ],
     [ q{( print ( cdr ( list 1 2 )) ) },
       q{(2 . NIL)},
     ],
-    [ q{( print ( cons 1 2 ) ) },
+    [ q{ ( print ( cdr ( cons 1 2 )) ) },
+      q{2},
+    ],
+    [ q{ ( print ( char "asdf" 0 ) ) },
+      q{a},
+      q{first character},
+      todo => 'still cannot pass 0',
+    ],
+    [ q{ ( print ( char "asdf" 1 ) ) },
+      q{s},
+    ],
+    [ q{ ( print ( char "asdf" 3 ) ) },
+      q{f},
+    ],
+    [ q{ ( print ( cons 1 2 ) ) },
       q{(1 . 2)},
     ],
-    [ q{ ( print ( car ( cons 1 2 )) ) },
-      q{1},
+    [ q{ ( print ( cons 1 ( cons 2 3 ) ) ) },
+      q{(1 . (2 . 3))},
     ],
-    [ q{ ( print ( cdr ( cons 1 2 )) ) },
+    [ q{ ( print ( eq 1 1 ) ) },
+      q{T},
+      q{function eq},
+      todo => 'eq is broken',
+    ],
+    [ q{ ( print ( eval '( + 1 1 ) ) ) },
       q{2},
+      q{eval an addition},
+    ],
+    [ q{ ( print ( list 1 2 ) ) },
+      q{(1 . (2 . NIL))},
     ],
     [ q{ ( setq asdf 1234 ) ( print asdf ) },
       q{1234},

Reply via email to