Skip to content

Commit

Permalink
Add failing test case demonstrating sprintf negative zero bug dotnet#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jwosty committed Dec 13, 2024
1 parent 471fdc8 commit 21a6776
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ type PrintfTests() =
Assert.AreEqual(" 7B", sprintf "%*X" 8 123 )
Assert.AreEqual("7B ", sprintf "%-*X" 8 123 )


[<Fact>]
member this.``positive and negative zero``() =
test "%f" +0.0 "0.000000"
test "%f" -0.0 "-0.000000"
test "%f" -0.0000001 "-0.000000"
test "%+f" +0.0 "+0.000000"
test "%+f" -0.0 "-0.000000"
test "%+f" -0.0000001 "-0.000000"

[<Fact>]
member _.``union case formatting`` () =
Assert.AreEqual("CaseOne", sprintf "%A" CaseOne)
Expand Down

0 comments on commit 21a6776

Please sign in to comment.