status update, probably last commit
[rofl0r-kripto.git] / test / test.c
blobd042eb9b0884013819729fcd3e455344aebc6189
1 /*
2 * Written in 2014 by Gregor Pintar <grpintar@gmail.com>
4 * To the extent possible under law, the author(s) have dedicated
5 * all copyright and related and neighboring rights to this software
6 * to the public domain worldwide.
7 *
8 * This software is distributed without any warranty.
10 * You should have received a copy of the CC0 Public Domain Dedication.
11 * If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
14 #include <stdlib.h>
15 #include <string.h>
16 #include <stdio.h>
18 #include "test.h"
20 int test_result = 0;
22 void test_pass(const char *test)
24 (void)test;
26 #ifdef VERBOSE
27 fputs(test, stdout);
28 puts(": PASS");
29 #endif
32 void test_fail(const char *test)
34 fputs(test, stdout);
35 puts(": FAIL");
36 //exit(1);
37 test_result = 1;
40 void test_error(const char *test)
42 perror(test);
43 exit(-1);
44 //test_result = -1;
47 void test_cmp(const char *test, const void *s1, const void *s2, size_t len)
49 if(memcmp(s1, s2, len)) test_fail(test);
50 else test_pass(test);