Esempio n. 1
0
func (intSetSuite) TestUninitializedPanics(c *gc.C) {
	f := func() {
		var s set.Ints
		s.Add(1)
	}
	c.Assert(f, gc.PanicMatches, "uninitalised set")
}
Esempio n. 2
0
// Helper methods for the tests.
func AssertIntValues(c *gc.C, s set.Ints, expected ...int) {
	values := s.Values()
	// Expect an empty slice, not a nil slice for values.
	if expected == nil {
		expected = []int{}
	}
	sort.Ints(expected)
	sort.Ints(values)
	c.Assert(values, gc.DeepEquals, expected)
	c.Assert(s.Size(), gc.Equals, len(expected))
	// Check the sorted values too.
	sorted := s.SortedValues()
	c.Assert(sorted, gc.DeepEquals, expected)
}