Home > testing > unit_tests > checkTasksTests.m

checkTasksTests

PURPOSE ^

run this test case with the command

SYNOPSIS ^

function tests = checkTasksTests

DESCRIPTION ^

run this test case with the command
results = runtests('checkTasksTests.m')

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 %run this test case with the command
0002 %results = runtests('checkTasksTests.m')
0003 function tests = checkTasksTests
0004     tests = functiontests(localfunctions);
0005 end
0006 
0007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0008 % testModel
0009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0010 
0011 function testModel = getTaskTstModel()
0012     testModel = struct();
0013     testModel.id = 'testModel';
0014     testModel.rxns = {};
0015     testModel.S=[];
0016     testModel.rev=[];
0017     testModel.mets = {'as';'ac';'bc';'cc';'dc';'ec';'es';'fc'};
0018     testModel.metNames = {'a';'a';'b';'c';'d';'e';'e';'f'};
0019     testModel.comps = {'s';'c'};
0020     testModel.compNames = testModel.comps;
0021     testModel.metComps = [1;2;2;2;2;2;1;2];
0022     testModel.genes = {'G1';'G2';'G3';'G4';'G5';'G6';'G7';'G8';'G9';'G10'};
0023     testModel.grRules = {};
0024     testModel.rxnGeneMat = [];
0025 
0026     rxnsToAdd = struct();
0027     rxnsToAdd.rxns = {'R1';'R2';'R3';'R4';'R5';'R6';'R7';'R8';'R9';'R10'};
0028     rxnsToAdd.equations = {'=> a[s]';...
0029                            'a[s] <=> a[c]';...
0030                            'a[c] <=> b[c] + c[c]';...
0031                            'a[c] <=> 2 d[c]';...
0032                            'b[c] + c[c] => e[c]';...
0033                            '2 d[c] => e[c]';...
0034                            'e[c] => e[s]';...
0035                            'e[s] =>';...
0036                            'a[c] <=> f[c]';...
0037                            'f[c] <=> e[c]'};
0038     rxnsToAdd.grRules = {'';'';'G3';'G4';'G5';'G6';'G7';'';'G9';'G10'};
0039     testModel = addRxns(testModel,rxnsToAdd, 3);
0040     testModel.c = [0;0;0;0;0;0;0;1;0;0];%optimize for output flux, if this is used, not sure
0041     testModel.ub = repmat(1000,10,1);
0042     testModel.lb = [0;-1000;-1000;-1000;0;0;0;0;-1000;-1000];
0043     testModel.rxnNames = testModel.rxns;
0044     testModel.b = repmat(0,8,1);
0045 end
0046 
0047 function testModelTasks = getTaskTstModelTasks()
0048     testModelTasks = struct();
0049     testModelTasks.id = 'Gen e[s] from a[s]';
0050     testModelTasks.description = 'Gen e[s] from a[s]';
0051     testModelTasks.shouldFail = false;
0052     testModelTasks.printFluxes = false;
0053     testModelTasks.comments = '';
0054     testModelTasks.inputs = {'a[s]'};
0055     testModelTasks.LBin = 0;
0056     testModelTasks.UBin = inf;
0057     testModelTasks.outputs = {'e[s]'};
0058     testModelTasks.LBout = 1;
0059     testModelTasks.UBout = 1;
0060     testModelTasks.equations = {};
0061     testModelTasks.LBequ = [];
0062     testModelTasks.UBequ = [];
0063     testModelTasks.changed = {};
0064     testModelTasks.LBrxn = {};
0065     testModelTasks.UBrxn = {};
0066 end
0067 
0068 
0069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0070 %TXXXX: checkTasks
0071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0072 function testcheckTasks(testCase)
0073 
0074     testModel = getTaskTstModel();
0075     testModel = closeModel(testModel);
0076     testModelTasks = getTaskTstModelTasks();
0077     
0078     %the task should work with the full model
0079     [~,taskReport] = evalc("checkTasks(testModel,[],true,false,false,testModelTasks);");
0080     verifyTrue(testCase, taskReport.ok == 1)
0081     
0082     %now remove R2, then it should fail
0083     testModel2 = removeReactions(testModel, {'R2'});
0084     [~, taskReport2] = evalc("checkTasks(testModel2,[],true,false,false,testModelTasks);");
0085     verifyTrue(testCase, taskReport2.ok == 0)
0086 end
0087 
0088

Generated by m2html © 2005