Пример #1
0
        public void testConstructorMandatorySteps()
        {
            // Testing TimeGrid construction with only mandatory points
            List <double> test_times = new List <double> {
                0.0, 1.0, 2.0, 4.0
            };
            TimeGrid tg = new TimeGrid(test_times);

            // Time grid must include all times from passed iterator.
            // Further no additional times can be added.
            QAssert.CollectionAreEqual(tg.Times(), test_times);
        }
Пример #2
0
        public void testConstructorEvenSteps()
        {
            // Testing TimeGrid construction with n evenly spaced points

            double        end_time       = 10;
            int           steps          = 5;
            TimeGrid      tg             = new TimeGrid(end_time, steps);
            List <double> expected_times = new List <double>
            {
                0.0,
                2.0,
                4.0,
                6.0,
                8.0,
                10.0
            };

            QAssert.CollectionAreEqual(tg.Times(), expected_times);
        }
Пример #3
0
        public void testConstructorAdditionalSteps()
        {
            // Testing TimeGrid construction with additional steps
            List <double> test_times = new List <double> {
                1.0, 2.0, 4.0
            };
            TimeGrid tg = new TimeGrid(test_times, 8);

            // Expect 8 evenly sized steps over the interval [0, 4].
            List <double> expected_times = new List <double>
            {
                0.0,
                0.5,
                1.0,
                1.5,
                2.0,
                2.5,
                3.0,
                3.5,
                4.0
            };

            QAssert.CollectionAreEqual(tg.Times(), expected_times);
        }