diff options
Diffstat (limited to 'Swiften/Base/UnitTest/DateTimeTest.cpp')
| -rw-r--r-- | Swiften/Base/UnitTest/DateTimeTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Swiften/Base/UnitTest/DateTimeTest.cpp b/Swiften/Base/UnitTest/DateTimeTest.cpp index 936a3ec..a9350fa 100644 --- a/Swiften/Base/UnitTest/DateTimeTest.cpp +++ b/Swiften/Base/UnitTest/DateTimeTest.cpp | |||
| @@ -16,10 +16,11 @@ using namespace Swift; | |||
| 16 | class DateTimeTest : public CppUnit::TestFixture { | 16 | class DateTimeTest : public CppUnit::TestFixture { |
| 17 | CPPUNIT_TEST_SUITE(DateTimeTest); | 17 | CPPUNIT_TEST_SUITE(DateTimeTest); |
| 18 | CPPUNIT_TEST(testStringToDateTime_UTC); | 18 | CPPUNIT_TEST(testStringToDateTime_UTC); |
| 19 | CPPUNIT_TEST(testStringToDateTime_WithTimezone); | 19 | CPPUNIT_TEST(testStringToDateTime_WithTimezone); |
| 20 | CPPUNIT_TEST(testDateTimeToString); | 20 | CPPUNIT_TEST(testDateTimeToString); |
| 21 | CPPUNIT_TEST(testDateTimeToLocalStringNotThrowingException); | ||
| 21 | CPPUNIT_TEST_SUITE_END(); | 22 | CPPUNIT_TEST_SUITE_END(); |
| 22 | 23 | ||
| 23 | public: | 24 | public: |
| 24 | void testStringToDateTime_UTC() { | 25 | void testStringToDateTime_UTC() { |
| 25 | boost::posix_time::ptime time = stringToDateTime("1969-07-21T02:56:15Z"); | 26 | boost::posix_time::ptime time = stringToDateTime("1969-07-21T02:56:15Z"); |
| @@ -36,8 +37,14 @@ class DateTimeTest : public CppUnit::TestFixture { | |||
| 36 | void testDateTimeToString() { | 37 | void testDateTimeToString() { |
| 37 | boost::posix_time::ptime time = stringToDateTime("1969-07-20T21:56:15-05:00"); | 38 | boost::posix_time::ptime time = stringToDateTime("1969-07-20T21:56:15-05:00"); |
| 38 | 39 | ||
| 39 | CPPUNIT_ASSERT_EQUAL(std::string("1969-07-21T02:56:15Z"), dateTimeToString(time)); | 40 | CPPUNIT_ASSERT_EQUAL(std::string("1969-07-21T02:56:15Z"), dateTimeToString(time)); |
| 40 | } | 41 | } |
| 42 | |||
| 43 | void testDateTimeToLocalStringNotThrowingException() { | ||
| 44 | boost::posix_time::ptime time = stringToDateTime("1954-07-20T21:56:15-05:00"); | ||
| 45 | |||
| 46 | CPPUNIT_ASSERT_EQUAL(std::string(""), dateTimeToLocalString(time)); | ||
| 47 | } | ||
| 41 | }; | 48 | }; |
| 42 | 49 | ||
| 43 | CPPUNIT_TEST_SUITE_REGISTRATION(DateTimeTest); | 50 | CPPUNIT_TEST_SUITE_REGISTRATION(DateTimeTest); |
Swift