Deleted C++ test scripts.
- These tests create a great deal of duplicated work. - The only errors caught by these tests would be errors that occur in the C client only when compiled by a C++ compiler. - This error case is deemed unlikely enough that it is not worth the extra work to maintain two sets of tests.
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CPPTests", "CPPTests.vcxproj", "{9BA85F4F-A75A-4C27-BD85-2FEF881BEA13}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9BA85F4F-A75A-4C27-BD85-2FEF881BEA13}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9BA85F4F-A75A-4C27-BD85-2FEF881BEA13}.Debug|Win32.Build.0 = Debug|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{9BA85F4F-A75A-4C27-BD85-2FEF881BEA13}</ProjectGuid>
|
||||
<RootNamespace>CPPTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>../../C/src;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\C\src\xplaneConnect.c" />
|
||||
<ClCompile Include="..\CPP Tests\main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\CPP Tests\main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\C\src\xplaneConnect.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,79 +0,0 @@
|
||||
.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
|
||||
.\"See Also:
|
||||
.\"man mdoc.samples for a complete listing of options
|
||||
.\"man mdoc for the short list of editing options
|
||||
.\"/usr/share/misc/mdoc.template
|
||||
.Dd 11/25/14 \" DATE
|
||||
.Dt XPC Tests 1 \" Program name and manual section number
|
||||
.Os Darwin
|
||||
.Sh NAME \" Section Header - required - don't modify
|
||||
.Nm XPC Tests,
|
||||
.\" The following lines are read in generating the apropos(man -k) database. Use only key
|
||||
.\" words here as the database is built based on the words here and in the .ND line.
|
||||
.Nm Other_name_for_same_program(),
|
||||
.Nm Yet another name for the same program.
|
||||
.\" Use .Nm macro to designate other names for the documented program.
|
||||
.Nd This line parsed for whatis database.
|
||||
.Sh SYNOPSIS \" Section Header - required - don't modify
|
||||
.Nm
|
||||
.Op Fl abcd \" [-abcd]
|
||||
.Op Fl a Ar path \" [-a path]
|
||||
.Op Ar file \" [file]
|
||||
.Op Ar \" [file ...]
|
||||
.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
|
||||
arg2 ... \" Arguments
|
||||
.Sh DESCRIPTION \" Section Header - required - don't modify
|
||||
Use the .Nm macro to refer to your program throughout the man page like such:
|
||||
.Nm
|
||||
Underlining is accomplished with the .Ar macro like this:
|
||||
.Ar underlined text .
|
||||
.Pp \" Inserts a space
|
||||
A list of items with descriptions:
|
||||
.Bl -tag -width -indent \" Begins a tagged list
|
||||
.It item a \" Each item preceded by .It macro
|
||||
Description of item a
|
||||
.It item b
|
||||
Description of item b
|
||||
.El \" Ends the list
|
||||
.Pp
|
||||
A list of flags and their descriptions:
|
||||
.Bl -tag -width -indent \" Differs from above in tag removed
|
||||
.It Fl a \"-a flag as a list item
|
||||
Description of -a flag
|
||||
.It Fl b
|
||||
Description of -b flag
|
||||
.El \" Ends the list
|
||||
.Pp
|
||||
.\" .Sh ENVIRONMENT \" May not be needed
|
||||
.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
|
||||
.\" .It Ev ENV_VAR_1
|
||||
.\" Description of ENV_VAR_1
|
||||
.\" .It Ev ENV_VAR_2
|
||||
.\" Description of ENV_VAR_2
|
||||
.\" .El
|
||||
.Sh FILES \" File used or created by the topic of the man page
|
||||
.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
|
||||
.It Pa /usr/share/file_name
|
||||
FILE_1 description
|
||||
.It Pa /Users/joeuser/Library/really_long_file_name
|
||||
FILE_2 description
|
||||
.El \" Ends the list
|
||||
.\" .Sh DIAGNOSTICS \" May not be needed
|
||||
.\" .Bl -diag
|
||||
.\" .It Diagnostic Tag
|
||||
.\" Diagnostic informtion here.
|
||||
.\" .It Diagnostic Tag
|
||||
.\" Diagnostic informtion here.
|
||||
.\" .El
|
||||
.Sh SEE ALSO
|
||||
.\" List links in ascending order by section, alphabetically within a section.
|
||||
.\" Please do not reference files that do not exist without filing a bug report
|
||||
.Xr a 1 ,
|
||||
.Xr b 1 ,
|
||||
.Xr c 1 ,
|
||||
.Xr a 2 ,
|
||||
.Xr b 2 ,
|
||||
.Xr a 3 ,
|
||||
.Xr b 3
|
||||
.\" .Sh BUGS \" Document known, unremedied bugs
|
||||
.\" .Sh HISTORY \" Document history if command behaves in a unique manner
|
||||
@@ -1,490 +0,0 @@
|
||||
//
|
||||
// main.cpp
|
||||
// XPC Tests
|
||||
//
|
||||
// Created by Chris Teubert on 11/25/14.
|
||||
// Copyright (c) 2014 Chris Teubert. All rights reserved.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
#include <time.h>
|
||||
#include <exception>
|
||||
#include "xplaneconnect.h"
|
||||
|
||||
int testFailed = 0;
|
||||
int testPassed = 0;
|
||||
|
||||
void runTest(void (*f)())
|
||||
{
|
||||
try {
|
||||
std::cout << "Test " << testPassed+testFailed+1<<": ";
|
||||
(*f)(); // Run Test
|
||||
std::cout << "PASSED\n";
|
||||
testPassed++;
|
||||
}
|
||||
catch (int i)
|
||||
{
|
||||
std::cerr << "FAILED\n\tError: " << i << std::endl;
|
||||
testFailed++;
|
||||
}
|
||||
catch (char c)
|
||||
{
|
||||
std::cerr << "FAILED\n\tError: " << c << std::endl;
|
||||
testFailed++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void openUDPTest() // openUDP Test
|
||||
{
|
||||
std::cout << "openUDP - ";
|
||||
struct xpcSocket sendPort = openUDP( 49062, "127.0.0.1", 49009 );
|
||||
}
|
||||
|
||||
void closeUDPTest() // closeUDP test
|
||||
{
|
||||
std::cout << "closeUDP - ";
|
||||
struct xpcSocket sendPort = openUDP( 49063, "127.0.0.1", 49009 );
|
||||
closeUDP(sendPort);
|
||||
sendPort = openUDP( 49063, "127.0.0.1", 49009 );
|
||||
closeUDP(sendPort);
|
||||
}
|
||||
|
||||
void sendReadTest() // send/read Test
|
||||
{
|
||||
std::cout << "send/readUDP - ";
|
||||
|
||||
// Initialization
|
||||
int i; // Iterator
|
||||
char test[] = {0, 1, 2, 3, 5};
|
||||
char buf[5] = {0};
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
|
||||
// Setup
|
||||
sendPort = openUDP( 49064, "127.0.0.1", 49063 );
|
||||
recvPort = openUDP( 49063, "127.0.0.1", 49009 );
|
||||
|
||||
// Execution
|
||||
sendUDP( sendPort, test, sizeof(test) );
|
||||
readUDP( recvPort, buf, NULL ); // Test
|
||||
|
||||
// Close
|
||||
closeUDP(sendPort);
|
||||
closeUDP(recvPort);
|
||||
|
||||
// Tests
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
if (test[i] != buf[i]) // Not received correctly
|
||||
{
|
||||
throw 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void requestDREFTest() // Request DREF Test (Required for next tests)
|
||||
{
|
||||
std::cout << "requestDREF - ";
|
||||
|
||||
// Initialization
|
||||
int i; // Iterator
|
||||
char DREFArray[100][100];
|
||||
float *recDATA[100];
|
||||
short DREFSizes[100];
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
short result = 0;
|
||||
|
||||
// Setup
|
||||
for (i = 0; i < 100; i++) {
|
||||
recDATA[i] = (float *) malloc(40*sizeof(float));
|
||||
memset(DREFArray[i],0,100);
|
||||
}
|
||||
sendPort = openUDP( 49064, "127.0.0.1", 49009 );
|
||||
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
||||
strcpy(DREFArray[0],"sim/cockpit/switches/gear_handle_status");
|
||||
strcpy(DREFArray[1],"sim/cockpit2/switches/panel_brightness_ratio");
|
||||
for (i=0;i<2;i++) {
|
||||
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
||||
}
|
||||
|
||||
// Execution
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 2, recDATA, DREFSizes);
|
||||
|
||||
// Close
|
||||
closeUDP(sendPort);
|
||||
closeUDP(recvPort);
|
||||
|
||||
// Tests
|
||||
if ( result < 0)// Request 2 values
|
||||
{
|
||||
throw 1;
|
||||
}
|
||||
if (DREFSizes[0] != 1 || DREFSizes[1] != 4)
|
||||
{
|
||||
throw 2;
|
||||
}
|
||||
}
|
||||
|
||||
void sendDREFTest() // sendDREF test
|
||||
{
|
||||
std::cout << "sendDREF - ";
|
||||
|
||||
// Initialization
|
||||
int i; // Iterator
|
||||
char DREFArray[100][100];
|
||||
float *recDATA[100];
|
||||
short DREFSizes[100];
|
||||
float value = 0.0;
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
short result = 0;
|
||||
|
||||
// Setup
|
||||
for (i = 0; i < 100; i++) {
|
||||
recDATA[i] = (float *) malloc(40*sizeof(float));
|
||||
memset(DREFArray[i],0,100);
|
||||
}
|
||||
sendPort = openUDP( 49066, "127.0.0.1", 49009 );
|
||||
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
||||
strcpy(DREFArray[0],"sim/cockpit/switches/gear_handle_status");
|
||||
for (i=0;i<1;i++) {
|
||||
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
||||
}
|
||||
|
||||
// Execution
|
||||
sendDREF(sendPort, DREFArray[0], DREFSizes[0], &value, 1);
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 1, recDATA, DREFSizes);
|
||||
|
||||
// Close
|
||||
closeUDP(sendPort);
|
||||
closeUDP(recvPort);
|
||||
|
||||
// Tests
|
||||
if (result < 0)// Request 1 value
|
||||
{
|
||||
throw 1;
|
||||
}
|
||||
if (DREFSizes[0] != 1)
|
||||
{
|
||||
throw 2;
|
||||
}
|
||||
if (*recDATA[0] != value)
|
||||
{
|
||||
throw 3;
|
||||
}
|
||||
}
|
||||
|
||||
void sendDATATest() // sendDATA test
|
||||
{
|
||||
std::cout << "sendData - ";
|
||||
|
||||
// Initialize
|
||||
int i,j; // Iterator
|
||||
char DREFArray[100][100];
|
||||
float data[4][9] = {0};
|
||||
float *recDATA[100];
|
||||
short DREFSizes[100];
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
short result = 0;
|
||||
|
||||
// Setup
|
||||
for (i = 0; i < 100; i++) {
|
||||
recDATA[i] = (float *) malloc(40*sizeof(float));
|
||||
memset(DREFArray[i],0,100);
|
||||
}
|
||||
sendPort = openUDP( 49066, "127.0.0.1", 49009 );
|
||||
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
||||
strcpy(DREFArray[0],"sim/aircraft/parts/acf_gear_deploy");
|
||||
for (i=0;i<1;i++) {
|
||||
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
||||
}
|
||||
for (i=0;i<4;i++) { // Set array to -999
|
||||
for (j=0;j<9;j++) data[i][j] = -999;
|
||||
}
|
||||
data[0][0] = 14; // Gear
|
||||
data[0][1] = 1;
|
||||
data[0][2] = 0;
|
||||
|
||||
// Execution
|
||||
sendDATA(sendPort, data, 1); // Gear
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 1, recDATA, DREFSizes); // Test
|
||||
|
||||
// Close
|
||||
closeUDP(sendPort);
|
||||
closeUDP(recvPort);
|
||||
|
||||
// Tests
|
||||
if ( result < 0 )// Request 1 value
|
||||
{
|
||||
throw 1;
|
||||
}
|
||||
if (DREFSizes[0] != 10)
|
||||
{
|
||||
throw 2;
|
||||
}
|
||||
if (*recDATA[0] != data[0][1])
|
||||
{
|
||||
throw 3;
|
||||
}
|
||||
}
|
||||
|
||||
void sendCTRLTest() // sendCTRL test
|
||||
{
|
||||
std::cout << "sendCTRL - ";
|
||||
|
||||
// Initialize
|
||||
int i; // Iterator
|
||||
char DREFArray[100][100];
|
||||
float CTRL[6] = {0.0};
|
||||
float *recDATA[100];
|
||||
short DREFSizes[100];
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
short result;
|
||||
|
||||
// Setup
|
||||
for (i = 0; i < 100; i++) {
|
||||
recDATA[i] = (float *) malloc(40*sizeof(float));
|
||||
memset(DREFArray[i],0,100);
|
||||
}
|
||||
sendPort = openUDP( 49066, "127.0.0.1", 49009 );
|
||||
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
||||
strcpy(DREFArray[0],"sim/cockpit2/controls/yoke_pitch_ratio");
|
||||
strcpy(DREFArray[1],"sim/cockpit2/controls/yoke_roll_ratio");
|
||||
strcpy(DREFArray[2],"sim/cockpit2/controls/yoke_heading_ratio");
|
||||
strcpy(DREFArray[3],"sim/flightmodel/engine/ENGN_thro");
|
||||
strcpy(DREFArray[4],"sim/cockpit/switches/gear_handle_status");
|
||||
strcpy(DREFArray[5],"sim/flightmodel/controls/flaprqst");
|
||||
for (i = 0; i < 100; i++) {
|
||||
DREFSizes[i] = (int)strlen(DREFArray[i]);
|
||||
}
|
||||
CTRL[3] = 0.8; // Throttle
|
||||
CTRL[4] = 1.0; // Gear
|
||||
CTRL[5] = 0.5; // Flaps
|
||||
|
||||
// Execute
|
||||
sendCTRL(sendPort, 6, CTRL);
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 6, recDATA, DREFSizes); // Test
|
||||
|
||||
// Close
|
||||
closeUDP(sendPort);
|
||||
closeUDP(recvPort);
|
||||
|
||||
// Tests
|
||||
if ( result < 0 )// Request 1 value
|
||||
{
|
||||
throw -6;
|
||||
}
|
||||
for (i=0;i<6;i++)
|
||||
{
|
||||
if (std::abs( recDATA[i][0]-CTRL[i])>1e-4)
|
||||
{
|
||||
throw -i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sendPOSITest() // sendPOSI test
|
||||
{
|
||||
std::cout << "sendPOSI - ";
|
||||
|
||||
// Initialization
|
||||
int i; // Iterator
|
||||
char DREFArray[100][100];
|
||||
float POSI[8] = {0.0};
|
||||
float *recDATA[100];
|
||||
short DREFSizes[100];
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
short result;
|
||||
|
||||
// Setup
|
||||
for (i = 0; i < 100; i++) {
|
||||
recDATA[i] = (float *) malloc(40*sizeof(float));
|
||||
memset(DREFArray[i],0,100);
|
||||
}
|
||||
sendPort = openUDP( 49063, "127.0.0.1", 49009 );
|
||||
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
||||
strcpy(DREFArray[0],"sim/flightmodel/position/latitude");
|
||||
strcpy(DREFArray[1],"sim/flightmodel/position/longitude");
|
||||
strcpy(DREFArray[2],"sim/flightmodel/position/y_agl");
|
||||
strcpy(DREFArray[3],"sim/flightmodel/position/phi");
|
||||
strcpy(DREFArray[4],"sim/flightmodel/position/theta");
|
||||
strcpy(DREFArray[5],"sim/flightmodel/position/psi");
|
||||
strcpy(DREFArray[6],"sim/cockpit/switches/gear_handle_status");
|
||||
for (i=0;i<7;i++) {
|
||||
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
||||
}
|
||||
POSI[0] = 37.524; // Lat
|
||||
POSI[1] = -122.06899; // Lon
|
||||
POSI[2] = 2500; // Alt
|
||||
POSI[3] = 0; // Pitch
|
||||
POSI[4] = 0; // Roll
|
||||
POSI[5] = 0; // Heading
|
||||
POSI[6] = 1; // Gear
|
||||
|
||||
// Execution
|
||||
sendPOSI( sendPort, 0, 7, POSI );
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 7, recDATA, DREFSizes); // Test
|
||||
|
||||
// Close
|
||||
closeUDP(sendPort);
|
||||
closeUDP(recvPort);
|
||||
|
||||
// Tests
|
||||
if ( result < 0 )// Request 1 value
|
||||
{
|
||||
throw -7;
|
||||
}
|
||||
for (i=0;i<7-1;i++)
|
||||
{
|
||||
if (i==2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (std::abs(recDATA[i][0]-POSI[i])>1e-4)
|
||||
{
|
||||
throw -i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pauseTest() // pauseSim test
|
||||
{
|
||||
std::cout << "pauseSim - ";
|
||||
|
||||
// Initialize
|
||||
int i; // Iterator
|
||||
char DREFArray[100][100];
|
||||
float *recDATA[100];
|
||||
short DREFSizes[100],RECSizes[100];
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
short result;
|
||||
|
||||
// Setup
|
||||
for (i = 0; i < 100; i++) {
|
||||
recDATA[i] = (float *) malloc(40*sizeof(float));
|
||||
memset(DREFArray[i],0,100);
|
||||
}
|
||||
|
||||
// Setup
|
||||
sendPort = openUDP( 49064, "127.0.0.1", 49009 );
|
||||
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
||||
strcpy(DREFArray[0],"sim/operation/override/override_planepath");
|
||||
for (i=0;i<1;i++) {
|
||||
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
||||
}
|
||||
|
||||
// Execute
|
||||
pauseSim(sendPort, 1);
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 1, recDATA, RECSizes); // Test
|
||||
|
||||
// Close
|
||||
closeUDP(sendPort);
|
||||
closeUDP(recvPort);
|
||||
|
||||
// Test
|
||||
if (result < 0) {
|
||||
throw -1;
|
||||
}
|
||||
if (recDATA[0][0] != 1)
|
||||
{
|
||||
throw -2;
|
||||
}
|
||||
|
||||
// Reopen
|
||||
sendPort = openUDP( 49064, "127.0.0.1", 49009 );
|
||||
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
||||
|
||||
// Execute 2
|
||||
pauseSim(sendPort, 0);
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 1, recDATA, RECSizes); // Test
|
||||
|
||||
// Close 2
|
||||
closeUDP(sendPort);
|
||||
closeUDP(recvPort);
|
||||
|
||||
// Test 2
|
||||
if (result < 0)
|
||||
{
|
||||
throw -3;
|
||||
}
|
||||
if (recDATA[0][0] != 0)
|
||||
{
|
||||
throw -4;
|
||||
}
|
||||
}
|
||||
|
||||
void connTest() // setConn test
|
||||
{
|
||||
std::cout << "setConn - ";
|
||||
|
||||
// Initialize
|
||||
int i; // Iterator
|
||||
char DREFArray[100][100];
|
||||
float *recDATA[100];
|
||||
short DREFSizes[100];
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
short result = 0;
|
||||
#if (__APPLE__ || __linux)
|
||||
usleep(0);
|
||||
#endif
|
||||
|
||||
// Setup
|
||||
sendPort = openUDP( 49067, "127.0.0.1", 49009 );
|
||||
recvPort = openUDP( 49055, "127.0.0.1", 49009 );
|
||||
strcpy(DREFArray[0],"sim/cockpit/switches/gear_handle_status");
|
||||
for (i=0;i<1;i++) {
|
||||
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
||||
}
|
||||
|
||||
// Execution
|
||||
setCONN(sendPort, 49055);
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 1, recDATA, DREFSizes); // Test
|
||||
|
||||
// Close
|
||||
closeUDP(sendPort);
|
||||
closeUDP(recvPort);
|
||||
|
||||
// Test
|
||||
if ( result < 0 )// No data received
|
||||
{
|
||||
throw 1;
|
||||
}
|
||||
|
||||
|
||||
// Set up for next test
|
||||
sendPort = openUDP( 49067, "127.0.0.1", 49009 );
|
||||
setCONN(sendPort, 49008);
|
||||
closeUDP(sendPort);
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
std::cout << "XPC Tests-cpp ";
|
||||
|
||||
#ifdef _WIN32
|
||||
std::cout << "(Windows)\n";
|
||||
#elif (__APPLE__)
|
||||
std::cout << "(Mac) \n";
|
||||
#elif (__linux)
|
||||
std::cout << "(Linux) \n";
|
||||
#endif
|
||||
|
||||
runTest(openUDPTest);
|
||||
runTest(closeUDPTest);
|
||||
runTest(sendReadTest);
|
||||
runTest(requestDREFTest);
|
||||
runTest(sendDREFTest);
|
||||
runTest(sendDATATest);
|
||||
runTest(sendCTRLTest);
|
||||
runTest(sendPOSITest);
|
||||
runTest(pauseTest);
|
||||
runTest(connTest);
|
||||
|
||||
std::cout << "----------------\nTest Summary\n\tFailed: " << testFailed << "\n\tPassed: " << testPassed << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
BE7C5C021A28F72F00F246B9 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE7C5C001A28F72F00F246B9 /* main.cpp */; };
|
||||
BEB0F4F81A28F7B0001975A6 /* xplaneConnect.c in Sources */ = {isa = PBXBuildFile; fileRef = BEB0F4F61A28F7B0001975A6 /* xplaneConnect.c */; };
|
||||
BEB0F4F91A28F7B0001975A6 /* xplaneConnect.h in Sources */ = {isa = PBXBuildFile; fileRef = BEB0F4F71A28F7B0001975A6 /* xplaneConnect.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
BE9C6BA91A253FA100EBE08A /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
BE7C5C001A28F72F00F246B9 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = "CPP Tests/main.cpp"; sourceTree = SOURCE_ROOT; };
|
||||
BE7C5C011A28F72F00F246B9 /* Cpp_Tests.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; name = Cpp_Tests.1; path = "CPP Tests/Cpp_Tests.1"; sourceTree = SOURCE_ROOT; };
|
||||
BE9C6BAB1A253FA100EBE08A /* Cpp Tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Cpp Tests"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BEB0F4F61A28F7B0001975A6 /* xplaneConnect.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = xplaneConnect.c; path = ../C/src/xplaneConnect.c; sourceTree = "<group>"; };
|
||||
BEB0F4F71A28F7B0001975A6 /* xplaneConnect.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = xplaneConnect.h; path = ../C/src/xplaneConnect.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
BE9C6BA81A253FA100EBE08A /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
BE9C6BA21A253FA100EBE08A = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BEB0F4F61A28F7B0001975A6 /* xplaneConnect.c */,
|
||||
BEB0F4F71A28F7B0001975A6 /* xplaneConnect.h */,
|
||||
BE9C6BAD1A253FA100EBE08A /* Cpp Tests */,
|
||||
BE9C6BAC1A253FA100EBE08A /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BE9C6BAC1A253FA100EBE08A /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BE9C6BAB1A253FA100EBE08A /* Cpp Tests */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BE9C6BAD1A253FA100EBE08A /* Cpp Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BE7C5C001A28F72F00F246B9 /* main.cpp */,
|
||||
BE7C5C011A28F72F00F246B9 /* Cpp_Tests.1 */,
|
||||
);
|
||||
name = "Cpp Tests";
|
||||
path = "XPC Tests";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
BE9C6BAA1A253FA100EBE08A /* Cpp Tests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = BE9C6BB41A253FA100EBE08A /* Build configuration list for PBXNativeTarget "Cpp Tests" */;
|
||||
buildPhases = (
|
||||
BE9C6BA71A253FA100EBE08A /* Sources */,
|
||||
BE9C6BA81A253FA100EBE08A /* Frameworks */,
|
||||
BE9C6BA91A253FA100EBE08A /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Cpp Tests";
|
||||
productName = "XPC Tests";
|
||||
productReference = BE9C6BAB1A253FA100EBE08A /* Cpp Tests */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
BE9C6BA31A253FA100EBE08A /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0500;
|
||||
ORGANIZATIONNAME = "Chris Teubert";
|
||||
};
|
||||
buildConfigurationList = BE9C6BA61A253FA100EBE08A /* Build configuration list for PBXProject "Cpp Tests" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = BE9C6BA21A253FA100EBE08A;
|
||||
productRefGroup = BE9C6BAC1A253FA100EBE08A /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
BE9C6BAA1A253FA100EBE08A /* Cpp Tests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
BE9C6BA71A253FA100EBE08A /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BEB0F4F81A28F7B0001975A6 /* xplaneConnect.c in Sources */,
|
||||
BEB0F4F91A28F7B0001975A6 /* xplaneConnect.h in Sources */,
|
||||
BE7C5C021A28F72F00F246B9 /* main.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
BE9C6BB21A253FA100EBE08A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
BE9C6BB31A253FA100EBE08A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
BE9C6BB51A253FA100EBE08A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "Cpp Tests";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
BE9C6BB61A253FA100EBE08A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "Cpp Tests";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
BE9C6BA61A253FA100EBE08A /* Build configuration list for PBXProject "Cpp Tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BE9C6BB21A253FA100EBE08A /* Debug */,
|
||||
BE9C6BB31A253FA100EBE08A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
BE9C6BB41A253FA100EBE08A /* Build configuration list for PBXNativeTarget "Cpp Tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BE9C6BB51A253FA100EBE08A /* Debug */,
|
||||
BE9C6BB61A253FA100EBE08A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = BE9C6BA31A253FA100EBE08A /* Project object */;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:Cpp Tests.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
Reference in New Issue
Block a user