Sha256: 28155b4b23b8b0f4043d6f7219329b1b226c4611fcfdfd59ae5600fcc2efe64c

Contents?: true

Size: 576 Bytes

Versions: 396

Compression:

Stored size: 576 Bytes

Contents

// +build bonus

package robotname

import "testing"

func TestCollisions(t *testing.T) {
	m := map[string]bool{}
	// Test uniqueness for new robots.
	// 10k should be plenty to catch names generated
	// randomly without a uniqueness check.
	for i := 0; i < 10000; i++ {
		n := New().Name()
		if m[n] {
			t.Fatalf("Name %s reissued after %d robots.", n, i)
		}
		m[n] = true
	}
	// Test that names aren't recycled either.
	r := New()
	for i := 0; i < 10000; i++ {
		r.Reset()
		n := r.Name()
		if m[n] {
			t.Fatalf("Name %s reissued after Reset.", n)
		}
		m[n] = true
	}
}

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.158 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.157 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.156 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.155 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.154 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.153 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.152 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.151 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.150 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.149 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.148 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.147 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.146 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.145 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.144 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.143 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.142 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.141 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.140 tracks/go/exercises/robot-name/bonus_test.go