package host import "testing" func TestRecommendedMemoryFollowsCommitMemory(t *testing.T) { // The measured case: 32 GB host, 14.7 GiB commit free -> 16G fails, 8G fits. if got := RecommendedMemoryGB(Report{TotalRAMGB: 31.8, CommitAvailGB: 14.7}); got != 8 { t.Fatalf("got %v, want 8", got) } if got := RecommendedMemoryGB(Report{TotalRAMGB: 64, CommitAvailGB: 60}); got != 32 { t.Fatalf("got %v, want 32", got) } if got := RecommendedMemoryGB(Report{TotalRAMGB: 8, CommitAvailGB: 3}); got != 4 { t.Fatalf("got %v, want the 4 GB floor", got) } if got := RecommendedMemoryGB(Report{TotalRAMGB: 32}); got != 16 { t.Fatalf("unknown commit: got %v, want 16", got) } }