Skip to content

Commit

Permalink
Merge pull request #5588 from STEllAR-GROUP/fixing_id_formatting
Browse files Browse the repository at this point in the history
Fixing the output formatting for id_types
  • Loading branch information
msimberg authored Oct 5, 2021
2 parents b459f3a + 3174891 commit acfd9b3
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
1 change: 0 additions & 1 deletion libs/full/actions/tests/regressions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ foreach(test ${tests})
SOURCES ${sources} ${${test}_FLAGS}
EXCLUDE_FROM_ALL
FOLDER ${folder_name}
FOLDER "Tests/Regressions/Modules/Full/Actions"
)

add_hpx_regression_test("modules.actions" ${test} ${${test}_PARAMETERS})
Expand Down
4 changes: 2 additions & 2 deletions libs/full/naming_base/src/gid_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace hpx { namespace naming {

std::string gid_type::to_string() const
{
return hpx::util::format("{:016x}{:016x}", id_msb_, id_lsb_);
return hpx::util::format("{:016llx}{:016llx}", id_msb_, id_lsb_);
}

std::ostream& operator<<(std::ostream& os, gid_type const& id)
Expand All @@ -118,7 +118,7 @@ namespace hpx { namespace naming {
if (id != naming::invalid_gid)
{
hpx::util::format_to(
os, "{{{:016x}, {:016x}}}", id.id_msb_, id.id_lsb_);
os, "{{{:016llx}, {:016llx}}}", id.id_msb_, id.id_lsb_);
}
else
{
Expand Down
22 changes: 21 additions & 1 deletion libs/full/naming_base/tests/regressions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Copyright (c) 2019 The STE||AR-Group
# Copyright (c) 2021 The STE||AR-Group
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

set(tests format_id_type)

foreach(test ${tests})
set(sources ${test}.cpp)

source_group("Source Files" FILES ${sources})

set(folder_name "Tests/Regressions/Modules/Full/NamingBase")

# add example executable
add_hpx_executable(
${test}_test INTERNAL_FLAGS
SOURCES ${sources} ${${test}_FLAGS}
EXCLUDE_FROM_ALL
FOLDER ${folder_name}
)

add_hpx_regression_test("modules.naming_base" ${test} ${${test}_PARAMETERS})
endforeach()
30 changes: 30 additions & 0 deletions libs/full/naming_base/tests/regressions/format_id_type.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) 2021 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <hpx/hpx_init.hpp>
#include <hpx/modules/naming_base.hpp>
#include <hpx/modules/runtime_distributed.hpp>
#include <hpx/modules/testing.hpp>

#include <sstream>
#include <string>

///////////////////////////////////////////////////////////////////////////////
int hpx_main()
{
std::stringstream strm;
strm << hpx::find_here();

HPX_TEST_EQ(
strm.str(), std::string("{0000000100000000, 0000000000000000}"));
return hpx::finalize();
}

int main(int argc, char** argv)
{
HPX_TEST_EQ(hpx::init(argc, argv), 0);
return hpx::util::report_errors();
}

0 comments on commit acfd9b3

Please sign in to comment.