Skip to content

Commit

Permalink
Flowchart improved (#53)
Browse files Browse the repository at this point in the history
* Link against boost statically.

* Improve FlowChart if/then/else

* Add support for while loop in FlowChart

* Add support for do-loop
  • Loading branch information
ArthurSonzogni authored Dec 12, 2022
1 parent a749338 commit 0a6f1b9
Show file tree
Hide file tree
Showing 31 changed files with 619 additions and 429 deletions.
6 changes: 4 additions & 2 deletions src/fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ extern "C" int LLVMFuzzerTestOneInput(const char* data, size_t size) {
auto& translator = translators[GeneratorInt(data, size) % translators.size()];
std::string input = GeneratorString(data, size);
std::string options = GeneratorString(data, size);
if (translator->Name())
if (std::string(translator->Identifier()) == "Grammar")
return 0;
std::cout << translator->Identifier() << std::endl;
std::cout << input << std::endl;
try {
translator->Translate(input, options);
std::cout << translator->Translate(input, options) << std::endl;
} catch (...) {
}
return 0; // Non-zero return values are reserved for future use.
Expand Down
8 changes: 6 additions & 2 deletions src/input_output_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ void ParseDirectoryName(std::string name,
int main(int, const char**) {
int result = EXIT_SUCCESS;
std::string path = test_directory;
std::cout << "test_directory = " << test_directory << std::endl;
//std::cout << "test_directory = " << test_directory << std::endl;

for (auto& dir : std::filesystem::directory_iterator(path)) {
std::string translator_name;
std::string options;
Expand All @@ -63,14 +64,17 @@ int main(int, const char**) {
std::string output_computed = translator->Translate(input, options);

if (output_computed == output) {
std::cout << " [PASS] " << test.path() << std::endl;
//std::cout << " [PASS] " << test.path() << std::endl;
} else {
std::cout << " [FAIL] " << test.path() << std::endl;
std::cout << "---[Output]------------------" << std::endl;
std::cout << output_computed << std::endl;
std::cout << "---[Expected]----------------" << std::endl;
std::cout << output << std::endl;
std::cout << "---------------------" << std::endl;

std::ofstream(test.path() / "output") << output_computed;

result = EXIT_FAILURE;
}
}
Expand Down
Loading

0 comments on commit 0a6f1b9

Please sign in to comment.