Skip to content

Commit 41b240e

Browse files
committed
improve coverage
1 parent ef841f4 commit 41b240e

File tree

6 files changed

+208
-111
lines changed

6 files changed

+208
-111
lines changed

unit_test/PlotTest.m

+9
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,22 @@ function trplot2_test(tc)
104104
clf
105105
h = trplot2(Rt1);
106106
trplot2(Rt1, 'handle', h);
107+
h = trplot2(Rt1, 'handle', h);
107108
trplot2(Rt1, 'color', 'r');
108109
trplot2(Rt1, 'color', [1 0 1]);
109110
trplot2(Rt1, 'noaxes');
110111
trplot2(Rt1, 'frame', 'bob');
111112
trplot2(Rt1, 'frame', 'A', 'text_opts', {'FontSize', 10, 'FontWeight', 'bold'})
112113
trplot2(Rt1, 'view', [10 20]);
113114
trplot2(Rt1, 'arrow')
115+
trplot2(Rt1, 'framelabel', 'A')
116+
117+
clf
118+
a = gca;
119+
trplot2(Rt1, 'axhandle', a);
120+
121+
h = trplot2(Rt1);
122+
tc.verifyWarning( @() trplot2(h, Rt1), 'RTB:trplot2:deprecated')
114123
end
115124

116125
% plot2 - plot trajectory

unit_test/QuaternionTest.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ function multiply_test(tc)
172172
tc.verifyError( @() q1 * [1 2 3], 'RTB:Quaternion:badarg')
173173
tc.verifyError( @() [1 2 3]*q1, 'RTB:Quaternion:badarg')
174174
tc.verifyError( @() [q1 q1] * [q1 q1 q1], 'RTB:Quaternion:badarg')
175-
175+
tc.verifyError( @() q1*SE3, 'RTB:Quaternion:badarg')
176+
176177

177178
end
178179

@@ -210,7 +211,7 @@ function divide_test(tc)
210211
%% errors
211212

212213
tc.verifyError( @() q1 / [1 2 3], 'RTB:Quaternion:badarg')
213-
tc.verifyError( @() [q1 q1] / [q1 q1 q1], 'RTB:Quaternion:badarg')
214+
tc.verifyError( @() [q1 q1] / SE3, 'RTB:Quaternion:badarg')
214215

215216
end
216217

unit_test/SO3Test.m

+27
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,33 @@ function conversions_test(tc)
327327
tc.verifyEqual(RR.log, skew(v)*th);
328328
end
329329

330+
function interp_test(tc)
331+
332+
rx = SO3.Rx(pi/2);
333+
ry = SO3.Ry(pi/2);
334+
rz = SO3.Rz(pi/2);
335+
u = SO3();
336+
337+
R = rx*ry*rz;
338+
339+
% from null
340+
tc.verifyEqual(u.interp(R, 0), u);
341+
tc.verifyEqual(u.interp(R, 1), R );
342+
343+
tc.verifyEqual(length(u.interp(R, linspace(0,1, 10))), 10);
344+
verifyTrue(tc, all( u.interp(R, [0 1]) == [u R]));
345+
346+
R0_5 = u.interp(R, 0.5);
347+
tc.verifyEqual( R0_5 * R0_5, R);
348+
349+
% between two SO3
350+
tc.verifyEqual(R.interp(rx, 0), R );
351+
tc.verifyEqual(R.interp(rx, 1), rx );
352+
353+
verifyTrue(tc, all( R.interp(rx, [0 1]) == [R rx]));
354+
355+
end
356+
330357
function miscellany_test(tc)
331358

332359
r = SO3.rpy( 0.1, 0.2, 0.3 );

unit_test/TransformationsTest.m

+18
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,11 @@ function trinterp_test(tc)
816816
tc.verifyEqual(T(:,:,1), T0, 'abstol', 1e-10);
817817
tc.verifyEqual(T(:,:,2), Tm, 'abstol', 1e-10);
818818
tc.verifyEqual(T(:,:,3), T1, 'abstol', 1e-10);
819+
820+
tc.verifyError( @() trinterp(T0, T1, -1), 'RTB:trinterp:badarg');
821+
tc.verifyError( @() trinterp(T0, T1, 1.7), 'RTB:trinterp:badarg');
822+
tc.verifyError( @() trinterp(T0), 'RTB:trinterp:badarg');
823+
819824
end
820825

821826

@@ -891,6 +896,10 @@ function trnorm_test(tc)
891896

892897
function trprint_test(tc)
893898

899+
% null case
900+
901+
trprint(eye(4,4))
902+
894903
a = transl([1,2,3]) * eul2tr([.1, .2, .3]);
895904

896905
trprint(a);
@@ -1031,6 +1040,11 @@ function trlog_test(tc)
10311040
tc.verifyEqual(trlog( roty(0.3) ), skew([0 0.3 0]), 'absTol', 1e-6);
10321041
tc.verifyEqual(trlog( rotz(0.4) ), skew([0 0 0.4]), 'absTol', 1e-6);
10331042

1043+
1044+
R = rotx(0.2) * roty(0.3) * rotz(0.4);
1045+
[th,w] = trlog(R);
1046+
tc.verifyEqual( logm(R), skew(th*w), 'absTol', 1e-10)
1047+
10341048
%%% SE(3) tests
10351049

10361050
% pure translation
@@ -1044,6 +1058,10 @@ function trlog_test(tc)
10441058
T = transl([1 2 3])*troty(0.3);
10451059
tc.verifyEqual(trlog(T), logm(T), 'absTol', 1e-6);
10461060

1061+
[th,w] = trlog(T);
1062+
tc.verifyEqual( logm(T), skewa(th*w), 'absTol', 1e-10)
1063+
1064+
10471065
verifyError(tc, @()trlog(0),'RTB:trlog:badarg');
10481066
end
10491067

0 commit comments

Comments
 (0)