Skip to content

Commit

Permalink
[core] Parallel serialization test.
Browse files Browse the repository at this point in the history
Header files for serialization_test.
  • Loading branch information
KerstinKeller committed Nov 4, 2024
1 parent e54d371 commit 7b7a024
Show file tree
Hide file tree
Showing 24 changed files with 435 additions and 57 deletions.
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 7b7a024

Please sign in to comment.