diff options
Diffstat (limited to 'tests/src/CoreMangLib/cti/system/boolean')
4 files changed, 0 insertions, 365 deletions
diff --git a/tests/src/CoreMangLib/cti/system/boolean/BooleanParse.csproj b/tests/src/CoreMangLib/cti/system/boolean/BooleanParse.csproj deleted file mode 100644 index d9bde7654d..0000000000 --- a/tests/src/CoreMangLib/cti/system/boolean/BooleanParse.csproj +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <OutputType>Exe</OutputType> - <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> - <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <CLRTestKind>BuildAndRun</CLRTestKind> - <CLRTestPriority>1</CLRTestPriority> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - </PropertyGroup> - <ItemGroup> - <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> - <Visible>False</Visible> - </CodeAnalysisDependentAssemblyPaths> - </ItemGroup> - <ItemGroup> - <!-- Add Compile Object Here --> - <Compile Include="booleanparse.cs" /> - </ItemGroup> - <ItemGroup> - <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - </ItemGroup> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> - <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> - </PropertyGroup> -</Project>
\ No newline at end of file diff --git a/tests/src/CoreMangLib/cti/system/boolean/BooleanTryParse.csproj b/tests/src/CoreMangLib/cti/system/boolean/BooleanTryParse.csproj deleted file mode 100644 index df1a740778..0000000000 --- a/tests/src/CoreMangLib/cti/system/boolean/BooleanTryParse.csproj +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <OutputType>Exe</OutputType> - <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> - <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <CLRTestKind>BuildAndRun</CLRTestKind> - <CLRTestPriority>1</CLRTestPriority> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - </PropertyGroup> - <ItemGroup> - <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> - <Visible>False</Visible> - </CodeAnalysisDependentAssemblyPaths> - </ItemGroup> - <ItemGroup> - <!-- Add Compile Object Here --> - <Compile Include="booleantryparse.cs" /> - </ItemGroup> - <ItemGroup> - <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - <ProjectReference Include="../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - </ItemGroup> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> - <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> - </PropertyGroup> -</Project>
\ No newline at end of file diff --git a/tests/src/CoreMangLib/cti/system/boolean/booleanparse.cs b/tests/src/CoreMangLib/cti/system/boolean/booleanparse.cs deleted file mode 100644 index 0090df02cd..0000000000 --- a/tests/src/CoreMangLib/cti/system/boolean/booleanparse.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -using System; - -/// <summary> -/// to test System.Boolean.Parse(string) -/// </summary> -public class BooleanParse -{ - // not using Boolean.TrueString/FalseString in order to not test circularly - const string cTRUE = "True"; - const string cFALSE = "False"; - - public static int Main() - { - BooleanParse testCase = new BooleanParse(); - - TestLibrary.TestFramework.BeginTestCase("Boolean.Parse"); - if (testCase.RunTests()) - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("PASS"); - return 100; - } - else - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("FAIL"); - return 0; - } - } - - public bool RunTests() - { - bool retVal = true; - - TestLibrary.TestFramework.LogInformation("[Positive]"); - retVal = PosTest1() && retVal; - retVal = PosTest2() && retVal; - retVal = PosTest3() && retVal; - retVal = PosTest4() && retVal; - retVal = PosTest5() && retVal; - retVal = PosTest6() && retVal; - retVal = PosTest7() && retVal; - - TestLibrary.TestFramework.LogInformation("[Negative]"); - retVal = NegTest1() && retVal; - retVal = NegTest2() && retVal; - retVal = NegTest3() && retVal; - retVal = NegTest4() && retVal; - retVal = NegTest5() && retVal; - retVal = NegTest6() && retVal; - retVal = NegTest7() && retVal; - - return retVal; - } - - - - public bool PosTest1() - { - return PosTest("001", cFALSE, false); - } - - public bool PosTest2() - { - return PosTest("002", cTRUE, true); - } - - public bool PosTest3() - { - return PosTest("003", "\t"+cTRUE, true); - } - public bool PosTest4() - { - return PosTest("004", cFALSE+" ", false); - } - - public bool PosTest5() - { - return PosTest("005", " "+cFALSE+"\t ", false); - } - - public bool PosTest6() - { - return PosTest("006", "fAlse", false); - } - - public bool PosTest7() - { - return PosTest("007", "tRUE", true); - } - - bool PosTest(string id, string str, bool expect) - { - bool retVal = true; - try - { - if (Boolean.Parse(str) != expect) - { - TestLibrary.TestFramework.LogError(id, String.Format("expect Boolean.Parse(\"{0}\") == {1}",str, expect)); - retVal = false; - } - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError(id, "Unexpected exception: " + e); - retVal = false; - } - return retVal; - } - - - public bool NegTest1() - { - bool retVal = false; - try - { - bool v = Boolean.Parse(null); - } - catch (ArgumentNullException) - { - // that exception is what's expected - retVal = true; - return retVal; - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e); - retVal = false; - return retVal; - } - - TestLibrary.TestFramework.LogError("001", "expect a FormatException on Boolean.Parse(null)"); - return retVal; - } - - public bool NegTest2() - { - return NegTest("002", "0"); - } - public bool NegTest3() - { - return NegTest("003", "1"); - } - public bool NegTest4() - { - return NegTest("004", "Yes"); - } - public bool NegTest5() - { - return NegTest("005", String.Empty); - } - public bool NegTest6() - { - return NegTest("006", cTRUE + cFALSE); - } - - public bool NegTest7() - { - return NegTest("007", cFALSE +" "+ cTRUE); - } - - bool NegTest(string id, string str) - { - bool retVal = false; - try - { - bool v = Boolean.Parse(str); - } - catch ( FormatException ) - { - // that exception is what's expected - retVal = true; - return retVal; - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError(id, "Unexpected exception: " + e); - retVal = false; - return retVal; - } - - TestLibrary.TestFramework.LogError(id, String.Format("expect a FormatException on Boolean.Parse(\"{0}\")", str)); - return retVal; - } -} diff --git a/tests/src/CoreMangLib/cti/system/boolean/booleantryparse.cs b/tests/src/CoreMangLib/cti/system/boolean/booleantryparse.cs deleted file mode 100644 index ae745ba29a..0000000000 --- a/tests/src/CoreMangLib/cti/system/boolean/booleantryparse.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -using System; - -// This test was ported over to CoreCLR from Co7521TryParse.cs -// Tests Boolean.TryParse(str) -// 2003/02/25 KatyK -// 2007/06/28 adapted by MarielY -public class BooleanTryParse -{ - static bool verbose = false; - - public static int Main() - { - bool passed = true; - - try - { - // Success cases - passed &= VerifyBooleanTryParse("True", true, true); - passed &= VerifyBooleanTryParse("true", true, true); - passed &= VerifyBooleanTryParse("TRUE", true, true); - passed &= VerifyBooleanTryParse("tRuE", true, true); - passed &= VerifyBooleanTryParse("False", false, true); - passed &= VerifyBooleanTryParse("false", false, true); - passed &= VerifyBooleanTryParse("FALSE", false, true); - passed &= VerifyBooleanTryParse("fAlSe", false, true); - passed &= VerifyBooleanTryParse(" True ", true, true); - passed &= VerifyBooleanTryParse("False ", false, true); - passed &= VerifyBooleanTryParse("True\0", true, true); // VSWhidbey 465401 - passed &= VerifyBooleanTryParse("False\0", false, true); - passed &= VerifyBooleanTryParse("True\0 ", true, true); - passed &= VerifyBooleanTryParse(" \0 \0 True \0 ", true, true); - passed &= VerifyBooleanTryParse(" False \0\0\0 ", false, true); - - // Fail cases - passed &= VerifyBooleanTryParse(null, false, false); - passed &= VerifyBooleanTryParse("", false, false); - passed &= VerifyBooleanTryParse(" ", false, false); - passed &= VerifyBooleanTryParse("Garbage", false, false); - passed &= VerifyBooleanTryParse("True\0Garbage", false, false); - passed &= VerifyBooleanTryParse("True\0True", false, false); - passed &= VerifyBooleanTryParse("True True", false, false); - passed &= VerifyBooleanTryParse("True False", false, false); - passed &= VerifyBooleanTryParse("False True", false, false); - passed &= VerifyBooleanTryParse("Fa lse", false, false); - passed &= VerifyBooleanTryParse("T", false, false); - passed &= VerifyBooleanTryParse("0", false, false); - passed &= VerifyBooleanTryParse("1", false, false); - - /// END TEST CASES - } - catch (Exception e) - { - TestLibrary.Logging.WriteLine("Unexpected exception!! " + e.ToString()); - passed = false; - } - - if (passed) - { - TestLibrary.Logging.WriteLine ("paSs"); - return 100; - } - else - { - TestLibrary.Logging.WriteLine ("FAiL"); - return 1; - } - } - - public static bool VerifyBooleanTryParse(string value, bool expectedResult, bool expectedReturn) { - bool result; - if (verbose) { - TestLibrary.Logging.WriteLine ("Test: Boolean.TryParse, Value = '{0}', Expected Result, {1}, Expected Return = {2}", - value, expectedResult, expectedReturn); - } - try { - bool returnValue = Boolean.TryParse(value, out result); - if (returnValue != expectedReturn) { - TestLibrary.Logging.WriteLine ("FAILURE: Value = '{0}', Expected Return: {1}, Actual Return: {2}", value, expectedReturn, returnValue); - return false; - } - if (result != expectedResult) { - TestLibrary.Logging.WriteLine ("FAILURE: Value = '{0}', Expected Result: {1}, Actual Result: {2}", value, expectedResult, result); - return false; - } - - return true; - } - catch (Exception ex) { - TestLibrary.Logging.WriteLine ("FAILURE: Unexpected Exception, Value = '{0}', Exception: {1}", value, ex); - return false; - } - } -} - |