Improve negative assertions by checking the actual exceptions' content.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "TestHelpers/AssertThrowEx.hpp"
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
@@ -57,19 +58,31 @@ TEST(PadPkcs7Tests, PadInvalidRangeTest)
|
||||
{
|
||||
std::array<uint8_t, 256> out = {};
|
||||
|
||||
ASSERT_THROW(PadderPkcs7::Pad(out.begin(), out.end()), Chaos::Service::ChaosException);
|
||||
ASSERT_THROW_EX(PadderPkcs7::Pad(out.begin(), out.end()),
|
||||
Chaos::Service::ChaosException,
|
||||
{
|
||||
ASSERT_EQ("PadderPkcs7::Pad(): invalid range", ex.GetMessage());
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
std::array<uint8_t, 500> out = {};
|
||||
|
||||
ASSERT_THROW(PadderPkcs7::Pad(out.begin(), out.end()), Chaos::Service::ChaosException);
|
||||
ASSERT_THROW_EX(PadderPkcs7::Pad(out.begin(), out.end()),
|
||||
Chaos::Service::ChaosException,
|
||||
{
|
||||
ASSERT_EQ("PadderPkcs7::Pad(): invalid range", ex.GetMessage());
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
std::array<uint8_t, 50> out = {};
|
||||
|
||||
ASSERT_THROW(PadderPkcs7::Pad(out.end(), out.begin()), Chaos::Service::ChaosException);
|
||||
ASSERT_THROW_EX(PadderPkcs7::Pad(out.end(), out.begin()),
|
||||
Chaos::Service::ChaosException,
|
||||
{
|
||||
ASSERT_EQ("PadderPkcs7::Pad(): invalid range", ex.GetMessage());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user