Add unit tests for SA1021 and SA1022 (fixes #207, #208, #271, #272)