X Tutup
Skip to content

TEST: Fix base64 test on big-endian#6441

Merged
lephilousophe merged 1 commit intoscummvm:masterfrom
lephilousophe:fix-15738
Feb 24, 2025
Merged

TEST: Fix base64 test on big-endian#6441
lephilousophe merged 1 commit intoscummvm:masterfrom
lephilousophe:fix-15738

Conversation

@lephilousophe
Copy link
Member

The structure is loaded bytewise from Base64 data and should be compared in a little endian fashion as the Base64 test pattern was generated on a LE machine.

Closes bug:15738.

The structure is loaded bytewise from Base64 data and should be compared
in a little endian fashion as the Base64 test pattern was generated on a LE machine.

Closes bug:15738.
@dwatteau
Copy link
Contributor

Thanks; tested on my big-endian Quad G5.

Before:

./test/runner
Running 387 tests...........................................
In Base64TestSuite::test_b64EncodeData:
./test/common/base64.h:86: Error: Expected (encoded == "AQAAAAIDAAQAAAAF"), found (AAAAAQIAAwAAAAQF != AQAAAAIDAAQAAAAF)
..
In Base64TestSuite::test_b64DecodeData:
./test/common/base64.h:121: Error: Expected (test->x == 1), found (16777216 != 1)
./test/common/base64.h:123: Error: Expected (test->z == 3), found (768 != 3)
./test/common/base64.h:124: Error: Expected (test->a == 4), found (67108864 != 4)
....................................................................................................................................................................................................................................................................................................................................................
Failed 2 of 387 tests
Success rate: 99%
gmake: *** [test/module.mk:75: test] Error 2

after:

./test/runner
Running 387 tests...................................................................................................................................................................................................................................................................................................................................................................................................OK!

So it looks good to me 🙂

(I can't say whether common/base64.cpp itself or its engines/scumm/he/moonbase/map_main.cpp user need any fix as well...)

@lephilousophe
Copy link
Member Author

The Base64 algorithm works on bytes only, so it is OK if the test as it is now is OK.
The test was wrong because it was reading multi-byte values without taking endianness into account.
The MapFile code itself seems completely broken when BE systems talk to LE systems and vice-versa.

@lephilousophe lephilousophe merged commit 64e478f into scummvm:master Feb 24, 2025
8 checks passed
@lephilousophe lephilousophe deleted the fix-15738 branch February 24, 2025 19:32
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.

2 participants

X Tutup