MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / TestMemoryLimit_Basic

Function TestMemoryLimit_Basic

memory_limit_test.go:9–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func 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
32func TestMemoryLimit_Enforcement(t *testing.T) {
33 b := createNewBuffer()

Callers

nothing calls this directly

Calls 3

createNewBufferFunction · 0.85
setMemoryLimitMethod · 0.80
getMemoryLimitMethod · 0.80

Tested by

no test coverage detected