mirror of
https://github.com/eclipse/upm.git
synced 2025-07-27 06:01:16 +03:00
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:
55
tests/unit/core/iUpmObject_tests.cxx
Normal file
55
tests/unit/core/iUpmObject_tests.cxx
Normal 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();
|
||||
}
|
||||
*/
|
Reference in New Issue
Block a user