Skip to content

Commit 03b00df

Browse files
committed
add eltype test and fix typo
1 parent c0d1fc5 commit 03b00df

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Primes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ iterate(np::PrevPrimes, state=np.start) =
732732
end
733733

734734
IteratorSize(::Type{<:PrevPrimes}) = Base.SizeUnknown()
735-
Iteratoreltype(::Type{<:PrevPrimes}) = Base.HasEltype()
735+
IteratorEltype(::Type{<:PrevPrimes}) = Base.HasEltype()
736736

737737
eltype(::Type{PrevPrimes{T}}) where {T} = T
738738

test/runtests.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ end
405405
@test nextprimes(1, 1)[1] == nextprimes(2, 1)[1] == 2
406406
@test nextprimes(3, 1)[1] == 3
407407
@test nextprimes(4, 1)[1] == nextprimes(5, 1)[1] == 5
408+
@test eltype(nextprimes(10)) == Int
409+
@test eltype(nextprimes(big(10))) == BigInt
408410
end
409411

410412

@@ -421,6 +423,8 @@ end
421423
@test length(p8) == 31
422424
@test p8[end] == 2
423425
@test p8[1] == 127
426+
@test eltype(p8) == Int8
424427
end
425-
428+
@test eltype(prevprimes(10)) == Int
429+
@test eltype(prevprimes(big(10))) == BigInt
426430
end

0 commit comments

Comments
 (0)