author | Michael Krelin <hacker@klever.net> | 2008-06-29 18:52:18 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-06-29 18:52:18 (UTC) |
commit | 767b9926a3b2a2ab000415cc5d36df84dd90f13f (patch) (unidiff) | |
tree | 0fe98a706206d9dd30dc5542c14fd7711e7f0ac2 /test | |
parent | 73f6183b26b1ebc460a27554b71e44037c07e09c (diff) | |
download | libopkele-767b9926a3b2a2ab000415cc5d36df84dd90f13f.zip libopkele-767b9926a3b2a2ab000415cc5d36df84dd90f13f.tar.gz libopkele-767b9926a3b2a2ab000415cc5d36df84dd90f13f.tar.bz2 |
added half-a-test for w3c time conversion
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | test/test.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/test.cc b/test/test.cc index 35f58ab..4bb2969 100644 --- a/test/test.cc +++ b/test/test.cc | |||
@@ -18,3 +18,3 @@ void test_rfc_3986_normalize_uri(const string &ouri,bool success,const string& n | |||
18 | if(!success) | 18 | if(!success) |
19 | throw failed_test(OPKELE_CP_ "Normalized URI when it shouldn't"); | 19 | throw failed_test(OPKELE_CP_ "Normalized URI when it shouldn't ('"+ouri+"' normalization resulted in '"+n+"')"); |
20 | if(n!=nuri) | 20 | if(n!=nuri) |
@@ -34,4 +34,2 @@ void test_rfc_3986_normalize_uri() { | |||
34 | test_rfc_3986_normalize_uri( | 34 | test_rfc_3986_normalize_uri( |
35 | "ftp://hacker.klever.net/", false ); | ||
36 | test_rfc_3986_normalize_uri( | ||
37 | "http://", false ); | 35 | "http://", false ); |
@@ -79,4 +77,20 @@ void test_rfc_3986_normalize_uri() { | |||
79 | 77 | ||
78 | void test_w3c_to_time(const char *w3c,time_t expected) { | ||
79 | time_t t = opkele::util::w3c_to_time(w3c); | ||
80 | if(t!=expected) { | ||
81 | char tmp[512]; snprintf(tmp,sizeof(tmp)-1, | ||
82 | "test failed for %s, expected %lu, got %lu (expected-got == %lu)", | ||
83 | w3c, (unsigned long)expected, (unsigned long)t, | ||
84 | (unsigned long)(expected-t) ); | ||
85 | throw failed_test(OPKELE_CP_ tmp); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | void test_w3c_to_time() { | ||
90 | test_w3c_to_time("2008-06-29T12:33:44",1214742824); | ||
91 | } | ||
92 | |||
80 | int main() { | 93 | int main() { |
81 | try { | 94 | try { |
95 | test_w3c_to_time(); | ||
82 | test_rfc_3986_normalize_uri(); | 96 | test_rfc_3986_normalize_uri(); |