Permalink
Browse files

Adding in get/set of 2D array since this was having problems, but no …

…longer.
  • Loading branch information...
kaby76 committed Mar 29, 2018
1 parent d81831c commit 1284d27c71c925214f1981a27e502885ba857473
Showing with 79 additions and 0 deletions.
  1. +15 −0 Campy.sln
  2. +23 −0 Tests/TwoDimArrayGetAndSet/TwoDimArrayGetAndSet.csproj
  3. +41 −0 Tests/TwoDimArrayGetAndSet/UnitTest1.cs
View
@@ -85,6 +85,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArrayOfRefs", "Tests\ArrayO
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Scan", "Tests\Scan\Scan.csproj", "{E41667EC-8255-4C39-8DEA-E31FCF2A38FF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TwoDimArrayGetAndSet", "Tests\TwoDimArrayGetAndSet\TwoDimArrayGetAndSet.csproj", "{832A493B-775F-472D-A93F-0A48006554DA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -468,6 +470,18 @@ Global
{E41667EC-8255-4C39-8DEA-E31FCF2A38FF}.Release|x64.Build.0 = Release|Any CPU
{E41667EC-8255-4C39-8DEA-E31FCF2A38FF}.Release|x86.ActiveCfg = Release|Any CPU
{E41667EC-8255-4C39-8DEA-E31FCF2A38FF}.Release|x86.Build.0 = Release|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Debug|x64.ActiveCfg = Debug|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Debug|x64.Build.0 = Debug|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Debug|x86.ActiveCfg = Debug|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Debug|x86.Build.0 = Debug|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Release|Any CPU.Build.0 = Release|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Release|x64.ActiveCfg = Release|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Release|x64.Build.0 = Release|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Release|x86.ActiveCfg = Release|Any CPU
{832A493B-775F-472D-A93F-0A48006554DA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -496,6 +510,7 @@ Global
{3F9F084B-A671-4637-991D-0B963AC48B0B} = {FD8F0C87-ED6C-498A-BE3A-B3B7F5B035C6}
{8C811F6E-C9AA-4797-8B23-188011C52FB1} = {FD8F0C87-ED6C-498A-BE3A-B3B7F5B035C6}
{E41667EC-8255-4C39-8DEA-E31FCF2A38FF} = {FD8F0C87-ED6C-498A-BE3A-B3B7F5B035C6}
{832A493B-775F-472D-A93F-0A48006554DA} = {FD8F0C87-ED6C-498A-BE3A-B3B7F5B035C6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7839B59F-A0C2-4484-BEC1-39F0DAEE8A8D}
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Campy\Campy.csproj" />
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>copy "$(SolutionDir)Campy.Runtime\Corlib\bin\Debug\net20\*.*" &amp;&amp; copy "$(SolutionDir)x64\Debug\*.*"</PostBuildEvent>
</PropertyGroup>
</Project>
@@ -0,0 +1,41 @@
using System;
using Xunit;
namespace TwoDimArrayGetAndSet
{
public class UnitTest1
{
[Fact]
public void Test1()
{
{
int ex0 = 3;
int ex1 = 5;
// three rows, five columns.
int[,] b = new int[ex0, ex1];
for (int d = 0; d < ex0 * ex1; ++d)
{
int i = d / ex1;
int j = d % ex1;
b[i, j] = d;
}
int[,] c = new int[ex0, ex1];
Campy.Parallel.For(15, d =>
{
int i = d / ex1;
int j = d % ex1;
c[i, j] = b[i, j];
});
for (int d = 0; d < ex0 * ex1; ++d)
{
int i = d / ex1;
int j = d % ex1;
if (b[i, j] != c[i, j])
throw new Exception();
}
}
}
}
}

0 comments on commit 1284d27

Please sign in to comment.