Added getPOSI and getCTRL support to the C client.

This commit is contained in:
Jason Watkins
2015-05-16 09:26:27 -07:00
parent 292f347982
commit 0b562d1fce
6 changed files with 169 additions and 1 deletions

View File

@@ -40,6 +40,33 @@ int doPOSITest(char* drefs[7], float values[], int size, int ac, float expected[
return compareArray(expected, actual, 7);
}
int doGETPTest(float values[7], int ac, float expected[7])
{
// Execute Test
float actual[7];
XPCSocket sock = openUDP(IP);
int result = sendPOSI(sock, values, 7, ac);
if (result >= 0)
{
result = getPOSI(sock, actual, ac);
}
closeUDP(sock);
if (result < 0)
{
return -1;
}
// Test values
for (int i = 0; i < 7; ++i)
{
if (fabs(expected[i] - actual[i]) > 1e-4)
{
return -10 - i;
}
}
return 0;
}
int basicPOSITest(char** drefs, int ac)
{
// Set psoition and initial orientation
@@ -116,6 +143,16 @@ int testPOSI_NonPlayer()
return basicPOSITest(drefs, 1);
}
int testGetPOSI_Player()
{
float POSI[7] = { 37.524F, -122.06899F, 2500, 0, 0, 0, 1 };
doGETPTest(POSI, 0, POSI);
}
int testGetPOSI_NonPlayer()
{
float POSI[7] = { 37.624F, -122.06899F, 1500, 0, 0, 0, 1 };
doGETPTest(POSI, 3, POSI);
}
#endif