(t *testing.T)
| 284 | } |
| 285 | |
| 286 | func TestFormatVolumeChange(t *testing.T) { |
| 287 | tests := []struct { |
| 288 | name string |
| 289 | total1 int |
| 290 | total2 int |
| 291 | expected string |
| 292 | }{ |
| 293 | {name: "increase 287%", total1: 23, total2: 89, expected: "+287%"}, |
| 294 | {name: "decrease 50%", total1: 100, total2: 50, expected: "-50%"}, |
| 295 | {name: "double", total1: 10, total2: 20, expected: "+100%"}, |
| 296 | {name: "from zero", total1: 0, total2: 10, expected: "+∞"}, |
| 297 | {name: "no change", total1: 10, total2: 10, expected: "+0%"}, |
| 298 | } |
| 299 | |
| 300 | for _, tt := range tests { |
| 301 | t.Run(tt.name, func(t *testing.T) { |
| 302 | result := formatVolumeChange(tt.total1, tt.total2) |
| 303 | assert.Equal(t, tt.expected, result, "Volume change format should match") |
| 304 | }) |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | func TestFirewallDiffJSONSerialization(t *testing.T) { |
| 309 | diff := computeFirewallDiff(100, 200, &FirewallAnalysis{ |
nothing calls this directly
no test coverage detected