Document new cal-day procedures and add more tests.
This commit is contained in:
parent
420b096bea
commit
aa6a9ac705
2 changed files with 68 additions and 0 deletions
|
@ -333,6 +333,56 @@ Parses the string and returns a valid cal-day structure.
|
|||
Tries parsing the string as cal-day and returns the result upon
|
||||
success. Upon failure, parses the string as cal-month.
|
||||
|
||||
(cal-day=? a b)
|
||||
|
||||
* ```a``` - a cal-day value
|
||||
* ```b``` - a cal-day value
|
||||
|
||||
Returns ```#t``` if ```a``` respresents the same date as ```b``` in
|
||||
calendar.
|
||||
|
||||
(cal-day<? a b)
|
||||
|
||||
* ```a``` - a cal-day value
|
||||
* ```b``` - a cal-day value
|
||||
|
||||
Returns ```#t``` if ```a``` comes before ```b``` in calendar.
|
||||
|
||||
(cal-day<=? a b)
|
||||
|
||||
* ```a``` - a cal-day value
|
||||
* ```b``` - a cal-day value
|
||||
|
||||
Returns ```#t``` if ```a``` comes before or is the same date as
|
||||
```b``` in calendar.
|
||||
|
||||
(cal-day>=? a b)
|
||||
|
||||
* ```a``` - a cal-day value
|
||||
* ```b``` - a cal-day value
|
||||
|
||||
Returns ```#t``` if ```a``` comes after or is the same date as ```b```
|
||||
in calendar.
|
||||
|
||||
(cal-day>? a b)
|
||||
|
||||
Returns ```#t``` if ```a``` comes after ```b``` in calendar.
|
||||
|
||||
(cal-day/month<? a b)
|
||||
|
||||
* ```a``` - a cal-day or cal-month value
|
||||
* ```b``` - a cal-day or cal-month value
|
||||
|
||||
Returns ```#t``` if ```a``` and ```b``` are of the same type and
|
||||
```a``` comes before ```b``` in calendar. Raises error if the values
|
||||
are not of the same type.
|
||||
|
||||
(cal-day/month->string v)
|
||||
|
||||
* ```v``` - a cal-day or cal-month value
|
||||
|
||||
Returns appropriate string representation of given value.
|
||||
|
||||
### Format
|
||||
|
||||
(import cal-format)
|
||||
|
|
|
@ -255,6 +255,24 @@
|
|||
(cal-day? (parse-cal-day/month "2023-05-11")))
|
||||
(test-true parse-cal-day/month
|
||||
(cal-month? (parse-cal-day/month "2023-05")))
|
||||
(test-true cal-day/month<?
|
||||
(cal-day/month<? (make-cal-day 2023 5 21)
|
||||
(make-cal-day 2023 5 22)))
|
||||
(test-exn cal-day/month<?
|
||||
(cal-day/month<? (make-cal-day 2023 5 21)
|
||||
(make-cal-month 2023 5)))
|
||||
(test-true cal-day/month<?
|
||||
(cal-day/month<? (make-cal-month 2023 4)
|
||||
(make-cal-month 2023 5)))
|
||||
(test-false cal-day/month<?
|
||||
(cal-day/month<? (make-cal-day 2023 5 22)
|
||||
(make-cal-day 2023 5 22)))
|
||||
(test-equal? cal-day/month->string
|
||||
(cal-day/month->string (make-cal-day 2023 5 22))
|
||||
"2023-05-22")
|
||||
(test-equal? cal-day/month->string
|
||||
(cal-day/month->string (make-cal-month 2023 5))
|
||||
"2023-05")
|
||||
))
|
||||
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue