[gnote] Update date time tests
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Update date time tests
- Date: Sun, 26 Jan 2020 16:53:23 +0000 (UTC)
commit fe5efa154ac41071ed979fb4f90aa2055f86ae42
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Jan 26 17:50:00 2020 +0200
Update date time tests
src/test/unit/datetimeutests.cpp | 35 +++++------------------------------
1 file changed, 5 insertions(+), 30 deletions(-)
---
diff --git a/src/test/unit/datetimeutests.cpp b/src/test/unit/datetimeutests.cpp
index 533f003c..148e2279 100644
--- a/src/test/unit/datetimeutests.cpp
+++ b/src/test/unit/datetimeutests.cpp
@@ -29,21 +29,6 @@
SUITE(DateTime)
{
- TEST(to_string)
- {
- sharp::DateTime d(678901234, 67890);
- Glib::ustring date_string = sharp::XmlConvert::to_string(d);
- CHECK_EQUAL("1991-07-07T15:40:34.067890Z", date_string);
-
- d = sharp::DateTime::from_iso8601("2009-03-24T03:34:35.2914680-04:00");
- // check when usec is 0.
- // see http://bugzilla.gnome.org/show_bug.cgi?id=581844
- d.set_usec(0);
-
- date_string = sharp::XmlConvert::to_string(d);
- CHECK_EQUAL("2009-03-24T07:34:35.000000Z", date_string);
- }
-
TEST(date_time_to_string)
{
auto d = Glib::DateTime::create_local(1991, 7, 7, 15, 40, 34);
@@ -52,16 +37,6 @@ SUITE(DateTime)
CHECK_EQUAL("1991-07-07 15:40:34", date_string);
}
- TEST(from_iso8601)
- {
- sharp::DateTime d(678901234, 67890);
- sharp::DateTime d2 = sharp::DateTime::from_iso8601("1991-07-07T15:40:34.067890Z");
- CHECK(d == d2);
-
- sharp::DateTime d3 = sharp::DateTime::from_iso8601("2009-03-24T03:34:35.2914680-04:00");
- CHECK(d3.is_valid());
- }
-
TEST(date_time_to_iso8601)
{
auto d = Glib::DateTime::create_local(2009, 3, 24, 7, 34, 35);
@@ -96,20 +71,20 @@ SUITE(DateTime)
TEST(pretty_print_date)
{
- sharp::DateTime d = sharp::DateTime::now();
+ Glib::DateTime d = Glib::DateTime::create_now_local();
Glib::ustring date_string = gnote::utils::get_pretty_print_date(d, false, false);
CHECK_EQUAL("Today", date_string);
- d.add_days(1);
+ d = d.add_days(1);
date_string = gnote::utils::get_pretty_print_date(d, false, false);
CHECK_EQUAL("Tomorrow", date_string);
- d = sharp::DateTime::now();
- d.add_days(-1);
+ d = Glib::DateTime::create_now_local();
+ d = d.add_days(-1);
date_string = gnote::utils::get_pretty_print_date(d, false, false);
CHECK_EQUAL("Yesterday", date_string);
- d = sharp::DateTime::from_iso8601("2009-03-24T13:34:35.2914680-04:00");
+ d = sharp::date_time_from_iso8601("2009-03-24T13:34:35.2914680-04:00");
date_string = gnote::utils::get_pretty_print_date(d, true, false);
CHECK(Glib::str_has_suffix(date_string, "17:34"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]