summaryrefslogtreecommitdiff
path: root/ftoa_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'ftoa_test.go')
-rw-r--r--ftoa_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/ftoa_test.go b/ftoa_test.go
index 276d411..e5076c4 100644
--- a/ftoa_test.go
+++ b/ftoa_test.go
@@ -17,6 +17,15 @@ func TestFtoa(t *testing.T) {
}.validate(t)
}
+func TestFtoaWithDigits(t *testing.T) {
+ testList{
+ {"1.23, 0", FtoaWithDigits(1.23, 0), "1"},
+ {"1.23, 1", FtoaWithDigits(1.23, 1), "1.2"},
+ {"1.23, 2", FtoaWithDigits(1.23, 2), "1.23"},
+ {"1.23, 3", FtoaWithDigits(1.23, 3), "1.23"},
+ }.validate(t)
+}
+
func BenchmarkFtoaRegexTrailing(b *testing.B) {
trailingZerosRegex := regexp.MustCompile(`\.?0+$`)