261 lines
13 KiB
C++
261 lines
13 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 <etk/os/FSNode.hpp>
|
|
#include <test-debug/debug.hpp>
|
|
#include <etest/etest.hpp>
|
|
|
|
static etk::String sourceIf1Action = "action_A;print_console(){action_B;}action_D;";
|
|
static etk::String sourceIf2Action = "action_A;print_console(){action_B;action_C;}action_D;";
|
|
|
|
|
|
TEST(testFunction, brace_0000) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-function-in-new-line-before", "true");
|
|
//interface.properties.set("brace-function-in-new-line-after", "true");
|
|
//interface.properties.set("brace-function-in-space-before", "true");
|
|
//interface.properties.set("brace-function-in-space-after", "true");
|
|
//interface.properties.set("brace-function-out-new-line-before", "true");
|
|
//interface.properties.set("brace-function-out-new-line-after", "true");
|
|
//interface.properties.set("brace-function-out-space-before", "true");
|
|
//interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console(){action_B;}action_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_1000) {
|
|
estyle::Generator interface;
|
|
interface.properties.set("brace-function-in-new-line-before", "true");
|
|
//interface.properties.set("brace-function-in-new-line-after", "true");
|
|
//interface.properties.set("brace-function-in-space-before", "true");
|
|
//interface.properties.set("brace-function-in-space-after", "true");
|
|
interface.properties.set("brace-function-out-new-line-before", "true");
|
|
//interface.properties.set("brace-function-out-new-line-after", "true");
|
|
//interface.properties.set("brace-function-out-space-before", "true");
|
|
//interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console()\n{action_B;\n}action_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_1010) {
|
|
estyle::Generator interface;
|
|
interface.properties.set("brace-function-in-new-line-before", "true");
|
|
//interface.properties.set("brace-function-in-new-line-after", "true");
|
|
interface.properties.set("brace-function-in-space-before", "true");
|
|
//interface.properties.set("brace-function-in-space-after", "true");
|
|
interface.properties.set("brace-function-out-new-line-before", "true");
|
|
//interface.properties.set("brace-function-out-new-line-after", "true");
|
|
interface.properties.set("brace-function-out-space-before", "true");
|
|
//interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console()\n{action_B;\n}action_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_1011) {
|
|
estyle::Generator interface;
|
|
interface.properties.set("brace-function-in-new-line-before", "true");
|
|
//interface.properties.set("brace-function-in-new-line-after", "true");
|
|
interface.properties.set("brace-function-in-space-before", "true");
|
|
interface.properties.set("brace-function-in-space-after", "true");
|
|
interface.properties.set("brace-function-out-new-line-before", "true");
|
|
//interface.properties.set("brace-function-out-new-line-after", "true");
|
|
interface.properties.set("brace-function-out-space-before", "true");
|
|
interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console()\n{ action_B;\n} action_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_1100) {
|
|
estyle::Generator interface;
|
|
interface.properties.set("brace-function-in-new-line-before", "true");
|
|
interface.properties.set("brace-function-in-new-line-after", "true");
|
|
//interface.properties.set("brace-function-in-space-before", "true");
|
|
//interface.properties.set("brace-function-in-space-after", "true");
|
|
interface.properties.set("brace-function-out-new-line-before", "true");
|
|
interface.properties.set("brace-function-out-new-line-after", "true");
|
|
//interface.properties.set("brace-function-out-space-before", "true");
|
|
//interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console()\n{\n\taction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_1101) {
|
|
estyle::Generator interface;
|
|
interface.properties.set("brace-function-in-new-line-before", "true");
|
|
interface.properties.set("brace-function-in-new-line-after", "true");
|
|
//interface.properties.set("brace-function-in-space-before", "true");
|
|
interface.properties.set("brace-function-in-space-after", "true");
|
|
interface.properties.set("brace-function-out-new-line-before", "true");
|
|
interface.properties.set("brace-function-out-new-line-after", "true");
|
|
//interface.properties.set("brace-function-out-space-before", "true");
|
|
interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console()\n{\n\taction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_1110) {
|
|
estyle::Generator interface;
|
|
interface.properties.set("brace-function-in-new-line-before", "true");
|
|
interface.properties.set("brace-function-in-new-line-after", "true");
|
|
interface.properties.set("brace-function-in-space-before", "true");
|
|
//interface.properties.set("brace-function-in-space-after", "true");
|
|
interface.properties.set("brace-function-out-new-line-before", "true");
|
|
interface.properties.set("brace-function-out-new-line-after", "true");
|
|
interface.properties.set("brace-function-out-space-before", "true");
|
|
//interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console()\n{\n\taction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_1111) {
|
|
estyle::Generator interface;
|
|
interface.properties.set("brace-function-in-new-line-before", "true");
|
|
interface.properties.set("brace-function-in-new-line-after", "true");
|
|
interface.properties.set("brace-function-in-space-before", "true");
|
|
interface.properties.set("brace-function-in-space-after", "true");
|
|
interface.properties.set("brace-function-out-new-line-before", "true");
|
|
interface.properties.set("brace-function-out-new-line-after", "true");
|
|
interface.properties.set("brace-function-out-space-before", "true");
|
|
interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console()\n{\n\taction_B;\n}\naction_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_1001) {
|
|
estyle::Generator interface;
|
|
interface.properties.set("brace-function-in-new-line-before", "true");
|
|
//interface.properties.set("brace-function-in-new-line-after", "true");
|
|
//interface.properties.set("brace-function-in-space-before", "true");
|
|
interface.properties.set("brace-function-in-space-after", "true");
|
|
interface.properties.set("brace-function-out-new-line-before", "true");
|
|
//interface.properties.set("brace-function-out-new-line-after", "true");
|
|
//interface.properties.set("brace-function-out-space-before", "true");
|
|
interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console()\n{ action_B;\n} action_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
TEST(testFunction, brace_0100) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-function-in-new-line-before", "true");
|
|
interface.properties.set("brace-function-in-new-line-after", "true");
|
|
//interface.properties.set("brace-function-in-space-before", "true");
|
|
//interface.properties.set("brace-function-in-space-after", "true");
|
|
//interface.properties.set("brace-function-out-new-line-before", "true");
|
|
interface.properties.set("brace-function-out-new-line-after", "true");
|
|
//interface.properties.set("brace-function-out-space-before", "true");
|
|
//interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console(){\n\taction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_0101) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-function-in-new-line-before", "true");
|
|
interface.properties.set("brace-function-in-new-line-after", "true");
|
|
//interface.properties.set("brace-function-in-space-before", "true");
|
|
interface.properties.set("brace-function-in-space-after", "true");
|
|
//interface.properties.set("brace-function-out-new-line-before", "true");
|
|
interface.properties.set("brace-function-out-new-line-after", "true");
|
|
//interface.properties.set("brace-function-out-space-before", "true");
|
|
interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console(){\n\taction_B;}\naction_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_0110) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-function-in-new-line-before", "true");
|
|
interface.properties.set("brace-function-in-new-line-after", "true");
|
|
interface.properties.set("brace-function-in-space-before", "true");
|
|
//interface.properties.set("brace-function-in-space-after", "true");
|
|
//interface.properties.set("brace-function-out-new-line-before", "true");
|
|
interface.properties.set("brace-function-out-new-line-after", "true");
|
|
interface.properties.set("brace-function-out-space-before", "true");
|
|
//interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console() {\n\taction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_0010) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-function-in-new-line-before", "true");
|
|
//interface.properties.set("brace-function-in-new-line-after", "true");
|
|
interface.properties.set("brace-function-in-space-before", "true");
|
|
//interface.properties.set("brace-function-in-space-after", "true");
|
|
//interface.properties.set("brace-function-out-new-line-before", "true");
|
|
//interface.properties.set("brace-function-out-new-line-after", "true");
|
|
interface.properties.set("brace-function-out-space-before", "true");
|
|
//interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console() {action_B; }action_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_0011) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-function-in-new-line-before", "true");
|
|
//interface.properties.set("brace-function-in-new-line-after", "true");
|
|
interface.properties.set("brace-function-in-space-before", "true");
|
|
interface.properties.set("brace-function-in-space-after", "true");
|
|
//interface.properties.set("brace-function-out-new-line-before", "true");
|
|
//interface.properties.set("brace-function-out-new-line-after", "true");
|
|
interface.properties.set("brace-function-out-space-before", "true");
|
|
interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console() { action_B; } action_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_0111) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-function-in-new-line-before", "true");
|
|
interface.properties.set("brace-function-in-new-line-after", "true");
|
|
interface.properties.set("brace-function-in-space-before", "true");
|
|
interface.properties.set("brace-function-in-space-after", "true");
|
|
//interface.properties.set("brace-function-out-new-line-before", "true");
|
|
interface.properties.set("brace-function-out-new-line-after", "true");
|
|
interface.properties.set("brace-function-out-space-before", "true");
|
|
interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console() {\n\taction_B; }\naction_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
TEST(testFunction, brace_0001) {
|
|
estyle::Generator interface;
|
|
//interface.properties.set("brace-function-in-new-line-before", "true");
|
|
//interface.properties.set("brace-function-in-new-line-after", "true");
|
|
//interface.properties.set("brace-function-in-space-before", "true");
|
|
interface.properties.set("brace-function-in-space-after", "true");
|
|
//interface.properties.set("brace-function-out-new-line-before", "true");
|
|
//interface.properties.set("brace-function-out-new-line-after", "true");
|
|
//interface.properties.set("brace-function-out-space-before", "true");
|
|
interface.properties.set("brace-function-out-space-after", "true");
|
|
etk::String outRef = "action_A;print_console(){ action_B;} action_D;";
|
|
etk::String output = interface.process(sourceIf1Action);
|
|
EXPECT_EQ(output, outRef);
|
|
}
|
|
|
|
|
|
|
|
|