mirror of
https://github.com/eclipse/upm.git
synced 2025-03-25 09:49:59 +03:00

Adding base classes for UPM sensors and actuators. Signed-off-by: Noel Eck <noel.eck@intel.com>
56 lines
1.4 KiB
C++
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();
|
|
}
|
|
*/
|