summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2009-09-01 19:57:41 (UTC)
committer Michael Krelin <hacker@klever.net>2009-09-01 19:57:41 (UTC)
commit34d57b6b55b51e4b489a4cafce8874dec558b600 (patch) (unidiff)
treea0b493e1b54fb4619abac33f7ca58b93cb0152ab
parentf5fa75f3fc446482232c847c1ddea5808bee2c25 (diff)
downloadlibopkele-34d57b6b55b51e4b489a4cafce8874dec558b600.zip
libopkele-34d57b6b55b51e4b489a4cafce8874dec558b600.tar.gz
libopkele-34d57b6b55b51e4b489a4cafce8874dec558b600.tar.bz2
added a test for the single-character trailing path component
due to the bug spotted by Hiroyuki ARAKI Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--test/test.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/test.cc b/test/test.cc
index 4bb2969..2143ac0 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -64,24 +64,26 @@ void test_rfc_3986_normalize_uri() {
64 test_rfc_3986_normalize_uri( 64 test_rfc_3986_normalize_uri(
65 "http://hacker.klever.net/ah/?", true, "http://hacker.klever.net/ah/?" ); 65 "http://hacker.klever.net/ah/?", true, "http://hacker.klever.net/ah/?" );
66 test_rfc_3986_normalize_uri( 66 test_rfc_3986_normalize_uri(
67 "http://hacker.klever.net/ah/%", false ); 67 "http://hacker.klever.net/ah/%", false );
68 test_rfc_3986_normalize_uri( 68 test_rfc_3986_normalize_uri(
69 "http://hacker.klever.net/ah/%a", false ); 69 "http://hacker.klever.net/ah/%a", false );
70 test_rfc_3986_normalize_uri( 70 test_rfc_3986_normalize_uri(
71 "http://hacker.klever.net/ah/%zx", false ); 71 "http://hacker.klever.net/ah/%zx", false );
72 test_rfc_3986_normalize_uri( 72 test_rfc_3986_normalize_uri(
73 "http://hacker.klever.net/ah/%5x", false ); 73 "http://hacker.klever.net/ah/%5x", false );
74 test_rfc_3986_normalize_uri( 74 test_rfc_3986_normalize_uri(
75 "Http://Hacker.Klever.Net:", true, "http://hacker.klever.net/" ); 75 "Http://Hacker.Klever.Net:", true, "http://hacker.klever.net/" );
76 test_rfc_3986_normalize_uri(
77 "http://www.xxx.com/openid/1", true, "http://www.xxx.com/openid/1" );
76} 78}
77 79
78void test_w3c_to_time(const char *w3c,time_t expected) { 80void test_w3c_to_time(const char *w3c,time_t expected) {
79 time_t t = opkele::util::w3c_to_time(w3c); 81 time_t t = opkele::util::w3c_to_time(w3c);
80 if(t!=expected) { 82 if(t!=expected) {
81 char tmp[512]; snprintf(tmp,sizeof(tmp)-1, 83 char tmp[512]; snprintf(tmp,sizeof(tmp)-1,
82 "test failed for %s, expected %lu, got %lu (expected-got == %lu)", 84 "test failed for %s, expected %lu, got %lu (expected-got == %lu)",
83 w3c, (unsigned long)expected, (unsigned long)t, 85 w3c, (unsigned long)expected, (unsigned long)t,
84 (unsigned long)(expected-t) ); 86 (unsigned long)(expected-t) );
85 throw failed_test(OPKELE_CP_ tmp); 87 throw failed_test(OPKELE_CP_ tmp);
86 } 88 }
87} 89}