This commit is contained in:
Dmitry Voytsekhovskiy 2016-03-16 15:36:50 +03:00
Родитель 7d44bc99a5
Коммит a35bbdbdf8
7 изменённых файлов: 0 добавлений и 323 удалений

Просмотреть файл

@ -1,94 +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="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F05CE339-15D8-4980-BBE1-845878DB15F1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Angara.Table.TestsC</RootNamespace>
<AssemblyName>Angara.Table.TestsC</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Angara.Serialization, Version=0.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\ext\nuget\Angara.Serialization.0.1.2.0\lib\net461\Angara.Serialization.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="nunit.core, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\ext\nuget\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="nunit.core.interfaces, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\ext\nuget\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\ext\nuget\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.util, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\ext\nuget\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NUnit.VisualStudio.TestAdapter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4cb40d35494691ac, processorArchitecture=MSIL">
<HintPath>..\..\ext\nuget\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Common.cs" />
<Compile Include="Csv.cs" />
<Compile Include="TableTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Angara.Table\Angara.Table.fsproj">
<Project>{3ef758e5-f5fe-40ef-8364-fe29f9338d79}</Project>
<Name>Angara.Table</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -1,58 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.FSharp.Core;
using NUnit.Framework;
namespace Angara.Data.TestsC
{
public static class Common
{
public static Random random = new Random();
public static string RandomString(Random random, int length)
{
var chars = "ABCDEFGHIJKLMNOPQRSTUVWUXYZ0123456789";
var rndChars = Enumerable.Range(0, length).Select(i => chars[random.Next(chars.Length)]).ToArray();
return new string(rndChars);
}
public static DateTime RandomDate(Random random)
{
var start = new DateTime(0);
var range = (DateTime.Today - start).Days;
return start.AddDays(random.Next(range));
}
public static double[] RandomDoubleArray(Random random, int length)
{
return Enumerable.Range(0, length).Select(i => random.NextDouble()).ToArray();
}
public static int[] RandomIntArray(Random random, int length)
{
return Enumerable.Range(0, length).Select(i => random.Next()).ToArray();
}
public static string[] RandomStringArray(Random random, int length1, int length2)
{
return Enumerable.Range(0, length1).Select(i => RandomString(random, length2).ToLower()).ToArray();
}
public static DateTime[] RandomDateArray(Random random, int length1)
{
return Enumerable.Range(0, length1).Select(i => RandomDate(random)).ToArray();
}
public static void TestOptionArraySome<T, U>(T[] expected, FSharpOption<U> actual)
{
Assert.IsTrue(FSharpOption<U>.get_IsSome(actual));
Assert.AreEqual(expected, actual.Value);
}
}
}

Просмотреть файл

@ -1,54 +0,0 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Angara;
namespace Angara.Data.TestsC
{
using Angara.Data;
[TestFixture]
public static class CsvTests
{
public static Stream AsStream(string content)
{
var ms = new MemoryStream();
var sw = new StreamWriter(ms);
sw.Write(content);
sw.Flush();
ms.Position = 0;
return ms;
}
public static string[] SplitRowStr(char delimiter, string row) {
using (var s = AsStream(row)) {
var r = new StreamReader(s);
var items = DelimitedFile.Helpers.splitRow(delimiter, r);
if (Microsoft.FSharp.Core.FSharpOption<string[]>.get_IsSome(items))
return items.Value;
else
return null;
}
}
// public static void TestCsvReadWithUserDefinedTypes()
// {
// using (var s = AsStream(
//@"x,y
//1,a
//2,b
//3,c"))
// {
// var settings = new Csv.ReadSettings(Csv.Delimiter.Comma, false, null,
// new Microsoft.FSharp.Core.FSharpOption((colIndex, colName) => null));
// var result = Csv.Read(settings, s);
// }
// }
}
}

Просмотреть файл

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Angara.Data.TestsC")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Angara.Data.TestsC")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("20d1292f-2ab7-4e65-9b8f-e114a68c2a86")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -1,64 +0,0 @@
using Angara.Data;
using Microsoft.FSharp.Core;
using NUnit.Framework;
using System;
namespace Angara.Data.TestsC
{
[TestFixture]
public class TableTests
{
[Test]
public void TableC_TestEmpty()
{
var table0 = Table.Empty;
Assert.AreEqual(new string[] {}, table0.Names);
Assert.AreEqual(new Column[] {}, table0.Columns);
Assert.AreEqual(new Type[] {}, table0.Types);
Assert.AreEqual(0, table0.Count);
}
public void TestColumn(int[] data, Table table, string columnName)
{
Assert.AreEqual(typeof(Int32), Table.Type(columnName, table));
Assert.AreEqual(FSharpOption<int>.None, Table.TryItem<int>(columnName, -1, table));
for (int i = 0; i < data.Length; i++)
{
Assert.AreEqual(FSharpOption<int>.Some(data[i]), Table.TryItem<int>(columnName, i, table));
}
Assert.AreEqual(FSharpOption<int>.None, Table.TryItem<int>(columnName, data.Length, table));
for (int i = 0; i < data.Length; i++)
{
Assert.AreEqual(data[i], Table.Item<int>(columnName, i, table));
}
}
[Test]
public void TableC_TestAddOneColumn()
{
var data = new int[100];
var random = new Random();
for (int i = 0; i < data.Length; i++)
{
data[i] = random.Next();
}
var column0 = Column.New<int[]>(data);
var table0 = Table.Empty;
var table1 = Table.Add("col1", column0, table0);
Assert.AreEqual(new string[] { "col1" }, table1.Names);
Assert.AreEqual(new Column[] { column0 } , table1.Columns);
Assert.AreEqual(new Type[] { typeof(Int32) }, table1.Types);
Assert.AreEqual(data.Length, table1.Count);
var column01 = Table.Column("col1", table1);
Assert.AreEqual(column0, column01);
TestColumn(data, table1, "col1");
}
}
}

Просмотреть файл

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Angara.Serialization" version="0.1.2.0" targetFramework="net461" />
<package id="NUnit" version="2.6.4" targetFramework="net452" />
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net461" />
</packages>