Commit 9e46318a authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

unittest: verify curl_strequal

parent c0c89cd4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
 test1108 test1109 test1110 test1111 test1112 test129 test567 test568	   \
 test569 test570 test571 test572 test804 test805 test806 test807 test573   \
 test313 test1115 test578 test579 test1116 test1200 test1201 test1202	   \
 test1203 test1117 test1118 test1119 test1120 test1300
 test1203 test1117 test1118 test1119 test1120 test1300 test1301

filecheck:
	@mkdir test-place; \

tests/data/test1301

0 → 100644
+26 −0
Original line number Diff line number Diff line
<testcase>
<info>
<keywords>
unittest
llist
</keywords>
</info>

#
# Client-side
<client>
<server>
none
</server>
<features>
unittest
</features>
 <name>
curl_strequal unit tests
 </name>
<tool>
unit1301
</tool>
</client>

</testcase>
+2 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
UNITFILES = curlcheck.h

# These are all unit test programs
noinst_PROGRAMS = unit1300
noinst_PROGRAMS = unit1300 unit1301

unit1300_SOURCES = unit1300.c $(UNITFILES)
unit1301_SOURCES = unit1301.c $(UNITFILES)

tests/unit/unit1301.c

0 → 100644
+36 −0
Original line number Diff line number Diff line
#include <stdlib.h>
#include "curl_config.h"
#include "setup.h"

#include "strequal.h"
#include "curlcheck.h"

static void unit_setup( void ) {}
static void unit_stop( void ) {}

UNITTEST_START

int rc;

rc = curl_strequal("iii", "III");
fail_unless( rc != 0 , "return code should be 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