Skip to content

Releases: rollbear/trompeloeil

v19

03 Oct 16:10
Compare
Choose a tag to compare
v19
  • Fixed obscure bug when placing an expectation using a value implicitly
    convertible to the target type, but not equal comparable with it.

    Example:

          struct S
          {
            S(const char* s_) : s(s_) {}
            bool operator(const char*) = delete;
            bool operator==(const S& rh) const
            {
              return s == rh.s;
            }
            std::string s;
          };
    
          struct mock {
            MAKE_MOCK1(func, void(S));
          };
    
          TEST(...)
          {
            mock m;
            REQUIRE_CALL(m, func("string"));
            // now compiles and compares the function call parameter value
            // with S("string")
          }
  • Improved compilation error messages for type-mismatch situations in .RETURN()

v18

18 Aug 10:17
Compare
Choose a tag to compare
v18
  • Writing custom matchers is much simplified through the use
    of function template make_matcher<>(), which accepts lambdas
    for predicate and printing error message.

    The old technique of inheriting from trompeloeil::matcher
    or trompeloeil::typed_matcher<T> still works.

    See CookBook for details.

  • Further internal restructuring for yet reduced test program build time.

v17

11 Jun 04:22
Compare
Choose a tag to compare
v17
  • Use template specialization when writing adapter code for unit testing frame works. The old technique is used by default.
  • Internal restructuring for shorter compilation times. Compilation time reductions of more than 10% have been measured.

v16

16 May 04:17
Compare
Choose a tag to compare
v16
  • .IN_SEQUENCE(...) can now be used with REQUIRE_DESTRUCTION(...)
    and NAMED_REQUIRE_DESTRUCTION(...) to ensure objects are destroyed in the intended order.
    Example:

    auto p1 = new trompeloeil::deathwatched<mock1>;
    auto p2 = new trompeloeil::deathwatched<mock2>;
    
    trompeloeil::sequence s;
    REQUIRE_DESTRUCTION(*p1)
      .IN_SEQUENCE(s);
    REQUIRE_DESTRUCTION(*p2)
      .IN_SEQUENCE(s);
    call_destroyer(p1, p2); // both must be destroyed, p1 before p2.
  • class trompeloeil::lifetime_monitor now inherits from class trompeloeil::expectation, so using

    std::unique_ptr<expectation> p = NAMED_REQUIRE_DESTRUCTION(obj);

    instead of

    std::unique_ptr<lifetime_monitor> p = NAMED_REQUIRE_DESTRUCTION(obj);

    works equally well, reduces the cognitive load a bit, and seems to build slightly faster.

v15

29 Apr 03:32
Compare
Choose a tag to compare
v15

Fixed macro bug that caused warnings with g++ and clang++ when compiling with strict C++ standards compliance

v14

27 Apr 20:25
Compare
Choose a tag to compare
v14
  • Fixed bug when the destruction of a sequence object with still
    living expectations caused call to abort().

  • You can now add extra trailing specifiers to a mock function,
    such as the override context sensitive specifier, and/or the
    keyword noexcept (careful with the latter if your registered
    reporter can/does throw.)

    Example:

    struct D : public B {
      MAKE_MOCK1(func, int(int), override);
    };

v13

07 Mar 21:14
Compare
Choose a tag to compare
v13
  • Mock functions and their expectations are thread safe, using a global recursive mutex
  • Silenced warnings from g++ -Wshadow.

v12

01 Feb 18:06
Compare
Choose a tag to compare
v12
  • Built in matchers are duck tuped by default, i.e. eq, ne, gt, ge,
    lt, le do by default match any parameter that supports operators
    ==, !=, >, >=, <, <= with the value provided. If needed for
    disambiguation of overloads an explicit type can be provided. In the
    example below the expectation on numfunc will match a function
    numfunc with any parameter type that can be compared as > 3.
    The expectation on strfunc will only match an overload with
    std::string& (if there are competing overloads, e.g.
    strfunc(const char*) and strfunc(const std::string).)
    REQUIRE_CALL(obj, numfunc(gt(3)));
    REQUIRE_CALL(obj, strfunc(eq<std::string&>("foo")));
  • Fixed a bug with return type deduction where an array type expression
    was used. E.g. returning a string literal when the return type was
    const char* or std::string caused a compilation error.
  • Fixed a bug when the eq(nullptr) matcher actually checked if !=
    comparison with nullptr was allowed.
  • Reluctantly reverted use of std::tuple_element_t<> for
    typename tuppe_element<>::type, to support g++ 4.9.0 (4.9.1 does have
    std::tuple_element_t<>.)

v11

04 Jan 06:34
Compare
Choose a tag to compare
v11
  • Added regular expression matcher for std::string and c-strings

  • Added specialization eq for pointer-like parameters and pointer-to-member parameters. This is mostly useful for pointer to pointer parameters, e.g.:

    REQUIRE_CALL(obj, func(*trompeloeil::eq(nullptr)));

  • Improved accuracy of compilation error message when attempting to place expectation that does not uniquely match any function signature.

v10

11 Dec 13:55
Compare
Choose a tag to compare
v10
  • Fixed bug when wildcard _ could not match std::ostream&
  • Fixed ADL bugs
  • Added functionality to use the dereference operator (prefix operator*) on any matcher to instead match a pointer to the value to check.
  • Documented adapter for VisualStudio MSTest
  • Corrected documentation bug for how to write report formatting function trompeloeil::print<>(std::ostream&, T const&).