summaryrefslogtreecommitdiff
path: root/tests/unit/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-03-03 21:29:44 +0100
committerSébastien Helleu <flashcode@flashtux.org>2020-03-03 21:29:44 +0100
commit4afaacd34e25c5e610d4527048a721a109b9226e (patch)
treeb78314e81ed341cae07dc0d16253699a94ff4184 /tests/unit/core
parent7af8e6c65269449cec6b6fd85a1ce6ec92987009 (diff)
downloadweechat-4afaacd34e25c5e610d4527048a721a109b9226e.zip
tests: add tests on function weecrypto_get_hash_algo
Diffstat (limited to 'tests/unit/core')
-rw-r--r--tests/unit/core/test-core-crypto.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/unit/core/test-core-crypto.cpp b/tests/unit/core/test-core-crypto.cpp
index d8a387d63..29be91893 100644
--- a/tests/unit/core/test-core-crypto.cpp
+++ b/tests/unit/core/test-core-crypto.cpp
@@ -140,6 +140,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
*/