Merge pull request #28 from jason-watkins/feature/test-scripts
C++ and MATLAB testing improvements
This commit is contained in:
19
TestScripts/CPP Tests.win/CPPTests.sln
Normal file
19
TestScripts/CPP Tests.win/CPPTests.sln
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
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
|
||||
75
TestScripts/CPP Tests.win/CPPTests.vcxproj
Normal file
75
TestScripts/CPP Tests.win/CPPTests.vcxproj
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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>
|
||||
25
TestScripts/CPP Tests.win/CPPTests.vcxproj.filters
Normal file
25
TestScripts/CPP Tests.win/CPPTests.vcxproj.filters
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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>
|
||||
@@ -58,7 +58,7 @@ void sendReadTest() // send/read Test
|
||||
|
||||
// Initialization
|
||||
int i; // Iterator
|
||||
char test[] = {0, 1, 2, 3};
|
||||
char test[] = {0, 1, 2, 3, 5};
|
||||
char buf[5] = {0};
|
||||
struct xpcSocket sendPort, recvPort;
|
||||
|
||||
@@ -256,14 +256,14 @@ void sendCTRLTest() // sendCTRL test
|
||||
strcpy(DREFArray[3],"sim/flightmodel/engine/ENGN_thro");
|
||||
strcpy(DREFArray[4],"sim/cockpit/switches/gear_handle_status");
|
||||
strcpy(DREFArray[5],"sim/flightmodel/controls/flaprqsts");
|
||||
for (i=0;i<5;i++) {
|
||||
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
||||
}
|
||||
for (i = 0; i < 100; i++) {
|
||||
DREFSizes[i] = (int)strlen(DREFArray[i]);
|
||||
}
|
||||
CTRL[3] = 0.8; // Throttle
|
||||
|
||||
// Execute
|
||||
sendCTRL(sendPort, 4, CTRL);
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 1, recDATA, DREFSizes); // Test
|
||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 6, recDATA, DREFSizes); // Test
|
||||
|
||||
// Close
|
||||
closeUDP(sendPort);
|
||||
|
||||
@@ -6,6 +6,10 @@ import XPlaneConnect.*
|
||||
|
||||
socket = openUDP( 49007 );
|
||||
|
||||
closeUDP( socket );
|
||||
assert(isequal(socket.isClosed(),1),'openCloseTest: socket is still open');
|
||||
|
||||
socket = openUDP( 49007 );
|
||||
closeUDP( socket );
|
||||
|
||||
end
|
||||
|
||||
@@ -5,15 +5,15 @@ addpath('../../MATLAB')
|
||||
import XPlaneConnect.*
|
||||
|
||||
DREFS = {'sim/operation/override/override_planepath'};
|
||||
value = 0; % Resume
|
||||
|
||||
value = 1; % Pause
|
||||
|
||||
pauseSim(value);
|
||||
result = requestDREF(DREFS);
|
||||
|
||||
assert(isequal(length(result),1),'pauseTest: requestDREF unsucessful-wrong number of elements returned');
|
||||
assert(abs(result{1}(1)-value)<1e-4,'pauseTest: Pause Unsuccessful');
|
||||
|
||||
value = 1; % Pause
|
||||
value = 0; % Resume
|
||||
|
||||
pauseSim(value);
|
||||
result = requestDREF(DREFS);
|
||||
|
||||
@@ -6,13 +6,14 @@ disp('Not Functional Yet!')
|
||||
addpath('../../MATLAB')
|
||||
import XPlaneConnect.*
|
||||
|
||||
DREFS = {'sim/operation/override/override_planepath'};
|
||||
value = 0; % Resume
|
||||
DREFS = {'sim/cockpit/switches/gear_handle_status'};
|
||||
|
||||
setConn(value);
|
||||
setConn(49055);
|
||||
result = requestDREF(DREFS);
|
||||
|
||||
assert(isequal(length(result),1),'setConnTest: requestDREF unsucessful-wrong number of elements returned');
|
||||
|
||||
setConn(49009);
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ theTests = {{@openCloseTest, 'Open/Close Test', 0},...
|
||||
{@CTRLTest,'CTRL Test', 0},...
|
||||
{@POSITest,'POSI Test', 0},...
|
||||
{@pauseTest,'Pause Test', 0},...
|
||||
{@struTest,'Struct Test', 0}};
|
||||
{@struTest,'Struct Test', 0},...
|
||||
{@setConnTest, 'setConn Test', 0}};
|
||||
|
||||
for i=1:length(theTests)
|
||||
fprintf(['Test ',num2str(i),': ',theTests{i}{2},' - ']);
|
||||
|
||||
Reference in New Issue
Block a user