Sha256: caee2b360f11eb6181f2a567db152f4080cefb0253284b605ecd1f63e67b7213

Contents?: true

Size: 830 Bytes

Versions: 122

Compression:

Stored size: 830 Bytes

Contents

package wordsearch

import (
	"reflect"
	"testing"
)

// Define a function Solve(words []string, puzzle []string) (map[string][2][2]int, error).

func TestSolve(t *testing.T) {
	for _, tc := range testCases {
		actual, err := Solve(tc.words, tc.puzzle)
		if err != nil {
			var _ error = err
			if !tc.expectError {
				t.Fatalf("FAIL: %s\nExpected %#v\nGot error: %v", tc.description, tc.expected, err)
			}
		} else if tc.expectError {
			t.Fatalf("FAIL: %s\nExpected error\nGot %v", tc.description, actual)
		} else if !reflect.DeepEqual(actual, tc.expected) {
			t.Fatalf("FAIL: %s\nExpected %v,\nGot %v", tc.description, tc.expected, actual)
		}
		t.Logf("PASS: %s", tc.description)
	}
}

func BenchmarkSolve(b *testing.B) {
	for i := 0; i < b.N; i++ {
		for _, tc := range testCases {
			Solve(tc.words, tc.puzzle)
		}
	}
}

Version data entries

122 entries across 122 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.179 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.178 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.177 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.176 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.175 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.174 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.173 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.172 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.171 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.170 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.169 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.167 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.166 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.165 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.164 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.163 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.162 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.161 tracks/go/exercises/word-search/word_search_test.go
trackler-2.2.1.160 tracks/go/exercises/word-search/word_search_test.go