Failing Tests:

There are 2 end-case situations which fails on the code shown in the lecture. It took me a lot of time to figure their solution correct, so it seemed to me that the code was too simple in the lecture, and I copied it and tried them out:
Here are the tests if anyone wants to check his code out:

// Strike and then 9 and Spare on last frame. The code in the lecture generates for the last frame X91
public void T07_StrikeAndSpareOnLastFrame() {
int[] bowls = {1,9, 2,4, 10, 5,5, 2,8, 10, 7,0, 0,10, 4,1, 10,9,1};
string formatted = “1/24X 5/2/X 7–/41X9/”;
Assert.AreEqual(formatted, ScoreDisplay.FormatRolls (bowls.ToList ()));

// Strike, 0 and then Spare (it’s not Strike if you missed bowl 20). The lecture’s code gives X-X for the last frame
public void T09_StrikeZeroSpareOnLastFrame() {
int[] bowls = {1,9, 2,4, 10, 5,5, 2,8, 10, 7,0, 0,10, 4,1, 10,0,10};
string formatted = “1/24X 5/2/X 7–/41X-/”;
Assert.AreEqual(formatted, ScoreDisplay.FormatRolls (bowls.ToList ()));

Btw, GoldenCopy T05 shows a situation with a spare on the last frame, yet Ben put in the expected result “X91” while we would have expected “X9/”

There are errors in both “formatted” strings:

T07 should be: “1/24X 5/2/X 7–/41X9/”

T08 should be: “1/24X 5/2/X 7–/41X-/”

With these new strings and the corrections in the next lesson, the tests pass.

Privacy & Terms