From 79d2a9cf417c3eca2d94dac7a814a0d26fb96b68 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sat, 9 Dec 2017 17:20:50 +1100 Subject: [PATCH 1/1] spec/timetable_spec.lua: Add more test cases for negative day normalisation --- spec/timetable_spec.lua | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- 2.39.5