Skip to content

Commit dafa16e

Browse files
committed
Replace expect with assert for nullptr check
1 parent 738a255 commit dafa16e

4 files changed

+6
-6
lines changed

src/credentials/tests/TestCommissionerDUTVectors.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct TestCommissionerDUTVectors : public ::testing::Test
5757
TEST_F(TestCommissionerDUTVectors, TestCommissionerDUTVectors)
5858
{
5959
DeviceAttestationVerifier * example_dac_verifier = GetDefaultDACVerifier(GetTestAttestationTrustStore());
60-
EXPECT_NE(example_dac_verifier, nullptr);
60+
ASSERT_NE(example_dac_verifier, nullptr);
6161

6262
std::string dirPath("../../../../../credentials/development/commissioner_dut/");
6363
DIR * dir = opendir(dirPath.c_str());

src/credentials/tests/TestDeviceAttestationConstruction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ TEST_F(TestDeviceAttestationConstruction, TestNocsrElements_Construction)
604604
TLV::EstimateStructOverhead(sizeof(kExampleCsr), sizeof(kNocsrNonce), sizeof(kVendorReserved1), sizeof(kVendorReserved3));
605605

606606
nocsrElements.Alloc(nocsrElementsLen);
607-
EXPECT_NE(nocsrElements.Get(), nullptr);
607+
ASSERT_NE(nocsrElements.Get(), nullptr);
608608

609609
MutableByteSpan nocsrElementsSpan(nocsrElements.Get(), nocsrElementsLen);
610610

src/credentials/tests/TestFabricTable.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2636,7 +2636,7 @@ TEST_F(TestFabricTable, TestEphemeralKeys)
26362636
uint8_t message[] = { 'm', 's', 'g' };
26372637

26382638
Crypto::P256Keypair * ephemeralKeypair = fabricTable.AllocateEphemeralKeypairForCASE();
2639-
EXPECT_NE(ephemeralKeypair, nullptr);
2639+
ASSERT_NE(ephemeralKeypair, nullptr);
26402640
EXPECT_EQ(ephemeralKeypair->Initialize(Crypto::ECPKeyTarget::ECDSA), CHIP_NO_ERROR);
26412641

26422642
EXPECT_EQ(ephemeralKeypair->ECDSA_sign_msg(message, sizeof(message), sig), CHIP_NO_ERROR);
@@ -2663,7 +2663,7 @@ TEST_F(TestFabricTable, TestEphemeralKeys)
26632663
uint8_t message[] = { 'm', 's', 'g' };
26642664

26652665
Crypto::P256Keypair * ephemeralKeypair = fabricTable.AllocateEphemeralKeypairForCASE();
2666-
EXPECT_NE(ephemeralKeypair, nullptr);
2666+
ASSERT_NE(ephemeralKeypair, nullptr);
26672667
EXPECT_EQ(ephemeralKeypair->Initialize(Crypto::ECPKeyTarget::ECDSA), CHIP_NO_ERROR);
26682668

26692669
EXPECT_EQ(ephemeralKeypair->ECDSA_sign_msg(message, sizeof(message), sig), CHIP_NO_ERROR);

src/credentials/tests/TestGroupDataProvider.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ TEST_F(TestGroupDataProvider, TestGroupDecryption)
11701170

11711171
// Get the key context
11721172
Crypto::SymmetricKeyContext * key_context = provider->GetKeyContext(kFabric2, kGroup2);
1173-
EXPECT_NE(nullptr, key_context);
1173+
ASSERT_NE(nullptr, key_context);
11741174
uint16_t session_id = key_context->GetKeyHash();
11751175

11761176
// Encrypt the message
@@ -1199,7 +1199,7 @@ TEST_F(TestGroupDataProvider, TestGroupDecryption)
11991199
{
12001200
std::pair<FabricIndex, GroupId> found(session.fabric_index, session.group_id);
12011201
EXPECT_GT(expected.count(found), 0u);
1202-
EXPECT_NE(session.keyContext, nullptr);
1202+
ASSERT_NE(session.keyContext, nullptr);
12031203
// Assert aboves doesn't actually exit, we call continue so that we can call it->Release() outside of
12041204
// loop.
12051205
if (session.keyContext == nullptr)

0 commit comments

Comments
 (0)