Skip to content

Commit d5d0677

Browse files
committed
add tests for comparison operators
1 parent e8f5207 commit d5d0677

File tree

6 files changed

+224
-0
lines changed

6 files changed

+224
-0
lines changed

tests/image/test_eq.m

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function tests = test_eq
2+
% Test suite for the file eq.
3+
%
4+
% Test suite for the file eq
5+
%
6+
% Example
7+
% test_eq
8+
%
9+
% See also
10+
% eq
11+
12+
% ------
13+
% Author: David Legland
14+
% e-mail: david.legland@inrae.fr
15+
% Created: 2021-02-04, using Matlab 9.8.0.1323502 (R2020a)
16+
% Copyright 2021 INRAE - BIA-BIBS.
17+
18+
tests = functiontests(localfunctions);
19+
20+
21+
function test_Simple(testCase) %#ok<*DEFNU>
22+
% Test call of function without argument.
23+
24+
lx = 1:6;
25+
ly = 10:10:40;
26+
[x, y]= meshgrid(lx, ly);
27+
img = Image(x + y);
28+
29+
bin = img == 23;
30+
31+
assertTrue(testCase, isa(bin, 'Image'));
32+
assertEqual(testCase, bin.Type, 'binary');
33+
assertEqual(testCase, size(bin), size(img));
34+
35+
assertFalse(testCase, bin(1, 1));
36+
assertTrue(testCase, bin(3, 2));
37+
assertFalse(testCase, bin(6, 4));

tests/image/test_ge.m

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
function tests = test_ge
2+
% Test suite for the file ge.
3+
%
4+
% Test suite for the file ge
5+
%
6+
% Example
7+
% test_ge
8+
%
9+
% See also
10+
% ge
11+
12+
% ------
13+
% Author: David Legland
14+
% e-mail: david.legland@inrae.fr
15+
% Created: 2021-02-04, using Matlab 9.8.0.1323502 (R2020a)
16+
% Copyright 2021 INRAE - BIA-BIBS.
17+
18+
tests = functiontests(localfunctions);
19+
20+
21+
function test_Simple(testCase) %#ok<*DEFNU>
22+
% Test call of function without argument.
23+
24+
lx = 1:6;
25+
ly = 10:10:40;
26+
[x, y]= meshgrid(lx, ly);
27+
img = Image(x + y);
28+
29+
bin = img >= 23;
30+
31+
assertTrue(testCase, isa(bin, 'Image'));
32+
assertEqual(testCase, bin.Type, 'binary');
33+
assertEqual(testCase, size(bin), size(img));
34+
35+
assertFalse(testCase, bin(1, 1));
36+
assertTrue(testCase, bin(3, 2));
37+
assertTrue(testCase, bin(6, 4));
38+

tests/image/test_gt.m

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
function tests = test_gt
2+
% Test suite for the file gt.
3+
%
4+
% Test suite for the file gt
5+
%
6+
% Example
7+
% test_gt
8+
%
9+
% See also
10+
% gt
11+
12+
% ------
13+
% Author: David Legland
14+
% e-mail: david.legland@inrae.fr
15+
% Created: 2021-02-04, using Matlab 9.8.0.1323502 (R2020a)
16+
% Copyright 2021 INRAE - BIA-BIBS.
17+
18+
tests = functiontests(localfunctions);
19+
20+
21+
function test_Simple(testCase) %#ok<*DEFNU>
22+
% Test call of function without argument.
23+
24+
lx = 1:6;
25+
ly = 10:10:40;
26+
[x, y]= meshgrid(lx, ly);
27+
img = Image(x + y);
28+
29+
bin = img > 23;
30+
31+
assertTrue(testCase, isa(bin, 'Image'));
32+
assertEqual(testCase, bin.Type, 'binary');
33+
assertEqual(testCase, size(bin), size(img));
34+
35+
assertFalse(testCase, bin(1, 1));
36+
assertFalse(testCase, bin(3, 2));
37+
assertTrue(testCase, bin(6, 4));
38+

