Sha256: be208b6a4d70c2a3bdc9143c599496d5acd4bf2af0a0f592220fd39604b4347a

Contents?: true

Size: 798 Bytes

Versions: 87

Compression:

Stored size: 798 Bytes

Contents

package atbash

import "testing"

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 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

87 entries across 87 versions & 1 rubygems

Version Path
trackler-2.0.6.31 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.30 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.29 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.28 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.27 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.26 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.25 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.24 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.23 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.22 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.21 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.20 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.19 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.18 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.17 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.16 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.15 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.14 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.13 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go
trackler-2.0.6.12 tracks/go/exercises/atbash-cipher/atbash_cipher_test.go