/** * @author Edouard DUPIN * @copyright 2017, Edouard DUPIN, all right reserved * @license MPL-2 (see license file) */ #include #include #include #include #include #include static etk::String sourceNamespace = "action_A;namespace myNamespace{action_B;}action_D;"; TEST(testNamespace, brace_0000) { estyle::Generator interface; //interface.properties.set("brace-namespace-in-new-line-before", "true"); //interface.properties.set("brace-namespace-in-new-line-after", "true"); //interface.properties.set("brace-namespace-in-space-before", "true"); //interface.properties.set("brace-namespace-in-space-after", "true"); //interface.properties.set("brace-namespace-out-new-line-before", "true"); //interface.properties.set("brace-namespace-out-new-line-after", "true"); //interface.properties.set("brace-namespace-out-space-before", "true"); //interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace{action_B;}action_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_1000) { estyle::Generator interface; interface.properties.set("brace-namespace-in-new-line-before", "true"); //interface.properties.set("brace-namespace-in-new-line-after", "true"); //interface.properties.set("brace-namespace-in-space-before", "true"); //interface.properties.set("brace-namespace-in-space-after", "true"); interface.properties.set("brace-namespace-out-new-line-before", "true"); //interface.properties.set("brace-namespace-out-new-line-after", "true"); //interface.properties.set("brace-namespace-out-space-before", "true"); //interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace\n{action_B;\n}action_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_1010) { estyle::Generator interface; interface.properties.set("brace-namespace-in-new-line-before", "true"); //interface.properties.set("brace-namespace-in-new-line-after", "true"); interface.properties.set("brace-namespace-in-space-before", "true"); //interface.properties.set("brace-namespace-in-space-after", "true"); interface.properties.set("brace-namespace-out-new-line-before", "true"); //interface.properties.set("brace-namespace-out-new-line-after", "true"); interface.properties.set("brace-namespace-out-space-before", "true"); //interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace\n{action_B;\n}action_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_1011) { estyle::Generator interface; interface.properties.set("brace-namespace-in-new-line-before", "true"); //interface.properties.set("brace-namespace-in-new-line-after", "true"); interface.properties.set("brace-namespace-in-space-before", "true"); interface.properties.set("brace-namespace-in-space-after", "true"); interface.properties.set("brace-namespace-out-new-line-before", "true"); //interface.properties.set("brace-namespace-out-new-line-after", "true"); interface.properties.set("brace-namespace-out-space-before", "true"); interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace\n{ action_B;\n} action_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_1100) { estyle::Generator interface; interface.properties.set("brace-namespace-in-new-line-before", "true"); interface.properties.set("brace-namespace-in-new-line-after", "true"); //interface.properties.set("brace-namespace-in-space-before", "true"); //interface.properties.set("brace-namespace-in-space-after", "true"); interface.properties.set("brace-namespace-out-new-line-before", "true"); interface.properties.set("brace-namespace-out-new-line-after", "true"); //interface.properties.set("brace-namespace-out-space-before", "true"); //interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace\n{\n\taction_B;\n}\naction_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_1101) { estyle::Generator interface; interface.properties.set("brace-namespace-in-new-line-before", "true"); interface.properties.set("brace-namespace-in-new-line-after", "true"); //interface.properties.set("brace-namespace-in-space-before", "true"); interface.properties.set("brace-namespace-in-space-after", "true"); interface.properties.set("brace-namespace-out-new-line-before", "true"); interface.properties.set("brace-namespace-out-new-line-after", "true"); //interface.properties.set("brace-namespace-out-space-before", "true"); interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace\n{\n\taction_B;\n}\naction_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_1110) { estyle::Generator interface; interface.properties.set("brace-namespace-in-new-line-before", "true"); interface.properties.set("brace-namespace-in-new-line-after", "true"); interface.properties.set("brace-namespace-in-space-before", "true"); //interface.properties.set("brace-namespace-in-space-after", "true"); interface.properties.set("brace-namespace-out-new-line-before", "true"); interface.properties.set("brace-namespace-out-new-line-after", "true"); interface.properties.set("brace-namespace-out-space-before", "true"); //interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace\n{\n\taction_B;\n}\naction_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_1111) { estyle::Generator interface; interface.properties.set("brace-namespace-in-new-line-before", "true"); interface.properties.set("brace-namespace-in-new-line-after", "true"); interface.properties.set("brace-namespace-in-space-before", "true"); interface.properties.set("brace-namespace-in-space-after", "true"); interface.properties.set("brace-namespace-out-new-line-before", "true"); interface.properties.set("brace-namespace-out-new-line-after", "true"); interface.properties.set("brace-namespace-out-space-before", "true"); interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace\n{\n\taction_B;\n}\naction_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_1001) { estyle::Generator interface; interface.properties.set("brace-namespace-in-new-line-before", "true"); //interface.properties.set("brace-namespace-in-new-line-after", "true"); //interface.properties.set("brace-namespace-in-space-before", "true"); interface.properties.set("brace-namespace-in-space-after", "true"); interface.properties.set("brace-namespace-out-new-line-before", "true"); //interface.properties.set("brace-namespace-out-new-line-after", "true"); //interface.properties.set("brace-namespace-out-space-before", "true"); interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace\n{ action_B;\n} action_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_0100) { estyle::Generator interface; //interface.properties.set("brace-namespace-in-new-line-before", "true"); interface.properties.set("brace-namespace-in-new-line-after", "true"); //interface.properties.set("brace-namespace-in-space-before", "true"); //interface.properties.set("brace-namespace-in-space-after", "true"); //interface.properties.set("brace-namespace-out-new-line-before", "true"); interface.properties.set("brace-namespace-out-new-line-after", "true"); //interface.properties.set("brace-namespace-out-space-before", "true"); //interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace{\n\taction_B;}\naction_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_0101) { estyle::Generator interface; //interface.properties.set("brace-namespace-in-new-line-before", "true"); interface.properties.set("brace-namespace-in-new-line-after", "true"); //interface.properties.set("brace-namespace-in-space-before", "true"); interface.properties.set("brace-namespace-in-space-after", "true"); //interface.properties.set("brace-namespace-out-new-line-before", "true"); interface.properties.set("brace-namespace-out-new-line-after", "true"); //interface.properties.set("brace-namespace-out-space-before", "true"); interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace{\n\taction_B;}\naction_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_0110) { estyle::Generator interface; //interface.properties.set("brace-namespace-in-new-line-before", "true"); interface.properties.set("brace-namespace-in-new-line-after", "true"); interface.properties.set("brace-namespace-in-space-before", "true"); //interface.properties.set("brace-namespace-in-space-after", "true"); //interface.properties.set("brace-namespace-out-new-line-before", "true"); interface.properties.set("brace-namespace-out-new-line-after", "true"); interface.properties.set("brace-namespace-out-space-before", "true"); //interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace {\n\taction_B; }\naction_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_0010) { estyle::Generator interface; //interface.properties.set("brace-namespace-in-new-line-before", "true"); //interface.properties.set("brace-namespace-in-new-line-after", "true"); interface.properties.set("brace-namespace-in-space-before", "true"); //interface.properties.set("brace-namespace-in-space-after", "true"); //interface.properties.set("brace-namespace-out-new-line-before", "true"); //interface.properties.set("brace-namespace-out-new-line-after", "true"); interface.properties.set("brace-namespace-out-space-before", "true"); //interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace {action_B; }action_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_0011) { estyle::Generator interface; //interface.properties.set("brace-namespace-in-new-line-before", "true"); //interface.properties.set("brace-namespace-in-new-line-after", "true"); interface.properties.set("brace-namespace-in-space-before", "true"); interface.properties.set("brace-namespace-in-space-after", "true"); //interface.properties.set("brace-namespace-out-new-line-before", "true"); //interface.properties.set("brace-namespace-out-new-line-after", "true"); interface.properties.set("brace-namespace-out-space-before", "true"); interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace { action_B; } action_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_0111) { estyle::Generator interface; //interface.properties.set("brace-namespace-in-new-line-before", "true"); interface.properties.set("brace-namespace-in-new-line-after", "true"); interface.properties.set("brace-namespace-in-space-before", "true"); interface.properties.set("brace-namespace-in-space-after", "true"); //interface.properties.set("brace-namespace-out-new-line-before", "true"); interface.properties.set("brace-namespace-out-new-line-after", "true"); interface.properties.set("brace-namespace-out-space-before", "true"); interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace {\n\taction_B; }\naction_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); } TEST(testNamespace, brace_0001) { estyle::Generator interface; //interface.properties.set("brace-namespace-in-new-line-before", "true"); //interface.properties.set("brace-namespace-in-new-line-after", "true"); //interface.properties.set("brace-namespace-in-space-before", "true"); interface.properties.set("brace-namespace-in-space-after", "true"); //interface.properties.set("brace-namespace-out-new-line-before", "true"); //interface.properties.set("brace-namespace-out-new-line-after", "true"); //interface.properties.set("brace-namespace-out-space-before", "true"); interface.properties.set("brace-namespace-out-space-after", "true"); etk::String outputRef = "action_A;\nnamespace myNamespace{ action_B;} action_D;"; etk::String output = interface.process(sourceNamespace); EXPECT_EQ(output, outputRef); }