From: Rob Pike Date: Wed, 18 Jun 2014 17:57:18 +0000 (-0700) Subject: fmt: include ±Inf and NaN in the complex format test X-Git-Tag: go1.4beta1~1265 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7dcbf4f353a724091a6f1fc4e760753d3adecd2b;p=gostls13.git fmt: include ±Inf and NaN in the complex format test Just to be more thorough. No need to push this to 1.3; it's just a test change that worked without any changes to the code being tested. LGTM=crawshaw R=golang-codereviews, crawshaw CC=golang-codereviews https://golang.org/cl/109080045 --- diff --git a/src/pkg/fmt/fmt_test.go b/src/pkg/fmt/fmt_test.go index 430da628aa..ef8b2ad86e 100644 --- a/src/pkg/fmt/fmt_test.go +++ b/src/pkg/fmt/fmt_test.go @@ -676,7 +676,7 @@ func TestSprintf(t *testing.T) { // thing as if done by hand with two singleton prints. func TestComplexFormatting(t *testing.T) { var yesNo = []bool{true, false} - var signs = []float64{1, 0, -1} + var values = []float64{1, 0, -1, math.Inf(1), math.Inf(-1), math.NaN()} for _, plus := range yesNo { for _, zero := range yesNo { for _, space := range yesNo { @@ -701,10 +701,10 @@ func TestComplexFormatting(t *testing.T) { imagFmt += "+" imagFmt += "10.2" imagFmt += string(char) - for _, realSign := range signs { - for _, imagSign := range signs { - one := Sprintf(realFmt, complex(realSign, imagSign)) - two := Sprintf("("+realFmt+imagFmt+"i)", realSign, imagSign) + for _, realValue := range values { + for _, imagValue := range values { + one := Sprintf(realFmt, complex(realValue, imagValue)) + two := Sprintf("("+realFmt+imagFmt+"i)", realValue, imagValue) if one != two { t.Error(f, one, two) }