Cody

Solution 1955385

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
assert(numCmp('12.3456',12.3456))

n1 = '12.3456' ans = '12.3456' tf = 1×7 logical array 1 1 1 1 1 1 1

Error using assert The condition input argument must be a scalar logical. Error in Test1 (line 1) assert(numCmp('12.3456',12.3456))

2   Fail
assert(numCmp('12.3456',12.3456789))

n1 = '12.3456' ans = '12.3457' tf = 1×7 logical array 1 1 1 1 1 1 0

Error using assert The condition input argument must be a scalar logical. Error in Test2 (line 1) assert(numCmp('12.3456',12.3456789))

3   Fail
assert(~numCmp('12.3456',12.345))

n1 = '12.3456' ans = '12.345'

Matrix dimensions must agree. Error in numCmp (line 4) tf = n1==num2str(n2) Error in Test3 (line 1) assert(~numCmp('12.3456',12.345))

4   Fail
assert(~numCmp('12.34567890',12.3456))

n1 = '12.34567890' ans = '12.3456'

Matrix dimensions must agree. Error in numCmp (line 4) tf = n1==num2str(n2) Error in Test4 (line 1) assert(~numCmp('12.34567890',12.3456))

5   Fail
assert(numCmp('12e6',12e6))

n1 = '12e6' ans = '12000000'

Matrix dimensions must agree. Error in numCmp (line 4) tf = n1==num2str(n2) Error in Test5 (line 1) assert(numCmp('12e6',12e6))

6   Fail
assert(~numCmp('54',100))

n1 = '54' ans = '100'

Matrix dimensions must agree. Error in numCmp (line 4) tf = n1==num2str(n2) Error in Test6 (line 1) assert(~numCmp('54',100))