upm/tests/unit/core/iUpmObject_tests.cxx
Noel Eck 0223cd2b85 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>
2018-04-02 11:01:18 -07:00

56 lines
1.4 KiB
C++

#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();
}
*/