Add documentation and some tests.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>