package ninja.willman.calculator;

import static org.junit.Assert.*;

import org.junit.Test;

public class OperatorTest {
	@Test
	public void testParseOperator() {
		assertEquals(Operator.parseOperator('+'), Operator.PLUS);
		assertEquals(Operator.parseOperator('-'), Operator.MINUS);
		assertEquals(Operator.parseOperator('/'), Operator.DIVIDE);
		assertEquals(Operator.parseOperator('*'), Operator.MULTIPLY);
	}
	
	@Test
	public void testIsOperator() {
		assertTrue(Operator.isOperator('+'));
		assertTrue(Operator.isOperator('-'));
		assertTrue(Operator.isOperator('/'));
		assertTrue(Operator.isOperator('*'));
		assertFalse(Operator.isOperator('z'));
	}
	
	@Test(expected = IllegalArgumentException.class)
	public void testParseInvalidOperator() {
		Operator.parseOperator('z');
	}
}