From 07ce26eaaee331235bbf9d1cf88c65d4e8548942 Mon Sep 17 00:00:00 2001 From: Anjan Roy Date: Tue, 3 Oct 2023 13:35:47 +0530 Subject: [PATCH] prefer `EXPECT_*` instead of `ASSERT_*` Signed-off-by: Anjan Roy --- tests/test_ascon128_aead.cpp | 10 +++++----- tests/test_ascon128a_aead.cpp | 10 +++++----- tests/test_ascon80pq_aead.cpp | 10 +++++----- tests/test_ascon_mac.cpp | 2 +- tests/test_ascon_perm.cpp | 8 ++++---- tests/test_ascon_prf.cpp | 2 +- tests/test_ascon_prfs.cpp | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/test_ascon128_aead.cpp b/tests/test_ascon128_aead.cpp index 10c1ca3..72558a8 100644 --- a/tests/test_ascon128_aead.cpp +++ b/tests/test_ascon128_aead.cpp @@ -37,8 +37,8 @@ test_ascon128_aead(const size_t dlen, // bytes; >= 0 ascon128_aead::encrypt(_key, _nonce, _data, _text, _enc, _tag); bool flag = ascon128_aead::decrypt(_key, _nonce, _data, _enc, _dec, _tag); - ASSERT_TRUE(flag); - ASSERT_EQ(text, dec); + EXPECT_TRUE(flag); + EXPECT_EQ(text, dec); } TEST(AsconAEAD, CorrectnessTestAscon128AEAD) @@ -111,9 +111,9 @@ kat_ascon128_aead() ascon128_aead::encrypt(_key, _nonce, _ad, _pt, _ctxt, _tag); bool flag = ascon128_aead::decrypt(_key, _nonce, _ad, _ctxt, _ptxt, _tag); - ASSERT_TRUE(flag); - ASSERT_TRUE(std::ranges::equal(_ct.subspan(0, pt.size()), _ctxt)); - ASSERT_TRUE(std::ranges::equal(_ct.subspan(pt.size()), _tag)); + EXPECT_TRUE(flag); + EXPECT_TRUE(std::ranges::equal(_ct.subspan(0, pt.size()), _ctxt)); + EXPECT_TRUE(std::ranges::equal(_ct.subspan(pt.size()), _tag)); std::string empty_line; std::getline(file, empty_line); diff --git a/tests/test_ascon128a_aead.cpp b/tests/test_ascon128a_aead.cpp index 638c91c..c751f97 100644 --- a/tests/test_ascon128a_aead.cpp +++ b/tests/test_ascon128a_aead.cpp @@ -37,8 +37,8 @@ test_ascon128a_aead(const size_t dlen, // bytes; >= 0 ascon128a_aead::encrypt(_key, _nonce, _data, _text, _enc, _tag); bool flag = ascon128a_aead::decrypt(_key, _nonce, _data, _enc, _dec, _tag); - ASSERT_TRUE(flag); - ASSERT_EQ(text, dec); + EXPECT_TRUE(flag); + EXPECT_EQ(text, dec); } TEST(AsconAEAD, CorrectnessTestAscon128aAEAD) @@ -111,9 +111,9 @@ kat_ascon128a_aead() ascon128a_aead::encrypt(_key, _nonce, _ad, _pt, _ctxt, _tag); bool flag = ascon128a_aead::decrypt(_key, _nonce, _ad, _ctxt, _ptxt, _tag); - ASSERT_TRUE(flag); - ASSERT_TRUE(std::ranges::equal(_ct.subspan(0, pt.size()), _ctxt)); - ASSERT_TRUE(std::ranges::equal(_ct.subspan(pt.size()), _tag)); + EXPECT_TRUE(flag); + EXPECT_TRUE(std::ranges::equal(_ct.subspan(0, pt.size()), _ctxt)); + EXPECT_TRUE(std::ranges::equal(_ct.subspan(pt.size()), _tag)); std::string empty_line; std::getline(file, empty_line); diff --git a/tests/test_ascon80pq_aead.cpp b/tests/test_ascon80pq_aead.cpp index 6bc5953..881a96c 100644 --- a/tests/test_ascon80pq_aead.cpp +++ b/tests/test_ascon80pq_aead.cpp @@ -37,8 +37,8 @@ test_ascon80pq_aead(const size_t dlen, // bytes; >= 0 ascon80pq_aead::encrypt(_key, _nonce, _data, _text, _enc, _tag); bool flag = ascon80pq_aead::decrypt(_key, _nonce, _data, _enc, _dec, _tag); - ASSERT_TRUE(flag); - ASSERT_EQ(text, dec); + EXPECT_TRUE(flag); + EXPECT_EQ(text, dec); } TEST(AsconAEAD, CorrectnessTestAscon80pqAEAD) @@ -111,9 +111,9 @@ kat_ascon80pq_aead() ascon80pq_aead::encrypt(_key, _nonce, _ad, _pt, _ctxt, _tag); bool flag = ascon80pq_aead::decrypt(_key, _nonce, _ad, _ctxt, _ptxt, _tag); - ASSERT_TRUE(flag); - ASSERT_TRUE(std::ranges::equal(_ct.subspan(0, pt.size()), _ctxt)); - ASSERT_TRUE(std::ranges::equal(_ct.subspan(pt.size()), _tag)); + EXPECT_TRUE(flag); + EXPECT_TRUE(std::ranges::equal(_ct.subspan(0, pt.size()), _ctxt)); + EXPECT_TRUE(std::ranges::equal(_ct.subspan(pt.size()), _tag)); std::string empty_line; std::getline(file, empty_line); diff --git a/tests/test_ascon_mac.cpp b/tests/test_ascon_mac.cpp index 311d899..0d61b33 100644 --- a/tests/test_ascon_mac.cpp +++ b/tests/test_ascon_mac.cpp @@ -47,7 +47,7 @@ TEST(AsconAuth, KnownAnswerTestsAsconMac) mac.finalize(_computed); bool flg = mac.verify(_tag, _computed); - ASSERT_TRUE(flg); + EXPECT_TRUE(flg); std::string empty_line; std::getline(file, empty_line); diff --git a/tests/test_ascon_perm.cpp b/tests/test_ascon_perm.cpp index 63c4852..35944a2 100644 --- a/tests/test_ascon_perm.cpp +++ b/tests/test_ascon_perm.cpp @@ -29,7 +29,7 @@ TEST(AsconPermutation, AsconPermWithAsconHashIV) 0x43189921b8f8e3e8ul, 0x348fa5c9d525e140ul }; static_assert(res, "Must compute init state of Ascon-Hash, in compile-time !"); - ASSERT_TRUE(res); + EXPECT_TRUE(res); } TEST(AsconPermutation, AsconPermWithAsconHashAIV) @@ -41,7 +41,7 @@ TEST(AsconPermutation, AsconPermWithAsconHashAIV) 0xd6f6a54d7f52377d, 0xa13c42a223be8d87 }; static_assert(res, "Must compute init state of Ascon-HashA, in compile-time !"); - ASSERT_TRUE(res); + EXPECT_TRUE(res); } TEST(AsconPermutation, AsconPermWithAsconXofIV) @@ -53,7 +53,7 @@ TEST(AsconPermutation, AsconPermWithAsconXofIV) 0x5aad0a7a8153650c, 0x4f3e0e32539493b6 }; static_assert(res, "Must compute init state of Ascon-Xof, in compile-time !"); - ASSERT_TRUE(res); + EXPECT_TRUE(res); } TEST(AsconPermutation, AsconPermWithAsconXofAIV) @@ -65,5 +65,5 @@ TEST(AsconPermutation, AsconPermWithAsconXofAIV) 0x246885e1de0d225b, 0xa8cb5ce33449973f }; static_assert(res, "Must compute init state of Ascon-XofA, in compile-time !"); - ASSERT_TRUE(res); + EXPECT_TRUE(res); } diff --git a/tests/test_ascon_prf.cpp b/tests/test_ascon_prf.cpp index 282dd2c..46a8b08 100644 --- a/tests/test_ascon_prf.cpp +++ b/tests/test_ascon_prf.cpp @@ -46,7 +46,7 @@ TEST(AsconAuth, KnownAnswerTestsAsconPRF) prf.finalize(); prf.squeeze(_out); - ASSERT_EQ(out, tag); + EXPECT_EQ(out, tag); std::string empty_line; std::getline(file, empty_line); diff --git a/tests/test_ascon_prfs.cpp b/tests/test_ascon_prfs.cpp index 28ad6f0..f349004 100644 --- a/tests/test_ascon_prfs.cpp +++ b/tests/test_ascon_prfs.cpp @@ -46,7 +46,7 @@ TEST(AsconAuth, KnownAnswerTestsAsconPRFShort) ascon_prfs::prfs_authenticate(_key, _msg, _computed); bool flg = ascon_prfs::prfs_verify(_key, _msg, _tag); - ASSERT_TRUE(flg); + EXPECT_TRUE(flg); std::string empty_line; std::getline(file, empty_line);