pike.git / lib / modules / Calendar.pmod / testsuite.in

version» Context lines:

pike.git/lib/modules/Calendar.pmod/testsuite.in:1:   START_MARKER - dnl $Id: testsuite.in,v 1.20 2008/05/22 20:21:01 mast Exp $ + dnl $Id: testsuite.in,v 1.21 2008/05/22 20:26:21 mast Exp $      dnl NOTE:   dnl *every* time the Calendar tests have failed, it's not the   dnl Calendar module that had any errors. Please don't commit   dnl your Pike until you've got Calendar to compile again. /Mirar      test_true(Calendar.Day())      test_eq([[Calendar.Austrian.Day(2500000)->month_day()]],31)   test_eq([[Calendar.Coptic.Day(2500000)->month_day()]],25);
pike.git/lib/modules/Calendar.pmod/testsuite.in:130:   test_eq([[ Calendar.ISO.Week(2005, 1)->format_ymd() ]], "2005-01-03")      test_eq([[Calendar.Language["swe"]->week_day_name_from_number(1)]], "mÃ¥ndag")      test_any([[    object k=Calendar.Events.se["midsummers eve"]->next(Calendar.Year());    return k->second(1)!=k->second(2);   ]], 1)      test_eq([[Calendar.ISO.Day (2007, 12, 31)->week()->month_day()]], 31); +  + dnl Tests for year spanning weeks.   test_any([[ -  object d = Calendar.ISO.Day (2007, 12, 01); +  object d = Calendar.ISO.dwim_day ("2007-12-01");    d->week_day();    return d->range (d)->week()->year_no();   ]], 2007) -  - test_eq([[(Calendar.ISO.Week (2007, 52) + 1)->year_no()]], 2008) -  - test_eq([[Calendar.ISO.Week (2007, 1)->distance (Calendar.ISO.Week (2008, 1))->number_of_weeks()]], 52) -  - test_eq([[Calendar.ISO.Year(2007)->year()->year_no()]], 2007) - test_eq([[Calendar.ISO.Year(2007)->year(1)->year_no()]], 2007) - test_eq([[Calendar.ISO.Year(2007)->year(-1)->year_no()]], 2007) - test_eq([[Calendar.ISO.Year(2007)->set_size(2)->year()->year_no()]], 2007) - test_eq([[Calendar.ISO.Year(2007)->set_size(2)->year(1)->year_no()]], 2007) - test_eq([[Calendar.ISO.Year(2007)->set_size(2)->year(2)->year_no()]], 2008) - test_eq([[Calendar.ISO.Year(2007)->set_size(2)->year(-2)->year_no()]], 2007) - test_eq([[Calendar.ISO.Year(2007)->set_size(2)->year(-1)->year_no()]], 2008) - test_equal([[Calendar.ISO.Year(2007)->set_size(2)->years()->year_no()]], ({2007, 2008})) - test_equal([[Calendar.ISO.Year(2007)->set_size(2)->years(1,1)->year_no()]], ({2007})) - test_equal([[Calendar.ISO.Year(2007)->set_size(2)->years(2,2)->year_no()]], ({2008})) - test_equal([[Calendar.ISO.Year(2007)->set_size(2)->years(1,2)->year_no()]], ({2007, 2008})) - test_equal([[Calendar.ISO.Year(2007)->set_size(2)->years(0,2)->year_no()]], ({2007, 2008})) - test_equal([[Calendar.ISO.Year(2007)->set_size(2)->years(1,3)->year_no()]], ({2007, 2008})) -  - test_eq([[Calendar.ISO.Month(2007,7)->month()->month_no()]], 7) - test_eq([[Calendar.ISO.Month(2007,7)->month(1)->month_no()]], 7) - test_eq([[Calendar.ISO.Month(2007,7)->month(-1)->month_no()]], 7) - test_eq([[Calendar.ISO.Month(2007,7)->set_size(2)->month()->month_no()]], 7) - test_eq([[Calendar.ISO.Month(2007,7)->set_size(2)->month(1)->month_no()]], 7) - test_eq([[Calendar.ISO.Month(2007,7)->set_size(2)->month(2)->month_no()]], 8) - test_eq([[Calendar.ISO.Month(2007,7)->set_size(2)->month(-2)->month_no()]], 7) - test_eq([[Calendar.ISO.Month(2007,7)->set_size(2)->month(-1)->month_no()]], 8) - test_equal([[Calendar.ISO.Month(2007,7)->set_size(2)->months()->month_no()]], ({7, 8})) - test_equal([[Calendar.ISO.Month(2007,7)->set_size(2)->months(1,1)->month_no()]], ({7})) - test_equal([[Calendar.ISO.Month(2007,7)->set_size(2)->months(2,2)->month_no()]], ({8})) - test_equal([[Calendar.ISO.Month(2007,7)->set_size(2)->months(1,2)->month_no()]], ({7, 8})) - test_equal([[Calendar.ISO.Month(2007,7)->set_size(2)->months(0,2)->month_no()]], ({7, 8})) - test_equal([[Calendar.ISO.Month(2007,7)->set_size(2)->months(1,3)->month_no()]], ({7, 8})) -  - test_eq([[Calendar.ISO.Week(2007,7)->week()->week_no()]], 7) - test_eq([[Calendar.ISO.Week(2007,7)->week(1)->week_no()]], 7) - test_eq([[Calendar.ISO.Week(2007,7)->week(-1)->week_no()]], 7) - test_eq([[Calendar.ISO.Week(2007,7)->set_size(2)->week()->week_no()]], 7) - test_eq([[Calendar.ISO.Week(2007,7)->set_size(2)->week(1)->week_no()]], 7) - test_eq([[Calendar.ISO.Week(2007,7)->set_size(2)->week(2)->week_no()]], 8) - test_eq([[Calendar.ISO.Week(2007,7)->set_size(2)->week(-2)->week_no()]], 7) - test_eq([[Calendar.ISO.Week(2007,7)->set_size(2)->week(-1)->week_no()]], 8) - test_equal([[Calendar.ISO.Week(2007,7)->set_size(2)->weeks()->week_no()]], ({7, 8})) - test_equal([[Calendar.ISO.Week(2007,7)->set_size(2)->weeks(1,1)->week_no()]], ({7})) - test_equal([[Calendar.ISO.Week(2007,7)->set_size(2)->weeks(2,2)->week_no()]], ({8})) - test_equal([[Calendar.ISO.Week(2007,7)->set_size(2)->weeks(1,2)->week_no()]], ({7, 8})) - test_equal([[Calendar.ISO.Week(2007,7)->set_size(2)->weeks(0,2)->week_no()]], ({7, 8})) - test_equal([[Calendar.ISO.Week(2007,7)->set_size(2)->weeks(1,3)->week_no()]], ({7, 8})) -  - test_eq([[Calendar.ISO.Day(2007,7,7)->day()->month_day()]], 7) - test_eq([[Calendar.ISO.Day(2007,7,7)->day(1)->month_day()]], 7) - test_eq([[Calendar.ISO.Day(2007,7,7)->day(-1)->month_day()]], 7) - test_eq([[Calendar.ISO.Day(2007,7,7)->set_size(2)->day()->month_day()]], 7) - test_eq([[Calendar.ISO.Day(2007,7,7)->set_size(2)->day(1)->month_day()]], 7) - test_eq([[Calendar.ISO.Day(2007,7,7)->set_size(2)->day(2)->month_day()]], 8) - test_eq([[Calendar.ISO.Day(2007,7,7)->set_size(2)->day(-2)->month_day()]], 7) - test_eq([[Calendar.ISO.Day(2007,7,7)->set_size(2)->day(-1)->month_day()]], 8) - test_equal([[Calendar.ISO.Day(2007,7,7)->set_size(2)->days()->month_day()]], ({7, 8})) - test_equal([[Calendar.ISO.Day(2007,7,7)->set_size(2)->days(1,1)->month_day()]], ({7})) - test_equal([[Calendar.ISO.Day(2007,7,7)->set_size(2)->days(2,2)->month_day()]], ({8})) - test_equal([[Calendar.ISO.Day(2007,7,7)->set_size(2)->days(1,2)->month_day()]], ({7, 8})) - test_equal([[Calendar.ISO.Day(2007,7,7)->set_size(2)->days(0,2)->month_day()]], ({7, 8})) - test_equal([[Calendar.ISO.Day(2007,7,7)->set_size(2)->days(1,3)->month_day()]], ({7, 8})) -  - test_eq([[Calendar.ISO.Year (Calendar.ISO.Month (2007, 12)->set_size (2))->nice_print_period()]], "2007..2008") - test_eq([[Calendar.ISO.Year (Calendar.ISO.Week (2007, 52)->set_size (2))->nice_print_period()]], "2007..2008") - test_eq([[Calendar.ISO.Year (Calendar.ISO.Day (2007, 12, 31)->set_size (2))->nice_print_period()]], "2007..2008") - test_equal([[Calendar.ISO.Year (Calendar.ISO.Month (2007, 12)->set_size (2))->years()->year_no()]], ({2007, 2008})) - test_equal([[Calendar.ISO.Year (Calendar.ISO.Week (2007, 52)->set_size (2))->years()->year_no()]], ({2007, 2008})) - test_equal([[Calendar.ISO.Year (Calendar.ISO.Day (2007, 12, 31)->set_size (2))->years()->year_no()]], ({2007, 2008})) - test_eq([[Calendar.ISO.Month (Calendar.ISO.Week (2007, 52)->set_size (2))->nice_print_period()]], "December 2007 .. January 2008") - test_eq([[Calendar.ISO.Month (Calendar.ISO.Day (2007, 12, 31)->set_size (2))->nice_print_period()]], "December 2007 .. January 2008") -  - test_eq([[Calendar.ISO.Month (2008, 2)->week (1)]], Calendar.ISO.Week (2008, 5)) - test_eq([[Calendar.ISO.Month (2008, 2)->week (-1)]], Calendar.ISO.Week (2008, 9)) - test_eq([[Calendar.ISO.Month (2008, 2)->week (5)]], Calendar.ISO.Week (2008, 9)) - test_eval_error([[Calendar.ISO.Month (2008, 2)->week (6)]]) -  - dnl This is a bit counterintuitive but it's consistent with weeks - dnl overlapping months. - test_eq([[Calendar.ISO.Year (2004)->week (-1)]], Calendar.ISO.Week (2004, 53)) - test_eq([[Calendar.ISO.Year (2005)->week (1)]], Calendar.ISO.Week (2004, 53)) - test_eq([[Calendar.ISO.Year (2005)->week (-1)]], Calendar.ISO.Week (2005, 52)) - test_eq([[Calendar.ISO.Year (2006)->week (1)]], Calendar.ISO.Week (2005, 52)) - test_eq([[Calendar.ISO.Year (2006)->week (-1)]], Calendar.ISO.Week (2006, 52)) - test_eq([[Calendar.ISO.Year (2007)->week (1)]], Calendar.ISO.Week (2007, 1)) -  - dnl Tests for year spanning weeks. +    test_eq([[Calendar.ISO.Day (2007, 12, 31)->format_iso_week()]], "2008-W01")   test_eq([[Calendar.ISO.Day (2007, 12, 31)->format_iso_week_short()]], "200801")   test_eq([[Calendar.ISO.Day (2007, 12, 31)->set_size (Calendar.ISO.Week())->format_iso_week()]], "2008-W01")   test_eq([[Calendar.ISO.Day (2007, 12, 31)->set_size (Calendar.ISO.Week())->year_no()]], 2008)   test_eq([[Calendar.ISO.Week (2008, 1)->set_size (Calendar.ISO.Day())->format_ymd()]], "2007-12-31")   test_eq([[Calendar.ISO.Week (2008, 1)->set_size (Calendar.ISO.Day())->year_no()]], 2007)   test_eq([[Calendar.ISO.Week (2008, 1)->year_no()]], 2008) - test_eq([[Calendar.ISO.Week (2008, 1)->year_day()]], 0) - test_equal([[Calendar.ISO.Week ("julian", 2454466)->format_iso_week()]], "2008-W01") + test_eq([[Calendar.ISO.Year (Calendar.ISO.Week (2008, 1))->year_no()]], 2008)    - test_equal([[ -  Calendar.ISO.Week (2008, 1)->datetime() - (["timezone": 1, "unix": 1]) - ]], [[ -  ([ -  "day": 31, -  "fraction": 0.0, -  "hour": 0, -  "julian": 2454466, -  "minute": 0, -  "month": 12, -  "second": 0, -  "week": 53, -  "week_day": 1, -  "year": 2007, -  "yearday": 364 -  ]) - ]]) - test_equal([[Calendar.ISO.Day (Calendar.ISO.Week(2008,1))->years()->year_no()]], ({2007, 2008})) - test_equal([[Calendar.ISO.Month (Calendar.ISO.Week(2008,1))->years()->year_no()]], ({2007, 2008})) - test_equal([[Calendar.ISO.Year (Calendar.ISO.Week(2008,1))->years()->year_no()]], ({2007, 2008})) - test_equal([[Calendar.ISO.Week(2008,1)->years()->year_no()]], ({2007, 2008})) - test_equal([[Calendar.ISO.Week(2008,1)->number_of_years()]], 2) - test_eq([[Calendar.ISO.Year (Calendar.ISO.Week (2008, 1))->year_no()]], 2007) - test_eq([[Calendar.ISO.Year (Calendar.ISO.Week (2008, 1))->number_of_years()]], 2) - test_equal([[Calendar.ISO.Year (Calendar.ISO.Week (2008, 1))->years()->year_no()]], ({2007, 2008})) -  +    test_eq([[Calendar.ISO.Day (2007, 5, 31)->add (1, Calendar.ISO.Month())]], Calendar.ISO.Day (2007, 6, 30))   test_eq([[Calendar.ISO.Day (2007, 5, 31)->add (2, Calendar.ISO.Month())]], Calendar.ISO.Day (2007, 7, 31))   test_eq([[Calendar.ISO.Day (2007, 5, 31)->add (1, Calendar.ISO.Month())->add (1, Calendar.ISO.Month())]], Calendar.ISO.Day (2007, 7, 30))   test_eq([[Calendar.ISO.Day (2007, 5, 31)->add (-1, Calendar.ISO.Month())]], Calendar.ISO.Day (2007, 4, 30))   test_eq([[Calendar.ISO.Day (2007, 5, 31)->add (-2, Calendar.ISO.Month())]], Calendar.ISO.Day (2007, 3, 31))   test_eq([[Calendar.ISO.Day (2007, 5, 31)->add (-1, Calendar.ISO.Month())->add (1, Calendar.ISO.Month())]], Calendar.ISO.Day (2007, 5, 30))      test_eq([[Calendar.ISO.Day (1900, 1, 31)->add (1, Calendar.ISO.Month())]], Calendar.ISO.Day (1900, 2, 28))   test_eq([[Calendar.ISO.Day (2000, 1, 31)->add (1, Calendar.ISO.Month())]], Calendar.ISO.Day (2000, 2, 29))   test_eq([[Calendar.ISO.Day (2004, 1, 31)->add (1, Calendar.ISO.Month())]], Calendar.ISO.Day (2004, 2, 29))      test_eq([[Calendar.ISO.Day (2004, 2, 29)->add (1, Calendar.ISO.Year())]], Calendar.ISO.Day (2005, 2, 28))   test_eq([[Calendar.ISO.Day (2004, 2, 29)->add (4, Calendar.ISO.Year())]], Calendar.ISO.Day (2008, 2, 29))   test_eq([[Calendar.ISO.Day (2004, 2, 29)->add (2, Calendar.ISO.Year())->add (2, Calendar.ISO.Year())]], Calendar.ISO.Day (2008, 2, 28))   test_eq([[Calendar.ISO.Day (2004, 2, 29)->add (-1, Calendar.ISO.Year())]], Calendar.ISO.Day (2003, 2, 28))   test_eq([[Calendar.ISO.Day (2004, 2, 29)->add (-4, Calendar.ISO.Year())]], Calendar.ISO.Day (2000, 2, 29))   test_eq([[Calendar.ISO.Day (2004, 2, 29)->add (-2, Calendar.ISO.Year())->add (2, Calendar.ISO.Year())]], Calendar.ISO.Day (2004, 2, 28))    - test_eq([[Calendar.ISO.Week (2003, 52)->add (1, Calendar.ISO.Year())]], Calendar.ISO.Week (2004, 52)) - test_eq([[Calendar.ISO.Week (2003, 52)->add (1, Calendar.ISO.Year())->add (1, Calendar.ISO.Year())]], Calendar.ISO.Week (2005, 52)) -  - test_eq([[Calendar.ISO.Week (2004, 53)->add (1, Calendar.ISO.Year())]], Calendar.ISO.Week (2005, 52)) - test_eq([[Calendar.ISO.Week (2004, 53)->add (5, Calendar.ISO.Year())]], Calendar.ISO.Week (2009, 53)) - test_eq([[Calendar.ISO.Week (2004, 53)->add (2, Calendar.ISO.Year())->add (3, Calendar.ISO.Year())]], Calendar.ISO.Week (2009, 52)) - test_eq([[Calendar.ISO.Week (2004, 53)->add (-1, Calendar.ISO.Year())]], Calendar.ISO.Week (2003, 52)) - test_eq([[Calendar.ISO.Week (2004, 53)->add (-6, Calendar.ISO.Year())]], Calendar.ISO.Week (1998, 53)) - test_eq([[Calendar.ISO.Week (2004, 53)->add (-3, Calendar.ISO.Year())->add (3, Calendar.ISO.Year())]], Calendar.ISO.Week (2004, 52)) -  - test_eq([[Calendar.ISO.Day (1996, 2, 24)->add (1, Calendar.ISO.Year())]], Calendar.ISO.Day (1997, 2, 24)) - test_eq([[Calendar.ISO.Day (1996, 2, 26)->add (1, Calendar.ISO.Year())]], Calendar.ISO.Day (1997, 2, 25)) - test_eq([[Calendar.ISO.Day (1996, 2, 29)->add (1, Calendar.ISO.Year())]], Calendar.ISO.Day (1997, 2, 28)) - test_eq([[Calendar.ISO.Day (1996, 2, 24)->add (8, Calendar.ISO.Year())]], Calendar.ISO.Day (2004, 2, 24)) - test_eq([[Calendar.ISO.Day (1996, 2, 26)->add (8, Calendar.ISO.Year())]], Calendar.ISO.Day (2004, 2, 26)) - test_eq([[Calendar.ISO.Day (1996, 2, 29)->add (8, Calendar.ISO.Year())]], Calendar.ISO.Day (2004, 2, 29)) -  - test_eq([[Calendar.Gregorian.Year (2005)->place (Calendar.Gregorian.Day (2004, 2, 24))]], 0) - test_eq([[Calendar.Gregorian.Year (2005)->place (Calendar.Gregorian.Day (2004, 2, 26))]], Calendar.Gregorian.Day (2005, 2, 25)) - test_eq([[Calendar.Gregorian.Year (2005)->place (Calendar.Gregorian.Day (2004, 2, 29))]], Calendar.Gregorian.Day (2005, 2, 28)) - test_eq([[Calendar.Gregorian.Year (2005)->place (Calendar.Gregorian.Day (2004, 2, 24), 1)]], Calendar.Gregorian.Day (2005, 2, 24)) - test_eq([[Calendar.Gregorian.Year (2005)->place (Calendar.Gregorian.Day (2004, 3, 1), 1)]], Calendar.Gregorian.Day (2005, 3, 1)) -  - test_eq([[Calendar.Gregorian.Month (2005, 2)->place (Calendar.Gregorian.Day (2004, 2, 24))]], 0) - test_eq([[Calendar.Gregorian.Month (2005, 2)->place (Calendar.Gregorian.Day (2004, 2, 26))]], Calendar.Gregorian.Day (2005, 2, 25)) - test_eq([[Calendar.Gregorian.Month (2005, 2)->place (Calendar.Gregorian.Day (2004, 2, 29))]], Calendar.Gregorian.Day (2005, 2, 28)) - test_eq([[Calendar.Gregorian.Month (2005, 2)->place (Calendar.Gregorian.Day (2004, 2, 24), 1)]], Calendar.Gregorian.Day (2005, 2, 24)) - test_eq([[Calendar.Gregorian.Month (2005, 3)->place (Calendar.Gregorian.Day (2004, 3, 1), 1)]], Calendar.Gregorian.Day (2005, 3, 1)) -  - test_eq([[Calendar.ISO.Year (2005)->place (Calendar.ISO.Day (2004, 2, 24))]], Calendar.ISO.Day (2005, 2, 24)) - test_eq([[Calendar.ISO.Year (2005)->place (Calendar.ISO.Day (2004, 2, 26))]], Calendar.ISO.Day (2005, 2, 26)) - test_eq([[Calendar.ISO.Year (2005)->place (Calendar.ISO.Day (2004, 2, 29))]], 0) - test_eq([[Calendar.ISO.Year (2005)->place (Calendar.ISO.Day (2004, 2, 29), 1)]], Calendar.ISO.Day (2005, 2, 28)) - test_eq([[Calendar.ISO.Year (2005)->place (Calendar.ISO.Day (2004, 3, 1), 1)]], Calendar.ISO.Day (2005, 3, 1)) -  - test_eq([[Calendar.ISO.Month (2005, 2)->place (Calendar.ISO.Day (2004, 2, 24))]], Calendar.ISO.Day (2005, 2, 24)) - test_eq([[Calendar.ISO.Month (2005, 2)->place (Calendar.ISO.Day (2004, 2, 26))]], Calendar.ISO.Day (2005, 2, 26)) - test_eq([[Calendar.ISO.Month (2005, 2)->place (Calendar.ISO.Day (2004, 2, 29))]], 0) - test_eq([[Calendar.ISO.Month (2005, 2)->place (Calendar.ISO.Day (2004, 2, 29), 1)]], Calendar.ISO.Day (2005, 2, 28)) - test_eq([[Calendar.ISO.Month (2005, 3)->place (Calendar.ISO.Day (2004, 3, 1), 1)]], Calendar.ISO.Day (2005, 3, 1)) -  +    END_MARKER