From: daurnimator Date: Sat, 9 Dec 2017 06:20:50 +0000 (+1100) Subject: spec/timetable_spec.lua: Add more test cases for negative day normalisation X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/79d2a9cf417c3eca2d94dac7a814a0d26fb96b68?ds=sidebyside;hp=-c spec/timetable_spec.lua: Add more test cases for negative day normalisation --- 79d2a9cf417c3eca2d94dac7a814a0d26fb96b68 diff --git a/spec/timetable_spec.lua b/spec/timetable_spec.lua index 3713391..b7bc3e3 100644 --- a/spec/timetable_spec.lua +++ b/spec/timetable_spec.lua @@ -102,6 +102,12 @@ describe("Timetable library", function() assert.same({2016,11,30,00,00,00}, {timetable.normalise(2016,12,0,0,0,0)}) assert.same({2017,11,30,00,00,00}, {timetable.normalise(2017,12,0,0,0,0)}) assert.same({2018,11,30,00,00,00}, {timetable.normalise(2018,12,0,0,0,0)}) + + assert.same({2017,2,13,0,0,0}, {timetable.normalise(2017,3,-15,0,0,0)}) + assert.same({2016,10,1,0,0,0}, {timetable.normalise(2017,3,-150,0,0,0)}) + assert.same({2013,1,20,0,0,0}, {timetable.normalise(2017,3,-1500,0,0,0)}) + assert.same({1976,2,4,0,0,0}, {timetable.normalise(2017,3,-15000,0,0,0)}) + assert.same({1606,6,23,0,0,0}, {timetable.normalise(2017,3,-150000,0,0,0)}) end) local function round_trip_add(t, field, x)