31 lines
843 B
C
31 lines
843 B
C
#include "cutest-1.5/CuTest.h"
|
|
#include "movement.h"
|
|
|
|
#include "const.h"
|
|
|
|
void TestCalculateTargetAngle_AgainstTopRight(CuTest *tc) {
|
|
struct RabbitPosition rabbitPosition;
|
|
|
|
// mouse against very edge
|
|
rabbitPosition.mouseDotPosition[0] = 199;
|
|
rabbitPosition.mouseDotPosition[1] = 0;
|
|
|
|
// rabbit against wall
|
|
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]);
|
|
CuAssertIntEquals(tc, 21, rabbitPosition.mousePosition[1]);
|
|
CuAssertIntEquals(tc, 41, rabbitPosition.mouseAngle);
|
|
}
|
|
|
|
CuSuite *MovementGetSuite() {
|
|
CuSuite *suite = CuSuiteNew();
|
|
SUITE_ADD_TEST(suite, TestCalculateTargetAngle_AgainstTopRight);
|
|
return suite;
|
|
}
|