package main import ( "reflect" "strconv" "testing" ) func TestPortsSetup(t *testing.T) { t.Run("Single Port", func(t *testing.T) { want := []string{"1"} got := portsSetup(want) assertEqual(t, got, want) }) t.Run("Multi Port", func(t *testing.T) { want := []string{"1", "2"} got := portsSetup(want) assertEqual(t, got, want) }) t.Run("Empty Port", func(t *testing.T) { var ports, want []string got := portsSetup(ports) for i := 1; i < 65535; i++ { want = append(want, strconv.FormatInt(int64(i), 10)) } assertEqual(t, got, want) }) } func assertEqual(t testing.TB, got, want []string) { t.Helper() if !reflect.DeepEqual(got, want) { t.Errorf("got %v, want %v", got, want) } }