Add tests for the degenerate cases

Signed-off-by: Igor Popov <igor.popov89@gmail.com>
Extract assert method

Signed-off-by: Igor Popov <igor.popov89@gmail.com>