| 1 | #cxx . . $ `<file>/tests/binarize/binarize_tests.cpp`/include <catch2/catch_test_macros.hpp> |
| 2 | |
| 3 | #include "binarize/binarize.hpp"cxx . . $ `<file>/src/LibBGCode/binarize/binarize.hpp`/ |
| 4 | #include "binarize/meatpack.hpp"cxx . . $ `<file>/src/LibBGCode/binarize/meatpack.hpp`/ |
| 5 | |
| 6 | #include <string> |
| 7 | #include <vector> |
| 8 | |
| 9 | using namespace MeatPack; |
| 10 | |
| 11 | // Binarize lines via MeatPack and unbinarize back to verify round-trip. |
| 12 | static stdcxx . . $ std/::stringcxx . . $ std/string# roundtripcxx . . $ roundtrip(8054708f2883265b).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> &lines, uint8_tcxx . . $ uint8_t# flags) { |
| 13 | MPBinarizercxx . . $ MeatPack/MPBinarizer# mp_binarizercxx . . $ MeatPack/MPBinarizer#MPBinarizer(ac50b47256ae7414).(flags); |
| 14 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<uint8_tcxx . . $ uint8_t#> binarycxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 15 | mp_binarizer.initializecxx . . $ MeatPack/MPBinarizer#initialize(d8e103f392b62d52).(binary); |
| 16 | for (const stdcxx . . $ std/::stringcxx . . $ std/string# &line: lines) { |
| 17 | mp_binarizer.binarize_linecxx . . $ MeatPack/MPBinarizer#binarize_line(9db05115f854ad40).(line, binary); |
| 18 | } |
| 19 | |
| 20 | mp_binarizer.finalizecxx . . $ MeatPack/MPBinarizer#finalize(d8e103f392b62d52).(binary); |
| 21 | |
| 22 | stdcxx . . $ std/::stringcxx . . $ std/string# unbinarize_resultcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 23 | unbinarizecxx . . $ MeatPack/unbinarize(66c8f0577a1d24f9).(binary, unbinarize_result); |
| 24 | |
| 25 | return unbinarize_resultcxx . . $ std/__cxx11/basic_string#basic_string(8f3aaafa33d05d0b).; |
| 26 | } |
| 27 | |
| 28 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("MeatPackComments preserves indented comments", "[Binarize][MeatPack]") { |
| 29 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> lines = {cxx . . $ std/vector#vector(9619226211e5a241). |
| 30 | ";FLUSH_START\n", |
| 31 | " G1 E1 F6000\n", |
| 32 | " ;FLUSH_END\n", |
| 33 | "\t;TAB_COMMENT\n", |
| 34 | }; |
| 35 | |
| 36 | const stdcxx . . $ std/::stringcxx . . $ std/string# roundtrip_result = roundtripcxx . . $ roundtrip(8054708f2883265b).(lines, Flag_OmitWhitespacescxx . . $ MeatPack/Flag_OmitWhitespaces.); |
| 37 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(roundtrip_result.find(";FLUSH_START") != std::string::npos); |
| 38 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(roundtrip_result.find(";FLUSH_END") != std::string::npos); |
| 39 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(roundtrip_result.find(";TAB_COMMENT") != std::string::npos); |
| 40 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(roundtrip_result.find("G1") != std::string::npos); |
| 41 | } |
| 42 | |
| 43 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("MeatPack removes indented comments when Flag_RemoveComments set", "[Binarize][MeatPack]") { |
| 44 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> lines = {cxx . . $ std/vector#vector(9619226211e5a241). |
| 45 | ";FLUSH_START\n", |
| 46 | " G1 E1 F6000\n", |
| 47 | " ;FLUSH_END\n", |
| 48 | "\t;TAB_COMMENT\n", |
| 49 | }; |
| 50 | |
| 51 | const stdcxx . . $ std/::stringcxx . . $ std/string# roundtrip_result = roundtripcxx . . $ roundtrip(8054708f2883265b).(lines, Flag_OmitWhitespacescxx . . $ MeatPack/Flag_OmitWhitespaces. | Flag_RemoveCommentscxx . . $ MeatPack/Flag_RemoveComments.); |
| 52 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(roundtrip_result.find(";FLUSH_START") == std::string::npos); |
| 53 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(roundtrip_result.find(";FLUSH_END") == std::string::npos); |
| 54 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(roundtrip_result.find(";TAB_COMMENT") == std::string::npos); |
| 55 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(roundtrip_result.find("G1") != std::string::npos); |
| 56 | } |