Skip to content

Commit

Permalink
[core] Parallel serialization test. (#1778)
Browse files Browse the repository at this point in the history
* Add a parallel serialization test
* Add header files for serialization test.
  • Loading branch information
KerstinKeller authored Nov 8, 2024
1 parent fe2a857 commit 066471a
Show file tree
Hide file tree
Showing 26 changed files with 446 additions and 226 deletions.
12 changes: 11 additions & 1 deletion ecal/tests/cpp/serialization_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,30 @@ set(ecal_serialize_src

set(unit_test_src
src/common_generate.cpp
src/common_generate.h
src/logging_compare.cpp
src/logging_compare.h
src/logging_generate.cpp
src/logging_generate.h
src/logging_serialization_test.cpp
src/monitoring_compare.cpp
src/monitoring_compare.h
src/monitoring_generate.cpp
src/monitoring_generate.h
src/monitoring_serialization_test.cpp
src/parallel_serialization_test.cpp
src/payload_compare.cpp
src/payload_compare.h
src/payload_generate.cpp
src/payload_generate.h
src/payload_serialization_test.cpp
src/registration_compare.cpp
src/registration_generate.cpp
src/registration_generate.h
src/registration_serialization_test.cpp
src/service_compare.cpp
src/service_compare.h
src/service_generate.cpp
src/service_generate.h
src/service_serialization_test.cpp
)

Expand Down
6 changes: 3 additions & 3 deletions ecal/tests/cpp/serialization_test/src/common_generate.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -17,9 +17,9 @@
* ========================= eCAL LICENSE =================================
*/

#include "common_generate.h"

#include <cstdlib>
#include <string>
#include <vector>

namespace eCAL
{
Expand Down
30 changes: 30 additions & 0 deletions ecal/tests/cpp/serialization_test/src/common_generate.h
Original file line number Diff line number Diff line change
@@ -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 <string>
#include <vector>

namespace eCAL
{
// Generate a random string of given length (may contain null character)
std::string GenerateString(size_t length);
std::vector<char> GenerateRandomVector(size_t length);
}
4 changes: 2 additions & 2 deletions ecal/tests/cpp/serialization_test/src/logging_compare.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -17,7 +17,7 @@
* ========================= eCAL LICENSE =================================
*/

#include <ecal/types/logging.h>
#include "logging_compare.h"

namespace eCAL
{
Expand Down
30 changes: 30 additions & 0 deletions ecal/tests/cpp/serialization_test/src/logging_compare.h
Original file line number Diff line number Diff line change
@@ -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 <ecal/types/logging.h>

namespace eCAL
{
namespace Logging
{
// compare two LogMessages for equality
bool CompareLogMessages(const SLogMessage& message1, const SLogMessage& message2);
}
}
7 changes: 3 additions & 4 deletions ecal/tests/cpp/serialization_test/src/logging_generate.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -17,14 +17,13 @@
* ========================= eCAL LICENSE =================================
*/

#include <ecal/types/logging.h>
#include "logging_generate.h"
#include "common_generate.h"

#include <cstdlib>

namespace eCAL
{
std::string GenerateString(size_t length);

namespace Logging
{
SLogMessage GenerateLogMessage()
Expand Down
29 changes: 29 additions & 0 deletions ecal/tests/cpp/serialization_test/src/logging_generate.h
Original file line number Diff line number Diff line change
@@ -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 <ecal/types/logging.h>

namespace eCAL
{
namespace Logging
{
SLogMessage GenerateLogMessage();
}
}
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -17,17 +17,17 @@
* ========================= eCAL LICENSE =================================
*/

#include "../../serialization/ecal_serialize_logging.h"
#include <serialization/ecal_serialize_logging.h>

#include "logging_generate.h"
#include "logging_compare.h"

#include <gtest/gtest.h>

namespace eCAL
{
namespace Logging
{
SLogMessage GenerateLogMessage();
bool CompareLogMessages(const SLogMessage& message1, const SLogMessage& message2);

TEST(core_cpp_serialization, LogMessage2String)
{
SLogMessage message_in = GenerateLogMessage();
Expand Down
4 changes: 3 additions & 1 deletion ecal/tests/cpp/serialization_test/src/monitoring_compare.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -17,6 +17,8 @@
* ========================= eCAL LICENSE =================================
*/

#include "monitoring_compare.h"

#include <ecal/types/monitoring.h>

namespace eCAL
Expand Down
31 changes: 31 additions & 0 deletions ecal/tests/cpp/serialization_test/src/monitoring_compare.h
Original file line number Diff line number Diff line change
@@ -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 <ecal/types/monitoring.h>

namespace eCAL
{
namespace Monitoring
{
// compare two monitoring structs
bool CompareMonitorings(const SMonitoring& monitoring1, const SMonitoring& monitoring2);
}
}
7 changes: 3 additions & 4 deletions ecal/tests/cpp/serialization_test/src/monitoring_generate.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -17,14 +17,13 @@
* ========================= eCAL LICENSE =================================
*/

#include <ecal/types/monitoring.h>
#include "monitoring_generate.h"
#include "common_generate.h"

#include <cstdlib>

namespace eCAL
{
std::string GenerateString(size_t length);

namespace Monitoring
{
// generate process
Expand Down
46 changes: 46 additions & 0 deletions ecal/tests/cpp/serialization_test/src/monitoring_generate.h
Original file line number Diff line number Diff line change
@@ -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 <ecal/types/monitoring.h>

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();
}
}
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -17,17 +17,16 @@
* ========================= eCAL LICENSE =================================
*/

#include "../../serialization/ecal_serialize_monitoring.h"
#include <serialization/ecal_serialize_monitoring.h>
#include "monitoring_generate.h"
#include "monitoring_compare.h"

#include <gtest/gtest.h>

namespace eCAL
{
namespace Monitoring
{
SMonitoring GenerateMonitoring();
bool CompareMonitorings(const SMonitoring& monitoring1, const SMonitoring& monitoring2);

TEST(core_cpp_serialization, Monitoring2String)
{
SMonitoring message_in = GenerateMonitoring();
Expand Down
Loading

0 comments on commit 066471a

Please sign in to comment.