Skip to content

Commit 2ac4bfc

Browse files
Fix asciify.
1 parent aeda7d1 commit 2ac4bfc

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

src/input_output_test.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ std::string ReadFile(std::filesystem::path path) {
2222
void ParseDirectoryName(std::string name,
2323
std::string* translator_name,
2424
std::string* options) {
25-
2625
// Split at the first '_' the first part is the translator name, the second is
2726
// the options.
2827
// The options follows name=value, split by '_', but name can contain '_'.
@@ -38,7 +37,7 @@ void ParseDirectoryName(std::string name,
3837
*translator_name = name.substr(0, pos);
3938

4039
// Parse a key=value list.
41-
while(true) {
40+
while (true) {
4241
// Parse the name.
4342
std::string::size_type pos2 = name.find('=', pos);
4443
if (pos2 == std::string::npos) {
@@ -66,15 +65,22 @@ void ParseDirectoryName(std::string name,
6665
int main(int, const char**) {
6766
int result = EXIT_SUCCESS;
6867
std::string path = test_directory;
69-
//std::cout << "test_directory = " << test_directory << std::endl;
7068

7169
for (auto& dir : std::filesystem::directory_iterator(path)) {
7270
std::string translator_name;
7371
std::string options;
7472
ParseDirectoryName(dir.path().filename(), &translator_name, &options);
73+
std::cout << std::endl
74+
<< "___" << std::setw(30) << std::setfill('_') << std::left
75+
<< (" " + translator_name + " ") << std::endl;
76+
77+
if (!options.empty()) {
78+
std::cout << " [INFO] Options:" << std::endl;
79+
std::cout << options << std::endl;
80+
}
7581

7682
for (auto& test : std::filesystem::directory_iterator(dir.path())) {
77-
std::cout << " [TEST] " << test.path() << std::endl;
83+
std::cout << " [TEST] " << test.path().filename().string() << std::endl;
7884
auto translator = FindTranslator(translator_name);
7985
if (!translator) {
8086
std::cout << "Translator " << translator_name << " not found."
@@ -108,9 +114,9 @@ int main(int, const char**) {
108114

109115
// Fix the expected output if it is not correct.
110116
// Uncomment the following lines to create the output file.
111-
//std::cout << " [Create output] " << std::endl;
112-
//std::cout << output_computed;
113-
//std::ofstream(test.path() / "output") << output_computed;
117+
// std::cout << " [Create output] " << std::endl;
118+
// std::cout << output_computed;
119+
// std::ofstream(test.path() / "output") << output_computed;
114120
}
115121
}
116122

src/screen/Screen.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,16 @@ void Screen::ASCIIfy(int style) {
156156
case L'': c = '\''; break;
157157
case L'': c = '.'; break;
158158
case L'': c = '\''; break;
159-
case L'': c = '-'; break; // Let's emphasize the horizontal nature
160-
case L'': c = '-'; break; // Let's emphasize the horizontal nature
161-
case L'': c = '|'; break; // Let's emphasize the vertical nature
162-
case L'': c = '|'; break; // Let's emphasize the vertical nature
159+
case L'': c = '-'; break;
160+
case L'': c = '-'; break;
161+
case L'': c = '-'; break;
162+
case L'': c = '-'; break;
163163
case L'': c = '^'; break;
164164
case L'': c = 'V'; break;
165165
case L'': c = '>'; break;
166166
case L'': c = '<'; break;
167-
case L'': c = '-'; break; // Don't forget the dashed lines!
168-
case L'': c = '|'; break; // Don't forget the dashed lines!
167+
case L'': c = '-'; break;
168+
case L'': c = '|'; break;
169169
}
170170
}
171171
}
@@ -184,14 +184,10 @@ void Screen::ASCIIfy(int style) {
184184
case L'': c = '\''; break;
185185
case L'': c = '.'; break;
186186
case L'': c = '\''; break;
187-
case L'': c = '|'; break; // Let's emphasize the vertical nature
188-
case L'': c = '|'; break; // Let's emphasize the vertical nature
187+
case L'': c = '-'; break;
188+
case L'': c = '-'; break;
189189
case L'': c = '^'; break;
190190
case L'': c = 'V'; break;
191-
case L'': c = '>'; break;
192-
case L'': c = '<'; break;
193-
case L'': c = '-'; break; // Don't forget the dashed lines!
194-
case L'': c = '|'; break; // Don't forget the dashed lines!
195191
}
196192
}
197193
}

src/translator/sequence/Sequence.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ std::string Sequence::Translate(const std::string& input,
291291

292292
auto options = SerializeOption(options_string);
293293
ascii_only_ = (options["ascii_only"] == "true");
294-
std::cout << "ascii_only: " << ascii_only_ << std::endl;
295294
interpret_backslash_n_ = (options["interpret_backslash_n"] != "false");
296295

297296
ComputeInternalRepresentation(input);

0 commit comments

Comments
 (0)