public void TestUnravelRavel(int[] shape, int index) { Multiarray <int> array = new Multiarray <int>(shape); Assert.AreEqual(index, array.RavelIndex(array.UnravelIndex(index))); Assert.AreEqual(array[index], array[array.UnravelIndex(index)]); }
public void TestRavelUnravel(int[] shape, int[] indices) { Multiarray <int> array = new Multiarray <int>(shape); Assert.AreEqual(indices, array.UnravelIndex(array.RavelIndex(indices))); Assert.AreEqual(array[indices], array[array.RavelIndex(indices)]); }
public void TestIndexOutOfRange(string arrayKey, int index) { Multiarray <int> array = TestIntegerArrays[arrayKey]; Assert.Throws <IndexOutOfRangeException>(delegate { int value = array[index]; }); Assert.Throws <IndexOutOfRangeException>(delegate { array[index] = 0; }); Assert.Throws <IndexOutOfRangeException>(delegate { array.UnravelIndex(index); }); }