main.cpp
No OneTemporary

File Metadata

Created
Fri, Mar 13, 7:44 PM

main.cpp

#include "utils.h"
#include <gtest/gtest.h>
using namespace std;
using namespace xreate;
int main(int argc, char **argv) {
testing::GTEST_FLAG(color) = "yes";
string testsTemplate = Config::get("tests.template");
string testsFilter = Config::get(string("tests.templates.") + testsTemplate);
testing::GTEST_FLAG(filter) = testsFilter;
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
//TODO adopt useful tests
//void testParser_1()
//{
// shared_ptr<Scanner> scanner(new Scanner(L"scripts/input.xreate"));
// shared_ptr<Parser> parser(new Parser(scanner.get()));
// parser->Parse();
// flush(cout);
// AST& root = parser->root;
// LLVMLayer l(&root);
// root.compile(l);
// root.run(l);
//}
//void testClasp2()
//{
// shared_ptr<Scanner> scanner(new Scanner(L"scripts/input.xreate"));
// shared_ptr<Parser> parser(new Parser(scanner.get()));
// parser->Parse();
// flush(cout);
// if (parser->errors->count)
// {
// cout << "Found " << parser->errors->count << " errors. Stop" << endl;
// exit(1);
// }
// AST& root = parser->root;
// ClaspLayer clasp;
// /*
// FunctionTagsPass(root).run(clasp);
// RulesPass(root).run(clasp);
// CFGPass(&clasp).run();
// clasp.1
// run();
// */
//}
//void testUnsafeCode1()
//{
// shared_ptr<Scanner> scanner(new Scanner(L"scripts/cases/bugs-code.xreate"));
// shared_ptr<Parser> parser(new Parser(scanner.get()));
// parser->Parse();
// flush(cout);
// if (parser->errors->count)
// {
// cout << "Found " << parser->errors->count << " errors. Stop" << endl;
// exit(1);
// }
// AST& root = parser->root;
// ClaspLayer clasp;
// /*
// FunctionTagsPass(root).run(clasp);
// RulesPass(root).run(clasp);
// CFGPass(&clasp).run();
// //clasp.addRule(":- call(X, Y), tag(Y, unsafe), not tag(X, unsafe), function(X), function(Y).");
// clasp.run();
// */
//}
//void test_DFG_1()
//{
// shared_ptr<Scanner> scanner(new Scanner(L"scripts/input.xreate"));
// shared_ptr<Parser> parser(new Parser(scanner.get()));
// parser->Parse();
// flush(cout);
// if (parser->errors->count)
// {
// cout << "Found " << parser->errors->count << " errors. Stop" << endl;
// exit(1);
// }
// PassManager m;
// m.clasp = new ClaspLayer();
// m.llvm = new LLVMLayer(&parser->root);
// m.root = & parser->root;
// m.clasp->ast = m.root;
// m.registerPass(new DFAPass(&m));
// m.run();
// m.clasp->run();
// m.root->compile(*m.llvm);
// m.root->run(*m.llvm);
//}
//void test_Xml_1()
//{
// shared_ptr<Scanner> scanner(new Scanner(L"scripts/input.xreate"));
// shared_ptr<Parser> parser(new Parser(scanner.get()));
// parser->Parse();
// flush(cout);
// if (parser->errors->count)
// {
// cout << "Found " << parser->errors->count << " errors. Stop" << endl;
// exit(1);
// }
// PassManager m;
// m.root = & parser->root;
// m.clasp = new ClaspLayer();
// m.clasp->ast = m.root;
// m.llvm = new LLVMLayer(&parser->root);
// m.registerPass(new DFAPass(&m));
// m.run();
//}

Event Timeline