示例#1
0
文件: ints_test.go 项目: kat-co/utils
func (intSetSuite) TestUninitializedPanics(c *gc.C) {
	f := func() {
		var s set.Ints
		s.Add(1)
	}
	c.Assert(f, gc.PanicMatches, "uninitalised set")
}
示例#2
0
文件: ints_test.go 项目: kat-co/utils
// 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)
}