dos-vga-arena-shooter-game/movement_test.c

31 lines
843 B
C
Raw Normal View History

#include "cutest-1.5/CuTest.h"
#include "movement.h"
#include "const.h"
2024-03-04 22:38:03 +00:00
void TestCalculateTargetAngle_AgainstTopRight(CuTest *tc) {
struct RabbitPosition rabbitPosition;
// mouse against very edge
rabbitPosition.mouseDotPosition[0] = 199;
2024-03-04 22:38:03 +00:00
rabbitPosition.mouseDotPosition[1] = 0;
// rabbit against wall
2024-03-04 22:38:03 +00:00
rabbitPosition.rabbitPosition[0] = 177;
rabbitPosition.rabbitPosition[1] = 25;
calculateTargetAngle(&rabbitPosition);
// mouse should not extend (tile width - mouse width) past player
CuAssertIntEquals(tc, 180, rabbitPosition.mousePosition[0]);
2024-03-04 22:38:03 +00:00
CuAssertIntEquals(tc, 21, rabbitPosition.mousePosition[1]);
CuAssertIntEquals(tc, 41, rabbitPosition.mouseAngle);
}
CuSuite *MovementGetSuite() {
CuSuite *suite = CuSuiteNew();
2024-03-04 22:38:03 +00:00
SUITE_ADD_TEST(suite, TestCalculateTargetAngle_AgainstTopRight);
return suite;
}