-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from andyferris/ajf/splitapplycombine
Reverse dependency with SplitApplyCombine.jl
- Loading branch information
Showing
9 changed files
with
44 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
authors = ["Andy Ferris <[email protected]>"] | ||
name = "Dictionaries" | ||
uuid = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
|
||
[deps] | ||
Indexing = "313cdc1a-70c2-5d6a-ae34-0150d3930a38" | ||
SplitApplyCombine = "03a91e81-4c3e-53e1-a0a4-9c0c8f19dd66" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
|
||
[extras] | ||
|
@@ -16,5 +15,4 @@ test = ["Test"] | |
|
||
[compat] | ||
julia = "1" | ||
SplitApplyCombine = "0.4.1" | ||
Indexing = "1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
@testset "map" begin | ||
function _mapview(f, d::AbstractDictionary) | ||
I = keytype(d) | ||
T = Core.Compiler.return_type(f, Tuple{eltype(d)}) | ||
|
||
return MappedDictionary{I, T, typeof(f), Tuple{typeof(d)}}(f, (d,)) | ||
end | ||
|
||
i = HashIndices([1,2,3,4,5]) | ||
|
||
@test issetequal(pairs(map(iseven, i)::HashDictionary), [1=>false, 2=>true, 3=>false, 4=>true, 5=>false]) | ||
@test issetequal(pairs(map(isodd, i)::HashDictionary), [1=>true, 2=>false, 3=>true, 4=>false, 5=>true]) | ||
|
||
@test issetequal(pairs(mapview(iseven, i)::Dictionaries.MappedDictionary), [1=>false, 2=>true, 3=>false, 4=>true, 5=>false]) | ||
@test issetequal(pairs(mapview(isodd, i)::Dictionaries.MappedDictionary), [1=>true, 2=>false, 3=>true, 4=>false, 5=>true]) | ||
@test issetequal(pairs(_mapview(iseven, i)::Dictionaries.MappedDictionary), [1=>false, 2=>true, 3=>false, 4=>true, 5=>false]) | ||
@test issetequal(pairs(_mapview(isodd, i)::Dictionaries.MappedDictionary), [1=>true, 2=>false, 3=>true, 4=>false, 5=>true]) | ||
|
||
d = HashDictionary([1,2,3,4,5], [1,3,2,4,5]) | ||
|
||
@test issetequal(pairs(map(iseven, d)::HashDictionary), [1=>false, 2=>false, 3=>true, 4=>true, 5=>false]) | ||
@test issetequal(pairs(map(isodd, d)::HashDictionary), [1=>true, 2=>true, 3=>false, 4=>false, 5=>true]) | ||
|
||
@test issetequal(pairs(mapview(iseven, d)::Dictionaries.MappedDictionary), [1=>false, 2=>false, 3=>true, 4=>true, 5=>false]) | ||
@test issetequal(pairs(mapview(isodd, d)::Dictionaries.MappedDictionary), [1=>true, 2=>true, 3=>false, 4=>false, 5=>true]) | ||
@test issetequal(pairs(_mapview(iseven, d)::Dictionaries.MappedDictionary), [1=>false, 2=>false, 3=>true, 4=>true, 5=>false]) | ||
@test issetequal(pairs(_mapview(isodd, d)::Dictionaries.MappedDictionary), [1=>true, 2=>true, 3=>false, 4=>false, 5=>true]) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters