Mercurial > thymian
comparison tests/generated.cpp @ 0:a4671277546c tip
created the repository for the thymian project
| author | ferencd |
|---|---|
| date | Tue, 17 Aug 2021 11:19:54 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:a4671277546c |
|---|---|
| 1 #include <sstream> | |
| 2 #include <fstream> | |
| 3 | |
| 4 #define URS 5 | |
| 5 | |
| 6 int main() | |
| 7 { | |
| 8 std::stringstream ss; | |
| 9 | |
| 10 ss << "#include \"../../tests/tests.h\"" << std::endl; | |
| 11 ss << "#include \"gtest/gtest.h\"" << std::endl; | |
| 12 ss << "#include \"nap_runtime.h\"" << std::endl << std::endl; | |
| 13 | |
| 14 ss << "TEST(PushPeekGen, Ints)" << std::endl | |
| 15 << "{" << std::endl << "SCRIPT_START" << std::endl | |
| 16 << "\" \\" << std::endl; | |
| 17 | |
| 18 for(int i=0; i<=URS; i++) | |
| 19 { | |
| 20 ss << "int gv_add_" << i << " = " << i << "; \\" << std::endl ; | |
| 21 } | |
| 22 | |
| 23 ss << "asm \\" << std::endl << "{ \\" << std::endl; | |
| 24 | |
| 25 for(int i=0; i<=URS; i++) | |
| 26 { | |
| 27 ss << " mov reg int " << i << " 1; \\" << std::endl; | |
| 28 } | |
| 29 ss << "} \\" << std::endl; | |
| 30 ss << "\"" << std::endl << "SCRIPT_END" << std::endl | |
| 31 << "SCRIPT_SHUTDOWN"<<std::endl << "(void)found_indicator;}" << std::endl; | |
| 32 | |
| 33 | |
| 34 std::ofstream outFile; | |
| 35 outFile.open("gen_test.cpp"); | |
| 36 | |
| 37 outFile << ss.rdbuf(); | |
| 38 } |
