Example #1
0
func (st *SurveyLogStore) loadLine(line []byte, answers *[]*models.SurveyAnswer, answered *set.SortedSet) error {
	var a models.SurveyAnswer
	err := json.Unmarshal(line, &a)
	if err != nil {
		return err
	}
	answered.Add(types.Int(a.CloneID))
	*answers = append(*answers, &a)
	return nil
}
Example #2
0
func visit(t testing.TB, x *assert.Assertions, visited *set.SortedSet, node Node) {
	errors.Logf("DEBUG", "visiting %v", node)
	if visited.Has(node.Pattern()) {
		return
	}
	visited.Add(node.Pattern())
	checkNode(t, x, node)
	kids, err := node.Children()
	if err != nil {
		t.Fatal(err)
	}
	for _, kid := range kids {
		if !visited.Has(kid.Pattern()) {
			visit(t, x, visited, kid.(Node))
		}
	}
}