From 9c5a5a331bcb86a2f6f5d54cf621de3f0be921c5 Mon Sep 17 00:00:00 2001 From: Ashwin A Nayar Date: Tue, 17 Jan 2023 19:33:10 +0530 Subject: [PATCH] Remove space while formatting multi-dim arrays --- dbg.h | 8 ++++---- tests/basic.cpp | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dbg.h b/dbg.h index a026b2c..fb8ca18 100644 --- a/dbg.h +++ b/dbg.h @@ -224,21 +224,21 @@ inline std::string get_type_name(type_tag) { template typename std::enable_if<(std::rank::value == 1), std::string>::type -get_dim() { +get_array_dim() { return "[" + std::to_string(std::extent::value) + "]"; } template typename std::enable_if<(std::rank::value > 1), std::string>::type -get_dim() { +get_array_dim() { return "[" + std::to_string(std::extent::value) + "]" + - get_dim::type>(); + get_array_dim::type>(); } template typename std::enable_if<(std::rank::value > 0), std::string>::type get_type_name(type_tag) { - return type_name::type>() + " " + get_dim(); + return type_name::type>() + get_array_dim(); } template diff --git a/tests/basic.cpp b/tests/basic.cpp index 49b1c9e..1e5fa37 100644 --- a/tests/basic.cpp +++ b/tests/basic.cpp @@ -282,10 +282,10 @@ TEST_CASE("type_name") { SECTION("C-style arrays") { CHECK(type_name() == - (std::is_same::value ? "int32_t [3]" : "int [3]")); - CHECK(type_name() == "char [1][2][3]"); + (std::is_same::value ? "int32_t[3]" : "int[3]")); + CHECK(type_name() == "char[1][2][3]"); double a[] = {5, 4, 3, 2, 1}; - CHECK(type_name() == "double [5]"); + CHECK(type_name() == "double[5]"); } SECTION("const and volatile") {