window: Extract logic such that results are yielded

Allows testing of the window function. Also adds such test cases.
transform: Extract logic from main() for testability

Switches the test cases to use the exposed transform() method rather
than calling the helpers directly.
combine: Extract logic from main() and add tests