File: splay_test.go

package info (click to toggle)
golang-github-badgerodon-collections 0.0~git20130729.604e922-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 164 kB
  • sloc: makefile: 5
file content (29 lines) | stat: -rw-r--r-- 425 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//+build skip_this_test

package splay

import (
	//"fmt"
	"testing"
)

func Test(t *testing.T) {
	tree := New(func(a, b interface{}) bool {
		return a.(string) < b.(string)
	})

	tree.Insert("d", 4)
	tree.Insert("b", 2)
	tree.Insert("a", 1)
	tree.Insert("c", 3)

	if tree.Len() != 4 {
		t.Errorf("expecting len 4")
	}

	tree.Remove("b")

	if tree.Len() != 3 {
		t.Errorf("expecting len 3")
	}
}