mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 20:16:21 +00:00
Update ai_providers_find() to handle NULL search_str safely by treating it as an empty string, preventing a segfault in strdup() within autocomplete_complete(). Rename test_ai_providers_find_case_sensitive to test_ai_providers_find_case_insensitive to reflect the new case-insensitive matching contract. Update all affected tests to expect cycling behavior (NULL/empty returns first provider) and use auto_gchar for automatic memory management. Use `gchar` instead of `char` in ai_providers_find for consistency
43 lines
1.9 KiB
C
43 lines
1.9 KiB
C
/*
|
|
* test_ai_client.h - AI client unit test declarations
|
|
*/
|
|
|
|
int ai_client_setup(void** state);
|
|
int ai_client_teardown(void** state);
|
|
|
|
void test_ai_client_init(void** state);
|
|
void test_ai_add_provider(void** state);
|
|
void test_ai_remove_provider(void** state);
|
|
void test_ai_list_providers(void** state);
|
|
void test_ai_set_provider_key(void** state);
|
|
void test_ai_get_provider_key(void** state);
|
|
void test_ai_session_create(void** state);
|
|
void test_ai_session_ref_unref(void** state);
|
|
void test_ai_session_add_message(void** state);
|
|
void test_ai_session_clear_history(void** state);
|
|
void test_ai_session_set_model(void** state);
|
|
void test_ai_json_escape(void** state);
|
|
void test_ai_json_escape_null(void** state);
|
|
void test_ai_json_escape_empty(void** state);
|
|
void test_ai_json_escape_special_chars(void** state);
|
|
void test_ai_json_escape_percent_signs(void** state);
|
|
void test_ai_json_escape_backslash_quote(void** state);
|
|
void test_ai_session_api_key_is_copied(void** state);
|
|
void test_ai_add_provider_update_existing(void** state);
|
|
void test_ai_add_provider_null_name_returns_null(void** state);
|
|
void test_ai_add_provider_null_url_returns_null(void** state);
|
|
void test_ai_session_create_null_provider_returns_null(void** state);
|
|
void test_ai_session_create_null_model_returns_null(void** state);
|
|
void test_ai_session_api_key_null_when_no_key_set(void** state);
|
|
/* Provider autocomplete tests */
|
|
void test_ai_providers_find_forward(void** state);
|
|
void test_ai_providers_find_forward_perplexity(void** state);
|
|
void test_ai_providers_find_forward_custom(void** state);
|
|
void test_ai_providers_find_forward_no_match(void** state);
|
|
void test_ai_providers_find_forward_partial_match(void** state);
|
|
void test_ai_providers_find_next(void** state);
|
|
void test_ai_providers_find_previous(void** state);
|
|
void test_ai_providers_find_null_search_str(void** state);
|
|
void test_ai_providers_find_empty_search_str(void** state);
|
|
void test_ai_providers_find_case_insensitive(void** state);
|