LCOV - code coverage report
Current view: top level - include/unotest - assertion_traits.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 3 33.3 %
Date: 2015-06-13 12:38:46 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #ifndef INCLUDED_UNOTEST_ASSERTION_TRAITS_HXX
      11             : #define INCLUDED_UNOTEST_ASSERTION_TRAITS_HXX
      12             : 
      13             : // sal/types.h declares typedefs to signed char (sal_Int8) and unsigned char
      14             : // (sal_uInt8, sal_Bool), so better specialize CppUnit::assertion_traits for
      15             : // those two types to treat the toString() value as an integer rather than a
      16             : // character:
      17             : 
      18             : #include <sal/config.h>
      19             : 
      20             : #include <string>
      21             : 
      22             : namespace CppUnit {
      23             : 
      24             : template<> struct assertion_traits<signed char> {
      25             :     static bool equal(signed char x, signed char y) { return x == y; }
      26             : 
      27             :     static std::string toString(signed char x)
      28             :     { return std::to_string(static_cast<int>(x)); }
      29             : };
      30             : 
      31             : template<> struct assertion_traits<unsigned char> {
      32           3 :     static bool equal(unsigned char x, unsigned char y) { return x == y; }
      33             : 
      34           0 :     static std::string toString(unsigned char x)
      35           0 :     { return std::to_string(static_cast<unsigned int>(x)); }
      36             : };
      37             : 
      38             : }
      39             : 
      40             : #endif
      41             : 
      42             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11