[ next ] [ prev ] [ contents ] [ up to More Tests for Story Three ] XP-Cinti TDD Workshop

Fixing the Boundary Problem

Fixing the boundary problem is easy. Just put some checks into the indexing method.

...
  def [](x,y)
    if x<1 || y<1
      nil
    else
      @tied[x-1][y-1]
    end
  end
...

Running the tests show that they all pass.


[ next ] [ prev ] [ contents ] [ up to More Tests for Story Three ] Copyright 2003 by Jim Weirich.
Some Rights Reserved