diff options
| author | Mattias Andrée <m@maandree.se> | 2026-04-26 22:36:47 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-04-26 22:36:47 +0200 |
| commit | d77ab463184d113ca6119403887c9f4ed0dfdf0b (patch) | |
| tree | ca8a1de443f90a4b7def56ea5b61c96aaa949f45 /librecrypt_settings_prefix.c | |
| download | librecrypt-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 '')
| -rw-r--r-- | librecrypt_settings_prefix.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/librecrypt_settings_prefix.c b/librecrypt_settings_prefix.c new file mode 100644 index 0000000..edc7222 --- /dev/null +++ b/librecrypt_settings_prefix.c @@ -0,0 +1,34 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline size_t librecrypt_settings_prefix(const char *hash); + + +#else + + +#define CHECK(PREFIX, SUFFIX)\ + do {\ + EXPECT(librecrypt_settings_prefix(PREFIX SUFFIX) == sizeof(PREFIX) - 1u);\ + EXPECT(librecrypt_settings_prefix(PREFIX) == sizeof(PREFIX) - 1u);\ + } while (0) + + +int +main(void) +{ + SET_UP_ALARM(); + CHECK("", "result"); + CHECK(">", "double-des result"); + CHECK("$", "x"); + CHECK("y$", "x"); + CHECK("y>", "x"); + CHECK("a$b$c>d$e$", "x"); + CHECK("a$b$c>", "x"); + return 0; +} + + +#endif |
