aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_chain_length.c
diff options
context:
space:
mode:
Diffstat (limited to 'librecrypt_chain_length.c')
-rw-r--r--librecrypt_chain_length.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/librecrypt_chain_length.c b/librecrypt_chain_length.c
new file mode 100644
index 0000000..64b9472
--- /dev/null
+++ b/librecrypt_chain_length.c
@@ -0,0 +1,27 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+#ifndef TEST
+
+
+extern inline size_t librecrypt_chain_length(const char *hash);
+
+
+#else
+
+
+int
+main(void)
+{
+ SET_UP_ALARM();
+ EXPECT(librecrypt_chain_length("") == 1u);
+ EXPECT(librecrypt_chain_length("a$b") == 1u);
+ EXPECT(librecrypt_chain_length(">") == 2u);
+ EXPECT(librecrypt_chain_length(">>") == 3u);
+ EXPECT(librecrypt_chain_length("a$b>c$d>e$f") == 3u);
+ EXPECT(librecrypt_chain_length("a$b>c$d>e$f>") == 4u);
+ EXPECT(librecrypt_chain_length(">a$b>c$d>e$f>") == 5u);
+ return 0;
+}
+
+
+#endif