// SPDX-FileCopyrightText: 2026 Echolot contributors // SPDX-License-Identifier: GPL-3.0-or-later package control import "testing" func TestDscpArg(t *testing.T) { ptr := func(v int) *int { return &v } for _, tc := range []struct { in *int want int wantErr bool }{ {nil, -1, false}, // absent: leave the socket alone {ptr(0), 0, false}, // explicit best-effort is not the same as absent {ptr(46), 46, false}, // EF, the value people actually test with {ptr(63), 63, false}, {ptr(64), 0, true}, // one past the 6-bit field {ptr(-1), 0, true}, } { got, err := dscpArg(tc.in) if (err != nil) != tc.wantErr || got != tc.want { t.Errorf("dscpArg(%v) = %d, err=%v; want %d, wantErr=%v", tc.in, got, err, tc.want, tc.wantErr) } } }