package lab.art; import static org.junit.Assert.*; import java.util.Random; import org.junit.Test; public class VariableXTester { @Test public void testConstructor() { new VariableX(); } @Test public void testToString() { VariableX expression = new VariableX(); assertEquals("toString method failed", "x", expression.toString()); } @Test public void testEvaluate() { Random random = new Random(System.currentTimeMillis()); VariableX expression = new VariableX(); int NUMBER = 1000; double DELTA = 0.0001; for (int n = 0; n < NUMBER; n++) { double x = random.nextDouble(); if (random.nextBoolean()) { x = -x; } double y = random.nextDouble(); if (random.nextBoolean()) { y = -y; } assertEquals("evaluate method failed", x, expression.evaluate(x, y), DELTA); } } }