Skip to content

Commit be02d1d

Browse files
committed
testing "times" using new style
1 parent 187e817 commit be02d1d

File tree

1 file changed

+72
-12
lines changed

1 file changed

+72
-12
lines changed

test/java_time_test.clj

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,23 +416,83 @@
416416
(is (j/not-before? dt+5 dt))
417417
(is (not (j/not-before? dt dt+5))))
418418

419-
(is (j/after? (j/local-date clock) (j/minus (j/local-date clock) (j/days 5))))
420-
(is (j/before? (j/local-date clock) (j/plus (j/local-date clock) (j/days 5))))
419+
(let [dt (j/local-date clock)
420+
dt+5 (j/plus dt (j/days 5))]
421+
(is (j/after? dt+5 dt))
422+
(is (not (j/after? dt dt+5)))
423+
(is (j/before? dt dt+5))
424+
(is (not (j/before? dt+5 dt)))
425+
(is (j/not-after? dt dt))
426+
(is (j/not-after? dt dt+5))
427+
(is (not (j/not-after? dt+5 dt)))
428+
(is (j/not-before? dt dt))
429+
(is (j/not-before? dt+5 dt))
430+
(is (not (j/not-before? dt dt+5))))
421431

422-
(is (j/after? (j/local-time clock) (j/minus (j/local-time clock) (j/minutes 5))))
423-
(is (j/before? (j/local-time clock) (j/plus (j/local-time clock) (j/minutes 5))))
432+
(let [dt (j/local-time clock)
433+
dt+5 (j/plus dt (j/minutes 5))]
434+
(is (j/after? dt+5 dt))
435+
(is (not (j/after? dt dt+5)))
436+
(is (j/before? dt dt+5))
437+
(is (not (j/before? dt+5 dt)))
438+
(is (j/not-after? dt dt))
439+
(is (j/not-after? dt dt+5))
440+
(is (not (j/not-after? dt+5 dt)))
441+
(is (j/not-before? dt dt))
442+
(is (j/not-before? dt+5 dt))
443+
(is (not (j/not-before? dt dt+5))))
424444

425-
(is (j/after? (j/zoned-date-time clock) (j/minus (j/zoned-date-time clock) (j/minutes 5))))
426-
(is (j/before? (j/zoned-date-time clock) (j/plus (j/zoned-date-time clock) (j/minutes 5))))
445+
(let [dt (j/zoned-date-time clock)
446+
dt+5 (j/plus dt (j/minutes 5))]
447+
(is (j/after? dt+5 dt))
448+
(is (not (j/after? dt dt+5)))
449+
(is (j/before? dt dt+5))
450+
(is (not (j/before? dt+5 dt)))
451+
(is (j/not-after? dt dt))
452+
(is (j/not-after? dt dt+5))
453+
(is (not (j/not-after? dt+5 dt)))
454+
(is (j/not-before? dt dt))
455+
(is (j/not-before? dt+5 dt))
456+
(is (not (j/not-before? dt dt+5))))
427457

428-
(is (j/after? (j/offset-date-time clock) (j/minus (j/offset-date-time clock) (j/minutes 5))))
429-
(is (j/before? (j/offset-date-time clock) (j/plus (j/offset-date-time clock) (j/minutes 5))))
458+
(let [dt (j/offset-date-time clock)
459+
dt+5 (j/plus dt (j/minutes 5))]
460+
(is (j/after? dt+5 dt))
461+
(is (not (j/after? dt dt+5)))
462+
(is (j/before? dt dt+5))
463+
(is (not (j/before? dt+5 dt)))
464+
(is (j/not-after? dt dt))
465+
(is (j/not-after? dt dt+5))
466+
(is (not (j/not-after? dt+5 dt)))
467+
(is (j/not-before? dt dt))
468+
(is (j/not-before? dt+5 dt))
469+
(is (not (j/not-before? dt dt+5))))
430470

431-
(is (j/after? (j/offset-time clock) (j/minus (j/offset-time clock) (j/minutes 5))))
432-
(is (j/before? (j/offset-time clock) (j/plus (j/offset-time clock) (j/minutes 5))))
471+
(let [dt (j/offset-time clock)
472+
dt+5 (j/plus dt (j/minutes 5))]
473+
(is (j/after? dt+5 dt))
474+
(is (not (j/after? dt dt+5)))
475+
(is (j/before? dt dt+5))
476+
(is (not (j/before? dt+5 dt)))
477+
(is (j/not-after? dt dt))
478+
(is (j/not-after? dt dt+5))
479+
(is (not (j/not-after? dt+5 dt)))
480+
(is (j/not-before? dt dt))
481+
(is (j/not-before? dt+5 dt))
482+
(is (not (j/not-before? dt dt+5))))
433483

434-
(is (j/after? (j/instant clock) (j/minus (j/instant clock) (j/minutes 5))))
435-
(is (j/before? (j/instant clock) (j/plus (j/instant clock) (j/minutes 5)))))
484+
(let [dt (j/instant clock)
485+
dt+5 (j/plus dt (j/minutes 5))]
486+
(is (j/after? dt+5 dt))
487+
(is (not (j/after? dt dt+5)))
488+
(is (j/before? dt dt+5))
489+
(is (not (j/before? dt+5 dt)))
490+
(is (j/not-after? dt dt))
491+
(is (j/not-after? dt dt+5))
492+
(is (not (j/not-after? dt+5 dt)))
493+
(is (j/not-before? dt dt))
494+
(is (j/not-before? dt+5 dt))
495+
(is (not (j/not-before? dt dt+5)))))
436496

437497
(testing "clocks"
438498
(is (j/after? (j/fixed-clock 1000) (j/fixed-clock 0)))

0 commit comments

Comments
 (0)