Rename identifiers.

This commit is contained in:
Dominik Pantůček 2023-05-09 19:41:22 +02:00
parent 54712827bd
commit 1fdfaee662

View file

@ -96,7 +96,7 @@
(define (sort-period-markers l)
(sort l
(lambda (a b)
(month<? (cadr a) (cadr b)))))
(cal-month<? (cadr a) (cadr b)))))
;; Converts list of start/stop markers to list of pairs of months -
;; periods. The markers are lists in the form (start/stop cal-month).
@ -227,16 +227,16 @@
(test-equal? sort-period-markers
(sort-period-markers '((start (2023 1)) (stop (2022 10)) (start (2022 3))))
'((start (2022 3)) (stop (2022 10)) (start (2023 1))))
(test-equal? period-markers->periods
(period-markers->periods
(test-equal? period-markers->cal-periods
(period-markers->cal-periods
'((start (2022 3)) (stop (2022 10)) (start (2023 1)) (stop (2023 4))))
'(#t
(((2022 3) (2022 10) #f #f)
((2023 1) (2023 4) #f #f))
""
-1))
(test-equal? period-markers->periods-open
(period-markers->periods
(test-equal? period-markers->cal-periods-open
(period-markers->cal-periods
'((start (2022 3)) (stop (2022 10)) (start (2023 1)) (stop (2023 4)) (start (2023 5))))
'(#t
(((2022 3) (2022 10) #f #f)
@ -244,42 +244,42 @@
((2023 5) #f #f #f))
""
-1))
(test-eq? period-duration
(period->duration '((2023 1) (2023 4) #f #f)) 3)
(test-eq? cal-period->duration
(cal-period->duration '((2023 1) (2023 4) #f #f)) 3)
(parameterize ((*current-month* (list 2023 4)))
(test-eq? period-duration
(period->duration '((2023 1) #f #f #f)) 3))
(test-eq? periods-duration
(periods-duration '(((2022 3) (2022 10) #f #f)
(test-eq? cal-period->duration
(cal-period->duration '((2023 1) #f #f #f)) 3))
(test-eq? cal-periods-duration
(cal-periods-duration '(((2022 3) (2022 10) #f #f)
((2023 1) (2023 4) #f #f)))
10)
(test-true month-in-period?
(month-in-period? '((2022 1) (2022 4) #f #f) '(2022 3)))
(test-false month-in-period?
(month-in-period? '((2022 1) (2022 4) #f #f) '(2022 5)))
(test-true month-in-periods?
(month-in-periods? '(((2022 1) (2022 4) #f #f)
(test-true cal-month-in-period?
(cal-month-in-period? '((2022 1) (2022 4) #f #f) '(2022 3)))
(test-false cal-month-in-period?
(cal-month-in-period? '((2022 1) (2022 4) #f #f) '(2022 5)))
(test-true cal-month-in-periods?
(cal-month-in-periods? '(((2022 1) (2022 4) #f #f)
((2023 5) (2023 10) #f #f))
'(2022 3)))
(test-true month-in-periods?
(month-in-periods? '(((2022 1) (2022 4) #f #f)
(test-true cal-month-in-periods?
(cal-month-in-periods? '(((2022 1) (2022 4) #f #f)
((2023 5) (2023 10) #f #f))
'(2023 7)))
(test-false month-in-periods?
(month-in-periods? '(((2022 1) (2022 4) #f #f)
(test-false cal-month-in-periods?
(cal-month-in-periods? '(((2022 1) (2022 4) #f #f)
((2023 5) (2023 10) #f #f))
'(2022 10)))
(test-equal? period->string
(period->string '((2022 1) (2022 4) #f #f))
(test-equal? cal-period->string
(cal-period->string '((2022 1) (2022 4) #f #f))
"2022-01..2022-04")
(test-equal? periods->string
(periods->string '(((2022 1) (2022 4) #f #f)
(test-equal? cal-periods->string
(cal-periods->string '(((2022 1) (2022 4) #f #f)
((2022 12) (2023 2) #f #f)))
"2022-01..2022-04, 2022-12..2023-02")
(test-false periods-match (periods-match '(((2022 1) (2022 4) #f #f)
(test-false cal-periods-match (cal-periods-match '(((2022 1) (2022 4) #f #f)
((2022 12) (2023 2) #f #f))
'(2022 5)))
(test-equal? periods-match (periods-match '(((2022 1) (2022 4) #f #f)
(test-equal? cal-periods-match (cal-periods-match '(((2022 1) (2022 4) #f #f)
((2022 12) (2023 2) #f #f))
'(2022 2))
'((2022 1) (2022 4) #f #f))