1818% matlab - other MATLAB matrices (not in gallery).
1919% nessie - matrices from real-life networks.
2020%
21- % Anymatrix accepts the following commands.
21+ % Anymatrix accepts the following commands. All arguments are strings,
22+ % except ones defined by the matrix M-files which might take various
23+ % types of arguments.
2224%
2325% help anymatrix - display this information.
2426% ANYMATRIX('all') - return all matrix IDs in the collection.
25- % ANYMATRIX('contents', '[ group_ID]' ) - displays Contents.m of the group
26- % with a specified name [ group_ID] .
27+ % ANYMATRIX('contents', group_ID) - displays Contents.m of the group
28+ % with a specified name group_ID.
2729% G = ANYMATRIX('groups') - return the available groups.
28- % M = ANYMATRIX('groups', '[ group_id]' ) - return matrix IDs that belong
29- % to the group with a specified name [ group_id] .
30- % ANYMATRIX('groups', '[ group_id]', '[ repository]' ) - clone or update
30+ % M = ANYMATRIX('groups', group_id) - return matrix IDs that belong
31+ % to the group with a specified name group_id.
32+ % ANYMATRIX('groups', group_id, repository) - clone or update
3133% an anymatrix group stored in the specified repository.
32- % ANYMATRIX('help', '[ matrix_id]' ) - list the help for a specified
33- % matrix (anymatrix('[ matrix_id]' , 'help') also accepted).
34- % M = ANYMATRIX('lookfor', [ pattern] ) - returns a list of matrix IDs
34+ % ANYMATRIX('help', matrix_id) - list the help for a specified
35+ % matrix (anymatrix(matrix_id, 'help') also accepted).
36+ % M = ANYMATRIX('lookfor', pattern) - returns a list of matrix IDs
3537% whose help comments contain the specified char pattern.
3638% ANYMATRIX('properties') - show the list of recognized properties.
37- % ANYMATRIX('properties', '[ matrix_id]' ) - list the properties of a
38- % specified matrix (anymatrix('[ matrix_id]' , 'properties') also
39+ % ANYMATRIX('properties', matrix_id) - list the properties of a
40+ % specified matrix (anymatrix(matrix_id, 'properties') also
3941% accepted).
40- % M = ANYMATRIX('properties', '[ properties]' ) - list matrices having
42+ % M = ANYMATRIX('properties', properties) - list matrices having
4143% the specified properties.
42- % S = ANYMATRIX('sets') - return the available sets.
43- % M = ANYMATRIX('sets', '[set_id]') - return matrix IDs that belong to
44- % the set with a specified name [set_id].
4544% ANYMATRIX('scan') - force a scan of the file system.
46- % [out1, ..., outK] = ANYMATRIX('[matrix_id]', in1, ..., inN) - get the
45+ % S = ANYMATRIX('sets') - return the available sets.
46+ % M = ANYMATRIX('sets', set_id) - return matrix IDs that belong to
47+ % the set with a specified name set_id.
48+ % ANYMATRIX('test') - run tests of all groups, where available.
49+ % ANYMATRIX('test', group_ID) - run tests of the specified group, if
50+ % available.
51+ % [out1, ..., outK] = ANYMATRIX(matrix_id, in1, ..., inN) - get the
4752% matrix with a specified matrix id and parameters (if any) in1 to
4853% inN. Some matrices supply multiple output arguments.
4954%
5055% Shorthand commands with one or more of the starting letters are also
5156% accepted, for example 'c', 'cont', 'g', 'gr', 'h', 'l', 'p', 'prop',
52- % 'sc', 'se'.
57+ % 'sc', 'se', 't' .
5358%
5459% Anymatrix supports logical queries to search for matrices by
5560% properties. In the command anymatrix('properties', '[properties]'), the
139144 if any(startsWith({' lookfor' , ' contents' }, varargin{1 }))
140145 error(' Please specify one argument to this command.' );
141146 elseif ~any(startsWith({' properties' , ' groups' , ...
142- ' sets' , ' all' , ' scan' , ' help' }, varargin{1 }))
147+ ' sets' , ' all' , ' scan' , ' help' , ' test ' }, varargin{1 }))
143148 error(' Anymatrix command was not recognized.' );
144149 end
145150% Check other commands that don't contain matrix IDs in the first arg.
155160 end
156161 elseif any(startsWith({' help' , ' properties' }, varargin{2 }))
157162 error(' Specified matrix ID was not found.' );
158- elseif any(startsWith({' groups' , ' contents' }, varargin{1 }))
163+ elseif any(startsWith({' groups' , ' contents' , ' test ' }, varargin{1 }))
159164 if ~ismember(varargin{2 }, group_IDs )
160165 error(' The specified group ID was not found.' );
161166 end
195200 else
196201 show_matrix_help(varargin{2 });
197202 end
203+ elseif startsWith(' lookfor' , varargin{1 })
204+ varargout{1 } = lookfor_term(varargin{2 });
198205elseif startsWith(' properties' , varargin{1 })
199206 if (nargin == 1 )
200207 varargout{1 } = supported_properties ;
208215 supported_properties = prop_list();
209216 [set_IDs , group_IDs , matrix_IDs , properties ] = scan_filesystem();
210217 disp(' Anymatrix scanning done.' );
211- elseif startsWith(' lookfor' , varargin{1 })
212- varargout{1 } = lookfor_term(varargin{2 });
213218elseif startsWith(' sets' , varargin{1 })
214219 if (nargin == 1 )
215220 varargout{1 } = set_IDs ;
220225 ' Delimiter' , ' :' , ' CommentStyle' , ' %' , ' LineEnding' , ...
221226 ' ;' , ' Whitespace' , ' \n ' ), ' [\n\r ]+' ,' ' );
222227 end
228+ elseif startsWith(' test' , varargin{1 })
229+ if (nargin == 1 )
230+ for group = group_IDs .'
231+ run_group_tests(group{1 });
232+ end
233+ else
234+ run_group_tests(varargin{2 });
235+ end
223236else
224237 if (nargin > 1 ) && ischar(varargin{2 }) && ...
225238 startsWith(' help' , varargin{2 })
@@ -527,4 +540,16 @@ function update_git_group(group_ID, repo_ID)
527540 [set_IDs , group_IDs , matrix_IDs , properties ] = scan_filesystem();
528541 end
529542
543+ % Run the testsuite of a particular group.
544+ function run_group_tests(group_ID )
545+ handle = str2func(strcat(' anymatrix_' , group_ID ));
546+ test_func = strcat(' test_' , group_ID );
547+ if (isfile(strcat(root_path , ' /' , group_ID , ' /private/' , ...
548+ test_func , ' .m' )))
549+ handle(test_func );
550+ else
551+ disp(' This group does not contain any tests.' );
552+ end
553+ end
554+
530555end
0 commit comments