-
Notifications
You must be signed in to change notification settings - Fork 0
/
assert.go
61 lines (56 loc) · 1.33 KB
/
assert.go
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"image"
"log"
"github.com/as/ui/tag"
)
const debug = 1 ^ 1
func assert(where string, g *Grid) {
if debug == 0 {
return
}
log.Printf("%s: grid %s\n", where, g.Loc())
for i, c := range g.List {
for j, c2 := range g.List {
if c == c2 {
continue
}
if c.Loc().Intersect(c2.Loc()) != image.ZR {
log.Printf("%s: col %v %s intersects col %v %s\n", where, i, c.Loc(), j, c2.Loc())
panic("suicide")
}
}
}
if g.Tag.Vis != tag.VisTag {
log.Printf("%v\n", g.Tag.Vis)
// panic("grid tag not vistag") // Put
}
for i, c := range g.List {
if c.(*Col).Tag.Vis != tag.VisTag {
log.Printf("number %d = %v\n", i, g.Tag.Vis)
//panic("col tag not vistag")
}
if !c.Loc().In(g.Loc()) {
log.Printf("%s: col %v %s not in grid %s\n", where, i, c.Loc(), g.Loc())
// panic("suicide")
}
log.Printf("%s: col %v %s is good\n", where, i, c.Loc())
{
c, _ := c.(*Col)
if c == nil {
continue
}
for j, t := range c.List {
if !t.Loc().In(c.Loc()) {
log.Printf("%s: tag %v %s not in col %v %s\n", where, j, t.Loc(), i, c.Loc())
//panic("suicide")
}
if !t.Loc().In(g.Loc()) {
log.Printf("%s: tag %v %s not in grid %v %s\n", where, j, t.Loc(), i, g.Loc())
//panic("suicide")
}
log.Printf("%s: tag %v %s is good\n", where, j, t.Loc())
}
}
}
}