Cody

Solution 1938685

Submitted on 16 Sep 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 true false false true false true]; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); clear g A; assert(isequal(solver(f),false))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in Test1>@(str)xor(~x,g(eval(str),A)) (line 4) f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); Error in solver>@(s)s('A==1') (line 5) statement = cellfun(@(s) s('A==1'),f) Error in solver (line 5) statement = cellfun(@(s) s('A==1'),f) Error in Test1 (line 7) assert(isequal(solver(f),false))

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

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in Test2>@(str)xor(~x,g(eval(str),A)) (line 4) f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); Error in solver>@(s)s('A==1') (line 5) statement = cellfun(@(s) s('A==1'),f) Error in solver (line 5) statement = cellfun(@(s) s('A==1'),f) Error in Test2 (line 7) assert(isequal(solver(f),true))

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

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in Test3>@(str)xor(~x,g(eval(str),A)) (line 4) f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); Error in solver>@(s)s('A==1') (line 5) statement = cellfun(@(s) s('A==1'),f) Error in solver (line 5) statement = cellfun(@(s) s('A==1'),f) Error in Test3 (line 7) assert(isequal(solver(f),false))

4   Fail
A=[true false false true false false true true true]; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); clear g A; assert(isequal(solver(f),false))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in Test4>@(str)xor(~x,g(eval(str),A)) (line 4) f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); Error in solver>@(s)s('A==1') (line 5) statement = cellfun(@(s) s('A==1'),f) Error in solver (line 5) statement = cellfun(@(s) s('A==1'),f) Error in Test4 (line 7) assert(isequal(solver(f),false))

5   Fail
A=rand(1,99)<.5; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); assert(isequal(solver(f),mean(A)<.5))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in Test5>@(str)xor(~x,g(eval(str),A)) (line 4) f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); Error in solver>@(s)s('A==1') (line 5) statement = cellfun(@(s) s('A==1'),f) Error in solver (line 5) statement = cellfun(@(s) s('A==1'),f) Error in Test5 (line 6) assert(isequal(solver(f),mean(A)<.5))

6   Fail
A=rand(1,99)<.5; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); assert(isequal(solver(f),mean(A)<.5))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in Test6>@(str)xor(~x,g(eval(str),A)) (line 4) f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); Error in solver>@(s)s('A==1') (line 5) statement = cellfun(@(s) s('A==1'),f) Error in solver (line 5) statement = cellfun(@(s) s('A==1'),f) Error in Test6 (line 6) assert(isequal(solver(f),mean(A)<.5))

7   Fail
A=rand(1,99)<.5; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); assert(isequal(solver(f),mean(A)<.5))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in Test7>@(str)xor(~x,g(eval(str),A)) (line 4) f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); Error in solver>@(s)s('A==1') (line 5) statement = cellfun(@(s) s('A==1'),f) Error in solver (line 5) statement = cellfun(@(s) s('A==1'),f) Error in Test7 (line 6) assert(isequal(solver(f),mean(A)<.5))

8   Fail
A=rand(1,99)<.5; g=inline('logical(interp1([0,1],[0,x],1))','x','A'); f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); assert(isequal(solver(f),mean(A)<.5))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in Test8>@(str)xor(~x,g(eval(str),A)) (line 4) f=arrayfun(@(x)@(str)xor(~x,g(eval(str),A)),A,'uni',0); Error in solver>@(s)s('A==1') (line 5) statement = cellfun(@(s) s('A==1'),f) Error in solver (line 5) statement = cellfun(@(s) s('A==1'),f) Error in Test8 (line 6) assert(isequal(solver(f),mean(A)<.5))