-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ install: | |
- platformio update | ||
|
||
script: | ||
- platformio test | ||
- platformio run | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* File: test_thing.cpp | ||
* Project: test_embedded | ||
* File Created: Tuesday, 16th June 2020 18:32:27 | ||
* Author: Caroline ([email protected]) | ||
* ----- | ||
* Last Modified: Tuesday June 16th 2020 19:57:33 | ||
* Modified By: Caroline | ||
* ----- | ||
* License: MIT License | ||
*/ | ||
|
||
#include <Arduino.h> | ||
#include <unity.h> | ||
|
||
#include "plant/sensors/sensor.h" | ||
|
||
class DummySensor : public Sensor { | ||
public: | ||
DummySensor() : Sensor::Sensor("dummySensor") { } | ||
float ReadData() override { | ||
return 1.0; | ||
} | ||
|
||
std::vector<SensorData> GetData() { | ||
return this->data_history; | ||
} | ||
}; | ||
|
||
void TestRecordData(void) { | ||
DummySensor dummy; | ||
struct tm time; | ||
dummy.RecordData(&time); | ||
auto data = dummy.GetData(); | ||
TEST_ASSERT_EQUAL_FLOAT(1.0, data.front().value); | ||
} | ||
|
||
void RunTests() { | ||
RUN_TEST(TestRecordData); | ||
} | ||
|
||
void setup() { | ||
UNITY_BEGIN(); | ||
RunTests(); | ||
UNITY_END(); | ||
} | ||
|
||
void loop() { | ||
|
||
} |