aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_equal.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-04-26 22:36:47 +0200
committerMattias Andrée <m@maandree.se>2026-04-26 22:36:47 +0200
commitd77ab463184d113ca6119403887c9f4ed0dfdf0b (patch)
treeca8a1de443f90a4b7def56ea5b61c96aaa949f45 /librecrypt_equal.c
downloadlibrecrypt-d77ab463184d113ca6119403887c9f4ed0dfdf0b.tar.gz
librecrypt-d77ab463184d113ca6119403887c9f4ed0dfdf0b.tar.bz2
librecrypt-d77ab463184d113ca6119403887c9f4ed0dfdf0b.tar.xz
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'librecrypt_equal.c')
-rw-r--r--librecrypt_equal.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/librecrypt_equal.c b/librecrypt_equal.c
new file mode 100644
index 0000000..22e2c05
--- /dev/null
+++ b/librecrypt_equal.c
@@ -0,0 +1,39 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+#ifndef TEST
+
+
+extern inline int librecrypt_equal(const char *a, const char *b);
+
+
+#else
+
+
+int
+main(void)
+{
+ SET_UP_ALARM();
+ EXPECT(librecrypt_equal("", "") == 1);
+ EXPECT(librecrypt_equal("", "a") == 0);
+ EXPECT(librecrypt_equal("a", "") == 0);
+ EXPECT(librecrypt_equal("a", "b") == 0);
+ EXPECT(librecrypt_equal("a", "a") == 1);
+ EXPECT(librecrypt_equal("abcdef", "Abcdef") == 0);
+ EXPECT(librecrypt_equal("abcdef", "ABcdef") == 0);
+ EXPECT(librecrypt_equal("abcdef", "aBcdef") == 0);
+ EXPECT(librecrypt_equal("abcdef", "abCdef") == 0);
+ EXPECT(librecrypt_equal("abcdef", "abCdeF") == 0);
+ EXPECT(librecrypt_equal("abcdef", "abcdeF") == 0);
+ EXPECT(librecrypt_equal("abcdef", "abcdex") == 0);
+ EXPECT(librecrypt_equal("abcdef", "abcxef") == 0);
+ EXPECT(librecrypt_equal("abcdef", "xbcdef") == 0);
+ EXPECT(librecrypt_equal("abcdef", "abcdef") == 1);
+ EXPECT(librecrypt_equal("abcdef", "abcdefg") == 0);
+ EXPECT(librecrypt_equal("abcdefg", "abcdef") == 0);
+ EXPECT(librecrypt_equal("abcdef", "") == 0);
+ EXPECT(librecrypt_equal("", "abcdef") == 0);
+ return 0;
+}
+
+
+#endif