diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..43937e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.html +*.out \ No newline at end of file diff --git a/README.md b/README.md index 167dc81..c988253 100644 --- a/README.md +++ b/README.md @@ -438,6 +438,12 @@ func main() { } ``` +## Testing + +```sh +go test -v -coverprofile coverage.out && go tool cover -html coverage.out -o coverage.html +``` + ## Performance See [tidwall/btree-benchmark](https://github.com/tidwall/btree-benchmark) for benchmark numbers. diff --git a/btreeg_test.go b/btreeg_test.go index cf61aa9..b11dc69 100644 --- a/btreeg_test.go +++ b/btreeg_test.go @@ -75,6 +75,12 @@ func kindsAreEqual(a, b []testKind) bool { return true } +func TestDegreeToMinMax(t *testing.T) { + if min, max := degreeToMinMax(1); min != 1 || max != 3 { + panic("mismatch") + } +} + func TestGenericMakeItemOrder(t *testing.T) { tr := testNewBTree() ints := []int{0, 1, 2, 3, 4, 10, 20, 30, 40, 100, 200, 300, 400}