8000 Test `issue_convert_valid_utf32_to_latin1_2104d5a31440e3ed` shows inconsistency in implementations · Issue #760 · simdutf/simdutf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Test issue_convert_valid_utf32_to_latin1_2104d5a31440e3ed shows inconsistency in implementations #760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
WojciechMula opened this issue Apr 24, 2025 · 2 comments

Comments

@WojciechMula
Copy link
Collaborator
WojciechMula commented Apr 24, 2025
  const auto outlen = implementation.latin1_length_from_utf32(data_len);
  ASSERT_EQUAL(outlen, 1);
  std::vector<char> output(outlen);
  const auto r = implementation.convert_valid_utf32_to_latin1(
      (const char32_t *)data, data_len, output.data());
  /*
   * fallback gets 1, the others 0
   */
  ASSERT_EQUAL(r, 0);

The comment and assertion states something violating our spec. The spec for convert_valid_utf32_to_latin1 says "number of written code units; 0 if conversion is not possible".

@WojciechMula
Copy link
Collaborator Author

I'm not sure if this should be tested. Input is not valid Latin1, thus according to the spec the behavior is unspecified.

@lemire
Copy link
Member
lemire commented Apr 24, 2025

I'm not sure if this should be tested. Input is not valid Latin1, thus according to the spec the behavior is unspecified.

Right. I don't think we want to make guarantees when our preconditions are not met. This precludes optimizations.

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

No branches or pull requests

2 participants
0