コード例 #1
0
    public bool Test(CultureInfo culture, string str1, string str2, int expected, CompareOptions options, string id)
    {
        CompareInfo ci = culture.CompareInfo;

        if (!id.Contains("s") || !Utilities.IsVistaOrLater)         //Due Windows 7 bug 130925
        {
            expected = GlobLocHelper.OSLastIndexOf(culture, str1, str2, options);
        }
        bool result = true;

        if (str1 == null || str2 == null || (str1.Length < 100 && str2.Length < 100))
        {
            TestFramework.BeginScenario(id + ": Comparing " + ((str1 == null) ? "null" : str1) + " / " + ((str2 == null) ? "null" : str2) + "; options: " + options + "; culture: " + ci.Name);
        }
        else
        {
            TestFramework.BeginScenario(id + ": Comparing LongStr (" + str1.Length + ") / LongStr(" + str2.Length + "); options: " + options + "; culture: " + ci.Name);
        }
        try
        {
            int i = ci.LastIndexOf(str1, str2, options);
            if (i != expected)
            {
                result = false;
                TestFramework.LogError("001z", "Error in " + id + ", unexpected comparison result. Actual: " + i + ", Expected: " + expected);
            }
        }
        catch (Exception exc)
        {
            result = false;
            TestFramework.LogError("003z", "Unexpected exception in " + id + ", excpetion: " + exc.ToString());
        }
        return(result);
    }
