Some label fixes
This commit is contained in:
@@ -108,7 +108,7 @@ static void test_assertStrLenMin(void **state) {
|
||||
}
|
||||
|
||||
static void test_assertIsMainThread(void **state) {
|
||||
// The group setup recorded this thread as main — assertIsMainThread must pass.
|
||||
// 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.
|
||||
|
||||
+10
-10
@@ -40,7 +40,7 @@ static int asset_setup(void **state) {
|
||||
// Save real callbacks so we can restore them in teardown.
|
||||
memoryCopy(saved_callbacks, ASSET_LOADER_CALLBACKS, sizeof(saved_callbacks));
|
||||
|
||||
// Manually init ASSET — no thread, no ZIP.
|
||||
// Manually init ASSET - no thread, no ZIP.
|
||||
memoryZero(&ASSET, sizeof(ASSET));
|
||||
for(size_t i = 0; i < ASSET_LOADING_COUNT_MAX; i++) {
|
||||
threadMutexInit(&ASSET.loading[i].mutex);
|
||||
@@ -117,7 +117,7 @@ static void test_getEntry_distinct_names(void **state) {
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// assetUpdate — state machine tests
|
||||
// assetUpdate - state machine tests
|
||||
// ============================================================
|
||||
|
||||
static void test_update_entry_reaches_loaded(void **state) {
|
||||
@@ -252,7 +252,7 @@ static void test_update_overflow_queues_entries(void **state) {
|
||||
}
|
||||
assert_int_equal(entries[ASSET_LOADING_COUNT_MAX]->state, ASSET_ENTRY_STATE_NOT_STARTED);
|
||||
|
||||
// Unlock first batch — the reaper can collect them in update 2.
|
||||
// Unlock first batch - the reaper can collect them in update 2.
|
||||
for(int i = 0; i < ASSET_LOADING_COUNT_MAX; i++) {
|
||||
assetEntryUnlock(entries[i]);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ static void test_update_error_slot_stays_occupied(void **state) {
|
||||
assetUpdate();
|
||||
assert_int_equal(entry->state, ASSET_ENTRY_STATE_ERROR);
|
||||
|
||||
// Unlike LOADED, the ERROR case does NOT clear the slot — it throws instead.
|
||||
// Unlike LOADED, the ERROR case does NOT clear the slot - it throws instead.
|
||||
assert_true(loading_slot_has_entry(entry));
|
||||
|
||||
errorret_t ret = assetUpdate();
|
||||
@@ -295,7 +295,7 @@ static void test_update_error_slot_stays_occupied(void **state) {
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// assetEntryInit — input copy
|
||||
// assetEntryInit - input copy
|
||||
// ============================================================
|
||||
|
||||
static void test_getEntry_null_input_stays_null(void **state) {
|
||||
@@ -312,7 +312,7 @@ static void test_getEntry_input_copied_into_entry(void **state) {
|
||||
|
||||
assetentry_t *entry = assetGetEntry("test.texture", ASSET_LOADER_TYPE_TEXTURE, &input);
|
||||
|
||||
// input must have been copied — entry->input must point inside the entry.
|
||||
// input must have been copied - entry->input must point inside the entry.
|
||||
assert_non_null(entry->input);
|
||||
assert_ptr_equal(entry->input, &entry->inputData);
|
||||
assert_int_equal((int)entry->input->texture, 42);
|
||||
@@ -321,7 +321,7 @@ static void test_getEntry_input_copied_into_entry(void **state) {
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// assetUpdate — re-entrant sync loader
|
||||
// assetUpdate - re-entrant sync loader
|
||||
// ============================================================
|
||||
|
||||
static assetentry_t *reentrant_inner_entry = NULL;
|
||||
@@ -362,7 +362,7 @@ static void test_update_reentrant_sync_loader(void **state) {
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// assetGetEntry — dedup against non-NOT_STARTED entries
|
||||
// assetGetEntry - dedup against non-NOT_STARTED entries
|
||||
// ============================================================
|
||||
|
||||
static void test_getEntry_returns_loaded_entry(void **state) {
|
||||
@@ -464,7 +464,7 @@ static void test_requireLoaded_propagates_error(void **state) {
|
||||
|
||||
assetentry_t *entry = assetGetEntry("fail.locale", ASSET_LOADER_TYPE_LOCALE, NULL);
|
||||
|
||||
// requireLoaded spins assetUpdate until LOADED — but the loader always fails,
|
||||
// requireLoaded spins assetUpdate until LOADED - but the loader always fails,
|
||||
// so the second assetUpdate sees ERROR and throws, which errorChain propagates.
|
||||
errorret_t ret = assetRequireLoaded(entry);
|
||||
assert_true(errorIsNotOk(ret));
|
||||
@@ -489,7 +489,7 @@ int main(void) {
|
||||
cmocka_unit_test_setup_teardown(test_getEntry_null_input_stays_null, asset_setup, asset_teardown),
|
||||
cmocka_unit_test_setup_teardown(test_getEntry_input_copied_into_entry, asset_setup, asset_teardown),
|
||||
|
||||
// assetUpdate — state machine
|
||||
// assetUpdate - state machine
|
||||
cmocka_unit_test_setup_teardown(test_update_noop_on_empty_table, asset_setup, asset_teardown),
|
||||
cmocka_unit_test_setup_teardown(test_update_entry_reaches_loaded, asset_setup, asset_teardown),
|
||||
cmocka_unit_test_setup_teardown(test_update_slot_occupied_after_first_update, asset_setup, asset_teardown),
|
||||
|
||||
@@ -133,7 +133,7 @@ static int locale_teardown(void **state) {
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// assetLocaleParseHeader — pure tests (no ZIP required)
|
||||
// assetLocaleParseHeader - pure tests (no ZIP required)
|
||||
// ============================================================
|
||||
|
||||
static void test_parseHeader_english(void **state) {
|
||||
@@ -251,7 +251,7 @@ static void test_parseHeader_error_missing_nplurals(void **state) {
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// assetLocaleEvaluatePlural — pure tests
|
||||
// assetLocaleEvaluatePlural - pure tests
|
||||
// ============================================================
|
||||
|
||||
static void test_evaluatePlural_english_singular(void **state) {
|
||||
@@ -302,7 +302,7 @@ static void test_evaluatePlural_less_than_boundary(void **state) {
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// assetLocaleGetString — ZIP-based tests
|
||||
// assetLocaleGetString - ZIP-based tests
|
||||
// ============================================================
|
||||
|
||||
static void test_getString_simple(void **state) {
|
||||
@@ -355,7 +355,7 @@ static void test_getString_missing_id(void **state) {
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// assetLocaleGetStringWithArgs — ZIP-based tests
|
||||
// assetLocaleGetStringWithArgs - ZIP-based tests
|
||||
// ============================================================
|
||||
|
||||
static void test_getStringWithArgs_int(void **state) {
|
||||
@@ -392,7 +392,7 @@ static void test_getStringWithArgs_string(void **state) {
|
||||
|
||||
int main(void) {
|
||||
const struct CMUnitTest tests[] = {
|
||||
// parseHeader — pure
|
||||
// parseHeader - pure
|
||||
cmocka_unit_test(test_parseHeader_english),
|
||||
cmocka_unit_test(test_parseHeader_singular),
|
||||
cmocka_unit_test(test_parseHeader_less_than),
|
||||
@@ -402,20 +402,20 @@ int main(void) {
|
||||
cmocka_unit_test(test_parseHeader_error_nplurals_too_large),
|
||||
cmocka_unit_test(test_parseHeader_error_missing_nplurals),
|
||||
|
||||
// evaluatePlural — pure
|
||||
// evaluatePlural - pure
|
||||
cmocka_unit_test(test_evaluatePlural_english_singular),
|
||||
cmocka_unit_test(test_evaluatePlural_english_plural),
|
||||
cmocka_unit_test(test_evaluatePlural_singular_only),
|
||||
cmocka_unit_test(test_evaluatePlural_less_than_boundary),
|
||||
|
||||
// getString — in-memory ZIP
|
||||
// getString - in-memory ZIP
|
||||
cmocka_unit_test_setup_teardown(test_getString_simple, locale_setup, locale_teardown),
|
||||
cmocka_unit_test_setup_teardown(test_getString_plural_singular, locale_setup, locale_teardown),
|
||||
cmocka_unit_test_setup_teardown(test_getString_plural_many, locale_setup, locale_teardown),
|
||||
cmocka_unit_test_setup_teardown(test_getString_multiple_calls, locale_setup, locale_teardown),
|
||||
cmocka_unit_test_setup_teardown(test_getString_missing_id, locale_setup, locale_teardown),
|
||||
|
||||
// getStringWithArgs — in-memory ZIP
|
||||
// getStringWithArgs - in-memory ZIP
|
||||
cmocka_unit_test_setup_teardown(test_getStringWithArgs_int, locale_setup, locale_teardown),
|
||||
cmocka_unit_test_setup_teardown(test_getStringWithArgs_string, locale_setup, locale_teardown),
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ static void test_thread_start_stop(void **state) {
|
||||
}
|
||||
|
||||
static void test_thread_should_stop(void **state) {
|
||||
// threadStop blocks until STOPPED — if threadShouldStop is broken the
|
||||
// threadStop blocks until STOPPED - if threadShouldStop is broken the
|
||||
// looping callback never exits and this test hangs / times out.
|
||||
thread_t thread;
|
||||
threadInit(&thread, helper_loop);
|
||||
@@ -108,12 +108,12 @@ typedef struct {
|
||||
static void helper_trylock(thread_t *thread) {
|
||||
trylock_data_t *data = (trylock_data_t *)thread->data;
|
||||
|
||||
// Phase 1: main holds the lock — trylock must fail.
|
||||
// Phase 1: main holds the lock - trylock must fail.
|
||||
while(data->phase != 1) {}
|
||||
data->resultWhileLocked = threadMutexTryLock(data->target);
|
||||
data->phase = 2;
|
||||
|
||||
// Phase 3: main released the lock — trylock must succeed.
|
||||
// Phase 3: main released the lock - trylock must succeed.
|
||||
while(data->phase != 3) {}
|
||||
data->resultAfterUnlock = threadMutexTryLock(data->target);
|
||||
if(data->resultAfterUnlock) {
|
||||
|
||||
Reference in New Issue
Block a user