Add gcd function with tests.