From: Frank Duncan Date: Sun, 24 Apr 2016 02:27:44 +0000 (-0500) Subject: Prims - Implement -, *, +, / X-Git-Tag: v0.1.0~47 X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?a=commitdiff_plain;h=ede7df20b380cf9d943a8e004965c5712d7b8ce6;p=clnl Prims - Implement -, *, +, / --- diff --git a/src/main/transpile.lisp b/src/main/transpile.lisp index 59356e3..d3f9612 100644 --- a/src/main/transpile.lisp +++ b/src/main/transpile.lisp @@ -78,6 +78,10 @@ DESCRIPTION: (defsimpleprim := :reporter cl:equalp) (defprim :!= :reporter (lambda (a b) `(not (equalp ,a ,b)))) +(defsimpleprim :- :reporter cl:-) +(defsimpleprim :+ :reporter cl:+) +(defsimpleprim :* :reporter cl:*) +(defsimpleprim :/ :reporter cl:/) (defsimpleprim :ask :command clnl-nvm:ask) (defsimpleprim :crt :command clnl-nvm:create-turtles) (defsimpleprim :fd :command clnl-nvm:forward) diff --git a/src/test/simpletests.lisp b/src/test/simpletests.lisp index 54847ef..c3796ec 100644 --- a/src/test/simpletests.lisp +++ b/src/test/simpletests.lisp @@ -41,3 +41,39 @@ (defsimplereportertest "!= 2" "5 != 4" "true" "E1DE30F072D785E0D0B59F28B0F7853E3D3E0D8B") + +(defsimplereportertest "- 1" "5 - 5" "0" + "E1DE30F072D785E0D0B59F28B0F7853E3D3E0D8B") + +(defsimplereportertest "- 2" "5 - 6" "-1" + "E1DE30F072D785E0D0B59F28B0F7853E3D3E0D8B") + +(defsimplereportertest "- 3" "random-float 5 - random-float 5" "3.349608870016444" + "811837B74F63D10ABBC01DD59C1E7556706D9F7A") + +(defsimplereportertest "+ 1" "5 + 5" "10" + "E1DE30F072D785E0D0B59F28B0F7853E3D3E0D8B") + +(defsimplereportertest "+ 2" "5 + -6" "-1" + "E1DE30F072D785E0D0B59F28B0F7853E3D3E0D8B") + +(defsimplereportertest "+ 3" "random-float 6 + random-float 6" "6.166281795942972" + "811837B74F63D10ABBC01DD59C1E7556706D9F7A") + +(defsimplereportertest "* 1" "5 * 5" "25" + "E1DE30F072D785E0D0B59F28B0F7853E3D3E0D8B") + +(defsimplereportertest "* 2" "5 * -6" "-30" + "E1DE30F072D785E0D0B59F28B0F7853E3D3E0D8B") + +(defsimplereportertest "* 3" "random-float 4 * random-float 7" "4.251800892259665" + "811837B74F63D10ABBC01DD59C1E7556706D9F7A") + +(defsimplereportertest "/ 1" "5 / 5" "1" + "E1DE30F072D785E0D0B59F28B0F7853E3D3E0D8B") + +(defsimplereportertest "/ 2" "5 / -6" "-0.8333333333333334" + "E1DE30F072D785E0D0B59F28B0F7853E3D3E0D8B") + +(defsimplereportertest "/ 3" "random-float 4 / random-float 7" "2.7112896835726876" + "811837B74F63D10ABBC01DD59C1E7556706D9F7A")