Skip to content

Commit 1159e99

Browse files
committed
🐛 (quick): fix quick test with limit iteration
1 parent c8e0f90 commit 1159e99

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

property-base-test/roman_number_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package roman_numerals
22

33
import (
44
"fmt"
5+
"log"
56
"testing"
7+
"testing/quick"
68
)
79

810
var cases = []struct {
@@ -62,3 +64,21 @@ func TestConvertingToArabic(t *testing.T) {
6264
})
6365
}
6466
}
67+
68+
func TestPropertiesOfConversion(t *testing.T) {
69+
assertion := func(arabic int) bool {
70+
if arabic < 0 || arabic > 3999 {
71+
log.Println(arabic)
72+
return true
73+
}
74+
roman := ConvertToRoman(arabic)
75+
fromRoman := ConvertToArabic(roman)
76+
return fromRoman == arabic
77+
}
78+
79+
if err := quick.Check(assertion, &quick.Config{
80+
MaxCount: 1000,
81+
}); err != nil {
82+
t.Error("failed checks", err)
83+
}
84+
}

0 commit comments

Comments
 (0)