Sha256: 2db215111d9e03487f8122481576417ec57217f5670b9fafb228a9fca6f04c79

Contents?: true

Size: 1.77 KB

Versions: 101

Compression:

Stored size: 1.77 KB

Contents

package binarysearch

// Source: exercism/problem-specifications
// Commit: 6114d03 binary-search: Update json for new input policy
// Problem Specifications Version: 1.1.0

var testCases = []struct {
	description string
	slice       []int
	key         int
	x           int
}{
	{
		description: "finds a value in an array with one element",
		slice:       []int{6},
		key:         6,
		x:           0,
	},
	{
		description: "finds a value in the middle of an array",
		slice:       []int{1, 3, 4, 6, 8, 9, 11},
		key:         6,
		x:           3,
	},
	{
		description: "finds a value at the beginning of an array",
		slice:       []int{1, 3, 4, 6, 8, 9, 11},
		key:         1,
		x:           0,
	},
	{
		description: "finds a value at the end of an array",
		slice:       []int{1, 3, 4, 6, 8, 9, 11},
		key:         11,
		x:           6,
	},
	{
		description: "finds a value in an array of odd length",
		slice:       []int{1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634},
		key:         144,
		x:           9,
	},
	{
		description: "finds a value in an array of even length",
		slice:       []int{1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377},
		key:         21,
		x:           5,
	},
	{
		description: "identifies that a value is not included in the array",
		slice:       []int{1, 3, 4, 6, 8, 9, 11},
		key:         7,
		x:           -1,
	},
	{
		description: "a value smaller than the array's smallest value is not included",
		slice:       []int{1, 3, 4, 6, 8, 9, 11},
		key:         0,
		x:           -1,
	},
	{
		description: "a value larger than the array's largest value is not included",
		slice:       []int{1, 3, 4, 6, 8, 9, 11},
		key:         13,
		x:           -1,
	},
	{
		description: "nothing is included in an empty array",
		slice:       []int{},
		key:         1,
		x:           -1,
	},
}

Version data entries

101 entries across 101 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.138 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.137 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.136 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.135 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.134 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.133 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.132 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.131 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.130 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.129 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.128 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.127 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.126 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.125 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.124 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.123 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.122 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.121 tracks/go/exercises/binary-search/cases_test.go
trackler-2.2.1.120 tracks/go/exercises/binary-search/cases_test.go