18 lines
365 B
Go
18 lines
365 B
Go
package primes
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDecimalPeriod(t *testing.T) {
|
|
tests := []struct {
|
|
Value int
|
|
Period int
|
|
}{{2, 1}, {3, 1}, {5, 1}, {7, 6}, {11, 2}, {13, 6}, {17, 16}, {41, 5}, {271, 5}}
|
|
for _, test := range tests {
|
|
assert.Equal(t, test.Period, DecimalPeriod(test.Value), "for p = %d", test.Value)
|
|
}
|
|
}
|