Sha256: 6275eb807d563667465ac2411c515daf8c3c46ae7a93d64db7189ed7aa62d284

Contents?: true

Size: 987 Bytes

Versions: 81

Compression:

Stored size: 987 Bytes

Contents

package atbash

import "testing"

const targetTestVersion = 1

var tests = []struct {
	expected string
	s        string
}{
	{"ml", "no"},
	{"ml", "no"},
	{"bvh", "yes"},
	{"lnt", "OMG"},
	{"lnt", "O M G"},
	{"nrmwy oldrm tob", "mindblowingly"},
	{"gvhgr mt123 gvhgr mt", "Testing, 1 2 3, testing."},
	{"gifgs rhurx grlm", "Truth is fiction."},
	{"gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt", "The quick brown fox jumps over the lazy dog."},
}

func TestTestVersion(t *testing.T) {
	if testVersion != targetTestVersion {
		t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
	}
}

func TestAtbash(t *testing.T) {
	for _, test := range tests {
		actual := Atbash(test.s)
		if actual != test.expected {
			t.Errorf("Atbash(%s): expected %s, actual %s", test.s, test.expected, actual)
		}
	}
}

func BenchmarkAtbash(b *testing.B) {
	b.StopTimer()
	for _, test := range tests {
		b.StartTimer()

		for i := 0; i < b.N; i++ {
			Atbash(test.s)
		}

		b.StopTimer()
	}
}

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
trackler-2.0.8.48 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.47 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.46 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.45 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.44 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.43 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.42 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.41 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.40 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.39 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.38 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.37 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.36 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.35 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.34 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.33 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.32 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.31 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.30 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.8.29 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go