lib1301: unit103 turned into a libtest
It is not a unit test so moved over to libtests.
This commit is contained in:
parent
3f039dfd6f
commit
480ac6e54d
@ -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>
|
||||
|
||||
@ -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)
|
||||
|
||||
62
tests/libtest/lib1301.c
Normal file
62
tests/libtest/lib1301.c
Normal file
@ -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;
|
||||
}
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
Loading…
Reference in New Issue
Block a user