Update check of already existing key on add

- Update check of already existing key on add
- Update docs of methods
This commit is contained in:
2021-06-02 10:26:40 +02:00
parent 0b2c3b07ed
commit 467f063129
4 changed files with 38 additions and 18 deletions

View File

@@ -141,12 +141,11 @@ func TestAddRepeatedIndex(t *testing.T) {
bLen := tree.HashFunction().Len()
k := BigIntToBytes(bLen, big.NewInt(int64(3)))
v := BigIntToBytes(bLen, big.NewInt(int64(12)))
if err := tree.Add(k, v); err != nil {
t.Fatal(err)
}
err = tree.Add(k, v)
c.Assert(err, qt.Not(qt.IsNil))
c.Check(err, qt.Equals, ErrMaxVirtualLevel)
c.Assert(err, qt.IsNil)
err = tree.Add(k, v) // repeating same key-value
c.Check(err, qt.Equals, ErrKeyAlreadyExists)
}
func TestUpdate(t *testing.T) {