unit tests for saowrite.c