Something went wrong. Try again.
Maps Linux distribution source packages to their upstream repositories, and through them to each other
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031package distro
import ( "testing"
"tangled.org/odd.computer/isomorph/internal/model")
func TestCandidates(t *testing.T) { var c []Candidate c = AddCandidate(c, "https://github.com/curl/curl", model.Evidence{Source: "metadata:Repository", Value: "https://github.com/curl/curl", Weight: 0.9}) c = AddCandidate(c, "https://github.com/curl/curl/releases/download/curl-8_4_0/curl-8.4.0.tar.xz", model.Evidence{Source: "watch", Weight: 0.5}) c = AddCandidate(c, "https://salsa.debian.org/debian/curl", model.Evidence{Source: "control:Vcs-Git", Weight: 0.9}) c = AddCandidate(c, "https://curl.se/download/curl-8.4.0.tar.xz", model.Evidence{Source: "watch", Weight: 0.5}) c = AddCandidate(c, "not a url", model.Evidence{Source: "x", Weight: 0.5}) if len(c) != 2 { t.Fatalf("expected 2 candidates, got %+v", c) } c = RankCandidates(c) if c[0].Key != "github.com/curl/curl" { t.Fatalf("best = %+v", c[0]) } // Repository evidence plus the release-tarball hint plus the curl.se homepage hint. if len(c[0].Evidence) < 2 || c[0].Score <= 0.9 { t.Fatalf("evidence not merged: %+v", c[0]) } if c[1].Score >= 0.5 { t.Fatalf("salsa should be penalised: %+v", c[1]) }}