Files
XPlaneConnectCSP/TestScripts/MATLAB Tests/tests.m
Jason Watkins 6ac513b40f Quick fix to make it possible to run MATLAB tests multiple times.
I'm not sure why this is necessary. Should look into object lifetimes in MATLAB to see if there's a valid reason for the second & subsequent test runs to fail when using automatic socket management.
2015-05-20 10:54:36 -07:00

46 lines
1.1 KiB
Matlab

addpath('../../MATLAB')
import XPlaneConnect.*
testsPassed=0;
testsFailed=0;
if ismac()
os = 'Mac';
elseif ispc()
os = 'Win';
else
os = 'Linux';
end
disp(['XPC Tests-MATLAB (', os, ')']);
theTests = {{@openCloseTest, 'Open/Close Test', 0},...
{@sendTEXTTest,'TEXT Test', 0},...
{@getDREFsTest,'Request DREF Test', 0},...
{@sendDREFTest,'Send DREF Test', 0},...
{@DATATest,'DATA Test', 0},...
{@CTRLTest,'CTRL Test', 0},...
{@POSITest,'POSI Test', 0},...
{@sendWYPTTest,'WYPT Test', 0},...
{@sendVIEWTest,'VIEW Test', 0},...
{@pauseTest,'Pause Test', 0},...
{@setConnTest, 'setConn Test', 0}};
socket = openUDP();
for i=1:length(theTests)
fprintf(['Test ',num2str(i),': ',theTests{i}{2},' - ']);
try
theTests{i}{1}();
disp('SUCCESS');
theTests{i}{3} = 1;
testsPassed = testsPassed+1;
catch err
disp('FAILURE');
fprintf('\t%s\n',err.message);
theTests{i}{3} = -1;
testsFailed = testsFailed + 1;
end
end
closeUDP(socket);
disp('Results Summary:');
fprintf('Passed: %i\tFailed: %i\n',testsPassed, testsFailed);