Skip to content

Commit 1275225

Browse files
hyrodiumdevmotion
andauthored
Use four spaces indent in test/runtests.jl (#22)
* use four spaces indent in `test/runtests.jl` * Fix indent Co-authored-by: David Widmann <[email protected]> * merge nested `for` loops Co-authored-by: David Widmann <[email protected]> * merge nested `for` loops Co-authored-by: David Widmann <[email protected]> --------- Co-authored-by: David Widmann <[email protected]>
1 parent c9a73a6 commit 1275225

File tree

1 file changed

+79
-83
lines changed

1 file changed

+79
-83
lines changed

test/runtests.jl

Lines changed: 79 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,135 +3,131 @@ using Documenter
33
using Test
44

55
@testset "k*pi" begin
6-
@test isapprox(2*pi, twoπ)
7-
@test isapprox(4*pi, fourπ)
8-
@test isapprox(pi/2, halfπ)
9-
@test isapprox(pi/4, quartπ)
6+
@test isapprox(2*pi, twoπ)
7+
@test isapprox(4*pi, fourπ)
8+
@test isapprox(pi/2, halfπ)
9+
@test isapprox(pi/4, quartπ)
1010
end
1111

1212
@testset "k/pi" begin
13-
@test isapprox(1/pi, invπ)
14-
@test isapprox(2/pi, twoinvπ)
15-
@test isapprox(4/pi, fourinvπ)
13+
@test isapprox(1/pi, invπ)
14+
@test isapprox(2/pi, twoinvπ)
15+
@test isapprox(4/pi, fourinvπ)
1616
end
1717

1818
@testset "1/(k*pi)" begin
19-
@test isapprox(1/(2pi), inv2π)
20-
@test isapprox(1/(4pi), inv4π)
19+
@test isapprox(1/(2pi), inv2π)
20+
@test isapprox(1/(4pi), inv4π)
2121
end
2222

2323
@testset "sqrt" begin
24-
@test isapprox(sqrt(2), sqrt2)
25-
@test isapprox(sqrt(3), sqrt3)
26-
@test isapprox(sqrt(pi), sqrtπ)
27-
@test isapprox(sqrt(2pi), sqrt2π)
28-
@test isapprox(sqrt(4pi), sqrt4π)
29-
@test isapprox(sqrt(pi/2), sqrthalfπ)
30-
@test isapprox(sqrt(1/2), invsqrt2)
31-
@test isapprox(sqrt(1/(pi)), invsqrtπ)
32-
@test isapprox(sqrt(1/(2pi)), invsqrt2π)
24+
@test isapprox(sqrt(2), sqrt2)
25+
@test isapprox(sqrt(3), sqrt3)
26+
@test isapprox(sqrt(pi), sqrtπ)
27+
@test isapprox(sqrt(2pi), sqrt2π)
28+
@test isapprox(sqrt(4pi), sqrt4π)
29+
@test isapprox(sqrt(pi/2), sqrthalfπ)
30+
@test isapprox(sqrt(1/2), invsqrt2)
31+
@test isapprox(sqrt(1/(pi)), invsqrtπ)
32+
@test isapprox(sqrt(1/(2pi)), invsqrt2π)
3333
end
3434

3535
@testset "log" begin
36-
@test isapprox(log(1/2), loghalf)
37-
@test isapprox(log(2), logtwo)
38-
@test isapprox(log(10), logten)
39-
@test isapprox(log(pi), logπ)
40-
@test isapprox(log(2pi), log2π)
41-
@test isapprox(log(4pi), log4π)
36+
@test isapprox(log(1/2), loghalf)
37+
@test isapprox(log(2), logtwo)
38+
@test isapprox(log(10), logten)
39+
@test isapprox(log(pi), logπ)
40+
@test isapprox(log(2pi), log2π)
41+
@test isapprox(log(4pi), log4π)
4242
end
4343

4444
@testset "type system" begin
45-
@test twoπ === IrrationalConstants.Twoπ()
46-
@test twoπ isa IrrationalConstants.IrrationalConstant
47-
@test twoπ isa AbstractIrrational
45+
@test twoπ === IrrationalConstants.Twoπ()
46+
@test twoπ isa IrrationalConstants.IrrationalConstant
47+
@test twoπ isa AbstractIrrational
4848
end
4949

5050
@testset "hash" begin
51-
for i in (twoπ, invπ, sqrt2, logtwo)
52-
for j in (twoπ, invπ, sqrt2, logtwo)
53-
@test isequal(i==j, hash(i)==hash(j))
51+
for i in (twoπ, invπ, sqrt2, logtwo), j in (twoπ, invπ, sqrt2, logtwo)
52+
@test isequal(i==j, hash(i)==hash(j))
5453
end
55-
end
5654
end
5755

5856
@testset "doctests" begin
59-
DocMeta.setdocmeta!(
60-
IrrationalConstants, :DocTestSetup, :(using IrrationalConstants); recursive=true
61-
)
62-
doctest(IrrationalConstants; manual=false)
57+
DocMeta.setdocmeta!(
58+
IrrationalConstants, :DocTestSetup, :(using IrrationalConstants); recursive=true
59+
)
60+
doctest(IrrationalConstants; manual=false)
6361
end
6462

6563
# copied from https://github.com/JuliaLang/julia/blob/cf5ae0369ceae078cf6a29d7aa34f48a5a53531e/test/numbers.jl
6664
# and adapted to irrationals in this package
6765

6866
@testset "IrrationalConstant zero and one" begin
69-
@test one(twoπ) === true
70-
@test zero(twoπ) === false
71-
@test one(typeof(twoπ)) === true
72-
@test zero(typeof(twoπ)) === false
67+
@test one(twoπ) === true
68+
@test zero(twoπ) === false
69+
@test one(typeof(twoπ)) === true
70+
@test zero(typeof(twoπ)) === false
7371
end
7472

7573
@testset "IrrationalConstants compared with IrrationalConstants" begin
76-
for i in (twoπ, invπ, sqrt2, logtwo)
77-
for j in (twoπ, invπ, sqrt2, logtwo)
78-
@test isequal(i==j, Float64(i)==Float64(j))
79-
@test isequal(i!=j, Float64(i)!=Float64(j))
80-
@test isequal(i<=j, Float64(i)<=Float64(j))
81-
@test isequal(i>=j, Float64(i)>=Float64(j))
82-
@test isequal(i<j, Float64(i)<Float64(j))
83-
@test isequal(i>j, Float64(i)>Float64(j))
74+
for i in (twoπ, invπ, sqrt2, logtwo), j in (twoπ, invπ, sqrt2, logtwo)
75+
@test isequal(i==j, Float64(i)==Float64(j))
76+
@test isequal(i!=j, Float64(i)!=Float64(j))
77+
@test isequal(i<=j, Float64(i)<=Float64(j))
78+
@test isequal(i>=j, Float64(i)>=Float64(j))
79+
@test isequal(i<j, Float64(i)<Float64(j))
80+
@test isequal(i>j, Float64(i)>Float64(j))
8481
end
85-
end
8682
end
8783

8884
@testset "IrrationalConstant Inverses, JuliaLang/Julia Issue #30882" begin
89-
@test @inferred(inv(twoπ)) 0.15915494309189535
85+
@test @inferred(inv(twoπ)) 0.15915494309189535
9086
end
9187

9288
@testset "IrrationalConstants compared with Rationals and Floats" begin
93-
@test Float64(twoπ, RoundDown) < twoπ
94-
@test Float64(twoπ, RoundUp) > twoπ
95-
@test !(Float64(twoπ, RoundDown) > twoπ)
96-
@test !(Float64(twoπ, RoundUp) < twoπ)
97-
@test Float64(twoπ, RoundDown) <= twoπ
98-
@test Float64(twoπ, RoundUp) >= twoπ
99-
@test Float64(twoπ, RoundDown) != twoπ
100-
@test Float64(twoπ, RoundUp) != twoπ
101-
102-
@test Float32(twoπ, RoundDown) < twoπ
103-
@test Float32(twoπ, RoundUp) > twoπ
104-
@test !(Float32(twoπ, RoundDown) > twoπ)
105-
@test !(Float32(twoπ, RoundUp) < twoπ)
106-
107-
@test prevfloat(big(twoπ)) < twoπ
108-
@test nextfloat(big(twoπ)) > twoπ
109-
@test !(prevfloat(big(twoπ)) > twoπ)
110-
@test !(nextfloat(big(twoπ)) < twoπ)
111-
112-
@test 5293386250278608690//842468587426513207 < twoπ
113-
@test !(5293386250278608690//842468587426513207 > twoπ)
114-
@test 5293386250278608690//842468587426513207 != twoπ
89+
@test Float64(twoπ, RoundDown) < twoπ
90+
@test Float64(twoπ, RoundUp) > twoπ
91+
@test !(Float64(twoπ, RoundDown) > twoπ)
92+
@test !(Float64(twoπ, RoundUp) < twoπ)
93+
@test Float64(twoπ, RoundDown) <= twoπ
94+
@test Float64(twoπ, RoundUp) >= twoπ
95+
@test Float64(twoπ, RoundDown) != twoπ
96+
@test Float64(twoπ, RoundUp) != twoπ
97+
98+
@test Float32(twoπ, RoundDown) < twoπ
99+
@test Float32(twoπ, RoundUp) > twoπ
100+
@test !(Float32(twoπ, RoundDown) > twoπ)
101+
@test !(Float32(twoπ, RoundUp) < twoπ)
102+
103+
@test prevfloat(big(twoπ)) < twoπ
104+
@test nextfloat(big(twoπ)) > twoπ
105+
@test !(prevfloat(big(twoπ)) > twoπ)
106+
@test !(nextfloat(big(twoπ)) < twoπ)
107+
108+
@test 5293386250278608690//842468587426513207 < twoπ
109+
@test !(5293386250278608690//842468587426513207 > twoπ)
110+
@test 5293386250278608690//842468587426513207 != twoπ
115111
end
116112
IrrationalConstants.@irrational i46051 4863.185427757 1548big(pi)
117113
@testset "IrrationalConstant printing" begin
118-
@test sprint(show, "text/plain", twoπ) == "twoπ = 6.2831853071795..."
119-
@test sprint(show, "text/plain", twoπ, context=:compact => true) == "twoπ"
120-
@test sprint(show, twoπ) == "twoπ"
121-
# JuliaLang/Julia issue #46051
122-
@test sprint(show, "text/plain", i46051) == "i46051 = 4863.185427757..."
114+
@test sprint(show, "text/plain", twoπ) == "twoπ = 6.2831853071795..."
115+
@test sprint(show, "text/plain", twoπ, context=:compact => true) == "twoπ"
116+
@test sprint(show, twoπ) == "twoπ"
117+
# JuliaLang/Julia issue #46051
118+
@test sprint(show, "text/plain", i46051) == "i46051 = 4863.185427757..."
123119
end
124120

125121
@testset "IrrationalConstant/Bool multiplication" begin
126-
@test false*twoπ === 0.0
127-
@test twoπ*false === 0.0
128-
@test true*twoπ === Float64(twoπ)
129-
@test twoπ*true === Float64(twoπ)
122+
@test false*twoπ === 0.0
123+
@test twoπ*false === 0.0
124+
@test true*twoπ === Float64(twoπ)
125+
@test twoπ*true === Float64(twoπ)
130126
end
131127

132128
# JuliaLang/Julia issue #26324
133129
@testset "irrational promotion" begin
134-
@test twoπ*ComplexF32(2) isa ComplexF32
135-
@test twoπ/ComplexF32(2) isa ComplexF32
136-
@test log(twoπ, ComplexF32(2)) isa ComplexF32
130+
@test twoπ*ComplexF32(2) isa ComplexF32
131+
@test twoπ/ComplexF32(2) isa ComplexF32
132+
@test log(twoπ, ComplexF32(2)) isa ComplexF32
137133
end

0 commit comments

Comments
 (0)