]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib1301: unit103 turned into a libtest
authorDaniel Stenberg <daniel@haxx.se>
Mon, 31 Oct 2022 12:04:19 +0000 (13:04 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 1 Nov 2022 16:01:26 +0000 (17:01 +0100)
It is not a unit test so moved over to libtests.

tests/data/test1301
tests/libtest/Makefile.inc
tests/libtest/lib1301.c [new file with mode: 0644]
tests/unit/Makefile.inc
tests/unit/unit1301.c [deleted file]

index 5aea24b654a97ddff762a5bc34ee15326bc3178e..17560617729853563714535fb990f2398d6a09d6 100644 (file)
@@ -2,7 +2,7 @@
 <info>
 <keywords>
 unittest
-curl_strcasecompare
+curl_strequal
 </keywords>
 </info>
 
@@ -12,11 +12,8 @@ curl_strcasecompare
 <server>
 none
 </server>
-<features>
-unittest
-</features>
  <name>
-curl_strcasecompare unit tests
+curl_strequal tests
  </name>
 </client>
 </testcase>
index 484ac178c7bab7c17c939f3f9f2f1df64d79a84c..861d79dba6249aeb562be109475041dbb8e7cf32 100644 (file)
@@ -52,6 +52,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect                \
  lib659 lib661 lib666 lib667 lib668 \
  lib670 lib671 lib672 lib673 lib674 lib676 lib677 lib678 \
  lib1156 \
+ lib1301 \
  lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1507 lib1508 \
  lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515         lib1517 \
  lib1518         lib1520 lib1521 lib1522 lib1523 \
@@ -427,6 +428,10 @@ lib678_SOURCES = lib678.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
 lib678_LDADD = $(TESTUTIL_LIBS)
 lib678_CPPFLAGS = $(AM_CPPFLAGS)
 
+lib1301_SOURCES = lib1301.c $(SUPPORTFILES) $(TESTUTIL)
+lib1301_LDADD = $(TESTUTIL_LIBS)
+lib1301_CPPFLAGS = $(AM_CPPFLAGS)
+
 lib1500_SOURCES = lib1500.c $(SUPPORTFILES) $(TESTUTIL)
 lib1500_LDADD = $(TESTUTIL_LIBS)
 lib1500_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/tests/libtest/lib1301.c b/tests/libtest/lib1301.c
new file mode 100644 (file)
index 0000000..d98134c
--- /dev/null
@@ -0,0 +1,62 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * SPDX-License-Identifier: curl
+ *
+ ***************************************************************************/
+#include "test.h"
+
+#define fail_unless(expr, msg)                             \
+  do {                                                     \
+    if(!(expr)) {                                          \
+      fprintf(stderr, "%s:%d Assertion '%s' failed: %s\n", \
+              __FILE__, __LINE__, #expr, msg);             \
+      return 1;                                            \
+    }                                                      \
+  } while(0)
+
+int test(char *URL)
+{
+  int rc;
+  (void)URL;
+
+  rc = curl_strequal("iii", "III");
+  fail_unless(rc != 0, "return code should be non-zero");
+
+  rc = curl_strequal("iiia", "III");
+  fail_unless(rc == 0, "return code should be zero");
+
+  rc = curl_strequal("iii", "IIIa");
+  fail_unless(rc == 0, "return code should be zero");
+
+  rc = curl_strequal("iiiA", "IIIa");
+  fail_unless(rc != 0, "return code should be non-zero");
+
+  rc = curl_strnequal("iii", "III", 3);
+  fail_unless(rc != 0, "return code should be non-zero");
+
+  rc = curl_strnequal("iiiABC", "IIIcba", 3);
+  fail_unless(rc != 0, "return code should be non-zero");
+
+  rc = curl_strnequal("ii", "II", 3);
+  fail_unless(rc != 0, "return code should be non-zero");
+
+  return 0;
+}
index 831a82033c4caa95a2f87f8c58b094a90197065c..c38bc954d4ffb5c8938fd19a20bcca5fb68e8dc1 100644 (file)
@@ -29,7 +29,7 @@ UNITFILES = curlcheck.h \
  ../libtest/first.c
 
 # These are all unit test programs
-UNITPROGS = unit1300 unit1301 unit1302 unit1303 unit1304 unit1305 unit1307 \
+UNITPROGS = unit1300          unit1302 unit1303 unit1304 unit1305 unit1307 \
  unit1308 unit1309 unit1323 \
  unit1330 unit1394 unit1395 unit1396 unit1397 unit1398 \
  unit1399 \
@@ -42,9 +42,6 @@ UNITPROGS = unit1300 unit1301 unit1302 unit1303 unit1304 unit1305 unit1307 \
 unit1300_SOURCES = unit1300.c $(UNITFILES)
 unit1300_CPPFLAGS = $(AM_CPPFLAGS)
 
-unit1301_SOURCES = unit1301.c $(UNITFILES)
-unit1301_CPPFLAGS = $(AM_CPPFLAGS)
-
 unit1302_SOURCES = unit1302.c $(UNITFILES)
 unit1302_CPPFLAGS = $(AM_CPPFLAGS)
 
diff --git a/tests/unit/unit1301.c b/tests/unit/unit1301.c
deleted file mode 100644 (file)
index 17b2700..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-#include "curlcheck.h"
-
-#include "strcase.h"
-
-static CURLcode unit_setup(void) {return CURLE_OK;}
-static void unit_stop(void) {}
-
-UNITTEST_START
-
-int rc;
-
-rc = curl_strequal("iii", "III");
-fail_unless(rc != 0, "return code should be non-zero");
-
-rc = curl_strequal("iiia", "III");
-fail_unless(rc == 0, "return code should be zero");
-
-rc = curl_strequal("iii", "IIIa");
-fail_unless(rc == 0, "return code should be zero");
-
-rc = curl_strequal("iiiA", "IIIa");
-fail_unless(rc != 0, "return code should be non-zero");
-
-rc = curl_strnequal("iii", "III", 3);
-fail_unless(rc != 0, "return code should be non-zero");
-
-rc = curl_strnequal("iiiABC", "IIIcba", 3);
-fail_unless(rc != 0, "return code should be non-zero");
-
-rc = curl_strnequal("ii", "II", 3);
-fail_unless(rc != 0, "return code should be non-zero");
-
-UNITTEST_STOP