Skip to content

convert: add comprehensive UTF-16/UTF-32 conversion tests - #125

Merged
christianparpart merged 1 commit into
masterfrom
fix/issue-26-utf16-utf32-conversion-tests
Apr 8, 2026
Merged

convert: add comprehensive UTF-16/UTF-32 conversion tests#125
christianparpart merged 1 commit into
masterfrom
fix/issue-26-utf16-utf32-conversion-tests

Conversation

@christianparpart

@christianparpart christianparpart commented Apr 8, 2026

Copy link
Copy Markdown
Member
  • Verified that the UTF-16 ↔ UTF-32 encoder/decoder math in convert.h is correct — the original bugs (throw-instead-of-return, wchar_t decoder calling encoder, output iterator not propagated) were already fixed in earlier commits
  • Added six new test cases covering all previously untested conversion directions: UTF-16→UTF-8, UTF-16→UTF-32, UTF-32→UTF-8, UTF-32→UTF-16, surrogate pair boundary round-trips (U+10000, U+10FFFF, U+1F600), and invalid surrogate handling

Closes #26

The underlying conversion bugs referenced in #26 were already fixed
in earlier commits (505373e, a440d09, 316f9f1), but no tests existed
for UTF-16 ↔ UTF-32, UTF-16 → UTF-8, or UTF-32 → UTF-8 directions.

Add six new test cases:
- convert.16_to_8, convert.16_to_32, convert.32_to_8, convert.32_to_16
- convert.surrogate_pair_boundaries (U+10000, U+10FFFF, U+1F600 round-trips)
- convert.utf16_invalid_surrogates (lone surrogates, surrogate-range codepoints)

Closes #26

Signed-off-by: Christian Parpart <christian@parpart.family>
@christianparpart
christianparpart merged commit 4b99c95 into master Apr 8, 2026
7 checks passed
@christianparpart
christianparpart deleted the fix/issue-26-utf16-utf32-conversion-tests branch April 8, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UTF-16 <-> UTF-32 conversion not working correctly

1 participant