Cody

Solution 1880876

Submitted on 22 Jul 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 = [1 2 3 4 5 6 7]; xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

[Warning: Integer operands are required for colon operator when used as index.] [> In split_it (line 4) In ScoringEngineTestPoint1 (line 2) In solutionTest (line 3) In matlab.unittest.internal.executeCodeBlock (line 11) In matlab.unittest.internal.ScriptTestCaseProvider/evaluateTestSection (line 134) In matlab.unittest.internal.ScriptTestCaseProvider/runTestSection (line 128) In matlab.unittest.internal.ScriptTestCaseProvider>@(testCase)provider.runTestSection(testCase) (line 94) In matlab.unittest.FunctionTestCase/test (line 98) In matlab.unittest.TestRunner/evaluateMethodCore (line 854) In matlab.unittest.TestRunner/evaluateMethod (line 1160) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 655) In scoringengine.OutputPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 655) In scoringengine.FiguresPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/evaluateMethodsOnTestContent (line 796) In matlab.unittest.TestRunner/runTestMethod (line 1156) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 609) In scoringengine.OutputPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 609) In scoringengine.FiguresPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/runTest (line 1103) In matlab.unittest.TestRunner/repeatTest (line 485) In matlab.unittest.TestRunner/runSharedTestCase (line 441) In matlab.unittest.TestRunner/runTestClass (line 1013) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/runTestSuite (line 950) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 226) In scoringengine.OutputPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 226) In scoringengine.FiguresPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 226) In matlab.unittest.plugins.DiagnosticsRecordingPlugin/runTestSuite (line 204) In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/doRun (line 414) In matlab.unittest.TestRunner/run (line 293) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ] xi = 4 2 1

Assertion failed.

2   Pass
x = [2 2 2 2 2 2]; xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

xi = 2 2 2

3   Pass
x = [2 5 4 5 4]; xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

[Warning: Integer operands are required for colon operator when used as index.] [> In split_it (line 4) In ScoringEngineTestPoint3 (line 2) In solutionTest (line 7) In matlab.unittest.internal.executeCodeBlock (line 11) In matlab.unittest.internal.ScriptTestCaseProvider/evaluateTestSection (line 134) In matlab.unittest.internal.ScriptTestCaseProvider/runTestSection (line 128) In matlab.unittest.internal.ScriptTestCaseProvider>@(testCase)provider.runTestSection(testCase) (line 94) In matlab.unittest.FunctionTestCase/test (line 98) In matlab.unittest.TestRunner/evaluateMethodCore (line 854) In matlab.unittest.TestRunner/evaluateMethod (line 1160) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 655) In scoringengine.OutputPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 655) In scoringengine.FiguresPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/evaluateMethodsOnTestContent (line 796) In matlab.unittest.TestRunner/runTestMethod (line 1156) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 609) In scoringengine.OutputPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 609) In scoringengine.FiguresPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/runTest (line 1103) In matlab.unittest.TestRunner/repeatTest (line 485) In matlab.unittest.TestRunner/runSharedTestCase (line 441) In matlab.unittest.TestRunner/runTestClass (line 1013) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/runTestSuite (line 950) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 226) In scoringengine.OutputPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 226) In scoringengine.FiguresPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 226) In matlab.unittest.plugins.DiagnosticsRecordingPlugin/runTestSuite (line 204) In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/doRun (line 414) In matlab.unittest.TestRunner/run (line 293) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ] xi = 4 2

4   Fail
x = [1 3 1 1 9 7]; xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

xi = 1 3 7

Index exceeds the number of array elements (6). Error in Test4 (line 3) assert(isequal(sum(x(xi)),sum(x)/2));

5   Fail
x = primes(100); xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

[Warning: Integer operands are required for colon operator when used as index.] [> In split_it (line 4) In ScoringEngineTestPoint5 (line 2) In solutionTest (line 11) In matlab.unittest.internal.executeCodeBlock (line 11) In matlab.unittest.internal.ScriptTestCaseProvider/evaluateTestSection (line 134) In matlab.unittest.internal.ScriptTestCaseProvider/runTestSection (line 128) In matlab.unittest.internal.ScriptTestCaseProvider>@(testCase)provider.runTestSection(testCase) (line 94) In matlab.unittest.FunctionTestCase/test (line 98) In matlab.unittest.TestRunner/evaluateMethodCore (line 854) In matlab.unittest.TestRunner/evaluateMethod (line 1160) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 655) In scoringengine.OutputPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 655) In scoringengine.FiguresPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/evaluateMethodsOnTestContent (line 796) In matlab.unittest.TestRunner/runTestMethod (line 1156) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 609) In scoringengine.OutputPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 609) In scoringengine.FiguresPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/runTest (line 1103) In matlab.unittest.TestRunner/repeatTest (line 485) In matlab.unittest.TestRunner/runSharedTestCase (line 441) In matlab.unittest.TestRunner/runTestClass (line 1013) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/runTestSuite (line 950) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 908) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 226) In scoringengine.OutputPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 226) In scoringengine.FiguresPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 226) In matlab.unittest.plugins.DiagnosticsRecordingPlugin/runTestSuite (line 204) In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 686) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 758) In matlab.unittest.TestRunner/doRun (line 414) In matlab.unittest.TestRunner/run (line 293) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ] xi = 19 29 59 37 41 71 97 61 5 13 83 31

Index exceeds the number of array elements (25). Error in Test5 (line 3) assert(isequal(sum(x(xi)),sum(x)/2));

Suggested Problems

More from this Author63