add test infra. Fixes #22. Ref #6.
reorganize sample/tests