Lot of code for generating code. Working on unit tests.
This commit is contained in:
parent
da45929b12
commit
8f4845d4d2
42 changed files with 1089 additions and 267 deletions
54
tests/pglabtests/tst_NameManglingRules.cpp
Normal file
54
tests/pglabtests/tst_NameManglingRules.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock-matchers.h>
|
||||
#include "PrintTo_Qt.h"
|
||||
#include "codebuilder/NameManglingRules.h"
|
||||
#include "Pgsql_oids.h"
|
||||
|
||||
using namespace testing;
|
||||
|
||||
class NameManglingRulesTest : public ::testing::Test, public ::testing::WithParamInterface<
|
||||
std::tuple<QString, NameManglingRules::CaseConversion, bool> > {
|
||||
protected:
|
||||
|
||||
virtual void SetUp() override
|
||||
{
|
||||
NameManglingRules r;
|
||||
|
||||
auto p = GetParam();
|
||||
//ReplaceRules replaceRules;
|
||||
// { {"[ -_]", QRegularExpression::OptimizeOnFirstUsageOption }, "", true }
|
||||
r.replaceRules;
|
||||
|
||||
//QString replaceSpaceWith; ///< default is empty string which means remove spaces
|
||||
r.replaceSpaceWith = std::get<0>(p);
|
||||
|
||||
//CollisionHandling CollisionHandling = CollisionHandling::Restrict;
|
||||
//CaseConversion caseConversion = CaseConversion::AsIs; ///< overall case conversion rule
|
||||
r.caseConversion = std::get<1>(p);
|
||||
//CaseConversion caseFirstChar = CaseConversion::AsIs; ///< case of the first char
|
||||
r.camelCase = std::get<2>(p); ///< removes underscores and make first char after underscore uppercase
|
||||
rules = r;
|
||||
}
|
||||
NameManglingRules rules;
|
||||
};
|
||||
|
||||
|
||||
TEST_P(NameManglingRulesTest, test1)
|
||||
{
|
||||
ASSERT_EQ(rules.replaceSpaceWith, std::get<0>(GetParam()));
|
||||
}
|
||||
|
||||
TEST_P(NameManglingRulesTest, test2)
|
||||
{
|
||||
ASSERT_EQ(rules.camelCase, std::get<2>(GetParam()));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(InstantiationName1,
|
||||
NameManglingRulesTest,
|
||||
::testing::Combine(
|
||||
::testing::Values("", "_", "+"),
|
||||
::testing::Values(NameManglingRules::CaseConversion::AsIs,
|
||||
NameManglingRules::CaseConversion::Lower,
|
||||
NameManglingRules::CaseConversion::Upper),
|
||||
::testing::Bool()
|
||||
));
|
||||
Loading…
Add table
Add a link
Reference in a new issue