Added testing framework
All checks were successful
Generate Documentation / build (push) Successful in 36s
All checks were successful
Generate Documentation / build (push) Successful in 36s
This commit is contained in:
@@ -12,3 +12,4 @@
|
|||||||
platform = atmelsam
|
platform = atmelsam
|
||||||
board = nano_33_iot
|
board = nano_33_iot
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
lib_deps = throwtheswitch/Unity@^2.6.0
|
||||||
|
|||||||
11
test/README
11
test/README
@@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
This directory is intended for PlatformIO Test Runner and project tests.
|
|
||||||
|
|
||||||
Unit Testing is a software testing method by which individual units of
|
|
||||||
source code, sets of one or more MCU program modules together with associated
|
|
||||||
control data, usage procedures, and operating procedures, are tested to
|
|
||||||
determine whether they are fit for use. Unit testing finds problems early
|
|
||||||
in the development cycle.
|
|
||||||
|
|
||||||
More information about PlatformIO Unit Testing:
|
|
||||||
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
|
||||||
43
test/test_user_functions.cpp
Normal file
43
test/test_user_functions.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
#include <unity.h>
|
||||||
|
|
||||||
|
void setUp(void)
|
||||||
|
{
|
||||||
|
// set stuff up here
|
||||||
|
}
|
||||||
|
|
||||||
|
void tearDown(void)
|
||||||
|
{
|
||||||
|
// clean stuff up here
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_function_should_doBlahAndBlah(void)
|
||||||
|
{
|
||||||
|
TEST_ASSERT_TRUE(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_function_should_doAlsoDoBlah(void)
|
||||||
|
{
|
||||||
|
TEST_ASSERT_TRUE(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int runUnityTests(void)
|
||||||
|
{
|
||||||
|
UNITY_BEGIN();
|
||||||
|
RUN_TEST(test_function_should_doBlahAndBlah);
|
||||||
|
RUN_TEST(test_function_should_doAlsoDoBlah);
|
||||||
|
return UNITY_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Arduino framework
|
||||||
|
*/
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
// Wait ~2 seconds before the Unity test runner
|
||||||
|
// establishes connection with a board Serial interface
|
||||||
|
delay(2000);
|
||||||
|
|
||||||
|
runUnityTests();
|
||||||
|
}
|
||||||
|
void loop() {}
|
||||||
Reference in New Issue
Block a user