diff options
author | Praveen Arimbrathodiyil <pravi.a@gmail.com> | 2009-01-15 04:06:41 -0800 |
---|---|---|
committer | Praveen Arimbrathodiyil <pravi.a@gmail.com> | 2009-01-15 04:06:41 -0800 |
commit | 891159af72653f37ca9f8cbe7c2403a06095dbb6 (patch) | |
tree | 76f7b00cd94870d0b3e3056ce1d7ed384fa27113 /calendar | |
parent | 4d51ad945bc6e0ff8ad6e46ecf81b84c43e07565 (diff) | |
download | Rachana.git-891159af72653f37ca9f8cbe7c2403a06095dbb6.tar.gz Rachana.git-891159af72653f37ca9f8cbe7c2403a06095dbb6.tar.xz Rachana.git-891159af72653f37ca9f8cbe7c2403a06095dbb6.zip |
Added tests to check corner cases (leap year start)
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp b/calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp index 8175b5c..87c390e 100644 --- a/calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp +++ b/calendar/kde/kdelibs/kdecore/tests/kcalendartest.cpp @@ -152,8 +152,35 @@ void KCalendarTest::testIndic() QDate myDate(2009, 1, 11); QVERIFY( calendar->setDate( myDate, 1938, 1, 7) ); myDate = calendar->addMonths( myDate, -1 ); + QCOMPARE( myDate.year(), 2016 ); QCOMPARE( calendar->year( myDate ), 1937 ); QCOMPARE( calendar->month( myDate ), 12 ); + + myDate = QDate::QDate(2009, 3, 22); + QCOMPARE( calendar->year( myDate ), 1931 ); + QCOMPARE( calendar->month( myDate ), 1 ); + QCOMPARE( calendar->day( myDate ), 1 ); + + myDate = QDate::QDate(2009, 3, 21); + QCOMPARE( calendar->year( myDate ), 1930 ); + QCOMPARE( calendar->month( myDate ), 12 ); + QCOMPARE( calendar->day( myDate ), 30 ); + + myDate = QDate::QDate(2008, 3, 22); + QCOMPARE( calendar->year( myDate ), 1930 ); + QCOMPARE( calendar->month( myDate ), 1 ); + QCOMPARE( calendar->day( myDate ), 2 ); + + myDate = QDate::QDate(2008, 3, 21); + QCOMPARE( calendar->year( myDate ), 1930 ); + QCOMPARE( calendar->month( myDate ), 1 ); + QCOMPARE( calendar->day( myDate ), 1 ); + + myDate = QDate::QDate(2008, 3, 20); + QCOMPARE( calendar->year( myDate ), 1929 ); + QCOMPARE( calendar->month( myDate ), 12 ); + QCOMPARE( calendar->day( myDate ), 30 ); + } |