From 84ec6d2c747843c114ee11e6b5b04cfa3cfbb69c Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 21 Sep 2019 16:12:31 -0400 Subject: [PATCH] Separate test function and main() This allows for inclusion of the test function/file in a program with an existing main(). This is an isolated piece of #19. --- makefile | 2 +- test.c | 2 +- testmain.c | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 testmain.c diff --git a/makefile b/makefile index eebe3e9..c18cc85 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,6 @@ CC=gcc CFLAGS=-Wall --std=c99 -SRC=siphash.c halfsiphash.c test.c +SRC=siphash.c halfsiphash.c test.c testmain.c BIN=test debug vectors ifneq ($(cROUNDS),) diff --git a/test.c b/test.c index b6547a5..8120562 100644 --- a/test.c +++ b/test.c @@ -43,7 +43,7 @@ const char *labels[4] = { size_t lengths[4] = {8, 16, 4, 8}; -int main() { +int siphash_test() { uint8_t in[64], out[16], k[16]; int i; #ifndef GETVECTORS diff --git a/testmain.c b/testmain.c new file mode 100644 index 0000000..bb9e024 --- /dev/null +++ b/testmain.c @@ -0,0 +1,5 @@ +int siphash_test(); + +int main(void) { + return siphash_test(); +}