diff --git a/ecal/tests/cpp/serialization_test/src/common_generate.cpp b/ecal/tests/cpp/serialization_test/src/common_generate.cpp index a5cd9a7e06..e81fdfd610 100644 --- a/ecal/tests/cpp/serialization_test/src/common_generate.cpp +++ b/ecal/tests/cpp/serialization_test/src/common_generate.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,9 @@ * ========================= eCAL LICENSE ================================= */ +#include "common_generate.h" + #include -#include -#include namespace eCAL { diff --git a/ecal/tests/cpp/serialization_test/src/common_generate.h b/ecal/tests/cpp/serialization_test/src/common_generate.h new file mode 100644 index 0000000000..b8966feee9 --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/common_generate.h @@ -0,0 +1,30 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ + +#pragma once + +#include +#include + +namespace eCAL +{ + // Generate a random string of given length (may contain null character) + std::string GenerateString(size_t length); + std::vector GenerateRandomVector(size_t length); +} diff --git a/ecal/tests/cpp/serialization_test/src/logging_compare.cpp b/ecal/tests/cpp/serialization_test/src/logging_compare.cpp index cd1512d67a..cf8b004cef 100644 --- a/ecal/tests/cpp/serialization_test/src/logging_compare.cpp +++ b/ecal/tests/cpp/serialization_test/src/logging_compare.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ * ========================= eCAL LICENSE ================================= */ -#include +#include "logging_compare.h" namespace eCAL { diff --git a/ecal/tests/cpp/serialization_test/src/logging_compare.h b/ecal/tests/cpp/serialization_test/src/logging_compare.h new file mode 100644 index 0000000000..1e5c9dfa73 --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/logging_compare.h @@ -0,0 +1,30 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ + +#pragma once +#include + +namespace eCAL +{ + namespace Logging + { + // compare two LogMessages for equality + bool CompareLogMessages(const SLogMessage& message1, const SLogMessage& message2); + } +} \ No newline at end of file diff --git a/ecal/tests/cpp/serialization_test/src/logging_generate.cpp b/ecal/tests/cpp/serialization_test/src/logging_generate.cpp index 03fe313402..f871a18e65 100644 --- a/ecal/tests/cpp/serialization_test/src/logging_generate.cpp +++ b/ecal/tests/cpp/serialization_test/src/logging_generate.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,13 @@ * ========================= eCAL LICENSE ================================= */ -#include +#include "logging_generate.h" +#include "common_generate.h" #include namespace eCAL { - std::string GenerateString(size_t length); - namespace Logging { SLogMessage GenerateLogMessage() diff --git a/ecal/tests/cpp/serialization_test/src/logging_generate.h b/ecal/tests/cpp/serialization_test/src/logging_generate.h new file mode 100644 index 0000000000..daab8f208c --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/logging_generate.h @@ -0,0 +1,29 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ + +#pragma once +#include + +namespace eCAL +{ + namespace Logging + { + SLogMessage GenerateLogMessage(); + } +} \ No newline at end of file diff --git a/ecal/tests/cpp/serialization_test/src/logging_serialization_test.cpp b/ecal/tests/cpp/serialization_test/src/logging_serialization_test.cpp index 6c2badb85f..c9587b0d52 100644 --- a/ecal/tests/cpp/serialization_test/src/logging_serialization_test.cpp +++ b/ecal/tests/cpp/serialization_test/src/logging_serialization_test.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,10 @@ * ========================= eCAL LICENSE ================================= */ -#include "../../serialization/ecal_serialize_logging.h" +#include + +#include "logging_generate.h" +#include "logging_compare.h" #include @@ -25,9 +28,6 @@ namespace eCAL { namespace Logging { - SLogMessage GenerateLogMessage(); - bool CompareLogMessages(const SLogMessage& message1, const SLogMessage& message2); - TEST(core_cpp_serialization, LogMessage2String) { SLogMessage message_in = GenerateLogMessage(); diff --git a/ecal/tests/cpp/serialization_test/src/monitoring_compare.cpp b/ecal/tests/cpp/serialization_test/src/monitoring_compare.cpp index 4081a580f9..74f5c61021 100644 --- a/ecal/tests/cpp/serialization_test/src/monitoring_compare.cpp +++ b/ecal/tests/cpp/serialization_test/src/monitoring_compare.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ * ========================= eCAL LICENSE ================================= */ +#include "monitoring_compare.h" + #include namespace eCAL diff --git a/ecal/tests/cpp/serialization_test/src/monitoring_compare.h b/ecal/tests/cpp/serialization_test/src/monitoring_compare.h new file mode 100644 index 0000000000..4d502e6942 --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/monitoring_compare.h @@ -0,0 +1,31 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ + +#pragma once + +#include + +namespace eCAL +{ + namespace Monitoring + { + // compare two monitoring structs + bool CompareMonitorings(const SMonitoring& monitoring1, const SMonitoring& monitoring2); + } +} diff --git a/ecal/tests/cpp/serialization_test/src/monitoring_generate.cpp b/ecal/tests/cpp/serialization_test/src/monitoring_generate.cpp index 3cffe86d18..e2c4aff2d8 100644 --- a/ecal/tests/cpp/serialization_test/src/monitoring_generate.cpp +++ b/ecal/tests/cpp/serialization_test/src/monitoring_generate.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,13 @@ * ========================= eCAL LICENSE ================================= */ -#include +#include "monitoring_generate.h" +#include "common_generate.h" #include namespace eCAL { - std::string GenerateString(size_t length); - namespace Monitoring { // generate process diff --git a/ecal/tests/cpp/serialization_test/src/monitoring_generate.h b/ecal/tests/cpp/serialization_test/src/monitoring_generate.h new file mode 100644 index 0000000000..2099f64c7b --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/monitoring_generate.h @@ -0,0 +1,46 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ + +#pragma once + +#include + +namespace eCAL +{ + namespace Monitoring + { + // generate process + SProcessMon GenerateProcess(); + + // generate topic + STopicMon GenerateTopic(const std::string& direction); + + // generate servicemethod + SMethodMon GenerateServiceMethod(); + + // generate service + SServerMon GenerateService(); + + // generate client + SClientMon GenerateClient(); + + // generate monitoring + SMonitoring GenerateMonitoring(); + } +} diff --git a/ecal/tests/cpp/serialization_test/src/monitoring_serialization_test.cpp b/ecal/tests/cpp/serialization_test/src/monitoring_serialization_test.cpp index b2dd57aeef..eb6f071fb2 100644 --- a/ecal/tests/cpp/serialization_test/src/monitoring_serialization_test.cpp +++ b/ecal/tests/cpp/serialization_test/src/monitoring_serialization_test.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,9 @@ * ========================= eCAL LICENSE ================================= */ -#include "../../serialization/ecal_serialize_monitoring.h" +#include +#include "monitoring_generate.h" +#include "monitoring_compare.h" #include @@ -25,9 +27,6 @@ namespace eCAL { namespace Monitoring { - SMonitoring GenerateMonitoring(); - bool CompareMonitorings(const SMonitoring& monitoring1, const SMonitoring& monitoring2); - TEST(core_cpp_serialization, Monitoring2String) { SMonitoring message_in = GenerateMonitoring(); diff --git a/ecal/tests/cpp/serialization_test/src/parallel_serialization_test.cpp b/ecal/tests/cpp/serialization_test/src/parallel_serialization_test.cpp new file mode 100644 index 0000000000..ccfd289f89 --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/parallel_serialization_test.cpp @@ -0,0 +1,70 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ + +#include "serialization/ecal_serialize_logging.h" +#include "serialization/ecal_serialize_sample_registration.h" + +#include "registration_generate.h" +#include "logging_generate.h" + +#include +#include + + +namespace eCAL +{ + void SerializeLogMessage() + { + Logging::SLogMessage message_in = Logging::GenerateLogMessage(); + + for (int i = 0; i < 10000; ++i) + { + std::string message_buffer; + SerializeToBuffer(message_in, message_buffer); + + Logging::SLogMessage message_out; + DeserializeFromBuffer(message_buffer.data(), message_buffer.size(), message_out); + } + } + + void SerializePayloadMessage() + { + Registration::Sample message_in = Registration::GenerateTopicSample(); + + for (int i = 0; i < 10000; ++i) + { + std::string message_buffer; + SerializeToBuffer(message_in, message_buffer); + + Registration::Sample message_out; + DeserializeFromBuffer(message_buffer.data(), message_buffer.size(), message_out); + } + } + + + TEST(core_cpp_serialization, ParallelSerialization) + { + std::thread logging_serializer_thread(SerializeLogMessage); + std::thread sample_serializer_thread(SerializePayloadMessage); + + logging_serializer_thread.join(); + sample_serializer_thread.join(); + } + +} diff --git a/ecal/tests/cpp/serialization_test/src/payload_compare.cpp b/ecal/tests/cpp/serialization_test/src/payload_compare.cpp index e6fa01482d..50266d51e3 100644 --- a/ecal/tests/cpp/serialization_test/src/payload_compare.cpp +++ b/ecal/tests/cpp/serialization_test/src/payload_compare.cpp @@ -17,7 +17,9 @@ * ========================= eCAL LICENSE ================================= */ -#include "../../serialization/ecal_struct_sample_payload.h" +#include "payload_compare.h" + +#include namespace eCAL { diff --git a/ecal/tests/cpp/serialization_test/src/payload_compare.h b/ecal/tests/cpp/serialization_test/src/payload_compare.h new file mode 100644 index 0000000000..a0c86a9f22 --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/payload_compare.h @@ -0,0 +1,29 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ + +#include + +namespace eCAL +{ + namespace Payload + { + // compare two samples for equality + bool ComparePayloadSamples(const Sample& sample1, const Sample& sample2); + } +} diff --git a/ecal/tests/cpp/serialization_test/src/payload_generate.cpp b/ecal/tests/cpp/serialization_test/src/payload_generate.cpp index b153a21fee..45ed68970b 100644 --- a/ecal/tests/cpp/serialization_test/src/payload_generate.cpp +++ b/ecal/tests/cpp/serialization_test/src/payload_generate.cpp @@ -17,15 +17,14 @@ * ========================= eCAL LICENSE ================================= */ -#include "../../serialization/ecal_struct_sample_payload.h" +#include "payload_generate.h" +#include "common_generate.h" +#include #include namespace eCAL { - std::string GenerateString(size_t length); - std::vector GenerateRandomVector(size_t length); - namespace Payload { // generate Topic diff --git a/ecal/tests/cpp/serialization_test/src/payload_generate.h b/ecal/tests/cpp/serialization_test/src/payload_generate.h new file mode 100644 index 0000000000..ce8286afe8 --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/payload_generate.h @@ -0,0 +1,49 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ + +#include + +#include + +namespace eCAL +{ + namespace Payload + { + // generate Topic + TopicInfo GenerateTopic(); + + // generate Payload + Payload GeneratePayload(const char* payload_addr, size_t payload_size); + + // generate Payload + Payload GeneratePayload(const std::vector& payload_vec); + + // generate Content + Content GenerateContent(const char* payload_addr, size_t payload_size); + + // generate Content + Content GenerateContent(const std::vector& payload_vec); + + // generate Payload Sample (payload raw pointer + size) + Sample GeneratePayloadSample(const char* payload_addr, size_t payload_size); + + // generate Payload Sample (payload vector) + Sample GeneratePayloadSample(const std::vector& payload_vec); + } +} diff --git a/ecal/tests/cpp/serialization_test/src/payload_serialization_test.cpp b/ecal/tests/cpp/serialization_test/src/payload_serialization_test.cpp index 4f42d055d8..dc9d4519ef 100644 --- a/ecal/tests/cpp/serialization_test/src/payload_serialization_test.cpp +++ b/ecal/tests/cpp/serialization_test/src/payload_serialization_test.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,10 @@ * ========================= eCAL LICENSE ================================= */ -#include "../../serialization/ecal_serialize_sample_payload.h" +#include + +#include "payload_generate.h" +#include "payload_compare.h" #include #include @@ -44,11 +47,6 @@ namespace eCAL { namespace Payload { - Sample GeneratePayloadSample(const char* payload_addr, size_t payload_size); - Sample GeneratePayloadSample(const std::vector& payload_vec); - - bool ComparePayloadSamples(const Sample& sample1, const Sample& sample2); - TEST(core_cpp_serialization, RawPayload2String) { std::vector payload; diff --git a/ecal/tests/cpp/serialization_test/src/registration_serialization_test.cpp b/ecal/tests/cpp/serialization_test/src/registration_serialization_test.cpp index 0478247cf1..f184dc08e4 100644 --- a/ecal/tests/cpp/serialization_test/src/registration_serialization_test.cpp +++ b/ecal/tests/cpp/serialization_test/src/registration_serialization_test.cpp @@ -17,7 +17,7 @@ * ========================= eCAL LICENSE ================================= */ -#include "../../serialization/ecal_serialize_sample_registration.h" +#include #include "registration_generate.h" #include @@ -26,8 +26,6 @@ namespace eCAL { namespace Registration { - bool CompareRegistrationSamples(const Sample& sample1, const Sample& sample2); - class RegistrationSampleSerializationTest : public ::testing::Test { public: @@ -54,7 +52,7 @@ namespace eCAL Sample sample_out; EXPECT_TRUE(DeserializeFromBuffer(sample_buffer.data(), sample_buffer.size(), sample_out)); - EXPECT_TRUE(CompareRegistrationSamples(sample_in, sample_out)); + EXPECT_EQ(sample_in, sample_out); } } @@ -68,7 +66,7 @@ namespace eCAL Sample sample_out; EXPECT_TRUE(DeserializeFromBuffer(sample_buffer.data(), sample_buffer.size(), sample_out)); - EXPECT_TRUE(CompareRegistrationSamples(sample_in, sample_out)); + EXPECT_EQ(sample_in, sample_out); } } @@ -87,7 +85,7 @@ namespace eCAL EXPECT_TRUE(DeserializeFromBuffer(sample_buffer.data(), sample_buffer.size(), sample_list_out)); EXPECT_TRUE(sample_list_in.size() == sample_list_out.size()); - EXPECT_TRUE(std::equal(sample_list_in.begin(), sample_list_in.end(), sample_list_out.begin(), CompareRegistrationSamples)); + EXPECT_EQ(sample_list_in, sample_list_out); } TEST_F(core_cpp_registration_serialization, RegistrationList2Vector) @@ -105,7 +103,7 @@ namespace eCAL EXPECT_TRUE(DeserializeFromBuffer(sample_buffer.data(), sample_buffer.size(), sample_list_out)); EXPECT_TRUE(sample_list_in.size() == sample_list_out.size()); - EXPECT_TRUE(std::equal(sample_list_in.begin(), sample_list_in.end(), sample_list_out.begin(), CompareRegistrationSamples)); + EXPECT_EQ(sample_list_in, sample_list_out); } } } diff --git a/ecal/tests/cpp/serialization_test/src/service_compare.cpp b/ecal/tests/cpp/serialization_test/src/service_compare.cpp index 981a1ab150..1cf1200cbf 100644 --- a/ecal/tests/cpp/serialization_test/src/service_compare.cpp +++ b/ecal/tests/cpp/serialization_test/src/service_compare.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ * ========================= eCAL LICENSE ================================= */ -#include "../../serialization/ecal_struct_service.h" +#include "service_compare.h" namespace eCAL { diff --git a/ecal/tests/cpp/serialization_test/src/service_compare.h b/ecal/tests/cpp/serialization_test/src/service_compare.h new file mode 100644 index 0000000000..46d9234e2e --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/service_compare.h @@ -0,0 +1,35 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ +#pragma once + +#include + +namespace eCAL +{ + namespace Service + { + // compare two ServiceHeaders for equality + bool CompareServiceHeaders(const ServiceHeader& header1, const ServiceHeader& header2); + + bool CompareRequests(const Request& request1, const Request& request2); + + // compare two Responses for equality + bool CompareResponses(const Response& response1, const Response& response2); + } +} diff --git a/ecal/tests/cpp/serialization_test/src/service_generate.cpp b/ecal/tests/cpp/serialization_test/src/service_generate.cpp index 70dc55759a..61fa5d2b95 100644 --- a/ecal/tests/cpp/serialization_test/src/service_generate.cpp +++ b/ecal/tests/cpp/serialization_test/src/service_generate.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,14 @@ * ========================= eCAL LICENSE ================================= */ -#include "../../serialization/ecal_struct_service.h" +#include "service_generate.h" +#include "common_generate.h" +#include #include namespace eCAL { - std::string GenerateString(size_t length); - namespace Service { // generate ServiceHeader diff --git a/ecal/tests/cpp/serialization_test/src/service_generate.h b/ecal/tests/cpp/serialization_test/src/service_generate.h new file mode 100644 index 0000000000..40c4ca8366 --- /dev/null +++ b/ecal/tests/cpp/serialization_test/src/service_generate.h @@ -0,0 +1,37 @@ +/* ========================= eCAL LICENSE ================================= + * + * Copyright (C) 2016 - 2024 Continental Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ========================= eCAL LICENSE ================================= +*/ + +#pragma once + +#include + +namespace eCAL +{ + namespace Service + { + // generate ServiceHeader + ServiceHeader GenerateServiceHeader(); + + // generate Request + Request GenerateRequest(); + + // generate Response + Response GenerateResponse(); + } +} diff --git a/ecal/tests/cpp/serialization_test/src/service_serialization_test.cpp b/ecal/tests/cpp/serialization_test/src/service_serialization_test.cpp index 06672857dc..f44896b6c8 100644 --- a/ecal/tests/cpp/serialization_test/src/service_serialization_test.cpp +++ b/ecal/tests/cpp/serialization_test/src/service_serialization_test.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,9 @@ * ========================= eCAL LICENSE ================================= */ -#include "../../serialization/ecal_serialize_service.h" +#include +#include "service_compare.h" +#include "service_generate.h" #include @@ -25,12 +27,6 @@ namespace eCAL { namespace Service { - Request GenerateRequest(); - bool CompareRequests(const Request& request1, const Request& request2); - - Response GenerateResponse(); - bool CompareResponses(const Response& response1, const Response& response2); - TEST(core_cpp_serialization, Request2String) { Request sample_in = GenerateRequest();