Debian Codegraph @

test/test.c

raw symbols SCIP
1 #include <stdbool.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 #include <xeddsa.h>
6
7 #include <test.h>
8
9 static void check(int result, bool* failed, const char* name) {
10 if (result == 0) {
11 fprintf(stdout, "Test passed: %s\n", name);
12 }
13 else {
14 fprintf(stderr, "Test failed: %s\n", name);
15 *failed = true;
16 }
17 }
18
19 int main() {
20 bool failed = false;
21
22 if (xeddsa_init() < 0) {
23 fprintf(stderr, "Couldn't initialize the library.\n");
24 return EXIT_FAILURE;
25 }
26
27 check(test_signing(), &failed, "private key/seed-based signing");
28 check(test_conversion_uniqueness(), &failed, "public key conversion uniqueness");
29 check(test_pub_derivation(), &failed, "public key from private key/seed derivation");
30
31 return failed ? EXIT_FAILURE : EXIT_SUCCESS;
32 }