Loading grid/cross/cross.go +10 −1 Original line number Diff line number Diff line Loading @@ -3,9 +3,18 @@ package cross // Cross ... type Cross struct{} const ( symbolCross = "×" ) // NewCross creates a new cross. func NewCross() *Cross { return &Cross{} } // Symbol ... func (c *Cross) Symbol() string { return "×" return symbolCross } // IsEmpty ... Loading grid/cross/cross_test.go +20 −0 Original line number Diff line number Diff line package cross import ( "testing" ) func TestCross(t *testing.T) { c := NewCross() if s := c.Symbol(); s != symbolCross { t.Errorf("c.Symbol() is \"%s\", expected \"%s\"", s, symbolCross) } if f := c.IsEmpty(); f != false { t.Errorf("c.IsEmpty() is %t, expected %t", f, false) } if f := c.IsNought(); f != false { t.Errorf("c.IsNought() is %t, expected %t", f, false) } if f := c.IsCross(); f != true { t.Errorf("c.IsCross() is %t, expected %t", f, true) } } grid/empty/empty.go +10 −1 Original line number Diff line number Diff line Loading @@ -3,9 +3,18 @@ package empty // Empty ... type Empty struct{} const ( symbolEmpty = " " ) // NewEmpty ... func NewEmpty() *Empty { return &Empty{} } // Symbol ... func (e *Empty) Symbol() string { return " " return symbolEmpty } // IsEmpty ... Loading grid/empty/empty_test.go +20 −0 Original line number Diff line number Diff line package empty import ( "testing" ) func TestEmpty(t *testing.T) { c := NewEmpty() if s := c.Symbol(); s != symbolEmpty { t.Errorf("c.Symbol() is \"%s\", expected \"%s\"", s, symbolEmpty) } if f := c.IsEmpty(); f != true { t.Errorf("c.IsEmpty() is %t, expected %t", f, true) } if f := c.IsNought(); f != false { t.Errorf("c.IsNought() is %t, expected %t", f, false) } if f := c.IsCross(); f != false { t.Errorf("c.IsCross() is %t, expected %t", f, false) } } grid/nought/nought.go +10 −1 Original line number Diff line number Diff line Loading @@ -3,9 +3,18 @@ package nought // Nought ... type Nought struct{} const ( symbolNought = "○" ) // NewNought ... func NewNought() *Nought { return &Nought{} } // Symbol ... func (n *Nought) Symbol() string { return "○" return symbolNought } // IsEmpty ... Loading Loading
grid/cross/cross.go +10 −1 Original line number Diff line number Diff line Loading @@ -3,9 +3,18 @@ package cross // Cross ... type Cross struct{} const ( symbolCross = "×" ) // NewCross creates a new cross. func NewCross() *Cross { return &Cross{} } // Symbol ... func (c *Cross) Symbol() string { return "×" return symbolCross } // IsEmpty ... Loading
grid/cross/cross_test.go +20 −0 Original line number Diff line number Diff line package cross import ( "testing" ) func TestCross(t *testing.T) { c := NewCross() if s := c.Symbol(); s != symbolCross { t.Errorf("c.Symbol() is \"%s\", expected \"%s\"", s, symbolCross) } if f := c.IsEmpty(); f != false { t.Errorf("c.IsEmpty() is %t, expected %t", f, false) } if f := c.IsNought(); f != false { t.Errorf("c.IsNought() is %t, expected %t", f, false) } if f := c.IsCross(); f != true { t.Errorf("c.IsCross() is %t, expected %t", f, true) } }
grid/empty/empty.go +10 −1 Original line number Diff line number Diff line Loading @@ -3,9 +3,18 @@ package empty // Empty ... type Empty struct{} const ( symbolEmpty = " " ) // NewEmpty ... func NewEmpty() *Empty { return &Empty{} } // Symbol ... func (e *Empty) Symbol() string { return " " return symbolEmpty } // IsEmpty ... Loading
grid/empty/empty_test.go +20 −0 Original line number Diff line number Diff line package empty import ( "testing" ) func TestEmpty(t *testing.T) { c := NewEmpty() if s := c.Symbol(); s != symbolEmpty { t.Errorf("c.Symbol() is \"%s\", expected \"%s\"", s, symbolEmpty) } if f := c.IsEmpty(); f != true { t.Errorf("c.IsEmpty() is %t, expected %t", f, true) } if f := c.IsNought(); f != false { t.Errorf("c.IsNought() is %t, expected %t", f, false) } if f := c.IsCross(); f != false { t.Errorf("c.IsCross() is %t, expected %t", f, false) } }
grid/nought/nought.go +10 −1 Original line number Diff line number Diff line Loading @@ -3,9 +3,18 @@ package nought // Nought ... type Nought struct{} const ( symbolNought = "○" ) // NewNought ... func NewNought() *Nought { return &Nought{} } // Symbol ... func (n *Nought) Symbol() string { return "○" return symbolNought } // IsEmpty ... Loading