Change unit test layout

This commit is contained in:
def 2017-08-30 22:18:48 +02:00
parent eb2634ab0a
commit 58c5303262

View file

@ -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");
}