From a317760054ac780d685f85228fe36eb87c6e0842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 4 Aug 2011 21:16:12 +0200 Subject: cleanup age_spec --- spec/age_spec.rb | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/spec/age_spec.rb b/spec/age_spec.rb index 23d54cb..045570c 100644 --- a/spec/age_spec.rb +++ b/spec/age_spec.rb @@ -56,11 +56,7 @@ describe DateTime do r[1].should >= 0 r[1].should <= 11 r[2].should >= 0 - if r[2]>31 - puts @b - puts at - end - r[2].should <= 31 + r[2].should <= 30 x = (@b>>(12*r[0]+r[1]))+r[2] x.year.should eql at.year x.month.should eql at.month @@ -69,27 +65,26 @@ describe DateTime do end it "should pass time computation" do # change years - full_check @b, DateTime.civil( 2010, 6, 27, 4, 40, 0), 0, 11, 0, 0, 0, 0 + full_check @b, DateTime.civil( 2010, 7, 26, 4, 40, 0), 0, 11, 29, 0, 0, 0 full_check @b, DateTime.civil( 2010, 7, 27, 3, 40, 0), 0, 11, 29, 23, 0, 0 full_check @b, DateTime.civil( 2010, 7, 27, 4, 39, 0), 0, 11, 29, 23, 59, 0 full_check @b, DateTime.civil( 2010, 7, 27, 4, 39, 59), 0, 11, 29, 23, 59, 59 full_check @b, DateTime.civil( 2010, 7, 27, 4, 40, 0), 1, 0, 0, 0, 0, 0 - full_check @b, DateTime.civil( 2010, 9, 25, 3, 40, 0), 1, 1, 28, 23, 0, 0 - full_check @b, DateTime.civil( 2010, 9, 25, 4, 39, 0), 1, 1, 28, 23, 59, 0 - full_check @b, DateTime.civil( 2010, 9, 25, 4, 39, 59), 1, 1, 28, 23, 59, 59 - full_check @b, DateTime.civil( 2010, 9, 25, 4, 40, 0), 1, 1, 29, 0, 0, 0 - full_check @b, DateTime.civil( 2010, 9, 26, 3, 40, 0), 1, 1, 29, 23, 0, 0 - full_check @b, DateTime.civil( 2010, 9, 26, 4, 39, 0), 1, 1, 29, 23, 59, 0 - full_check @b, DateTime.civil( 2010, 9, 26, 4, 39, 59), 1, 1, 29, 23, 59, 59 - full_check @b, DateTime.civil( 2010, 9, 26, 4, 40, 0), 1, 1, 30, 0, 0, 0 - full_check @b, DateTime.civil( 2010, 9, 27, 3, 40, 0), 1, 1, 30, 23, 0, 0 - full_check @b, DateTime.civil( 2010, 9, 27, 4, 39, 0), 1, 1, 30, 23, 59, 0 - full_check @b, DateTime.civil( 2010, 9, 27, 4, 39, 59), 1, 1, 30, 23, 59, 59 - full_check @b, DateTime.civil( 2010, 9, 27, 4, 40, 0), 1, 2, 0, 0, 0, 0 - full_check @b, DateTime.civil( 2010, 9, 28, 3, 40, 0), 1, 2, 0, 23, 0, 0 - full_check @b, DateTime.civil( 2010, 9, 28, 4, 39, 0), 1, 2, 0, 23, 59, 0 - full_check @b, DateTime.civil( 2010, 9, 28, 4, 39, 59), 1, 2, 0, 23, 59, 59 - full_check @b, DateTime.civil( 2010, 9, 28, 4, 40, 0), 1, 2, 1, 0, 0, 0 - full_check @b, DateTime.civil( 2010, 9, 29, 3, 40, 0), 1, 2, 1, 23, 0, 0 + full_check @b, DateTime.civil( 2010, 8, 25, 4, 40, 0), 1, 0, 29, 0, 0, 0 + full_check @b, DateTime.civil( 2010, 8, 26, 3, 40, 0), 1, 0, 29, 23, 0, 0 + full_check @b, DateTime.civil( 2010, 8, 26, 4, 39, 0), 1, 0, 29, 23, 59, 0 + full_check @b, DateTime.civil( 2010, 8, 26, 4, 39, 59), 1, 0, 29, 23, 59, 59 + full_check @b, DateTime.civil( 2010, 8, 26, 4, 40, 0), 1, 0, 30, 0, 0, 0 + full_check @b, DateTime.civil( 2010, 8, 27, 3, 40, 0), 1, 0, 30, 23, 0, 0 + full_check @b, DateTime.civil( 2010, 8, 27, 4, 39, 0), 1, 0, 30, 23, 59, 0 + full_check @b, DateTime.civil( 2010, 8, 27, 4, 39, 59), 1, 0, 30, 23, 59, 59 + full_check @b, DateTime.civil( 2010, 8, 27, 4, 40, 0), 1, 1, 0, 0, 0, 0 + full_check @b, DateTime.civil( 2010, 8, 28, 3, 40, 0), 1, 1, 0, 23, 0, 0 + full_check @b, DateTime.civil( 2010, 8, 28, 4, 39, 0), 1, 1, 0, 23, 59, 0 + full_check @b, DateTime.civil( 2010, 8, 28, 4, 39, 59), 1, 1, 0, 23, 59, 59 + full_check @b, DateTime.civil( 2010, 8, 28, 4, 40, 0), 1, 1, 1, 0, 0, 0 + full_check @b, DateTime.civil( 2010, 8, 29, 3, 40, 0), 1, 1, 1, 23, 0, 0 + full_check @b, DateTime.civil( 2010, 8, 29, 4, 39, 0), 1, 1, 1, 23, 59, 0 + full_check @b, DateTime.civil( 2010, 8, 29, 4, 39, 59), 1, 1, 1, 23, 0, 59 end end -- cgit v1.1-2-g2b99