Cody

Problem 43738. Negative without '-'

Solution 1721333

Submitted on 5 Feb 2019 by James
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 = 1; y_correct = -1; assert(isequal(your_fcn_name(x),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, '*')),'sign * forbidden') assert(isempty(strfind(filetext, 'mtimes')),'mtimes forbidden') assert(isempty(strfind(filetext, 'cross')),'cross forbidden') assert(isempty(strfind(filetext, 'prod')),'prod forbidden') assert(isempty(strfind(filetext, 'cumprod')),'cumprod forbidden') assert(isempty(strfind(filetext, 'times')),'times forbidden') assert(isempty(strfind(filetext, 'mldivide')),'mldivide forbidden') assert(isempty(strfind(filetext, 'mrdivide')),'mrdivide forbidden') assert(isempty(strfind(filetext, '/')),'/ forbidden') assert(isempty(strfind(filetext, '\')),'\ forbidden') assert(isempty(strfind(filetext, '-')),'- forbidden') assert(isempty(strfind(filetext, '0')),'0 forbidden') assert(isempty(strfind(filetext, '^')),'^ forbidden') assert(isempty(strfind(filetext, 'dot')),'dot forbidden') assert(isempty(strfind(filetext, '''')),'string forbidden') 2

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In your_fcn_name (line 5) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)] ans = 2

2   Pass
x = 8; y_correct = -8; assert(isequal(your_fcn_name(x),y_correct)) 3

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In your_fcn_name (line 5) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)] ans = 3

3   Pass
x = 8; y_correct = -8; assert(isequal(your_fcn_name(x),y_correct)) 4

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In your_fcn_name (line 5) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)] ans = 4

4   Pass
x = -148; y_correct = 148; assert(isequal(your_fcn_name(x),y_correct)) 5

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In your_fcn_name (line 5) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)] ans = 5

5   Pass
x = randi([1 58]); y_correct = -x; assert(isequal(your_fcn_name(x),y_correct)) 6

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In your_fcn_name (line 5) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)] ans = 6

6   Pass
x = -pi; y_correct = pi; assert(isequal(your_fcn_name(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 unix (line 32) In your_fcn_name (line 5) In ScoringEngineTestPoint6 (line 3) In solutionTest (line 13)]