Do the test more properly
This commit is contained in:
parent
8eacafb3c9
commit
e811376a95
@ -50,8 +50,15 @@ static int check_canary(const uint8_t *d) {
|
||||
return -1; \
|
||||
}
|
||||
|
||||
#define DEFER(x) x
|
||||
#define NAMESPACE_CHECK DEFER(NAMESPACE(API_H))
|
||||
// https://stackoverflow.com/a/55243651/248065
|
||||
#define MY_TRUTHY_VALUE_X 1
|
||||
#define CAT(x,y) CAT_(x,y)
|
||||
#define CAT_(x,y) x##y
|
||||
#define HAS_NAMESPACE(x) CAT(CAT(MY_TRUTHY_VALUE_,CAT(PQCLEAN_NAMESPACE,CAT(_,x))),X)
|
||||
|
||||
#if !HAS_NAMESPACE(API_H)
|
||||
#error "namespace not properly defined for header guard"
|
||||
#endif
|
||||
|
||||
static int test_keys(void) {
|
||||
/*
|
||||
@ -200,9 +207,8 @@ static int test_invalid_ciphertext(void) {
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
// these two will trigger compiler errors
|
||||
// Check if CRYPTO_ALGNAME is printable
|
||||
puts(CRYPTO_ALGNAME);
|
||||
NAMESPACE_CHECK;
|
||||
|
||||
int result = 0;
|
||||
result += test_keys();
|
||||
|
@ -51,8 +51,16 @@ static int check_canary(const uint8_t *d) {
|
||||
return -1; \
|
||||
}
|
||||
|
||||
#define DEFER(x) x
|
||||
#define NAMESPACE_CHECK DEFER(NAMESPACE(API_H))
|
||||
// https://stackoverflow.com/a/55243651/248065
|
||||
#define MY_TRUTHY_VALUE_X 1
|
||||
#define CAT(x,y) CAT_(x,y)
|
||||
#define CAT_(x,y) x##y
|
||||
#define HAS_NAMESPACE(x) CAT(CAT(MY_TRUTHY_VALUE_,CAT(PQCLEAN_NAMESPACE,CAT(_,x))),X)
|
||||
|
||||
#if !HAS_NAMESPACE(API_H)
|
||||
#error "namespace not properly defined for header guard"
|
||||
#endif
|
||||
|
||||
|
||||
static int test_sign(void) {
|
||||
/*
|
||||
@ -163,10 +171,8 @@ static int test_wrong_pk(void) {
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
// these two will generate compile errors
|
||||
// check if CRYPTO_ALGNAME is printable
|
||||
puts(CRYPTO_ALGNAME);
|
||||
NAMESPACE_CHECK;
|
||||
|
||||
int result = 0;
|
||||
result += test_sign();
|
||||
result += test_wrong_pk();
|
||||
|
Loading…
Reference in New Issue
Block a user