diff options
Diffstat (limited to '')
| -rw-r--r-- | librecrypt_decompose_chain1.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/librecrypt_decompose_chain1.c b/librecrypt_decompose_chain1.c new file mode 100644 index 0000000..718e54c --- /dev/null +++ b/librecrypt_decompose_chain1.c @@ -0,0 +1,37 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline size_t librecrypt_decompose_chain1(char *hash); + + +#else + + +#define CHECK(IN, OUT, N)\ + do {\ + assert(sizeof(IN) <= sizeof(buf));\ + assert(sizeof(IN) == sizeof(OUT));\ + stpcpy(buf, (IN));\ + n = librecrypt_decompose_chain1(buf);\ + EXPECT(n == (N));\ + EXPECT(n == librecrypt_chain_length(IN));\ + EXPECT(!memcmp(buf, (OUT), sizeof(IN)));\ + } while (0) + + +int +main(void) +{ + char buf[64u]; + size_t n; + SET_UP_ALARM(); + CHECK("", "", 1u); + CHECK(">", "\0", 2u); + CHECK("a$b>c$d>e$f", "a$b\0c$d\0e$f", 3u); + return 0; +} + + +#endif |
