mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 20:15:03 -05:00
unittest: verify curl_strequal
This commit is contained in:
parent
c0c89cd44e
commit
9e46318a03
@ -68,7 +68,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
|
|||||||
test1108 test1109 test1110 test1111 test1112 test129 test567 test568 \
|
test1108 test1109 test1110 test1111 test1112 test129 test567 test568 \
|
||||||
test569 test570 test571 test572 test804 test805 test806 test807 test573 \
|
test569 test570 test571 test572 test804 test805 test806 test807 test573 \
|
||||||
test313 test1115 test578 test579 test1116 test1200 test1201 test1202 \
|
test313 test1115 test578 test579 test1116 test1200 test1201 test1202 \
|
||||||
test1203 test1117 test1118 test1119 test1120 test1300
|
test1203 test1117 test1118 test1119 test1120 test1300 test1301
|
||||||
|
|
||||||
filecheck:
|
filecheck:
|
||||||
@mkdir test-place; \
|
@mkdir test-place; \
|
||||||
|
26
tests/data/test1301
Normal file
26
tests/data/test1301
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<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>
|
@ -3,6 +3,7 @@
|
|||||||
UNITFILES = curlcheck.h
|
UNITFILES = curlcheck.h
|
||||||
|
|
||||||
# These are all unit test programs
|
# These are all unit test programs
|
||||||
noinst_PROGRAMS = unit1300
|
noinst_PROGRAMS = unit1300 unit1301
|
||||||
|
|
||||||
unit1300_SOURCES = unit1300.c $(UNITFILES)
|
unit1300_SOURCES = unit1300.c $(UNITFILES)
|
||||||
|
unit1301_SOURCES = unit1301.c $(UNITFILES)
|
||||||
|
36
tests/unit/unit1301.c
Normal file
36
tests/unit/unit1301.c
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#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
|
Loading…
Reference in New Issue
Block a user