Fixed errors in MATLAB client and updated tests.

This commit is contained in:
Jason Watkins
2015-04-21 09:51:49 -07:00
parent 3ad2bb76cb
commit 1523405495
29 changed files with 109 additions and 128 deletions

View File

@@ -1,6 +1,7 @@
function CTRLTest( )
%CTRLTest Summary of this function goes here
% Detailed explanation goes here
%% Test player aircraft
addpath('../../MATLAB')
import XPlaneConnect.*
@@ -14,14 +15,15 @@ THROT = rand();
CTRL = [0.0, 0.0, 1.0, THROT, 0.0, 1.0];
sendCTRL(CTRL);
result = requestDREF(DREFS);
result = getDREFs(DREFS);
assert(isequal(length(result),6),'CTRLTest: requestDREF unsucessful-wrong number of elements returned');
assert(isequal(length(result{4}),8),'CTRLTest: requestDREF unsucessful- element 1 incorrect size (should be size 8)');
assert(isequal(length(result),6),'CTRLTest: getDREFs unsucessful-wrong number of elements returned');
assert(isequal(length(result{4}),8),'CTRLTest: getDREFs unsucessful- element 1 incorrect size (should be size 8)');
for i=1:length(CTRL)-1
assert(abs(result{i}(1)-CTRL(i))<1e-4,['CTRLTest: DATA set unsucessful-',num2str(i)]);
end
%% Test NPC aircraft
DREFS = {'sim/multiplayer/position/plane1_yolk_pitch',...
'sim/multiplayer/position/plane1_yolk_roll',...
'sim/multiplayer/position/plane1_yolk_yaw',...
@@ -32,7 +34,7 @@ THROT = rand();
CTRL = [0.0, 0.0, 1.0, THROT, 0.0, 1.0];
sendCTRL(CTRL, 1);
result = requestDREF(DREFS);
result = getDREFs(DREFS);
assert(isequal(length(result),6),'CTRLTest: requestDREF unsucessful-wrong number of elements returned');
assert(isequal(length(result{4}),8),'CTRLTest: requestDREF unsucessful- element 1 incorrect size (should be size 8)');