Sha256: 55898f2993f4ba2739b29b0d7d9b4ed1fd5c6b3a2625394a6f872b67e9a676d3

Contents?: true

Size: 1.66 KB

Versions: 184

Compression:

Stored size: 1.66 KB

Contents

package cryptosquare

import "testing"

const targetTestVersion = 2

var tests = []struct {
	pt string // plain text
	ct string // cipher text
}{
	{
		"s#$%^&plunk",
		"su pn lk",
	},
	{
		"1, 2, 3 GO!",
		"1g 2o 3",
	},
	{
		"1234",
		"13 24",
	},
	{
		"123456789",
		"147 258 369",
	},
	{
		"123456789abc",
		"159 26a 37b 48c",
	},
	{
		"Never vex thine heart with idle woes",
		"neewl exhie vtetw ehaho ririe vntds",
	},
	{
		"ZOMG! ZOMBIES!!!",
		"zzi ooe mms gb",
	},
	{
		"Time is an illusion. Lunchtime doubly so.",
		"tasney inicds miohoo elntu illib suuml",
	},
	{
		"We all know interspecies romance is weird.",
		"wneiaw eorene awssci liprer lneoid ktcms",
	},
	{
		"Madness, and then illumination.",
		"msemo aanin dnin ndla etlt shui",
	},
	{
		"Vampires are people too!",
		"vrel aepe mset paoo irpo",
	},
	{
		"",
		"",
	},
	{
		"1",
		"1",
	},
	{
		"12",
		"1 2",
	},
	{
		"12 3",
		"13 2",
	},
	{
		"12345678",
		"147 258 36",
	},
	{
		"123456789a",
		"159 26a 37 48",
	},
	{
		"If man was meant to stay on the ground god would have given us roots",
		"imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau",
	},
	{
		"Have a nice day. Feed the dog & chill out!",
		"hifei acedl veeol eddgo aatcu nyhht",
	},
}

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

func TestEncode(t *testing.T) {
	for _, test := range tests {
		if ct := Encode(test.pt); ct != test.ct {
			t.Fatalf(`Encode(%q):
got  %q
want %q`, test.pt, ct, test.ct)
		}
	}
}

func BenchmarkEncode(b *testing.B) {
	for i := 0; i < b.N; i++ {
		for _, test := range tests {
			Encode(test.pt)
		}
	}
}

Version data entries

184 entries across 184 versions & 1 rubygems

Version Path
trackler-2.2.1.56 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.55 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.54 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.53 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.52 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.51 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.50 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.49 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.48 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.47 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.46 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.45 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.44 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.43 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.42 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.41 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.40 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.39 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.38 tracks/go/exercises/crypto-square/crypto_square_test.go
trackler-2.2.1.37 tracks/go/exercises/crypto-square/crypto_square_test.go