Skip to content

Commit 18aff29

Browse files
author
tempate
committed
Fix - to_upper
Signed-off-by: tempate <danieldiaz@eprosima.com>
1 parent 40a66eb commit 18aff29

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/cpp/utils/UnitsParser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace utils {
3232
*
3333
* @param [in] st String to convert
3434
*/
35-
inline void to_uppercase(
35+
void to_uppercase(
3636
std::string& st) noexcept;
3737

3838
/**

test/unittest/dds/xtypes/serializers/idl/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ configure_file(
6666
COPYONLY)
6767

6868
set(RESOURCEDYNTYPETOIDLTESTS_SOURCE
69-
DynTypeIDLTests.cpp)
69+
DynTypeIDLTests.cpp
70+
${PROJECT_SOURCE_DIR}/src/cpp/utils/UnitsParser.cpp)
7071

7172
file(GLOB DATATYPE_SOURCES "types/**/gen/*.cxx")
7273

test/unittest/dds/xtypes/serializers/idl/DynTypeIDLTests.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include <gtest/gtest.h>
2121

22+
#include <utils/UnitsParser.hpp>
23+
2224
#include <fastdds/dds/core/ReturnCode.hpp>
2325
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
2426
#include <fastdds/dds/xtypes/dynamic_types/DynamicType.hpp>
@@ -58,15 +60,17 @@ class DynTypeIDLTests : public ::testing::TestWithParam<std::string>
5860
std::string camel_case;
5961
bool to_upper = true;
6062

61-
for (char ch : snake_case)
63+
for (const auto& ch : snake_case)
6264
{
6365
if (ch == '_')
6466
{
6567
to_upper = true;
6668
}
6769
else if (to_upper)
6870
{
69-
camel_case += std::toupper(ch);
71+
std::string ch_str(1, ch);
72+
utils::to_uppercase(ch_str);
73+
camel_case += ch_str;
7074
to_upper = false;
7175
}
7276
else

0 commit comments

Comments
 (0)