Skip to content

Commit 9fbde32

Browse files
committed
generalize
1 parent 50eda9c commit 9fbde32

37 files changed

+174
-62
lines changed

+stdlib/absolute.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
try %#ok<TRYNC>
3333
cwd = string(cwd);
34+
p = string(p);
35+
base = string(base);
3436
end
3537

3638
cwd = stdlib.posix(cwd);

+stdlib/auto_chunk_size.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
% * dims: proposed dataset dimensions (like size())
88

99
function csize = auto_chunk_size(dims)
10-
arguments
11-
dims (1,:) {mustBeInteger,mustBePositive}
12-
end
10+
% arguments
11+
% dims (1,:) {mustBeInteger,mustBePositive}
12+
% end
13+
14+
assert(isvector(dims), 'dims must be a vector')
15+
mustBePositive(dims)
1316

1417
CHUNK_BASE = 16000; % Multiplier by which chunks are adjusted
1518
CHUNK_MIN = 8000; % lower limit: 8 kbyte
@@ -55,4 +58,6 @@
5558
i = i+1;
5659
end
5760

58-
end % function
61+
end
62+
63+
%!assert(auto_chunk_size([15,250,100]), [2,32,25])

+stdlib/checkRAM.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
% certainly CAN'T create an array without digging deep into swap or worse.
77

88
function [OK,newSizeBytes,freebytes] = checkRAM(newSize, myclass)
9-
arguments
10-
newSize (1,:) {mustBeNumeric}
11-
myclass (1,1) string = "double"
12-
end
9+
% arguments
10+
% newSize (1,:) {mustBeNumeric}
11+
% myclass (1,1) string
12+
% end
1313

1414
% get available RAM
1515
freebytes = stdlib.ram_free();
@@ -29,3 +29,5 @@
2929
OK = newSizeBytes < freebytes;
3030

3131
end
32+
33+
%!assert(checkRAM([15,2,1], 'double'), true)

+stdlib/exists.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
%% EXISTS does path exist
22
%
3+
% NOTE: in general on Windows existS("not-exist/..") is true, but on
4+
% Unix it is false.
5+
% In C/C++ access() or stat() the same behavior is observed Windows vs Unix.
6+
%
37
%%% Inputs
48
% * p: path to check
59
%%% Outputs

+stdlib/expanduser.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@
2222
end
2323

2424
if ischar(e)
25-
if e(1) ~= '~' || (L > 1 && e(1) == '~' && e(2) ~= '/')
26-
return
27-
end
25+
ng = e(1) ~= '~' || (L > 1 && e(1) == '~' && e(2) ~= '/');
2826
else
29-
if ~startsWith(e, "~") || (L > 1 && ~startsWith(e, "~/"))
30-
return
31-
end
27+
ng = ~startsWith(e, "~") || (L > 1 && ~startsWith(e, "~/"));
3228
end
29+
if ng, return, end
3330

3431
home = stdlib.homedir(use_java);
3532

+stdlib/extract_zstd.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ function extract_zstd_bin(archive, out_dir)
4040
untar(tar_arc, out_dir)
4141
delete(tar_arc)
4242
end
43+
44+
%!testif 0

+stdlib/h4exists.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@
2222
rethrow(e)
2323
end
2424
end
25+
26+
%!testif 0

+stdlib/h4size.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@
2222
fsize = cell2mat({sds(i).Dims.Size});
2323

2424
end
25+
26+
%!testif 0

+stdlib/h4variables.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@
2020
names = string({ds.Name});
2121

2222
end
23+
24+
%!testif 0

+stdlib/h5create_group.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@
5353
end
5454

5555
end
56+
57+
58+
%!testif 0

0 commit comments

Comments
 (0)