Skip to content

Commit

Permalink
Updated unit testing.
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
dlebansais committed Oct 30, 2017
1 parent 2486ba5 commit 7a3bf9d
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
language: csharp
solution: LargeList.sln
install:
- nuget restore LargeList.sln
- nuget install NUnit.ConsoleRunner -Version 3.7.0 -OutputDirectory testrunner
script:
- xbuild /p:Configuration=Release LargeList.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe ./LargeList/bin/x64/Release/Test-LargeList.dll
7 changes: 7 additions & 0 deletions LargeList/LargeList.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<Compile Include="LargeCollection.cs" />
<Compile Include="LargeCollectionDebugView.cs" />
<Compile Include="LargeList.cs" />
<Compile Include="LargeListAssemblyAttribute.cs" />
<Compile Include="PartitionEnumerator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReadOnlyLargeCollection.cs" />
Expand All @@ -58,6 +59,12 @@
<Compile Include="Partition.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>call "$(SolutionDir)updateversion.bat" "$(SolutionDir)" "$(SolutionPath)" "$(ProjectPath)"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>copy /Y "$(SolutionDir)Test\Test-LargeList.dll" "$(TargetDir)"</PostBuildEvent>
</PropertyGroup>
<!-- 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">
Expand Down
23 changes: 23 additions & 0 deletions LargeList/LargeListAssemblyAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;

namespace LargeList
{
/// <summary>
/// Custom attribute for the assembly.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
public class LargeListAssemblyAttribute : Attribute
{
internal const int GlobalDefaultMaxSegmentCapacity = 10;

/// <summary>
/// Indicates if the assembly was compiled in STRICT mode.
/// </summary>
public bool IsStrict { get; set; }

/// <summary>
/// Reports the default maximum capacity of a partition's segment.
/// </summary>
public int DefaultMaxSegmentCapacity { get; set; } = GlobalDefaultMaxSegmentCapacity;
}
}
2 changes: 1 addition & 1 deletion LargeList/Partition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public Partition(long capacity, long count)
/// <returns>
/// The maximum capacity allowed for segments.
/// </returns>
protected virtual int MaxSegmentCapacity { get { return 10; } }
protected virtual int MaxSegmentCapacity { get { return LargeListAssemblyAttribute.GlobalDefaultMaxSegmentCapacity; } }

/// <summary>
/// Gets the total number of elements the Partition&lt;T&gt; can hold without resizing.
Expand Down
23 changes: 10 additions & 13 deletions LargeList/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using LargeList;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand All @@ -14,6 +15,12 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

#if STRICT
[assembly: LargeListAssembly(IsStrict = true)]
#else
[assembly: LargeListAssembly(IsStrict = false, DefaultMaxSegmentCapacity = LargeListAssemblyAttribute.GlobalDefaultMaxSegmentCapacity)]
#endif

// 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.
Expand All @@ -22,15 +29,5 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("49708123-ffcc-4fda-9d6a-53d7d07fac52")]

// 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: AssemblyVersion("1.0.0.3")]
[assembly: AssemblyFileVersion("1.0.0.3")]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Status: Beta
Please wait a few days while I sort out unit tests, performance and doc.

Target framework: 4.5.2, Windows 64-bits only.
You can download the latest build [here](/Release/x64/LargeList.NET-4-5-2.x64.dll).
You can download the latest build [here](/Release/x64/LargeList.NET-4-5-2.x64.dll). Target framework: 4.5.2, Windows 64-bits only.

TODO list:
* [ ] Integrate unit testing with travis-ci.
Expand Down
Binary file modified Test/Test-LargeList.dll
Binary file not shown.
10 changes: 10 additions & 0 deletions updateversion.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if not exist "%~1\..\Version Tools\VersionBuilder.exe" goto error

"%~1\..\Version Tools\VersionBuilder.exe" %2 %3 %4
goto end

:error
echo Failed to update version.
goto end

:end

0 comments on commit 7a3bf9d

Please sign in to comment.