Skip to content

Commit

Permalink
Merge pull request #3 from jzebedee/net-core
Browse files Browse the repository at this point in the history
Migrate to .NET core
  • Loading branch information
jzebedee committed May 29, 2016
2 parents bf6232b + 00dd67e commit 8ed4c72
Show file tree
Hide file tree
Showing 23 changed files with 3,841 additions and 272 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,6 @@ $RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
*.snk
/.vs

*.lock.json
41 changes: 16 additions & 25 deletions deltaq-tests/BsDiffTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,18 @@
using System.IO.Compression;
using System.IO.MemoryMappedFiles;
using System.Linq;
using deltaq;
using NUnit.Framework;
using deltaq.BsDiff;
using Xunit;

namespace deltaq_tests
{
[TestFixture]
public class BsDiffTests
{
private static readonly int[] Sizes = { 0, 1, 512, 999, 1024, 0x10000 };

private static byte[] GetBuffer(int size)
{
var rand = SetupRandomizer();
var rand = new Random(63*13*63*13);

var buf = new byte[size];
rand.NextBytes(buf);
Expand All @@ -54,15 +53,7 @@ private static IEnumerable<byte[]> GetBuffers(IEnumerable<int> sizes)
return sizes.Select(GetBuffer);
}

private static Randomizer SetupRandomizer()
{
var seed = Randomizer.RandomSeed;
Console.WriteLine("Randomizer seed: {0}", seed);

return new Randomizer(seed);
}

[Test]
[Fact]
public void BsDiffCreateFromBuffers()
{
foreach (var oldBuffer in GetBuffers(Sizes))
Expand All @@ -71,11 +62,11 @@ public void BsDiffCreateFromBuffers()
var patchBuf = BsDiffCreate(oldBuffer, newBuffer);
var finishedBuf = BsDiffApply(oldBuffer, patchBuf);

Assert.AreEqual(newBuffer, finishedBuf);
Assert.Equal(newBuffer, finishedBuf);
}
}

[Test]
[Fact]
public void BsDiffCreateFromBuffers_Identical()
{
foreach (var oldBuffer in GetBuffers(Sizes))
Expand All @@ -86,12 +77,12 @@ public void BsDiffCreateFromBuffers_Identical()
var patchBuf = BsDiffCreate(oldBuffer, newBuffer);
var finishedBuf = BsDiffApply(oldBuffer, patchBuf);

Assert.AreEqual(oldBuffer, finishedBuf);
Assert.AreEqual(newBuffer, finishedBuf);
Assert.Equal(oldBuffer, finishedBuf);
Assert.Equal(newBuffer, finishedBuf);
}
}

[Test]
[Fact]
public void BsDiffCreateFromStreams()
{
const int outputSize = 0x2A000;
Expand All @@ -115,15 +106,15 @@ public void BsDiffCreateFromStreams()
}
}

Assert.AreEqual(newBuffer, bytesOut);
Assert.Equal(newBuffer, bytesOut);
}
}

[TestCaseSource(typeof(BsDiffTests), "BsDiffCreateNullArguments_TestData")]
[ExpectedException(typeof(ArgumentNullException))]
[Theory]
[MemberData(nameof(BsDiffCreateNullArguments_TestData))]
public void BsDiffCreateNullArguments(byte[] oldData, byte[] newData, Stream outStream)
{
BsDiff.Create(oldData, newData, outStream);
Assert.Throws<ArgumentNullException>(() => BsDiff.Create(oldData, newData, outStream));
}

private static IEnumerable BsDiffCreateNullArguments_TestData()
Expand All @@ -135,11 +126,11 @@ private static IEnumerable BsDiffCreateNullArguments_TestData()
yield return new object[] { emptybuf, emptybuf, null };
}