tests/image/test_le.m

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function tests = test_le
2+
% Test suite for the file le.
3+
%
4+
% Test suite for the file le
5+
%
6+
% Example
7+
% test_le
8+
%
9+
% See also
10+
% le
11+
12+
% ------
13+
% Author: David Legland
14+
% e-mail: david.legland@inrae.fr
15+
% Created: 2021-02-04, using Matlab 9.8.0.1323502 (R2020a)
16+
% Copyright 2021 INRAE - BIA-BIBS.
17+
18+
tests = functiontests(localfunctions);
19+
20+
21+
function test_Simple(testCase) %#ok<*DEFNU>
22+
% Test call of function without argument.
23+
24+
lx = 1:6;
25+
ly = 10:10:40;
26+
[x, y]= meshgrid(lx, ly);
27+
img = Image(x + y);
28+
29+
bin = img <= 23;
30+
31+
assertTrue(testCase, isa(bin, 'Image'));
32+
assertEqual(testCase, bin.Type, 'binary');
33+
assertEqual(testCase, size(bin), size(img));
34+
35+
assertTrue(testCase, bin(1, 1));
36+
assertTrue(testCase, bin(3, 2));
37+
assertFalse(testCase, bin(6, 4));

tests/image/test_lt.m

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function tests = test_lt
2+
% Test suite for the file lt.
3+
%
4+
% Test suite for the file lt
5+
%
6+
% Example
7+
% test_lt
8+
%
9+
% See also
10+
% lt
11+
12+
% ------
13+
% Author: David Legland
14+
% e-mail: david.legland@inrae.fr
15+
% Created: 2021-02-04, using Matlab 9.8.0.1323502 (R2020a)
16+
% Copyright 2021 INRAE - BIA-BIBS.
17+
18+
tests = functiontests(localfunctions);
19+
20+
21+
function test_Simple(testCase) %#ok<*DEFNU>
22+
% Test call of function without argument.
23+
24+
lx = 1:6;
25+
ly = 10:10:40;
26+
[x, y]= meshgrid(lx, ly);
27+
img = Image(x + y);
28+
29+
bin = img < 23;
30+
31+
assertTrue(testCase, isa(bin, 'Image'));
32+
assertEqual(testCase, bin.Type, 'binary');
33+
assertEqual(testCase, size(bin), size(img));
34+
35+
assertTrue(testCase, bin(1, 1));
36+
assertFalse(testCase, bin(3, 2));
37+
assertFalse(testCase, bin(6, 4));

tests/image/test_ne.m

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function tests = test_ne
2+
% Test suite for the file ne.
3+
%
4+
% Test suite for the file ne
5+
%
6+
% Example
7+
% test_ne
8+
%
9+
% See also
10+
% ne
11+
12+
% ------
13+
% Author: David Legland
14+
% e-mail: david.legland@inrae.fr
15+
% Created: 2021-02-04, using Matlab 9.8.0.1323502 (R2020a)
16+
% Copyright 2021 INRAE - BIA-BIBS.
17+
18+
tests = functiontests(localfunctions);
19+
20+
21+
function test_Simple(testCase) %#ok<*DEFNU>
22+
% Test call of function without argument.
23+
24+
lx = 1:6;
25+
ly = 10:10:40;
26+
[x, y]= meshgrid(lx, ly);
27+
img = Image(x + y);
28+
29+
bin = img ~= 23;
30+
31+
assertTrue(testCase, isa(bin, 'Image'));
32+
assertEqual(testCase, bin.Type, 'binary');
33+
assertEqual(testCase, size(bin), size(img));
34+
35+
assertTrue(testCase, bin(1, 1));
36+
assertFalse(testCase, bin(3, 2));
37+
assertTrue(testCase, bin(6, 4));

0 commit comments

Comments
 (0)