renamed read test file to test_r

now symmetric with test_w
added preparation for rw mode tests
added tests for rw mode and fixed related bugs

There are some peculiarities with how to set the file format when the
file is in rw mode. Now, file format is optional for rw mode.