// Encodes the given vector and returns the corresponding // EncodedS2CellIdVector (which points into the Encoder's data buffer). private static EncodedS2CellIdVector MakeEncodedS2CellIdVector(List <S2CellId> input, Encoder encoder) { EncodedS2CellIdVector.EncodeS2CellIdVector(input, encoder); var decoder = encoder.Decoder(); EncodedS2CellIdVector cell_ids = new(); Assert.True(cell_ids.Init(decoder)); return(cell_ids); }
// Encodes the given vector and checks that it has the expected size and // contents. private static void TestEncodedS2CellIdVector(List <S2CellId> expected, int expected_bytes) { Encoder encoder = new(); EncodedS2CellIdVector actual = MakeEncodedS2CellIdVector(expected, encoder); Assert.Equal(expected_bytes, encoder.Length()); var dec = actual.Decode(); Assert.True(dec.SequenceEqual(expected)); }