public void Level1_repetitions_unpacked() { var flatValues = new List <int>(); var levels = new List <int>(); RepetitionPack.HierarchyToFlat(1, new List <List <int> > { new List <int> { 1, 2 }, new List <int> { 3, 4 } }, flatValues, levels ); Assert.Equal(4, flatValues.Count); Assert.Equal(4, levels.Count); Assert.Equal(new[] { 0, 1, 0, 1 }, levels); Assert.Equal(new[] { 1, 2, 3, 4 }, flatValues); }
public void Level2_repetitions_unpacked() { var flatList = new List <int>(); var levels = new List <int>(); RepetitionPack.HierarchyToFlat(2, new List <List <List <int> > > { new List <List <int> > { new List <int> { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }, new List <int> { 6, 7, 19, 20, 21, 22, 23 } }, new List <List <int> > { new List <int> { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }, new List <int> { 6, 7, 19, 20, 21, 22, 23 } }, }, flatList, levels ); Assert.Equal(34, flatList.Count); Assert.Equal(34, levels.Count); Assert.Equal(new List <int> { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2 }, levels); Assert.Equal(new List <int> { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 6, 7, 19, 20, 21, 22, 23, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 6, 7, 19, 20, 21, 22, 23 }, flatList); }