Explorar el Código

Refactoring.

main
offa hace 7 años
padre
commit
b9b7126260
Se han modificado 2 ficheros con 14 adiciones y 12 borrados
  1. +8
    -3
      test/ScopeGuardTest.cpp
  2. +6
    -9
      test/UniqueResourceTest.cpp

+ 8
- 3
test/ScopeGuardTest.cpp Ver fichero

@@ -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 Ver fichero

@@ -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)
{

Cargando…
Cancelar
Guardar