package jrummikub.model;

import java.util.HashSet;
import java.util.Set;

import org.junit.*;
import static org.junit.Assert.*;

/**
 * test functions of Position-Class
 * 
 */
public class PositionTest {

	/**
	 * String for debugging and testing
	 */
	@Test
	public void testToString() {
		Position pos = new Position(6, 2);
		assertEquals("Position[x=6.0,y=2.0]", pos.toString());
	}

	/**
	 * tests hashing
	 */
	@Test
	public void testEqualsAndHashCode() {
		Position pos1 = new Position(0, 0);
		Position pos2 = new Position(0, 0);
		Position pos3 = new Position(0, 1);
		Set<Position> set = new HashSet<Position>();
		set.add(pos1);
		assertTrue(set.contains(pos1));
		assertTrue(set.contains(pos2));
		assertFalse(set.contains(pos3));
	}

}
