4026 lines
180 KiB
C++
4026 lines
180 KiB
C++
/**
|
|
* @author Edouard DUPIN
|
|
* @copyright 2017, Edouard DUPIN, all right reserved
|
|
* @license MPL-2 (see license file)
|
|
*/
|
|
#include <estyle/estyle.hpp>
|
|
#include <estyle/Generator.hpp>
|
|
#include <etk/etk.hpp>
|
|
#include <test-debug/debug.hpp>
|
|
#include <etest/etest.hpp>
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------------
|
|
// -- Brace section: {}
|
|
// -----------------------------------------------------------------------------------------------------------------------
|
|
|
|
static etk::String sourceBrace0Action = "action_A;if(true){}action_D;";
|
|
static etk::String sourceBrace1Action = "action_A;if(true){action_B;}action_D;";
|
|
static etk::String sourceBrace1ActionNoBrace = "action_A;if(true)action_B;action_D;";
|
|
static etk::String sourceBrace2Action = "action_A;if(true){action_B;action_C;}action_D;";
|
|
|
|
|
|
TEST(testIf, brace_100000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{action_B;\n}action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_101000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{action_B;\n}action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_101100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{ action_B;\n} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_110000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{\naction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_110100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{\naction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_111000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{\naction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_111100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{\naction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_100100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{ action_B;\n} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testIf, brace_010000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){\naction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_010100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){\naction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_011000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {\naction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_001000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {action_B; }action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_001100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) { action_B; } action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_011100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {\naction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_000100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){ action_B;} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
TEST(testIf, brace_100001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{action_B;\n}action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_101001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{action_B;\n}action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_101101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{ action_B;\n} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_110001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{\n\taction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_110101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{\n\taction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_111001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{\n\taction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_111101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{\n\taction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_100101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n{ action_B;\n} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testIf, brace_010001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){\n\taction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_010101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){\n\taction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_011001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {\n\taction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_001001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {action_B; }action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_001101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) { action_B; } action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_011101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {\n\taction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_000101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
//interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){ action_B;} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
TEST(testIf, brace_100010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{action_B;\n\t}action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_101010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{action_B;\n\t}action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_101110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{ action_B;\n\t} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_110010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\taction_B;\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_110110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\taction_B;\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_111010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\taction_B;\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_111110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\taction_B;\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_100110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{ action_B;\n\t} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testIf, brace_010010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){\n\taction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_010110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){\n\taction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_011010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {\n\taction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_001010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {action_B; }action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_001110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) { action_B; } action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_011110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {\n\taction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_000110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
//interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
//interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){ action_B;} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
TEST(testIf, brace_100011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{action_B;\n\t}action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_101011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{action_B;\n\t}action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_101111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{ action_B;\n\t} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_110011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\t\taction_B;\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_110111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\t\taction_B;\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_111011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\t\taction_B;\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_111111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\t\taction_B;\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_100111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{ action_B;\n\t} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testIf, brace_010011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){\n\t\taction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_010111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){\n\t\taction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_011011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {\n\t\taction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_001011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
//interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
//interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {action_B; }action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_001111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) { action_B; } action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_011111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true) {\n\t\taction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_000111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("brace-if-in-new-line-before", "true");
|
|
//interface.properties.set("brace-if-in-new-line-after", "true");
|
|
//interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("brace-if-out-new-line-before", "true");
|
|
//interface.properties.set("brace-if-out-new-line-after", "true");
|
|
//interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("brace-if-single", "true");
|
|
etk::String outRef = "action_A;if(true){ action_B;} action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEST(testIf, brace_single_000) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-if-one-line-size-max", "40");
|
|
interface.properties.set("brace-if-single", "true");
|
|
//interface.properties.set("brace-if-single-in-new-line", "true");
|
|
//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");
|
|
//interface.properties.set("brace-if-single-indent", "true");
|
|
etk::String outRef = "action_A;if(true)action_B;action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_single_100) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-if-one-line-size-max", "40");
|
|
interface.properties.set("brace-if-single", "true");
|
|
interface.properties.set("brace-if-single-in-new-line", "true");
|
|
//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");
|
|
//interface.properties.set("brace-if-single-indent", "true");
|
|
etk::String outRef = "action_A;if(true)\naction_B;\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_single_010) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-if-one-line-size-max", "40");
|
|
interface.properties.set("brace-if-single", "true");
|
|
//interface.properties.set("brace-if-single-in-new-line", "true");
|
|
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");
|
|
//interface.properties.set("brace-if-single-indent", "true");
|
|
etk::String outRef = "action_A;if(true) action_B; action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
TEST(testIf, brace_single_110) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-if-one-line-size-max", "40");
|
|
interface.properties.set("brace-if-single", "true");
|
|
interface.properties.set("brace-if-single-in-new-line", "true");
|
|
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");
|
|
//interface.properties.set("brace-if-single-indent", "true");
|
|
etk::String outRef = "action_A;if(true)\naction_B;\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
|
|
TEST(testIf, brace_single_001) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-if-one-line-size-max", "40");
|
|
interface.properties.set("brace-if-single", "true");
|
|
//interface.properties.set("brace-if-single-in-new-line", "true");
|
|
//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");
|
|
interface.properties.set("brace-if-single-indent", "true");
|
|
etk::String outRef = "action_A;if(true)action_B;action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_single_101) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-if-one-line-size-max", "40");
|
|
interface.properties.set("brace-if-single", "true");
|
|
interface.properties.set("brace-if-single-in-new-line", "true");
|
|
//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");
|
|
interface.properties.set("brace-if-single-indent", "true");
|
|
etk::String outRef = "action_A;if(true)\n\taction_B;\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_single_011) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-if-one-line-size-max", "40");
|
|
interface.properties.set("brace-if-single", "true");
|
|
//interface.properties.set("brace-if-single-in-new-line", "true");
|
|
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");
|
|
interface.properties.set("brace-if-single-indent", "true");
|
|
etk::String outRef = "action_A;if(true) action_B; action_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
TEST(testIf, brace_single_111) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-if-one-line-size-max", "40");
|
|
interface.properties.set("brace-if-single", "true");
|
|
interface.properties.set("brace-if-single-in-new-line", "true");
|
|
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");
|
|
interface.properties.set("brace-if-single-indent", "true");
|
|
etk::String outRef = "action_A;if(true)\n\taction_B;\naction_D;";
|
|
etk::String output = interface.process(sourceBrace1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
output = interface.process(sourceBrace1ActionNoBrace);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
TEST(testIf, brace_empty_000) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// empty
|
|
//interface.properties.set("brace-if-one-line-size-max", "0");
|
|
//interface.properties.set("brace-empty-space", "true");
|
|
//interface.properties.set("brace-empty-indent", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace0Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_empty_100) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// empty
|
|
interface.properties.set("brace-if-one-line-size-max", "0");
|
|
//interface.properties.set("brace-if-empty-space", "true");
|
|
//interface.properties.set("brace-if-empty-indent", "true");
|
|
etk::String outRef = "action_A;if(true) {}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace0Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_empty_110) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// empty
|
|
interface.properties.set("brace-if-one-line-size-max", "0");
|
|
interface.properties.set("brace-if-empty-space", "true");
|
|
//interface.properties.set("brace-if-empty-indent", "true");
|
|
etk::String outRef = "action_A;if(true) { }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace0Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_empty_111) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// empty
|
|
interface.properties.set("brace-if-one-line-size-max", "0");
|
|
interface.properties.set("brace-if-empty-space", "true");
|
|
interface.properties.set("brace-if-empty-indent", "true");
|
|
etk::String outRef = "action_A;if(true) { }\naction_D;";
|
|
etk::String output = interface.process(sourceBrace0Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, brace_empty_001) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("brace-if-in-new-line-before", "true");
|
|
interface.properties.set("brace-if-in-new-line-after", "true");
|
|
interface.properties.set("brace-if-in-space-before", "true");
|
|
interface.properties.set("brace-if-in-space-after", "true");
|
|
interface.properties.set("brace-if-in-indent-before", "true");
|
|
interface.properties.set("brace-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("brace-if-out-new-line-before", "true");
|
|
interface.properties.set("brace-if-out-new-line-after", "true");
|
|
interface.properties.set("brace-if-out-space-before", "true");
|
|
interface.properties.set("brace-if-out-space-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-after", "true");
|
|
interface.properties.set("brace-if-out-unindent-before", "true");
|
|
// empty
|
|
//interface.properties.set("brace-if-one-line-size-max", "0");
|
|
//interface.properties.set("brace-if-empty-space", "true");
|
|
interface.properties.set("brace-if-empty-indent", "true");
|
|
etk::String outRef = "action_A;if(true)\n\t{\n\t\t\n\t}\naction_D;";
|
|
etk::String output = interface.process(sourceBrace0Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------------
|
|
// -- Condition section: ()
|
|
// -----------------------------------------------------------------------------------------------------------------------
|
|
|
|
static etk::String sourceCondition0 = "if(){}";
|
|
static etk::String sourceCondition1 = "if(elementA==true){}";
|
|
static etk::String sourceCondition2 = "if(elementA==false&&(elementB==99||not elementC)&&!elementD){}";
|
|
|
|
|
|
TEST(testIf, condition_100000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(elementA==true\n){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(elementA==false&&(elementB==99||not elementC)&&!elementD){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_101000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(elementA==true\n){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(elementA==false&&(elementB==99||not elementC)&&!elementD\n){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_101100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n( elementA==true\n) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n( elementA==false&&(elementB==99||not elementC)&&!elementD\n) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_110000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(\nelementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(\nelementA==false&&(elementB==99||not elementC)&&!elementD\n)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_110100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(\nelementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(\nelementA==false&&(elementB==99||not elementC)&&!elementD\n)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_111000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(\nelementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(\nelementA==false&&(elementB==99||not elementC)&&!elementD\n)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_111100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(\nelementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(\nelementA==false&&(elementB==99||not elementC)&&!elementD\n){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_100100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n( elementA==true\n) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n( elementA==false&&(elementB==99||not elementC)&&!elementD\n) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testIf, condition_010000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if(\nelementA==true)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if(\nelementA==false&&(elementB==99||not elementC)&&!elementD)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_010100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if(\nelementA==true)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if(\nelementA==false&&(elementB==99||not elementC)&&!elementD)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_011000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if (\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (\nelementA==true )\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (\nelementA==false&&(elementB==99||not elementC)&&!elementD )\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_001000) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( ){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (elementA==true ){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (elementA==false&&(elementB==99||not elementC)&&!elementD ){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_001100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( ) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if ( elementA==true ) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if ( elementA==false&&(elementB==99||not elementC)&&!elementD ) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_011100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if (\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (\nelementA==true )\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (\nelementA==false&&(elementB==99||not elementC)&&!elementD )\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_000100) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if( ) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if( elementA==true) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if( elementA==false&&(elementB==99||not elementC)&&!elementD) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
TEST(testIf, condition_100001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(elementA==true\n){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(elementA==false&&(elementB==99||not elementC)&&!elementD\n){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_101001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(elementA==true\n){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(elementA==false&&(elementB==99||not elementC)&&!elementD\n){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_101101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(elementA==true\n){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n( elementA==false&&(elementB==99||not elementC)&&!elementD\n){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_110001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n\t)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(\n\telementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(\n\telementA==false&&(elementB==99||not elementC)&&!elementD\n)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testIf, condition_110101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if(){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if(elementA==true){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if(elementA==false&&(elementB==99||not elementC)&&!elementD){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_111001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(\n\telementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(\n\telementA==false&&(elementB==99||not elementC)&&!elementD\n)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_111101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(\n\telementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(\n\telementA==false&&(elementB==99||not elementC)&&!elementD\n)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_100101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n( elementA==true\n) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n( elementA==false&&(elementB==99||not elementC)&&!elementD\n) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testIf, condition_010001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n(elementA==true\n){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n(elementA==false&&(elementB==99||not elementC)&&!elementD\n){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_010101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if(\n\telementA==true)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if(\n\telementA==false&&(elementB==99||not elementC)&&!elementD)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_011001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if (\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (\n\telementA==true )\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (\n\telementA==false&&(elementB==99||not elementC)&&!elementD )\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_001001) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( ){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (elementA==true ){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (elementA==false&&(elementB==99||not elementC)&&!elementD ){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_001101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( ) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if ( elementA==true ) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if ( elementA==false&&(elementB==99||not elementC)&&!elementD ) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_011101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if (\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (\n\telementA==true )\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (\n\telementA==false&&(elementB==99||not elementC)&&!elementD )\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_000101) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if( ) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if( elementA==true) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if( elementA==false&&(elementB==99||not elementC)&&!elementD) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
TEST(testIf, condition_100010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(elementA==true\n\t){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(elementA==false&&(elementB==99||not elementC)&&!elementD\n\t){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_101010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(elementA==true\n){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(elementA==false&&(elementB==99||not elementC)&&!elementD\n){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_101110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t( elementA==true\n){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t( elementA==false&&(elementB==99||not elementC)&&!elementD\n){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_110010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\telementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\telementA==false&&(elementB==99||not elementC)&&!elementD\n)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_110110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\telementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\telementA==false&&(elementB==99||not elementC)&&!elementD\n)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_111010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\telementA==true\n)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\telementA==false&&(elementB==99||not elementC)&&!elementD\n)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_111110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\telementA==true\n\t)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_100110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t( elementA==true\n\t) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t( elementA==false&&(elementB==99||not elementC)&&!elementD\n\t) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testIf, condition_010010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if(\n\t)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if(\n\telementA==true)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if(\n\telementA==false&&(elementB==99||not elementC)&&!elementD)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_010110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if(\n\t) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if(\n\telementA==true)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if(\n\telementA==false&&(elementB==99||not elementC)&&!elementD)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_011010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if (\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (\n\telementA==true )\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (\n\telementA==false&&(elementB==99||not elementC)&&!elementD )\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_001010) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( ){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (elementA==true ){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (elementA==false&&(elementB==99||not elementC)&&!elementD ){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_001110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( ) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if ( elementA==true ) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if ( elementA==false&&(elementB==99||not elementC)&&!elementD ) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_011110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if (\n)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (\n\telementA==true )\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (\n\telementA==false&&(elementB==99||not elementC)&&!elementD )\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_000110) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
//interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
//interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if( ) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if( elementA==true) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if( elementA==false&&(elementB==99||not elementC)&&!elementD) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
TEST(testIf, condition_100011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(elementA==true\n\t){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(elementA==false&&(elementB==99||not elementC)&&!elementD\n\t){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_101011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(elementA==true\n\t){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(elementA==false&&(elementB==99||not elementC)&&!elementD\n\t){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_101111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t( elementA==true\n\t) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t( elementA==false&&(elementB==99||not elementC)&&!elementD\n\t) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_110011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t)\n\t{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\t\telementA==true\n\t)\n\t{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n\t{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_110111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t)\n\t{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\t\telementA==true\n\t)\n\t{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n\t{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_111011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t)\n\t{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\t\telementA==true\n\t)\n\t{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n\t{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_111111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t)\n\t{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\t\telementA==true\n\t)\n\t{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n\t{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_100111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t( ) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t( elementA==true\n\t) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t( elementA==false&&(elementB==99||not elementC)&&!elementD\n\t) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testIf, condition_010011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if(\n\t\t)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if(\n\t\telementA==true)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_010111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if(\n\t\t)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if(\n\t\telementA==true)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_011011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if (\n\t\t)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (\n\t\telementA==true )\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD )\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_001011) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
//interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
//interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( ){}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (elementA==true ){}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (elementA==false&&(elementB==99||not elementC)&&!elementD ){}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_001111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( ) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if ( elementA==true ) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if ( elementA==false&&(elementB==99||not elementC)&&!elementD ) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_011111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if (\n\t\t)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if (\n\t\telementA==true )\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if (\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD )\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_000111) {
|
|
estyle::Generator interface;
|
|
// in:
|
|
//interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
//interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
//interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
//interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// single:
|
|
//interface.properties.set("parenthese-if-single", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if( ) {}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if( elementA==true) {}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if( elementA==false&&(elementB==99||not elementC)&&!elementD) {}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
TEST(testIf, condition_empty_000) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// empty
|
|
//interface.properties.set("parenthese-if-one-line-size-max", "0");
|
|
//interface.properties.set("parenthese-empty-space", "true");
|
|
//interface.properties.set("parenthese-empty-indent", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\t\telementA==true\n\t)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_empty_100) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// empty
|
|
interface.properties.set("parenthese-if-one-line-size-max", "0");
|
|
//interface.properties.set("parenthese-if-empty-space", "true");
|
|
//interface.properties.set("parenthese-if-empty-indent", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ()\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\t\telementA==true\n\t)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_empty_110) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// empty
|
|
interface.properties.set("parenthese-if-one-line-size-max", "0");
|
|
interface.properties.set("parenthese-if-empty-space", "true");
|
|
//interface.properties.set("parenthese-if-empty-indent", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( )\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\t\telementA==true\n\t)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_empty_111) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// empty
|
|
interface.properties.set("parenthese-if-one-line-size-max", "0");
|
|
interface.properties.set("parenthese-if-empty-space", "true");
|
|
interface.properties.set("parenthese-if-empty-indent", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if ( )\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\t\telementA==true\n\t)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testIf, condition_empty_001) {
|
|
estyle::Generator interface;
|
|
// in out for specific empty change:
|
|
interface.properties.set("parenthese-if-in-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-in-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-in-space-before", "true");
|
|
interface.properties.set("parenthese-if-in-space-after", "true");
|
|
interface.properties.set("parenthese-if-in-indent-before", "true");
|
|
interface.properties.set("parenthese-if-in-indent-after", "true");
|
|
// out:
|
|
interface.properties.set("parenthese-if-out-new-line-before", "true");
|
|
interface.properties.set("parenthese-if-out-new-line-after", "true");
|
|
interface.properties.set("parenthese-if-out-space-before", "true");
|
|
interface.properties.set("parenthese-if-out-space-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-after", "true");
|
|
interface.properties.set("parenthese-if-out-unindent-before", "true");
|
|
// empty
|
|
//interface.properties.set("parenthese-if-one-line-size-max", "0");
|
|
//interface.properties.set("parenthese-if-empty-space", "true");
|
|
interface.properties.set("parenthese-if-empty-indent", "true");
|
|
// Force inside RAw mode
|
|
interface.properties.set("parenthese-if-mode", "true");
|
|
// TEST 1
|
|
etk::String outRef = "if\n\t(\n\t\t\n\t)\n{}";
|
|
etk::String output = interface.process(sourceCondition0);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 2
|
|
outRef = "if\n\t(\n\t\telementA==true\n\t)\n{}";
|
|
output = interface.process(sourceCondition1);
|
|
EXPECT_EQ(output, outRef);
|
|
// TEST 3
|
|
outRef = "if\n\t(\n\t\telementA==false&&(elementB==99||not elementC)&&!elementD\n\t)\n{}";
|
|
output = interface.process(sourceCondition2);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|