Skip to content

Commit e26f3cb

Browse files
committed
[Matlab] Refactor Dimension function names
- Refactors all Sampled- and RangeDimension function names to CamelCase. - Refactors all affected tests.
1 parent 9859372 commit e26f3cb

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

+nix/RangeDimension.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
nix.Dynamic.add_dyn_attr(obj, 'ticks', 'rw');
2727
end
2828

29-
function r = tick_at(obj, index)
29+
function r = tickAt(obj, index)
3030
index = nix.Utils.handle_index(index);
3131
fname = strcat(obj.alias, '::tickAt');
3232
r = nix_mx(fname, obj.nix_handle, index);
3333
end
3434

35-
function r = index_of(obj, position)
35+
function r = indexOf(obj, position)
3636
fname = strcat(obj.alias, '::indexOf');
3737
r = nix_mx(fname, obj.nix_handle, position);
3838
end

+nix/SampledDimension.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
nix.Dynamic.add_dyn_attr(obj, 'offset', 'rw');
2727
end
2828

29-
function r = index_of(obj, position)
29+
function r = indexOf(obj, position)
3030
fname = strcat(obj.alias, '::indexOf');
3131
r = nix_mx(fname, obj.nix_handle, position);
3232
end
3333

34-
function r = position_at(obj, index)
34+
function r = positionAt(obj, index)
3535
index = nix.Utils.handle_index(index);
3636
fname = strcat(obj.alias, '::positionAt');
3737
r = nix_mx(fname, obj.nix_handle, index);

tests/TestDimensions.m

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
% LICENSE file in the root of the Project.
88

99
function funcs = TestDimensions
10-
%TestDimensions tests for Dimensions
11-
% Detailed explanation goes here
10+
% TestDimensions tests for Dimensions
1211

1312
funcs = {};
14-
funcs{end+1} = @test_set_dimension;
15-
funcs{end+1} = @test_sample_dimension;
16-
funcs{end+1} = @test_range_dimension;
13+
funcs{end+1} = @testSetDimension;
14+
funcs{end+1} = @testSampleDimension;
15+
funcs{end+1} = @testRangeDimension;
1716
end
1817

19-
function [] = test_set_dimension( varargin )
18+
function [] = testSetDimension( varargin )
2019
%% Test: set dimension
2120
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
2221
b = f.createBlock('daTestBlock', 'test nixBlock');
@@ -50,7 +49,7 @@
5049
end;
5150
end
5251

53-
function [] = test_sample_dimension( varargin )
52+
function [] = testSampleDimension( varargin )
5453
%% Test: sampled dimension
5554
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
5655
b = f.createBlock('daTestBlock', 'test nixBlock');
@@ -83,8 +82,8 @@
8382
assert(length(axis) == 10);
8483
assert(axis(end) == (length(axis) - 1) * d1.samplingInterval + d1.offset);
8584

86-
assert(d1.position_at(1) == d1.offset);
87-
assert(d1.position_at(10) == d1.offset + 9 * d1.samplingInterval);
85+
assert(d1.positionAt(1) == d1.offset);
86+
assert(d1.positionAt(10) == d1.offset + 9 * d1.samplingInterval);
8887

8988
d1.label = '';
9089
d1.unit = '';
@@ -99,11 +98,11 @@
9998
assert(axis(1) == 0);
10099
assert(axis(end) == (length(axis) - 1) * d1.samplingInterval + d1.offset);
101100

102-
assert(d1.position_at(1) == d1.offset);
103-
assert(d1.position_at(10) == d1.offset + 9 * d1.samplingInterval);
101+
assert(d1.positionAt(1) == d1.offset);
102+
assert(d1.positionAt(10) == d1.offset + 9 * d1.samplingInterval);
104103
end
105104

106-
function [] = test_range_dimension( varargin )
105+
function [] = testRangeDimension( varargin )
107106
%% Test: range dimension
108107
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
109108
b = f.createBlock('daTestBlock', 'test nixBlock');
@@ -121,17 +120,17 @@
121120
assert(length(axis) == 3);
122121
assert(axis(end) == ticks(length(axis)));
123122

124-
assert(d1.tick_at(1) == ticks(1));
125-
assert(d1.tick_at(3) == ticks(3));
123+
assert(d1.tickAt(1) == ticks(1));
124+
assert(d1.tickAt(3) == ticks(3));
126125

127-
new_ticks = [5 6 7 8];
126+
newTicks = [5 6 7 8];
128127
d1.label = 'foo';
129128
d1.unit = 'mV';
130-
d1.ticks = new_ticks;
129+
d1.ticks = newTicks;
131130

132131
assert(strcmp(d1.label, 'foo'));
133132
assert(strcmp(d1.unit, 'mV'));
134-
assert(isequal(d1.ticks, new_ticks));
133+
assert(isequal(d1.ticks, newTicks));
135134

136135
d1.label = '';
137136
d1.unit = '';

0 commit comments

Comments
 (0)