mirror of
https://github.com/correl/calrissian.git
synced 2024-11-23 11:09:58 +00:00
Clean up maybe monad tests
Removed redundant tests
This commit is contained in:
parent
8ffd854ee2
commit
fdfdd8b085
1 changed files with 3 additions and 21 deletions
|
@ -11,22 +11,17 @@
|
||||||
|
|
||||||
(test-monad maybe-monad)
|
(test-monad maybe-monad)
|
||||||
|
|
||||||
(deftest bind-short-circuit-value
|
(deftest nothing-short-circuits-value
|
||||||
(is-equal 'nothing
|
(is-equal 'nothing
|
||||||
(>>= maybe-monad 'nothing
|
(>>= maybe-monad 'nothing
|
||||||
(lambda (x) (+ 5 x)))))
|
(lambda (x) (+ 5 x)))))
|
||||||
|
|
||||||
(deftest bind-short-circuit-error
|
(deftest nothing-short-circuits-error
|
||||||
(is-equal 'nothing
|
(is-equal 'nothing
|
||||||
(>>= maybe-monad 'nothing
|
(>>= maybe-monad 'nothing
|
||||||
(lambda (_) (error 'bad-func)))))
|
(lambda (_) (error 'bad-func)))))
|
||||||
|
|
||||||
(deftest bind
|
(deftest fold-increment-value
|
||||||
(is-equal 10
|
|
||||||
(>>= maybe-monad (tuple 'just 5)
|
|
||||||
(lambda (x) (+ 5 x)))))
|
|
||||||
|
|
||||||
(deftest bind-fold
|
|
||||||
(is-equal #(just 3)
|
(is-equal #(just 3)
|
||||||
(let ((minc (lambda (x) (return maybe-monad (+ 1 x))))
|
(let ((minc (lambda (x) (return maybe-monad (+ 1 x))))
|
||||||
(bind (lambda (f m) (>>= maybe-monad m f))))
|
(bind (lambda (f m) (>>= maybe-monad m f))))
|
||||||
|
@ -35,16 +30,3 @@
|
||||||
(list minc
|
(list minc
|
||||||
minc
|
minc
|
||||||
minc)))))
|
minc)))))
|
||||||
|
|
||||||
(deftest do-bindings
|
|
||||||
(is-equal #(just 3)
|
|
||||||
(do-m maybe-monad
|
|
||||||
(a <- #(just 1))
|
|
||||||
(b <- #(just 2))
|
|
||||||
(return maybe-monad (+ a b)))))
|
|
||||||
|
|
||||||
(deftest do-nobindings
|
|
||||||
(is-equal #(just 3)
|
|
||||||
(do-m maybe-monad
|
|
||||||
#(just 5)
|
|
||||||
#(just 3))))
|
|
||||||
|
|
Loading…
Reference in a new issue