Ejemplo n.º 1
0
func (s *MySuite) TestCartesianProductToVariable(c *C) {
	input := [][]string{
		{"host=a", "host=b"},
		{"job=a", "job=b"},
		{"other=x", "other=y"},
	}
	output := aggregations.CartesianProductToVariable(aggregations.CartesianProduct(input))
	c.Assert(len(output), Equals, 2*2*2)
	c.Check(output[0].String(), Equals, "{host=a,job=a,other=x}")
	c.Check(output[len(output)-1].String(), Equals, "{host=b,job=b,other=y}")
}
Ejemplo n.º 2
0
func (s *MySuite) TestCartesianProduct(c *C) {
	input := [][]string{
		{"host=a", "host=b"},
		{"job=a", "job=b"},
		{"other=x", "other=y"},
	}
	output := aggregations.CartesianProduct(input)
	c.Assert(len(output), Equals, 2*2*2)
	c.Check(output[0], DeepEquals, []string{"host=a", "job=a", "other=x"})
	c.Check(output[len(output)-1], DeepEquals, []string{"host=b", "job=b", "other=y"})
}