private static void TestRoundtripEncoding(CodingHint hint) { // Ensures that the EncodedS2PointVector can be encoded and decoded without // loss. const int level = 3; var pointsArray = new S2Point[kBlockSize]; pointsArray.Fill(EncodedValueToPoint(0, level)); var pointsList = pointsArray.ToList(); pointsList.Add(EncodedValueToPoint(0x78, level)); pointsList.Add(EncodedValueToPoint(0x7a, level)); pointsList.Add(EncodedValueToPoint(0x7c, level)); pointsList.Add(EncodedValueToPoint(0x84, level)); pointsArray = pointsList.ToArray(); EncodedS2PointVector a_vector = new(); Encoder a_encoder = new(); EncodedS2PointVector b_vector = new(); Encoder b_encoder = new(); // Encode and decode from a vector<S2Point>. { EncodedS2PointVector.EncodeS2PointVector(pointsArray, hint, a_encoder); var decoder = a_encoder.Decoder(); a_vector.Init(decoder); } Assert.Equal(pointsList, a_vector.Decode()); // Encode and decode from an EncodedS2PointVector. { a_vector.Encode(b_encoder); var decoder = b_encoder.Decoder(); b_vector.Init(decoder); } Assert.Equal(pointsList, b_vector.Decode()); }