Cody

Problem 44270. Assert yourself! Hack the assert function to pass this test.

Solution 2869082

Submitted on 22 Aug 2020 by Rafael S.T. Vieira
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   Pass
x = 'Try this one'; y_correct = rand(1); assert(isequal(assertYourself(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assertYourself (line 9) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)] ans = logical 1

2   Pass
clear all; x = rand(10); y_correct = rand(1); assertYourself(); assert(isequal(true,false))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assertYourself (line 9) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] ans = logical 1

3   Pass
clear all; x = rand(10); y = assertYourself(x,'blah') y_correct = rand(1); assert(isequal(y,y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assertYourself (line 9) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)] y = 1 ans = logical 1

4   Pass
clear all; x = randi(26,10); y_correct = rand(1); [v,z]= assertYourself(x,x,x); z; msg = ['That is not even fair! ',char(randi(26,1,10)+'A')] assert(isequal(x,y_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assertYourself (line 9) In ScoringEngineTestPoint4 (line 4) In solutionTest (line 9)] msg = 'That is not even fair! XNNDHPMJEF'

5   Pass
clear all; [v,z]= assertYourself(); v; assert(false);

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assertYourself (line 9) In ScoringEngineTestPoint5 (line 2) In solutionTest (line 11)]

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!