testBoxOverlaps() {
    // Overlapping tests.
    let box2 = new Box(1, 4, 4, 1);

    // Corner overlaps.
    assertTrue('NW overlap', boxOverlaps(new Box(0, 2, 2, 0), box2));
    assertTrue('NE overlap', boxOverlaps(new Box(0, 5, 2, 3), box2));
    assertTrue('SE overlap', boxOverlaps(new Box(3, 5, 5, 3), box2));
    assertTrue('SW overlap', boxOverlaps(new Box(3, 2, 5, 0), box2));

    // Inside.
    assertTrue('Inside overlap', boxOverlaps(new Box(2, 3, 3, 2), box2));

    // Around.
    assertTrue('Outside overlap', boxOverlaps(new Box(0, 5, 5, 0), box2));

    // Edge overlaps.
    assertTrue('N overlap', boxOverlaps(new Box(0, 3, 2, 2), box2));
    assertTrue('E overlap', boxOverlaps(new Box(2, 5, 3, 3), box2));
    assertTrue('S overlap', boxOverlaps(new Box(3, 3, 5, 2), box2));
    assertTrue('W overlap', boxOverlaps(new Box(2, 2, 3, 0), box2));

    assertTrue('N-in overlap', boxOverlaps(new Box(0, 5, 2, 0), box2));
    assertTrue('E-in overlap', boxOverlaps(new Box(0, 5, 5, 3), box2));
    assertTrue('S-in overlap', boxOverlaps(new Box(3, 5, 5, 0), box2));
    assertTrue('W-in overlap', boxOverlaps(new Box(0, 2, 5, 0), box2));

    // Does not overlap.
    box2 = new Box(3, 6, 6, 3);

    // Along the edge - shorter.
    assertFalse('N-in no overlap', boxOverlaps(new Box(1, 5, 2, 4), box2));
    assertFalse('E-in no overlap', boxOverlaps(new Box(4, 8, 5, 7), box2));
    assertFalse('S-in no overlap', boxOverlaps(new Box(7, 5, 8, 4), box2));
    assertFalse('N-in no overlap', boxOverlaps(new Box(4, 2, 5, 1), box2));

    // By the corner.
    assertFalse('NE no overlap', boxOverlaps(new Box(1, 8, 2, 7), box2));
    assertFalse('SE no overlap', boxOverlaps(new Box(7, 8, 8, 7), box2));
    assertFalse('SW no overlap', boxOverlaps(new Box(7, 2, 8, 1), box2));
    assertFalse('NW no overlap', boxOverlaps(new Box(1, 2, 2, 1), box2));

    // Perpendicular to an edge.
    assertFalse('NNE no overlap', boxOverlaps(new Box(1, 7, 2, 5), box2));
    assertFalse('NEE no overlap', boxOverlaps(new Box(2, 8, 4, 7), box2));
    assertFalse('SEE no overlap', boxOverlaps(new Box(5, 8, 7, 7), box2));
    assertFalse('SSE no overlap', boxOverlaps(new Box(7, 7, 8, 5), box2));
    assertFalse('SSW no overlap', boxOverlaps(new Box(7, 4, 8, 2), box2));
    assertFalse('SWW no overlap', boxOverlaps(new Box(5, 2, 7, 1), box2));
    assertFalse('NWW no overlap', boxOverlaps(new Box(2, 2, 4, 1), box2));
    assertFalse('NNW no overlap', boxOverlaps(new Box(1, 4, 2, 2), box2));

    // Along the edge - longer.
    assertFalse('N no overlap', boxOverlaps(new Box(0, 7, 1, 2), box2));
    assertFalse('E no overlap', boxOverlaps(new Box(2, 9, 7, 8), box2));
    assertFalse('S no overlap', boxOverlaps(new Box(8, 7, 9, 2), box2));
    assertFalse('W no overlap', boxOverlaps(new Box(2, 1, 7, 0), box2));
  }
Tests if the utility function to compute box overlapping functions
properly.