31 lines
847 B
C
31 lines
847 B
C
|
#include "cutest-1.5/CuTest.h"
|
||
|
#include "movement.h"
|
||
|
|
||
|
#include "const.h"
|
||
|
|
||
|
void TestCalculateTargetAngle_AgainstRightWall(CuTest *tc) {
|
||
|
struct RabbitPosition rabbitPosition;
|
||
|
|
||
|
// mouse against very edge
|
||
|
rabbitPosition.mouseDotPosition[0] = 199;
|
||
|
rabbitPosition.mouseDotPosition[1] = 30;
|
||
|
|
||
|
// rabbit against wall
|
||
|
rabbitPosition.rabbitPosition[0] = 179;
|
||
|
rabbitPosition.rabbitPosition[1] = 80;
|
||
|
|
||
|
calculateTargetAngle(&rabbitPosition);
|
||
|
|
||
|
// mouse should not extend (tile width - mouse width) past player
|
||
|
|
||
|
CuAssertIntEquals(tc, 180, rabbitPosition.mousePosition[0]);
|
||
|
CuAssertIntEquals(tc, 105, rabbitPosition.mousePosition[1]);
|
||
|
CuAssertIntEquals(tc, 21, rabbitPosition.mouseAngle);
|
||
|
}
|
||
|
|
||
|
CuSuite *MovementGetSuite() {
|
||
|
CuSuite *suite = CuSuiteNew();
|
||
|
SUITE_ADD_TEST(suite, TestCalculateTargetAngle_AgainstRightWall);
|
||
|
return suite;
|
||
|
}
|