Commit 1a7c8044 authored by Boris Mühmer's avatar Boris Mühmer
Browse files

added points test

parent 02fe9aa5
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
package board

import (
	"encoding/json"
	"reflect"
	"testing"
)

func TestPoints(t *testing.T) {
	ps := Points()

	b, err := json.MarshalIndent(ps, "", "  ")
	if err != nil {
		t.Fatalf("json.MarshalIndent() failed with: %s", err)
	}
	t.Logf("JSON: %s", string(b))
	var ps1 []Point
	if err := json.Unmarshal(b, &ps1); err != nil {
		t.Fatalf("(json.Unmarshal) failed with: %s", err)
	}

	if !reflect.DeepEqual(ps, ps1) {
		t.Fatal("points do not match")
	}
}

func TestBoard(t *testing.T) {
	b := New()
	t.Logf("Board: %s", b)