functions: Always use named test-cases in tests.

This commit is contained in:
Sergiu Ivanov 2020-07-23 00:21:34 +02:00
parent e370356fac
commit 6eb6e21979

View file

@ -377,21 +377,24 @@
(define sbf? (and/c tbf? (λ (x) (= 0 (tbf-θ x)))))
(module+ test
(test-case "sbf?"
(check-false (sbf? (tbf #(1 2) 3)))
(check-true (sbf? (tbf #(1 2) 0))))
(check-true (sbf? (tbf #(1 2) 0)))))
;;; Creates a TBF which is an SBF from a vector of weights.
(define (sbf w) (tbf w 0))
(module+ test
(check-equal? (sbf #(1 -1)) (tbf '#(1 -1) 0)))
(test-case "sbf"
(check-equal? (sbf #(1 -1)) (tbf '#(1 -1) 0))))
;;; Converts a list of numbers to an SBF. The elements of the list
;;; are taken to be the weights of the SBF.
(define list->sbf (compose sbf list->vector))
(module+ test
(check-equal? (list->sbf '(1 -1)) (tbf '#(1 -1) 0)))
(test-case "list->sbf"
(check-equal? (list->sbf '(1 -1)) (tbf '#(1 -1) 0))))
;;; Reads a list of SBF from an Org-mode string containing a sexp,
;;; containing a list of lists of numbers. If headers is #t, drops
@ -405,5 +408,6 @@
(map list->sbf sexp-clean))
(module+ test
(test-case "read-org-sbfs"
(check-equal? (read-org-sbfs "((1 1) (1 -1))")
(list (tbf '#(1 1) 0) (tbf '#(1 -1) 0))))
(list (tbf '#(1 1) 0) (tbf '#(1 -1) 0)))))