@@ -151,25 +151,28 @@ public void testCellArea() {
151151 @ Test
152152 public void testExactEdgeLength () {
153153 for (int res = 0 ; res <= 15 ; res ++) {
154- String cellAddress = h3 .geoToH3Address (0 , 0 , res );
155154 long cell = h3 .geoToH3 (0 , 0 , res );
156155
157- double areaAddressM = h3 .exactEdgeLength (cellAddress , LengthUnit .m );
158- double areaAddressKm = h3 .exactEdgeLength (cellAddress , LengthUnit .km );
159- double areaAddressRads = h3 .exactEdgeLength (cellAddress , LengthUnit .rads );
160- double areaM = h3 .exactEdgeLength (cell , LengthUnit .m );
161- double areaKm = h3 .exactEdgeLength (cell , LengthUnit .km );
162- double areaRads = h3 .exactEdgeLength (cell , LengthUnit .rads );
163-
164- // Only asserts some properties of the functions that the edge lengths
165- // should have certain relationships to each other, test isn't specific
166- // to a cell's actual values.
167- assertTrue ("edge length should match expectation" , areaAddressRads > 0 );
168- assertEquals ("rads edge length should agree" , areaAddressRads , areaRads , EPSILON );
169- assertEquals ("km edge length should agree" , areaAddressKm , areaKm , EPSILON );
170- assertEquals ("m edge length should agree" , areaAddressM , areaM , EPSILON );
171- assertTrue ("m length greater than km length" , areaM > areaKm );
172- assertTrue ("km length greater than rads length" , areaKm > areaRads );
156+ for (long edge : h3 .getH3UnidirectionalEdgesFromHexagon (cell )) {
157+ String edgeAddress = h3 .h3ToString (edge );
158+
159+ double areaAddressM = h3 .exactEdgeLength (edgeAddress , LengthUnit .m );
160+ double areaAddressKm = h3 .exactEdgeLength (edgeAddress , LengthUnit .km );
161+ double areaAddressRads = h3 .exactEdgeLength (edgeAddress , LengthUnit .rads );
162+ double areaM = h3 .exactEdgeLength (edge , LengthUnit .m );
163+ double areaKm = h3 .exactEdgeLength (edge , LengthUnit .km );
164+ double areaRads = h3 .exactEdgeLength (edge , LengthUnit .rads );
165+
166+ // Only asserts some properties of the functions that the edge lengths
167+ // should have certain relationships to each other, test isn't specific
168+ // to a cell's actual values.
169+ assertTrue ("edge length should match expectation" , areaAddressRads > 0 );
170+ assertEquals ("rads edge length should agree" , areaAddressRads , areaRads , EPSILON );
171+ assertEquals ("km edge length should agree" , areaAddressKm , areaKm , EPSILON );
172+ assertEquals ("m edge length should agree" , areaAddressM , areaM , EPSILON );
173+ assertTrue ("m length greater than km length" , areaM > areaKm );
174+ assertTrue ("km length greater than rads length" , areaKm > areaRads );
175+ }
173176 }
174177 }
175178
0 commit comments