mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-21 05:14:26 -04:00
Refactor freqman_db parsing (#1244)
* WIP freqman changes/memory perf/stash * Split ui tone_key function out for testing. * Add more tests and fix bugs. * Use default max_entries in recond * Set limit back to 90 for now
This commit is contained in:
parent
60de625c37
commit
497ca3f934
30 changed files with 1206 additions and 705 deletions
|
@ -38,6 +38,20 @@ TEST_CASE("It can iterate file lines.") {
|
|||
CHECK_EQ(line_count, 3);
|
||||
}
|
||||
|
||||
TEST_CASE("It can iterate multiple times.") {
|
||||
MockFile f{"abc\ndef\nhij"};
|
||||
BufferLineReader<MockFile> reader{f};
|
||||
int line_count = 0;
|
||||
int line_count2 = 0;
|
||||
for (const auto& line : reader)
|
||||
++line_count;
|
||||
for (const auto& line : reader)
|
||||
++line_count2;
|
||||
|
||||
CHECK_EQ(line_count, 3);
|
||||
CHECK_EQ(line_count2, 3);
|
||||
}
|
||||
|
||||
TEST_CASE("It can iterate file ending with newline.") {
|
||||
MockFile f{"abc\ndef\nhij\n"};
|
||||
BufferLineReader<MockFile> reader{f};
|
||||
|
@ -133,6 +147,18 @@ TEST_CASE("It will split only empty columns.") {
|
|||
|
||||
TEST_SUITE_END();
|
||||
|
||||
TEST_CASE("count_lines returns 1 for single line") {
|
||||
MockFile f{"abs"};
|
||||
BufferLineReader<MockFile> reader{f};
|
||||
CHECK_EQ(count_lines(reader), 1);
|
||||
}
|
||||
|
||||
TEST_CASE("count_lines returns 2 for 2 lines") {
|
||||
MockFile f{"abs"};
|
||||
BufferLineReader<MockFile> reader{f};
|
||||
CHECK_EQ(count_lines(reader), 1);
|
||||
}
|
||||
|
||||
/* Simple example of how to use this to read settings by lines. */
|
||||
TEST_CASE("It can parse a settings file.") {
|
||||
MockFile f{"100,File.txt,5\n200,File2.txt,7"};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue