Cody

Solution 1982860

Submitted on 19 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
filetext = fileread('rep_str_3.m'); assert(isempty(strfind(filetext, 'for'))) assert(isempty(strfind(filetext, 'while')))

Assertion failed.

2   Fail
string1 = 'string1'; string2 = 'STRING2'; num1 = 0; num2 = 10; n = 2; y_correct = { 'string1_0' 'STRING2_10' 'string1_1' 'STRING2_11'}; assert(isequal(rep_str_3(string1, string2, num1, num2, n),y_correct))

y = 1×1 cell array {["string1_0"]} y = 1×2 cell array {["string1_0"]} {["STRING2_10"]} k = 4 y = 1×4 cell array {["string1_0"]} {["STRING2_10"]} {0×0 double} {["string1_1"]} y = 1×5 cell array {["string1_0"]} {["STRING2_10"]} {0×0 double} {["string1_1"]} {["STRING2_11"]} k = 7

Assertion failed.

3   Fail
string1 = 'm'; string2 = 'l'; num1 = 2; num2 = 3; n = 3; y_correct = { 'm_2' 'l_3' 'm_3' 'l_4' 'm_4' 'l_5'}; assert(isequal(rep_str_3(string1, string2, num1, num2, n),y_correct))

y = 1×1 cell array {["m_2"]} y = 1×2 cell array {["m_2"]} {["l_3"]} k = 4 y = 1×4 cell array {["m_2"]} {["l_3"]} {0×0 double} {["m_3"]} y = 1×5 cell array {["m_2"]} {["l_3"]} {0×0 double} {["m_3"]} {["l_4"]} k = 7 y = 1×7 cell array {["m_2"]} {["l_3"]} {0×0 double} {["m_3"]} {["l_4"]} {0×0 double} {["m_4"]} y = 1×8 cell array {["m_2"]} {["l_3"]} {0×0 double} {["m_3"]} {["l_4"]} {0×0 double} {["m_4"]} {["l_5"]} k = 10

Assertion failed.

4   Fail
string1 = 'A'; string2 = 'B'; num1 = 50; num2 = 230; n = 4; y_correct = { 'A_50' 'B_230' 'A_51' 'B_231' 'A_52' 'B_232' 'A_53' 'B_233'}; assert(isequal(rep_str_3(string1, string2, num1, num2, n),y_correct))

y = 1×1 cell array {["A_50"]} y = 1×2 cell array {["A_50"]} {["B_230"]} k = 4 y = 1×4 cell array {["A_50"]} {["B_230"]} {0×0 double} {["A_51"]} y = 1×5 cell array {["A_50"]} {["B_230"]} {0×0 double} {["A_51"]} {["B_231"]} k = 7 y = 1×7 cell array {["A_50"]} {["B_230"]} {0×0 double} {["A_51"]} {["B_231"]} {0×0 double} {["A_52"]} y = 1×8 cell array {["A_50"]} {["B_230"]} {0×0 double} {["A_51"]} {["B_231"]} {0×0 double} {["A_52"]} {["B_232"]} k = 10 y = 1×10 cell array {["A_50"]} {["B_230"]} {0×0 double} {["A_51"]} {["B_231"]} {0×0 double} {["A_52"]} {["B_232"]} {0×0 double} {["A_53"]} y = 1×11 cell array {["A_50"]} {["B_230"]} {0×0 double} {["A_51"]} {["B_231"]} {0×0 double} {["A_52"]} {["B_232"]} {0×0 double} {["A_53"]} {["B_233"]} k = 13

Assertion failed.