]> git.madduck.net Git - etc/awesome.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

spec/timetable_spec: more tests
authordaurnimator <quae@daurnimator.com>
Fri, 29 Aug 2014 20:02:40 +0000 (16:02 -0400)
committerdaurnimator <quae@daurnimator.com>
Fri, 29 Aug 2014 20:02:40 +0000 (16:02 -0400)
spec/timetable_spec.lua

index 0ff42b12d7bbccb894a2f0143481dcb10278afc9..34c05295992d0e2dba03768a5e5acce52de62f84 100644 (file)
@@ -41,6 +41,8 @@ describe ( "Timetable library" , function ( )
                assert_same_wday ( 2014 , 1 , 1 )
                assert_same_wday ( 2014 , 1 , 6 )
                assert_same_wday ( 2016 , 2 , 28 )
+               assert_same_wday ( 2016 , 2 , 29 )
+               assert_same_wday ( 2016 , 3 , 1 )
        end )
 
        local function native_timestamp ( year , month , day )
@@ -57,6 +59,16 @@ describe ( "Timetable library" , function ( )
                end
        end )
 
+       it ( "#normalise handles out of range days in a year" , function ( )
+               assert.same ( { timetable.normalise(2013,1,366,0,0,0) } , { 2014,1,1,0,0,0 } )
+               assert.same ( { timetable.normalise(2013,1,400,0,0,0) } , { 2014,2,4,0,0,0 } )
+               assert.same ( { timetable.normalise(2016,1,400,0,0,0) } , { 2017,2,3,0,0,0 } )
+               assert.same ( { timetable.normalise(2015,1,430,0,0,0) } , { 2016,3,5,0,0,0 } )
+               assert.same ( { timetable.normalise(2016,1,430,0,0,0) } , { 2017,3,5,0,0,0 } )
+               assert.same ( { timetable.normalise(2000,1,10000,0,0,0) } , { 2027,5,18,0,0,0 } )
+               assert.same ( { timetable.normalise(2000,1,10000000,0,0,0) } , { 29379,1,25,0,0,0 } )
+       end )
+
        it ( "#normalise handles out of range days in a #month" , function ( )
                assert.same ( { timetable.normalise(2013,0,1,0,0,0) } , { 2012,12,1,0,0,0 } )
                assert.same ( { timetable.normalise(2013,42,1,0,0,0) } , { 2016,6,1,0,0,0 } )