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:
parent
89e3bc8d56
commit
e73eed247e
19 changed files with 190 additions and 160 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue