Switch to ArgumentParse in testprogram

- fixes cases where there are extra arguments that should be ignored