offa преди 7 години
родител
ревизия
b9b7126260
променени са 2 файла, в които са добавени 14 реда и са изтрити 12 реда
  1. +8
    -3
      test/ScopeGuardTest.cpp
  2. +6
    -9
      test/UniqueResourceTest.cpp

+ 8
- 3
test/ScopeGuardTest.cpp Целия файл

@@ -20,13 +20,18 @@

#include "scope_guard.h"
#include <catch.hpp>
#include "Mocks.h"
#include <trompeloeil.hpp>

using namespace trompeloeil;

namespace
{
mock::CallMock m;
struct CallMock
{
MAKE_MOCK0(deleter, void());
};

CallMock m;

void deleter()
{
@@ -51,7 +56,7 @@ TEST_CASE("deleter is not called if released", "[ScopeGuard]")

TEST_CASE("deleter lambda called on destruction", "[ScopeGuard]")
{
mock::CallMock cm;
CallMock cm;
REQUIRE_CALL(cm, deleter());
auto guard = sr::scope_guard([&cm] { cm.deleter(); });
static_cast<void>(guard);

+ 6
- 9
test/UniqueResourceTest.cpp Целия файл

@@ -25,21 +25,18 @@

using namespace trompeloeil;

using Handle = int;
using PtrHandle = std::add_pointer_t<Handle>;

namespace mock
namespace
{
using Handle = int;
using PtrHandle = std::add_pointer_t<Handle>;


struct CallMock
{
MAKE_MOCK1(deleter, void(Handle));
};
}


namespace
{
mock::CallMock m;
CallMock m;

void deleter(Handle h)
{

Loading…
Отказ
Запис