36 lines
648 B
C++
36 lines
648 B
C++
|
|
#include <unity.h>
|
|
#include <Arduino.h>
|
|
#include "config.h"
|
|
#include "sensor433.h"
|
|
|
|
|
|
// somehow not possible to use method from sensor433.h/cpp, linking fails:
|
|
uint8_t add_device_id(uint8_t value, uint8_t device_id) {
|
|
return value |= device_id;
|
|
}
|
|
|
|
|
|
|
|
void test_message_header() {
|
|
uint8_t header = MSG_START;
|
|
header = add_device_id(header, DEVICE_ID);
|
|
|
|
// 0x10 | 0x01 = 0x11
|
|
TEST_ASSERT_EQUAL(0x11, header);
|
|
|
|
// header
|
|
TEST_ASSERT_EQUAL(0x10, header & 0x10);
|
|
|
|
// id
|
|
TEST_ASSERT_EQUAL(0x01, header & 0x01);
|
|
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
UNITY_BEGIN();
|
|
RUN_TEST(test_message_header);
|
|
UNITY_END();
|
|
|
|
return 0;
|
|
} |