Skip to content

Commit

Permalink
Restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
tehampson committed Jun 30, 2022
1 parent ee05e95 commit 9475174
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/lib/support/PersistentStorageAudit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
#undef NL_TEST_ASSERT
#endif

#define NL_TEST_ASSERT(inSuite, inCondition) \
do { \
(inSuite)->performedAssertions += 1; \
\
if (!(inCondition)) \
{ \
ChipLogError(Automation, "%s:%u: assertion failed: \"%s\"\n", \
__FILE__, __LINE__, #inCondition); \
(inSuite)->failedAssertions += 1; \
(inSuite)->flagError = true; \
} \
#define NL_TEST_ASSERT(inSuite, inCondition) \
do \
{ \
(inSuite)->performedAssertions += 1; \
\
if (!(inCondition)) \
{ \
ChipLogError(Automation, "%s:%u: assertion failed: \"%s\"\n", __FILE__, __LINE__, #inCondition); \
(inSuite)->failedAssertions += 1; \
(inSuite)->flagError = true; \
} \
} while (0)

namespace chip {
Expand All @@ -51,19 +51,19 @@ bool ExecutePersistentStorageApiAudit(PersistentStorageDelegate & storage)
struct fakeTestSuite
{
int performedAssertions = 0;
int failedAssertions = 0;
bool flagError = false;
int failedAssertions = 0;
bool flagError = false;
} theSuite;
auto * inSuite = &theSuite;

const char * kLongKeyString = "aKeyThatIsExactlyMaxKeyLengthhhh";
// Start fresh.
(void)storage.SyncDeleteKeyValue("roboto");
(void)storage.SyncDeleteKeyValue("key2");
(void)storage.SyncDeleteKeyValue("key3");
(void)storage.SyncDeleteKeyValue("key4");
(void)storage.SyncDeleteKeyValue("keyDOES_NOT_EXIST");
(void)storage.SyncDeleteKeyValue(kLongKeyString);
(void) storage.SyncDeleteKeyValue("roboto");
(void) storage.SyncDeleteKeyValue("key2");
(void) storage.SyncDeleteKeyValue("key3");
(void) storage.SyncDeleteKeyValue("key4");
(void) storage.SyncDeleteKeyValue("keyDOES_NOT_EXIST");
(void) storage.SyncDeleteKeyValue(kLongKeyString);

// ========== Start of actual audit from TestTestPersistentStorageDelegate.cpp =========

Expand Down Expand Up @@ -281,7 +281,9 @@ bool ExecutePersistentStorageApiAudit(PersistentStorageDelegate & storage)
// ========== End of code from TestTestPersistentStorageDelegate.cpp =========
if (inSuite->flagError)
{
ChipLogError(Automation, "==== PersistentStorageDelegate API audit: FAILED: %d/%d failed assertions ====", inSuite->failedAssertions, inSuite->performedAssertions);
ChipLogError(Automation,
"==== PersistentStorageDelegate API audit: FAILED: %d/%d failed assertions ====", inSuite->failedAssertions,
inSuite->performedAssertions);
return false;
}

Expand Down

0 comments on commit 9475174

Please sign in to comment.