[DEBUG] correct the spacing around elements

This commit is contained in:
Edouard DUPIN 2018-01-03 22:10:02 +01:00
parent 067b211bf8
commit 210a42e5cb
9 changed files with 535 additions and 512 deletions

View File

@ -392,6 +392,22 @@ void estyle::Generator::addSpaceIfNeeded() {
}
}
static bool startWithText(const etk::String& _data) {
if (_data.size() == 0) {
return false;
}
if ( ( _data[0] >= '0'
&& _data[0] <= '9' )
|| ( _data[0] >= 'a'
&& _data[0] <= 'z' )
|| ( _data[0] >= 'A'
&& _data[0] <= 'Z' )
|| _data[0] == '_' ) {
return true;
}
return false;
}
bool estyle::Generator::onNewLine() {
if (m_output.size() == 0) {
return true;
@ -647,8 +663,9 @@ int32_t estyle::Generator::process(int32_t _startId,
}
if (elem == estyle::lexer::RESERVED_FOR) {
addNewLineIfSemiColon();
addSpace();
m_output += "for ";
addIndent();
addSpaceIfNeeded();
m_output += "for";
typePush("for");
offsetPush(4);
bool errorOccured = false;
@ -749,7 +766,8 @@ int32_t estyle::Generator::process(int32_t _startId,
|| elem == estyle::lexer::RESERVED_WHILE
|| elem == estyle::lexer::RESERVED_DO) {
addNewLineIfSemiColon();
addSpace();
addIndent();
addSpaceIfNeeded();
if (elem == estyle::lexer::RESERVED_IF) {
m_output += "if";
typePush("if");
@ -824,7 +842,7 @@ int32_t estyle::Generator::process(int32_t _startId,
} else {
addSpaceIfNeeded();
iii++;
m_output += "while ";
m_output += "while";
offsetPush(6);
for (int64_t jjj=iii+1; jjj<m_lexer.size(); ++jjj) {
enum estyle::lexer::tocken elem2 = m_lexer.getTocken(jjj);
@ -853,7 +871,7 @@ int32_t estyle::Generator::process(int32_t _startId,
if (elem == estyle::lexer::RESERVED_ELSE) {
addNewLineIfSemiColon();
typePush("else");
addSpace();
addSpaceIfNeeded();
m_output += "else";
// special case ==> nothing special to do for the else element...
if (nextIs(iii+1, estyle::lexer::RESERVED_IF) == true) {
@ -889,7 +907,7 @@ int32_t estyle::Generator::process(int32_t _startId,
if (elem == estyle::lexer::RESERVED_NAMESPACE) {
addNewLineIfSemiColon();
typePush("namespace");
addSpace();
addSpaceIfNeeded();
m_output += "namespace";
// special case ==> nothing special to do for the else element...
if (nextIs(iii+1, estyle::lexer::BRACE_IN) == false) {
@ -933,10 +951,10 @@ int32_t estyle::Generator::process(int32_t _startId,
if ( elem == estyle::lexer::ELEMENT_FUNCTION
|| elem == estyle::lexer::ELEMENT_FUNCTION_DECLARATION) {
addNewLineIfSemiColon();
addSpaceIfNeeded();
typePush("function");
//addSpace();
m_output += m_lexer.getData(iii);
m_output += " ";
//offsetPush(m_lexer.getData(iii).size() + 2);
offsetPushAuto();
for (int64_t jjj=iii+1; jjj<m_lexer.size(); ++jjj) {
@ -966,6 +984,9 @@ int32_t estyle::Generator::process(int32_t _startId,
}
// default other case:
//addSpace();
if (startWithText(m_lexer.getData(iii)) == true) {
addSpaceIfNeeded();
}
m_output += m_lexer.getData(iii);
}
return _stopId+1;
@ -1102,11 +1123,13 @@ bool estyle::Generator::nextIs(int64_t _pos, enum estyle::lexer::tocken _nextTyp
int64_t estyle::Generator::generateCondition(int64_t _pos) {
int32_t sectionEnd = endOfSection(_pos);
int32_t nbCondition = countCurrentLevelCondition(_pos);
m_output += "(";
if (nbCondition == 0) {
process(_pos, sectionEnd);
ESTYLE_WARNING("==> only one element");
process(_pos+1, sectionEnd);
} else {
m_output += "( ";
offsetPush(5);
m_output += " ";
offsetPushAuto();
for (int64_t iii=_pos+1; iii<=sectionEnd; ++iii) {
enum estyle::lexer::tocken elem = m_lexer.getTocken(iii);
if (elem == estyle::lexer::PARENTHESE_IN) {
@ -1125,7 +1148,7 @@ int64_t estyle::Generator::generateCondition(int64_t _pos) {
}
offsetPop();
}
addSpace();
//addSpaceIfNeeded();
m_output += ")";
return sectionEnd;
}
@ -1147,7 +1170,7 @@ int64_t estyle::Generator::generateFunction(int64_t _pos) {
}
}
}
addSpace();
//addSpace();
m_output += ")";
offsetPop();
return sectionEnd;

View File

@ -23,9 +23,9 @@ TEST(testBlock, brace_0000) {
//interface.properties.set("brace-block-out-new-line-after", "true");
//interface.properties.set("brace-block-out-space-before", "true");
//interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;{action_B;}action_D;";
etk::String outRef = "action_A;{action_B;}action_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_1000) {
@ -38,9 +38,9 @@ TEST(testBlock, brace_1000) {
//interface.properties.set("brace-block-out-new-line-after", "true");
//interface.properties.set("brace-block-out-space-before", "true");
//interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;\n{action_B;\n}action_D;";
etk::String outRef = "action_A;\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_1010) {
@ -53,9 +53,9 @@ TEST(testBlock, brace_1010) {
//interface.properties.set("brace-block-out-new-line-after", "true");
interface.properties.set("brace-block-out-space-before", "true");
//interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;\n{action_B;\n}action_D;";
etk::String outRef = "action_A;\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_1011) {
@ -68,9 +68,9 @@ TEST(testBlock, brace_1011) {
//interface.properties.set("brace-block-out-new-line-after", "true");
interface.properties.set("brace-block-out-space-before", "true");
interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_1100) {
@ -83,9 +83,9 @@ TEST(testBlock, brace_1100) {
interface.properties.set("brace-block-out-new-line-after", "true");
//interface.properties.set("brace-block-out-space-before", "true");
//interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_1101) {
@ -98,9 +98,9 @@ TEST(testBlock, brace_1101) {
interface.properties.set("brace-block-out-new-line-after", "true");
//interface.properties.set("brace-block-out-space-before", "true");
interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_1110) {
@ -113,9 +113,9 @@ TEST(testBlock, brace_1110) {
interface.properties.set("brace-block-out-new-line-after", "true");
interface.properties.set("brace-block-out-space-before", "true");
//interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_1111) {
@ -128,9 +128,9 @@ TEST(testBlock, brace_1111) {
interface.properties.set("brace-block-out-new-line-after", "true");
interface.properties.set("brace-block-out-space-before", "true");
interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_1001) {
@ -143,9 +143,9 @@ TEST(testBlock, brace_1001) {
//interface.properties.set("brace-block-out-new-line-after", "true");
//interface.properties.set("brace-block-out-space-before", "true");
interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -159,9 +159,9 @@ TEST(testBlock, brace_0100) {
interface.properties.set("brace-block-out-new-line-after", "true");
//interface.properties.set("brace-block-out-space-before", "true");
//interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;{\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;{\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_0101) {
@ -174,9 +174,9 @@ TEST(testBlock, brace_0101) {
interface.properties.set("brace-block-out-new-line-after", "true");
//interface.properties.set("brace-block-out-space-before", "true");
interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;{\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;{\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_0110) {
@ -189,9 +189,9 @@ TEST(testBlock, brace_0110) {
interface.properties.set("brace-block-out-new-line-after", "true");
interface.properties.set("brace-block-out-space-before", "true");
//interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A; {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A; {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_0010) {
@ -204,9 +204,9 @@ TEST(testBlock, brace_0010) {
//interface.properties.set("brace-block-out-new-line-after", "true");
interface.properties.set("brace-block-out-space-before", "true");
//interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A; {action_B; }action_D;";
etk::String outRef = "action_A; {action_B; }action_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_0011) {
@ -219,9 +219,9 @@ TEST(testBlock, brace_0011) {
//interface.properties.set("brace-block-out-new-line-after", "true");
interface.properties.set("brace-block-out-space-before", "true");
interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A; { action_B; } action_D;";
etk::String outRef = "action_A; { action_B; } action_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_0111) {
@ -234,9 +234,9 @@ TEST(testBlock, brace_0111) {
interface.properties.set("brace-block-out-new-line-after", "true");
interface.properties.set("brace-block-out-space-before", "true");
interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A; {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A; {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBlock, brace_0001) {
@ -249,9 +249,9 @@ TEST(testBlock, brace_0001) {
//interface.properties.set("brace-block-out-new-line-after", "true");
//interface.properties.set("brace-block-out-space-before", "true");
interface.properties.set("brace-block-out-space-after", "true");
etk::String outputRef = "action_A;{ action_B;} action_D;";
etk::String outRef = "action_A;{ action_B;} action_D;";
etk::String output = interface.process(sourceBlock);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}

View File

@ -26,11 +26,11 @@ TEST(testDoWhile, brace_0000) {
//interface.properties.set("brace-do-while-out-space-before", "true");
//interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo{action_B;}while (true );\naction_D;";
etk::String outRef = "action_A;do{action_B;}while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_1000) {
@ -44,11 +44,11 @@ TEST(testDoWhile, brace_1000) {
//interface.properties.set("brace-do-while-out-space-before", "true");
//interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo\n{action_B;\n}while (true );\naction_D;";
etk::String outRef = "action_A;do\n{action_B;\n}while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_1010) {
@ -62,11 +62,11 @@ TEST(testDoWhile, brace_1010) {
interface.properties.set("brace-do-while-out-space-before", "true");
//interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo\n{action_B;\n}while (true );\naction_D;";
etk::String outRef = "action_A;do\n{action_B;\n}while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_1011) {
@ -80,11 +80,11 @@ TEST(testDoWhile, brace_1011) {
interface.properties.set("brace-do-while-out-space-before", "true");
interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo\n{ action_B;\n} while (true );\naction_D;";
etk::String outRef = "action_A;do\n{ action_B;\n} while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_1100) {
@ -98,11 +98,11 @@ TEST(testDoWhile, brace_1100) {
//interface.properties.set("brace-do-while-out-space-before", "true");
//interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo\n{\n\taction_B;\n}\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do\n{\n\taction_B;\n}\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_1101) {
@ -116,11 +116,11 @@ TEST(testDoWhile, brace_1101) {
//interface.properties.set("brace-do-while-out-space-before", "true");
interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo\n{\n\taction_B;\n}\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do\n{\n\taction_B;\n}\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_1110) {
@ -134,11 +134,11 @@ TEST(testDoWhile, brace_1110) {
interface.properties.set("brace-do-while-out-space-before", "true");
//interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo\n{\n\taction_B;\n}\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do\n{\n\taction_B;\n}\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_1111) {
@ -152,11 +152,11 @@ TEST(testDoWhile, brace_1111) {
interface.properties.set("brace-do-while-out-space-before", "true");
interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo\n{\n\taction_B;\n}\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do\n{\n\taction_B;\n}\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_1001) {
@ -170,11 +170,11 @@ TEST(testDoWhile, brace_1001) {
//interface.properties.set("brace-do-while-out-space-before", "true");
interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo\n{ action_B;\n} while (true );\naction_D;";
etk::String outRef = "action_A;do\n{ action_B;\n} while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -189,11 +189,11 @@ TEST(testDoWhile, brace_0100) {
//interface.properties.set("brace-do-while-out-space-before", "true");
//interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo{\n\taction_B;}\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do{\n\taction_B;}\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_0101) {
@ -207,11 +207,11 @@ TEST(testDoWhile, brace_0101) {
//interface.properties.set("brace-do-while-out-space-before", "true");
interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo{\n\taction_B;}\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do{\n\taction_B;}\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_0110) {
@ -225,11 +225,11 @@ TEST(testDoWhile, brace_0110) {
interface.properties.set("brace-do-while-out-space-before", "true");
//interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo {\n\taction_B; }\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do {\n\taction_B; }\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_0010) {
@ -243,11 +243,11 @@ TEST(testDoWhile, brace_0010) {
interface.properties.set("brace-do-while-out-space-before", "true");
//interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo {action_B; }while (true );\naction_D;";
etk::String outRef = "action_A;do {action_B; }while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_0011) {
@ -261,11 +261,11 @@ TEST(testDoWhile, brace_0011) {
interface.properties.set("brace-do-while-out-space-before", "true");
interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo { action_B; } while (true );\naction_D;";
etk::String outRef = "action_A;do { action_B; } while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_0111) {
@ -279,11 +279,11 @@ TEST(testDoWhile, brace_0111) {
interface.properties.set("brace-do-while-out-space-before", "true");
interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo {\n\taction_B; }\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do {\n\taction_B; }\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_0001) {
@ -297,11 +297,11 @@ TEST(testDoWhile, brace_0001) {
//interface.properties.set("brace-do-while-out-space-before", "true");
interface.properties.set("brace-do-while-out-space-after", "true");
//interface.properties.set("brace-do-while-single", "true");
etk::String outputRef = "action_A;\ndo{ action_B;} while (true );\naction_D;";
etk::String outRef = "action_A;do{ action_B;} while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -313,11 +313,11 @@ TEST(testDoWhile, brace_single_00) {
//interface.properties.set("brace-do-while-single-in-space", "true");
//interface.properties.set("brace-do-while-single-out-new-line", "true");
//interface.properties.set("brace-do-while-single-out-space", "true");
etk::String outputRef = "action_A;\ndo action_B;while (true );\naction_D;";
etk::String outRef = "action_A;do action_B;while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_single_10) {
@ -328,11 +328,11 @@ TEST(testDoWhile, brace_single_10) {
//interface.properties.set("brace-do-while-single-in-space", "true");
interface.properties.set("brace-do-while-single-out-new-line", "true");
//interface.properties.set("brace-do-while-single-out-space", "true");
etk::String outputRef = "action_A;\ndo\n\taction_B;\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do\n\taction_B;\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_single_01) {
@ -343,11 +343,11 @@ TEST(testDoWhile, brace_single_01) {
interface.properties.set("brace-do-while-single-in-space", "true");
//interface.properties.set("brace-do-while-single-out-new-line", "true");
interface.properties.set("brace-do-while-single-out-space", "true");
etk::String outputRef = "action_A;\ndo action_B; while (true );\naction_D;";
etk::String outRef = "action_A;do action_B; while(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testDoWhile, brace_single_11) {
estyle::Generator interface;
@ -357,11 +357,11 @@ TEST(testDoWhile, brace_single_11) {
interface.properties.set("brace-do-while-single-in-space", "true");
interface.properties.set("brace-do-while-single-out-new-line", "true");
interface.properties.set("brace-do-while-single-out-space", "true");
etk::String outputRef = "action_A;\ndo\n\taction_B;\nwhile (true );\naction_D;";
etk::String outRef = "action_A;do\n\taction_B;\nwhile(true);action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}

View File

@ -15,7 +15,7 @@ static etk::String sourceElse1ActionNoBrace = "action_A;if(true){action_K:}else
static etk::String sourceElse2Action = "action_A;if(true){action_K:}else{action_B;action_C;}action_D;";
TEST(testElse, brace_else_0000) {
TEST(testElse, brace_0000) {
estyle::Generator interface;
//interface.properties.set("brace-else-in-new-line-before", "true");
//interface.properties.set("brace-else-in-new-line-after", "true");
@ -26,14 +26,14 @@ TEST(testElse, brace_else_0000) {
//interface.properties.set("brace-else-out-space-before", "true");
//interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else{action_B;}action_D;";
etk::String outRef = "action_A;if(true){action_K:}else{action_B;}action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_1000) {
TEST(testElse, brace_1000) {
estyle::Generator interface;
interface.properties.set("brace-else-in-new-line-before", "true");
//interface.properties.set("brace-else-in-new-line-after", "true");
@ -44,14 +44,14 @@ TEST(testElse, brace_else_1000) {
//interface.properties.set("brace-else-out-space-before", "true");
//interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{action_B;\n}action_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_1010) {
TEST(testElse, brace_1010) {
estyle::Generator interface;
interface.properties.set("brace-else-in-new-line-before", "true");
//interface.properties.set("brace-else-in-new-line-after", "true");
@ -62,14 +62,14 @@ TEST(testElse, brace_else_1010) {
interface.properties.set("brace-else-out-space-before", "true");
//interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{action_B;\n}action_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_1011) {
TEST(testElse, brace_1011) {
estyle::Generator interface;
interface.properties.set("brace-else-in-new-line-before", "true");
//interface.properties.set("brace-else-in-new-line-after", "true");
@ -80,14 +80,14 @@ TEST(testElse, brace_else_1011) {
interface.properties.set("brace-else-out-space-before", "true");
interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_1100) {
TEST(testElse, brace_1100) {
estyle::Generator interface;
interface.properties.set("brace-else-in-new-line-before", "true");
interface.properties.set("brace-else-in-new-line-after", "true");
@ -98,14 +98,14 @@ TEST(testElse, brace_else_1100) {
//interface.properties.set("brace-else-out-space-before", "true");
//interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_1101) {
TEST(testElse, brace_1101) {
estyle::Generator interface;
interface.properties.set("brace-else-in-new-line-before", "true");
interface.properties.set("brace-else-in-new-line-after", "true");
@ -116,14 +116,14 @@ TEST(testElse, brace_else_1101) {
//interface.properties.set("brace-else-out-space-before", "true");
interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_1110) {
TEST(testElse, brace_1110) {
estyle::Generator interface;
interface.properties.set("brace-else-in-new-line-before", "true");
interface.properties.set("brace-else-in-new-line-after", "true");
@ -134,14 +134,14 @@ TEST(testElse, brace_else_1110) {
interface.properties.set("brace-else-out-space-before", "true");
//interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_1111) {
TEST(testElse, brace_1111) {
estyle::Generator interface;
interface.properties.set("brace-else-in-new-line-before", "true");
interface.properties.set("brace-else-in-new-line-after", "true");
@ -152,14 +152,14 @@ TEST(testElse, brace_else_1111) {
interface.properties.set("brace-else-out-space-before", "true");
interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_1001) {
TEST(testElse, brace_1001) {
estyle::Generator interface;
interface.properties.set("brace-else-in-new-line-before", "true");
//interface.properties.set("brace-else-in-new-line-after", "true");
@ -170,15 +170,15 @@ TEST(testElse, brace_else_1001) {
//interface.properties.set("brace-else-out-space-before", "true");
interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_0100) {
TEST(testElse, brace_0100) {
estyle::Generator interface;
//interface.properties.set("brace-else-in-new-line-before", "true");
interface.properties.set("brace-else-in-new-line-after", "true");
@ -189,14 +189,14 @@ TEST(testElse, brace_else_0100) {
//interface.properties.set("brace-else-out-space-before", "true");
//interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else{\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else{\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_0101) {
TEST(testElse, brace_0101) {
estyle::Generator interface;
//interface.properties.set("brace-else-in-new-line-before", "true");
interface.properties.set("brace-else-in-new-line-after", "true");
@ -207,14 +207,14 @@ TEST(testElse, brace_else_0101) {
//interface.properties.set("brace-else-out-space-before", "true");
interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else{\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else{\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_0110) {
TEST(testElse, brace_0110) {
estyle::Generator interface;
//interface.properties.set("brace-else-in-new-line-before", "true");
interface.properties.set("brace-else-in-new-line-after", "true");
@ -225,14 +225,14 @@ TEST(testElse, brace_else_0110) {
interface.properties.set("brace-else-out-space-before", "true");
//interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_0010) {
TEST(testElse, brace_0010) {
estyle::Generator interface;
//interface.properties.set("brace-else-in-new-line-before", "true");
//interface.properties.set("brace-else-in-new-line-after", "true");
@ -243,14 +243,14 @@ TEST(testElse, brace_else_0010) {
interface.properties.set("brace-else-out-space-before", "true");
//interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else {action_B; }action_D;";
etk::String outRef = "action_A;if(true){action_K:}else {action_B; }action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_0011) {
TEST(testElse, brace_0011) {
estyle::Generator interface;
//interface.properties.set("brace-else-in-new-line-before", "true");
//interface.properties.set("brace-else-in-new-line-after", "true");
@ -261,14 +261,14 @@ TEST(testElse, brace_else_0011) {
interface.properties.set("brace-else-out-space-before", "true");
interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else { action_B; } action_D;";
etk::String outRef = "action_A;if(true){action_K:}else { action_B; } action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_0111) {
TEST(testElse, brace_0111) {
estyle::Generator interface;
//interface.properties.set("brace-else-in-new-line-before", "true");
interface.properties.set("brace-else-in-new-line-after", "true");
@ -279,14 +279,14 @@ TEST(testElse, brace_else_0111) {
interface.properties.set("brace-else-out-space-before", "true");
interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_0001) {
TEST(testElse, brace_0001) {
estyle::Generator interface;
//interface.properties.set("brace-else-in-new-line-before", "true");
//interface.properties.set("brace-else-in-new-line-after", "true");
@ -297,15 +297,15 @@ TEST(testElse, brace_else_0001) {
//interface.properties.set("brace-else-out-space-before", "true");
interface.properties.set("brace-else-out-space-after", "true");
//interface.properties.set("brace-else-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else{ action_B;} action_D;";
etk::String outRef = "action_A;if(true){action_K:}else{ action_B;} action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_single_00) {
TEST(testElse, brace_single_00) {
estyle::Generator interface;
//interface.properties.set("brace-else-single-one-line-size-max", "40");
interface.properties.set("brace-else-single", "true");
@ -313,14 +313,14 @@ TEST(testElse, brace_else_single_00) {
//interface.properties.set("brace-else-single-in-space", "true");
//interface.properties.set("brace-else-single-out-new-line", "true");
//interface.properties.set("brace-else-single-out-space", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else action_B;\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else action_B;action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_single_10) {
TEST(testElse, brace_single_10) {
estyle::Generator interface;
//interface.properties.set("brace-else-single-one-line-size-max", "40");
interface.properties.set("brace-else-single", "true");
@ -328,14 +328,14 @@ TEST(testElse, brace_else_single_10) {
//interface.properties.set("brace-else-single-in-space", "true");
interface.properties.set("brace-else-single-out-new-line", "true");
//interface.properties.set("brace-else-single-out-space", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n\taction_B;\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n\taction_B;\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_single_01) {
TEST(testElse, brace_single_01) {
estyle::Generator interface;
//interface.properties.set("brace-else-single-one-line-size-max", "40");
interface.properties.set("brace-else-single", "true");
@ -343,13 +343,13 @@ TEST(testElse, brace_else_single_01) {
interface.properties.set("brace-else-single-in-space", "true");
//interface.properties.set("brace-else-single-out-new-line", "true");
interface.properties.set("brace-else-single-out-space", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else action_B; action_D;";
etk::String outRef = "action_A;if(true){action_K:}else action_B; action_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testElse, brace_else_single_11) {
TEST(testElse, brace_single_11) {
estyle::Generator interface;
//interface.properties.set("brace-else-single-one-line-size-max", "40");
interface.properties.set("brace-else-single", "true");
@ -357,11 +357,11 @@ TEST(testElse, brace_else_single_11) {
interface.properties.set("brace-else-single-in-space", "true");
interface.properties.set("brace-else-single-out-new-line", "true");
interface.properties.set("brace-else-single-out-space", "true");
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n\taction_B;\naction_D;";
etk::String outRef = "action_A;if(true){action_K:}else\n\taction_B;\naction_D;";
etk::String output = interface.process(sourceElse1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceElse1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}

View File

@ -15,7 +15,7 @@ static etk::String sourceFor1ActionNoBrace = "action_A;for(;;)action_B;action_D;
static etk::String sourceFor2Action = "action_A;for(;;){action_B;action_C;}action_D;";
TEST(testFor, brace_for_0000) {
TEST(testFor, brace_0000) {
estyle::Generator interface;
//interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
@ -26,14 +26,14 @@ TEST(testFor, brace_for_0000) {
//interface.properties.set("brace-for-out-space-before", "true");
//interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;){action_B;}action_D;";
etk::String outRef = "action_A;for(;;){action_B;}action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_1000) {
TEST(testFor, brace_1000) {
estyle::Generator interface;
interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
@ -44,14 +44,14 @@ TEST(testFor, brace_for_1000) {
//interface.properties.set("brace-for-out-space-before", "true");
//interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;)\n{action_B;\n}action_D;";
etk::String outRef = "action_A;for(;;)\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_1010) {
TEST(testFor, brace_1010) {
estyle::Generator interface;
interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
@ -62,14 +62,14 @@ TEST(testFor, brace_for_1010) {
interface.properties.set("brace-for-out-space-before", "true");
//interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;)\n{action_B;\n}action_D;";
etk::String outRef = "action_A;for(;;)\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_1011) {
TEST(testFor, brace_1011) {
estyle::Generator interface;
interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
@ -80,14 +80,14 @@ TEST(testFor, brace_for_1011) {
interface.properties.set("brace-for-out-space-before", "true");
interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;)\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;for(;;)\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_1100) {
TEST(testFor, brace_1100) {
estyle::Generator interface;
interface.properties.set("brace-for-in-new-line-before", "true");
interface.properties.set("brace-for-in-new-line-after", "true");
@ -98,14 +98,14 @@ TEST(testFor, brace_for_1100) {
//interface.properties.set("brace-for-out-space-before", "true");
//interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;)\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;for(;;)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_1101) {
TEST(testFor, brace_1101) {
estyle::Generator interface;
interface.properties.set("brace-for-in-new-line-before", "true");
interface.properties.set("brace-for-in-new-line-after", "true");
@ -116,14 +116,14 @@ TEST(testFor, brace_for_1101) {
//interface.properties.set("brace-for-out-space-before", "true");
interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;)\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;for(;;)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_1110) {
TEST(testFor, brace_1110) {
estyle::Generator interface;
interface.properties.set("brace-for-in-new-line-before", "true");
interface.properties.set("brace-for-in-new-line-after", "true");
@ -134,14 +134,14 @@ TEST(testFor, brace_for_1110) {
interface.properties.set("brace-for-out-space-before", "true");
//interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;)\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;for(;;)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_1111) {
TEST(testFor, brace_1111) {
estyle::Generator interface;
interface.properties.set("brace-for-in-new-line-before", "true");
interface.properties.set("brace-for-in-new-line-after", "true");
@ -152,14 +152,14 @@ TEST(testFor, brace_for_1111) {
interface.properties.set("brace-for-out-space-before", "true");
interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;)\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;for(;;)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_1001) {
TEST(testFor, brace_1001) {
estyle::Generator interface;
interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
@ -170,15 +170,15 @@ TEST(testFor, brace_for_1001) {
//interface.properties.set("brace-for-out-space-before", "true");
interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;)\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;for(;;)\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_0100) {
TEST(testFor, brace_0100) {
estyle::Generator interface;
//interface.properties.set("brace-for-in-new-line-before", "true");
interface.properties.set("brace-for-in-new-line-after", "true");
@ -189,14 +189,14 @@ TEST(testFor, brace_for_0100) {
//interface.properties.set("brace-for-out-space-before", "true");
//interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;){\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;for(;;){\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_0101) {
TEST(testFor, brace_0101) {
estyle::Generator interface;
//interface.properties.set("brace-for-in-new-line-before", "true");
interface.properties.set("brace-for-in-new-line-after", "true");
@ -207,14 +207,14 @@ TEST(testFor, brace_for_0101) {
//interface.properties.set("brace-for-out-space-before", "true");
interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;){\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;for(;;){\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_0110) {
TEST(testFor, brace_0110) {
estyle::Generator interface;
//interface.properties.set("brace-for-in-new-line-before", "true");
interface.properties.set("brace-for-in-new-line-after", "true");
@ -225,14 +225,14 @@ TEST(testFor, brace_for_0110) {
interface.properties.set("brace-for-out-space-before", "true");
//interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;) {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;for(;;) {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_0010) {
TEST(testFor, brace_0010) {
estyle::Generator interface;
//interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
@ -243,14 +243,14 @@ TEST(testFor, brace_for_0010) {
interface.properties.set("brace-for-out-space-before", "true");
//interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;) {action_B; }action_D;";
etk::String outRef = "action_A;for(;;) {action_B; }action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_0011) {
TEST(testFor, brace_0011) {
estyle::Generator interface;
//interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
@ -261,14 +261,14 @@ TEST(testFor, brace_for_0011) {
interface.properties.set("brace-for-out-space-before", "true");
interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;) { action_B; } action_D;";
etk::String outRef = "action_A;for(;;) { action_B; } action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_0111) {
TEST(testFor, brace_0111) {
estyle::Generator interface;
//interface.properties.set("brace-for-in-new-line-before", "true");
interface.properties.set("brace-for-in-new-line-after", "true");
@ -279,14 +279,14 @@ TEST(testFor, brace_for_0111) {
interface.properties.set("brace-for-out-space-before", "true");
interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;) {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;for(;;) {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_0001) {
TEST(testFor, brace_0001) {
estyle::Generator interface;
//interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
@ -297,17 +297,17 @@ TEST(testFor, brace_for_0001) {
//interface.properties.set("brace-for-out-space-before", "true");
interface.properties.set("brace-for-out-space-after", "true");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;){ action_B;} action_D;";
etk::String outRef = "action_A;for(;;){ action_B;} action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_single_00) {
TEST(testFor, brace_single_00) {
estyle::Generator interface;
//interface.properties.set("brace-for-single-one-line-size-max", "40");
interface.properties.set("brace-for-single", "true");
@ -315,14 +315,14 @@ TEST(testFor, brace_for_single_00) {
//interface.properties.set("brace-for-single-in-space", "true");
//interface.properties.set("brace-for-single-out-new-line", "true");
//interface.properties.set("brace-for-single-out-space", "true");
etk::String outputRef = "action_A;\nfor (;;)action_B;\naction_D;";
etk::String outRef = "action_A;for(;;)action_B;action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_single_10) {
TEST(testFor, brace_single_10) {
estyle::Generator interface;
//interface.properties.set("brace-for-single-one-line-size-max", "40");
interface.properties.set("brace-for-single", "true");
@ -330,14 +330,14 @@ TEST(testFor, brace_for_single_10) {
//interface.properties.set("brace-for-single-in-space", "true");
interface.properties.set("brace-for-single-out-new-line", "true");
//interface.properties.set("brace-for-single-out-space", "true");
etk::String outputRef = "action_A;\nfor (;;)\n\taction_B;\naction_D;";
etk::String outRef = "action_A;for(;;)\n\taction_B;\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_single_01) {
TEST(testFor, brace_single_01) {
estyle::Generator interface;
//interface.properties.set("brace-for-single-one-line-size-max", "40");
interface.properties.set("brace-for-single", "true");
@ -345,13 +345,13 @@ TEST(testFor, brace_for_single_01) {
interface.properties.set("brace-for-single-in-space", "true");
//interface.properties.set("brace-for-single-out-new-line", "true");
interface.properties.set("brace-for-single-out-space", "true");
etk::String outputRef = "action_A;\nfor (;;) action_B; action_D;";
etk::String outRef = "action_A;for(;;) action_B; action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_single_11) {
TEST(testFor, brace_single_11) {
estyle::Generator interface;
//interface.properties.set("brace-for-single-one-line-size-max", "40");
interface.properties.set("brace-for-single", "true");
@ -359,18 +359,18 @@ TEST(testFor, brace_for_single_11) {
interface.properties.set("brace-for-single-in-space", "true");
interface.properties.set("brace-for-single-out-new-line", "true");
interface.properties.set("brace-for-single-out-space", "true");
etk::String outputRef = "action_A;\nfor (;;)\n\taction_B;\naction_D;";
etk::String outRef = "action_A;for(;;)\n\taction_B;\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_oneLine_0) {
TEST(testFor, brace_oneLine_0) {
estyle::Generator interface;
interface.properties.set("brace-for-in-new-line-before", "true");
interface.properties.set("brace-for-in-new-line-after", "true");
@ -382,15 +382,15 @@ TEST(testFor, brace_for_oneLine_0) {
//interface.properties.set("brace-for-out-space-after", "true");
interface.properties.set("brace-for-single-one-line-size-max", "40");
//interface.properties.set("brace-for-single", "true");
etk::String outputRef = "action_A;\nfor (;;) { action_B; }\naction_D;";
etk::String outRef = "action_A;for(;;) { action_B; }\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testFor, brace_for_oneLine_1) {
TEST(testFor, brace_oneLine_1) {
estyle::Generator interface;
interface.properties.set("brace-for-single-one-line-size-max", "40");
interface.properties.set("brace-for-single", "true");
@ -398,11 +398,11 @@ TEST(testFor, brace_for_oneLine_1) {
interface.properties.set("brace-for-single-in-space", "true");
interface.properties.set("brace-for-single-out-new-line", "true");
interface.properties.set("brace-for-single-out-space", "true");
etk::String outputRef = "action_A;\nfor (;;) action_B;\naction_D;";
etk::String outRef = "action_A;for(;;) action_B;\naction_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceFor1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -416,11 +416,11 @@ TEST(testFor, condition_0) {
//interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
//interface.properties.set("brace-for-in-space-before", "true");
etk::String outputRef = "action_A;\nfor (;;){action_B;}action_D;";
etk::String outRef = "action_A;for(;;){action_B;}action_D;";
etk::String output = interface.process(sourceFor1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
//output = interface.process(sourceFor1ActionNoBrace);
//EXPECT_EQ(output, outputRef);
//EXPECT_EQ(output, outRef);
}
@ -431,13 +431,13 @@ TEST(testFor, condition_1) {
//interface.properties.set("brace-for-in-new-line-before", "true");
//interface.properties.set("brace-for-in-new-line-after", "true");
//interface.properties.set("brace-for-in-space-before", "true");
etk::String outputRef = "action_A;\nfor (instanciation =4; condition<6; ++inclemantation){action_B;}action_D;";
etk::String outRef = "action_A;for(instanciation =4; condition<6; ++inclemantation){action_B;}action_D;";
etk::String base = "action_A;for(instanciation=4; condition<6; ++inclemantation){action_B;}action_D;";
etk::String output = interface.process(base);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
interface.properties.set("condition-for-multi-line-big-size", "20");
output = interface.process(base);
outputRef = "action_A;\nfor (instanciation =4;\n condition<6;\n ++inclemantation){action_B;}action_D;";
EXPECT_EQ(output, outputRef);
outRef = "action_A;for(instanciation =4;\n condition<6;\n ++inclemantation){action_B;}action_D;";
EXPECT_EQ(output, outRef);
}

View File

@ -14,7 +14,7 @@ static etk::String sourceIf1Action = "action_A;print_console(){action_B;}action_
static etk::String sourceIf2Action = "action_A;print_console(){action_B;action_C;}action_D;";
TEST(testBraceFunction, brace_function_0000) {
TEST(testFunction, brace_0000) {
estyle::Generator interface;
//interface.properties.set("brace-function-in-new-line-before", "true");
//interface.properties.set("brace-function-in-new-line-after", "true");
@ -24,12 +24,12 @@ TEST(testBraceFunction, brace_function_0000) {
//interface.properties.set("brace-function-out-new-line-after", "true");
//interface.properties.set("brace-function-out-space-before", "true");
//interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( ){action_B;}action_D;";
etk::String outRef = "action_A;print_console(){action_B;}action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_1000) {
TEST(testFunction, brace_1000) {
estyle::Generator interface;
interface.properties.set("brace-function-in-new-line-before", "true");
//interface.properties.set("brace-function-in-new-line-after", "true");
@ -39,12 +39,12 @@ TEST(testBraceFunction, brace_function_1000) {
//interface.properties.set("brace-function-out-new-line-after", "true");
//interface.properties.set("brace-function-out-space-before", "true");
//interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( )\n{action_B;\n}action_D;";
etk::String outRef = "action_A;print_console()\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_1010) {
TEST(testFunction, brace_1010) {
estyle::Generator interface;
interface.properties.set("brace-function-in-new-line-before", "true");
//interface.properties.set("brace-function-in-new-line-after", "true");
@ -54,12 +54,12 @@ TEST(testBraceFunction, brace_function_1010) {
//interface.properties.set("brace-function-out-new-line-after", "true");
interface.properties.set("brace-function-out-space-before", "true");
//interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( )\n{action_B;\n}action_D;";
etk::String outRef = "action_A;print_console()\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_1011) {
TEST(testFunction, brace_1011) {
estyle::Generator interface;
interface.properties.set("brace-function-in-new-line-before", "true");
//interface.properties.set("brace-function-in-new-line-after", "true");
@ -69,12 +69,12 @@ TEST(testBraceFunction, brace_function_1011) {
//interface.properties.set("brace-function-out-new-line-after", "true");
interface.properties.set("brace-function-out-space-before", "true");
interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( )\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;print_console()\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_1100) {
TEST(testFunction, brace_1100) {
estyle::Generator interface;
interface.properties.set("brace-function-in-new-line-before", "true");
interface.properties.set("brace-function-in-new-line-after", "true");
@ -84,12 +84,12 @@ TEST(testBraceFunction, brace_function_1100) {
interface.properties.set("brace-function-out-new-line-after", "true");
//interface.properties.set("brace-function-out-space-before", "true");
//interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;print_console()\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_1101) {
TEST(testFunction, brace_1101) {
estyle::Generator interface;
interface.properties.set("brace-function-in-new-line-before", "true");
interface.properties.set("brace-function-in-new-line-after", "true");
@ -99,12 +99,12 @@ TEST(testBraceFunction, brace_function_1101) {
interface.properties.set("brace-function-out-new-line-after", "true");
//interface.properties.set("brace-function-out-space-before", "true");
interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;print_console()\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_1110) {
TEST(testFunction, brace_1110) {
estyle::Generator interface;
interface.properties.set("brace-function-in-new-line-before", "true");
interface.properties.set("brace-function-in-new-line-after", "true");
@ -114,12 +114,12 @@ TEST(testBraceFunction, brace_function_1110) {
interface.properties.set("brace-function-out-new-line-after", "true");
interface.properties.set("brace-function-out-space-before", "true");
//interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;print_console()\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_1111) {
TEST(testFunction, brace_1111) {
estyle::Generator interface;
interface.properties.set("brace-function-in-new-line-before", "true");
interface.properties.set("brace-function-in-new-line-after", "true");
@ -129,12 +129,12 @@ TEST(testBraceFunction, brace_function_1111) {
interface.properties.set("brace-function-out-new-line-after", "true");
interface.properties.set("brace-function-out-space-before", "true");
interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;print_console()\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_1001) {
TEST(testFunction, brace_1001) {
estyle::Generator interface;
interface.properties.set("brace-function-in-new-line-before", "true");
//interface.properties.set("brace-function-in-new-line-after", "true");
@ -144,13 +144,13 @@ TEST(testBraceFunction, brace_function_1001) {
//interface.properties.set("brace-function-out-new-line-after", "true");
//interface.properties.set("brace-function-out-space-before", "true");
interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( )\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;print_console()\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_0100) {
TEST(testFunction, brace_0100) {
estyle::Generator interface;
//interface.properties.set("brace-function-in-new-line-before", "true");
interface.properties.set("brace-function-in-new-line-after", "true");
@ -160,12 +160,12 @@ TEST(testBraceFunction, brace_function_0100) {
interface.properties.set("brace-function-out-new-line-after", "true");
//interface.properties.set("brace-function-out-space-before", "true");
//interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( ){\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;print_console(){\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_0101) {
TEST(testFunction, brace_0101) {
estyle::Generator interface;
//interface.properties.set("brace-function-in-new-line-before", "true");
interface.properties.set("brace-function-in-new-line-after", "true");
@ -175,12 +175,12 @@ TEST(testBraceFunction, brace_function_0101) {
interface.properties.set("brace-function-out-new-line-after", "true");
//interface.properties.set("brace-function-out-space-before", "true");
interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( ){\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;print_console(){\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_0110) {
TEST(testFunction, brace_0110) {
estyle::Generator interface;
//interface.properties.set("brace-function-in-new-line-before", "true");
interface.properties.set("brace-function-in-new-line-after", "true");
@ -190,12 +190,12 @@ TEST(testBraceFunction, brace_function_0110) {
interface.properties.set("brace-function-out-new-line-after", "true");
interface.properties.set("brace-function-out-space-before", "true");
//interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( ) {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;print_console() {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_0010) {
TEST(testFunction, brace_0010) {
estyle::Generator interface;
//interface.properties.set("brace-function-in-new-line-before", "true");
//interface.properties.set("brace-function-in-new-line-after", "true");
@ -205,12 +205,12 @@ TEST(testBraceFunction, brace_function_0010) {
//interface.properties.set("brace-function-out-new-line-after", "true");
interface.properties.set("brace-function-out-space-before", "true");
//interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( ) {action_B; }action_D;";
etk::String outRef = "action_A;print_console() {action_B; }action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_0011) {
TEST(testFunction, brace_0011) {
estyle::Generator interface;
//interface.properties.set("brace-function-in-new-line-before", "true");
//interface.properties.set("brace-function-in-new-line-after", "true");
@ -220,12 +220,12 @@ TEST(testBraceFunction, brace_function_0011) {
//interface.properties.set("brace-function-out-new-line-after", "true");
interface.properties.set("brace-function-out-space-before", "true");
interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( ) { action_B; } action_D;";
etk::String outRef = "action_A;print_console() { action_B; } action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_0111) {
TEST(testFunction, brace_0111) {
estyle::Generator interface;
//interface.properties.set("brace-function-in-new-line-before", "true");
interface.properties.set("brace-function-in-new-line-after", "true");
@ -235,12 +235,12 @@ TEST(testBraceFunction, brace_function_0111) {
interface.properties.set("brace-function-out-new-line-after", "true");
interface.properties.set("brace-function-out-space-before", "true");
interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( ) {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;print_console() {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testBraceFunction, brace_function_0001) {
TEST(testFunction, brace_0001) {
estyle::Generator interface;
//interface.properties.set("brace-function-in-new-line-before", "true");
//interface.properties.set("brace-function-in-new-line-after", "true");
@ -250,9 +250,9 @@ TEST(testBraceFunction, brace_function_0001) {
//interface.properties.set("brace-function-out-new-line-after", "true");
//interface.properties.set("brace-function-out-space-before", "true");
interface.properties.set("brace-function-out-space-after", "true");
etk::String outputRef = "action_A;\nprint_console ( ){ action_B;} action_D;";
etk::String outRef = "action_A;print_console(){ action_B;} action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}

View File

@ -15,7 +15,7 @@ static etk::String sourceIf1ActionNoBrace = "action_A;if(true)action_B;action_D;
static etk::String sourceIf2Action = "action_A;if(true){action_B;action_C;}action_D;";
TEST(testIf, brace_if_0000) {
TEST(testIf, brace_0000) {
estyle::Generator interface;
//interface.properties.set("brace-if-in-new-line-before", "true");
//interface.properties.set("brace-if-in-new-line-after", "true");
@ -26,14 +26,14 @@ TEST(testIf, brace_if_0000) {
//interface.properties.set("brace-if-out-space-before", "true");
//interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true ){action_B;}action_D;";
etk::String outRef = "action_A;if(true){action_B;}action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_1000) {
TEST(testIf, brace_1000) {
estyle::Generator interface;
interface.properties.set("brace-if-in-new-line-before", "true");
//interface.properties.set("brace-if-in-new-line-after", "true");
@ -44,14 +44,14 @@ TEST(testIf, brace_if_1000) {
//interface.properties.set("brace-if-out-space-before", "true");
//interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true )\n{action_B;\n}action_D;";
etk::String outRef = "action_A;if(true)\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_1010) {
TEST(testIf, brace_1010) {
estyle::Generator interface;
interface.properties.set("brace-if-in-new-line-before", "true");
//interface.properties.set("brace-if-in-new-line-after", "true");
@ -62,14 +62,14 @@ TEST(testIf, brace_if_1010) {
interface.properties.set("brace-if-out-space-before", "true");
//interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true )\n{action_B;\n}action_D;";
etk::String outRef = "action_A;if(true)\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_1011) {
TEST(testIf, brace_1011) {
estyle::Generator interface;
interface.properties.set("brace-if-in-new-line-before", "true");
//interface.properties.set("brace-if-in-new-line-after", "true");
@ -80,14 +80,14 @@ TEST(testIf, brace_if_1011) {
interface.properties.set("brace-if-out-space-before", "true");
interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true )\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;if(true)\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_1100) {
TEST(testIf, brace_1100) {
estyle::Generator interface;
interface.properties.set("brace-if-in-new-line-before", "true");
interface.properties.set("brace-if-in-new-line-after", "true");
@ -98,14 +98,14 @@ TEST(testIf, brace_if_1100) {
//interface.properties.set("brace-if-out-space-before", "true");
//interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;if(true)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_1101) {
TEST(testIf, brace_1101) {
estyle::Generator interface;
interface.properties.set("brace-if-in-new-line-before", "true");
interface.properties.set("brace-if-in-new-line-after", "true");
@ -116,14 +116,14 @@ TEST(testIf, brace_if_1101) {
//interface.properties.set("brace-if-out-space-before", "true");
interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;if(true)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_1110) {
TEST(testIf, brace_1110) {
estyle::Generator interface;
interface.properties.set("brace-if-in-new-line-before", "true");
interface.properties.set("brace-if-in-new-line-after", "true");
@ -134,14 +134,14 @@ TEST(testIf, brace_if_1110) {
interface.properties.set("brace-if-out-space-before", "true");
//interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;if(true)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_1111) {
TEST(testIf, brace_1111) {
estyle::Generator interface;
interface.properties.set("brace-if-in-new-line-before", "true");
interface.properties.set("brace-if-in-new-line-after", "true");
@ -152,14 +152,14 @@ TEST(testIf, brace_if_1111) {
interface.properties.set("brace-if-out-space-before", "true");
interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;if(true)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_1001) {
TEST(testIf, brace_1001) {
estyle::Generator interface;
interface.properties.set("brace-if-in-new-line-before", "true");
//interface.properties.set("brace-if-in-new-line-after", "true");
@ -170,15 +170,15 @@ TEST(testIf, brace_if_1001) {
//interface.properties.set("brace-if-out-space-before", "true");
interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true )\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;if(true)\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_0100) {
TEST(testIf, brace_0100) {
estyle::Generator interface;
//interface.properties.set("brace-if-in-new-line-before", "true");
interface.properties.set("brace-if-in-new-line-after", "true");
@ -189,14 +189,14 @@ TEST(testIf, brace_if_0100) {
//interface.properties.set("brace-if-out-space-before", "true");
//interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true ){\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;if(true){\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_0101) {
TEST(testIf, brace_0101) {
estyle::Generator interface;
//interface.properties.set("brace-if-in-new-line-before", "true");
interface.properties.set("brace-if-in-new-line-after", "true");
@ -207,14 +207,14 @@ TEST(testIf, brace_if_0101) {
//interface.properties.set("brace-if-out-space-before", "true");
interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true ){\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;if(true){\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_0110) {
TEST(testIf, brace_0110) {
estyle::Generator interface;
//interface.properties.set("brace-if-in-new-line-before", "true");
interface.properties.set("brace-if-in-new-line-after", "true");
@ -225,14 +225,14 @@ TEST(testIf, brace_if_0110) {
interface.properties.set("brace-if-out-space-before", "true");
//interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true ) {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;if(true) {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_0010) {
TEST(testIf, brace_0010) {
estyle::Generator interface;
//interface.properties.set("brace-if-in-new-line-before", "true");
//interface.properties.set("brace-if-in-new-line-after", "true");
@ -243,14 +243,14 @@ TEST(testIf, brace_if_0010) {
interface.properties.set("brace-if-out-space-before", "true");
//interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true ) {action_B; }action_D;";
etk::String outRef = "action_A;if(true) {action_B; }action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_0011) {
TEST(testIf, brace_0011) {
estyle::Generator interface;
//interface.properties.set("brace-if-in-new-line-before", "true");
//interface.properties.set("brace-if-in-new-line-after", "true");
@ -261,14 +261,14 @@ TEST(testIf, brace_if_0011) {
interface.properties.set("brace-if-out-space-before", "true");
interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true ) { action_B; } action_D;";
etk::String outRef = "action_A;if(true) { action_B; } action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_0111) {
TEST(testIf, brace_0111) {
estyle::Generator interface;
//interface.properties.set("brace-if-in-new-line-before", "true");
interface.properties.set("brace-if-in-new-line-after", "true");
@ -279,14 +279,14 @@ TEST(testIf, brace_if_0111) {
interface.properties.set("brace-if-out-space-before", "true");
interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true ) {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;if(true) {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_0001) {
TEST(testIf, brace_0001) {
estyle::Generator interface;
//interface.properties.set("brace-if-in-new-line-before", "true");
//interface.properties.set("brace-if-in-new-line-after", "true");
@ -297,15 +297,15 @@ TEST(testIf, brace_if_0001) {
//interface.properties.set("brace-if-out-space-before", "true");
interface.properties.set("brace-if-out-space-after", "true");
//interface.properties.set("brace-if-single", "true");
etk::String outputRef = "action_A;\nif (true ){ action_B;} action_D;";
etk::String outRef = "action_A;if(true){ action_B;} action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_single_00) {
TEST(testIf, brace_single_00) {
estyle::Generator interface;
//interface.properties.set("brace-if-single-one-line-size-max", "40");
interface.properties.set("brace-if-single", "true");
@ -313,14 +313,14 @@ TEST(testIf, brace_if_single_00) {
//interface.properties.set("brace-if-single-in-space", "true");
//interface.properties.set("brace-if-single-out-new-line", "true");
//interface.properties.set("brace-if-single-out-space", "true");
etk::String outputRef = "action_A;\nif (true )action_B;\naction_D;";
etk::String outRef = "action_A;if(true)action_B;action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_single_10) {
TEST(testIf, brace_single_10) {
estyle::Generator interface;
//interface.properties.set("brace-if-single-one-line-size-max", "40");
interface.properties.set("brace-if-single", "true");
@ -328,14 +328,14 @@ TEST(testIf, brace_if_single_10) {
//interface.properties.set("brace-if-single-in-space", "true");
interface.properties.set("brace-if-single-out-new-line", "true");
//interface.properties.set("brace-if-single-out-space", "true");
etk::String outputRef = "action_A;\nif (true )\n\taction_B;\naction_D;";
etk::String outRef = "action_A;if(true)\n\taction_B;\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_single_01) {
TEST(testIf, brace_single_01) {
estyle::Generator interface;
//interface.properties.set("brace-if-single-one-line-size-max", "40");
interface.properties.set("brace-if-single", "true");
@ -343,13 +343,13 @@ TEST(testIf, brace_if_single_01) {
interface.properties.set("brace-if-single-in-space", "true");
//interface.properties.set("brace-if-single-out-new-line", "true");
interface.properties.set("brace-if-single-out-space", "true");
etk::String outputRef = "action_A;\nif (true ) action_B; action_D;";
etk::String outRef = "action_A;if(true) action_B; action_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testIf, brace_if_single_11) {
TEST(testIf, brace_single_11) {
estyle::Generator interface;
//interface.properties.set("brace-if-single-one-line-size-max", "40");
interface.properties.set("brace-if-single", "true");
@ -357,11 +357,11 @@ TEST(testIf, brace_if_single_11) {
interface.properties.set("brace-if-single-in-space", "true");
interface.properties.set("brace-if-single-out-new-line", "true");
interface.properties.set("brace-if-single-out-space", "true");
etk::String outputRef = "action_A;\nif (true )\n\taction_B;\naction_D;";
etk::String outRef = "action_A;if(true)\n\taction_B;\naction_D;";
etk::String output = interface.process(sourceIf1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceIf1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}

View File

@ -23,9 +23,9 @@ TEST(testNamespace, brace_0000) {
//interface.properties.set("brace-namespace-out-new-line-after", "true");
//interface.properties.set("brace-namespace-out-space-before", "true");
//interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace{action_B;}action_D;";
etk::String outRef = "action_A;namespace myNamespace{action_B;}action_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_1000) {
@ -38,9 +38,9 @@ TEST(testNamespace, brace_1000) {
//interface.properties.set("brace-namespace-out-new-line-after", "true");
//interface.properties.set("brace-namespace-out-space-before", "true");
//interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace\n{action_B;\n}action_D;";
etk::String outRef = "action_A;namespace myNamespace\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_1010) {
@ -53,9 +53,9 @@ TEST(testNamespace, brace_1010) {
//interface.properties.set("brace-namespace-out-new-line-after", "true");
interface.properties.set("brace-namespace-out-space-before", "true");
//interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace\n{action_B;\n}action_D;";
etk::String outRef = "action_A;namespace myNamespace\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_1011) {
@ -68,9 +68,9 @@ TEST(testNamespace, brace_1011) {
//interface.properties.set("brace-namespace-out-new-line-after", "true");
interface.properties.set("brace-namespace-out-space-before", "true");
interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;namespace myNamespace\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_1100) {
@ -83,9 +83,9 @@ TEST(testNamespace, brace_1100) {
interface.properties.set("brace-namespace-out-new-line-after", "true");
//interface.properties.set("brace-namespace-out-space-before", "true");
//interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;namespace myNamespace\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_1101) {
@ -98,9 +98,9 @@ TEST(testNamespace, brace_1101) {
interface.properties.set("brace-namespace-out-new-line-after", "true");
//interface.properties.set("brace-namespace-out-space-before", "true");
interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;namespace myNamespace\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_1110) {
@ -113,9 +113,9 @@ TEST(testNamespace, brace_1110) {
interface.properties.set("brace-namespace-out-new-line-after", "true");
interface.properties.set("brace-namespace-out-space-before", "true");
//interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;namespace myNamespace\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_1111) {
@ -128,9 +128,9 @@ TEST(testNamespace, brace_1111) {
interface.properties.set("brace-namespace-out-new-line-after", "true");
interface.properties.set("brace-namespace-out-space-before", "true");
interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;namespace myNamespace\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_1001) {
@ -143,9 +143,9 @@ TEST(testNamespace, brace_1001) {
//interface.properties.set("brace-namespace-out-new-line-after", "true");
//interface.properties.set("brace-namespace-out-space-before", "true");
interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;namespace myNamespace\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -159,9 +159,9 @@ TEST(testNamespace, brace_0100) {
interface.properties.set("brace-namespace-out-new-line-after", "true");
//interface.properties.set("brace-namespace-out-space-before", "true");
//interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace{\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;namespace myNamespace{\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_0101) {
@ -174,9 +174,9 @@ TEST(testNamespace, brace_0101) {
interface.properties.set("brace-namespace-out-new-line-after", "true");
//interface.properties.set("brace-namespace-out-space-before", "true");
interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace{\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;namespace myNamespace{\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_0110) {
@ -189,9 +189,9 @@ TEST(testNamespace, brace_0110) {
interface.properties.set("brace-namespace-out-new-line-after", "true");
interface.properties.set("brace-namespace-out-space-before", "true");
//interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;namespace myNamespace {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_0010) {
@ -204,9 +204,9 @@ TEST(testNamespace, brace_0010) {
//interface.properties.set("brace-namespace-out-new-line-after", "true");
interface.properties.set("brace-namespace-out-space-before", "true");
//interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace {action_B; }action_D;";
etk::String outRef = "action_A;namespace myNamespace {action_B; }action_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_0011) {
@ -219,9 +219,9 @@ TEST(testNamespace, brace_0011) {
//interface.properties.set("brace-namespace-out-new-line-after", "true");
interface.properties.set("brace-namespace-out-space-before", "true");
interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace { action_B; } action_D;";
etk::String outRef = "action_A;namespace myNamespace { action_B; } action_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_0111) {
@ -234,9 +234,9 @@ TEST(testNamespace, brace_0111) {
interface.properties.set("brace-namespace-out-new-line-after", "true");
interface.properties.set("brace-namespace-out-space-before", "true");
interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;namespace myNamespace {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testNamespace, brace_0001) {
@ -249,9 +249,9 @@ TEST(testNamespace, brace_0001) {
//interface.properties.set("brace-namespace-out-new-line-after", "true");
//interface.properties.set("brace-namespace-out-space-before", "true");
interface.properties.set("brace-namespace-out-space-after", "true");
etk::String outputRef = "action_A;\nnamespace myNamespace{ action_B;} action_D;";
etk::String outRef = "action_A;namespace myNamespace{ action_B;} action_D;";
etk::String output = interface.process(sourceNamespace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}

View File

@ -26,11 +26,11 @@ TEST(testWhile, brace_while_0000) {
//interface.properties.set("brace-while-out-space-before", "true");
//interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true ){action_B;}action_D;";
etk::String outRef = "action_A;while(true){action_B;}action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_1000) {
@ -44,11 +44,11 @@ TEST(testWhile, brace_while_1000) {
//interface.properties.set("brace-while-out-space-before", "true");
//interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true )\n{action_B;\n}action_D;";
etk::String outRef = "action_A;while(true)\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_1010) {
@ -62,11 +62,11 @@ TEST(testWhile, brace_while_1010) {
interface.properties.set("brace-while-out-space-before", "true");
//interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true )\n{action_B;\n}action_D;";
etk::String outRef = "action_A;while(true)\n{action_B;\n}action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_1011) {
@ -80,11 +80,11 @@ TEST(testWhile, brace_while_1011) {
interface.properties.set("brace-while-out-space-before", "true");
interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true )\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;while(true)\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_1100) {
@ -98,11 +98,11 @@ TEST(testWhile, brace_while_1100) {
//interface.properties.set("brace-while-out-space-before", "true");
//interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;while(true)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_1101) {
@ -116,11 +116,11 @@ TEST(testWhile, brace_while_1101) {
//interface.properties.set("brace-while-out-space-before", "true");
interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;while(true)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_1110) {
@ -134,11 +134,11 @@ TEST(testWhile, brace_while_1110) {
interface.properties.set("brace-while-out-space-before", "true");
//interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;while(true)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_1111) {
@ -152,11 +152,11 @@ TEST(testWhile, brace_while_1111) {
interface.properties.set("brace-while-out-space-before", "true");
interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true )\n{\n\taction_B;\n}\naction_D;";
etk::String outRef = "action_A;while(true)\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_1001) {
@ -170,11 +170,11 @@ TEST(testWhile, brace_while_1001) {
//interface.properties.set("brace-while-out-space-before", "true");
interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true )\n{ action_B;\n} action_D;";
etk::String outRef = "action_A;while(true)\n{ action_B;\n} action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -189,11 +189,11 @@ TEST(testWhile, brace_while_0100) {
//interface.properties.set("brace-while-out-space-before", "true");
//interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true ){\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;while(true){\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_0101) {
@ -207,11 +207,11 @@ TEST(testWhile, brace_while_0101) {
//interface.properties.set("brace-while-out-space-before", "true");
interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true ){\n\taction_B;}\naction_D;";
etk::String outRef = "action_A;while(true){\n\taction_B;}\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_0110) {
@ -225,11 +225,11 @@ TEST(testWhile, brace_while_0110) {
interface.properties.set("brace-while-out-space-before", "true");
//interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true ) {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;while(true) {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_0010) {
@ -243,11 +243,11 @@ TEST(testWhile, brace_while_0010) {
interface.properties.set("brace-while-out-space-before", "true");
//interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true ) {action_B; }action_D;";
etk::String outRef = "action_A;while(true) {action_B; }action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_0011) {
@ -261,11 +261,11 @@ TEST(testWhile, brace_while_0011) {
interface.properties.set("brace-while-out-space-before", "true");
interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true ) { action_B; } action_D;";
etk::String outRef = "action_A;while(true) { action_B; } action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_0111) {
@ -279,11 +279,11 @@ TEST(testWhile, brace_while_0111) {
interface.properties.set("brace-while-out-space-before", "true");
interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true ) {\n\taction_B; }\naction_D;";
etk::String outRef = "action_A;while(true) {\n\taction_B; }\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_0001) {
@ -297,11 +297,11 @@ TEST(testWhile, brace_while_0001) {
//interface.properties.set("brace-while-out-space-before", "true");
interface.properties.set("brace-while-out-space-after", "true");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true ){ action_B;} action_D;";
etk::String outRef = "action_A;while(true){ action_B;} action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -315,11 +315,11 @@ TEST(testWhile, brace_while_single_00) {
//interface.properties.set("brace-while-single-in-space", "true");
//interface.properties.set("brace-while-single-out-new-line", "true");
//interface.properties.set("brace-while-single-out-space", "true");
etk::String outputRef = "action_A;\nwhile (true )action_B;\naction_D;";
etk::String outRef = "action_A;while(true)action_B;action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_single_10) {
@ -330,11 +330,11 @@ TEST(testWhile, brace_while_single_10) {
//interface.properties.set("brace-while-single-in-space", "true");
interface.properties.set("brace-while-single-out-new-line", "true");
//interface.properties.set("brace-while-single-out-space", "true");
etk::String outputRef = "action_A;\nwhile (true )\n\taction_B;\naction_D;";
etk::String outRef = "action_A;while(true)\n\taction_B;\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_single_01) {
@ -345,11 +345,11 @@ TEST(testWhile, brace_while_single_01) {
interface.properties.set("brace-while-single-in-space", "true");
//interface.properties.set("brace-while-single-out-new-line", "true");
interface.properties.set("brace-while-single-out-space", "true");
etk::String outputRef = "action_A;\nwhile (true ) action_B; action_D;";
etk::String outRef = "action_A;while(true) action_B; action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
TEST(testWhile, brace_while_single_11) {
estyle::Generator interface;
@ -359,11 +359,11 @@ TEST(testWhile, brace_while_single_11) {
interface.properties.set("brace-while-single-in-space", "true");
interface.properties.set("brace-while-single-out-new-line", "true");
interface.properties.set("brace-while-single-out-space", "true");
etk::String outputRef = "action_A;\nwhile (true )\n\taction_B;\naction_D;";
etk::String outRef = "action_A;while(true)\n\taction_B;\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -382,11 +382,11 @@ TEST(testWhile, brace_while_oneLine_0) {
//interface.properties.set("brace-while-out-space-after", "true");
interface.properties.set("brace-while-single-one-line-size-max", "40");
//interface.properties.set("brace-while-single", "true");
etk::String outputRef = "action_A;\nwhile (true ) { action_B; }\naction_D;";
etk::String outRef = "action_A;while(true) { action_B; }\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -398,11 +398,11 @@ TEST(testWhile, brace_while_oneLine_1) {
interface.properties.set("brace-while-single-in-space", "true");
interface.properties.set("brace-while-single-out-new-line", "true");
interface.properties.set("brace-while-single-out-space", "true");
etk::String outputRef = "action_A;\nwhile (true ) action_B;\naction_D;";
etk::String outRef = "action_A;while(true) action_B;\naction_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
output = interface.process(sourceWhile1ActionNoBrace);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
}
@ -415,11 +415,11 @@ TEST(testWhile, condition_0) {
//interface.properties.set("brace-while-in-new-line-before", "true");
//interface.properties.set("brace-while-in-new-line-after", "true");
//interface.properties.set("brace-while-in-space-before", "true");
etk::String outputRef = "action_A;\nwhile (true ){action_B;}action_D;";
etk::String outRef = "action_A;while(true){action_B;}action_D;";
etk::String output = interface.process(sourceWhile1Action);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
//output = interface.process(sourceWhile1ActionNoBrace);
//EXPECT_EQ(output, outputRef);
//EXPECT_EQ(output, outRef);
}
@ -430,13 +430,13 @@ TEST(testWhile, condition_1) {
//interface.properties.set("brace-while-in-new-line-before", "true");
//interface.properties.set("brace-while-in-new-line-after", "true");
//interface.properties.set("brace-while-in-space-before", "true");
etk::String outputRef = "action_A;\nwhile (condition<6 && my_stupid_variable == 77){action_B;}action_D;";
etk::String outRef = "action_A;while (condition<6 && my_stupid_variable == 77){action_B;}action_D;";
etk::String base = "action_A;while(condition<6 && my_stupid_variable == 77){action_B;}action_D;";
etk::String output = interface.process(base);
EXPECT_EQ(output, outputRef);
EXPECT_EQ(output, outRef);
interface.properties.set("condition-while-multi-line-big-size", "20");
output = interface.process(base);
outputRef = "action_A;\nwhile ( condition<6\n && my_stupid_variable==77 ){action_B;}action_D;";
EXPECT_EQ(output, outputRef);
outRef = "action_A;while ( condition<6\n && my_stupid_variable==77 ){action_B;}action_D;";
EXPECT_EQ(output, outRef);
}