Merge branch 'v1.0.1'
This commit is contained in:
commit
bf8439bdd1
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.pio/
|
||||||
|
.vscode/
|
||||||
47
library.json
47
library.json
@ -1,27 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "ha-mqtt",
|
"$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
|
||||||
"version": "1.0.0",
|
"name": "ha-mqtt",
|
||||||
"description": "Home Assistant classes for integration with MQTT auto discovery",
|
"version": "1.0.1",
|
||||||
"repository":
|
"description": "Home Assistant classes for integration with MQTT auto discovery",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.hodos.ro/arduino/ha-mqtt.git"
|
||||||
|
},
|
||||||
|
"authors": [
|
||||||
{
|
{
|
||||||
"type": "git",
|
"name": "Nicu Hodos",
|
||||||
"url": "https://git.hodos.ro/arduino/ha-mqtt.git"
|
"email": "nicu@hodos.ro",
|
||||||
},
|
"maintainer": true
|
||||||
"authors":
|
}
|
||||||
[
|
],
|
||||||
{
|
"dependencies": {
|
||||||
"name": "Nicu Hodos",
|
"bblanchon/ArduinoJson": "6.21.5",
|
||||||
"email": "nicu@hodos.ro",
|
"marvinroger/AsyncMqttClient": "^0.9.0"
|
||||||
"maintainer": true
|
},
|
||||||
}
|
"license": "MIT",
|
||||||
],
|
"frameworks": "arduino",
|
||||||
"dependencies":
|
"platforms": "*"
|
||||||
{
|
}
|
||||||
"bblanchon/ArduinoJson": "6.21.5",
|
|
||||||
"arkhipenko/TaskScheduler": "^3.7.0",
|
|
||||||
"marvinroger/AsyncMqttClient": "^0.9.0"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"frameworks": "arduino",
|
|
||||||
"platforms": "*"
|
|
||||||
}
|
|
||||||
16
platformio.ini
Normal file
16
platformio.ini
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
; PlatformIO Project Configuration File
|
||||||
|
;
|
||||||
|
; Build options: build flags, source filter
|
||||||
|
; Upload options: custom upload port, speed and extra flags
|
||||||
|
; Library options: dependencies, extra library storages
|
||||||
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
|
; Please visit documentation for the other options and examples
|
||||||
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[platformio]
|
||||||
|
default_envs = native
|
||||||
|
|
||||||
|
[env:native]
|
||||||
|
platform = native
|
||||||
|
debug_build_flags = -std=c++11
|
||||||
@ -30,6 +30,7 @@ struct List {
|
|||||||
delete c;
|
delete c;
|
||||||
c = n;
|
c = n;
|
||||||
}
|
}
|
||||||
|
first = last = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
11
test/README
Normal file
11
test/README
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
This directory is intended for PlatformIO Unit Testing 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/page/plus/unit-testing.html
|
||||||
42
test/utils.cpp
Normal file
42
test/utils.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <unity.h>
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
void setUp(void) {
|
||||||
|
// set stuff up here
|
||||||
|
}
|
||||||
|
|
||||||
|
void tearDown(void) {
|
||||||
|
// clean stuff up here
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_add(void) {
|
||||||
|
List<int> list;
|
||||||
|
int value = 10;
|
||||||
|
list.add(&value);
|
||||||
|
TEST_ASSERT_EQUAL(value, *list.last->t);
|
||||||
|
TEST_ASSERT_EQUAL_PTR(list.first, list.last);
|
||||||
|
|
||||||
|
int value2 = 12;
|
||||||
|
list.add(&value2);
|
||||||
|
TEST_ASSERT_EQUAL(value2, *list.last->t);
|
||||||
|
TEST_ASSERT_EQUAL_PTR(list.first->next, list.last);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_empty(void) {
|
||||||
|
List<int> list;
|
||||||
|
int value = 10;
|
||||||
|
list.add(&value);
|
||||||
|
list.add(&value);
|
||||||
|
list.empty();
|
||||||
|
TEST_ASSERT_EQUAL_PTR(nullptr, list.first);
|
||||||
|
TEST_ASSERT_EQUAL_PTR(list.first, list.last);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
UNITY_BEGIN();
|
||||||
|
RUN_TEST(test_add);
|
||||||
|
RUN_TEST(test_empty);
|
||||||
|
UNITY_END();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user