Sha256: fc678437c98175241f13fda0532caa6da85a0075cb5e4b62b96e7b9ddab43a94

Contents?: true

Size: 1.13 KB

Versions: 121

Compression:

Stored size: 1.13 KB

Contents

package say

// The steps are interesting, but all that matters is the final exam.

import (
	"math"
	"testing"
)

var tests = []struct {
	uint64
	string
}{
	{1, "one"},
	{14, "fourteen"},
	{20, "twenty"},
	{22, "twenty-two"},
	{100, "one hundred"},
	{120, "one hundred twenty"},
	{123, "one hundred twenty-three"},
	{1000, "one thousand"},
	{1234, "one thousand two hundred thirty-four"},
	{1000000, "one million"},
	{1000002, "one million two"},
	{1002345, "one million two thousand three hundred forty-five"},
	{1e9, "one billion"},
	{987654321123, "nine hundred eighty-seven billion " +
		"six hundred fifty-four million " +
		"three hundred twenty-one thousand " +
		"one hundred twenty-three"},
	{0, "zero"},
	{math.MaxUint64, "eighteen quintillion " +
		"four hundred forty-six quadrillion " +
		"seven hundred forty-four trillion " +
		"seventy-three billion " +
		"seven hundred nine million " +
		"five hundred fifty-one thousand " +
		"six hundred fifteen"},
}

func TestSay(t *testing.T) {
	for _, test := range tests {
		if s := Say(test.uint64); s != test.string {
			t.Errorf("Say(%d) = %q.  Want %q.", test.uint64, s, test.string)
		}
	}
}

Version data entries

121 entries across 121 versions & 1 rubygems

Version Path
trackler-2.0.8.20 tracks/go/exercises/say/say_test.go
trackler-2.0.8.19 tracks/go/exercises/say/say_test.go
trackler-2.0.8.18 tracks/go/exercises/say/say_test.go
trackler-2.0.8.17 tracks/go/exercises/say/say_test.go
trackler-2.0.8.16 tracks/go/exercises/say/say_test.go
trackler-2.0.8.15 tracks/go/exercises/say/say_test.go
trackler-2.0.8.14 tracks/go/exercises/say/say_test.go
trackler-2.0.8.13 tracks/go/exercises/say/say_test.go
trackler-2.0.8.12 tracks/go/exercises/say/say_test.go
trackler-2.0.8.11 tracks/go/exercises/say/say_test.go
trackler-2.0.8.10 tracks/go/exercises/say/say_test.go
trackler-2.0.8.9 tracks/go/exercises/say/say_test.go
trackler-2.0.8.8 tracks/go/exercises/say/say_test.go
trackler-2.0.8.7 tracks/go/exercises/say/say_test.go
trackler-2.0.8.6 tracks/go/exercises/say/say_test.go
trackler-2.0.8.5 tracks/go/exercises/say/say_test.go
trackler-2.0.8.4 tracks/go/exercises/say/say_test.go
trackler-2.0.8.3 tracks/go/exercises/say/say_test.go
trackler-2.0.8.2 tracks/go/exercises/say/say_test.go
trackler-2.0.8.1 tracks/go/exercises/say/say_test.go