예제 #1
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo {
                Result = AssertionResults.Error
            };

            //validate arguments length
            if (values.Length != 2)
            {
                result.FailureReason = Name + " awaited 2 arguments (lvalue, rvalue) but got " + values.Length;
                return(result);
            }
            string lvalue = values[0];
            string rvalue = values[1];

            if (lvalue == rvalue)
            {
                result.Result = AssertionResults.Passed;
            }
            else
            {
                result.Result = AssertionResults.Failed;
                //var diffResult = Diff.DiffText(values[0], values[1], false, false, false);
                //TODO print string diffs
                result.FailureReason = String.Format("Strings are not equal", lvalue, rvalue);
            }
            return(result);
        }
예제 #2
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo { Result = AssertionResults.Error };

            //validate arguments length
            if (values.Length != 2)
            {
                result.FailureReason = Name + " awaited 2 arguments (lvalue, rvalue) but got " + values.Length;
                return result;
            }
            string lvalue = values[0];
            string rvalue = values[1];
            if (lvalue == rvalue)
            {
                result.Result = AssertionResults.Passed;
            }
            else
            {
                result.Result = AssertionResults.Failed;
                //var diffResult = Diff.DiffText(values[0], values[1], false, false, false);
                //TODO print string diffs
                result.FailureReason = String.Format("Strings are not equal", lvalue, rvalue);
            }
            return result;
        }
예제 #3
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo();

            result.Result = AssertionResults.Error; //for future validation

            //validate arguments length
            if (values.Length != 7)
            {
                result.FailureReason = "AssertVectorAlmostEqual awaited 7 arguments (x1, y1, z1, x2, y2, z2, delta)  but got " + values.Length;
                return(result);
            }

            //parse arguments

            double[] parsedValues = new double[7];
            for (int i = 0; i < 7; i++)
            {
                if (!Double.TryParse(values[i], NumberStyles.Any, CultureInfo.InvariantCulture, out parsedValues[i]))
                {
                    result.FailureReason = "AssertVectorAlmostEqual was unable to parse " + i + " argument: " + values[0];
                    return(result);
                }
            }

            var v1 = new double[3];
            var v2 = new double[3];

            v1[0] = parsedValues[0];
            v1[1] = parsedValues[1];
            v1[2] = parsedValues[2];
            v2[0] = parsedValues[3];
            v2[1] = parsedValues[4];
            v2[2] = parsedValues[5];
            double delta = parsedValues[6];

            for (int i = 0; i < 3; i++)
            {
                double realDelta = Math.Abs(v1[i] - v2[i]);
                delta = Math.Abs(delta);
                if (Math.Abs(realDelta) > delta)
                {
                    result.Result         = AssertionResults.Failed;
                    result.FailureReason  = String.Format("Values {0} and {1} differ for {2}. It is {3} bigger than required delta {4}", v1[i], v2[i], realDelta, Math.Abs(realDelta - delta), delta);
                    result.FailureReason += String.Format("Comparision [x1={0} x2={1}] [y1={2}, y2={3}] [z1={4}, z2={5}] delta={6}", v1[0], v2[0], v1[1], v2[1], v1[2], v2[2], delta);
                    return(result);
                }
            }

            result.Result = AssertionResults.Passed;
            return(result);
        }
예제 #4
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo();
            result.Result = AssertionResults.Error; //for future validation

            //validate arguments length
            if(values.Length !=7)
            {
                result.FailureReason = "AssertVectorAlmostEqual awaited 7 arguments (x1, y1, z1, x2, y2, z2, delta)  but got " + values.Length;
                return result;
            }

            //parse arguments

            double[] parsedValues = new double[7];
            for (int i = 0; i < 7; i++)
            {
                if (!Double.TryParse(values[i], NumberStyles.Any, CultureInfo.InvariantCulture, out parsedValues[i]))
                {
                    result.FailureReason = "AssertVectorAlmostEqual was unable to parse " + i + " argument: " + values[0];
                    return result;
                }
            }

            var v1 = new double[3];
            var v2 = new double[3];
            v1[0] = parsedValues[0];
            v1[1] = parsedValues[1];
            v1[2] = parsedValues[2];
            v2[0] = parsedValues[3];
            v2[1] = parsedValues[4];
            v2[2] = parsedValues[5];
            double delta = parsedValues[6];

            for (int i = 0; i < 3; i++)
            {
                double realDelta = Math.Abs(v1[i] - v2[i]);
                delta = Math.Abs(delta);
                if (Math.Abs(realDelta) > delta)
                {
                    result.Result = AssertionResults.Failed;
                    result.FailureReason = String.Format("Values {0} and {1} differ for {2}. It is {3} bigger than required delta {4}", v1[i], v2[i], realDelta, Math.Abs(realDelta - delta), delta);
                    result.FailureReason += String.Format("Comparision [x1={0} x2={1}] [y1={2}, y2={3}] [z1={4}, z2={5}] delta={6}", v1[0], v2[0], v1[1], v2[1], v1[2], v2[2], delta);
                    return result;
                }

            }

            result.Result = AssertionResults.Passed;
            return result;
        }
