Added unit test write().

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>