diff options
author | Colin Okay <okay@toyful.space> | 2021-09-03 08:01:01 -0500 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2021-09-03 08:01:01 -0500 |
commit | d42f764fecc92697020b079db2819a500e5f619d (patch) | |
tree | 8c38f449887519c8c7db84067ba5a522810230af | |
parent | 454f9dea4ea2d2bd440e891d27f64814b98ce313 (diff) |
added examples.lisp
-rw-r--r-- | examples.lisp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/examples.lisp b/examples.lisp new file mode 100644 index 0000000..df3de19 --- /dev/null +++ b/examples.lisp @@ -0,0 +1,42 @@ +(defpackage :testiere.examples + (:use #:cl) + (:import-from #:testiere + #:defun+ + #:defmethod+)) + +(in-package :testiere.examples) + +(defun+ fibble (x y &key (z 10)) + "Hey, a docstring." + :tests + (= (1 2) 13) + (>= (1 2 :z 1) -5) + (:outputp (0 0 :z 0) (lambda (result) (equalp result 0))) + (:fails ("strings" "ain't" :z "numbers")) + :end + (+ x y z)) + + +(defvar *count*) + +(defun+ increment-count () + "Increments the *count* variable." + :tests + (:with-bindings ((*count* 4)) + (:afterp () (lambda () (= *count* 5))) + (= () 6) + (:outputp () (lambda (x) (= x 7)))) + :end + (incf *count*)) + + +(defun just-a-function () + (print "Just a function.")) + +(defun+ call-just-a-function () + "Calls JUST-A-FUNCTION." + :tests + (:with-stubs ((just-a-function () (print "TEMP JUST-A-FUNCTION."))) + (equal () "TEMP JUST-A-FUNCTION.")) + :end + (just-a-function)) |