Skip to content

Commit

Permalink
feat(docstrings): fix docstrings test evaluations
Browse files Browse the repository at this point in the history
  • Loading branch information
ocehugo committed Oct 26, 2020
1 parent 25e10d3 commit c3c903d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 37 deletions.
15 changes: 7 additions & 8 deletions Util/Path/FilesInFolder.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
% folders - a cell with fullpath strings of the subfolders.
%
% Example:
% % assumes /dev/shm got 4 files, "_a","1b","1_ab","abc.m".
% path = '/dev/shm';
% [files] = FilesInFolder(path);
% assert(any(contains(files,'1_ab')));
% assert(any(contains(files,'1b')));
% assert(any(contains(files,'_a')));
% assert(any(contains(files,'abc.m')));

%
% [files] = FilesInFolder(toolboxRootPath);
% assert(any(contains(files,'imosToolbox.m')));
% assert(any(contains(files,'license.txt')));
% assert(any(contains(files,'toolboxProperties.txt')));
%
%
% author: hugo.oliveira@utas.edu.au
%

Expand Down
10 changes: 5 additions & 5 deletions Util/Path/files2namestruct.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
%
% Example:
% carg = {'/dev/shm/_a','/dev/shm/1b','/dev/shm/1_ab','/dev/shm/abc.m'};
% [named_struct] = cell2namestruct(carg);
% assert(strcmpi(cargs.x_a,'/dev/shm/_a'));
% assert(strcmpi(cargs.x1b,'/dev/shm/1b'));
% assert(strcmpi(cargs.x1abc,'/dev/shm/1abc'));
% assert(strcmpi(cargs.abc_m,'/dev/shm/abc.m'));
% [named_struct] = files2namestruct(carg);
% assert(strcmpi(named_struct.x_a,'/dev/shm/_a'));
% assert(strcmpi(named_struct.x1b,'/dev/shm/1b'));
% assert(strcmpi(named_struct.x1_ab,'/dev/shm/1_ab'));
% assert(strcmpi(named_struct.abc_m,'/dev/shm/abc.m'));
%
% author: hugo.oliveira@utas.edu.au
%
Expand Down
25 changes: 10 additions & 15 deletions Util/Path/rdir.m
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
function [files, folders] = rdir(path)
% function files,folders = rdir(path)
%
% recursive dir - List all children given a path (files/folders)
% Recursively list all files/folders in
% a given a path.
%
% Inputs:
%
% path - a path string
% path [str] - a folder path
%
% Outputs:
%
% `files` - a cell with fullpath string of all files at all levels.
% `folders` - a cell with fullpath strings of all subfolders at all levels.
% files [cell] - file path strings at all root/sub folder levels.
% folders [cell] - folder path strings at all sub-folder levels.
%
% Example:
% % assumes /dev/shm/a,/dev/shm/b are files
% % assumes /dev/shm/c/d/e/f/g/h/i is a file
% % assumes /dev/shm/c/d/e/f/g/h/j is a empty folder
% path = '/dev/shm'
% [allfiles,allfolders] = rdir(path);
% assert(strcmp(allfiles{1}, '/dev/shm/a'));
% assert(strcmp(allfiles{2}, '/dev/shm/b'));
% assert(strcmp(allfiles{3}, '/dev/shm/c/d/e/f/g/h/i'));
% assert(strcmp(allfolders{1},'/dev/shm/c'));
% assert(strcmp(allfolders{2},'/dev/shm/c/d'));
% assert(strcmp(allfolders{end},'/dev/shm/c/d/e/f/g/h/j'));
%
% %simple test with nest folders
% [allfiles,allfolders] = rdir([toolboxRootPath 'Java']);
% assert(sum(contains(allfolders,'Java/bin'))==4)
% assert(sum(contains(allfiles,'ddb.jar'))==1)
%
% author: hugo.oliveira@utas.edu.au
%
Expand Down
7 changes: 4 additions & 3 deletions Util/Path/toolboxRootPath.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
% root_path - a string path of the toolbox root
%
% Example:
% % assumes toolbox is at /home/user/imos-toolbox
% [root_path] = toolboxRootPath()
% assert(strcmp('/home/user/imos-toolbox/',root_path)
%
% [root_path] = toolboxRootPath();
% assert(~isempty(root_path))
% assert(any(contains(FilesInFolder(root_path),'imosToolbox.m')))
%
% author: hugo.oliveira@utas.edu.au
%
Expand Down
4 changes: 2 additions & 2 deletions Util/Time/nextLowerTimePrecision.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
%
% Example:
%
% prec = 'microsecond'
% [lower_prec] = nextLowerTimePrecision(prec)
% prec = 'microsecond';
% [lower_prec] = nextLowerTimePrecision(prec);
% assert(strcmp(lower_prec,'milisecond'))
%
% author: hugo.oliveira@utas.edu.au
Expand Down
6 changes: 3 additions & 3 deletions Util/Units/toCelsius.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
% Example:
%
% degC = toCelsius([300.15],'kelvin');
% assert(degC==27);
% assert(round(degC)==27);
% degC = toCelsius([27],'celsius');
% assert(degC==27);
% assert(round(degC)==27);
% degC = toCelsius([80.6],'fahr');
% assert(DegC==27);
% assert(round(degC)==27);
%
%
% author: hugo.oliveira@utas.edu.au
Expand Down
2 changes: 1 addition & 1 deletion Util/getIMOSType.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
% type
%
% Example:
% [mtype] = getIMOSType('TEMP')
% [mtype] = getIMOSType('TEMP');
% assert(isequal(mtype,@single))
%
% author: hugo.oliveira@utas.edu.au
Expand Down

0 comments on commit c3c903d

Please sign in to comment.