Adapt M17 Golay Test to Unit Test Infrastructure

pull/68/head
Niccolò Izzo 2021-11-02 20:20:54 +01:00 zatwierdzone przez Silvano Seva
rodzic 8a3643ad3a
commit df5a35e843
2 zmienionych plików z 16 dodań i 4 usunięć

Wyświetl plik

@ -605,5 +605,10 @@ unit_test_opts = {'c_args': linux_c_args,
'link_args' : linux_l_args}
unit_test_src = openrtx_src + minmea_src + linux_platform_src
dummy_test = executable('dummy', 'tests/unit/dummy.c')
test('Dummy Unit Test', dummy_test)
#dummy_test = executable('dummy', 'tests/unit/dummy.c')
#test('Dummy Unit Test', dummy_test)
m17_golay_test = executable('m17_golay_test',
sources: unit_test_src + ['tests/unit/M17_golay.cpp'],
kwargs: unit_test_opts)
test('M17 Golay Unit Test', m17_golay_test)

Wyświetl plik

@ -71,10 +71,17 @@ int main()
// Less than four errors should be corrected.
if(decoded == value) correcting_ok = true;
printf("Value %04x, emask %08x errs %d -> d %s, c %s\n", value, emask,
__builtin_popcount(emask),
int input_error_count = __builtin_popcount(emask);
printf("Value %04x, emask %08x errs %d -> d %s, c %s\n",
value,
emask,
input_error_count,
decoding_ok ? "OK" : "FAIL",
correcting_ok ? "OK" : "FAIL");
if(input_error_count <= 4 && (!decoding_ok || !correcting_ok))
return -1;
}
return 0;