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.180 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.179 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.178 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.177 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.176 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.175 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.174 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.173 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.172 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.171 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.170 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.169 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.167 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.166 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.165 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.164 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.163 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.162 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.161 tracks/go/exercises/robot-name/bonus_test.go
trackler-2.2.1.160 tracks/go/exercises/robot-name/bonus_test.go