|
438 | 438 | (is (= j/plus j/+))
|
439 | 439 | (is (= j/minus j/-)))
|
440 | 440 |
|
| 441 | +(defmacro is-<-coerce |
| 442 | + [a b c a' b' c'] |
| 443 | + (assert ((every-pred symbol?) a b c)) |
| 444 | + (assert ((every-pred (some-fn number? keyword?)) a' b' c')) |
| 445 | + `(do (is (j/> ~b ~a')) |
| 446 | + (is (not (j/> ~a ~b'))) |
| 447 | + (is (j/< ~b ~c')) |
| 448 | + (is (not (j/< ~c ~b'))) |
| 449 | + (is (j/<= ~b ~c')) |
| 450 | + ;;FIXME https://github.com/dm3/clojure.java-time/issues/105 |
| 451 | + ;;(is (j/<= ~b ~b')) |
| 452 | + (is (not (j/<= ~c ~b'))) |
| 453 | + ;;FIXME https://github.com/dm3/clojure.java-time/issues/105 |
| 454 | + ;;(is (j/>= ~b ~b')) |
| 455 | + (is (j/>= ~b ~a')) |
| 456 | + (is (not (j/>= ~a ~b'))))) |
| 457 | + |
441 | 458 | (defmacro is-< [a b c]
|
442 | 459 | (assert ((every-pred symbol?) a b c))
|
443 | 460 | `(do (is (j/> ~a))
|
|
504 | 521 | (let [thursday (j/day-of-week :thursday)
|
505 | 522 | saturday (j/day-of-week :saturday)
|
506 | 523 | sunday (j/day-of-week :sunday)]
|
507 |
| - ;; no properties |
508 |
| - (is (j/after? saturday :thursday)) |
509 |
| - (is (not (j/after? thursday :saturday))) |
510 |
| - (is (j/before? saturday :sunday)) |
511 |
| - (is (not (j/before? sunday :saturday))) |
512 |
| - ;; has properties |
| 524 | + (is-<-coerce thursday saturday sunday |
| 525 | + :thursday :saturday :sunday) |
513 | 526 | (is-< thursday saturday sunday))
|
514 | 527 |
|
515 | 528 | (let [january (j/month :january)
|
516 | 529 | february (j/month :february)
|
517 | 530 | march (j/month :march)]
|
518 |
| - ;; no properties |
519 |
| - (is (j/after? february :january)) |
520 |
| - (is (not (j/after? january :february))) |
521 |
| - (is (j/before? february :march)) |
522 |
| - (is (not (j/before? march :february))) |
523 |
| - ;; has properties |
| 531 | + (is-<-coerce january february march |
| 532 | + :january :february :march) |
524 | 533 | (is-< january february march))
|
525 | 534 |
|
526 | 535 | (let [year-2009 (j/year 2009)
|
527 | 536 | year-2010 (j/year 2010)
|
528 | 537 | year-2011 (j/year 2011)]
|
529 |
| - ;; no properties |
530 |
| - (is (j/after? year-2010 2009)) |
531 |
| - (is (not (j/after? year-2009 2010))) |
532 |
| - (is (j/before? year-2009 2010)) |
533 |
| - (is (not (j/before? year-2010 2009))) |
534 |
| - ;; has properties |
| 538 | + (is-<-coerce year-2009 year-2010 year-2011 |
| 539 | + 2009 2010 2011) |
535 | 540 | (is-< year-2009 year-2010 year-2011))
|
536 | 541 |
|
537 | 542 | (let [jan-1 (j/month-day 1 1)
|
|
0 commit comments