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