jwendelil4 | ee5bf28 | 2020-05-25 16:20:07 +0200 | [diff] [blame] | 1 | #include <gtest/gtest.h> |
jwendelil4 | ee5bf28 | 2020-05-25 16:20:07 +0200 | [diff] [blame] | 2 | |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 3 | #include <BaSyx/submodel/api_v2/dataspecification/IDataSpecificationContent.h> |
jwendelil4 | ee5bf28 | 2020-05-25 16:20:07 +0200 | [diff] [blame] | 4 | #include "BaSyx/submodel/map_v2/dataspecification/DataSpecification.h" |
| 5 | |
| 6 | using namespace basyx::submodel::map; |
| 7 | using namespace basyx::submodel; |
| 8 | |
| 9 | class DataSpecificationTest : public ::testing::Test |
| 10 | { |
| 11 | protected: |
| 12 | void SetUp() override |
| 13 | {} |
| 14 | |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 15 | class DataSpecificationContentMock |
| 16 | : public virtual api::IDataSpecificationContent |
| 17 | , public basyx::vab::ElementMap |
jwendelil4 | ee5bf28 | 2020-05-25 16:20:07 +0200 | [diff] [blame] | 18 | { |
| 19 | public: |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 20 | DataSpecificationContentMock() |
| 21 | : basyx::vab::ElementMap{} |
| 22 | {} |
| 23 | |
jwendelil4 | ee5bf28 | 2020-05-25 16:20:07 +0200 | [diff] [blame] | 24 | bool isMock() |
| 25 | { |
| 26 | return true; |
| 27 | } |
| 28 | }; |
| 29 | |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 30 | class DataSpecificationContentMock2 |
| 31 | : public virtual api::IDataSpecificationContent |
| 32 | , public basyx::vab::ElementMap |
jwendelil4 | ee5bf28 | 2020-05-25 16:20:07 +0200 | [diff] [blame] | 33 | { |
| 34 | public: |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 35 | DataSpecificationContentMock2() |
| 36 | : basyx::vab::ElementMap{} |
| 37 | {} |
| 38 | |
jwendelil4 | ee5bf28 | 2020-05-25 16:20:07 +0200 | [diff] [blame] | 39 | bool isMock2() |
| 40 | { |
| 41 | return true; |
| 42 | } |
| 43 | }; |
| 44 | }; |
| 45 | |
| 46 | TEST_F(DataSpecificationTest, TestConstructor) |
| 47 | { |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 48 | // simple::Identifier id; |
| 49 | // std::unique_ptr<api::IDataSpecificationContent> content = util::make_unique<DataSpecificationContentMock>(); |
| 50 | // DataSpecification dataSpecification("id", id, std::move(content)); |
| 51 | // |
| 52 | // ASSERT_EQ(dataSpecification.getIdShort(), "id"); |
| 53 | // ASSERT_TRUE(dataSpecification.getIdentification() == id); |
| 54 | // ASSERT_TRUE((dynamic_cast<DataSpecificationContentMock&>(dataSpecification.getContent())).isMock()); |
jwendelil4 | ee5bf28 | 2020-05-25 16:20:07 +0200 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | TEST_F(DataSpecificationTest, TestContent) |
| 58 | { |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 59 | // simple::Identifier id; |
| 60 | // std::unique_ptr<api::IDataSpecificationContent> content = util::make_unique<DataSpecificationContentMock>(); |
| 61 | // DataSpecification dataSpecification("id", id, std::move(content)); |
| 62 | // |
| 63 | // ASSERT_TRUE((dynamic_cast<DataSpecificationContentMock&>(dataSpecification.getContent())).isMock()); |
| 64 | // |
| 65 | // std::unique_ptr<api::IDataSpecificationContent> content2 = util::make_unique<DataSpecificationContentMock2>(); |
| 66 | // dataSpecification.setContent(std::move(content2)); |
| 67 | // ASSERT_TRUE((dynamic_cast<DataSpecificationContentMock2&>(dataSpecification.getContent())).isMock2()); |
jwendelil4 | ee5bf28 | 2020-05-25 16:20:07 +0200 | [diff] [blame] | 68 | } |