Example #1
0
func (s *registrySuite) TestDescriptionFromVersions(c *gc.C) {
	versions := registry.Versions{0: nilFactory}
	c.Check(registry.DescriptionFromVersions("name", versions),
		gc.DeepEquals,
		registry.Description{
			Name:     "name",
			Versions: []int{0},
		})
	versions[2] = nilFactory
	c.Check(registry.DescriptionFromVersions("name", versions),
		gc.DeepEquals,
		registry.Description{
			Name:     "name",
			Versions: []int{0, 2},
		})
}
Example #2
0
func (s *registrySuite) TestDescriptionFromVersionsAreSorted(c *gc.C) {
	versions := registry.Versions{
		10: nilFactory,
		5:  nilFactory,
		0:  nilFactory,
		18: nilFactory,
		6:  nilFactory,
		4:  nilFactory,
	}
	c.Check(registry.DescriptionFromVersions("name", versions),
		gc.DeepEquals,
		registry.Description{
			Name:     "name",
			Versions: []int{0, 4, 5, 6, 10, 18},
		})
}