Add some testing code to MCsim.R