add test case for pascal traps

This commit is contained in:
Wolfgang Thaller 2019-06-23 17:27:47 +02:00
parent 3612935ed9
commit 2075e92f23
3 changed files with 26 additions and 5 deletions

View File

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

View File

@ -0,0 +1,16 @@
#include <FixMath.h>
#include "Test.h"
short calc()
{
return FixRound(FixRatio(42,5));
}
int main()
{
if(calc() == 8)
TEST_LOG_OK();
else
TEST_LOG_NO();
return 0;
}

View File

@ -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);
/*