aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_settings_prefix.c
blob: edc7222d172d5ec53179a7cf92348a0b282555d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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