func (s *BernoulliTest) TestEdgesTermination(c *C) { var hit int s.graphs["dir_unstable"].Edges(func(e gogl.Edge) bool { hit++ return true }) c.Assert(hit, Equals, 1) s.graphs["und_unstable"].Edges(func(e gogl.Edge) bool { hit++ return true }) c.Assert(hit, Equals, 2) gogl.CollectEdges(s.graphs["und_stable"]) // To populate the cache s.graphs["und_stable"].Edges(func(e gogl.Edge) bool { hit++ return true }) c.Assert(hit, Equals, 3) gogl.CollectEdges(s.graphs["dir_stable"]) s.graphs["dir_stable"].Edges(func(e gogl.Edge) bool { hit++ return true }) c.Assert(hit, Equals, 4) }
func (s *BernoulliTest) TestArcsTermination(c *C) { var hit int s.graphs["dir_unstable"].(gogl.DigraphSource).Arcs(func(e gogl.Arc) bool { hit++ return true }) c.Assert(hit, Equals, 1) gogl.CollectEdges(s.graphs["dir_stable"]) s.graphs["dir_stable"].(gogl.DigraphSource).Arcs(func(e gogl.Arc) bool { hit++ return true }) c.Assert(hit, Equals, 2) s.graphs["dir_stable"].Edges(func(e gogl.Edge) bool { hit++ return true }) c.Assert(hit, Equals, 3) }