d3 / d3-polygon

Geometric operations for two-dimensional polygons.
https://d3js.org/d3-polygon
ISC License
98 stars 26 forks source link

Updated centroid-test.js - different tests named differently #24

Closed inobelar closed 4 years ago

inobelar commented 4 years ago

First and fourth different tests named the same. It may cause problems on non-'tape' test-frameworks That's why it fixed (by adding in fourth case additional 's' letter).


Next test named the same:

1)

tape("polygonCentroid(points) returns the expected value for closed counterclockwise polygons", function(test) {
  test.deepEqual(polygon.polygonCentroid([[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]), [.5, .5]);
  test.end();
});

4)

tape("polygonCentroid(points) returns the expected value for closed counterclockwise polygons", function(test) {
  test.deepEqual(polygon.polygonCentroid([[0, 0], [1, 0], [1, 1], [0, 1]]), [.5, .5]);
  test.deepEqual(polygon.polygonCentroid([[1, 1], [3, 2], [2, 3]]), [2, 2]);
  test.end();
});

It may produce warnings/errors on non-tape testing-framework, or even on another languages libraries. For example: c++ implementation, covered by catch2, warned about it:

image

Fil commented 4 years ago

solved by https://github.com/d3/d3-polygon/pull/26