From ce16df0934ac8fa407da06088c6b1b59e156f091 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 5 Oct 2020 09:47:30 -0400 Subject: [PATCH] Fix scoped buffer test to init and shut down Platform::Memory. --- src/lib/support/tests/TestScopedBuffer.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/lib/support/tests/TestScopedBuffer.cpp b/src/lib/support/tests/TestScopedBuffer.cpp index 71e3a6044e6621..ac61810553960a 100644 --- a/src/lib/support/tests/TestScopedBuffer.cpp +++ b/src/lib/support/tests/TestScopedBuffer.cpp @@ -137,9 +137,29 @@ static const nlTest sTests[] = { NL_TEST_SENTINEL() // }; +/** + * Set up the test suite. + */ +int TestScopedBuffer_Setup(void * inContext) +{ + CHIP_ERROR error = chip::Platform::MemoryInit(); + if (error != CHIP_NO_ERROR) + return FAILURE; + return SUCCESS; +} + +/** + * Tear down the test suite. + */ +int TestScopedBuffer_Teardown(void * inContext) +{ + chip::Platform::MemoryShutdown(); + return SUCCESS; +} + int TestScopedBuffer(void) { - nlTestSuite theSuite = { "CHIP ScopedBuffer tests", &sTests[0], nullptr, nullptr }; + nlTestSuite theSuite = { "CHIP ScopedBuffer tests", &sTests[0], TestScopedBuffer_Setup, TestScopedBuffer_Teardown }; // Run test suit againt one context. nlTestRunner(&theSuite, nullptr);