Make tests check return codes
Make tests not leak memory
Stub base64_encode for now