70 lines
2.0 KiB
C++
70 lines
2.0 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>
|
|
|
|
|
|
int main(int _argc, const char** _argv) {
|
|
// the only one init for etk:
|
|
etest::init(_argc, _argv);
|
|
for (int32_t iii=1; iii<_argc ; ++iii) {
|
|
etk::String data = _argv[iii];
|
|
if ( data == "-h"
|
|
|| data == "--help") {
|
|
ETEST_PRINT("Help : ");
|
|
ETEST_PRINT(" ./xxx [options]");
|
|
ETEST_PRINT(" File to test");
|
|
ETEST_PRINT(" -h/--help: this help");
|
|
exit(0);
|
|
}
|
|
}
|
|
return RUN_ALL_TESTS();
|
|
}
|
|
|
|
TEST(testrestyle, test1) {
|
|
estyle::Generator interface;
|
|
|
|
|
|
etk::String source =
|
|
"/* simple comment */\n"
|
|
"int32_t hello = \"plouf \\n\";"
|
|
"\n";
|
|
etk::String output = interface.process(source);
|
|
|
|
TEST_INFO("source:\n" << source);
|
|
TEST_INFO("output:\n" << output);
|
|
|
|
}
|
|
|
|
TEST(testrestyle, test2) {
|
|
estyle::Generator interface;
|
|
|
|
|
|
etk::String source =
|
|
"if (plop == \"plop\" || (kikou != 363464564 && !tree)) { int32_t coucou; int64_t hello = 456; } else if (lol==345 && UNO == why) {/* nothing to do*/} else DEBUG_INFO(\"kjlkj\" << 456346.6 << \" \" << 0xabcdef123);";
|
|
etk::String output = interface.process(source);
|
|
|
|
TEST_INFO("source:\n" << source);
|
|
TEST_INFO("output:\n" << output);
|
|
|
|
}
|
|
|
|
TEST(testrestyle, test3) {
|
|
estyle::Generator interface;
|
|
|
|
|
|
etk::String source =
|
|
"namespace aaa { namespace BBB { const unsigned \n int myFunction(int32_t & arg1, float \t*\t\t* arg2, const\t \n double*\n& arg3=0x345aeF);const unsigned int myFunction(int32_t& arg1, float** arg2, const double*& arg3){ return 0;} } } if(aaa::BBB::myFunction(2452452345!=55 && 765432=5432,24523452354,\"43SFGDVEZT5R34EAQCWX\") == false && 235445 & 24545 == 'R') exit (-1); if (ploppp == 54) { return -T;}";
|
|
etk::String output = interface.process(source);
|
|
|
|
TEST_INFO("source:\n" << source);
|
|
TEST_INFO("output:\n" << output);
|
|
|
|
}
|