[TestCaseSource(typeof(BsDiffTests), "BsDiffCreateBadStreams_TestData")]
[ExpectedException(typeof(ArgumentException))]
[Theory]
[MemberData(nameof(BsDiffCreateBadStreams_TestData))]
public void BsDiffCreateBadStreams(byte[] oldData, byte[] newData, Stream outStream)
{
BsDiff.Create(oldData, newData, outStream);
Assert.Throws<ArgumentException>(() => BsDiff.Create(oldData, newData, outStream));
}

private static IEnumerable BsDiffCreateBadStreams_TestData()
Expand Down
28 changes: 6 additions & 22 deletions deltaq-tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// 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("deltaq-tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("deltaq-tests")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyProduct("deltaq_tests")]
[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
// 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("73c9d3aa-1d0f-49c4-907f-4a4f6696c7a6")]

// 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")]
[assembly: Guid("0fcb4753-5989-452d-a341-2a807bf4320c")]
91 changes: 0 additions & 91 deletions deltaq-tests/deltaq-tests.csproj

This file was deleted.

22 changes: 22 additions & 0 deletions deltaq-tests/deltaq-tests.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>0fcb4753-5989-452d-a341-2a807bf4320c</ProjectGuid>
<RootNamespace>deltaq_tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
4 changes: 0 additions & 4 deletions deltaq-tests/packages.config

This file was deleted.

20 changes: 20 additions & 0 deletions deltaq-tests/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "1.0.0-*",
"testRunner": "xunit",

"dependencies": {
"deltaq": "1.0.0-*",
"dotnet-test-xunit": "1.0.0-rc2-build10025",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
},
"xunit": "2.2.0-beta1-build3239"
},

"frameworks": {
"netcoreapp1.0": {
"imports": [ "dnxcore50", "portable-net46" ]
}
}
}
30 changes: 15 additions & 15 deletions deltaq.sln
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "deltaq", "deltaq\deltaq.csproj", "{9D7B540E-0FF6-4F88-B8D6-4DDCDA22AA91}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "deltaq-tests", "deltaq-tests\deltaq-tests.csproj", "{67322683-041F-4777-8202-01BF37B15640}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Publishing", "Publishing", "{AE6DCED3-6193-4DD6-A6F9-33536CA9C06A}"
ProjectSection(SolutionItems) = preProject
deltaq\deltaq.snk = deltaq\deltaq.snk
deltaq.snk = deltaq.snk
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "deltaq", "deltaq\deltaq.xproj", "{CE1513B6-2F66-4E62-BDD1-0C41D4433A51}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "deltaq-tests", "deltaq-tests\deltaq-tests.xproj", "{0FCB4753-5989-452D-A341-2A807BF4320C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9D7B540E-0FF6-4F88-B8D6-4DDCDA22AA91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D7B540E-0FF6-4F88-B8D6-4DDCDA22AA91}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D7B540E-0FF6-4F88-B8D6-4DDCDA22AA91}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D7B540E-0FF6-4F88-B8D6-4DDCDA22AA91}.Release|Any CPU.Build.0 = Release|Any CPU
{67322683-041F-4777-8202-01BF37B15640}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{67322683-041F-4777-8202-01BF37B15640}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67322683-041F-4777-8202-01BF37B15640}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67322683-041F-4777-8202-01BF37B15640}.Release|Any CPU.Build.0 = Release|Any CPU
{CE1513B6-2F66-4E62-BDD1-0C41D4433A51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE1513B6-2F66-4E62-BDD1-0C41D4433A51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE1513B6-2F66-4E62-BDD1-0C41D4433A51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE1513B6-2F66-4E62-BDD1-0C41D4433A51}.Release|Any CPU.Build.0 = Release|Any CPU
{0FCB4753-5989-452D-A341-2A807BF4320C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0FCB4753-5989-452D-A341-2A807BF4320C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FCB4753-5989-452D-A341-2A807BF4320C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FCB4753-5989-452D-A341-2A807BF4320C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading

0 comments on commit 8ed4c72

Please sign in to comment.