Skip to content

Commit

Permalink
Add testing to travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
curieos committed Jun 17, 2020
1 parent 389964b commit a202e4e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 25 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ install:
- platformio update

script:
- platformio test
- platformio run


Expand Down
25 changes: 0 additions & 25 deletions test/test_config.cpp

This file was deleted.

50 changes: 50 additions & 0 deletions test/test_embedded/test_sensor.cpp
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() {

}

0 comments on commit a202e4e

Please sign in to comment.