Skip to content

Commit 0609289

Browse files
Merge pull request mdavid#1 from anders9ustafsson/master
Switch unit tests to NUnit
2 parents 38c64fe + d85df21 commit 0609289

29 files changed

Lines changed: 900 additions & 739 deletions

.gitignore

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
#################
2+
## Visual Studio
3+
#################
4+
5+
## Ignore Visual Studio temporary files, build results, and
6+
## files generated by popular Visual Studio add-ons.
7+
8+
# User-specific files
9+
*.suo
10+
*.user
11+
*.sln.docstates
12+
13+
# Build results
14+
15+
[Dd]ebug/
16+
[Rr]elease/
17+
x64/
18+
build/
19+
[Bb]in/
20+
[Oo]bj/
21+
22+
# MSTest test Results
23+
[Tt]est[Rr]esult*/
24+
[Bb]uild[Ll]og.*
25+
26+
*_i.c
27+
*_p.c
28+
*.ilk
29+
*.meta
30+
*.obj
31+
*.pch
32+
*.pdb
33+
*.pgc
34+
*.pgd
35+
*.rsp
36+
*.sbr
37+
*.tlb
38+
*.tli
39+
*.tlh
40+
*.tmp
41+
*.tmp_proj
42+
*.log
43+
*.vspscc
44+
*.vssscc
45+
.builds
46+
*.pidb
47+
*.log
48+
*.scc
49+
50+
# Visual C++ cache files
51+
ipch/
52+
*.aps
53+
*.ncb
54+
*.opensdf
55+
*.sdf
56+
*.cachefile
57+
58+
# Visual Studio profiler
59+
*.psess
60+
*.vsp
61+
*.vspx
62+
63+
# Guidance Automation Toolkit
64+
*.gpState
65+
66+
# ReSharper is a .NET coding add-in
67+
_ReSharper*/
68+
*.[Rr]e[Ss]harper
69+
70+
# TeamCity is a build add-in
71+
_TeamCity*
72+
73+
# DotCover is a Code Coverage Tool
74+
*.dotCover
75+
76+
# NCrunch
77+
*.ncrunch*
78+
.*crunch*.local.xml
79+
80+
# Installshield output folder
81+
[Ee]xpress/
82+
83+
# DocProject is a documentation generator add-in
84+
DocProject/buildhelp/
85+
DocProject/Help/*.HxT
86+
DocProject/Help/*.HxC
87+
DocProject/Help/*.hhc
88+
DocProject/Help/*.hhk
89+
DocProject/Help/*.hhp
90+
DocProject/Help/Html2
91+
DocProject/Help/html
92+
93+
# Click-Once directory
94+
publish/
95+
96+
# Publish Web Output
97+
*.Publish.xml
98+
*.pubxml
99+
*.publishproj
100+
101+
# NuGet Packages Directory
102+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
103+
[Pp]ackages/
104+
105+
# Windows Azure Build Output
106+
csx
107+
*.build.csdef
108+
109+
# Windows Store app package directory
110+
AppPackages/
111+
112+
# Others
113+
sql/
114+
*.Cache
115+
ClientBin/
116+
[Ss]tyle[Cc]op.*
117+
~$*
118+
*~
119+
*.dbmdl
120+
*.[Pp]ublish.xml
121+
*.pfx
122+
*.publishsettings
123+
124+
# RIA/Silverlight projects
125+
Generated_Code/
126+
127+
# Backup & report files from converting an old project file to a newer
128+
# Visual Studio version. Backup files are not needed, because we have git ;-)
129+
_UpgradeReport_Files/
130+
Backup*/
131+
UpgradeLog*.XML
132+
UpgradeLog*.htm
133+
134+
# SQL Server files
135+
App_Data/*.mdf
136+
App_Data/*.ldf
137+
138+
#############
139+
## Windows detritus
140+
#############
141+
142+
# Windows image file caches
143+
Thumbs.db
144+
ehthumbs.db
145+
146+
# Folder config file
147+
Desktop.ini
148+
149+
# Recycle Bin used on file shares
150+
$RECYCLE.BIN/
151+
152+
# Mac crap
153+
.DS_Store
154+
Sources/Controls/AForge.Controls.xml
155+
Sources/Core/AForge.xml
156+
Sources/Fuzzy/AForge.Fuzzy.xml
157+
Sources/Genetic/AForge.Genetic.xml
158+
Sources/Imaging.Formats/AForge.Imaging.Formats.xml
159+
Sources/Imaging/AForge.Imaging.xml
160+
Sources/MachineLearning/AForge.MachineLearning.xml
161+
Sources/Math/AForge.Math.xml
162+
Sources/Neuro/AForge.Neuro.xml
163+
Sources/Robotics.Lego/AForge.Robotics.Lego.xml
164+
Sources/Robotics.Surveyor/AForge.Robotics.Surveyor.xml
165+
Sources/Video.DirectShow/AForge.Video.DirectShow.xml
166+
Sources/Video.Kinect/AForge.Video.Kinect.xml
167+
Sources/Video.VFW/AForge.Video.VFW.xml
168+
Sources/Video.Ximea/AForge.Video.Ximea.xml
169+
Sources/Video/AForge.Video.xml
170+
Sources/Vision/AForge.Vision.xml

Unit Tests/AForge.Imaging.Tests/AForge.Imaging.Tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,8 @@
5858
<SpecificVersion>False</SpecificVersion>
5959
<HintPath>..\..\Release\AForge.Imaging.dll</HintPath>
6060
</Reference>
61-
<Reference Include="Gallio, Version=3.1.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL">
62-
<SpecificVersion>False</SpecificVersion>
63-
</Reference>
64-
<Reference Include="MbUnit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL">
65-
<SpecificVersion>False</SpecificVersion>
61+
<Reference Include="nunit.framework">
62+
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
6663
</Reference>
6764
<Reference Include="System" />
6865
<Reference Include="System.Core">
@@ -99,6 +96,9 @@
9996
<Install>true</Install>
10097
</BootstrapperPackage>
10198
</ItemGroup>
99+
<ItemGroup>
100+
<None Include="packages.config" />
101+
</ItemGroup>
102102
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
103103
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
104104
Other similar extension points exist, see Microsoft.Common.targets.

Unit Tests/AForge.Imaging.Tests/IntegralImageTest.cs

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Drawing.Imaging;
55
using AForge;
66
using AForge.Imaging;
7-
using MbUnit.Framework;
7+
using NUnit.Framework;
88

99
namespace AForge.Imaging.Tests
1010
{
@@ -29,99 +29,99 @@ public IntegralImageTest( )
2929
}
3030

3131
[Test]
32-
[Row( 0, 0, 0, 0, 0 )]
33-
[Row( 0, 0, 1, 0, 1 )]
34-
[Row( 0, 0, 0, 1, 1 )]
35-
[Row( 0, 0, 1, 1, 2 )]
36-
[Row( -1, -1, 1, 1, 2 )]
37-
[Row( 0, 0, 9, 9, 50 )]
38-
[Row( 9, 9, 9, 9, 0 )]
39-
[Row( 9, 9, 10, 10, 0 )]
32+
[TestCase( 0, 0, 0, 0, 0u )]
33+
[TestCase( 0, 0, 1, 0, 1u )]
34+
[TestCase( 0, 0, 0, 1, 1u )]
35+
[TestCase( 0, 0, 1, 1, 2u )]
36+
[TestCase( -1, -1, 1, 1, 2u )]
37+
[TestCase( 0, 0, 9, 9, 50u )]
38+
[TestCase( 9, 9, 9, 9, 0u )]
39+
[TestCase( 9, 9, 10, 10, 0u )]
4040
public void GetRectangleSumTest( int x1, int y1, int x2, int y2, uint expectedSum )
4141
{
4242
uint sum = integralImage.GetRectangleSum( x1, y1, x2, y2 );
43-
Assert.AreEqual<uint>( sum, expectedSum );
43+
Assert.AreEqual( sum, expectedSum );
4444
}
4545

4646
[Test]
47-
[Row( 0, 0, 0, 0, 0 )]
48-
[Row( 0, 0, 1, 0, 1 )]
49-
[Row( 0, 0, 0, 1, 1 )]
50-
[Row( 0, 0, 1, 1, 2 )]
51-
[Row( 0, 0, 9, 9, 50 )]
52-
[Row( 9, 9, 9, 9, 0 )]
47+
[TestCase( 0, 0, 0, 0, 0u )]
48+
[TestCase( 0, 0, 1, 0, 1u )]
49+
[TestCase( 0, 0, 0, 1, 1u )]
50+
[TestCase( 0, 0, 1, 1, 2u )]
51+
[TestCase( 0, 0, 9, 9, 50u )]
52+
[TestCase( 9, 9, 9, 9, 0u )]
5353
public void GetRectangleSumUnsafeTest( int x1, int y1, int x2, int y2, uint expectedSum )
5454
{
5555
uint sum = integralImage.GetRectangleSum( x1, y1, x2, y2 );
56-
Assert.AreEqual<uint>( sum, expectedSum );
56+
Assert.AreEqual( sum, expectedSum );
5757
}
5858

5959
[Test]
60-
[Row( 0, 0, 1, 2 )]
61-
[Row( 1, 1, 1, 4 )]
62-
[Row( 9, 9, 1, 2 )]
63-
[Row( 8, 8, 1, 4 )]
64-
[Row( 2, 1, 1, 5 )]
60+
[TestCase( 0, 0, 1, 2u )]
61+
[TestCase( 1, 1, 1, 4u )]
62+
[TestCase( 9, 9, 1, 2u )]
63+
[TestCase( 8, 8, 1, 4u )]
64+
[TestCase( 2, 1, 1, 5u )]
6565
public void GetRectangleSumTest( int x, int y, int radius, uint expectedSum )
6666
{
6767
uint sum = integralImage.GetRectangleSum( x, y, radius );
68-
Assert.AreEqual<uint>( sum, expectedSum );
68+
Assert.AreEqual( sum, expectedSum );
6969
}
7070

7171
[Test]
72-
[Row( 1, 1, 1, 4 )]
73-
[Row( 8, 8, 1, 4 )]
74-
[Row( 2, 1, 1, 5 )]
72+
[TestCase( 1, 1, 1, 4u )]
73+
[TestCase( 8, 8, 1, 4u )]
74+
[TestCase( 2, 1, 1, 5u )]
7575
public void GetRectangleSumUnsafeTest( int x, int y, int radius, uint expectedSum )
7676
{
7777
uint sum = integralImage.GetRectangleSum( x, y, radius );
78-
Assert.AreEqual<uint>( sum, expectedSum );
78+
Assert.AreEqual( sum, expectedSum );
7979
}
8080

8181
[Test]
82-
[Row( 0, 0, 0, 0, 0 )]
83-
[Row( 0, 0, 1, 0, 0.5 )]
84-
[Row( 0, 0, 0, 1, 0.5 )]
85-
[Row( 0, 0, 1, 1, 0.5 )]
86-
[Row( -1, -1, 1, 1, 0.5 )]
87-
[Row( 0, 0, 9, 9, 0.5 )]
88-
[Row( 9, 9, 9, 9, 0 )]
89-
[Row( 9, 9, 10, 10, 0 )]
90-
[Row( 9, 0, 9, 0, 1 )]
82+
[TestCase( 0, 0, 0, 0, 0 )]
83+
[TestCase( 0, 0, 1, 0, 0.5f )]
84+
[TestCase( 0, 0, 0, 1, 0.5f )]
85+
[TestCase( 0, 0, 1, 1, 0.5f )]
86+
[TestCase( -1, -1, 1, 1, 0.5f )]
87+
[TestCase( 0, 0, 9, 9, 0.5f )]
88+
[TestCase( 9, 9, 9, 9, 0 )]
89+
[TestCase( 9, 9, 10, 10, 0 )]
90+
[TestCase( 9, 0, 9, 0, 1 )]
9191
public void GetRectangleMeanTest( int x1, int y1, int x2, int y2, float expectedMean )
9292
{
9393
float mean = integralImage.GetRectangleMean( x1, y1, x2, y2 );
94-
Assert.AreEqual<float>( mean, expectedMean );
94+
Assert.AreEqual( mean, expectedMean );
9595
}
9696

9797
[Test]
98-
[Row( 1, 1, 1, 0 )]
99-
[Row( 1, 2, 1, 0 )]
100-
[Row( 2, 2, 1, 0 )]
101-
[Row( 2, 2, 2, 0 )]
102-
[Row( 8, 8, 1, 0 )]
103-
[Row( 5, 5, 5, 0 )]
104-
[Row( 0, 1, 1, 1 )]
105-
[Row( 10, 9, 1, -1 )]
98+
[TestCase( 1, 1, 1, 0 )]
99+
[TestCase( 1, 2, 1, 0 )]
100+
[TestCase( 2, 2, 1, 0 )]
101+
[TestCase( 2, 2, 2, 0 )]
102+
[TestCase( 8, 8, 1, 0 )]
103+
[TestCase( 5, 5, 5, 0 )]
104+
[TestCase( 0, 1, 1, 1 )]
105+
[TestCase( 10, 9, 1, -1 )]
106106
public void GetHaarXWavelet( int x, int y, int radius, int expectedValue )
107107
{
108108
int value = integralImage.GetHaarXWavelet( x, y, radius );
109-
Assert.AreEqual<int>( value, expectedValue );
109+
Assert.AreEqual( value, expectedValue );
110110
}
111111

112112
[Test]
113-
[Row( 1, 1, 1, 0 )]
114-
[Row( 1, 2, 1, 0 )]
115-
[Row( 2, 2, 1, 0 )]
116-
[Row( 2, 2, 2, 0 )]
117-
[Row( 8, 8, 1, 0 )]
118-
[Row( 5, 5, 5, 0 )]
119-
[Row( 1, 0, 1, 1 )]
120-
[Row( 9, 10, 1, -1 )]
113+
[TestCase( 1, 1, 1, 0 )]
114+
[TestCase( 1, 2, 1, 0 )]
115+
[TestCase( 2, 2, 1, 0 )]
116+
[TestCase( 2, 2, 2, 0 )]
117+
[TestCase( 8, 8, 1, 0 )]
118+
[TestCase( 5, 5, 5, 0 )]
119+
[TestCase( 1, 0, 1, 1 )]
120+
[TestCase( 9, 10, 1, -1 )]
121121
public void GetHaarYWavelet( int x, int y, int radius, int expectedValue )
122122
{
123123
int value = integralImage.GetHaarYWavelet( x, y, radius );
124-
Assert.AreEqual<int>( value, expectedValue );
124+
Assert.AreEqual( value, expectedValue );
125125
}
126126
}
127127
}

0 commit comments

Comments
 (0)