trompeloeil

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

multiple_limits.cpp (826B)


      1 /*
      2  * Trompeloeil C++ mocking framework
      3  *
      4  * Copyright Björn Fahller 2014,2017
      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 //Only one TIMES call limit is allowed, but it can express an interval
     15 #include <trompeloeil.hpp>
     16 
     17 struct MS
     18 {
     19   MAKE_MOCK0(f, int());
     20 };
     21 
     22 int main()
     23 {
     24   MS obj;
     25 
     26 #if (TROMPELOEIL_CPLUSPLUS == 201103L)
     27 
     28   REQUIRE_CALL_V(obj, f(),
     29     .TIMES(AT_LEAST(1))
     30     .TIMES(AT_MOST(3))
     31     .RETURN(0));
     32 
     33 #else /* (TROMPELOEIL_CPLUSPLUS == 201103L) */
     34 
     35   REQUIRE_CALL(obj, f())
     36     .TIMES(AT_LEAST(1))
     37     .TIMES(AT_MOST(3))
     38     .RETURN(0);
     39 
     40 #endif /* !(TROMPELOEIL_CPLUSPLUS == 201103L) */
     41 }