Adding tests.

@pradeepto please review.