mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-07-06 01:50:42 +02:00
Simplified code. Add/substract min value when interleaving. BigMin still broken.
This commit is contained in:
@ -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))
|
||||
}
|
||||
|
Reference in New Issue
Block a user