Add test_scan.py.
Refactoring.
Bug fixed.
Enable to construct test-reference.
Merge branch 'add-test' into v2.1