From aa766557552db2ec5c52de807c7826cd3662c23a Mon Sep 17 00:00:00 2001 From: Victor Fors Date: Sat, 27 Nov 2021 14:58:57 +0100 Subject: [PATCH] tests --- test-util.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test-util.scm diff --git a/test-util.scm b/test-util.scm new file mode 100644 index 0000000..207242f --- /dev/null +++ b/test-util.scm @@ -0,0 +1,20 @@ +(module test-util () + (import scheme) + (import (chicken base)) + (import (chicken syntax)) + (import test) + (import util) + + (test-group "util" + (test '(2 3 4) (map (curry + 1) '(1 2 3))) + (test 3 ((applied +) '(1 2))) + (test 2 ((thunk (+ 1 1)))) + (test 5 ((just (lambda () 5)) 6 7 8)) + (test-group "perhaps" + (test 3 (let ((v 2)) + (perhaps (lambda (n) + (+ n 1)) v))) + (test #f (let ((v #f)) + (perhaps (lambda (n) + (+ n 1)) v)))) + (test 'apple-orange (compose-symbols 'apple 'orange))))