mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-12 19:18:20 +00:00
Change unit test layout
This commit is contained in:
parent
eb2634ab0a
commit
58c5303262
|
@ -3,16 +3,33 @@
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <engine/storage.h>
|
#include <engine/storage.h>
|
||||||
|
|
||||||
#define T(name, input, output) \
|
class StripPathAndExtension : public ::testing::Test
|
||||||
TEST(StripPathAndExtension, name) \
|
{
|
||||||
{ \
|
protected:
|
||||||
char aBuf[32]; \
|
void testEq(const char *pInput, const char *pOutput)
|
||||||
IStorage::StripPathAndExtension(input, aBuf, sizeof(aBuf)); \
|
{
|
||||||
ASSERT_STREQ(aBuf, output); \
|
char aBuf[32];
|
||||||
|
IStorage::StripPathAndExtension(pInput, aBuf, sizeof(aBuf));
|
||||||
|
ASSERT_STREQ(aBuf, pOutput);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
T(WorksOnBareFilename, "abc", "abc");
|
TEST_F(StripPathAndExtension, WorksOnBareFilename) {
|
||||||
T(NormalPath, "/usr/share/teeworlds/data/mapres/grass_main.png", "grass_main");
|
testEq("abc", "abc");
|
||||||
T(NormalFile, "winter_main.png", "winter_main");
|
}
|
||||||
T(DotInFolder, "C:\\a.b\\c", "c");
|
|
||||||
T(DoubleDot, "file.name.png", "file.name");
|
TEST_F(StripPathAndExtension, NormalPath) {
|
||||||
|
testEq("/usr/share/teeworlds/data/mapres/grass_main.png", "grass_main");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(StripPathAndExtension, NormalFile) {
|
||||||
|
testEq("winter_main.png", "winter_main");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(StripPathAndExtension, DotInFolder) {
|
||||||
|
testEq("C:\\a.b\\c", "c");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(StripPathAndExtension, DoubleDot) {
|
||||||
|
testEq("file.name.png", "file.name");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue