Skip to content

Commit f872e9f

Browse files
committed
add two tests for badly covered plotting functions
1 parent 5d6be04 commit f872e9f

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
function test_suite = test_computeIsoDoseContours
2+
%The output should always be test_suite, and the function name the same as
3+
%your file name
4+
5+
%To collect all tests defined below, this is needed in newer Matlab
6+
%versions. test_functions will collect function handles to below test
7+
%functions
8+
test_functions=localfunctions();
9+
10+
% This will initialize the test suite, i.e., take the functions from
11+
% test_functions, check if they contain "test", convert them into a MOxUnit
12+
% Test Case, and add them to the test-runner
13+
initTestSuite;
14+
15+
16+
function test_compute
17+
dim = [10,13,15];
18+
dose_cube = rand(dim);
19+
levels = [0.1,0.5,0.95];
20+
isoDoseContours = matRad_computeIsoDoseContours(dose_cube,levels);
21+
assertTrue(iscell(isoDoseContours));
22+
assertEqual(size(isoDoseContours),[max(dim),3])
23+
sz = cellfun(@(c) size(c,1),isoDoseContours(:));
24+
assertTrue(all(sz == 0 | sz == 2))
25+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function test_suite = test_computeVoiSurfaces
2+
%The output should always be test_suite, and the function name the same as
3+
%your file name
4+
5+
%To collect all tests defined below, this is needed in newer Matlab
6+
%versions. test_functions will collect function handles to below test
7+
%functions
8+
test_functions=localfunctions();
9+
10+
% This will initialize the test suite, i.e., take the functions from
11+
% test_functions, check if they contain "test", convert them into a MOxUnit
12+
% Test Case, and add them to the test-runner
13+
initTestSuite;
14+
15+
16+
function test_compute
17+
18+
testpatient = load('photons_testData.mat');
19+
cst = matRad_computeAllVoiSurfaces(testpatient.ct,testpatient.cst)
20+
assertTrue(isa(cst,'cell'));
21+
assertTrue(all(iscell(cst(:,8))))
22+
assertTrue(all(cellfun(@numel,cst(:,8)) == 2)) % Normals and Vertices
23+
assertTrue(isequal(cst(:,1:6),testpatient.cst(:,1:6)))

0 commit comments

Comments
 (0)