Skip to content

Improve unittests#2093

Merged
jubalh merged 9 commits intomasterfrom
improve-unittests
Feb 25, 2026
Merged

Improve unittests#2093
jubalh merged 9 commits intomasterfrom
improve-unittests

Conversation

@jubalh
Copy link
Member

@jubalh jubalh commented Feb 25, 2026

No description provided.

It seems like we didn't even check whether the operations succeed or
not.

* `clear_empty()`
  Add assertion to confirm a newly created autocomplete object is empty.
* `find_after_create()`:
  Add assertion to ensure `autocomplete_complete()` returns NULL when no
  entries are present in th object.
@jubalh jubalh added this to the next milestone Feb 25, 2026
@jubalh jubalh self-assigned this Feb 25, 2026
Writing this test I'm unsure whether a function like
string_matches_one_of() should actually call cons_show().
Let's just note that for later.
See last commit with comment regarding cons_show().

In this test here we can see that if we pass NULL cons_show() isn't
called. Making it a bit different that other invalid test cases.
Optimize prof_occurrences by using pointer arithmetic and
g_utf8_next_char instead of calls to g_utf8_offset_to_pointer.

Improve list construction efficiency in prof_occurrences by
using g_slist_prepend and g_slist_reverse instead of appends.

Also fix a slight oversight that could lead to trouble:
When empty search strings (e.g. empty nicks) are passed
it caused matches at every position.

Update the test case to test for empty nicks.
Also refactor the function so we pass it the current version
and don't rely on the define inside of it.

This function only allows version format in the style of "x.y.z".
@jubalh jubalh merged commit 8fd3c05 into master Feb 25, 2026
7 checks passed
@jubalh jubalh deleted the improve-unittests branch February 25, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant