aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-01-04 16:13:58 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-01-04 16:13:58 +0100
commit9e46318a03eaf3aa34e870234599804f80686746 (patch)
treec2316316dc65f4cd3b058bc65336f516855a83e4 /tests/unit
parentc0c89cd44ed30385017d585df6429471f6b89617 (diff)
unittest: verify curl_strequal
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/Makefile.inc3
-rw-r--r--tests/unit/unit1301.c36
2 files changed, 38 insertions, 1 deletions
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