Cody

Solution 1945235

Submitted on 21 Sep 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
p=[0 0]; v=[1 -1]; w=[1 1]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-1)<.005)

distp2v = 1.4142 distp2w = 1.4142 m1 = Inf m2 = 0 p2v = 1.4142 p2w = 1.4142 A = 0 -1 Inf -1 b = 0 Inf [Warning: Matrix is singular to working precision.] [> In distP2S (line 15) In ScoringEngineTestPoint1 (line 4) 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 96) In matlab.unittest/TestRunner/evaluateMethodCore (line 870) In matlab.unittest/TestRunner/evaluateMethod (line 1186) In matlab.unittest/TestRunner/invokeTestContentOperatorMethod_ (line 925) In matlab.unittest.plugins/TestRunnerPlugin/evaluateMethod (line 729) In scoringengine/OutputPlugin/evaluateMethod In matlab.unittest.plugins/TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 760) In matlab.unittest.plugins/TestRunnerPlugin/evaluateMethod (line 729) In scoringengine/FiguresPlugin/evaluateMethod In matlab.unittest.plugins/TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 760) In matlab.unittest/TestRunner/evaluateMethodOnPlugins (line 438) In matlab.unittest/TestRunner/evaluateMethodsOnTestContent (line 812) In matlab.unittest/TestRunner/runTestMethod (line 1182) In matlab.unittest/TestRunner/invokeTestContentOperatorMethod_ (line 925) In matlab.unittest.plugins/TestRunnerPlugin/runTestMethod (line 648) In scoringengine/OutputPlugin/runTestMethod In matlab.unittest.plugins/TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 760) In matlab.unittest.plugins/TestRunnerPlugin/runTestMethod (line 648) In scoringengine/FiguresPlugin/runTestMethod In matlab.unittest.plugins/TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 760) In matlab.unittest/TestRunner/evaluateMethodOnPlugins (line 438) In matlab.unittest/TestRunner/runTest (line 1129) In matlab.unittest/TestRunner/repeatTest (line 516) In matlab.unittest/TestRunner/runSharedTestCase (line 472) In matlab.unittest/TestRunner/runTestClass (line 1039) In matlab.unittest/TestRunner/invokeTestContentOperatorMethod_ (line 925) In matlab.unittest/TestRunner/evaluateMethodOnPlugins (line 438) In matlab.unittest/TestRunner/runTestSuite (line 976) In matlab.unittest/TestRunner/invokeTestContentOperatorMethod_ (line 925) In matlab.unittest.plugins/TestRunnerPlugin/runTestSuite (line 265) In scoringengine/OutputPlugin/runTestSuite In matlab.unittest.plugins/TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 760) In matlab.unittest.plugins/TestRunnerPlugin/runTestSuite (line 265) In scoringengine/FiguresPlugin/runTestSuite In matlab.unittest.plugins/TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 760) In matlab.unittest.plugins/TestRunnerPlugin/runTestSuite (line 265) In matlab.unittest.plugins/DiagnosticsRecordingPlugin/runTestSuite (line 199) In matlab.unittest.plugins/TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 760) In matlab.unittest/TestRunner/evaluateMethodOnPlugins (line 438) In matlab.unittest/TestRunner/evaluateMethodOnPluginsFromMethodName (line 426) In matlab.unittest.internal/SerialTestRunStrategy/runSession (line 21) In matlab.unittest/TestRunner/runSession (line 937) In matlab.unittest/TestRunner/invokeTestContentOperatorMethod_ (line 925) In matlab.unittest/TestRunner/evaluateMethodOnPlugins (line 438) In matlab.unittest/TestRunner/evaluateMethodOnPluginsFromMethodName (line 426) In matlab.unittest/TestRunner/doRunWithFcn (line 409) In matlab.unittest/TestRunner/run (line 297) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ] u = NaN 0 ux = NaN uy = 0 distp2u = NaN distVec = 1.4142 1.4142 NaN d = 1.4142

Assertion failed.

2   Pass
p=[0 0]; v=[-1 2]; w=[1 2]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-2)<.005)

distp2v = 2.2361 distp2w = 2.2361 m1 = 0 distp2u = 2 distVec = 2.2361 2.2361 2.0000 d = 2

3   Pass
p=[0 0]; v=[-1 -1]; w=[1 1]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d)<.005)

distp2v = 1.4142 distp2w = 1.4142 m1 = 1 m2 = -1 p2v = 1.4142 p2w = 1.4142 A = -1 -1 1 -1 b = 0 0 u = 0 0 ux = 0 uy = 0 distp2u = 0 distVec = 1.4142 1.4142 0 d = 0

4   Pass
p=[1 1]; v=[0 3]; w=[3 0]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-1/2^.5)<.005)

distp2v = 2.2361 distp2w = 2.2361 m1 = -1 m2 = 1 p2v = 2.2361 p2w = 2.2361 A = 1 -1 -1 -1 b = 0 -3 u = 1.5000 1.5000 ux = 1.5000 uy = 1.5000 distp2u = 0.7071 distVec = 2.2361 2.2361 0.7071 d = 0.7071

5   Pass
p=[5 0]; v=[0 3]; w=[3 0]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-2)<.005)

distp2v = 5.8310 distp2w = 2 m1 = -1 m2 = 1 p2v = 5.8310 p2w = 2 A = 1 -1 -1 -1 b = 5 -3 u = 4 -1 ux = 4 uy = -1 distp2u = NaN distVec = 5.8310 2.0000 NaN d = 2

6   Pass
p=[0 6]; v=[0 3]; w=[3 0]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-3)<.005)

distp2v = 3 distp2w = 6.7082 m1 = -1 m2 = 1 p2v = 3 p2w = 6.7082 A = 1 -1 -1 -1 b = -6 -3 u = -1.5000 4.5000 ux = -1.5000 uy = 4.5000 distp2u = NaN distVec = 3.0000 6.7082 NaN d = 3

7   Pass
p=[-4 0]; v=[0 3]; w=[-3 0]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)) assert(abs(d-1)<.005)

distp2v = 5 distp2w = 1 m1 = 1 m2 = -1 p2v = 5 p2w = 1 A = -1 -1 1 -1 b = 4 -3 u = -3.5000 -0.5000 ux = -3.5000 uy = -0.5000 distp2u = NaN distVec = 5 1 NaN d = 1 d = 1

8   Pass
p=[1 0]; v=[1.01 0]; w=[5 5]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)) assert(abs(d-.01)<.005)

distp2v = 0.0100 distp2w = 6.4031 m1 = 1.2531 m2 = -0.7980 p2v = 0.0100 p2w = 6.4031 A = -0.7980 -1.0000 1.2531 -1.0000 b = -0.7980 1.2657 u = 1.0061 -0.0049 ux = 1.0061 uy = -0.0049 distp2u = NaN distVec = 0.0100 6.4031 NaN d = 0.0100 d = 0.0100