[WIP/RFC] Add unit tests for buffer.c and fileio.c

I switched these away from `#define` so they can be referenced in tests. Is that kosher?