13#ifndef RTCTK_COMPONENTFRAMEWORK_TEST_REPOSITORYIFTESTSUITE_HPP
14#define RTCTK_COMPONENTFRAMEWORK_TEST_REPOSITORYIFTESTSUITE_HPP
16#include <boost/filesystem.hpp>
17#include <ciiLogManager.hpp>
18#include <gtest/gtest.h>
26using rtctk::componentFramework::operator
""_dppath;
153 EXPECT_EQ(adapter->
GetDataPointType(
"/datapoint"_dppath),
typeid(std::string));
173 EXPECT_EQ(adapter->
GetDataPointType(
"/datapoint"_dppath),
typeid(std::vector<int32_t>));
177 EXPECT_EQ(adapter->
GetDataPointType(
"/datapoint"_dppath),
typeid(std::vector<int64_t>));
181 EXPECT_EQ(adapter->
GetDataPointType(
"/datapoint"_dppath),
typeid(std::vector<float>));
185 EXPECT_EQ(adapter->
GetDataPointType(
"/datapoint"_dppath),
typeid(std::vector<double>));
210 ASSERT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, std::string(
"abcdefg")); });
215 ASSERT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, int32_t(123)); });
220 ASSERT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, int64_t(234)); });
225 ASSERT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath,
float(3.45)); });
230 ASSERT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath,
double(4.56)); });
235 ASSERT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, std::vector<int32_t>{1, 2, 3}); });
241 adapter->
SetDataPoint(
"/datapoint"_dppath, std::vector<int64_t>{2, 3, 4, 5});
248 adapter->
SetDataPoint(
"/datapoint"_dppath, std::vector<float>{3.4, 4.5, 5.6, 6.7, 7.8});
255 adapter->
SetDataPoint(
"/datapoint"_dppath, std::vector<double>{1.2, 2.4, 3.6});
296 EXPECT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, std::string(
"test string")); });
297 EXPECT_EQ(adapter->
GetDataPoint<std::string>(
"/datapoint"_dppath), std::string(
"test string"));
301 EXPECT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, int32_t(123)); });
302 EXPECT_EQ(adapter->
GetDataPoint<int32_t>(
"/datapoint"_dppath), int32_t(123));
306 EXPECT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, int64_t(234)); });
307 EXPECT_EQ(adapter->
GetDataPoint<int64_t>(
"/datapoint"_dppath), int64_t(234));
311 EXPECT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath,
float(3.45)); });
312 EXPECT_EQ(adapter->
GetDataPoint<
float>(
"/datapoint"_dppath),
float(3.45));
316 EXPECT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath,
double(4.56)); });
317 EXPECT_EQ(adapter->
GetDataPoint<
double>(
"/datapoint"_dppath),
double(4.56));
321 EXPECT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, std::vector<int32_t>{1, 2, 3}); });
324 EXPECT_EQ(adapter->
GetDataPoint<std::vector<int32_t>>(
"/datapoint"_dppath),
325 (std::vector<int32_t>{1, 2, 3}));
329 EXPECT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, std::vector<int64_t>{2, 3, 4}); });
330 EXPECT_EQ(adapter->
GetDataPoint<std::vector<int64_t>>(
"/datapoint"_dppath),
331 (std::vector<int64_t>{2, 3, 4}));
336 adapter->
SetDataPoint(
"/datapoint"_dppath, std::vector<float>{1.2, 2.3, 3.4});
338 EXPECT_EQ(adapter->
GetDataPoint<std::vector<float>>(
"/datapoint"_dppath),
339 (std::vector<float>{1.2, 2.3, 3.4}));
344 adapter->
SetDataPoint(
"/datapoint"_dppath, std::vector<double>{2.4, 3.6, 4.8});
346 EXPECT_EQ(adapter->
GetDataPoint<std::vector<double>>(
"/datapoint"_dppath),
347 (std::vector<double>{2.4, 3.6, 4.8}));
392 EXPECT_NO_THROW({ adapter->
SetDataPoint(
"/datapoint"_dppath, std::string(
"test string")); });
393 EXPECT_EQ(adapter->
GetDataPoint<std::string>(
"/datapoint"_dppath), std::string(
"test string"));
396 EXPECT_NO_THROW({ exists = adapter->
DataPointExists(
"/datapoint"_dppath); });
397 EXPECT_EQ(exists,
true);
400 EXPECT_NO_THROW({ exists = adapter->
DataPointExists(
"/datapoint"_dppath); });
401 EXPECT_EQ(exists,
false);
405 { adapter->
SetDataPoint(
"/datapoint/test"_dppath, std::string(
"test string")); });
406 EXPECT_EQ(adapter->
GetDataPoint<std::string>(
"/datapoint/test"_dppath),
407 std::string(
"test string"));
409 EXPECT_NO_THROW({ exists = adapter->
DataPointExists(
"/datapoint/test"_dppath); });
410 EXPECT_EQ(exists,
true);
411 EXPECT_NO_THROW({ exists = adapter->
DataPointExists(
"/datapoint"_dppath); });
412 EXPECT_EQ(exists,
false);
413 EXPECT_NO_THROW({ exists = adapter->
DataPointExists(
"/datapoint/test/data"_dppath); });
414 EXPECT_EQ(exists,
false);
417 EXPECT_NO_THROW({ exists = adapter->
DataPointExists(
"/datapoint/test"_dppath); });
418 EXPECT_EQ(exists,
false);
419 EXPECT_NO_THROW({ exists = adapter->
DataPointExists(
"/datapoint"_dppath); });
420 EXPECT_EQ(exists,
false);
424 DataPointCreationAndDeletion,
425 TypesAreReturnedCorrectly,
426 SizesAreReturnedCorrectly,
427 DataPointWriteAndRead,
428 DataPointExistanceConsistency);
A buffer class representing 2D matrix data.
Definition: matrixBuffer.hpp:28
Abstract interface providing basic read and write facilities to a repository.
Definition: repositoryIf.hpp:38
virtual const std::type_info & GetDataPointType(const DataPointPath &path) const =0
Fetches the type of the datapoint.
virtual size_t GetDataPointSize(const DataPointPath &path) const =0
Fetches the size of the datapoint's data.
T GetDataPoint(const DataPointPath &path) const
Fetches a datapoint from the repository.
Definition: repositoryIf.hpp:574
virtual void CreateDataPoint(const DataPointPath &path, const std::type_info &type)=0
Creates a new datapoint in the repository with a specified type.
void SetDataPoint(const DataPointPath &path, const T value)
Sets a datapoint in the repository.
Definition: repositoryIf.hpp:595
virtual void DeleteDataPoint(const DataPointPath &path)=0
Deletes a datapoint.
virtual bool DataPointExists(const DataPointPath &path) const =0
Checks for the existence of a datapoint in the repository.
A test suite for performing acceptance tests of a RepositoryIf implementation.
Definition: repositoryIfTestSuite.hpp:79
void CleanupRepository(std::shared_ptr< U > &adapter)
A cleanup function that is invoked before destroying a repository adapter of a given type.
Definition: repositoryIfTestSuite.hpp:112
std::shared_ptr< U > CreateRepository()
Constructs a new instance of a repository adapter that derives from RepositoryIf.
void SetUp() override
Definition: repositoryIfTestSuite.hpp:81
std::shared_ptr< T > m_adapter
Definition: repositoryIfTestSuite.hpp:117
void TearDown() override
Definition: repositoryIfTestSuite.hpp:85
Definition: fakeClock.cpp:15
TYPED_TEST_SUITE_P(RepositoryIfTestSuite)
REGISTER_TYPED_TEST_SUITE_P(RepositoryIfTestSuite, DataPointCreationAndDeletion, TypesAreReturnedCorrectly, SizesAreReturnedCorrectly, DataPointWriteAndRead, DataPointExistanceConsistency)
TYPED_TEST_P(RepositoryIfTestSuite, DataPointCreationAndDeletion)
Definition: repositoryIfTestSuite.hpp:124
Header file for RepositoryIf and related base classes.