2019-12-01 15:03:27 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"math/rand"
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/gdamore/tcell"
|
|
|
|
)
|
|
|
|
|
|
|
|
type testMinoStruct struct {
|
|
|
|
minoRotation MinoRotation
|
|
|
|
x int
|
|
|
|
y int
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
setupForTesting()
|
|
|
|
retCode := m.Run()
|
|
|
|
os.Exit(retCode)
|
|
|
|
}
|
|
|
|
|
|
|
|
func setupForTesting() {
|
2020-09-11 05:33:02 -05:00
|
|
|
logger = log.New(os.Stdout, "", log.Ldate|log.Ltime|log.LUTC|log.Lshortfile)
|
2019-12-01 15:03:27 -06:00
|
|
|
|
|
|
|
rand.Seed(1)
|
|
|
|
|
|
|
|
err := loadBoards()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal("error loading boards:", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
screen, err = tcell.NewScreen()
|
|
|
|
if err != nil {
|
|
|
|
logger.Fatal("NewScreen error:", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
NewMinos()
|
|
|
|
NewBoard()
|
|
|
|
NewEngine()
|
|
|
|
}
|