Пример #1
0
        public void TestCopyVariables()
        {
            List <DEVariable> expectedResult = new List <DEVariable>
            {
                new DEVariable(leftDEVariables[0].Name, leftDEVariables[0].Value),
                new DEVariable(leftDEVariables[1].Name, leftDEVariables[1].Value)
            };

            List <DEVariable> actualResult = new List <DEVariable>();

            DifferentialEquationSystemHelpers.CopyVariables(leftDEVariables, actualResult);

            VerifyCollections(expectedResult, actualResult);

            List <Variable> secondActualResult = new List <Variable>();

            DifferentialEquationSystemHelpers.CopyVariables(leftDEVariables, secondActualResult);

            VerifyCollections(expectedResult, secondActualResult);

            List <DEVariable> thirdActualResult = new List <DEVariable>();

            DifferentialEquationSystemHelpers.CopyVariables(leftDEVariables, thirdActualResult);

            VerifyCollections(leftDEVariables, thirdActualResult);

            List <Variable> forthActualResult = new List <Variable>();

            DifferentialEquationSystemHelpers.CopyVariables(leftDEVariables, forthActualResult);

            VerifyCollections(leftDEVariables, forthActualResult);
        }
Пример #2
0
 public void TestCheckVariablesTauLessThanZero()
 {
     DifferentialEquationSystemHelpers.CheckVariables(
         differentialEquationSystem.ExpressionSystem,
         differentialEquationSystem.LeftVariables,
         differentialEquationSystem.TimeVariable,
         -100,
         differentialEquationSystem.TEnd);
 }
Пример #3
0
 public void TestCheckVariablesTauMoreThanInterval()
 {
     DifferentialEquationSystemHelpers.CheckVariables(
         differentialEquationSystem.ExpressionSystem,
         differentialEquationSystem.LeftVariables,
         differentialEquationSystem.TimeVariable,
         100,
         differentialEquationSystem.TEnd);
 }
Пример #4
0
 public void TestCheckVariablesTimeVariableNull()
 {
     DifferentialEquationSystemHelpers.CheckVariables(
         differentialEquationSystem.ExpressionSystem,
         differentialEquationSystem.LeftVariables,
         null,
         differentialEquationSystem.Tau,
         differentialEquationSystem.TEnd);
 }
Пример #5
0
 public void TestCheckVariablesTimeVariableMoreThanTEnd()
 {
     DifferentialEquationSystemHelpers.CheckVariables(
         differentialEquationSystem.ExpressionSystem,
         differentialEquationSystem.LeftVariables,
         new Variable("time", 100),
         differentialEquationSystem.Tau,
         differentialEquationSystem.TEnd);
 }
Пример #6
0
 public void TestCheckVariablesVariableEmpty()
 {
     DifferentialEquationSystemHelpers.CheckVariables(
         differentialEquationSystem.ExpressionSystem,
         new List <Variable>(),
         differentialEquationSystem.TimeVariable,
         differentialEquationSystem.Tau,
         differentialEquationSystem.TEnd);
 }
Пример #7
0
 public void TestCheckVariablesExpressionEmpty()
 {
     DifferentialEquationSystemHelpers.CheckVariables(
         new List <Expression>(),
         differentialEquationSystem.LeftVariables,
         differentialEquationSystem.TimeVariable,
         differentialEquationSystem.Tau,
         differentialEquationSystem.TEnd);
 }
Пример #8
0
 public void TestCheckVariablesAllCorrect()
 {
     DifferentialEquationSystemHelpers.CheckVariables(
         differentialEquationSystem.ExpressionSystem,
         differentialEquationSystem.LeftVariables,
         differentialEquationSystem.TimeVariable,
         differentialEquationSystem.Tau,
         differentialEquationSystem.TEnd);
 }
Пример #9
0
        public void TestCheckVariablesExpressionNotEqualVariables()
        {
            List <Variable> vars = new List <Variable>();

            DifferentialEquationSystemHelpers.CopyVariables(differentialEquationSystem.LeftVariables, vars);
            vars.Add(new Variable("x1", 8));

            DifferentialEquationSystemHelpers.CheckVariables(
                differentialEquationSystem.ExpressionSystem,
                vars,
                differentialEquationSystem.TimeVariable,
                differentialEquationSystem.Tau,
                differentialEquationSystem.TEnd);
        }
Пример #10
0
        public void TestCollectVariables()
        {
            List <Variable> constants = new List <Variable>
            {
                new Variable("w", 10),
                new Variable("r", 100)
            };

            List <Variable> expectedResult = new List <Variable>();

            expectedResult.AddRange(leftVariables);
            expectedResult.AddRange(constants);
            expectedResult.Add(new Variable("time", 0));

            List <Variable> actualVariable = DifferentialEquationSystemHelpers.CollectVariables(leftVariables, constants, new Variable("time", 0));

            VerifyCollections(expectedResult, actualVariable);
        }
Пример #11
0
        public void TestSaveLeftVariableToStatistics()
        {
            List <List <DEVariable> > expectedStatistics = new List <List <DEVariable> >();
            List <List <DEVariable> > actualStatistics   = new List <List <DEVariable> >();
            List <DEVariable>         expectedResult     = new List <DEVariable>
            {
                new DEVariable(leftDEVariables[0].Name, leftDEVariables[0].Value),
                new DEVariable(leftDEVariables[1].Name, leftDEVariables[1].Value),
                new DEVariable("time", 0)
            };

            expectedStatistics.Add(expectedResult);

            DifferentialEquationSystemHelpers.SaveLeftVariableToStatistics(
                actualStatistics,
                leftVariables,
                new DEVariable("time", 0));

            VerifyCollections(expectedStatistics[0], actualStatistics[0]);
        }
Пример #12
0
        public void TestConvertVariableToDEVariable()
        {
            List <Variable> variables = new List <Variable>
            {
                new Variable("a", 1),
                new Variable("b", 2),
                new Variable("c", 3)
            };

            List <DEVariable> expectedVariables = new List <DEVariable>
            {
                new DEVariable("a", 1),
                new DEVariable("b", 2),
                new DEVariable("c", 3)
            };

            List <DEVariable> actualVariables = DifferentialEquationSystemHelpers.ConvertVariableToDEVariable(variables);

            for (int i = 0; i < actualVariables.Count; i++)
            {
                Assert.AreEqual(expectedVariables[i].Name, actualVariables[i].Name);
                Assert.AreEqual(expectedVariables[i].Value, actualVariables[i].Value);
            }
        }