diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-03-22 16:57:09 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-03-22 16:57:09 +0100 |
commit | aad1eaa291460509a5cf94092609ae22ebef5494 (patch) | |
tree | 72d6308a84449e85b00de84f27f0a613b46ef669 /test/SoilMoistureIoTest.cpp | |
parent | 0dc2cc6503386c809266ad6564ba675803cf8cc7 (diff) | |
download | ble-toys-aad1eaa291460509a5cf94092609ae22ebef5494.tar.gz ble-toys-aad1eaa291460509a5cf94092609ae22ebef5494.tar.bz2 ble-toys-aad1eaa291460509a5cf94092609ae22ebef5494.tar.xz ble-toys-aad1eaa291460509a5cf94092609ae22ebef5494.zip |
o Renaming SoilMoistureIo to SensorSample, moving to its own library.
Diffstat (limited to 'test/SoilMoistureIoTest.cpp')
-rw-r--r-- | test/SoilMoistureIoTest.cpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/test/SoilMoistureIoTest.cpp b/test/SoilMoistureIoTest.cpp deleted file mode 100644 index e7889d0..0000000 --- a/test/SoilMoistureIoTest.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "SoilMoistureIo.h" - -#define BOOST_TEST_MODULE "SoilMoistureIoTest" - -#include <boost/test/unit_test.hpp> - -using namespace trygvis::soil_moisture; - -BOOST_AUTO_TEST_CASE(key_value_parser) { - KeyDictionary dict; - - auto buffer = make_shared<VectorSampleOutputStream>(); - - auto parser = new KeyValueSampleStreamParser(buffer, dict); - - char data[] = "a=1, b=2, c=3\n"; - parser->process(boost::asio::buffer(data, sizeof(data))); - BOOST_CHECK_EQUAL(buffer->samples.size(), 1); - BOOST_CHECK_EQUAL(dict.size(), 3); - auto it = dict.begin(); - BOOST_CHECK_EQUAL((*it)->name, "a"); - BOOST_CHECK_EQUAL((*it++)->index, 0); - BOOST_CHECK_EQUAL((*it)->name, "b"); - BOOST_CHECK_EQUAL((*it++)->index, 1); - BOOST_CHECK_EQUAL((*it)->name, "c"); - BOOST_CHECK_EQUAL((*it++)->index, 2); -} - -BOOST_AUTO_TEST_CASE(key_value_parser_with_custom_dict) { - KeyDictionary dict; - - dict.indexOf("c"); - dict.indexOf("b"); - - auto buffer = make_shared<VectorSampleOutputStream>(); - - auto parser = new KeyValueSampleStreamParser(buffer, dict); - - char data[] = "a=1, b=2, c=3\n"; - parser->process(boost::asio::buffer(data, sizeof(data))); - BOOST_CHECK_EQUAL(buffer->samples.size(), 1); - BOOST_CHECK_EQUAL(dict.size(), 3); - auto it = dict.begin(); - BOOST_CHECK_EQUAL((*it)->name, "c"); - BOOST_CHECK_EQUAL((*it++)->index, 0); - BOOST_CHECK_EQUAL((*it)->name, "b"); - BOOST_CHECK_EQUAL((*it++)->index, 1); -} |