add hand-made test framework
refactor to separate tests and algorithm logic
pass all tests, implement loop
update readme