Skip to content
Snippets Groups Projects
Commit 859d306a authored by Zoe Pfister's avatar Zoe Pfister :speech_balloon:
Browse files

Merge branch 'espnow' into 'develop'

add message tests

See merge request !4
parents 1117e58d 415aed45
No related branches found
No related tags found
6 merge requests!39Merge Develop into Main,!19development into master,!17Inital Host, initial Client,!10merge serial comm and sd write into espnow,!4add message tests,!3Merge Branch `develop` into `sensor_readout`
#include "TestESPNow.hpp"
void test_on_data_recv_valid_config()
{
uint8_t mac_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
int len = 0;
config conf = {host : {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}, time_millis : 0};
// preferences / hostinfo would need to be global for this to work
TEST_FAIL();
}
#pragma once
#include <Arduino.h>
#include <ESPNow.hpp>
#include <unity.h>
void test_on_data_recv_valid_config();
\ No newline at end of file
#include "TestMessage.hpp"
void test_on_data_recv()
{
Message message = Message{};
TEST_ASSERT_EQUAL(0, message.getData().amountData);
}
void test_new_message_filled()
{
Message message = Message{};
message.add_data(1.1, 0);
message.add_data(1.2, 1);
message.add_data(1.3, 2);
float expectedValuesArray[] = {1.1, 1.2, 1.3};
int expectedIdentifiersArray[] = {0, 1, 2};
TEST_ASSERT_EQUAL(3, message.getData().amountData);
TEST_ASSERT_EQUAL_FLOAT_ARRAY(expectedValuesArray, message.getData().values, 3);
TEST_ASSERT_EQUAL_INT_ARRAY(expectedIdentifiersArray, message.getData().identifiers, 3);
}
\ No newline at end of file
#pragma once
#include <Arduino.h>
#include <ESPNow.hpp>
#include <unity.h>
void test_on_data_recv();
void test_new_message_filled();
\ No newline at end of file
#include "TestESPNow.hpp"
#include "TestMessage.hpp"
#include <Arduino.h>
#include <unity.h>
void setup()
{
delay(2000); // service delay
UNITY_BEGIN();
RUN_TEST(test_on_data_recv_valid_config);
RUN_TEST(test_on_data_recv);
RUN_TEST(test_new_message_filled);
UNITY_END();
}
void loop() {}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment