Cody

Solution 2022950

Submitted on 15 Nov 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
x = magic(3); y_correct = true; assert(isequal(magical(x),y_correct))

s = [] s = 8 S = 8 Z = 8 8 8 s = 8 5 S = 13 Z = 13 13 13 s = 8 5 2 S = 15 Z = 15 15 15 tf = logical 0

Assertion failed.

2   Fail
x = magic(7); y_correct = true; assert(isequal(magical(x),y_correct))

s = [] s = 30 S = 30 Z = 30 30 30 30 30 30 30 s = 30 47 S = 77 Z = 77 77 77 77 77 77 77 s = 30 47 8 S = 85 Z = 85 85 85 85 85 85 85 s = 30 47 8 25 S = 110 Z = 110 110 110 110 110 110 110 s = 30 47 8 25 42 S = 152 Z = 152 152 152 152 152 152 152 s = 30 47 8 25 42 3 S = 155 Z = 155 155 155 155 155 155 155 s = 30 47 8 25 42 3 20 S = 175 Z = 175 175 175 175 175 175 175 tf = logical 0

Assertion failed.

3   Pass
x = eye(7); y_correct = false; assert(isequal(magical(x),y_correct))

s = [] s = 1 S = 1 Z = 1 1 1 1 1 1 1 s = 1 1 S = 2 Z = 2 2 2 2 2 2 2 s = 1 1 1 S = 3 Z = 3 3 3 3 3 3 3 s = 1 1 1 1 S = 4 Z = 4 4 4 4 4 4 4 s = 1 1 1 1 1 S = 5 Z = 5 5 5 5 5 5 5 s = 1 1 1 1 1 1 S = 6 Z = 6 6 6 6 6 6 6 s = 1 1 1 1 1 1 1 S = 7 Z = 7 7 7 7 7 7 7 tf = logical 0

4   Fail
x = magic(2); y_correct = false; assert(isequal(magical(x),y_correct))

s = [] s = 1 S = 1 Z = 1 1 s = 1 2 S = 3 Z = 3 3

Output argument "tf" (and maybe others) not assigned during call to "magical". Error in Test4 (line 3) assert(isequal(magical(x),y_correct))

5   Pass
x = magic(3)+1; y_correct = false; assert(isequal(magical(x),y_correct))

s = [] s = 9 S = 9 Z = 9 9 9 s = 9 6 S = 15 Z = 15 15 15 s = 9 6 3 S = 18 Z = 18 18 18 tf = logical 0

6   Fail
x = flipud(magic(9)); y_correct = true; assert(isequal(magical(x),y_correct))

s = [] s = 37 S = 37 Z = 37 37 37 37 37 37 37 37 37 s = 37 38 S = 75 Z = 75 75 75 75 75 75 75 75 75 s = 37 38 39 S = 114 Z = 114 114 114 114 114 114 114 114 114 s = 37 38 39 40 S = 154 Z = 154 154 154 154 154 154 154 154 154 s = 37 38 39 40 41 S = 195 Z = 195 195 195 195 195 195 195 195 195 s = 37 38 39 40 41 42 S = 237 Z = 237 237 237 237 237 237 237 237 237 s = 37 38 39 40 41 42 43 S = 280 Z = 280 280 280 280 280 280 280 280 280 s = 37 38 39 40 41 42 43 44 S = 324 Z = 324 324 324 324 324 324 324 324 324 s = 37 38 39 40 41 42 43 44 45 S = 369 Z = 369 369 369 369 369 369 369 369 369 tf = logical 0

Assertion failed.

7   Fail
x = fliplr(magic(11)); y_correct = true; assert(isequal(magical(x),y_correct))

s = [] s = 66 S = 66 Z = 66 66 66 66 66 66 66 66 66 66 66 s = 66 65 S = 131 Z = 131 131 131 131 131 131 131 131 131 131 131 s = 66 65 64 S = 195 Z = 195 195 195 195 195 195 195 195 195 195 195 s = 66 65 64 63 S = 258 Z = 258 258 258 258 258 258 258 258 258 258 258 s = 66 65 64 63 62 S = 320 Z = 320 320 320 320 320 320 320 320 320 320 320 s = 66 65 64 63 62 61 S = 381 Z = 381 381 381 381 381 381 381 381 381 381 381 s = 66 65 64 63 62 61 60 S = 441 Z = 441 441 441 441 441 441 441 441 441 441 441 s = 66 65 64 63 62 61 60 59 S = 500 Z = 500 500 500 500 500 500 500 500 500 500 500 s = 66 65 64 63 62 61 60 59 58 S = 558 Z = 558 558 558 558 558 558 558 558 558 558 558 s = 66 65 64 63 62 61 60 59 58 57 S = 615 Z = 615 615 615 615 615 615 615 615 615 615 615 s = 66 65 64 63 62 61 60 59 58 57 56 S = 671 Z = 671 671 671 671 671 671 671 671 671 671 671 tf = logical 0

Assertion failed.

8   Fail
x = magic(4); y_correct = true; assert(isequal(magical(x),y_correct))

s = [] s = 16 S = 16 Z = 16 16 16 16 s = 16 11 S = 27 Z = 27 27 27 27 s = 16 11 6 S = 33 Z = 33 33 33 33 s = 16 11 6 1 S = 34 Z = 34 34 34 34 tf = logical 0

Assertion failed.

9   Fail
x = flipud(magic(8)); y_correct = true; assert(isequal(magical(x),y_correct))

s = [] s = 8 S = 8 Z = 8 8 8 8 8 8 8 8 s = 8 15 S = 23 Z = 23 23 23 23 23 23 23 23 s = 8 15 22 S = 45 Z = 45 45 45 45 45 45 45 45 s = 8 15 22 29 S = 74 Z = 74 74 74 74 74 74 74 74 s = 8 15 22 29 36 S = 110 Z = 110 110 110 110 110 110 110 110 s = 8 15 22 29 36 43 S = 153 Z = 153 153 153 153 153 153 153 153 s = 8 15 22 29 36 43 50 S = 203 Z = 203 203 203 203 203 203 203 203 s = 8 15 22 29 36 43 50 57 S = 260 Z = 260 260 260 260 260 260 260 260 tf = logical 0

Assertion failed.

10   Fail
x = [1 2; 3 4]; y_correct = false; assert(isequal(magical(x),y_correct))

s = [] s = 1 S = 1 Z = 1 1 s = 1 4 S = 5 Z = 5 5

Output argument "tf" (and maybe others) not assigned during call to "magical". Error in Test10 (line 3) assert(isequal(magical(x),y_correct))

11   Fail
x = [1 2 3; 4 5 6]; y_correct = false; assert(isequal(magical(x),y_correct))

s = [] s = 1 S = 1 Z = 1 1 1 s = 1 5 S = 6 Z = 6 6 6

Index in position 1 exceeds array bounds (must not exceed 2). Error in magical (line 4) s(end+1)=x(i,i) Error in Test11 (line 3) assert(isequal(magical(x),y_correct))

12   Pass
x = ones(2); y_correct = false; assert(isequal(magical(x),y_correct))

s = [] s = 1 S = 1 Z = 1 1 s = 1 1 S = 2 Z = 2 2 tf = logical 0

13   Pass
x = [7 1 6; 3 5 7; 4 9 3]; y_correct = false; assert(isequal(magical(x),y_correct))

s = [] s = 7 S = 7 Z = 7 7 7 s = 7 5 S = 12 Z = 12 12 12 s = 7 5 3 S = 15 Z = 15 15 15 tf = logical 0