コード例 #2
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1:The SByte MaxValue ToString 1");
        try
        {
            sbyte  SByteVal = sbyte.MaxValue;
            string format1  = null;
            string format2  = string.Empty;
            string desStr1  = SByteVal.ToString(format1);
            string desStr2  = SByteVal.ToString(format2);
            if (desStr1 != GlobLocHelper.OSSByteToString(SByteVal, format1) || desStr2 != GlobLocHelper.OSSByteToString(SByteVal, format2))
            {
                TestLibrary.TestFramework.LogError("001", "The ExpectResult is not the ActualResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
コード例 #3
0
    public bool PosTest1()
    {
        bool   retVal = true;
        string errorDesc;

        UInt16 uintA;
        string expectedValue;
        string actualValue;

        uintA = (UInt16)(TestLibrary.Generator.GetInt32(-55) % (UInt16.MaxValue + 1));

        TestLibrary.TestFramework.BeginScenario("PosTest1: Random UInt16 value between 0 and UInt16.MaxValue.");
        try
        {
            actualValue   = uintA.ToString();
            expectedValue = GlobLocHelper.OSUInt16ToString(uintA);

            if (actualValue != expectedValue)
            {
                errorDesc =
                    string.Format("The char value of {0} is not the value {1} as expected: actual({2})",
                                  uintA, expectedValue, actualValue);
                TestLibrary.TestFramework.LogError("001", errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpect exception:" + e;
            TestLibrary.TestFramework.LogError("002", errorDesc);
            retVal = false;
        }
        return(retVal);
    }
コード例 #4
0
    public bool PosTest2()
    {
        bool   retVal = true;
        string errorDesc;

        UInt16 uintA;
        string expectedValue;
        string actualValue;

        uintA = UInt16.MaxValue;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Value is UInt16.MaxValue.");
        try
        {
            actualValue   = uintA.ToString();
            expectedValue = GlobLocHelper.OSUInt16ToString(uintA);

            if (actualValue != expectedValue)
            {
                errorDesc =
                    string.Format("The char value of {0} is not the value {1} as expected: actual({2})",
                                  uintA, expectedValue, actualValue);
                TestLibrary.TestFramework.LogError("003", errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpect exception:" + e;
            TestLibrary.TestFramework.LogError("004", errorDesc);
            retVal = false;
        }
        return(retVal);
    }
コード例 #5
0
    public bool PosTest3()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest3: Verify convert byte is min value...");

        try
        {
            Byte   myByte     = 0;
            string byteString = myByte.ToString();

            if (byteString != GlobLocHelper.OSByteToString(myByte))
            {
                TestLibrary.TestFramework.LogError("005", "The convert string is not correct!");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpected exception occurs: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #6
0
    public bool Test(CultureInfo culture, string str1, string str2, int expected, CompareOptions options, string id)
    {
		if (!Utilities.IsVistaOrLater || !culture.Name.Equals("tr-TR")) //Due Windows 7 bug 130925
			expected = GlobLocHelper.OSCompare(culture, str1, 0, str1.Length, str2, 0, str2.Length, options);

        CompareInfo ci = culture.CompareInfo;
        bool result = true;
        if (str1 == null || str2 == null || (str1.Length < 100 && str2.Length < 100))
            TestFramework.BeginScenario(id + ": Comparing " + ((str1 == null) ? "null" : str1) + " / " + ((str2 == null) ? "null" : str2) + "; options: " + options + "; culture: " + ci.Name);
        else
            TestFramework.BeginScenario(id + ": Comparing LongStr (" + str1.Length + ") / LongStr(" + str2.Length + "); options: " + options + "; culture: " + ci.Name);
        try
        {
            int i = ci.Compare(str1, str2, options);
            i = (i == 0) ? 0 : i / Math.Abs(i); // We don't care what i is, just whether it's =,>, or < 0
            if (i != expected)
            {
                result = false;
                TestFramework.LogError("001", "Error in " + id + ", unexpected comparison result. Actual: " + i + ", Expected: " + expected);
            }
            i = ci.Compare(str2, str1, options);
            i = (i == 0) ? 0 : i / Math.Abs(i); // We don't care what i is, just whether it's =,>, or < 0
            if (i != (0 - expected))
            {
                result = false;
                TestFramework.LogError("002", "Error in " + id + ", unexpected comparison result. Actual: " + i + ", Expected: " + (0 - expected));
            }
        }
        catch (Exception exc)
        {
            result = false;
            TestFramework.LogError("003", "Unexpected exception in " + id + ", excpetion: " + exc.ToString());
        }
        return result;
    }
コード例 #7
0
        public bool PosTest17()
        {
            bool   retVal = true;
            string strA;
            string strB;
            int    ActualResult;

            TestLibrary.TestFramework.BeginScenario("PosTest17:Globalized strings CompareTo");
            try
            {
                strA         = "A\u0300";
                strB         = "\u00C0";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // 0
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("033", "Globalized strings CompareTo ExpectResult is equel 0,ActualResult is (" + ActualResult + ")");
                    retVal = false;
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("034", "Unexpected Exception" + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #8
0
    public bool PosTest9()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest9: UInt32(MaxValue, 'N', sv-SE)");

        try
        {
            UInt32      uintA     = UInt32.MaxValue;
            string      str       = "N";
            CultureInfo myculture = new CultureInfo("sv-SE");
            String      strA      = uintA.ToString(str, myculture);
            if (strA != GlobLocHelper.OSUInt32ToString(uintA, str, myculture))
            {
                TestLibrary.TestFramework.LogError("017", "Expected: " + GlobLocHelper.OSUInt32ToString(uintA, str, myculture) +
                                                   ", actual: " + strA);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("018", "Unexpected exception: " + e);
            retVal = false;
        }
        return(retVal);
    }
コード例 #9
0
        public bool PosTest13()
        {
            bool   retVal = true;
            string strA;
            string strB;
            int    ActualResult;

            TestLibrary.TestFramework.BeginScenario("PosTest13:string CompareTo its with newline symbol three");
            try
            {
                strA         = "\nhelloword";
                strB         = "helloword";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // -1
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("025", "string CompareTo its with newline symbol three ExpectResult is less 0,ActualResult is (" + ActualResult + ")");
                    retVal = false;
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("026", "Unexpected Exception" + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #10
0
        public bool PosTest16()
        {
            bool   retVal = true;
            string strA;
            string strB;
            int    ActualResult;

            TestLibrary.TestFramework.BeginScenario("PosTest16:strings embedded nulls CompareTo three");
            try
            {
                strA         = "\0helloword";
                strB         = "helloword";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // 0
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("031", "strings embedded nulls CompareTo three ExpectResult is equel 0,ActualResult is (" + ActualResult + ")");
                    retVal = false;
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("032", "Unexpected Exception" + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #11
0
        public bool PosTest10()
        {
            bool   retVal = true;
            string strA;
            string strB;
            int    ActualResult;

            TestLibrary.TestFramework.BeginScenario("PosTest10:strings with one char CompareTo");
            try
            {
                strA         = "A";
                strB         = "a";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // 1
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("019", "strings with one char CompareTo ExpectResult is greater 0,ActualResult is (" + ActualResult + ")");
                    retVal = false;
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("020", "Unexpected Exception" + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #12
0
        public bool PosTest8()
        {
            bool   retVal = true;
            string strA;
            string strB;
            int    ActualResult;

            TestLibrary.TestFramework.BeginScenario("PosTest8:string CompareTo its with space two");

            try
            {
                strA         = "helloword";
                strB         = "hello word";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // 1
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("015", "string CompareTo its with space one ExpectResult is greater 0 ActualResult is (" + ActualResult + ")");
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("016", "Unexpected exception" + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #13
0
        public bool PosTest6()
        {
            bool   retVal = true;
            string strA;
            string strB;
            int    ActualResult;

            TestLibrary.TestFramework.BeginScenario("PosTest6:One string with lower chars CompareTo the uppers ");

            try
            {
                strA         = "helloWord";
                strB         = "helloword";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // 1
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("011", "One string with lower chars CompareTo the uppers ExpectResult is greater 0 ActualResult is (" + ActualResult + ")");
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("012", "Unexpected exception" + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #14
0
        public bool PosTest5()
        {
            bool   retVal = true;
            string strA;
            string strB;
            int    ActualResult;

            TestLibrary.TestFramework.BeginScenario("PosTest5:Two like strings CompareTo");

            try
            {
                strA         = "helloword!";
                strB         = "helloword!";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // 0
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("009", "Two like strings CompareTo ExpectResult is equel 0 ActualResult is (" + ActualResult + ")");
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("010", "Unexpected exception" + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #15
0
        public bool PosTest19()
        {
            bool   retVal = true;
            string strA;
            string strB;
            int    ActualResult;

            TestLibrary.TestFramework.BeginScenario("PosTest19:Two different strings CompareTo two");
            try
            {
                strA         = "\uD801\uDC00";
                strB         = "\uD801\uDC28";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // -1
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("037", "Two different strings CompareTo two ExpectResult is less 0,ActualResult is (" + ActualResult + ")");
                    retVal = false;
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("038", "Unexpected Exception" + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #16
0
ファイル: chartolower1.cs プロジェクト: tempbottle/coreclr
    public bool PosTest2()
    {
        bool retVal = true;

        const string c_TEST_ID   = "P002";
        const string c_TEST_DESC = "PosTest2: lowercase character";
        string       errorDesc;

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
        try
        {
            char ch           = 'a';
            char expectedChar = GlobLocHelper.OSToLower(ch); // ch;
            char actualChar   = char.ToLower(ch);
            if (actualChar != expectedChar)
            {
                errorDesc  = string.Format("Lowercase of character \\u{0:x} is not the value ", (int)ch);
                errorDesc += string.Format("\\u{0:x} as expected: actual(\\u{1:x}", (int)expectedChar, (int)actualChar);
                TestLibrary.TestFramework.LogError("003" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpected exception: " + e;
            TestLibrary.TestFramework.LogError("004" + " TestId-" + c_TEST_ID, errorDesc);
            retVal = false;
        }

        return(retVal);
    }
コード例 #17
0
        public bool PosTest20()
        {
            bool   retVal = true;
            int    ActualResult;
            string strA;
            string strB;

            TestLibrary.TestFramework.BeginScenario("PosTest20: Two different strings CompareTo three");

            try
            {
                strA         = "\\\\my documents\\my files\\";
                strB         = @"\\my documents\my files\";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // 0
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("039", "Two different strings CompareTo three Expected Result is equel 0,Actual Result is ( " + ActualResult + ")");
                    retVal = false;
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("040", "Unexpected exception: " + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #18
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: UInt32(minValue, 'F', en-US)");

        try
        {
            UInt32      uintA     = UInt32.MinValue;
            string      str       = "F";
            CultureInfo myculture = new CultureInfo("en-US");
            String      strA      = uintA.ToString(str, myculture);
            if (strA != GlobLocHelper.OSUInt32ToString(uintA, str, myculture))
            {
                TestLibrary.TestFramework.LogError("003", "Expected: " + GlobLocHelper.OSUInt32ToString(uintA, str, myculture) +
                                                   ", actual: " + strA);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
            retVal = false;
        }
        return(retVal);
    }
コード例 #19
0
        public bool PosTest21()
        {
            bool   retVal = true;
            int    ActualResult;
            string strA;
            string strB;

            TestLibrary.TestFramework.BeginScenario("PosTest21: Tab CompareTo four spaces ");

            try
            {
                strA         = "\t";
                strB         = "    ";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // 1
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("041", "Tab CompareTo four spaces Expected Result is greater 0,Actual Result is ( " + ActualResult + ")");
                    retVal = false;
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("042", "Unexpected exception: " + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #20
0
    public bool PosTest4()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest4: Convert a random uint64 to string value");

        try
        {
            UInt64 u64  = (UInt64)this.GetInt32(0, UInt32.MaxValue);
            string str  = u64.ToString();
            string str2 = GlobLocHelper.OSUInt64ToString(u64);
            if (str != str2)
            {
                TestLibrary.TestFramework.LogError("007", "The result is not the value as expected");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("008", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #21
0
        public bool PosTest4()
        {
            bool   retVal = true;
            string strA;
            string strB;
            int    ActualResult;

            TestLibrary.TestFramework.BeginScenario("PosTest4:one space CompareTo two spaces");

            try
            {
                strA         = " ";
                strB         = "  ";
                ActualResult = strA.CompareTo(strB);
                int ExpectedResult = GlobLocHelper.OSCompare(strA, strB); // -1
                if (ActualResult != ExpectedResult)
                {
                    TestLibrary.TestFramework.LogError("007", "one space CompareTo two spaces ExpectResult is less 0 ActualResult is (" + ActualResult + ")");
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("008", "Unexpected exception" + e);
                retVal = false;
            }
            return(retVal);
        }
コード例 #22
0
ファイル: Generator.cs プロジェクト: zwb0216/coreclr
        // if value is no-weight char, return true
        public static bool NoWeightChar(int value)
        {
            if ((int)'a' == value) // 'a' = 97
            {
                return(false);
            }

            String strA = "a" + Convert.ToChar(value);
            String strB = "a";

            if (0 == GlobLocHelper.OSCompare(CultureInfo.CurrentCulture, strA, 0, 2, strB, 0, 1, CompareOptions.None))
            {
                return(true);
            }

            return(false);
        }
コード例 #23
0
    public bool DoPosTest(string testDesc,
                          string errorNum1,
                          string errorNum2,
                          UInt16 uintA,
                          CultureInfo culture)
    {
        bool   retVal = true;
        string errorDesc;

        IFormatProvider provider;
        string          expectedValue;
        string          actualValue;

        TestLibrary.TestFramework.BeginScenario(testDesc);
        try
        {
            provider = (IFormatProvider)culture.NumberFormat;

            actualValue   = uintA.ToString(provider);
            expectedValue = GlobLocHelper.OSUInt16ToString(uintA, culture);

            if (actualValue != expectedValue)
            {
                errorDesc =
                    string.Format("The string representation of {0} is not the value {1} as expected: actual({2})",
                                  uintA, expectedValue, actualValue);
                errorDesc += "\nThe format info is " + culture.Name + " culture speicifed.";
                TestLibrary.TestFramework.LogError("005", errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpect exception:" + e;
            TestLibrary.TestFramework.LogError("006", errorDesc);
            retVal = false;
        }
        return(retVal);
    }
コード例 #24
0
    public bool PosTest3()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest3:The random SByte ToString 1");
        try
        {
            sbyte  SByteVal = 10;
            string desStr   = SByteVal.ToString();
            if (desStr != GlobLocHelper.OSSByteToString(SByteVal))
            {
                TestLibrary.TestFramework.LogError("005", "The ExpectResult is not the ActualResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
コード例 #25
0
ファイル: stringcompare15.cs プロジェクト: yukitos/coreclr
    // True value returned from test method means that the first substring lesser than the second
    private bool ExecutePosTestLesser(Parameters paras, bool expectedValue, string testDesc)
    {
        bool retVal = true;

        UpdateCounts(TestType.PositiveTest);

        string testInfo = c_POS_TEST_PREFIX + this.posTestCount.ToString() + ": " + testDesc;
        bool   actualValue;

        TestResult testResult = TestResult.NotRun;

        TestLibrary.TestFramework.BeginScenario(testInfo);
        try
        {
            actualValue = (0 > this.CallTestMethod(paras));
            if (paras.strA != null && paras.strB != null)
            {
                expectedValue = (0 > GlobLocHelper.OSCompare(paras.strA, paras.strB));
            }
            if (expectedValue != actualValue)
            {
                string errorDesc = "Value is not " + expectedValue + " as expected: Actual(" + actualValue + ")";
                errorDesc += paras.DataString;
                TestLibrary.TestFramework.LogError(GenerateErrorNum(this.totalTestCount), errorDesc);
                testResult = TestResult.FailedTest;
                retVal     = false;
            }
            testResult = TestResult.PassedTest;
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError(GenerateErrorNum(this.totalTestCount + 1), "Unexpected exception: " + e);
            testResult = TestResult.FailedTest;
            retVal     = false;
        }

        UpdateCounts(testResult);
        return(retVal);
    }
コード例 #26
0
ファイル: stringcompare2.cs プロジェクト: yukitos/coreclr
        /// <summary>
        /// Compare the same string with different cases when the case is considered
        /// </summary>
        /// <returns></returns>
        public bool PosTest2()
        {
            bool retVal = true;

            try
            {
                TestLibrary.TestFramework.BeginScenario("Compare the same string with different cases when the case is considered...");
                int expected = GlobLocHelper.OSCompare(str1, 2, str2, 2, 3, false); // 1;
                if (String.Compare(str1, 2, str2, 2, 3, StringComparison.CurrentCulture) != expected)
                {
                    TestLibrary.TestFramework.LogError("009", "LLOWO is not larger than llowo when the case is considered!");
                    retVal = false;
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("010", "Unexpected exception: " + e);
                retVal = false;
            }


            return(retVal);
        }
コード例 #27
0
ファイル: stringcompare2.cs プロジェクト: yukitos/coreclr
        /// <summary>
        /// Compare the same string with different cases when ignore the case
        /// </summary>
        /// <returns></returns>
        public bool PosTest1()
        {
            bool retVal = true;

            try
            {
                TestLibrary.TestFramework.BeginScenario("Compare the same string with different cases when ignore the case...");
                int expected = GlobLocHelper.OSCompare(str1, 2, str2, 2, 3, true); // 0;
                if (String.Compare(str1, 2, str2, 2, 3, StringComparison.CurrentCultureIgnoreCase) != expected)
                {
                    TestLibrary.TestFramework.LogError("001", "LLOWO is not equal to llowo when ignore the case...");
                    retVal = false;
                }
            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
                retVal = false;
            }


            return(retVal);
        }
コード例 #28
0
    public bool PosTest5()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest5:The SByte MinValue ToString 2");
        try
        {
            sbyte  SByteVal = sbyte.MinValue;
            string format   = "D";
            string desStr   = SByteVal.ToString(format);
            if (desStr != GlobLocHelper.OSSByteToString(SByteVal, format))
            {
                TestLibrary.TestFramework.LogError("009", "The ExpectResult is not the ActualResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("010", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
コード例 #29
0
    public bool PosTest4()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest4: Check the int16 in the beginning of which there are some zeros ");

        try
        {
            Int16 i1 = -00000000000765;
            if (i1.ToString() != GlobLocHelper.OSInt16ToString(i1))
            {
                TestLibrary.TestFramework.LogError("007", "The result is not the value as expected. ");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("008", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #30
0
    public bool PosTest3()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest3: Convert the \"-0\" to String ");

        try
        {
            Int16 i1 = -0;
            if (i1.ToString() != GlobLocHelper.OSInt16ToString(i1))
            {
                TestLibrary.TestFramework.LogError("005", "The result is not the value as expected. ");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }