0001
0002
0003 function tests = importExportTests
0004 tests = functiontests(localfunctions);
0005 end
0006
0007 function testExcelImport(testCase)
0008 sourceDir=fileparts(fileparts(fileparts(which(mfilename))));
0009 excelFile=fullfile(sourceDir,'tutorial','empty.xlsx');
0010
0011
0012
0013
0014
0015 evalc('model=importExcelModel(excelFile)');
0016 load(fullfile(sourceDir,'testing','unit_tests','test_data','importExportResults.mat'), 'modelExcel');
0017 verifyEqual(testCase,model,modelExcel)
0018 end
0019
0020 function testSBMLImport(testCase)
0021 sourceDir=fileparts(fileparts(fileparts(which(mfilename))));
0022 sbmlFile=fullfile(sourceDir,'tutorial','empty.xml');
0023 evalc('model=importModel(sbmlFile)');
0024 load(fullfile(sourceDir,'testing','unit_tests','test_data','importExportResults.mat'), 'modelSBML');
0025 verifyEqual(testCase,model,modelSBML)
0026 end
0027
0028 function testYAMLimport(testCase)
0029 sourceDir=fileparts(fileparts(fileparts(which(mfilename))));
0030 yamlFile=fullfile(sourceDir,'tutorial','empty.yml');
0031 evalc('model=readYAMLmodel(yamlFile)');
0032 load(fullfile(sourceDir,'testing','unit_tests','test_data','importExportResults.mat'), 'modelYAML');
0033 verifyEqual(testCase,model,modelYAML)
0034 end
0035
0036 function testExcelExport(testCase)
0037 sourceDir=fileparts(fileparts(fileparts(which(mfilename))));
0038 load(fullfile(sourceDir,'testing','unit_tests','test_data','ecoli_textbook.mat'), 'model');
0039 exportToExcelFormat(model,fullfile(sourceDir,'testing','unit_tests','test_data','_test.xlsx'));
0040
0041
0042
0043 s = dir(fullfile(sourceDir,'testing','unit_tests','test_data','_test.xlsx'));
0044 filesize = s.bytes;
0045 verifyTrue(testCase,filesize>17000);
0046 delete(fullfile(sourceDir,'testing','unit_tests','test_data','_test.xlsx'));
0047 end
0048
0049 function testSBMLExport(testCase)
0050 sourceDir=fileparts(fileparts(fileparts(which(mfilename))));
0051 load(fullfile(sourceDir,'testing','unit_tests','test_data','ecoli_textbook.mat'), 'model');
0052 evalc('exportModel(model,fullfile(sourceDir,''testing'',''unit_tests'',''test_data'',''_test.xml''))');
0053
0054
0055
0056 s = dir(fullfile(sourceDir,'testing','unit_tests','test_data','_test.xml'));
0057 filesize = s.bytes;
0058 verifyTrue(testCase,filesize>18500);
0059 delete(fullfile(sourceDir,'testing','unit_tests','test_data','_test.xml'));
0060 end
0061
0062 function testYAMLexport(testCase)
0063 sourceDir=fileparts(fileparts(fileparts(which(mfilename))));
0064 load(fullfile(sourceDir,'tutorial','empty.mat'), 'emptyModel');
0065 evalc('writeYAMLmodel(emptyModel,fullfile(sourceDir,''testing'',''unit_tests'',''test_data'',''_test.yml''))');
0066
0067
0068
0069 s = dir(fullfile(sourceDir,'testing','unit_tests','test_data','_test.yml'));
0070 filesize = s.bytes;
0071 verifyTrue(testCase,filesize>1290);
0072 delete(fullfile(sourceDir,'testing','unit_tests','test_data','_test.yml'));
0073 end