1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Apply some refactoring/cleanup to mainly util functions

This commit is contained in:
sfan5 2025-03-26 19:08:31 +01:00
parent 89e3bc8d56
commit e73eed247e
19 changed files with 190 additions and 160 deletions

View file

@ -47,6 +47,7 @@ public:
void testIsBlockInSight();
void testColorizeURL();
void testSanitizeUntrusted();
void testReadSeed();
};
static TestUtilities g_test_instance;
@ -82,6 +83,7 @@ void TestUtilities::runTests(IGameDef *gamedef)
TEST(testIsBlockInSight);
TEST(testColorizeURL);
TEST(testSanitizeUntrusted);
TEST(testReadSeed);
}
////////////////////////////////////////////////////////////////////////////////
@ -753,3 +755,11 @@ void TestUtilities::testSanitizeUntrusted()
UASSERTEQ(auto, sanitize_untrusted("\x1b(", keep), "(");
}
}
void TestUtilities::testReadSeed()
{
UASSERTEQ(int, read_seed("123"), 123);
UASSERTEQ(int, read_seed("0x123"), 0x123);
// hashing should produce some non-zero number
UASSERT(read_seed("hello") != 0);
}