0001 classdef dsUnitTest_strrep2 < matlab.unittest.TestCase 0002 0003 methods (Test, TestTags = {'utility'}) 0004 function testDocExamples(testCase) 0005 testCase.verifyEqual('(pop1_v)*(-av)', dsStrrep2('(v)*(-av)','v','pop1_v') ) 0006 testCase.verifyEqual('pop1_v-pop1_v^2+vav', dsStrrep2('v-v^2+vav','v','pop1_v') ) 0007 testCase.verifyEqual('pop1_v-pop1_v-pop1_v', dsStrrep2('v-v-v','v','pop1_v') ) 0008 testCase.verifyEqual('pop1_v-pop1_v-pop1_v^2', dsStrrep2('v-v-v^2','v','pop1_v') ) 0009 testCase.verifyEqual('(pop1_v-pop1_v-pop1_v^2)', dsStrrep2('(v-v-v^2)','v','pop1_v') ) 0010 testCase.verifyEqual('E-pop1_V(n-1)+1', dsStrrep2('E-pop1_V+1','pop1_V','pop1_V(n-1)') ) 0011 testCase.verifyEqual('v=1; u(n,test)=u(n,test)+d', dsStrrep2('v=1; u=u+d','u','u(n,test)') ) 0012 end 0013 0014 function testSubString(testCase) 0015 testCase.verifyEqual('new.new', dsStrrep2('old.old','old','new') ) 0016 testCase.verifyEqual('new.new.new', dsStrrep2('old.old.old','old','new') ) 0017 end 0018 end 0019 0020 end