From 1a1c5fa05d0d483d4cebcf221c89c574d980b2b4 Mon Sep 17 00:00:00 2001 From: SG Date: Tue, 25 May 2021 19:43:14 +1000 Subject: [PATCH] Unit tests: fix IRDA test data (#488) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Unit tests: fix IRDA test data * Fix format-errors on test data files * Fix sticking red/green light on unit-tests Co-authored-by: あく Co-authored-by: Albert Kharisov --- .../tests/irda_decoder/irda_decoder_test.c | 4 +- ...a.h => irda_decoder_nec_test_data.srcdata} | 110 +++++++++--------- ...=> irda_decoder_samsung_test_data.srcdata} | 0 applications/tests/test_index.c | 2 - docker/syntax_check.sh | 1 - 5 files changed, 57 insertions(+), 60 deletions(-) rename applications/tests/irda_decoder/test_data/{irda_decoder_nec_test_data.h => irda_decoder_nec_test_data.srcdata} (77%) rename applications/tests/irda_decoder/test_data/{irda_decoder_samsung_test_data.h => irda_decoder_samsung_test_data.srcdata} (100%) diff --git a/applications/tests/irda_decoder/irda_decoder_test.c b/applications/tests/irda_decoder/irda_decoder_test.c index e95a5d02..6305a7e7 100644 --- a/applications/tests/irda_decoder/irda_decoder_test.c +++ b/applications/tests/irda_decoder/irda_decoder_test.c @@ -1,8 +1,8 @@ #include #include "../minunit.h" #include "irda.h" -#include "test_data/irda_decoder_nec_test_data.h" -#include "test_data/irda_decoder_samsung_test_data.h" +#include "test_data/irda_decoder_nec_test_data.srcdata" +#include "test_data/irda_decoder_samsung_test_data.srcdata" #define RUN_DECODER(data, expected) \ run_decoder((data), COUNT_OF(data), (expected), COUNT_OF(expected)) diff --git a/applications/tests/irda_decoder/test_data/irda_decoder_nec_test_data.h b/applications/tests/irda_decoder/test_data/irda_decoder_nec_test_data.srcdata similarity index 77% rename from applications/tests/irda_decoder/test_data/irda_decoder_nec_test_data.h rename to applications/tests/irda_decoder/test_data/irda_decoder_nec_test_data.srcdata index 7269e3f1..69c7626b 100644 --- a/applications/tests/irda_decoder/test_data/irda_decoder_nec_test_data.h +++ b/applications/tests/irda_decoder/test_data/irda_decoder_nec_test_data.srcdata @@ -11,9 +11,9 @@ const uint32_t test_nec_input1[] = { 1415838, 9080, 4436, 611, 494, 600, 505, 578, 500, 608, 501, 602, 502, 580, 498, 606, 508, 605, 500, 583, 1633, 608, 1608, 611, 1631, 578, 1638, 602, 1614, 606, 1637, 583, 1633, 607, 1609, 611, 494, 600, 505, 570, 500, 604, 501, 602, 502, 581, 497, 606, 499, 605, 499, 583, 1633, 617, 1608, 611, 1631, 579, 1638, 602}; const IrdaMessage test_nec_expected1[] = { - {IrdaProtocolNEC, 0, 0, false}, - {IrdaProtocolNEC, 0, 0, true}, - {IrdaProtocolNEC, 0, 0, false}, + {IrdaProtocolNEC, 0xFF00, 0, false}, + {IrdaProtocolNEC, 0xFF00, 0, true}, + {IrdaProtocolNEC, 0xFF00, 0, false}, }; const uint32_t test_nec_input2[] = { @@ -124,57 +124,57 @@ const uint32_t test_nec_input2[] = { }; const IrdaMessage test_nec_expected2[] = { - {IrdaProtocolNEC, 0, 0x02, false}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, false}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x02, true}, - {IrdaProtocolNEC, 0, 0x06, false}, - {IrdaProtocolNEC, 0, 0x06, true}, - {IrdaProtocolNEC, 0, 0x04, false}, - {IrdaProtocolNEC, 0, 0x04, true}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, true}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, true}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x09, false}, - {IrdaProtocolNEC, 0, 0x09, false}, - {IrdaProtocolNEC, 0, 0x09, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x0A, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, true}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x08, true}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x0A, false}, - {IrdaProtocolNEC, 0, 0x08, false}, - {IrdaProtocolNEC, 0, 0x0A, false}, - {IrdaProtocolNEC, 0, 0x0A, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, false}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, false}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x02, true}, + {IrdaProtocolNEC, 0xFF00, 0x06, false}, + {IrdaProtocolNEC, 0xFF00, 0x06, true}, + {IrdaProtocolNEC, 0xFF00, 0x04, false}, + {IrdaProtocolNEC, 0xFF00, 0x04, true}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, true}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, true}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x09, false}, + {IrdaProtocolNEC, 0xFF00, 0x09, false}, + {IrdaProtocolNEC, 0xFF00, 0x09, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x0A, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, true}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, true}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x0A, false}, + {IrdaProtocolNEC, 0xFF00, 0x08, false}, + {IrdaProtocolNEC, 0xFF00, 0x0A, false}, + {IrdaProtocolNEC, 0xFF00, 0x0A, true}, }; diff --git a/applications/tests/irda_decoder/test_data/irda_decoder_samsung_test_data.h b/applications/tests/irda_decoder/test_data/irda_decoder_samsung_test_data.srcdata similarity index 100% rename from applications/tests/irda_decoder/test_data/irda_decoder_samsung_test_data.h rename to applications/tests/irda_decoder/test_data/irda_decoder_samsung_test_data.srcdata diff --git a/applications/tests/test_index.c b/applications/tests/test_index.c index 2774a4bb..4319f58b 100644 --- a/applications/tests/test_index.c +++ b/applications/tests/test_index.c @@ -20,11 +20,9 @@ int32_t flipper_test_app(void* p) { if(test_result == 0) { // test passed notification_message(notification, &sequence_success); - notification_message(notification, &sequence_set_only_green_255); } else { // test failed notification_message(notification, &sequence_error); - notification_message(notification, &sequence_set_only_red_255); } furi_record_close("notification"); diff --git a/docker/syntax_check.sh b/docker/syntax_check.sh index d184be43..be74df29 100755 --- a/docker/syntax_check.sh +++ b/docker/syntax_check.sh @@ -14,7 +14,6 @@ C_FILES=$(find . \ -not \( -path './firmware/.obj' -prune \) \ -not \( -path './firmware/targets' -prune \) \ -not \( -path './assets' -prune \) \ - -not \( -path './applications/tests/irda_decoder/test_data' -prune \) \ -not \( -path ./lib -prune \) \ -name *.c -o -name *.h -o -name *.cpp)