trompeloeil

FORK: Header only C++14 mocking framework
git clone https://git.neptards.moe/u3shit/trompeloeil.git
Log | Files | Refs | README

trompeloeil.hpp (983B)


      1 /*
      2  * Trompeloeil C++ mocking framework
      3  *
      4  * Copyright Björn Fahller 2014-2019
      5  *
      6  *  Use, modification and distribution is subject to the
      7  *  Boost Software License, Version 1.0. (See accompanying
      8  *  file LICENSE_1_0.txt or copy at
      9  *  http://www.boost.org/LICENSE_1_0.txt)
     10  *
     11  * Project home: https://github.com/rollbear/trompeloeil
     12  */
     13 
     14 
     15 #ifndef TROMPELOEIL_GTEST_HPP_
     16 #define TROMPELOEIL_GTEST_HPP_
     17 
     18 #ifndef GTEST_TEST
     19 #error "<gtest.h> must be included before <gtest/trompeloeil.hpp>"
     20 #endif
     21 
     22 #include "../trompeloeil.hpp"
     23 
     24 namespace trompeloeil
     25 {
     26   template <>
     27   inline void reporter<specialized>::send(
     28     severity s,
     29     char const *file,
     30     unsigned long line,
     31     const char* msg)
     32   {
     33     if (s == severity::fatal)
     34     {
     35       std::ostringstream os;
     36       if (line != 0U)
     37       {
     38         os << file << ':' << line << '\n';
     39       }
     40       throw expectation_violation(os.str() + msg);
     41     }
     42 
     43     ADD_FAILURE_AT(file, line) << msg;
     44   }
     45 }
     46 
     47 
     48 #endif //TROMPELOEIL_GTEST_HPP_