package main

import (
	"testing"
)

func TestDropAmbiguousPkgs(t *testing.T) {
	pkgs := []string{
		"bar",
		"bar",
		"baz",
		"baz:arm64",
		"foo",
		"foo",
		"foo:amd64",
		"foo:i386",
	}
	want := map[string]bool{
		"bar":       true,
		"baz:arm64": true,
		"foo:amd64": true,
		"foo:i386":  true,
	}
	got := uniqArchFreePkgs(pkgs)

	// TODO: use cmp.Diff instead.
	equal := len(got) == len(want)
	if equal {
		for k := range got {
			if got[k] != want[k] {
				equal = false
				break
			}
		}
	}

	if !equal {
		t.Errorf("dropAmbiguousPkgs(%#v) =\n     %#v\nwant %#v", pkgs, got, want)
	}
}
