Cody

Solution 2629036

Submitted on 29 Jun 2020 by Ramesh Kumar V
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 2.2 3.3 4]; y_correct = [true false false true]; assert(isequal(checkIfinteger(x),y_correct))

m = 4 y = [] z = 1 k = 0 l = logical 0 mm = logical 0 y = 1 z = 2.2000 k = 0.2000 l = logical 0 mm = logical 0 y = 1 0 z = 3.3000 k = 0.3000 l = logical 0 mm = logical 0 y = 1 0 0 z = 4 k = 0 l = logical 0 mm = logical 0 y = 1 0 0 1

2   Pass
x = [-1 2 3.3 4 -7.54]; y_correct = [true true false true false]; assert(isequal(checkIfinteger(x),y_correct))

m = 5 y = [] z = -1 k = 0 l = logical 0 mm = logical 0 y = 1 z = 2 k = 0 l = logical 0 mm = logical 0 y = 1 1 z = 3.3000 k = 0.3000 l = logical 0 mm = logical 0 y = 1 1 0 z = 4 k = 0 l = logical 0 mm = logical 0 y = 1 1 0 1 z = -7.5400 k = 0.4600 l = logical 0 mm = logical 0 y = 1 1 0 1 0

3   Pass
x = [pi 2.2 single(3.78) -4.34 eps inf] ; y_correct = [false false false false false false]; assert(isequal(checkIfinteger(x),y_correct))

m = 6 y = [] z = single 3.1416 k = single 0.1416 l = logical 0 mm = logical 0 y = 0 z = single 2.2000 k = single 0.2000 l = logical 0 mm = logical 0 y = 0 0 z = single 3.7800 k = single 0.7800 l = logical 0 mm = logical 0 y = 0 0 0 z = single -4.3400 k = single 0.6600 l = logical 0 mm = logical 0 y = 0 0 0 0 z = single 2.2204e-16 k = single 2.2204e-16 l = logical 0 mm = logical 0 y = 0 0 0 0 0 z = single Inf k = single NaN l = logical 0 mm = logical 0 y = 0 0 0 0 0 0

4   Pass
x = [1.0 0 nan -6.0]; % infact nan is 'not a number' y_correct = [true true false true]; assert(isequal(checkIfinteger(x),y_correct))

m = 4 y = [] z = 1 k = 0 l = logical 0 mm = logical 0 y = 1 z = 0 k = 0 l = logical 0 mm = logical 0 y = 1 1 z = NaN k = NaN l = logical 0 mm = logical 0 y = 1 1 0 z = -6 k = 0 l = logical 0 mm = logical 0 y = 1 1 0 1

5   Pass
x = [true false logical(0) logical(1)] y_correct = [false false false false]; assert(isequal(checkIfinteger(x),y_correct))

x = 1×4 logical array 1 0 0 1 m = 4 y = [] z = logical 1 k = 0 l = logical 0 mm = logical 1 y = 0 z = logical 0 k = 0 l = logical 0 mm = logical 1 y = 0 0 z = logical 0 k = 0 l = logical 0 mm = logical 1 y = 0 0 0 z = logical 1 k = 0 l = logical 0 mm = logical 1 y = 0 0 0 0

6   Pass
x = ['1' '2' 'a' 'b' '!'] y_correct = [false false false false false]; assert(isequal(checkIfinteger(x),y_correct))

x = '12ab!' m = 5 y = [] z = '1' k = 0 l = logical 1 mm = logical 0 y = 0 z = '2' k = 0 l = logical 1 mm = logical 0 y = 0 0 z = 'a' k = 0 l = logical 1 mm = logical 0 y = 0 0 0 z = 'b' k = 0 l = logical 1 mm = logical 0 y = 0 0 0 0 z = '!' k = 0 l = logical 1 mm = logical 0 y = 0 0 0 0 0