Sha256: 724bf139cd2a5e2fa924c77f9b111791803fb08d7ec56beec5acb0cb4f753be7
Contents?: true
Size: 833 Bytes
Versions: 122
Compression:
Stored size: 833 Bytes
Contents
package romannumerals import "testing" func TestRomanNumerals(t *testing.T) { tc := append(romanNumeralTests, []romanNumeralTest{ {0, "", true}, {-1, "", true}, {3001, "", true}, }...) 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
122 entries across 122 versions & 1 rubygems