Skip to content

Commit cb668d9

Browse files
committed
Fix typo, add tests
1 parent 579d68d commit cb668d9

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "UnspecifiedTypes"
22
uuid = "42b3faec-625b-4613-8ddc-352bf9672b8d"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.1.1"
4+
version = "0.1.2"
55

66
[compat]
77
julia = "1.10"

src/unspecifiedzero.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ Base.:/(::Number, ::UnspecifiedZero) = throw(DivideError())
3232
Base.:/(::UnspecifiedZero, ::UnspecifiedZero) = throw(DivideError())
3333
Base.:-(::UnspecifiedZero) = UnspecifiedZero()
3434

35-
Base.promote_rule(::Type{<:UnspecifiedZero}, t::Type) = t2
35+
Base.promote_rule(::Type{<:UnspecifiedZero}, t::Type) = t
3636
Base.promote_rule(::Type{<:UnspecifiedZero}, ::Type{<:UnspecifiedZero}) = UnspecifiedZero
3737
Base.promote_type(::Type{<:Complex{<:UnspecifiedZero}}, t::Type) = complex(t)

test/Project.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
33
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
44
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
55
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
6+
UnspecifiedTypes = "42b3faec-625b-4613-8ddc-352bf9672b8d"
67

78
[compat]
89
Aqua = "0.8.9"

test/test_basics.jl

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using UnspecifiedTypes: UnspecifiedZero
2+
using Test: @testset, @test
3+
4+
@testset "UnspecifiedTypes (eltype=$elt)" for elt in (
5+
Float32, Float64, Complex{Float32}, Complex{Float64}
6+
)
7+
8+
for x in (
9+
elt(2) + UnspecifiedZero(),
10+
UnspecifiedZero() + elt(2),
11+
)
12+
@test x isa elt
13+
@test x === elt(2)
14+
end
15+
16+
for x in (
17+
elt(2) * UnspecifiedZero(),
18+
UnspecifiedZero() * elt(2),
19+
)
20+
@test x isa UnspecifiedZero
21+
@test x === UnspecifiedZero()
22+
end
23+
24+
end

0 commit comments

Comments
 (0)