Cody

Solution 1955656

Submitted on 2 Oct 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
A=true; B=false; X=1; f=inline('logical(interp1([0,1],[0,x],1))','x','A','B','X'); fA=@(str)xor(~A,f(eval(str),A,B,X)); fB=@(str)xor(~B,f(eval(str),A,B,X)); clear f A B X; assert(isequal(solver(fA,fB),1))

Error using eval Undefined function 'fB' for input arguments of type 'string'. Error in Test1>@(str)xor(~A,f(eval(str),A,B,X)) (line 4) fA=@(str)xor(~A,f(eval(str),A,B,X)); Error in solver (line 2) if fA('fB("X==1")')==true Error in Test1 (line 8) assert(isequal(solver(fA,fB),1))

2   Fail
A=true; B=false; X=2; f=inline('logical(interp1([0,1],[0,x],1))','x','A','B','X'); fA=@(str)xor(~A,f(eval(str),A,B,X)); fB=@(str)xor(~B,f(eval(str),A,B,X)); clear f A B X; assert(isequal(solver(fA,fB),2))

Error using eval Undefined function 'fB' for input arguments of type 'string'. Error in Test2>@(str)xor(~A,f(eval(str),A,B,X)) (line 4) fA=@(str)xor(~A,f(eval(str),A,B,X)); Error in solver (line 2) if fA('fB("X==1")')==true Error in Test2 (line 8) assert(isequal(solver(fA,fB),2))

3   Fail
A=false; B=true; X=1; f=inline('logical(interp1([0,1],[0,x],1))','x','A','B','X'); fA=@(str)xor(~A,f(eval(str),A,B,X)); fB=@(str)xor(~B,f(eval(str),A,B,X)); clear f A B X; assert(isequal(solver(fA,fB),1))

Error using eval Undefined function 'fB' for input arguments of type 'string'. Error in Test3>@(str)xor(~A,f(eval(str),A,B,X)) (line 4) fA=@(str)xor(~A,f(eval(str),A,B,X)); Error in solver (line 2) if fA('fB("X==1")')==true Error in Test3 (line 8) assert(isequal(solver(fA,fB),1))

4   Fail
A=false; B=true; X=2; f=inline('logical(interp1([0,1],[0,x],1))','x','A','B','X'); fA=@(str)xor(~A,f(eval(str),A,B,X)); fB=@(str)xor(~B,f(eval(str),A,B,X)); clear f A B X; assert(isequal(solver(fA,fB),2))

Error using eval Undefined function 'fB' for input arguments of type 'string'. Error in Test4>@(str)xor(~A,f(eval(str),A,B,X)) (line 4) fA=@(str)xor(~A,f(eval(str),A,B,X)); Error in solver (line 2) if fA('fB("X==1")')==true Error in Test4 (line 8) assert(isequal(solver(fA,fB),2))

Suggested Problems

More from this Author38