summaryrefslogtreecommitdiff
path: root/tests/src/GC/Scenarios/StringCreator
diff options
context:
space:
mode:
authorSean Gillespie <segilles@microsoft.com>2016-02-26 14:56:07 -0800
committerSean Gillespie <sean.william.g@gmail.com>2016-03-09 17:31:37 -0800
commitf7c51223d7b3a0153b002b30f619a7f02ff4fc99 (patch)
treee27ea40b3601cd864a336e7c29aef22f15e7be49 /tests/src/GC/Scenarios/StringCreator
parentf178841cda726a30b98ae42529b0cadb6a486151 (diff)
downloadcoreclr-f7c51223d7b3a0153b002b30f619a7f02ff4fc99.tar.gz
coreclr-f7c51223d7b3a0153b002b30f619a7f02ff4fc99.tar.bz2
coreclr-f7c51223d7b3a0153b002b30f619a7f02ff4fc99.zip
Initial bringup of new set of ported GC tests.
Diffstat (limited to 'tests/src/GC/Scenarios/StringCreator')
-rw-r--r--tests/src/GC/Scenarios/StringCreator/app.config31
-rw-r--r--tests/src/GC/Scenarios/StringCreator/stringcreator.cs103
-rw-r--r--tests/src/GC/Scenarios/StringCreator/stringcreator.csproj45
3 files changed, 179 insertions, 0 deletions
diff --git a/tests/src/GC/Scenarios/StringCreator/app.config b/tests/src/GC/Scenarios/StringCreator/app.config
new file mode 100644
index 0000000000..c51f616257
--- /dev/null
+++ b/tests/src/GC/Scenarios/StringCreator/app.config
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Globalization" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
diff --git a/tests/src/GC/Scenarios/StringCreator/stringcreator.cs b/tests/src/GC/Scenarios/StringCreator/stringcreator.cs
new file mode 100644
index 0000000000..5bc065ecae
--- /dev/null
+++ b/tests/src/GC/Scenarios/StringCreator/stringcreator.cs
@@ -0,0 +1,103 @@
+// 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.
+
+namespace DefaultNamespace {
+ using System;
+
+ public class StringCreator
+ {
+ internal String m_String;
+ internal String[] m_aString, m_aString1;
+ internal const int MAX_LENGTH = 2000;
+
+ public static int Main(String [] Args)
+ {
+ int iNofObjects = 0;
+ Console.WriteLine("Test should return with ExitCode 100 ...");
+
+ if (Args.Length==1)
+ {
+ if (!Int32.TryParse( Args[0], out iNofObjects ))
+ {
+ iNofObjects = 2;
+ }
+ }
+ else
+ {
+ iNofObjects = 2;
+ }
+
+
+ RunTest(iNofObjects);
+
+ return 100;
+ }
+
+ public static void RunTest(int iNofObjects)
+ {
+ for (int i = 0; i < iNofObjects; i++)
+ {
+ StringCreator sc = new StringCreator();
+ int slicer = 0;
+ String str;
+ sc.CreateString();
+ do
+ {
+ slicer = sc.SplitString(slicer);
+ str = sc.RotateStrings();
+ } while(String.Compare(String.Empty, "") != 0);
+
+ Console.WriteLine("\nslicer = {0}", slicer);
+ }
+ }
+
+ public void CreateString()
+ {
+ m_String = String.Empty;
+ Console.WriteLine("Creating Strings..");
+ for (int i = 0; i < MAX_LENGTH; i++)
+ {
+ if ( i%100 == 0)
+ {
+ Console.WriteLine("Created Strings: {0} : {1}", i, GC.GetTotalMemory(false));
+ }
+ m_String = m_String + Convert.ToString(i);
+ }
+ }
+
+
+ public int SplitString(int slicer)
+ {
+ char [] Sep = new char[1];
+ Sep[0] = (slicer.ToString())[0];
+ m_aString = m_String.Split(Sep);
+ slicer += 1;
+ if( slicer >= 10 )
+ {
+ slicer -=10;
+ }
+ return slicer;
+ }
+
+
+ public String RotateStrings()
+ {
+ m_String = String.Empty;
+ m_aString1 = new String[m_aString.Length];
+ Console.WriteLine("Creating More Strings..");
+ for (int i = 0; i < m_aString.Length; i++)
+ {
+ if (i%100 == 0)
+ {
+ Console.WriteLine("Created Strings: {0} : {1}", i, GC.GetTotalMemory(false));
+ }
+ m_aString1[i] = (m_aString[(m_aString.Length - 1) - i]);
+ m_String = m_String + m_aString[i];
+ m_aString1[i] = m_aString1[i % m_aString.Length] + m_aString1[i % m_aString.Length];
+ }
+
+ return m_String;
+ }
+ }
+}
diff --git a/tests/src/GC/Scenarios/StringCreator/stringcreator.csproj b/tests/src/GC/Scenarios/StringCreator/stringcreator.csproj
new file mode 100644
index 0000000000..6c2e49c997
--- /dev/null
+++ b/tests/src/GC/Scenarios/StringCreator/stringcreator.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </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="StringCreator.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="$(GCPackagesConfigFileDirectory)extra\project.json" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(GCPackagesConfigFileDirectory)extra\project.json</ProjectJson>
+ <ProjectLockJson>$(GCPackagesConfigFileDirectory)extra\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file