]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - lib/tests/testRFC1738.cc
SourceFormat Enforcement
[thirdparty/squid.git] / lib / tests / testRFC1738.cc
index c67a85a53b3d75624e2fafac6754607e19e57b97..41862ab9db24119fa989709f6e0cde33aa50ef0d 100644 (file)
@@ -1,11 +1,16 @@
-#define SQUID_UNIT_TEST 1
-#include "config.h"
-
-#if HAVE_ASSERT_H
-#include <assert.h>
-#endif
+/*
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
 
+#include "squid.h"
 #include "testRFC1738.h"
+#include "unitTestMain.h"
+
+#include <cassert>
 
 /* Being a C library code it is best bodily included and tested with C++ type-safe techniques. */
 #include "lib/rfc1738.c"
@@ -61,7 +66,6 @@ void testRFC1738::testUrlDecode()
     CPPUNIT_ASSERT(memcmp(unescaped_str, "Bad String %1",14)==0);
     xfree(unescaped_str);
 
-
     /* A partly corrupt string */
     unescaped_str = xstrdup("Bad String %1A%3");
     rfc1738_unescape(unescaped_str);
@@ -87,10 +91,6 @@ void testRFC1738::testUrlEncode()
 {
     char *result;
 
-#define RFC1738_ESCAPE_UNSAFE     0
-#define RFC1738_ESCAPE_RESERVED   1
-#define RFC1738_ESCAPE_UNESCAPED -1
-
     /* TEST: Escaping only unsafe characters */
 
     /* regular URL (no encoding needed) */
@@ -101,7 +101,6 @@ void testRFC1738::testUrlEncode()
     result = rfc1738_do_escape("################ ################ ################ ################ ################ ################ ################ ################", RFC1738_ESCAPE_UNSAFE);
     CPPUNIT_ASSERT(memcmp(result, "%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23",406)==0);
 
-
     /* TEST: escaping only reserved characters */
 
     /* regular URL (full encoding requested) */
@@ -112,7 +111,6 @@ void testRFC1738::testUrlEncode()
     result = rfc1738_do_escape("/data/source/path", RFC1738_ESCAPE_RESERVED);
     CPPUNIT_ASSERT(memcmp(result, "%2Fdata%2Fsource%2Fpath",24)==0);
 
-
     /* TEST: safety-escaping a string already partially escaped */
 
     /* escaping of dangerous characters in a partially escaped string */
@@ -154,3 +152,4 @@ void testRFC1738::PercentZeroNullDecoding()
     CPPUNIT_ASSERT(memcmp(unescaped_str, "w%%00%rd",9)==0);
     xfree(unescaped_str);
 }
+