/// <summary> /// Verify that S2TextFormat.ToDebugString() formats the given lat/lng with at most /// "max_digits" after the decimal point and has no trailing zeros. /// </summary> private static void ExpectMaxDigits(S2LatLng ll, int maxDigits) { var result = ll.ToDebugString(); var values = result.Split(':', StringSplitOptions.RemoveEmptyEntries); Assert.Equal(2, values.Length); foreach (var value in values) { var numDigits = 0; if (value.Contains('.')) { numDigits = value.Split(".")[1].Length; Assert.NotEqual('0', value.Last()); } Assert.True(numDigits <= maxDigits); } }
private static void ExpectString(string expected, S2LatLng ll) { Assert.Equal(expected, ll.ToDebugString()); }