Commit 0d4af829 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Implement audiowmark cmp --expect-matches option for tests.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 969d1cb9
......@@ -801,6 +801,8 @@ main (int argc, char **argv)
parse_shared_options (ap);
parse_get_options (ap);
ap.parse_opt ("--expect-matches", Params::expect_matches);
args = parse_positional (ap, "watermarked_wav", "message_hex");
return get_watermark (args[0], args[1]);
}
......
......@@ -41,6 +41,7 @@ int Params::test_cut = 0; // for sync test
bool Params::test_no_sync = false; // disable sync
bool Params::test_no_limiter = false; // disable limiter
int Params::test_truncate = 0;
int Params::expect_matches = -1;
Format Params::input_format = Format::AUTO;
Format Params::output_format = Format::AUTO;
......
......@@ -71,6 +71,7 @@ public:
static bool test_no_sync;
static bool test_no_limiter;
static int test_truncate;
static int expect_matches;
static Format input_format;
static Format output_format;
......
......@@ -639,6 +639,12 @@ decode_and_report (const WavData& wav_data, const vector<int>& orig_bits)
block_decoder.print_debug_sync();
if (Params::expect_matches >= 0)
{
printf ("expect_matches %d\n", Params::expect_matches);
if (match_count != Params::expect_matches)
return 1;
}
if (!match_count)
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment