Пример #1
0
        public void LogScalesTest()
        {
            var s = new Scale(new Region(1, 100), true);
            var expectedMajor = new double[] {1, 10, 100};
            var expectedMinor = new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100};

            Assert.IsTrue(s.IsLog);
            CollectionAssert.AreEquivalent(expectedMajor, s.Major);
            CollectionAssert.AreEquivalent(expectedMinor, s.Minor);
        }
Пример #2
0
        public void LinearScaleTest(double delta, double maxRandom, [NotNull] params double[] expected)
        {
            var r = random.NextDouble()*maxRandom;
            var s = new Scale(new Region(r, r + delta), false);
            var actual = s.Major.ToArray();
            Assert.IsFalse(s.IsLog);

            foreach (var i in Enumerable.Range(0, expected.Length))
                Assert.AreEqual(expected[i], actual[i], 0.001, String.Format("r={0}, i={1}", r, i));
        }