Further refinement on gcd definition in tests.th4.