Skip to content

Commit

Permalink
Merge pull request #621 from iamim/master
Browse files Browse the repository at this point in the history
HashMap implementation is broken after RemoveRange()
  • Loading branch information
louthy authored Aug 15, 2019
2 parents 5b6eb28 + 1c168a6 commit c4a4709
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions LanguageExt.Tests/HashMapTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,22 @@ public void EqualsTest()
Assert.True(HashMap<int, int>((3, 4), (1, 2)).Equals(HashMap<int, int>((1, 2), (3, 4))));
Assert.True(HashMap<int, int>((3, 4), (1, 2)).Equals(HashMap<int, int>((3, 4), (1, 2))));
}

[Fact]
public void FetchBack()
{
var init = Seq(69, 1477);
var rmv = Seq1(69);

var map = toHashMap(init.Zip(Enumerable.Repeat(1, int.MaxValue)));
var minus = map.RemoveRange(rmv);

Assert.True(minus.Keys.Find(i => i == 1477).IsSome); // true

Assert.True(minus.ContainsKey(1477)); // false
Assert.True(minus.Find(1477).IsSome); // false

var boom = minus[1477]; // throws
}
}
}

0 comments on commit c4a4709

Please sign in to comment.