Skip to content

Commit 4f8beae

Browse files
committed
[Matlab] Remove Property compare method
Since the introduction of the NamedEntity compare method, the Propery compare method is no longer required and is removed. This commit also updates the corresponding test.
1 parent fb1ddad commit 4f8beae

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

+nix/Property.m

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,6 @@
6565
fname = strcat(obj.alias, '::deleteValues');
6666
nix_mx(fname, obj.nix_handle);
6767
end
68-
69-
% return value 0 means name and id of two properties are
70-
% identical, any other value means either name or id differ.
71-
function r = compare(obj, property)
72-
if (~isa(property, class(obj)))
73-
error('Function only supports comparison of Properties.');
74-
end
75-
76-
fname = strcat(obj.alias, '::compare');
77-
r = nix_mx(fname, obj.nix_handle, property.nix_handle);
78-
end
7968
end
8069

8170
end

tests/TestProperty.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149

150150
%% Test: Compare properties
151151
function [] = test_property_compare( varargin )
152-
testFile = fullfile(pwd,'tests','testRW.h5');
152+
testFile = fullfile(pwd, 'tests', 'testRW.h5');
153153
f = nix.File(testFile, nix.FileMode.Overwrite);
154154
s1 = f.create_section('testSection1', 'nixSection');
155155
s2 = f.create_section('testSection2', 'nixSection');
@@ -159,14 +159,17 @@
159159
% test invalid property comparison
160160
try
161161
p.compare('I shall crash and burn');
162+
err.identifier = 'Test:UnraisedError';
163+
error(err);
162164
catch ME
163-
assert(strcmp(ME.message, 'Function only supports comparison of Properties.'));
165+
msg = 'Only entities of the same class can be compared.';
166+
assert(strcmp(ME.message, msg), 'Compare exception fail');
164167
end
165-
168+
166169
% test property equal comparison
167170
assert(~p.compare(p));
168171

169172
% test property not eqal
170173
pNEq = s2.create_property_with_value('property', {true, false});
171-
assert(p.compare(pNEq)~=0);
174+
assert(p.compare(pNEq) ~= 0);
172175
end

0 commit comments

Comments
 (0)