gnucash unstable: Add tests for GMT and GMT+7 timezones.

John Ralls jralls at code.gnucash.org
Mon Dec 18 13:15:34 EST 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/baad2097 (commit)
	from  https://github.com/Gnucash/gnucash/commit/5af21dfa (commit)



commit baad2097a709f90a63f9608542fd701fcc64746e
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Dec 18 10:15:05 2017 -0800

    Add tests for GMT and GMT+7 timezones.

diff --git a/libgnucash/engine/test/gtest-gnc-timezone.cpp b/libgnucash/engine/test/gtest-gnc-timezone.cpp
index 0703333..d499544 100644
--- a/libgnucash/engine/test/gtest-gnc-timezone.cpp
+++ b/libgnucash/engine/test/gtest-gnc-timezone.cpp
@@ -67,10 +67,35 @@ TEST(gnc_timezone_constructors, test_posix_timezone)
     TZ_Ptr tz = tzp.get(2006);
     EXPECT_EQ(tz->std_zone_abbrev(), "FST");
     EXPECT_EQ(tz->dst_zone_abbrev(), "FDT");
+    EXPECT_TRUE(tz->has_dst());
     EXPECT_EQ(tz->base_utc_offset().hours(), 8L);
     EXPECT_EQ(tz->dst_offset().hours(), 7L);
 }
 
+TEST(gnc_timezone_constructors, test_gmt_timezone)
+{
+    std::string timezone("GMT");
+    TimeZoneProvider tzp(timezone);
+    TZ_Ptr tz = tzp.get(2006);
+    EXPECT_EQ(tz->std_zone_abbrev(), "GMT");
+    EXPECT_FALSE(tz->has_dst());
+    EXPECT_EQ(tz->dst_zone_abbrev(), "");
+    EXPECT_EQ(tz->base_utc_offset().hours(), 0L);
+    EXPECT_EQ(tz->dst_offset().hours(), 0L);
+}
+
+TEST(gnc_timezone_constructors, test_GMT_plus_7_timezone)
+{
+    std::string timezone("Etc/GMT+7");
+    TimeZoneProvider tzp(timezone);
+    TZ_Ptr tz = tzp.get(2006);
+    EXPECT_EQ(tz->std_zone_abbrev(), "-07");
+    EXPECT_EQ(tz->dst_zone_abbrev(), "");
+    EXPECT_FALSE(tz->has_dst());
+    EXPECT_EQ(tz->base_utc_offset().hours(), -7);
+    EXPECT_EQ(tz->dst_offset().hours(), 0L);
+}
+
 TEST(gnc_timezone_constructors, test_IANA_Belize_tz)
 {
     TimeZoneProvider tzp("America/Belize");



Summary of changes:
 libgnucash/engine/test/gtest-gnc-timezone.cpp | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)



More information about the gnucash-changes mailing list