(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestMemoryLimit_Basic(t *testing.T) { |
| 10 | b := createNewBuffer() |
| 11 | |
| 12 | // Check default limit (unlimited = 0) |
| 13 | if b.maxMemory != 0 { |
| 14 | t.Errorf("Default memory limit should be 0 (unlimited), got %d", b.maxMemory) |
| 15 | } |
| 16 | |
| 17 | // Test setting custom limit |
| 18 | customLimit := int64(100 * 1024 * 1024) // 100 MB |
| 19 | b.setMemoryLimit(customLimit) |
| 20 | |
| 21 | if b.getMemoryLimit() != customLimit { |
| 22 | t.Errorf("Memory limit should be %d, got %d", customLimit, b.getMemoryLimit()) |
| 23 | } |
| 24 | |
| 25 | // Test back to unlimited (0) |
| 26 | b.setMemoryLimit(0) |
| 27 | if b.getMemoryLimit() != 0 { |
| 28 | t.Error("Memory limit should be 0 (unlimited)") |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | func TestMemoryLimit_Enforcement(t *testing.T) { |
| 33 | b := createNewBuffer() |
nothing calls this directly
no test coverage detected