import static org.junit.Assert.*;

import org.junit.Test;

public class GreatestCommonDivisorTest {

	@Test
	public void reflexive() throws Exception {
		assertEquals(1, gcd(1, 1));
		assertEquals(2, gcd(2, 2));
		assertEquals(-1, gcd(-1, -1));
	}

	@Test
	public void relativelyPrimes() throws Exception {
		assertEquals(1, gcd(2,3));
		assertEquals(1, gcd(4,7));
		assertEquals(-1, gcd(-2,-3));
	}
	
	@Test
	public void oneIsMultpleOfTheOther() throws Exception {
		assertEquals(3, gcd(3,9));
		assertEquals(5, gcd(5,30));
	}
	
	private int gcd(int a, int b) {
		while(b!=0){
			int t = b;
			b = a % t;
			a = t;
		}
		return a;
	}

}

@@ -212,33 +212,32 @@
 %0A%09%09assertEquals(
--
 1, gcd(-1, -1));
@@ -237,16 +237,16 @@
 , -1));%0A
+
 %09%7D%0A%0A%09@Te
@@ -372,17 +372,16 @@
 tEquals(
--
 1, gcd(-
@@ -521,16 +521,256 @@
 );%0A%09%7D%0A%09%0A
+%09@Test%0A%09public void commonFactor() throws Exception %7B%0A%09%09assertEquals(2, gcd(6,8));%0A%09%09assertEquals(7, gcd(49,315));%0A%09%7D%0A%09%0A%09@Test%0A%09public void negatives() throws Exception %7B%0A%09%09assertEquals(4, gcd(-24,28));%0A%09%09assertEquals(4, gcd(24,-28));%0A%09%7D%0A%09%0A
 %09private
@@ -860,17 +860,27 @@
 %09return 
-a
+Math.abs(a)
 ;%0A%09%7D%0A%0A%7D%0A

make gcd algorithm return always positive number