Change output to little-endian
Add more tests - compare against reference data for read & write

Move duplicated test utils to a common file
Add some function docs