Skip to content

Commit

Permalink
Ensure backwards compatibility of the unit tests to Matlab R2016b (9.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards committed Jul 25, 2022
1 parent 5a5ddf5 commit 1a142ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hmri_code_tests/hmri_coreg_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function getData(testCase)
% Use low resolution brain image
ut_data_dir = [fileparts(which('hmri_test_utils')) filesep 'example_data'];
field_map_1 = [ut_data_dir filesep 'field_map_1.nii'];
assert(exist(field_map_1,'file'),'%s not found; please run hmri_get_ut_data to download the data',field_map_1)
assert(logical(exist(field_map_1,'file')),'Could not find\n\t%s.\nPlease run "hmri_get_ut_data" to download the data',field_map_1)

% Use temporary directory which is deleted after tests have run
import matlab.unittest.fixtures.TemporaryFolderFixture
Expand Down
10 changes: 8 additions & 2 deletions hmri_code_tests/hmri_get_ut_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@
ut_data_dir = [fileparts(which('hmri_test_utils')) filesep 'example_data'];
[~,~] = mkdir(ut_data_dir);

% Download data for unit testing (if not already present locally)
urlwrite([url_loc field_map_1], [ut_data_dir filesep 'field_map_1.nii']);
% Download data for unit testing (overwriting any previous file)
%urlwrite([url_loc field_map_1], [ut_data_dir filesep 'field_map_1.nii']);
x=webread([url_loc field_map_1]);
fid=fopen([ut_data_dir filesep 'field_map_1.nii'],'w');
fwrite(fid,x);
fclose(fid);

end

0 comments on commit 1a142ef

Please sign in to comment.