package com.gradescope.hw4; import static org.junit.Assert.*; import org.junit.Test; public class PointTest { double EPSILON = 0.0001; @Test public void test_Point2Args() { Point p = new Point(42.0, 60.0); assertEquals(42.0, p.getX(), EPSILON); assertEquals(60.0, p.getY(), EPSILON); } @Test public void test_Point0Args() { Point p = new Point(); assertEquals(0.0, p.getX(), EPSILON); assertEquals(0.0, p.getY(), EPSILON); } @Test public void test_equals() { Point c1 = new Point(2.0, 3.0); Point c2 = new Point(2, 3); assertEquals(c1, c2); } @Test public void test_add_1() { Point c1 = new Point(2.0, 3.0); Point c2 = new Point(1.0, 1.0); Point c = c1.add(c2); assertEquals(3.0, c.getX(), EPSILON); assertEquals(4.0, c.getY(), EPSILON); } @Test public void test_scale_1() { Point c1 = new Point(2.0, 3.0); double d = 10.0; Point c2 = c1.scale(d); Point c3 = new Point(20.0, 30.0); assertEquals(c3, c2); // uses c3.equals(...) } @Test public void test_isSmaller_1() { Point c1 = new Point(2.0, 3.0); Point c2 = new Point(20.0, 30.0); assertTrue(c1.isSmaller(c2)); assertFalse(c2.isSmaller(c1)); } }