UnitTest: redesing to avoid #include ".cpp" in Xcode
Each unit test .cpp file is not a separate compilation unit in Xcode project like it is in Visual Studio. Hopefully, Visual Studio test tool still likes this arrangement. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
SPDX-License-Identifier: MIT
|
||||
Copyright © 2023-2024 Amebis
|
||||
*/
|
||||
@@ -12,21 +12,17 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace UnitTests
|
||||
{
|
||||
TEST_CLASS(watchdog)
|
||||
void watchdog::test()
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(test)
|
||||
{
|
||||
volatile bool wd_called = false;
|
||||
stdex::watchdog<std::chrono::steady_clock> wd(
|
||||
std::chrono::milliseconds(100), [&] { wd_called = true; });
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
Assert::IsFalse(wd_called);
|
||||
wd.reset();
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(300));
|
||||
Assert::IsTrue(wd_called);
|
||||
volatile bool wd_called = false;
|
||||
stdex::watchdog<std::chrono::steady_clock> wd(
|
||||
std::chrono::milliseconds(100), [&] { wd_called = true; });
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
Assert::IsFalse(wd_called);
|
||||
wd.reset();
|
||||
}
|
||||
};
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(300));
|
||||
Assert::IsTrue(wd_called);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user