Esempio n. 1
0
        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)]);
        }
Esempio n. 2
0
        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)]);
        }
Esempio n. 3
0
        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);
            });
        }