Some code cleanup in unit test for bit version of BigMin. Test is still failing.

This commit is contained in:
Sascha L. Teichmann
2014-09-06 20:38:49 +02:00
parent 234b487077
commit f75e1015af
2 changed files with 21 additions and 22 deletions

View File

@ -5,7 +5,6 @@
package common
import (
"fmt"
"math/rand"
"testing"
)
@ -161,9 +160,9 @@ func TestBigMin(t *testing.T) {
x1 := rand.Intn(4000) - 2000
y1 := rand.Intn(4000) - 2000
z1 := rand.Intn(4000) - 2000
w := rand.Intn(20) + 1
h := rand.Intn(20) + 1
d := rand.Intn(20) + 1
w := rand.Intn(18) + 1
h := rand.Intn(18) + 1
d := rand.Intn(18) + 1
x2 := x1 + w
y2 := y1 + h
z2 := z1 + d
@ -171,20 +170,19 @@ func TestBigMin(t *testing.T) {
c1 := Coord{X: int16(x1), Y: int16(y1), Z: int16(z1)}
c2 := Coord{X: int16(x2), Y: int16(y2), Z: int16(z2)}
cub := Cuboid{P1: c1, P2: c2}
fmt.Printf("Cuboid: %s\n", cub)
//fmt.Printf("Cuboid: %s\n", cub)
zmin := CoordToInterleaved(c1)
zmax := CoordToInterleaved(c2)
for zcode := zmin + 1; zcode < zmax; zcode++ {
c3 := InterleavedToCoord(zcode)
if cub.Contains(c3) {
if cub.Contains(InterleavedToCoord(zcode)) {
continue
}
nbm := NaiveBigMin(zmin, zmax, zcode)
cbm := BigMin(zmin, zmax, zcode)
//fmt.Printf("cbm: %d\n", cbm)
//fmt.Printf("nbm: %d\n", nbm)
//fmt.Printf("nbm: %b\n", nbm)
//fmt.Printf("cbm: %b\n", cbm)
if nbm != cbm {
errors++
} else {