|
| 1 | +#!/usr/bin/env tclsh |
| 2 | +package require tcltest |
| 3 | +namespace import ::tcltest::* |
| 4 | +source testHelpers.tcl |
| 5 | + |
| 6 | +############################################################ |
| 7 | +source "swift-scheduling.tcl" |
| 8 | + |
| 9 | +test swift-scheduling-01 "NOW translates to two hours later" -body { |
| 10 | + deliveryDate "2012-02-13T09:00:00" "NOW" |
| 11 | +} -returnCodes ok -result "2012-02-13T11:00:00" |
| 12 | + |
| 13 | +skip swift-scheduling-02 |
| 14 | +test swift-scheduling-02 "ASAP before one in the afternoon translates to today at five in the afternoon" -body { |
| 15 | + deliveryDate "1999-06-03T09:45:00" "ASAP" |
| 16 | +} -returnCodes ok -result "1999-06-03T17:00:00" |
| 17 | + |
| 18 | +skip swift-scheduling-03 |
| 19 | +test swift-scheduling-03 "ASAP at one in the afternoon translates to tomorrow at one in the afternoon" -body { |
| 20 | + deliveryDate "2008-12-21T13:00:00" "ASAP" |
| 21 | +} -returnCodes ok -result "2008-12-22T13:00:00" |
| 22 | + |
| 23 | +skip swift-scheduling-04 |
| 24 | +test swift-scheduling-04 "ASAP after one in the afternoon translates to tomorrow at one in the afternoon" -body { |
| 25 | + deliveryDate "2008-12-21T14:50:00" "ASAP" |
| 26 | +} -returnCodes ok -result "2008-12-22T13:00:00" |
| 27 | + |
| 28 | +skip swift-scheduling-05 |
| 29 | +test swift-scheduling-05 "EOW on Monday translates to Friday at five in the afternoon" -body { |
| 30 | + deliveryDate "2025-02-03T16:00:00" "EOW" |
| 31 | +} -returnCodes ok -result "2025-02-07T17:00:00" |
| 32 | + |
| 33 | +skip swift-scheduling-06 |
| 34 | +test swift-scheduling-06 "EOW on Tuesday translates to Friday at five in the afternoon" -body { |
| 35 | + deliveryDate "1997-04-29T10:50:00" "EOW" |
| 36 | +} -returnCodes ok -result "1997-05-02T17:00:00" |
| 37 | + |
| 38 | +skip swift-scheduling-07 |
| 39 | +test swift-scheduling-07 "EOW on Wednesday translates to Friday at five in the afternoon" -body { |
| 40 | + deliveryDate "2005-09-14T11:00:00" "EOW" |
| 41 | +} -returnCodes ok -result "2005-09-16T17:00:00" |
| 42 | + |
| 43 | +skip swift-scheduling-08 |
| 44 | +test swift-scheduling-08 "EOW on Thursday translates to Sunday at eight in the evening" -body { |
| 45 | + deliveryDate "2011-05-19T08:30:00" "EOW" |
| 46 | +} -returnCodes ok -result "2011-05-22T20:00:00" |
| 47 | + |
| 48 | +skip swift-scheduling-09 |
| 49 | +test swift-scheduling-09 "EOW on Friday translates to Sunday at eight in the evening" -body { |
| 50 | + deliveryDate "2022-08-05T14:00:00" "EOW" |
| 51 | +} -returnCodes ok -result "2022-08-07T20:00:00" |
| 52 | + |
| 53 | +skip swift-scheduling-10 |
| 54 | +test swift-scheduling-10 "EOW translates to leap day" -body { |
| 55 | + deliveryDate "2008-02-25T10:30:00" "EOW" |
| 56 | +} -returnCodes ok -result "2008-02-29T17:00:00" |
| 57 | + |
| 58 | +skip swift-scheduling-11 |
| 59 | +test swift-scheduling-11 "2M before the second month of this year translates to the first workday of the second month of this year" -body { |
| 60 | + deliveryDate "2007-01-02T14:15:00" "2M" |
| 61 | +} -returnCodes ok -result "2007-02-01T08:00:00" |
| 62 | + |
| 63 | +skip swift-scheduling-12 |
| 64 | +test swift-scheduling-12 "11M in the eleventh month translates to the first workday of the eleventh month of next year" -body { |
| 65 | + deliveryDate "2013-11-21T15:30:00" "11M" |
| 66 | +} -returnCodes ok -result "2014-11-03T08:00:00" |
| 67 | + |
| 68 | +skip swift-scheduling-13 |
| 69 | +test swift-scheduling-13 "4M in the ninth month translates to the first workday of the fourth month of next year" -body { |
| 70 | + deliveryDate "2019-11-18T15:15:00" "4M" |
| 71 | +} -returnCodes ok -result "2020-04-01T08:00:00" |
| 72 | + |
| 73 | +skip swift-scheduling-14 |
| 74 | +test swift-scheduling-14 "Q1 in the first quarter translates to the last workday of the first quarter of this year" -body { |
| 75 | + deliveryDate "2003-01-01T10:45:00" "Q1" |
| 76 | +} -returnCodes ok -result "2003-03-31T08:00:00" |
| 77 | + |
| 78 | +skip swift-scheduling-15 |
| 79 | +test swift-scheduling-15 "Q4 in the second quarter translates to the last workday of the fourth quarter of this year" -body { |
| 80 | + deliveryDate "2001-04-09T09:00:00" "Q4" |
| 81 | +} -returnCodes ok -result "2001-12-31T08:00:00" |
| 82 | + |
| 83 | +skip swift-scheduling-16 |
| 84 | +test swift-scheduling-16 "Q3 in the fourth quarter translates to the last workday of the third quarter of next year" -body { |
| 85 | + deliveryDate "2022-10-06T11:00:00" "Q3" |
| 86 | +} -returnCodes ok -result "2023-09-29T08:00:00" |
| 87 | + |
| 88 | + |
| 89 | +cleanupTests |
0 commit comments