🔧 Replaced gtest with catch2

This commit is contained in:
2018-12-15 12:18:07 +01:00
parent e83556ae74
commit cc0d44a01d
3 changed files with 23 additions and 22 deletions

View File

@ -1,35 +1,36 @@
#define CATCH_CONFIG_MAIN
#include "moFileReader.h"
#include "gtest/gtest.h"
#include "catch.hpp"
using namespace moFileLib;
#define _L(str) moFileReaderSingleton::GetInstance().Lookup(str)
#define _LC(ctx,str) moFileReaderSingleton::GetInstance().LookupWithContext(ctx,str)
TEST(moFileReader, setup)
TEST_CASE ("Load mo-file", "[ReadFile]")
{
EXPECT_EQ(moFileReaderSingleton::GetInstance().ReadFile("test.mo"), moFileLib::moFileReader::EC_SUCCESS);
CHECK (moFileReaderSingleton::GetInstance().ReadFile("test.mo") == moFileLib::moFileReader::EC_SUCCESS);
}
TEST(moFileReader, Lookup)
TEST_CASE ("Lookup string", "[Lookup]")
{
moFileReaderSingleton::GetInstance ().ReadFile ("test.mo");
/* This is the first comment. */
EXPECT_EQ ("Text Nederlands Een", _L ("String English One"));
CHECK ("Text Nederlands Een" == _L ("String English One"));
/* This is the second comment. */
EXPECT_EQ ("Text Nederlands Twee", _L ("String English Two"));
CHECK ("Text Nederlands Twee" == _L ("String English Two"));
/* This is the third comment. */
EXPECT_EQ ("Text Nederlands Drie", _L ("String English Three"));
CHECK ("Text Nederlands Drie" == _L ("String English Three"));
}
TEST (moFileReader, LookupWithContext)
TEST_CASE ("Lookup string with context", "[LookupWithContext]")
{
moFileReaderSingleton::GetInstance ().ReadFile ("test.mo");
/* This is the first comment. */
EXPECT_EQ ("Text Nederlands Een", _LC ("TEST|String|1", "String English"));
CHECK ("Text Nederlands Een" == _LC ("TEST|String|1", "String English"));
/* This is the second comment. */
EXPECT_EQ ("Text Nederlands Twee", _LC ("TEST|String|2", "String English"));
CHECK ("Text Nederlands Twee" == _LC ("TEST|String|2", "String English"));
/* This is the third comment. */
EXPECT_EQ ("Text Nederlands Drie", _LC ("TEST|String|3", "String English"));
CHECK ("Text Nederlands Drie" == _LC ("TEST|String|3", "String English"));
}