Month equality.
This commit is contained in:
parent
9c2bafe279
commit
fda45105d6
1 changed files with 9 additions and 2 deletions
|
@ -141,8 +141,11 @@
|
|||
m))
|
||||
(error 'string->month "Invalid month" M)))
|
||||
|
||||
;; Returns true if both arguments are a valid month and are equal
|
||||
(define (month=? m n)
|
||||
#f)
|
||||
(and (valid-month? m)
|
||||
(valid-month? n)
|
||||
(equal? m n)))
|
||||
|
||||
(define (month<? m n)
|
||||
#f)
|
||||
|
@ -153,12 +156,16 @@
|
|||
|
||||
(define (month-tests!)
|
||||
(display "[test] month ")
|
||||
(unit-test 'month-valid? (month-valid? '(2023 5)))
|
||||
(unit-test 'month-valid?-bad-year (not (month-valid? '(999 8))))
|
||||
(unit-test 'month-valid?-bad-month (not (month-valid? '(2023 -5))))
|
||||
;; Parsing
|
||||
(unit-test 'month->string (equal? (month->string '(2023 1)) "2023-01"))
|
||||
(unit-test 'month->string-bad-year (with-handler (lambda (x) #t) (month->string '(999 12)) #f))
|
||||
(unit-test 'month->string-bad-month (with-handler (lambda (x) #t) (month->string '(2023 13)) #f))
|
||||
;; Comparison less
|
||||
;; Comparison equal
|
||||
(unit-test 'month-equal? (month-equal? '(2023 4) '(2023 4)))
|
||||
(unit-test 'month-equal? (not (month-equal? '(2023 4) '(2023 5))))
|
||||
;; Comparison greater
|
||||
;; Difference - TODO: inclusive both ends?
|
||||
(print " ok."))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue