refactor tests into the same files as implementation
add test script