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

I'm guessing `NameBuff` was not converted along with the others because it caused tests to fail. 
I have updated the code so that it passes the tests. If there is a better way to fix things please let me know.