public void Index() { int[] keys = { 0, 1, 2, 3, 4, 5, 6 }; int[] values = { 10, 11, 12, 13, 14, 15, 16 }; var dict = new NonAllocDictionary <int, int>(keys, values); for (int i = 0; i < keys.Length; ++i) { Assert.AreEqual(values[i], dict[keys[i]]); } }
public void Iterate() { int[] keys = { 0, 1, 2, 3, 4, 5, 6 }; int[] values = { 10, 11, 12, 13, 14, 15, 16 }; var dict = new NonAllocDictionary <int, int>(keys, values); var k = new List <int>(); var v = new List <int>(); foreach (var it in dict) { k.Add(it.Key); v.Add(it.Value); } Assert.AreEqual(keys, k.ToArray()); Assert.AreEqual(values, v.ToArray()); }