// vfs/gc/gc_test.go package gc import ( "testing" ) func TestGetGCAlgorithm(t *testing.T) { tests := []struct { name string algorithm GCAlgorithm expected bool // true if we expect a non-nil function }{ {"LRU", LRU, true}, {"LFU", LFU, true}, {"FIFO", FIFO, true}, {"Largest", Largest, true}, {"Smallest", Smallest, true}, {"Hybrid", Hybrid, true}, {"Unknown", "unknown", true}, // should fall back to LRU {"Empty", "", true}, // should fall back to LRU } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { fn := GetGCAlgorithm(tt.algorithm) if fn == nil { t.Errorf("GetGCAlgorithm(%s) returned nil, expected non-nil function", tt.algorithm) } }) } } func TestGCAlgorithmConstants(t *testing.T) { expectedAlgorithms := []GCAlgorithm{LRU, LFU, FIFO, Largest, Smallest, Hybrid} for _, algo := range expectedAlgorithms { if algo == "" { t.Errorf("GC algorithm constant is empty") } } }