mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-21 11:00:08 +08:00
update value
This commit is contained in:
@@ -242,4 +242,31 @@ func TestFindGreaterOrEqual(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestChangeValue(t *testing.T) {
|
||||
list := New()
|
||||
|
||||
for i := 0; i < maxN; i++ {
|
||||
list.Insert(Element(i), []byte("value"))
|
||||
}
|
||||
|
||||
for i := 0; i < maxN; i++ {
|
||||
// The key only looks at the int so the string doesn't matter here!
|
||||
f1, ok := list.Find(Element(i))
|
||||
if !ok {
|
||||
t.Fail()
|
||||
}
|
||||
ok = list.ChangeValue(f1, []byte("different value"))
|
||||
if !ok {
|
||||
t.Fail()
|
||||
}
|
||||
f2, ok := list.Find(Element(i))
|
||||
if !ok {
|
||||
t.Fail()
|
||||
}
|
||||
if bytes.Compare(f2.GetValue(), []byte("different value")) != 0 {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user