Browse Source

Upgrade FsUnit (now as NuGet package)

v2
Christoph Ruegg 13 years ago
parent
commit
d9518826be
  1. BIN
      packages/FsUnit.1.2.1.0/FsUnit.1.2.1.0.nupkg
  2. 22
      packages/FsUnit.1.2.1.0/FsUnit.1.2.1.0.nuspec
  3. BIN
      packages/FsUnit.1.2.1.0/Lib/Net20/FsUnit.NUnit.dll
  4. BIN
      packages/FsUnit.1.2.1.0/Lib/Net40/FsUnit.NUnit.dll
  5. 3
      packages/FsUnit.1.2.1.0/tools/install.ps1
  6. 18
      src/FSharpPortableUnitTests/App.config
  7. 7
      src/FSharpPortableUnitTests/FSharpPortableUnitTests.fsproj
  8. 1
      src/FSharpPortableUnitTests/packages.config
  9. 13
      src/FSharpUnitTests/App.config
  10. 6
      src/FSharpUnitTests/FSharpUnitTests.fsproj
  11. 70
      src/FSharpUnitTests/FsUnit.fs
  12. 8
      src/FSharpUnitTests/MatrixTests.fs
  13. 10
      src/FSharpUnitTests/VectorTests.fs
  14. 1
      src/FSharpUnitTests/packages.config

BIN
packages/FsUnit.1.2.1.0/FsUnit.1.2.1.0.nupkg

Binary file not shown.

22
packages/FsUnit.1.2.1.0/FsUnit.1.2.1.0.nuspec

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>FsUnit</id>
<version>1.2.1.0</version>
<title>FsUnit</title>
<authors>Ray Vernagus and Daniel Mohl</authors>
<owners>Ray Vernagus and Daniel Mohl</owners>
<licenseUrl>http://fsunit.codeplex.com/license</licenseUrl>
<projectUrl>http://fsunit.codeplex.com/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>FsUnit is a set of extensions that add special testing syntax to NUnit.</description>
<summary>The goals of FsUnit are to make unit-testing feel more functional while leverage existing testing frameworks.</summary>
<releaseNotes />
<copyright />
<language>en-US</language>
<tags>F# fsharp NUnit FsUnit</tags>
<dependencies>
<dependency id="NUnit" version="2.6.2" />
</dependencies>
</metadata>
</package>

BIN
packages/FsUnit.1.2.1.0/Lib/Net20/FsUnit.NUnit.dll

Binary file not shown.

BIN
packages/FsUnit.1.2.1.0/Lib/Net40/FsUnit.NUnit.dll

Binary file not shown.

3
packages/FsUnit.1.2.1.0/tools/install.ps1

@ -0,0 +1,3 @@
param($rootPath, $toolsPath, $package, $project)
Add-BindingRedirect $project.Name

18
src/FSharpPortableUnitTests/App.config

@ -1,11 +1,13 @@
<?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.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="2.3.5.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

7
src/FSharpPortableUnitTests/FSharpPortableUnitTests.fsproj

@ -39,6 +39,10 @@
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" Condition=" Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')" />
<ItemGroup>
<Reference Include="FSharp.Core" />
<Reference Include="FsUnit.NUnit">
<HintPath>..\..\packages\FsUnit.1.2.1.0\Lib\Net40\FsUnit.NUnit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<HintPath>..\..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
@ -58,9 +62,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\FSharpUnitTests\FsUnit.fs">
<Link>FsUnit.fs</Link>
</Compile>
<Compile Include="..\FSharpUnitTests\VectorTests.fs">
<Link>VectorTests.fs</Link>
</Compile>

1
src/FSharpPortableUnitTests/packages.config

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FsUnit" version="1.2.1.0" targetFramework="net45" />
<package id="NUnit" version="2.6.2" targetFramework="net45" />
</packages>

13
src/FSharpUnitTests/App.config

@ -0,0 +1,13 @@
<?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="4.0.0.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="2.3.5.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

6
src/FSharpUnitTests/FSharpUnitTests.fsproj

@ -46,6 +46,10 @@
<Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" Condition="(!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')) And (!Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets')) And (Exists('$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets'))" />
<ItemGroup>
<Reference Include="FSharp.Core" />
<Reference Include="FsUnit.NUnit">
<HintPath>..\..\packages\FsUnit.1.2.1.0\Lib\Net40\FsUnit.NUnit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<HintPath>..\..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
@ -65,7 +69,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="FsUnit.fs" />
<Compile Include="VectorTests.fs" />
<Compile Include="SparseVectorTests.fs" />
<Compile Include="DenseVectorTests.fs" />
@ -78,6 +81,7 @@
<Compile Include="PokerTests.fs" />
<Compile Include="CurveFittingTests.fs" />
<None Include="packages.config" />
<None Include="App.config" />
</ItemGroup>
<!-- 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.

70
src/FSharpUnitTests/FsUnit.fs

