From de9cc96296108761ae907c53f18166b98baf5eea Mon Sep 17 00:00:00 2001 From: Florent Pollet Date: Mon, 21 Dec 2020 19:24:50 +0100 Subject: [PATCH] Tests (ter) --- data/config.mm | 5 ++++- src/lib/wav.cpp | 24 ++++++------------------ test/str02.txt | 4 +++- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/data/config.mm b/data/config.mm index d7b7eb5..7d8b14a 100644 --- a/data/config.mm +++ b/data/config.mm @@ -14,7 +14,10 @@ wav.ta¤3 wav.espaceinter¤1 wav.espacelettre¤3 +wav.espacelettre2¤13 wav.espacemot¤7 +wav.espacemot2¤9 +wav.espacemot3¤38 wav.debug¤0 @@ -89,5 +92,5 @@ ï¤---... begin¤.-.- -paragraphe¤-...- +paragraphe¤-...--...- end¤...-.- diff --git a/src/lib/wav.cpp b/src/lib/wav.cpp index e1099fe..3e942b2 100644 --- a/src/lib/wav.cpp +++ b/src/lib/wav.cpp @@ -244,27 +244,15 @@ string MorseL::Wav::read_file(Config& cfg) if (cfg.wav["wav.debug"]) cout << morse[i] << " "; - switch (morse[i]) - { - case 1: + int mi = morse[i]; + if (mi == cfg.wav["wav.ti"]) output.append("."); - break; - - case 3: + else if (mi == cfg.wav["wav.ta"]) output.append("-"); - break; - - case -3: - case -13: // https://www.meridianoutpost.com/resources/etools/calculators/calculator-morse-code.php + else if ((mi == -cfg.wav["wav.espacelettre"]) || (mi == -cfg.wav["wav.espacelettre2"])) // https://www.meridianoutpost.com/resources/etools/calculators/calculator-morse-code.php output.append(" "); - break; - - case -7: - case -9: // https://www.radio-amater.rs/morsecodegenerator/ - case -38: // https://www.meridianoutpost.com/resources/etools/calculators/calculator-morse-code.php - output.append("/"); - break; - } + else if ((mi == -cfg.wav["wav.espacemot"]) || (mi == -cfg.wav["wav.espacemot2"]) || (mi == -cfg.wav["wav.espacemot3"])) // https://www.meridianoutpost.com/resources/etools/calculators/calculator-morse-code.php et // https://www.radio-amater.rs/morsecodegenerator/ + output.append("/"); } if (cfg.wav["wav.debug"]) diff --git a/test/str02.txt b/test/str02.txt index 4232fe7..083aaf4 100644 --- a/test/str02.txt +++ b/test/str02.txt @@ -1 +1,3 @@ -Je suis passionné par l'informatique. \ No newline at end of file +Je suis passionné par l'informatique. + +3 + 4 = 9 \ No newline at end of file