diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-01-04 16:13:58 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-01-04 16:13:58 +0100 |
commit | 9e46318a03eaf3aa34e870234599804f80686746 (patch) | |
tree | c2316316dc65f4cd3b058bc65336f516855a83e4 | |
parent | c0c89cd44ed30385017d585df6429471f6b89617 (diff) |
unittest: verify curl_strequal
-rw-r--r-- | tests/data/Makefile.am | 2 | ||||
-rw-r--r-- | tests/data/test1301 | 26 | ||||
-rw-r--r-- | tests/unit/Makefile.inc | 3 | ||||
-rw-r--r-- | tests/unit/unit1301.c | 36 |
4 files changed, 65 insertions, 2 deletions
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 @@ +<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> 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 <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 |