ADTF  3.18.3
catch_integration.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <a_utils.h>
10 #include <catch2/catch.hpp>
11 
12 CATCH_TRANSLATE_EXCEPTION(const tResult& oError)
13 {
14  return adtf::util::to_string(oError).GetPtr();
15 }
16 
17 namespace Catch
18 {
19 
20 template<>
21 struct StringMaker<tResult>
22 {
23  static std::string convert(const tResult& oError)
24  {
25  return adtf::util::to_string(oError).GetPtr();
26  }
27 };
28 
29 template<tErrorCode::error_code_type Code>
30 struct StringMaker<tError<Code>>
31 {
32  static std::string convert(const tError<Code>&)
33  {
35  }
36 };
37 
38 template<>
39 struct StringMaker<adtf::util::cString>
40 {
41  static std::string convert(const adtf::util::cString& strString)
42  {
43  return strString.GetPtr();
44  }
45 };
46 
47 template<>
48 struct StringMaker<adtf::util::cFilename>
49 {
50  static std::string convert(const adtf::util::cFilename& strString)
51  {
52  return strString.GetPtr();
53  }
54 };
55 
56 }
57 
58 #define REQUIRE_OK( ... ) REQUIRE(tResult(ERR_NOERROR) == __VA_ARGS__)
59 #define REQUIRE_FAILED(...) REQUIRE(tResult(ERR_NOERROR) != __VA_ARGS__)
60 
61 #define CHECK_OK(...) CHECK(tResult(ERR_NOERROR) == __VA_ARGS__)
62 #define CHECK_FAILED(...) CHECK(tResult(ERR_NOERROR) != __VA_ARGS__)
Copyright © Audi Electronics Venture GmbH.
const tChar * GetPtr() const
This function returns the current string as an array of characters (c-style)
Definition: string.h:467
cString to_string(const tResult &i_oResult, eResultFormatFlags i_eFormatFlags=eResultFormatFlags::RFF_DisableNone, const tChar *i_strFormat=nullptr)
Copy all information of an assigned result object to a (formatted) string.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2778
Namespace for entire ADTF SDK.
Basic error type template, specialized by _MAKE_ERROR() to create concrete error types.