functions: Always use named test-cases in tests.
This commit is contained in:
parent
e370356fac
commit
6eb6e21979
1 changed files with 10 additions and 6 deletions
|
@ -377,21 +377,24 @@
|
||||||
(define sbf? (and/c tbf? (λ (x) (= 0 (tbf-θ x)))))
|
(define sbf? (and/c tbf? (λ (x) (= 0 (tbf-θ x)))))
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
|
(test-case "sbf?"
|
||||||
(check-false (sbf? (tbf #(1 2) 3)))
|
(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.
|
;;; Creates a TBF which is an SBF from a vector of weights.
|
||||||
(define (sbf w) (tbf w 0))
|
(define (sbf w) (tbf w 0))
|
||||||
|
|
||||||
(module+ test
|
(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
|
;;; Converts a list of numbers to an SBF. The elements of the list
|
||||||
;;; are taken to be the weights of the SBF.
|
;;; are taken to be the weights of the SBF.
|
||||||
(define list->sbf (compose sbf list->vector))
|
(define list->sbf (compose sbf list->vector))
|
||||||
|
|
||||||
(module+ test
|
(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,
|
;;; 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
|
;;; containing a list of lists of numbers. If headers is #t, drops
|
||||||
|
@ -405,5 +408,6 @@
|
||||||
(map list->sbf sexp-clean))
|
(map list->sbf sexp-clean))
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
|
(test-case "read-org-sbfs"
|
||||||
(check-equal? (read-org-sbfs "((1 1) (1 -1))")
|
(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)))))
|
||||||
|
|
Loading…
Reference in a new issue