Add Makefile tests
Fix fwrite to use moves