mirror of
https://github.com/curl/curl.git
synced 2026-07-31 21:48:04 +03:00
unit1600: unit test for Curl_ntlm_core_mk_nt_hash
This commit is contained in:
parent
6b68aa989c
commit
83bb07027d
6 changed files with 42 additions and 10 deletions
|
|
@ -5,7 +5,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* 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
|
||||
|
|
@ -36,11 +36,13 @@
|
|||
unitfail++; \
|
||||
}
|
||||
|
||||
#define verify_memory(dynamic, check, len) \
|
||||
if(dynamic && memcmp(dynamic, check, len)) { \
|
||||
fprintf(stderr, "%s:%d The dynamic string didn't match '%s'\n", \
|
||||
__FILE__, __LINE__, check); \
|
||||
unitfail++; \
|
||||
#define verify_memory(dynamic, check, len) \
|
||||
if(dynamic && memcmp(dynamic, check, len)) { \
|
||||
fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \
|
||||
__FILE__, __LINE__, len, hexdump((unsigned char *)check, len)); \
|
||||
fprintf(stderr, "%s:%d the same as '%s'\n", \
|
||||
__FILE__, __LINE__, hexdump((unsigned char *)dynamic, len)); \
|
||||
unitfail++; \
|
||||
}
|
||||
|
||||
/* fail() is for when the test case figured out by itself that a check
|
||||
|
|
|
|||
|
|
@ -44,7 +44,18 @@ UNITTEST_START
|
|||
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);
|
||||
"\x69\x94\x3c\x5e\x63\xb4\xd2\xc1\x04\xdb"
|
||||
"\xbc\xc1\x51\x38\xb7\x2b\x00\x00\x00\x00\x00", 21);
|
||||
|
||||
Curl_ntlm_core_mk_nt_hash(easy, "hello-you-fool", output);
|
||||
|
||||
verify_memory(testp,
|
||||
"\x39\xaf\x87\xa6\x75\x0a\x7a\x00\xba\xa0"
|
||||
"\xd3\x4f\x04\x9e\xc1\xd0\x00\x00\x00\x00\x00", 21);
|
||||
|
||||
Curl_ntlm_core_mk_nt_hash(easy, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", output);
|
||||
|
||||
verify_memory(testp,
|
||||
"\x36\x9d\xae\x06\x84\x7e\xe1\xc1\x4a\x94\x39\xea\x6f\x44\x8c\x65\x00\x00\x00\x00\x00", 21);
|
||||
|
||||
UNITTEST_STOP
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue