]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/tests/testString.cc
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / tests / testString.cc
index 09659ddd2bdb3918c1987c0c8c2cb11b503530e4..469c1f50e1ae9d681e2217a6c140678de5ad0cbc 100644 (file)
@@ -1,8 +1,16 @@
+/*
+ * Copyright (C) 1996-2018 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 "event.h"
-#include "Mem.h"
 #include "SquidString.h"
 #include "testString.h"
+#include "unitTestMain.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testString );
 
@@ -13,12 +21,11 @@ eventAdd(const char *name, EVH * func, void *arg, double when, int, bool cbdata)
 
 /* init memory pools */
 
-struct Initer
+void
+testString::setUp()
 {
-    Initer() {Mem::Init();}
-};
-
-static Initer ensure_mempools;
+    Mem::Init();
+}
 
 void
 testString::testCmpDefault()
@@ -59,3 +66,12 @@ testString::testCmpNotEmptyDefault()
     CPPUNIT_ASSERT(right.cmp("foo") < 0);
     CPPUNIT_ASSERT(right.cmp("foo", 1) < 0);
 }
+
+void testString::testSubstr()
+{
+    String s("0123456789");
+    String check=s.substr(3,5);
+    String ref("34");
+    CPPUNIT_ASSERT(check == ref);
+}
+