Ad
  • Default User Avatar

    1, this test should pass (per the "return empty array when n == 0" rule):
    Assert.AreEqual(new double[] { }, Tribonacci(new double[] { 1, 5, 7 }, 0));

    2, tests like this should be removed:
    Assert.AreEqual(new double[] { 300 }, Tribonacci(new double[] { 300, 5, 7 }, 0));
    Assert.AreEqual(new double[] { 0 }, Tribonacci(new double[] { 8, 5, 7 }, 0));

  • Default User Avatar

    In C#, Attempt returns this EXTREMELY BROKEN response:

    Testing for signature: 1, 5, 7 and n: 0

    Expected and actual are both <System.Double[1]>
    Values differ at index [0]
    Expected: 0.0d
    But was: 300.0d

    Instructions: if n==0, then return an empty array.

    So this should pass:
    Assert.AreEqual(new double[] { }, Tribonacci(new double[] { 1, 5, 7 }, 0));

    Also, if I return a double[] { 0 }, I get the error:

    Expected and actual are both <System.Double[1]>
    Values differ at index [0]
    Expected: 1.0d
    But was: 0.0d

    If I leave the starting value alone, then I get the first error above.