summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-07-18 15:09:18 +0200
committerDavid Tardon <dtardon@redhat.com>2017-07-20 10:32:37 +0200
commit85d24152f81bfcd463356330f1cc6257f485535f (patch)
treeeb9f010d6f583c518c191bb9d9406fb0caeca0b1
parentc29651571c5e6e52dda92b85210c8ab9026a79fb (diff)
downloadcppunit-85d24152f81bfcd463356330f1cc6257f485535f.tar.gz
Report (un)signed char values numerically
...instead of as characters, as those values often represent numerical values (e.g., sal_uInt8 aka unsigned char in LibreOffice), and often even have values outside the printing ASCII range Change-Id: I72727e98f5af616f6b0c03c57fc1119c0c11c1fc Reviewed-on: https://gerrit.libreoffice.org/40138 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r--include/cppunit/tools/StringHelper.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/cppunit/tools/StringHelper.h b/include/cppunit/tools/StringHelper.h
index 3301045..3b7a38e 100644
--- a/include/cppunit/tools/StringHelper.h
+++ b/include/cppunit/tools/StringHelper.h
@@ -36,6 +36,16 @@ typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(cons
return ost.str();
}
+template<> inline std::string toString(const signed char& x)
+{
+ return toString(static_cast<int>(x));
+}
+
+template<> inline std::string toString(const unsigned char& x)
+{
+ return toString(static_cast<unsigned int>(x));
+}
+
}