mirror of
https://github.com/emirpasic/gods
synced 2024-11-06 15:20:25 +00:00
855ba6d469
- test failing (fixing it up)
34 lines
589 B
Go
34 lines
589 B
Go
package redblacktree
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestPutGet(t *testing.T) {
|
|
|
|
tree := NewWithIntComparator()
|
|
|
|
tree.Put(5, "e")
|
|
tree.Put(3, "c")
|
|
tree.Put(4, "d")
|
|
tree.Put(1, "x")
|
|
tree.Put(2, "b")
|
|
tree.Put(1, "a") //overwrite
|
|
|
|
// key,expectedValue,expectedFound
|
|
tests := [][]interface{}{
|
|
{1, "a", true},
|
|
{2, "b", true},
|
|
{3, "c", true},
|
|
{4, "d", true},
|
|
{5, nil, false},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
actualValue, actualFound := tree.Get(test[0])
|
|
if actualValue != test[1] || actualFound != test[2] {
|
|
t.Errorf("Got %v expected %v", actualValue, test[1])
|
|
}
|
|
}
|
|
}
|