Skip to content
Permalink
Browse files

Updated cmakelists slightly; added object return test from MrAtari th…

…at indeed crashes.
  • Loading branch information...
Peter Bindels
Peter Bindels committed May 31, 2016
1 parent 9800b51 commit 6d3ac6dd8e3cd4f5e11e3271d83bdcde3030b523
Showing with 78 additions and 44 deletions.
  1. +1 −1 CMakeLists.txt
  2. +5 −0 HippoMocks/CMakeLists.txt
  3. +38 −34 HippoMocksTest/CMakeLists.txt
  4. +34 −0 HippoMocksTest/test_objectreturn.cpp
  5. +0 −9 makefile
@@ -4,7 +4,7 @@ enable_testing()
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-long-long -std=c++11")
endif()

add_subdirectory(HippoMocks)
add_subdirectory(HippoMocksTest)

install(FILES ${PROJECT_SOURCE_DIR}/HippoMocks/hippomocks.h
@@ -0,0 +1,5 @@
project(HippoMocks)

add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE .)

@@ -1,37 +1,41 @@
cmake_minimum_required(VERSION 3.0)
project(HippoMocksTests CXX)
include_directories(../HippoMocks)

set(test_SOURCES
Framework.cpp
is_virtual.cpp
main.cpp
test.cpp
test_args.cpp
test_array.cpp
test_autoptr.cpp
test_cfuncs.cpp
test_class_args.cpp
test_constref_params.cpp
test_cv_funcs.cpp
test_do.cpp
test_dontcare.cpp
test_except.cpp
test_exception_quality.cpp
test_filter.cpp
test_inparam.cpp
test_membermock.cpp
test_mi.cpp
test_nevercall.cpp
test_optional.cpp
test_outparam.cpp
test_overload.cpp
test_ref_args.cpp
test_regression_arg_count.cpp
test_retval.cpp
test_transaction.cpp
test_zombie.cpp)

add_executable(HippoMocksTest ${test_SOURCES})
add_test(test HippoMocksTest)
project(HippoMocksTests CXX)

add_executable(${PROJECT_NAME}
Framework.cpp
is_virtual.cpp
main.cpp
test_args.cpp
test_array.cpp
test_autoptr.cpp
test_cfuncs.cpp
test_class_args.cpp
test_com_support_stdcall.cpp
test_constref_params.cpp
test.cpp
test_cv_funcs.cpp
test_do.cpp
test_dontcare.cpp
test_except.cpp
test_exception_quality.cpp
test_filter.cpp
test_inparam.cpp
test_membermock.cpp
test_mi.cpp
test_nevercall.cpp
test_objectreturn.cpp
test_optional.cpp
test_outparam.cpp
test_overload.cpp
test_ref_args.cpp
test_regression_arg_count.cpp
test_retval.cpp
test_transaction.cpp
test_zombie.cpp
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
HippoMocks
)
add_test(test ${PROJECT_NAME})
@@ -0,0 +1,34 @@
#include "hippomocks.h"
#include "Framework.h"

class Argument
{
public:
virtual ~Argument() { };
int value;
};

class ISS
{
public:
virtual Argument getValue() = 0;
};

TEST(checkUnexpectedCall)
{
MockRepository mocks;

ISS* is = mocks.Mock<ISS>();
bool unexpectedCall = false;

try
{
Argument arg = is->getValue();
}
catch (HippoMocks::NotImplementedException&)
{
unexpectedCall = true;
}

CHECK(unexpectedCall == true);
}

This file was deleted.

0 comments on commit 6d3ac6d

Please sign in to comment.
You can’t perform that action at this time.