mirror of
https://github.com/Genaker/LoraSA.git
synced 2026-04-30 18:42:46 +02:00
Add test for detect()
This commit is contained in:
@@ -47,11 +47,32 @@ void test_rssi(void)
|
||||
TEST_ASSERT_EQUAL_INT16_ARRAY(expect, samples, test_sz);
|
||||
}
|
||||
|
||||
void test_detect()
|
||||
{
|
||||
uint16_t samples[test_sz] = {20, 50, 55, 60, 0, 70, 75, 80, 0, 90, 0, 100, 110};
|
||||
bool result[test_sz];
|
||||
|
||||
size_t r = Scan::detect(samples, result, test_sz, 1);
|
||||
|
||||
bool expect[test_sz] = {1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1};
|
||||
|
||||
TEST_ASSERT_EQUAL_INT16(0, r);
|
||||
TEST_ASSERT_EQUAL_INT8_ARRAY(expect, result, test_sz);
|
||||
|
||||
r = Scan::detect(samples, result, test_sz, 2);
|
||||
|
||||
bool expect2[test_sz] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0};
|
||||
|
||||
TEST_ASSERT_EQUAL_INT16(1, r);
|
||||
TEST_ASSERT_EQUAL_INT8_ARRAY(expect2, result, test_sz);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
|
||||
RUN_TEST(test_rssi);
|
||||
RUN_TEST(test_detect);
|
||||
|
||||
UNITY_END();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user