blob: 633712e68a6e9558269f1daf3c35d99904ed746d [file] [log] [blame]
jwendelil4ee5bf282020-05-25 16:20:07 +02001#include <gtest/gtest.h>
jwendelil4ee5bf282020-05-25 16:20:07 +02002
Constantin Ziesche02817f12020-08-04 21:40:43 +02003#include <BaSyx/submodel/api_v2/dataspecification/IDataSpecificationContent.h>
jwendelil4ee5bf282020-05-25 16:20:07 +02004#include "BaSyx/submodel/map_v2/dataspecification/DataSpecification.h"
5
6using namespace basyx::submodel::map;
7using namespace basyx::submodel;
8
9class DataSpecificationTest : public ::testing::Test
10{
11protected:
12 void SetUp() override
13 {}
14
Constantin Ziesche02817f12020-08-04 21:40:43 +020015class DataSpecificationContentMock
16 : public virtual api::IDataSpecificationContent
17 , public basyx::vab::ElementMap
jwendelil4ee5bf282020-05-25 16:20:07 +020018 {
19 public:
Constantin Ziesche02817f12020-08-04 21:40:43 +020020 DataSpecificationContentMock()
21 : basyx::vab::ElementMap{}
22 {}
23
jwendelil4ee5bf282020-05-25 16:20:07 +020024 bool isMock()
25 {
26 return true;
27 }
28 };
29
Constantin Ziesche02817f12020-08-04 21:40:43 +020030class DataSpecificationContentMock2
31 : public virtual api::IDataSpecificationContent
32 , public basyx::vab::ElementMap
jwendelil4ee5bf282020-05-25 16:20:07 +020033 {
34 public:
Constantin Ziesche02817f12020-08-04 21:40:43 +020035 DataSpecificationContentMock2()
36 : basyx::vab::ElementMap{}
37 {}
38
jwendelil4ee5bf282020-05-25 16:20:07 +020039 bool isMock2()
40 {
41 return true;
42 }
43 };
44};
45
46TEST_F(DataSpecificationTest, TestConstructor)
47{
Constantin Ziesche02817f12020-08-04 21:40:43 +020048// 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());
jwendelil4ee5bf282020-05-25 16:20:07 +020055}
56
57TEST_F(DataSpecificationTest, TestContent)
58{
Constantin Ziesche02817f12020-08-04 21:40:43 +020059// 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());
jwendelil4ee5bf282020-05-25 16:20:07 +020068}