Skip to content
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

Failing tests in StringUtilTests #1621

Closed
hexagonrecursion opened this issue Nov 18, 2023 · 4 comments
Closed

Failing tests in StringUtilTests #1621

hexagonrecursion opened this issue Nov 18, 2023 · 4 comments
Labels

Comments

@hexagonrecursion
Copy link
Contributor

On my machine the following 4 tests fail:

ctest --rerun-failed --output-on-failure
Test project /home/cdda/github/colobot/build
    Start 111: StringUtilTests.StringCodePointCounts
1/4 Test #111: StringUtilTests.StringCodePointCounts ...***Failed    0.02 sec
Note: Google Test filter = StringUtilTests.StringCodePointCounts
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from StringUtilTests
[ RUN      ] StringUtilTests.StringCodePointCounts
unknown file: Failure
C++ exception with description "Invalid character" thrown in the test body.
[  FAILED  ] StringUtilTests.StringCodePointCounts (0 ms)
[----------] 1 test from StringUtilTests (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] StringUtilTests.StringCodePointCounts

 1 FAILED TEST

    Start 112: StringUtilTests.StringConversion
2/4 Test #112: StringUtilTests.StringConversion ........***Failed    0.02 sec
Note: Google Test filter = StringUtilTests.StringConversion
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from StringUtilTests
[ RUN      ] StringUtilTests.StringConversion
unknown file: Failure
C++ exception with description "Invalid character" thrown in the test body.
[  FAILED  ] StringUtilTests.StringConversion (0 ms)
[----------] 1 test from StringUtilTests (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] StringUtilTests.StringConversion

 1 FAILED TEST

    Start 113: StringUtilTests.ToLowerTest
3/4 Test #113: StringUtilTests.ToLowerTest .............***Failed    0.02 sec
Note: Google Test filter = StringUtilTests.ToLowerTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from StringUtilTests
[ RUN      ] StringUtilTests.ToLowerTest
unknown file: Failure
C++ exception with description "Invalid character" thrown in the test body.
[  FAILED  ] StringUtilTests.ToLowerTest (0 ms)
[----------] 1 test from StringUtilTests (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] StringUtilTests.ToLowerTest

 1 FAILED TEST

    Start 114: StringUtilTests.ToUpperTest
4/4 Test #114: StringUtilTests.ToUpperTest .............***Failed    0.01 sec
Note: Google Test filter = StringUtilTests.ToUpperTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from StringUtilTests
[ RUN      ] StringUtilTests.ToUpperTest
unknown file: Failure
C++ exception with description "Invalid character" thrown in the test body.
[  FAILED  ] StringUtilTests.ToUpperTest (0 ms)
[----------] 1 test from StringUtilTests (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] StringUtilTests.ToUpperTest

 1 FAILED TEST


0% tests passed, 4 tests failed out of 4

Total Test time (real) =   0.08 sec

The following tests FAILED:
	111 - StringUtilTests.StringCodePointCounts (Failed)
	112 - StringUtilTests.StringConversion (Failed)
	113 - StringUtilTests.ToLowerTest (Failed)
	114 - StringUtilTests.ToUpperTest (Failed)
Errors while running CTest

System info

colobot f07b7a1 (latest dev)
Ubuntu 22.04.3 LTS
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
GNU ld (GNU Binutils for Ubuntu) 2.38

@tomangelo2 tomangelo2 added the bug label Nov 18, 2023
@hexagonrecursion
Copy link
Contributor Author

After some debugging it appears that several functions in the standard library think that "narrow multibyte representation" means "ASCII-only". I asked about that on stackoverflow.

@hexagonrecursion
Copy link
Contributor Author

After some more digging it turned out that "en_US.UTF-8" locale was not configured on my system. Configuring the locale fixed it. Should we be using locale facilities when there is std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t>?

@tomaszkax86
Copy link
Contributor

I'm working on a rewrite using std::codecvt, it won't depend on current locale. Should be finished this week.

@hexagonrecursion
Copy link
Contributor Author

This was fixed somewhere between 9c53d4d and c9db4a1 - probably 9c53d4d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants