Skip to content

Commit

Permalink
added tests, NEWS, and a bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Jul 10, 2023
1 parent 8f46fa0 commit 3623b67
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ New library functions
* `tanpi` is now defined. It computes tan(πx) more accurately than `tan(pi*x)` ([#48575]).
* `fourthroot(x)` is now defined in `Base.Math` and can be used to compute the fourth root of `x`.
It can also be accessed using the unicode character ``, which can be typed by `\fourthroot<tab>` ([#48899]).
* `unzip(itr)` is now provided, essentially as an inverse of `zip` ([#33515]).
* `Libc.memmove`, `Libc.memset`, and `Libc.memcpy` are now defined, whose functionality matches that of their respective C calls.

New library features
Expand Down
2 changes: 1 addition & 1 deletion base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using .Base:
SizeUnknown, HasLength, HasShape, IsInfinite, EltypeUnknown, HasEltype, OneTo,
@propagate_inbounds, @isdefined, @boundscheck, @inbounds, Generator,
AbstractRange, AbstractUnitRange, UnitRange, LinearIndices, TupleOrBottom,
(:), |, +, -, *, !==, !, ==, !=, <=, <, >, >=, missing,
(:), |, +, -, *, !==, !, ==, !=, <=, <, >, >=, missing, something, copyto!,
any, _counttuple, eachindex, ntuple, zero, prod, reduce, in, firstindex, lastindex,
tail, fieldtypes, min, max, minimum, zero, oneunit, promote, promote_shape
using Core: @doc
Expand Down
11 changes: 11 additions & 0 deletions test/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1001,3 +1001,14 @@ end
end
@test v == ()
end

@testset "unzip" begin
for itrs in ((1:3,), (1:3, 4:6), (1:3,4:6,7:9),
((), ()), (Bool[], Int8[]),
(Iterators.filter(isodd,1:6), 4:6))
@test unzip(zip(itrs...)) == collect.(itrs)
end
@test unzip([(), (), ()]) == ()
@test unzip([(1,2), (4,5,6)]) == ([1, 4], [2, 5])
@test unzip([(4,5,6), (1,2)]) == ([4, 1], [5, 2])
end

0 comments on commit 3623b67

Please sign in to comment.