Пример #1
0
func TestResolverVersion(t *testing.T) {
	arch, err := dependency.ParseArch("amd64")
	isok(t, err)

	candidates, err := resolver.ReadFromBinaryIndex(
		strings.NewReader(testBinaryIndex),
	)
	isok(t, err)
	assert(t, len(*candidates) == 3)

	dep, err := dependency.Parse("android-tools-fsutils (>= 1.0)")
	isok(t, err)
	possi := dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == true)

	dep, err = dependency.Parse("android-tools-fsutils (>= 1:1.0)")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == false)

	dep, err = dependency.Parse("android-tools-fsutils (<= 1:1.0)")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == true)

	dep, err = dependency.Parse("android-tools-fsutils (<= 0:0)")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == false)

	dep, err = dependency.Parse("android-tools-fsutils (= 4.2.2+git20130529-5.1)")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == true)

	dep, err = dependency.Parse("android-tools-fsutils (= 2.2.2+git20130529-5.1)")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == false)

	dep, err = dependency.Parse("android-tools-fsutils (<< 4.2.2+git20130529-5.1)")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == false)

	dep, err = dependency.Parse("android-tools-fsutils (<< 4.2.2+git20130529-6.1)")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == true)

	dep, err = dependency.Parse("android-tools-fsutils (>> 4.2.2+git20130529-5.1)")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == false)

	dep, err = dependency.Parse("android-tools-fsutils (>> 4.2.2+git20130529-4.1)")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == true)
}
Пример #2
0
func TestResolverDependsVersion(t *testing.T) {
	candidates, err := resolver.ReadFromBinaryIndex(
		strings.NewReader(testBinaryIndex),
	)
	isok(t, err)
	assert(t, len(*candidates) == 3)

	arch, err := dependency.ParseArch("amd64")
	isok(t, err)

	dep, err := dependency.Parse("android-tools-fsutils (>= 1.0)")
	isok(t, err)
	assert(t, candidates.SatisfiesBuildDepends(*arch, *dep) == true)

	dep, err = dependency.Parse("android-tools-fsutils (>= 1.0), quix")
	isok(t, err)
	assert(t, candidates.SatisfiesBuildDepends(*arch, *dep) == false)
}
Пример #3
0
func TestResolverBasics(t *testing.T) {
	arch, err := dependency.ParseArch("amd64")
	isok(t, err)

	candidates, err := resolver.ReadFromBinaryIndex(
		strings.NewReader(testBinaryIndex),
	)
	isok(t, err)
	assert(t, len(*candidates) == 3)

	dep, err := dependency.Parse("baz")
	isok(t, err)
	possi := dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == false)

	dep, err = dependency.Parse("android-tools-fsutils")
	isok(t, err)
	possi = dep.GetAllPossibilities()[0]
	assert(t, candidates.Satisfies(*arch, possi) == true)
}