tests: Fix all tests for compact mode

Memory allocation behavior is different in compact mode so tests that rely
on current behavior have to be adjusted.