コード例 #1
0
ファイル: registry_test.go プロジェクト: wwitzel3/utils
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},
		})
}
コード例 #2
0
ファイル: registry_test.go プロジェクト: wwitzel3/utils
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},
		})
}