From f7cad98f3e6b8689e9cab2699e9042f1b48a8be7 Mon Sep 17 00:00:00 2001 From: Dave Hickin Date: Wed, 7 Sep 2016 14:40:16 +0100 Subject: [PATCH] testTypeCast: Escape non-printing characters --- testApp/misc/testTypeCast.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/testApp/misc/testTypeCast.cpp b/testApp/misc/testTypeCast.cpp index 1f2516e..8a00aa7 100644 --- a/testApp/misc/testTypeCast.cpp +++ b/testApp/misc/testTypeCast.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,14 @@ using std::string; namespace { + std::string escapedFromRaw(const std::string & s) + { + std::vector result; + result.resize(epicsStrnEscapedFromRawSize(s.c_str(), s.length())+1); + epicsStrnEscapedFromRaw(&result[0], result.size(), s.c_str(), s.length()); + return std::string(&result[0]); + } + template struct testequal { static bool op(T A, T B) {return A==B; } @@ -57,7 +66,7 @@ namespace { < " <::op(actual, expect)) { @@ -65,14 +74,14 @@ namespace { < " < " < (" < (" <