Sha256: b0576e47b8395cedfec5742d8f48ca6316ae95416cce3c63f8c202d86ae1c3be

Contents?: true

Size: 1.03 KB

Versions: 125

Compression:

Stored size: 1.03 KB

Contents

package romannumerals

import "testing"

const targetTestVersion = 3

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

func TestRomanNumerals(t *testing.T) {
	tc := append(romanNumeralTests, []romanNumeralTest{
		{0, "", true},
		{-1, "", true},
		{4000, "", true},
		{3999, "MMMCMXCIX", false},
	}...)
	for _, test := range tc {
		actual, err := ToRomanNumeral(test.arabic)
		if err == nil && test.hasError {
			t.Errorf("ToRomanNumeral(%d) should return an error.", test.arabic)
			continue
		}
		if err != nil && !test.hasError {
			var _ error = err
			t.Errorf("ToRomanNumeral(%d) should not return an error.", test.arabic)
			continue
		}
		if !test.hasError && actual != test.roman {
			t.Errorf("ToRomanNumeral(%d): %s, expected %s", test.arabic, actual, test.roman)
		}
	}
}

func BenchmarkRomanNumerals(b *testing.B) {
	for i := 0; i < b.N; i++ {
		for _, test := range romanNumeralTests {
			ToRomanNumeral(test.arabic)
		}
	}
}

Version data entries

125 entries across 125 versions & 1 rubygems

Version Path
trackler-2.2.1.27 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.26 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.25 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.24 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.23 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.22 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.21 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.20 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.19 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.18 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.17 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.16 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.15 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.14 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.13 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.12 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.11 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.10 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.9 tracks/go/exercises/roman-numerals/roman_numerals_test.go
trackler-2.2.1.8 tracks/go/exercises/roman-numerals/roman_numerals_test.go