Maintain history; use state

This commit is contained in:
Madison Rye Progress
2025-09-13 20:58:36 -07:00
parent bef9cd248e
commit f3b3803535
7 changed files with 63 additions and 12 deletions

View File

@ -1,6 +1,7 @@
package state
import (
"regexp"
"testing"
. "github.com/smartystreets/goconvey/convey"
@ -48,6 +49,24 @@ func TestState(t *testing.T) {
})
})
Convey("You can maintain a history of all actions", func() {
s.Flag()
s.Mark()
s.Clear()
s.CursorSectionRight()
s.CursorSectionLeft()
s.CursorSectionDown()
s.CursorSectionUp()
s.CursorCellRight()
s.CursorCellLeft()
s.CursorCellDown()
s.CursorCellUp()
matches, err := regexp.Match("gogogogogram 2 2:\n(i\\(\\d,\\d\\)[\b\x01]{4}){4}fmcRLDUrldu", []byte(s.History()))
So(matches, ShouldBeTrue)
So(err, ShouldBeNil)
})
Convey("You can complete sections and clear portions of the board", func() {
s.cells.vivify(Point{0, 0})
s.cells.vivify(Point{2, 0})