From 9e46318a03eaf3aa34e870234599804f80686746 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 4 Jan 2011 16:13:58 +0100 Subject: [PATCH] unittest: verify curl_strequal --- tests/data/Makefile.am | 2 +- tests/data/test1301 | 26 ++++++++++++++++++++++++++ tests/unit/Makefile.inc | 3 ++- tests/unit/unit1301.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 tests/data/test1301 create mode 100644 tests/unit/unit1301.c diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index c7a1b467f..cc47c1266 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -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; \ diff --git a/tests/data/test1301 b/tests/data/test1301 new file mode 100644 index 000000000..4a51a00bd --- /dev/null +++ b/tests/data/test1301 @@ -0,0 +1,26 @@ + + + +unittest +llist + + + +# +# Client-side + + +none + + +unittest + + +curl_strequal unit tests + + +unit1301 + + + + diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc index 07d13188b..adfcc4420 100644 --- a/tests/unit/Makefile.inc +++ b/tests/unit/Makefile.inc @@ -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) diff --git a/tests/unit/unit1301.c b/tests/unit/unit1301.c new file mode 100644 index 000000000..6f01e2dae --- /dev/null +++ b/tests/unit/unit1301.c @@ -0,0 +1,36 @@ +#include +#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