Skip to content

Commit

Permalink
Added test_all()
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltaylor committed May 22, 2023
1 parent 6fe6fe3 commit 3ea6e95
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 65 deletions.
9 changes: 9 additions & 0 deletions test_all.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function passed_count_and_run_count = test_all()
function_name_from_test_index = {'test_all_eight_major_configurations', 'test_all_verification_conditions' } ;
cell_results_from_test_index = cellfun(@feval, function_name_from_test_index, 'UniformOutput', false) ;
results_from_test_index = cell2mat(cell_results_from_test_index') ; % test_count x 2, 1st col subtests passed, 2nd col subtests run
passed_count_and_run_count = sum(results_from_test_index, 1) ;
passed_count = passed_count_and_run_count(1) ;
run_count = passed_count_and_run_count(2) ;
fprintf('Test summary: %d passed out of %d tests run.\n', passed_count, run_count) ;
end
15 changes: 13 additions & 2 deletions test_all_eight_major_configurations.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
function test_all_eight_major_configurations()
function pass_and_run_count = test_all_eight_major_configurations()
pass_count = 0 ;
run_count = 0 ;
for freezing_or_thawing = { 'freezing', 'thawing' } ,
for raw_tiles_or_octree = { 'raw-tiles', 'octree' } ,
for local_or_cluster = { 'local', 'cluster' } ,
test_single_major_configuration(freezing_or_thawing{1}, raw_tiles_or_octree{1}, local_or_cluster{1}) ;
run_count = run_count + 1 ;
try
test_single_major_configuration(freezing_or_thawing{1}, raw_tiles_or_octree{1}, local_or_cluster{1}) ;
pass_count = pass_count + 1 ;
catch me
report = me.getReport() ;
fprint('Caught error while running test_single_major_configuration(''%s'', ''%s'', ''%s'').\nException report:\n%s', ...
freezing_or_thawing{1}, raw_tiles_or_octree{1}, local_or_cluster{1}, report) ;
end
end
end
end
pass_and_run_count = [pass_count run_count] ;
end
29 changes: 20 additions & 9 deletions test_all_verification_conditions.m
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
function test_all_verification_conditions()
%for freezing_or_thawing = { 'freezing', 'thawing' } ,
for freezing_or_thawing = { 'thawing' } ,
%for raw_tiles_or_octree = { 'raw-tiles', 'octree' } ,
for raw_tiles_or_octree = { 'octree' } ,
%for local_or_cluster = { 'local', 'cluster' } ,
for local_or_cluster = { 'local' } ,
function pass_and_run_count = test_all_verification_conditions()
pass_count = 0 ;
run_count = 0 ;
for freezing_or_thawing = { 'freezing', 'thawing' } ,
%for freezing_or_thawing = { 'thawing' } ,
for raw_tiles_or_octree = { 'raw-tiles', 'octree' } ,
%for raw_tiles_or_octree = { 'octree' } ,
for local_or_cluster = { 'local', 'cluster' } ,
%for local_or_cluster = { 'local' } ,
for stack_or_non_stack = { 'stack', 'non-stack' } ,
for exact_problem = { 'deleted', 'zero-length', 'corrupt' } ,
test_verification_condition( ...
freezing_or_thawing{1}, raw_tiles_or_octree{1}, local_or_cluster{1}, stack_or_non_stack{1}, exact_problem{1}) ;
run_count = run_count + 1 ;
try
test_verification_condition( ...
freezing_or_thawing{1}, raw_tiles_or_octree{1}, local_or_cluster{1}, stack_or_non_stack{1}, exact_problem{1}) ;
pass_count = pass_count + 1 ;
catch me
report = me.getReport() ;
fprint('Caught error while running test_verification_condition(''%s'', ''%s'', ''%s'', ''%s'', ''%s'').\nException report:\n%s', ...
freezing_or_thawing{1}, raw_tiles_or_octree{1}, local_or_cluster{1}, stack_or_non_stack{1}, exact_problem{1}, report) ;
end
end
end
end
end
end
pass_and_run_count = [pass_count run_count] ;
end
1 change: 1 addition & 0 deletions test_single_major_configuration.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function test_single_major_configuration(freezing_or_thawing, raw_tiles_or_octree, local_or_cluster)
% Test, in one of 2^3==8 possible configurations.
% This function returns normally if all is well, throws an error if not.

% Deal with the arguments
if ~strcmp(freezing_or_thawing, 'freezing') && ~strcmp(freezing_or_thawing, 'thawing') ,
Expand Down
54 changes: 0 additions & 54 deletions test_something.m

This file was deleted.

2 changes: 2 additions & 0 deletions test_verification_condition.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function test_verification_condition(freezing_or_thawing, raw_tiles_or_octree, local_or_cluster, stack_or_non_stack, exact_problem)
% This function returns normally if all is well, throws an error if not.

% Deal with the arguments
if ~strcmp(freezing_or_thawing, 'freezing') && ~strcmp(freezing_or_thawing, 'thawing') ,
error('freezing_or_thawing must be ''freezing'' or ''thawing''') ;
Expand Down

0 comments on commit 3ea6e95

Please sign in to comment.