示例#1
0
func TestBugSubGraphWorld(t *testing.T) {
	g := analtest(t, "world.gv.txt")
	st, err := parser.ParseString(g.String())
	check(t, err)
	s := &bugSubGraphWorldVisitor{
		t: t,
	}
	st.Walk(s)
	if !s.found {
		t.Fatalf("2 -> SubGraph not found")
	}
}
func anal(t *testing.T, input string) Interface {
	fmt.Printf("Input: %v\n", input)
	g, err := parser.ParseString(input)
	check(t, err)
	fmt.Printf("Parsed: %v\n", g)
	ag := NewGraph()
	Analyse(g, ag)
	fmt.Printf("Analysed: %v\n", ag)
	agstr := ag.String()
	fmt.Printf("Written: %v\n", agstr)
	g2, err := parser.ParseString(agstr)
	check(t, err)
	fmt.Printf("Parsed %v\n", g2)
	ag2 := NewEscape()
	Analyse(g2, ag2)
	fmt.Printf("Analysed %v\n", ag2)
	ag2str := ag2.String()
	fmt.Printf("Written: %v\n", ag2str)
	assert(t, "analysed", agstr, ag2str)
	return ag2
}