Unit tests: fix IRDA test data (#488)

* Unit tests: fix IRDA test data
* Fix format-errors on test data files
* Fix sticking red/green light on unit-tests

Co-authored-by: あく <alleteam@gmail.com>
Co-authored-by: Albert Kharisov <albert@flipperdevices.com>
This commit is contained in:
SG 2021-05-25 19:43:14 +10:00 committed by GitHub
parent 19644f6af5
commit 1a1c5fa05d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 60 deletions

View File

@ -1,8 +1,8 @@
#include <furi.h>
#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))

View File

@ -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},
};

View File

@ -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");

View File

@ -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)