Some label fixes

This commit is contained in:
2026-06-25 19:56:14 -05:00
parent d85737cc08
commit 722fe2ccfb
30 changed files with 290 additions and 105 deletions
+10 -10
View File
@@ -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),
+8 -8
View File
@@ -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),
};