Scene script code
This commit is contained in:
@@ -107,6 +107,27 @@ static void test_assertStrLenMin(void **state) {
|
||||
expect_assert_failure(assertStrLenMin("tiny", 10, "asserts"));
|
||||
}
|
||||
|
||||
static void test_assertIsMainThread(void **state) {
|
||||
// The group setup recorded this thread as main — assertIsMainThread must pass.
|
||||
assertIsMainThread("test thread is main, should not assert");
|
||||
|
||||
// assertNotMainThread must fail when called from the main thread.
|
||||
expect_assert_failure(assertNotMainThread("asserts"));
|
||||
}
|
||||
|
||||
static void test_assertNotMainThread(void **state) {
|
||||
// assertNotMainThread must fail because we are still on the main thread.
|
||||
expect_assert_failure(assertNotMainThread("asserts"));
|
||||
|
||||
// assertIsMainThread must pass.
|
||||
assertIsMainThread("test thread is main, should not assert");
|
||||
}
|
||||
|
||||
static int groupSetup(void **state) {
|
||||
assertInit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(test_assertTrueImpl),
|
||||
@@ -122,7 +143,9 @@ int main(void) {
|
||||
cmocka_unit_test(test_assertDeprecated),
|
||||
cmocka_unit_test(test_assertStrLenMax),
|
||||
cmocka_unit_test(test_assertStrLenMin),
|
||||
cmocka_unit_test(test_assertIsMainThread),
|
||||
cmocka_unit_test(test_assertNotMainThread),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
return cmocka_run_group_tests(tests, groupSetup, NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user