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