mirror of
https://github.com/TheOnlyZac/sly1.git
synced 2024-11-27 07:30:26 +00:00
Test updates
This commit is contained in:
parent
846e4223b1
commit
a9f33a5d01
@ -1,24 +1,24 @@
|
||||
macro(add_unit_test)
|
||||
set(options PARALLEL)
|
||||
set(oneValueArgs NAME)
|
||||
set(multiValueArgs SOURCES LIBS)
|
||||
cmake_parse_arguments(TEST "${options}" "${oneValueArgs}"
|
||||
"${multiValueArgs}" ${ARGN})
|
||||
message(STATUS "Generating Test ${TEST_NAME}... (${TEST_SOURCES})")
|
||||
add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
||||
target_link_libraries(${TEST_NAME} ${TEST_LIBS})
|
||||
if(TEST_PARALLEL AND HAVE_MPI)
|
||||
set(TESTCOMMAND ${MPIEXEC})
|
||||
set(TESTARGS ${MPIEXEC_NUMPROC_FLAG} 3 ${MPIEXEC_PREFLAGS}
|
||||
"./${TEST_NAME}" ${MPIEXEC_POSTFLAGS})
|
||||
set(TESTCOMMAND ${TESTCOMMAND} ${TESTARGS})
|
||||
else()
|
||||
set(TESTCOMMAND ${TEST_NAME})
|
||||
endif()
|
||||
add_test(NAME ${TEST_NAME}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin/tests
|
||||
COMMAND ${TESTCOMMAND})
|
||||
set(options PARALLEL)
|
||||
set(oneValueArgs NAME)
|
||||
set(multiValueArgs SOURCES LIBS)
|
||||
cmake_parse_arguments(TEST "${options}" "${oneValueArgs}"
|
||||
"${multiValueArgs}" ${ARGN})
|
||||
message(STATUS "Generating Test ${TEST_NAME}... (${TEST_SOURCES})")
|
||||
add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
||||
target_link_libraries(${TEST_NAME} ${TEST_LIBS})
|
||||
if(TEST_PARALLEL AND HAVE_MPI)
|
||||
set(TESTCOMMAND ${MPIEXEC})
|
||||
set(TESTARGS ${MPIEXEC_NUMPROC_FLAG} 3 ${MPIEXEC_PREFLAGS}
|
||||
"./${TEST_NAME}" ${MPIEXEC_POSTFLAGS})
|
||||
set(TESTCOMMAND ${TESTCOMMAND} ${TESTARGS})
|
||||
else()
|
||||
set(TESTCOMMAND ${TEST_NAME})
|
||||
endif()
|
||||
add_test(NAME ${TEST_NAME}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin/tests
|
||||
COMMAND ${TESTCOMMAND})
|
||||
|
||||
get_property(TESTNAMES GLOBAL PROPERTY TESTNAMES)
|
||||
set_property(GLOBAL PROPERTY TESTNAMES ${TESTNAMES} ${TEST_NAME})
|
||||
get_property(TESTNAMES GLOBAL PROPERTY TESTNAMES)
|
||||
set_property(GLOBAL PROPERTY TESTNAMES ${TESTNAMES} ${TEST_NAME})
|
||||
endmacro(add_unit_test)
|
||||
|
@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <exception>
|
||||
|
||||
// Custom assert function that doesn't call abort
|
||||
inline void assert(bool assertion)
|
||||
{
|
||||
if (!assertion)
|
||||
{
|
||||
printf("Assertion failed");
|
||||
exit(1);
|
||||
}
|
||||
}
|
@ -1,23 +1,23 @@
|
||||
#include <clock.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
SetClockRate(1.0);
|
||||
assert(g_rtClock == 1.0f);
|
||||
assert(g_clock.fEnabled == true);
|
||||
JtAssert(g_rtClock == 1.0f);
|
||||
JtAssert(g_clock.fEnabled);
|
||||
|
||||
SetClockRate(0.5);
|
||||
assert(g_rtClock == 0.5f);
|
||||
assert(g_clock.fEnabled == true);
|
||||
JtAssert(g_rtClock == 0.5f);
|
||||
JtAssert(g_clock.fEnabled);
|
||||
|
||||
SetClockRate(0);
|
||||
assert(g_rtClock == 0.f);
|
||||
assert(g_clock.fEnabled == false);
|
||||
JtAssert(g_rtClock == 0.f);
|
||||
JtAssert(!g_clock.fEnabled);
|
||||
|
||||
SetClockRate(-1);
|
||||
assert(g_rtClock == -1.f);
|
||||
assert(g_clock.fEnabled == false);
|
||||
JtAssert(g_rtClock == -1.f);
|
||||
JtAssert(!g_clock.fEnabled);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <coin.h>
|
||||
#include <gs.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -11,20 +11,20 @@ int main()
|
||||
g_pgsCur->ccharm = 0;
|
||||
OnCoinSmack(&coin);
|
||||
|
||||
assert(g_pgsCur->ccoin == 1);
|
||||
assert(g_pgsCur->ccharm == 0);
|
||||
JtAssert(g_pgsCur->ccoin == 1);
|
||||
JtAssert(g_pgsCur->ccharm == 0);
|
||||
|
||||
g_pgsCur->ccoin = 98;
|
||||
OnCoinSmack(&coin);
|
||||
|
||||
assert(g_pgsCur->ccoin == 99);
|
||||
assert(g_pgsCur->ccharm == 0);
|
||||
JtAssert(g_pgsCur->ccoin == 99);
|
||||
JtAssert(g_pgsCur->ccharm == 0);
|
||||
|
||||
// Test collecting a 100 coins to get a charm
|
||||
OnCoinSmack(&coin);
|
||||
|
||||
assert(g_pgsCur->ccoin == 0);
|
||||
assert(g_pgsCur->ccharm == 1);
|
||||
JtAssert(g_pgsCur->ccoin == 0);
|
||||
JtAssert(g_pgsCur->ccharm == 1);
|
||||
|
||||
// Test collecting 100 coins to get an extra life
|
||||
g_pgsCur->ccoin = 99;
|
||||
@ -32,9 +32,9 @@ int main()
|
||||
g_pgsCur->clife = 5;
|
||||
OnCoinSmack(&coin);
|
||||
|
||||
assert(g_pgsCur->ccoin == 0);
|
||||
assert(g_pgsCur->ccharm == 2);
|
||||
assert(g_pgsCur->clife == 6);
|
||||
JtAssert(g_pgsCur->ccoin == 0);
|
||||
JtAssert(g_pgsCur->ccharm == 2);
|
||||
JtAssert(g_pgsCur->clife == 6);
|
||||
|
||||
// Test collecting a coin when coins, lives, and charms are all at max
|
||||
g_pgsCur->ccoin = 99;
|
||||
@ -42,7 +42,7 @@ int main()
|
||||
g_pgsCur->clife = 99;
|
||||
OnCoinSmack(&coin);
|
||||
|
||||
assert(g_pgsCur->ccoin == 99);
|
||||
assert(g_pgsCur->ccharm == 2);
|
||||
assert(g_pgsCur->clife == 99);
|
||||
JtAssert(g_pgsCur->ccoin == 99);
|
||||
JtAssert(g_pgsCur->ccharm == 2);
|
||||
JtAssert(g_pgsCur->clife == 99);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <difficulty.h>
|
||||
#include <gs.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -10,19 +10,19 @@ int main()
|
||||
OnDifficultyWorldPostLoad(&g_difficulty);
|
||||
|
||||
// Test changing level suck
|
||||
g_plsCur->uSuck = 0.0;
|
||||
assert(g_plsCur->uSuck == 0.0);
|
||||
g_plsCur->uSuck = 0.0f;
|
||||
JtAssert(g_plsCur->uSuck == 0.0f);
|
||||
|
||||
ChangeSuck(0.1, &g_difficulty);
|
||||
assert(g_plsCur->uSuck == 0.1);
|
||||
JtAssert(g_plsCur->uSuck == 0.1f);
|
||||
|
||||
ChangeSuck(1.0, &g_difficulty);
|
||||
assert(g_plsCur->uSuck == 1.0);
|
||||
JtAssert(g_plsCur->uSuck == 1.0f);
|
||||
|
||||
ChangeSuck(-1.0, &g_difficulty);
|
||||
assert(g_plsCur->uSuck == -1.0);
|
||||
JtAssert(g_plsCur->uSuck == -1.0f);
|
||||
|
||||
// Test collect key scenario
|
||||
OnDifficultyCollectKey(&g_difficulty);
|
||||
assert(g_plsCur->uSuck == 0.0);
|
||||
JtAssert(g_plsCur->uSuck == 0.0f);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <difficulty.h>
|
||||
#include <gs.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
void SetGameLevel(GAMEWORLD gameworld, WORLDLEVEL worldlevel);
|
||||
|
||||
@ -13,13 +13,13 @@ int main()
|
||||
// jb_intro = easy
|
||||
SetGameLevel(GAMEWORLD::Intro, WORLDLEVEL::Approach);
|
||||
OnDifficultyWorldPreLoad(&g_difficulty);
|
||||
assert(g_difficulty.props == &g_difficultyEasy);
|
||||
JtAssert(g_difficulty.props == &g_difficultyEasy);
|
||||
|
||||
|
||||
// cw_security = easy
|
||||
SetGameLevel(GAMEWORLD::Clockwerk, WORLDLEVEL::Level2);
|
||||
OnDifficultyWorldPreLoad(&g_difficulty);
|
||||
assert(g_difficulty.props == &g_difficultyEasy);
|
||||
JtAssert(g_difficulty.props == &g_difficultyEasy);
|
||||
|
||||
|
||||
// uw_bonus_security
|
||||
@ -28,12 +28,12 @@ int main()
|
||||
// no key = medium
|
||||
g_plsCur->fls = static_cast<FLS>((int)g_plsCur->fls & ~(int)FLS::KeyCollected); // unset KeyCollected flag
|
||||
OnDifficultyWorldPreLoad(&g_difficulty);
|
||||
assert(g_difficulty.props == &g_difficultyMedium);
|
||||
JtAssert(g_difficulty.props == &g_difficultyMedium);
|
||||
|
||||
// with key = hard
|
||||
g_plsCur->fls = static_cast<FLS>((int)g_plsCur->fls | (int)FLS::KeyCollected); // setKeyCollected flag
|
||||
OnDifficultyWorldPreLoad(&g_difficulty);
|
||||
assert(g_difficulty.props == &g_difficultyHard);
|
||||
JtAssert(g_difficulty.props == &g_difficultyHard);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <game.h>
|
||||
#include <joy.h>
|
||||
#include <gs.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -9,34 +9,34 @@ int main()
|
||||
g_grfcht &= ~((int)FCHT::InfiniteCharms); // disable infinite charms
|
||||
|
||||
// Confirm max charm count is 2
|
||||
assert(CcharmMost() == 2);
|
||||
JtAssert(CcharmMost() == 2);
|
||||
|
||||
// Test checking if a charm is available
|
||||
g_pgsCur->ccharm = 0;
|
||||
assert(FCharmAvailable() == false);
|
||||
JtAssert(FCharmAvailable() == false);
|
||||
|
||||
g_pgsCur->ccharm = 1;
|
||||
assert(FCharmAvailable() == true);
|
||||
JtAssert(FCharmAvailable() == true);
|
||||
|
||||
g_pgsCur->ccharm = -1;
|
||||
assert(FCharmAvailable() == false);
|
||||
JtAssert(FCharmAvailable() == false);
|
||||
|
||||
g_pgsCur->ccharm = 0;
|
||||
g_grfcht |= (int)FCHT::InfiniteCharms; // enable infinite charms cheat
|
||||
assert(FCharmAvailable() == true);
|
||||
JtAssert(FCharmAvailable() == true);
|
||||
|
||||
// Test setting charm count
|
||||
SetCcharm(0);
|
||||
assert(g_pgsCur->ccharm == 0);
|
||||
JtAssert(g_pgsCur->ccharm == 0);
|
||||
|
||||
SetCcharm(1);
|
||||
assert(g_pgsCur->ccharm == 1);
|
||||
JtAssert(g_pgsCur->ccharm == 1);
|
||||
|
||||
SetCcharm(3);
|
||||
assert(g_pgsCur->ccharm == 3);
|
||||
JtAssert(g_pgsCur->ccharm == 3);
|
||||
|
||||
SetCcharm(-1);
|
||||
assert(g_pgsCur->ccharm == -1);
|
||||
JtAssert(g_pgsCur->ccharm == -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
#include <game.h>
|
||||
#include <joy.h>
|
||||
#include <gs.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Confirm max charm count is 2
|
||||
assert(CcharmMost() == 2);
|
||||
JtAssert(CcharmMost() == 2);
|
||||
|
||||
// Test setting charm count
|
||||
SetCcharm(0);
|
||||
assert(g_pgsCur->ccharm == 0);
|
||||
JtAssert(g_pgsCur->ccharm == 0);
|
||||
|
||||
SetCcharm(1);
|
||||
assert(g_pgsCur->ccharm == 1);
|
||||
JtAssert(g_pgsCur->ccharm == 1);
|
||||
|
||||
SetCcharm(3);
|
||||
assert(g_pgsCur->ccharm == 3);
|
||||
JtAssert(g_pgsCur->ccharm == 3);
|
||||
|
||||
SetCcharm(-1);
|
||||
assert(g_pgsCur->ccharm == -1);
|
||||
JtAssert(g_pgsCur->ccharm == -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <game.h>
|
||||
#include <joy.h>
|
||||
#include <gs.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -10,19 +10,19 @@ int main()
|
||||
|
||||
// Test setting coin count
|
||||
SetCcoin(0);
|
||||
assert(g_pgsCur->ccoin == 0);
|
||||
JtAssert(g_pgsCur->ccoin == 0);
|
||||
|
||||
SetCcoin(14);
|
||||
assert(g_pgsCur->ccoin == 14);
|
||||
JtAssert(g_pgsCur->ccoin == 14);
|
||||
|
||||
SetCcoin(99);
|
||||
assert(g_pgsCur->ccoin == 99);
|
||||
JtAssert(g_pgsCur->ccoin == 99);
|
||||
|
||||
SetCcoin(-1);
|
||||
assert(g_pgsCur->ccoin == -1);
|
||||
JtAssert(g_pgsCur->ccoin == -1);
|
||||
|
||||
SetCcoin(101);
|
||||
assert(g_pgsCur->ccoin == 101);
|
||||
JtAssert(g_pgsCur->ccoin == 101);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
#include <gs.h>
|
||||
|
||||
#include <cassert>
|
||||
#include "../test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -8,7 +8,7 @@ int main()
|
||||
|
||||
// Test save file percent calculation
|
||||
int percent = CalculatePercentCompletion(g_pgsCur);
|
||||
assert(percent == 0);
|
||||
JtAssert(percent == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <joy.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -7,16 +7,16 @@ int main()
|
||||
g_grfcht = 0x0;
|
||||
|
||||
AddFcht((int)FCHT::InfiniteCharms);
|
||||
assert(g_grfcht == 0x2);
|
||||
JtAssert(g_grfcht == 0x2);
|
||||
|
||||
AddFcht((int)FCHT::LowGravity);
|
||||
assert(g_grfcht == 0x6);
|
||||
JtAssert(g_grfcht == 0x6);
|
||||
|
||||
AddFcht((int)FCHT::Invulnerability);
|
||||
assert(g_grfcht == 0x7);
|
||||
JtAssert(g_grfcht == 0x7);
|
||||
|
||||
AddFcht((int)FCHT::LowFriction);
|
||||
assert(g_grfcht == 0xF);
|
||||
JtAssert(g_grfcht == 0xF);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
#include <joy.h>
|
||||
#include <gs.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@ -13,12 +13,12 @@ int main()
|
||||
g_pgsCur->clife = 0;
|
||||
|
||||
CheatActivateChetkido();
|
||||
assert(strstr(chetkido_buffer, "The password is: chetkido") != NULL);
|
||||
JtAssert(strstr(chetkido_buffer, "The password is: chetkido") != NULL);
|
||||
|
||||
g_pgsCur->ccoin = 98;
|
||||
|
||||
CheatActivateChetkido();
|
||||
assert(strstr(chetkido_buffer, "The password is: chetkido") == NULL);
|
||||
JtAssert(strstr(chetkido_buffer, "The password is: chetkido") == NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
22
test/test.h
Normal file
22
test/test.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <exception>
|
||||
|
||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
// Custom assert macro that doesn't call abort
|
||||
#define JtAssert(assertion) \
|
||||
{ \
|
||||
if (!(assertion)) \
|
||||
{ \
|
||||
printf( \
|
||||
"\nAn assertion failure has occurred\n" \
|
||||
"========================================\n" \
|
||||
"Assertion: %s\n" \
|
||||
"File: %s\nLine %d, in %s\n" \
|
||||
"========================================\n\n", \
|
||||
#assertion, __FILENAME__, __LINE__, __FUNCTION__); \
|
||||
exit(1); \
|
||||
} \
|
||||
}
|
@ -1,32 +1,35 @@
|
||||
#include <util.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
// disable warning for truncating double to float
|
||||
#pragma warning(disable: 4305)
|
||||
|
||||
int main()
|
||||
{
|
||||
// Clamp value between -1 and 1
|
||||
assert(GLimitAbs(-5, 1) == -1.f);
|
||||
assert(GLimitAbs(-1, 1) == -1.f);
|
||||
assert(GLimitAbs(-0.4, 1) == -0.4f);
|
||||
assert(GLimitAbs(0.76, 1) == 0.76f);
|
||||
assert(GLimitAbs(1, 1) == 1.f);
|
||||
assert(GLimitAbs(17, 1) == 1.f);
|
||||
JtAssert(GLimitAbs(-5, 1) == -1.f);
|
||||
JtAssert(GLimitAbs(-1, 1) == -1.f);
|
||||
JtAssert(GLimitAbs(-0.4, 1) == -0.4f);
|
||||
JtAssert(GLimitAbs(0.76, 1) == 0.76f);
|
||||
JtAssert(GLimitAbs(1, 1) == 1.f);
|
||||
JtAssert(GLimitAbs(17, 1) == 1.f);
|
||||
|
||||
// Clamp value between -3.14 and 3.14
|
||||
assert(GLimitAbs(-5, 3.14) == -3.14f);
|
||||
assert(GLimitAbs(-1, 3.14) == -1.f);
|
||||
assert(GLimitAbs(-0.4, 3.14) == -0.4f);
|
||||
assert(GLimitAbs(0.76, 3.14) == 0.76f);
|
||||
assert(GLimitAbs(3.14, 3.14) == 3.14f);
|
||||
assert(GLimitAbs(17, 3.14) == 3.14f);
|
||||
JtAssert(GLimitAbs(-5, 3.14) == -3.14f);
|
||||
JtAssert(GLimitAbs(-1, 3.14) == -1.f);
|
||||
JtAssert(GLimitAbs(-0.4, 3.14) == -0.4f);
|
||||
JtAssert(GLimitAbs(0.76, 3.14) == 0.76f);
|
||||
JtAssert(GLimitAbs(3.14, 3.14) == 3.14f);
|
||||
JtAssert(GLimitAbs(17, 3.14) == 3.14f);
|
||||
|
||||
// Clamp value between -100 and 100
|
||||
assert(GLimitAbs(-1000, 100) == -100.f);
|
||||
assert(GLimitAbs(-100, 100) == -100.f);
|
||||
assert(GLimitAbs(-17.3, 100) == -17.3f);
|
||||
assert(GLimitAbs(0, 100) == 0.f);
|
||||
assert(GLimitAbs(91, 100) == 91.f);
|
||||
assert(GLimitAbs(100.2, 100) == 100.f);
|
||||
assert(GLimitAbs(420.69, 100) == 100.f);
|
||||
JtAssert(GLimitAbs(-1000, 100) == -100.f);
|
||||
JtAssert(GLimitAbs(-100, 100) == -100.f);
|
||||
JtAssert(GLimitAbs(-17.3, 100) == -17.3f);
|
||||
JtAssert(GLimitAbs(0, 100) == 0.f);
|
||||
JtAssert(GLimitAbs(91, 100) == 91.f);
|
||||
JtAssert(GLimitAbs(100.2, 100) == 100.f);
|
||||
JtAssert(GLimitAbs(420.69, 100) == 100.f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,23 +1,25 @@
|
||||
#include <util.h>
|
||||
#include "../assert.h"
|
||||
#include "../test.h"
|
||||
|
||||
#pragma warning(disable: 4305)
|
||||
|
||||
int main()
|
||||
{
|
||||
// Clamp value using global 0-1 limit
|
||||
assert(GLimitLm(&g_lmZeroOne, -2.3) == 0.f);
|
||||
assert(GLimitLm(&g_lmZeroOne, 0) == 0.f);
|
||||
assert(GLimitLm(&g_lmZeroOne, 0.234) == 0.234f);
|
||||
assert(GLimitLm(&g_lmZeroOne, 0.7) == 0.7f);
|
||||
assert(GLimitLm(&g_lmZeroOne, 1) == 1.f);
|
||||
assert(GLimitLm(&g_lmZeroOne, 4) == 1.f);
|
||||
JtAssert(GLimitLm(&g_lmZeroOne, -2.3) == 0.f);
|
||||
JtAssert(GLimitLm(&g_lmZeroOne, 0) == 0.f);
|
||||
JtAssert(GLimitLm(&g_lmZeroOne, 0.234) == 0.234f);
|
||||
JtAssert(GLimitLm(&g_lmZeroOne, 0.7) == 0.7f);
|
||||
JtAssert(GLimitLm(&g_lmZeroOne, 1) == 1.f);
|
||||
JtAssert(GLimitLm(&g_lmZeroOne, 4) == 1.f);
|
||||
|
||||
// Clamp value using local limit
|
||||
LM lmFiveTen(5, 10);
|
||||
assert(GLimitLm(&lmFiveTen, 1) == 5.f);
|
||||
assert(GLimitLm(&lmFiveTen, 5) == 5.f);
|
||||
assert(GLimitLm(&lmFiveTen, 7) == 7.f);
|
||||
assert(GLimitLm(&lmFiveTen, 10) == 10.f);
|
||||
assert(GLimitLm(&lmFiveTen, 99) == 10.f);
|
||||
JtAssert(GLimitLm(&lmFiveTen, 1) == 5.f);
|
||||
JtAssert(GLimitLm(&lmFiveTen, 5) == 5.f);
|
||||
JtAssert(GLimitLm(&lmFiveTen, 7) == 7.f);
|
||||
JtAssert(GLimitLm(&lmFiveTen, 10) == 10.f);
|
||||
JtAssert(GLimitLm(&lmFiveTen, 99) == 10.f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
#include <xform.h>
|
||||
#include "../assert.h"
|
||||
#include <cassert>
|
||||
|
||||
#include "../test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
EXIT exit;
|
||||
|
||||
// todo: why does the custom assert macro cause errors here
|
||||
|
||||
SetExitExits(&exit, EXITS::Blocked);
|
||||
assert(exit.fKeyed == EXITS::Blocked);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user