diff --git a/TestScripts/CPP Tests.win/CPPTests.sln b/TestScripts/CPP Tests.win/CPPTests.sln new file mode 100644 index 0000000..ece566f --- /dev/null +++ b/TestScripts/CPP Tests.win/CPPTests.sln @@ -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 diff --git a/TestScripts/CPP Tests.win/CPPTests.vcxproj b/TestScripts/CPP Tests.win/CPPTests.vcxproj new file mode 100644 index 0000000..b75ad82 --- /dev/null +++ b/TestScripts/CPP Tests.win/CPPTests.vcxproj @@ -0,0 +1,75 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9BA85F4F-A75A-4C27-BD85-2FEF881BEA13} + CPPTests + + + + Application + true + v120 + MultiByte + + + Application + false + v120 + true + MultiByte + + + + + + + + + + + + + ../../C/src;$(IncludePath) + + + + Level3 + Disabled + false + + + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + + + + + + \ No newline at end of file diff --git a/TestScripts/CPP Tests.win/CPPTests.vcxproj.filters b/TestScripts/CPP Tests.win/CPPTests.vcxproj.filters new file mode 100644 index 0000000..7558937 --- /dev/null +++ b/TestScripts/CPP Tests.win/CPPTests.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/TestScripts/CPP Tests/main.cpp b/TestScripts/CPP Tests/main.cpp index 2447a8a..7054c27 100755 --- a/TestScripts/CPP Tests/main.cpp +++ b/TestScripts/CPP Tests/main.cpp @@ -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); diff --git a/TestScripts/MATLAB Tests/openCloseTest.m b/TestScripts/MATLAB Tests/openCloseTest.m index b05a497..fc008ac 100644 --- a/TestScripts/MATLAB Tests/openCloseTest.m +++ b/TestScripts/MATLAB Tests/openCloseTest.m @@ -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 diff --git a/TestScripts/MATLAB Tests/pauseTest.m b/TestScripts/MATLAB Tests/pauseTest.m index c7979a6..2e17fe6 100644 --- a/TestScripts/MATLAB Tests/pauseTest.m +++ b/TestScripts/MATLAB Tests/pauseTest.m @@ -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); diff --git a/TestScripts/MATLAB Tests/setConnTest.m b/TestScripts/MATLAB Tests/setConnTest.m index e0f8c30..b2485f4 100644 --- a/TestScripts/MATLAB Tests/setConnTest.m +++ b/TestScripts/MATLAB Tests/setConnTest.m @@ -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 diff --git a/TestScripts/MATLAB Tests/tests.m b/TestScripts/MATLAB Tests/tests.m index 4a8faae..8492faa 100644 --- a/TestScripts/MATLAB Tests/tests.m +++ b/TestScripts/MATLAB Tests/tests.m @@ -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},' - ']);