package system

import "testing"

// The classification table (RCA fix 2): network fs magics and the healthy idle autofs trigger are
// OK; anything local is a STUB.
func TestClassifyFSMagic_Table(t *testing.T) {
	cifsU32 := uint32(0xFF534D42) // runtime value: the sign-extended form must classify identically
	cases := []struct {
		name  string
		ftype int64
		want  string
	}{
		{"autofs trigger (idle — healthy)", 0x0187, FSClassAutofs},
		{"nfs (all versions)", 0x6969, FSClassNetwork},
		{"cifs", 0xFF534D42, FSClassNetwork},
		{"cifs as sign-extended negative", int64(int32(cifsU32)), FSClassNetwork},
		{"smb2", 0xFE534D42, FSClassNetwork},
		{"ext4 (the RCA stub)", 0xEF53, FSClassStub},
		{"tmpfs", 0x01021994, FSClassStub},
		{"overlayfs", 0x794C7630, FSClassStub},
	}
	for _, c := range cases {
		if got := classifyFSMagic(c.ftype); got != c.want {
			t.Errorf("%s: classifyFSMagic(%#x) = %q, want %q", c.name, c.ftype, got, c.want)
		}
	}
}