예제 #5
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo();

            result.Result = AssertionResults.Error; //fo future validation

            //validate arguments length
            if (values.Length != 3)
            {
                result.FailureReason = "AssertAlmostEqual awaited 3 arguments (lvalue, rvalue, delta) but got " + values.Length;
                return(result);
            }

            //parse arguments
            double lvalue, rvalue, delta;

            double[] parsedValues = new double[3];
            for (int i = 0; i < 3; i++)
            {
                if (!Double.TryParse(values[i], NumberStyles.Any, CultureInfo.InvariantCulture, out parsedValues[i]))
                {
                    result.FailureReason = "AssertAlmostEqual was unable to parse " + i + " argument: " + values[0];
                    return(result);
                }
            }
            lvalue = parsedValues[0];
            rvalue = parsedValues[1];
            delta  = parsedValues[2];

            double realDelta = Math.Abs(lvalue - rvalue);

            delta = Math.Abs(delta);
            if (Math.Abs(realDelta) <= delta)
            {
                result.Result = AssertionResults.Passed;
            }
            else
            {
                result.Result        = AssertionResults.Failed;
                result.FailureReason = String.Format("Values {0} and {1} differ for {2}. It is {3} bigger than required delta {4}", lvalue, rvalue, realDelta, Math.Abs(realDelta - delta), delta);
            }
            return(result);
        }
예제 #6
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo {
                Result = AssertionResults.Error
            };

            //validate arguments length
            if (values.Length != 2)
            {
                result.FailureReason = "AssertIntEqual awaited 2 arguments (lvalue, rvalue) but got " + values.Length;
                return(result);
            }

            //parse arguments
            int lvalue, rvalue;

            if (!int.TryParse(values[0], out lvalue))
            {
                result.FailureReason = "AssertIntEqual was unable to parse 1st argument: " + values[0];
                return(result);
            }

            if (!int.TryParse(values[1], out rvalue))
            {
                result.FailureReason = "AssertIntEqual was unable to parse 2nd argument: " + values[1];
                return(result);
            }


            if (lvalue == rvalue)
            {
                result.Result = AssertionResults.Passed;
            }
            else
            {
                result.Result        = AssertionResults.Failed;
                result.FailureReason = String.Format("{0} is not equal to {1}", lvalue, rvalue);
            }
            return(result);
        }
예제 #7
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo();
            result.Result = AssertionResults.Error; //fo future validation

            //validate arguments length
            if(values.Length !=3)
            {
                result.FailureReason = "AssertAlmostEqual awaited 3 arguments (lvalue, rvalue, delta) but got " + values.Length;
                return result;
            }

            //parse arguments
            double lvalue, rvalue, delta;
            double[] parsedValues = new double[3];
            for (int i = 0; i < 3; i++)
            {
                if (!Double.TryParse(values[i], NumberStyles.Any, CultureInfo.InvariantCulture, out parsedValues[i]))
                {
                    result.FailureReason = "AssertAlmostEqual was unable to parse "+i+" argument: " + values[0];
                    return result;
                }
            }
            lvalue = parsedValues[0];
            rvalue = parsedValues[1];
            delta = parsedValues[2];

            double realDelta = Math.Abs(lvalue - rvalue);
            delta = Math.Abs(delta);
            if (Math.Abs(realDelta) <= delta)
            {
                result.Result = AssertionResults.Passed;
            }
            else
            {
                result.Result = AssertionResults.Failed;
                result.FailureReason = String.Format("Values {0} and {1} differ for {2}. It is {3} bigger than required delta {4}", lvalue, rvalue, realDelta, Math.Abs(realDelta - delta), delta);
            }
            return result;
        }
예제 #8
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo { Result = AssertionResults.Error };

            //validate arguments length
            if (values.Length != 1)
            {
                result.FailureReason = Name + " awaited 1 argument but got " + values.Length;
                return result;
            }

            if (values[0].ToLower() == "true")
            {
                result.Result = AssertionResults.Passed;
            }
            else
            {
                result.Result = AssertionResults.Failed;
                result.FailureReason = String.Format("Value is not true it is " + values[0]);
            }
            return result;
        }
예제 #9
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo {Result = AssertionResults.Error};

            //validate arguments length
            if (values.Length != 2)
            {
                result.FailureReason = "AssertIntEqual awaited 2 arguments (lvalue, rvalue) but got " + values.Length;
                return result;
            }

            //parse arguments
            int lvalue, rvalue;
            if (!int.TryParse(values[0], out lvalue))
            {
                result.FailureReason = "AssertIntEqual was unable to parse 1st argument: " + values[0];
                return result;
            }

            if (!int.TryParse(values[1], out rvalue))
            {
                result.FailureReason = "AssertIntEqual was unable to parse 2nd argument: " + values[1];
                return result;
            }

            if (lvalue == rvalue)
            {
                result.Result = AssertionResults.Passed;
            }
            else
            {
                result.Result = AssertionResults.Failed;
                result.FailureReason = String.Format("{0} is not equal to {1}", lvalue, rvalue);
            }
            return result;
        }
예제 #10
0
        /// <summary>
        /// Function provides test of assertion
        /// </summary>
        /// <param name="values">assertion values as they appear in UDK log</param>
        /// <returns>Never null TestInfo with test results</returns>
        public AssertionInfo Test(string[] values)
        {
            var result = new AssertionInfo {
                Result = AssertionResults.Error
            };

            //validate arguments length
            if (values.Length != 1)
            {
                result.FailureReason = Name + " awaited 1 argument but got " + values.Length;
                return(result);
            }

            if (values[0].ToLower() == "false")
            {
                result.Result = AssertionResults.Passed;
            }
            else
            {
                result.Result        = AssertionResults.Failed;
                result.FailureReason = String.Format("Value is not false it is " + values[0]);
            }
            return(result);
        }