File tree Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change 65
65
fname = strcat(obj .alias , ' ::deleteValues' );
66
66
nix_mx(fname , obj .nix_handle );
67
67
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
79
68
end
80
69
81
70
end
Original file line number Diff line number Diff line change 149
149
150
150
%% Test: Compare properties
151
151
function [] = test_property_compare( varargin )
152
- testFile = fullfile(pwd ,' tests' ,' testRW.h5' );
152
+ testFile = fullfile(pwd , ' tests' , ' testRW.h5' );
153
153
f = nix .File(testFile , nix .FileMode .Overwrite );
154
154
s1 = f .create_section(' testSection1' , ' nixSection' );
155
155
s2 = f .create_section(' testSection2' , ' nixSection' );
159
159
% test invalid property comparison
160
160
try
161
161
p .compare(' I shall crash and burn' );
162
+ err.identifier = ' Test:UnraisedError' ;
163
+ error(err );
162
164
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' );
164
167
end
165
-
168
+
166
169
% test property equal comparison
167
170
assert(~p .compare(p ));
168
171
169
172
% test property not eqal
170
173
pNEq = s2 .create_property_with_value(' property' , {true , false });
171
- assert(p .compare(pNEq )~= 0 );
174
+ assert(p .compare(pNEq ) ~= 0 );
172
175
end
You can’t perform that action at this time.
0 commit comments