public void Test_S2CellUnion_FromBeginEnd() { // Since FromMinMax() is implemented in terms of FromBeginEnd(), we // focus on test cases that generate an empty range. S2CellId initial_id = S2CellId.FromFace(3); // Test an empty range before the minimum S2CellId. S2CellUnion cell_union = new(new List <S2CellId> { initial_id }); S2CellId id_begin = S2CellId.Begin(S2.kMaxCellLevel); cell_union.InitFromBeginEnd(id_begin, id_begin); Assert.True(cell_union.IsEmpty()); // Test an empty range after the maximum S2CellId. cell_union = new S2CellUnion(new List <S2CellId> { initial_id }); S2CellId id_end = S2CellId.End(S2.kMaxCellLevel); cell_union.InitFromBeginEnd(id_end, id_end); Assert.True(cell_union.IsEmpty()); // Test the full sphere. cell_union = S2CellUnion.FromBeginEnd(id_begin, id_end); Assert.Equal(6, cell_union.Size()); foreach (S2CellId id in cell_union) { Assert.True(id.IsFace()); } }