Skip to content

Commit 773c2e5

Browse files
authored
update tests
1 parent 00f7ea4 commit 773c2e5

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/string.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
@testset "string" begin
1+
function test_string_and_show(x, s)
2+
b = IOBuffer
3+
show(b, x)
4+
@test String(take!(b)) == string(x) == s
5+
end
26

3-
@test string(Double64(pi)) == "3.14159265358979323846264338327950588"
7+
@testset "string" begin
8+
test_string_and_show(Double64(pi), "3.14159265358979323846264338327950588")
49

5-
@test string(Double64(2.3045377697175683e-24, -1.5436846311151439e-40)) == "2.30453776971756809999999999999975586e-24"
10+
x = Double64(2.3045377697175683e-24, -1.5436846311151439e-40)
11+
test_string_and_show(x, "2.30453776971756809999999999999975586e-24")
612

7-
@test string(ComplexDF64(1.0,1.0)) == "1.0 + 1.0im"
13+
test_string_and_show(ComplexDF64(1.0,1.0), "1.0 + 1.0im")
14+
15+
x = Complex{Double64}(pi)+Double64(pi)*im
16+
test_string_and_show(x, "3.14159265358979323846264338327950588 + 3.14159265358979323846264338327950588im")
817

918
@test stringtyped(Double64(pi)) == "Double64(3.141592653589793, 1.2246467991473532e-16)"
1019

0 commit comments

Comments
 (0)