Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
4c687658
Kaydet (Commit)
4c687658
authored
May 02, 2017
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add more unit tests for Date::Normalize()
Change-Id: I013317bfa9dad02194177cca0907b0ffbb171ccd
üst
1edd4229
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
test_date.cxx
tools/qa/cppunit/test_date.cxx
+29
-0
No files found.
tools/qa/cppunit/test_date.cxx
Dosyayı görüntüle @
4c687658
...
...
@@ -78,6 +78,35 @@ void DateTest::testDate()
aDate
.
Normalize
();
CPPUNIT_ASSERT_EQUAL
(
Date
(
4
,
3
,
1999
).
GetDate
(),
aDate
.
GetDate
());
// Empty date is not normalized and stays empty date.
aDate
=
Date
(
Date
::
EMPTY
);
aDate
.
Normalize
();
CPPUNIT_ASSERT_EQUAL
(
Date
(
Date
::
EMPTY
).
GetDate
(),
aDate
.
GetDate
());
CPPUNIT_ASSERT
(
!
aDate
.
IsValidDate
());
// GetDate() also shall have no normalizing side effect
// 0000-01-00 normalized to -0001-12-31
// SetYear(0) asserts, use empty date to force.
aDate
=
Date
(
Date
::
EMPTY
);
aDate
.
SetMonth
(
1
);
aDate
.
SetDay
(
0
);
aDate
.
Normalize
();
CPPUNIT_ASSERT_EQUAL
(
Date
(
31
,
12
,
-
1
).
GetDate
(),
aDate
.
GetDate
());
// 1999-00-00 normalized to 1998-12-31 (not 1998-11-30, or otherwise
// also 0001-00-00 should be -0001-11-30 which it should not, should it?)
aDate
.
SetYear
(
1999
);
aDate
.
SetMonth
(
0
);
aDate
.
SetDay
(
0
);
aDate
.
Normalize
();
CPPUNIT_ASSERT_EQUAL
(
Date
(
31
,
12
,
1998
).
GetDate
(),
aDate
.
GetDate
());
// 0001-00-00 normalized to -0001-12-31
aDate
.
SetYear
(
1
);
aDate
.
SetMonth
(
0
);
aDate
.
SetDay
(
0
);
aDate
.
Normalize
();
CPPUNIT_ASSERT_EQUAL
(
Date
(
31
,
12
,
-
1
).
GetDate
(),
aDate
.
GetDate
());
// Year -1 is a leap year.
aDate
=
Date
(
28
,
2
,
-
1
);
CPPUNIT_ASSERT_EQUAL
(
Date
(
29
,
2
,
-
1
).
GetDate
(),
(
aDate
+=
1
).
GetDate
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment