Simplified code. Add/substract min value when interleaving. BigMin still broken.

This commit is contained in:
Sascha L. Teichmann
2014-09-07 09:58:09 +02:00
parent 6e958e4ff6
commit a8c2a4c55d
2 changed files with 29 additions and 21 deletions

View File

@ -87,7 +87,7 @@ func checkJoinSplit(
k := join(c)
s := split(k)
if !s.Equals(c) {
if s != c {
t.Errorf("%s: Expected %s got %s %b\n", desc, c, s, k)
}
}
@ -153,6 +153,15 @@ func TestTransforms(t *testing.T) {
})
}
func TestCoordInterleaving(t *testing.T) {
allData(func(c Coord) {
d := InterleavedToCoord(CoordToInterleaved(c))
if c != d {
t.Errorf("Expected %v got %v\n", c, d)
}
})
}
func outsiders(zmin, zmax int64) chan int64 {
outs := make(chan int64)
@ -200,6 +209,10 @@ func TestBigMin(t *testing.T) {
zmin := CoordToInterleaved(c1)
zmax := CoordToInterleaved(c2)
if zmin > zmax {
t.Errorf("zmin > zmax: %d > %d\n", zmin, zmax)
}
errors, success := 0, 0
for zcode := range outsiders(zmin, zmax) {
nbm := NaiveBigMin(zmin, zmax, zcode)
@ -214,8 +227,9 @@ func TestBigMin(t *testing.T) {
}
if errors > 0 {
cub := Cuboid{P1: c1, P2: c2}
t.Errorf("BigMin: %s %d errors out of %d (%f)\n",
t.Errorf("BigMin: %s (%d %d) %d errors out of %d (%f)\n",
cub,
zmin, zmax,
errors, errors+success,
float64(errors)/float64(errors+success))
}