MCPcopy Create free account
hub / github.com/ZeroIntensity/pointers.py / _

Function _

tests/test_allocation.py:11–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9
10@test("malloc and free")
11def _():
12 ptr = malloc(28)
13 assert ptr.freed is False
14 assert ptr.assigned is False
15 ptr <<= 1
16 assert ptr.assigned is True
17
18 with raises(InvalidSizeError):
19 ptr <<= "hello"
20
21 free(ptr)
22
23 with raises(FreedMemoryError):
24 print(~ptr)
25
26 with raises(FreedMemoryError):
27 free(ptr)
28
29 with raises(FreedMemoryError):
30 ptr.ensure_valid()
31
32 assert ptr.freed is True
33
34
35@test("calloc with enumerations")

Callers

nothing calls this directly

Calls 6

mallocFunction · 0.90
freeFunction · 0.90
callocFunction · 0.90
reallocFunction · 0.90
ensure_validMethod · 0.80
AClass · 0.70

Tested by

no test coverage detected