diff --git a/AutomatedTests/CMakeLists.txt b/AutomatedTests/CMakeLists.txt index eb8d468124..4e9e4aa59c 100644 --- a/AutomatedTests/CMakeLists.txt +++ b/AutomatedTests/CMakeLists.txt @@ -41,7 +41,8 @@ enable_testing() function(test FILE) get_filename_component(NAME ${FILE} NAME_WE) - add_application(${NAME} ${FILE} Test.h Test.c) + add_application(${NAME} ${FILE} Test.h Test.c) + target_include_directories(${NAME} PRIVATE .) add_test(NAME ${TESTCASE_PREFIX}${NAME} COMMAND ${LAUNCH_APPL} ${LAUNCH_METHOD_FLAG} ${RETRO68_TEST_CONFIG} ${NAME}.bin) if(ARGN) @@ -77,3 +78,7 @@ if(CMAKE_SYSTEM_NAME MATCHES Retro68) endif() test(Exceptions.cc PROPERTIES PASS_REGULAR_EXPRESSION "OK") + +configure_file(PascalTrap.c PascalTrapCPP.cc) +test(PascalTrap.c PROPERTIES PASS_REGULAR_EXPRESSION "OK") +test(${CMAKE_CURRENT_BINARY_DIR}/PascalTrapCPP.cc PROPERTIES PASS_REGULAR_EXPRESSION "OK") diff --git a/AutomatedTests/PascalTrap.c b/AutomatedTests/PascalTrap.c new file mode 100644 index 0000000000..038708ea42 --- /dev/null +++ b/AutomatedTests/PascalTrap.c @@ -0,0 +1,16 @@ +#include +#include "Test.h" + +short calc() +{ + return FixRound(FixRatio(42,5)); +} + +int main() +{ + if(calc() == 8) + TEST_LOG_OK(); + else + TEST_LOG_NO(); + return 0; +} diff --git a/AutomatedTests/Test.h b/AutomatedTests/Test.h index 3e88d860a3..f2a081509b 100644 --- a/AutomatedTests/Test.h +++ b/AutomatedTests/Test.h @@ -48,7 +48,7 @@ void TestLog(const char *str); _hpb.ioParam.ioPosOffset = 0; \ _hpb.ioParam.ioRefNum = _ref; \ _hpb.ioParam.ioMisc = NULL; \ - PBWriteSync((void*)&_hpb); \ + PBWriteSync((ParmBlkPtr)&_hpb); \ char _newline = '\n'; \ _hpb.ioParam.ioCompletion = NULL; \ _hpb.ioParam.ioBuffer = &_newline; \ @@ -57,16 +57,16 @@ void TestLog(const char *str); _hpb.ioParam.ioPosOffset = 0; \ _hpb.ioParam.ioRefNum = _ref; \ _hpb.ioParam.ioMisc = NULL; \ - PBWriteSync((void*)&_hpb); \ + PBWriteSync((ParmBlkPtr)&_hpb); \ _hpb.ioParam.ioCompletion = NULL; \ _hpb.ioParam.ioRefNum = _ref; \ _hpb.ioParam.ioMisc = NULL; \ - PBCloseSync((void*)&_hpb); \ + PBCloseSync((ParmBlkPtr)&_hpb); \ _hpb.ioParam.ioCompletion = NULL; \ _hpb.ioParam.ioNamePtr = NULL; \ _hpb.ioParam.ioVRefNum = 0; \ _hpb.ioParam.ioMisc = NULL; \ - PBFlushVolSync((void*)&_hpb); \ + PBFlushVolSync((ParmBlkPtr)&_hpb); \ } while(0); /*