LCOV - code coverage report
Current view: top level - core - dict.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 12 100.0 %
Date: 2024-04-28 01:25:40 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: BSD-3-Clause
       2             : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
       3             : /// @file
       4             : /// @author Jan-Lukas Wynen
       5             : 
       6             : #include "scipp/core/dict.h"
       7             : 
       8             : #include <sstream>
       9             : 
      10             : namespace scipp::core {
      11             : template <class It>
      12        5855 : std::string dict_keys_to_string(It it, const It end,
      13             :                                 const std::string_view &dict_name) {
      14        5855 :   std::ostringstream ss;
      15        5855 :   ss << "<" << dict_name << " {";
      16        5855 :   bool first = true;
      17       19336 :   for (; it != end; ++it) {
      18       13481 :     if (!first) {
      19        7647 :       ss << ", ";
      20             :     } else {
      21        5834 :       first = false;
      22             :     }
      23       13481 :     ss << *it;
      24             :   }
      25        5855 :   ss << "}>";
      26       11710 :   return ss.str();
      27        5855 : }
      28             : 
      29             : // The value type does not matter here, so set it to something simple.
      30             : using dim_dict_key_iterator = Dict<Dim, int>::const_key_iterator;
      31             : using str_dict_key_iterator = Dict<std::string, int>::const_key_iterator;
      32             : 
      33             : template SCIPP_CORE_EXPORT std::string
      34             : dict_keys_to_string(dim_dict_key_iterator, dim_dict_key_iterator,
      35             :                     const std::string_view &);
      36             : template SCIPP_CORE_EXPORT std::string
      37             : dict_keys_to_string(str_dict_key_iterator, str_dict_key_iterator,
      38             :                     const std::string_view &);
      39             : } // namespace scipp::core

Generated by: LCOV version 1.14