summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-02-03 10:44:41 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-02-03 20:37:44 +0100
commit6b68aa989c9d5f6c031e992f44e5ad792ab48994 (patch)
treec37134e94bfa6ef7755adf2eea96401f74f175d7
parent8f027aa0bf5eca33a812ae8a7e92d128f90e1508 (diff)
downloadgnurl-6b68aa989c9d5f6c031e992f44e5ad792ab48994.tar.gz
gnurl-6b68aa989c9d5f6c031e992f44e5ad792ab48994.tar.bz2
gnurl-6b68aa989c9d5f6c031e992f44e5ad792ab48994.zip
unit1600: NTLM unit test
-rw-r--r--tests/data/test160027
-rw-r--r--tests/unit/.gitignore1
-rw-r--r--tests/unit/Makefile.inc8
-rw-r--r--tests/unit/unit1600.c50
4 files changed, 84 insertions, 2 deletions
diff --git a/tests/data/test1600 b/tests/data/test1600
new file mode 100644
index 000000000..88040747a
--- /dev/null
+++ b/tests/data/test1600
@@ -0,0 +1,27 @@
+<testcase>
+<info>
+<keywords>
+unittest
+NTLM
+</keywords>
+</info>
+
+#
+# Client-side
+<client>
+<server>
+none
+</server>
+<features>
+unittest
+NTLM
+</features>
+ <name>
+NTLM unit tests
+ </name>
+<tool>
+unit1600
+</tool>
+</client>
+
+</testcase>
diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore
index f5367fb58..c3f6d01a2 100644
--- a/tests/unit/.gitignore
+++ b/tests/unit/.gitignore
@@ -1 +1,2 @@
unit13[0-9][0-9]
+unit1600
diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc
index 526ec1fbd..d522e0d20 100644
--- a/tests/unit/Makefile.inc
+++ b/tests/unit/Makefile.inc
@@ -5,8 +5,9 @@ UNITFILES = curlcheck.h \
../libtest/first.c
# These are all unit test programs
-UNITPROGS = unit1300 unit1301 unit1302 unit1303 unit1304 unit1305 unit1307 \
- unit1308 unit1309 unit1330 unit1394 unit1395 unit1396 unit1397 unit1398
+UNITPROGS = unit1300 unit1301 unit1302 unit1303 unit1304 unit1305 unit1307 \
+ unit1308 unit1309 unit1330 unit1394 unit1395 unit1396 unit1397 unit1398 \
+ unit1600
unit1300_SOURCES = unit1300.c $(UNITFILES)
unit1300_CPPFLAGS = $(AM_CPPFLAGS)
@@ -56,3 +57,6 @@ unit1397_CPPFLAGS = $(AM_CPPFLAGS)
unit1398_SOURCES = unit1398.c $(UNITFILES)
unit1398_CPPFLAGS = $(AM_CPPFLAGS)
+unit1600_SOURCES = unit1600.c $(UNITFILES)
+unit1600_CPPFLAGS = $(AM_CPPFLAGS)
+
diff --git a/tests/unit/unit1600.c b/tests/unit/unit1600.c
new file mode 100644
index 000000000..3cc0ebd8e
--- /dev/null
+++ b/tests/unit/unit1600.c
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include "curlcheck.h"
+
+#include "urldata.h"
+#include "curl_ntlm_core.h"
+
+CURL *easy;
+
+static CURLcode unit_setup(void)
+{
+ easy = curl_easy_init();
+ return CURLE_OK;
+}
+
+static void unit_stop(void)
+{
+ curl_easy_cleanup(easy);
+}
+
+UNITTEST_START
+
+ unsigned char output[21];
+ unsigned char *testp = output;
+ Curl_ntlm_core_mk_nt_hash(easy, "1", output);
+
+ verify_memory(testp,
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 21);
+
+UNITTEST_STOP