Test: Removed Date
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
#include <Context.h>
|
||||
#include <Nibbler.h>
|
||||
#ifdef NIBBLER_FEATURE_DATE
|
||||
#include <Date.h>
|
||||
#include <ISO8601.h>
|
||||
#endif
|
||||
#include <test.h>
|
||||
|
||||
@@ -65,7 +65,7 @@ int main (int argc, char** argv)
|
||||
time_t ti;
|
||||
|
||||
#ifdef NIBBLER_FEATURE_DATE
|
||||
Date dt;
|
||||
ISO8601d dt;
|
||||
#endif
|
||||
std::vector <std::string> options;
|
||||
|
||||
@@ -533,56 +533,56 @@ int main (int argc, char** argv)
|
||||
t.diag ("Nibbler::getDate");
|
||||
n = Nibbler ("1/1/2008");
|
||||
t.ok (n.getDate ("m/d/Y", ti), "m/d/Y ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
n = Nibbler ("20080101");
|
||||
t.ok (n.getDate ("YMD", ti), "YMD ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
n = Nibbler ("12/31/2007");
|
||||
t.ok (n.getDate ("m/d/Y", ti), "m/d/Y ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 12, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 31, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2007, "ctor (std::string) -> y");
|
||||
|
||||
n = Nibbler ("20071231");
|
||||
t.ok (n.getDate ("YMD", ti), "YMD ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 12, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 31, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2007, "ctor (std::string) -> y");
|
||||
|
||||
n = Nibbler ("Tue 01 Jan 2008 (01)");
|
||||
t.ok (n.getDate ("a D b Y (V)", ti), "a D b Y (V)");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
n = Nibbler ("Tuesday, January 1, 2008");
|
||||
t.ok (n.getDate ("A, B d, Y", ti), "A, B d, Y ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
n = Nibbler ("w01 Tue 2008-01-01");
|
||||
t.ok (n.getDate ("wV a Y-M-D", ti), "wV a Y-M-D ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
n = Nibbler ("6/7/2010 1:23:45");
|
||||
t.ok (n.getDate ("m/d/Y h:N:S", ti), "m/d/Y h:N:S ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 6, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 7, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2010, "ctor (std::string) -> Y");
|
||||
@@ -592,7 +592,7 @@ int main (int argc, char** argv)
|
||||
|
||||
n = Nibbler ("6/7/2010 01:23:45");
|
||||
t.ok (n.getDate ("m/d/Y H:N:S", ti), "m/d/Y H:N:S ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 6, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 7, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2010, "ctor (std::string) -> Y");
|
||||
@@ -602,7 +602,7 @@ int main (int argc, char** argv)
|
||||
|
||||
n = Nibbler ("6/7/2010 12:34:56");
|
||||
t.ok (n.getDate ("m/d/Y H:N:S", ti), "m/d/Y H:N:S ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 6, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 7, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2010, "ctor (std::string) -> Y");
|
||||
@@ -612,7 +612,7 @@ int main (int argc, char** argv)
|
||||
|
||||
n = Nibbler ("2010");
|
||||
t.ok (n.getDate ("Y", ti), "Y ok");
|
||||
dt = Date (ti);
|
||||
dt = ISO8601d (ti);
|
||||
t.is (dt.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2010, "ctor (std::string) -> Y");
|
||||
@@ -622,8 +622,8 @@ int main (int argc, char** argv)
|
||||
|
||||
n = Nibbler ("17:18:19");
|
||||
t.ok (n.getDate ("H:N:S", ti), "H:N:S ok");
|
||||
dt = Date (ti);
|
||||
Date now = Date ();
|
||||
dt = ISO8601d (ti);
|
||||
ISO8601d now;
|
||||
t.is (dt.month (), now.month(), "ctor (std::string) -> m");
|
||||
t.is (dt.day (), now.day(), "ctor (std::string) -> d");
|
||||
t.is (dt.year (), now.year(), "ctor (std::string) -> Y");
|
||||
|
||||
Reference in New Issue
Block a user