+ (list ,name ,test-fn ,debug-fn ,scala-prog ,scala-input)
+ *tests*)))
+
+(defun checksum= (expected got)
+ (if (stringp expected)
+ (string= got expected)
+ (find got expected :test #'string=)))
+
+; To be used only with the simplest of tests, just a list of commands and a checksum of the
+; world after they've been run.
+(defmacro defsimplecommandtest (name commands checksum)
+ `(defsimpletest
+ (format nil "Simple Command - ~A" ,name)
+ (lambda ()
+ (clnl:boot)
+ (clnl:run-commands ,commands)
+ (checksum= ,checksum (checksum-world)))
+ (lambda ()
+ (clnl:boot)
+ (clnl:run-commands ,commands)
+ (format nil "~A~A"
+ (clnl-nvm:export-world)
+ (checksum-world)))
+ "bin/runcmd.scala"
+ (format nil "~A~%" ,commands)))
+
+(defmacro defsimplereportertest (name reporter value checksum)
+ `(defsimpletest
+ (format nil "Simple Reporter - ~A" ,name)
+ (lambda ()
+ (clnl:boot)
+ (and
+ (string= (funcall (intern "DUMP-OBJECT" :clnl-nvm) (clnl:run-reporter ,reporter)) ,value)
+ (checksum= ,checksum (checksum-world))))
+ (lambda ()
+ (clnl:boot)
+ (format nil "~A~%~A~A"
+ (funcall (intern "DUMP-OBJECT" :clnl-nvm) (clnl:run-reporter ,reporter))
+ (clnl-nvm:export-world)
+ (checksum-world)))
+ "bin/runreporter.scala"
+ (format nil "~A~%" ,reporter)))
+
+(defmacro defviewtest (name commands checksum)
+ `(defsimpletest
+ (format nil "Simple View - ~A" ,name)
+ (lambda ()
+ (clnl:boot)
+ (clnl:run-commands ,commands)
+ (let
+ ((viewsum (checksum-view)))
+ (when (not (checksum= ,checksum viewsum))
+ (format t "~c[1;35m-- For ~A, got ~A but expected ~A~c[0m~%" #\Esc ,name viewsum ,checksum #\Esc))
+ (checksum= ,checksum (checksum-view))))
+ (lambda ()
+ (clnl:boot)
+ (clnl:run-commands ,commands)
+ (save-view-to-ppm)
+ (format nil "~A" (checksum-view)))
+ ""
+ (format nil "~A~%" ,commands)))