Program: 86580
Project: 86580
Buggy source:
/** 
 * This test checks the results returned by the method intersects of the class MyEdge. The method also checks that the intersection points are well computed.
 */
public void testEdgesIntersection() throws DelaunayError {
  MyEdge e1=new MyEdge(4,4,0,8,8,0);
  MyEdge e2=new MyEdge(8,4,0,4,8,0);
  MyElement intersection;
  int c=e1.intersects(e2);
  assertTrue(e1.intersects(e2) == 1);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyPoint(6,6,0)));
  e2=new MyEdge(4,4,0,2,2,0);
  assertTrue(e1.intersects(e2) == 3);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyPoint(4,4,0)));
  e2=new MyEdge(4,4,0,20,20,0);
  assertTrue(e1.intersects(e2) == 4);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyEdge(4,4,0,8,8,0)));
  e2=new MyEdge(10,10,0,6,6,0);
  assertTrue(e1.intersects(e2) == 4);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyEdge(6,6,0,8,8,0)));
  e2=new MyEdge(6,4,0,10,8,0);
  assertTrue(e1.intersects(e2) == 2);
  e2=new MyEdge(0,0,0,1,-4,0);
  assertTrue(e1.intersects(e2) == 0);
  assertNull(e1.getIntersection(e2));
  e2=new MyEdge(8,8,0,1,-4,0);
  assertTrue(e1.intersects(e2) == 3);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyPoint(8,8,0)));
  e2=new MyEdge(6,6,0,1,-4,0);
  assertTrue(e1.intersects(e2) == 1);
  e1=new MyEdge(4,4,0,4,8,0);
  e2=new MyEdge(4,4,0,4,2,0);
  assertTrue(e1.intersects(e2) == 3);
  assertTrue(e1.getIntersection(e2).equals(new MyPoint(4,4,0)));
  e2=new MyEdge(4,8,0,4,10,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(4,6,0,4,10,0);
  assertTrue(e1.intersects(e2) == 4);
  assertTrue(e1.getIntersection(e2).equals(new MyEdge(4,6,0,4,8,0)));
  e2=new MyEdge(2,4,0,2,10,0);
  assertTrue(e1.intersects(e2) == 2);
  assertNull(e1.getIntersection(e2));
  e2=new MyEdge(4,9,0,4,10,0);
  assertTrue(e1.intersects(e2) == 2);
  e2=new MyEdge(9,9,0,10,10,0);
  assertTrue(e1.intersects(e2) == 0);
  assertNull(e1.getIntersection(e2));
  e2=new MyEdge(4,0,0,4,10,0);
  assertTrue(e1.intersects(e2) == 4);
  assertTrue(e1.getIntersection(e2).equals(new MyEdge(4,4,0,4,8,0)));
  e2=new MyEdge(4,8,0,10,12,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(9,9,0,10,10,0);
  assertTrue(e1.intersects(e2) == 0);
  e1=new MyEdge(4,4,0,8,4,0);
  e2=new MyEdge(4,4,0,4,2,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(5,3,0,5,8,0);
  assertTrue(e1.intersects(e2) == 1);
  e2=new MyEdge(9,4,0,0,4,0);
  assertTrue(e1.intersects(e2) == 4);
  assertTrue(e1.getIntersection(e2).equals(new MyEdge(4,4,0,8,4,0)));
  e2=new MyEdge(8,4,0,10,4,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(9,4,0,10,4,0);
  assertTrue(e1.intersects(e2) == 2);
  e2=new MyEdge(4,4,0,8,7,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(4,3,0,8,5,0);
  assertTrue(e1.intersects(e2) == 1);
  e2=new MyEdge(4,3,0,8,3,0);
  assertTrue(e1.intersects(e2) == 2);
  e1=new MyEdge(1.8074157402864,98.70155495362685,17.33208384927718,15.677161919360142,88.91946702159545,72.62346056964518);
  e2=new MyEdge(15.893774288391056,88.76669412916696,73.48698005614088,16.7142085041698,88.18805631290299,76.75761938242825);
  double d1=(88.91946702159545 - 98.70155495362685) / (15.677161919360142 - 1.8074157402864);
  double d2=(88.18805631290299 - 88.76669412916696) / (16.7142085041698 - 15.893774288391056);
  System.out.println("String_Node_Str" + d1);
  System.out.println("String_Node_Str" + d2);
  MyElement haha=e1.getIntersection(e2);
  System.out.println(haha);
  System.out.println("String_Node_Str" + e1.intersects(e2));
  System.out.println("String_Node_Str" + e2.intersects(e1));
  assertTrue(e1.intersects(e2) == 2);
  assertTrue(e2.intersects(e1) == 2);
}

Fixed version (ground truth):
/** 
 * This test checks the results returned by the method intersects of the class MyEdge. The method also checks that the intersection points are well computed.
 */
public void testEdgesIntersection() throws DelaunayError {
  MyEdge e1=new MyEdge(4,4,0,8,8,0);
  MyEdge e2=new MyEdge(8,4,0,4,8,0);
  MyElement intersection;
  int c=e1.intersects(e2);
  assertTrue(e1.intersects(e2) == 1);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyPoint(6,6,0)));
  e2=new MyEdge(4,4,0,2,2,0);
  assertTrue(e1.intersects(e2) == 3);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyPoint(4,4,0)));
  e2=new MyEdge(4,4,0,20,20,0);
  assertTrue(e1.intersects(e2) == 4);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyEdge(4,4,0,8,8,0)));
  e2=new MyEdge(10,10,0,6,6,0);
  assertTrue(e1.intersects(e2) == 4);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyEdge(6,6,0,8,8,0)));
  e2=new MyEdge(6,4,0,10,8,0);
  assertTrue(e1.intersects(e2) == 2);
  e2=new MyEdge(0,0,0,1,-4,0);
  assertTrue(e1.intersects(e2) == 0);
  assertNull(e1.getIntersection(e2));
  e2=new MyEdge(8,8,0,1,-4,0);
  assertTrue(e1.intersects(e2) == 3);
  intersection=e1.getIntersection(e2);
  assertTrue(intersection.equals(new MyPoint(8,8,0)));
  e2=new MyEdge(6,6,0,1,-4,0);
  assertTrue(e1.intersects(e2) == 1);
  e1=new MyEdge(4,4,0,4,8,0);
  e2=new MyEdge(4,4,0,4,2,0);
  assertTrue(e1.intersects(e2) == 3);
  assertTrue(e1.getIntersection(e2).equals(new MyPoint(4,4,0)));
  e2=new MyEdge(4,8,0,4,10,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(4,6,0,4,10,0);
  assertTrue(e1.intersects(e2) == 4);
  assertTrue(e1.getIntersection(e2).equals(new MyEdge(4,6,0,4,8,0)));
  e2=new MyEdge(2,4,0,2,10,0);
  assertTrue(e1.intersects(e2) == 2);
  assertNull(e1.getIntersection(e2));
  e2=new MyEdge(4,9,0,4,10,0);
  assertTrue(e1.intersects(e2) == 2);
  e2=new MyEdge(9,9,0,10,10,0);
  assertTrue(e1.intersects(e2) == 0);
  assertNull(e1.getIntersection(e2));
  e2=new MyEdge(4,0,0,4,10,0);
  assertTrue(e1.intersects(e2) == 4);
  assertTrue(e1.getIntersection(e2).equals(new MyEdge(4,4,0,4,8,0)));
  e2=new MyEdge(4,8,0,10,12,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(9,9,0,10,10,0);
  assertTrue(e1.intersects(e2) == 0);
  e1=new MyEdge(4,4,0,8,4,0);
  e2=new MyEdge(4,4,0,4,2,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(5,3,0,5,8,0);
  assertTrue(e1.intersects(e2) == 1);
  e2=new MyEdge(9,4,0,0,4,0);
  assertTrue(e1.intersects(e2) == 4);
  assertTrue(e1.getIntersection(e2).equals(new MyEdge(4,4,0,8,4,0)));
  e2=new MyEdge(8,4,0,10,4,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(9,4,0,10,4,0);
  assertTrue(e1.intersects(e2) == 2);
  e2=new MyEdge(4,4,0,8,7,0);
  assertTrue(e1.intersects(e2) == 3);
  e2=new MyEdge(4,3,0,8,5,0);
  assertTrue(e1.intersects(e2) == 1);
  e2=new MyEdge(4,3,0,8,3,0);
  assertTrue(e1.intersects(e2) == 2);
  e1=new MyEdge(26.605142485395294,45.996587159903655,14.80314043832656,26.60521489309339,45.99657676794573,14.803141832441982);
  e2=new MyEdge(26.605142485395294,45.996587159903655,14.80314043832656,26.60522657816091,45.996594194945246,14.80313187802681);
  double d1=(e1.getPointLeft().getY() - e1.getPointRight().getY()) / (e1.getPointLeft().getX() - e1.getPointRight().getX());
  double d2=(e2.getPointLeft().getY() - e2.getPointRight().getY()) / (e2.getPointLeft().getX() - e2.getPointRight().getX());
  System.out.println("String_Node_Str" + d1);
  System.out.println("String_Node_Str" + d2);
  MyElement haha=e1.getIntersection(e2);
  System.out.println(haha);
  System.out.println("String_Node_Str" + e1.intersects(e2));
  System.out.println("String_Node_Str" + e2.intersects(e1));
  assertTrue(e1.intersects(e2) == 3);
  assertTrue(e2.intersects(e1) == 3);
}