Tests/NUnit/H3Suite/TestH3ToLocalIjExhaustive.cs
/// <summary>
/// Test that the neighbors (k-ring), if they can be found in the local IJ
/// coordinate space, can be converted back to indexes.
/// </summary>
Test that the neighbors (k-ring), if they can be found in the local IJ
coordinate space, can be converted back to indexes.
Test that the neighbors ( k - ring ) if they can be found in the local IJ coordinate space can be converted back to indexes .
private void LocalIjToH3KRingAssertions(H3Index h3)
        {
            int r = h3.Resolution;
            Assert.LessOrEqual(r, 5);
            int maxK = _maxDistances[r];
            int sz = maxK.MaxKringSize();
            var lookup = h3.KRingDistances(maxK);
            var index = 0;
            foreach ((var key, int value) in lookup)
            {
                index++;
                if (key == 0)
                {
                    continue;
                }
                (int status, var ij) = h3.ToLocalIjExperimental(key);
                if (status != 0)
                {
                    continue;
                }
                (int check, H3Index retrieved) = ij.ToH3Experimental(h3);
                Assert.AreEqual(0, check);
                Assert.AreEqual(key, retrieved);
            }
        }
private void LocalIjToH3KRingAssertions ( H3Index h3 ) { int r = h3 . Resolution ; Assert . LessOrEqual ( r , 5 ) ; int maxK = _maxDistances [ r ] ; int sz = maxK . MaxKringSize ( ) ; var lookup = h3 . KRingDistances ( maxK ) ; var index = 0 ; foreach ( ( var key , int value ) in lookup ) { index ++ ; if ( key == 0 ) { continue ; } ( int status , var ij ) = h3 . ToLocalIjExperimental ( key ) ; if ( status != 0 ) { continue ; } ( int check , H3Index retrieved ) = ij . ToH3Experimental ( h3 ) ; Assert . AreEqual ( 0 , check ) ; Assert . AreEqual ( key , retrieved ) ; } }
Test that the neighbors (k-ring), if they can be found in the local IJ
coordinate space, can be converted back to indexes.
Test that the neighbors ( k - ring ) if they can be found in the local IJ coordinate space can be converted back to indexes .
// <H3Index, int>
h3
H3Index