C++ Core: Add base class per sensor/actuator type

Adding base classes for UPM sensors and actuators.

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck
2017-06-08 13:50:09 -07:00
parent b55501e327
commit 0223cd2b85
184 changed files with 4462 additions and 1099 deletions

View File

@ -0,0 +1,55 @@
#include "gtest/gtest.h"
#include "iUpmObject.hpp"
#include "iSensorType.hpp"
class TestSensorClass : public virtual upm::iUpmObject
{
};
/* Interfaces test fixture */
class iUpmObject_unit : public ::testing::Test
{
protected:
/* One-time setup logic if needed */
iUpmObject_unit()
{
/* Load a specific JSON library descriptor file */
obj.initFromJsonLibDesc("./sensortype_example.json");
}
/* One-time tear-down logic if needed */
virtual ~iUpmObject_unit() {}
/* Per-test setup logic if needed */
virtual void SetUp() {}
/* Per-test tear-down logic if needed */
virtual void TearDown() {}
/* Instance of the test class */
TestSensorClass obj;
};
TEST_F(iUpmObject_unit, test_json_basic)
{
/* Basic checking */
ASSERT_EQ(obj.DerivedClassName(), "TestSensorClass");
ASSERT_EQ(obj.Description(), "This is a description");
ASSERT_EQ(obj.LibraryBaseName(), "core_tests");
ASSERT_EQ(obj.Name(), "TestSensorClass");
}
TEST_F(iUpmObject_unit, test_json_deserialize_basic)
{
/* Basic checking */
ASSERT_EQ(obj.Name(), "TestSensorClass");
ASSERT_EQ(obj.Description(), "This is a description");
}
/* Currently no need for a custom main (use gtest's)
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
*/