tests: add tests on function weecrypto_get_hash_algo

v2.8-utf8proc
Sébastien Helleu 2020-03-03 21:29:44 +01:00
parent 7af8e6c652
commit 4afaacd34e
1 changed files with 26 additions and 0 deletions

View File

@ -138,6 +138,32 @@ TEST_GROUP(CoreCrypto)
{
};
/*
* Tests functions:
* weecrypto_get_hash_algo
*/
TEST(CoreCrypto, GetHashAlgo)
{
LONGS_EQUAL(GCRY_MD_NONE, weecrypto_get_hash_algo (NULL));
LONGS_EQUAL(GCRY_MD_NONE, weecrypto_get_hash_algo (""));
LONGS_EQUAL(GCRY_MD_NONE, weecrypto_get_hash_algo ("not_an_algorithm"));
LONGS_EQUAL(GCRY_MD_CRC32, weecrypto_get_hash_algo ("crc32"));
LONGS_EQUAL(GCRY_MD_MD5, weecrypto_get_hash_algo ("md5"));
LONGS_EQUAL(GCRY_MD_SHA1, weecrypto_get_hash_algo ("sha1"));
LONGS_EQUAL(GCRY_MD_SHA224, weecrypto_get_hash_algo ("sha224"));
LONGS_EQUAL(GCRY_MD_SHA256, weecrypto_get_hash_algo ("sha256"));
LONGS_EQUAL(GCRY_MD_SHA384, weecrypto_get_hash_algo ("sha384"));
LONGS_EQUAL(GCRY_MD_SHA512, weecrypto_get_hash_algo ("sha512"));
#if GCRYPT_VERSION_NUMBER >= 0x010700
LONGS_EQUAL(GCRY_MD_SHA3_224, weecrypto_get_hash_algo ("sha3-224"));
LONGS_EQUAL(GCRY_MD_SHA3_256, weecrypto_get_hash_algo ("sha3-256"));
LONGS_EQUAL(GCRY_MD_SHA3_384, weecrypto_get_hash_algo ("sha3-384"));
LONGS_EQUAL(GCRY_MD_SHA3_512, weecrypto_get_hash_algo ("sha3-512"));
#endif
}
/*
* Tests functions:
* weecrypto_hash