Example #1
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)]);
        }
Example #2
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)]);
        }
Example #3
0
        public void TestRankMismatch(string arrayKey, int[] indices)
        {
            Multiarray <int> array = TestIntegerArrays[arrayKey];

            Assert.Throws <RankException>(delegate
            {
                int value = array[indices];
            });
            Assert.Throws <RankException>(delegate
            {
                array[indices] = 0;
            });
            Assert.Throws <RankException>(delegate
            {
                array.RavelIndex(indices);
            });
        }