More tests for constants

This commit is contained in:
Frank Denis 2014-09-13 14:37:04 -07:00
parent 2c1b507045
commit 12a3f27706
3 changed files with 25 additions and 0 deletions

View File

@ -20,5 +20,18 @@ int main(void)
}
printf("\n");
}
assert(crypto_generichash_bytes_min() > 0U);
assert(crypto_generichash_bytes_max() > 0U);
assert(crypto_generichash_bytes() > 0U);
assert(crypto_generichash_bytes() >= crypto_generichash_bytes_min());
assert(crypto_generichash_bytes() <= crypto_generichash_bytes_max());
assert(crypto_generichash_keybytes_min() >= 0U);
assert(crypto_generichash_keybytes_max() > 0U);
assert(crypto_generichash_keybytes() > 0U);
assert(crypto_generichash_keybytes() >= crypto_generichash_keybytes_min());
assert(crypto_generichash_keybytes() <= crypto_generichash_keybytes_max());
assert(strcmp(crypto_generichash_primitive(), "blake2b") == 0);
return 0;
}

View File

@ -11,5 +11,11 @@ int main(void)
crypto_hash(h,x,sizeof x - 1U);
for (i = 0;i < crypto_hash_BYTES;++i) printf("%02x",(unsigned int) h[i]);
printf("\n");
assert(crypto_hash_bytes() > 0U);
assert(strcmp(crypto_hash_primitive(), "sha512") == 0);
assert(crypto_hash_sha256_bytes() > 0U);
assert(crypto_hash_sha512_bytes() == crypto_hash_bytes());
return 0;
}

View File

@ -39,5 +39,11 @@ int main(void)
printf(",0x%02x",(unsigned int) a[i]);
if (i % 8 == 7) printf("\n");
}
assert(crypto_onetimeauth_bytes() > 0U);
assert(crypto_onetimeauth_keybytes() > 0U);
assert(strcmp(crypto_onetimeauth_primitive(), "poly1305") == 0);
assert(crypto_onetimeauth_poly1305_bytes() == crypto_onetimeauth_bytes());
assert(crypto_onetimeauth_poly1305_keybytes() == crypto_onetimeauth_keybytes());
return 0;
}