示例#1
0
        public void Invert_NonzeroIndex_ReturnsExpectedIndex()
        {
            int index  = 7;
            int result = HammersleySequence.Invert(hammersleySequence3DBase16[index], 16);

            Assert.That(result, Is.EqualTo(index));
        }
示例#2
0
        public void GetElement_3DNonzeroIndex_ReturnsExpectedElement()
        {
            int index = 10;

            double[] result = HammersleySequence.GetElement(3, 16, index);
            Assert.That(result, Is.EqualTo(hammersleySequence3DBase16[index]).Within(6E-7));
        }
示例#3
0
        public void Next_3DZeroSeed_ReturnsExpectedSequence()
        {
            int count = 11;
            HammersleySequence sequence = new HammersleySequence(3, 16);

            double[][] result = new double[count][];
            for (int i = 0; i < count; i++)
            {
                result[i] = sequence.Next();
            }
            Assert.That(result, Is.EqualTo(hammersleySequence3DBase16).Within(6E-7));
        }
示例#4
0
 public void GetElement_InvalidDimensions_Throws()
 {
     Assert.That(() => HammersleySequence.GetElement(0, 16, 0), Throws.ArgumentException);
 }
示例#5
0
 public void GetElement_InvalidBase_Throws()
 {
     Assert.That(() => HammersleySequence.GetElement(1, 0, 0), Throws.ArgumentException);
 }
示例#6
0
 public void GetElement_InvalidIndex_Throws()
 {
     Assert.That(() => HammersleySequence.GetElement(1, 16, -1), Throws.ArgumentException);
 }
示例#7
0
 public void Invert_NonrationalNumber_Overflows()
 {
     Assert.That(() => HammersleySequence.Invert(new double[] { 1.0 / Math.PI, 1.0 / Math.E }, 16), Throws.TypeOf <OverflowException>());
 }
示例#8
0
 public void Invert_ValuesTooLarge_Throws()
 {
     Assert.That(() => HammersleySequence.Invert(new double[] { 2.0, 4.0, 8.0 }, 0), Throws.ArgumentException);
 }
示例#9
0
 public void Invert_InvalidBase_Throws()
 {
     Assert.That(() => HammersleySequence.Invert(hammersleySequence3DBase16[1], 0), Throws.ArgumentException);
 }
示例#10
0
 public void Invert_EmptyElement_Throws()
 {
     Assert.That(() => HammersleySequence.Invert(new double[0], 16), Throws.ArgumentException);
 }
示例#11
0
 public void Invert_ElementIsNull_Throws()
 {
     Assert.That(() => HammersleySequence.Invert(null, 16), Throws.ArgumentNullException);
 }
示例#12
0
 public void Constructor_InvalidDimensions_Throws()
 {
     Assert.That(() => HammersleySequence.GetElement(1, 16, -1), Throws.ArgumentException);
 }