@ -1,70 +0,0 @@
module FsUnit
open NUnit.Framework
open NUnit.Framework.Constraints
let should (f : 'a -> #Constraint) x (y : obj) =
let c = f x
let y =
match y with
| :? (unit -> unit) -> box (TestDelegate(y :?> unit -> unit))
| _ -> y
Assert.That(y, c)
let equal x = EqualConstraint(x)
let equalWithin tolerance x = equal(x).Within tolerance
let contain x = ContainsConstraint(x)
let haveLength n = Has.Length.EqualTo(n)
let haveCount n = Has.Count.EqualTo(n)
let be = id
let Null = NullConstraint()
let Empty = EmptyConstraint()
let EmptyString = EmptyStringConstraint()
let NullOrEmptyString = NullOrEmptyStringConstraint()
let True = TrueConstraint()
let False = FalseConstraint()
let sameAs x = SameAsConstraint(x)
let throw = Throws.TypeOf
let greaterThan x = GreaterThanConstraint(x)
let greaterThanOrEqualTo x = GreaterThanOrEqualConstraint(x)
let lessThan x = LessThanConstraint(x)
let lessThanOrEqualTo x = LessThanOrEqualConstraint(x)
let shouldFail (f : unit -> unit) =
TestDelegate(f) |> should throw typeof<AssertionException>
let endWith (s:string) = EndsWithConstraint s
let startWith (s:string) = StartsWithConstraint s
let ofExactType<'a> = ExactTypeConstraint(typeof<'a>)
let instanceOfType<'a> = InstanceOfTypeConstraint(typeof<'a>)
let NaN = NaNConstraint()
let unique = UniqueItemsConstraint()
let not' x = NotConstraint(x)
let array_equal = equal
let array2_equal = equal
let approximately_equal tolerance = equalWithin (10.0 ** (float -tolerance))
let approximately_vector_equal = approximately_equal
let approximately_matrix_equal = approximately_equal

8
src/FSharpUnitTests/MatrixTests.fs

@ -8,6 +8,8 @@ open MathNet.Numerics.LinearAlgebra.Double
/// Unit tests for the matrix type.
module MatrixTests =
let approximately_equal tolerance = equalWithin (10.0 ** (float -tolerance))
/// A small uniform vector.
let smallM = DenseMatrix.OfArray( Array2D.create 2 2 0.3 )
let failingFoldBackM = DenseMatrix.init 2 3 (fun i j -> 1.0)
@ -46,7 +48,7 @@ module MatrixTests =
[<Test>]
let ``Matrix.toArray2`` () =
Matrix.toArray2 smallM |> should array2_equal (Array2D.create 2 2 0.3)
Matrix.toArray2 smallM |> should equal (Array2D.create 2 2 0.3)
[<Test>]
let ``Matrix.mapInPlace.Dense`` () =
@ -102,11 +104,11 @@ module MatrixTests =
[<Test>]
let ``Matrix.mapCols`` () =
Matrix.mapCols (fun j col -> col.Add(float j)) smallM |> should (approximately_matrix_equal 14) (matrix [[0.3;1.3];[0.3;1.3]])
Matrix.mapCols (fun j col -> col.Add(float j)) smallM |> should (approximately_equal 14) (matrix [[0.3;1.3];[0.3;1.3]])
[<Test>]
let ``Matrix.mapRows`` () =
Matrix.mapRows (fun i row -> row.Add(float i)) smallM |> should (approximately_matrix_equal 14) (matrix [[0.3;0.3];[1.3;1.3]])
Matrix.mapRows (fun i row -> row.Add(float i)) smallM |> should (approximately_equal 14) (matrix [[0.3;0.3];[1.3;1.3]])
[<Test>]
let ``Matrix.fold`` () =

10
src/FSharpUnitTests/VectorTests.fs

@ -8,6 +8,8 @@ open MathNet.Numerics.LinearAlgebra.Double
/// Unit tests for the vector type.
module VectorTests =
let approximately_equal tolerance = equalWithin (10.0 ** (float -tolerance))
/// A small uniform vector.
let smallv = DenseVector([|0.3;0.3;0.3;0.3;0.3|])
@ -45,7 +47,7 @@ module VectorTests =
[<Test>]
let ``Vector.toArray`` () =
Vector.toArray smallv |> should array_equal [|0.3;0.3;0.3;0.3;0.3|]
Vector.toArray smallv |> should equal [|0.3;0.3;0.3;0.3;0.3|]
[<Test>]
let ``Vector.toList`` () =
@ -145,11 +147,11 @@ module VectorTests =
[<Test>]
let ``Vector.scan`` () =
Vector.scan (fun acc x -> acc + x) smallv |> should (approximately_vector_equal 14) (new DenseVector( [|0.3;0.6;0.9;1.2;1.5|] ) :> Vector<float>)
Vector.scan (fun acc x -> acc + x) smallv |> should (approximately_equal 14) (new DenseVector( [|0.3;0.6;0.9;1.2;1.5|] ) :> Vector<float>)
[<Test>]
let ``Vector.scanBack`` () =
Vector.scanBack (fun x acc -> acc + x) smallv |> should (approximately_vector_equal 14) (new DenseVector( [|1.5;1.2;0.9;0.6;0.3|] ) :> Vector<float>)
Vector.scanBack (fun x acc -> acc + x) smallv |> should (approximately_equal 14) (new DenseVector( [|1.5;1.2;0.9;0.6;0.3|] ) :> Vector<float>)
[<Test>]
let ``Vector.reduce`` () =
@ -161,4 +163,4 @@ module VectorTests =
[<Test>]
let ``Vector.insert`` () =
Vector.insert 2 0.5 smallv |> should (approximately_vector_equal 14) (new DenseVector ( [|0.3;0.3;0.5;0.3;0.3;0.3|] ) :> Vector<float>)
Vector.insert 2 0.5 smallv |> should (approximately_equal 14) (new DenseVector ( [|0.3;0.3;0.5;0.3;0.3;0.3|] ) :> Vector<float>)

1
src/FSharpUnitTests/packages.config

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FsUnit" version="1.2.1.0" targetFramework="net40" />
<package id="NUnit" version="2.6.2" targetFramework="net40" />
</packages>
Loading…
Cancel
Save