Skip to content

Commit

Permalink
use category for performance unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabien-chevalley committed Sep 28, 2017
1 parent 55440e6 commit cdca4e9
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 20 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
50 changes: 41 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,48 @@
bin
obj
Debug
*.suo
# DotNet sources
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

# Visual Studio 2015 cache/options directory
.vs/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

# Others
*.sdf
*.suo
*.filters
*.user
*.log
/Sources/Embedded/Release/*
/Sources/Embedded/DemoServer/Release/*
/Sources/Embedded/Server/Release/*
node_modules

.vs/
node_modules
2 changes: 1 addition & 1 deletion Sources/DotNet/WoopsaTest/UnitTestWoopsaObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void TestWoopsaObjects()
Assert.AreEqual(_maxLevel, 5.5);
}

[TestMethod]
[TestMethod, TestCategory("Performance")]
public void TestWoopsaObjectPerformance()
{
const int objectCount = 5000;
Expand Down
8 changes: 2 additions & 6 deletions Sources/DotNet/WoopsaTest/UnitTestWoopsaProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void TestWoopsaProtocolUnboundClient()
}
}

[TestMethod]
[TestMethod, TestCategory("Performance")]
public void TestWoopsaProtocolPerformance()
{
TestObjectServer objectServer = new TestObjectServer();
Expand All @@ -102,16 +102,12 @@ public void TestWoopsaProtocolPerformance()
Assert.AreEqual(result.ToInt64(), i);
}
TimeSpan duration = watch.Elapsed;
#if NET4_5
Assert.IsTrue(duration < TimeSpan.FromMilliseconds(200), $"Duration takes ${duration.Milliseconds}ms, instead of 200ms");
#elif NETCORE2
Assert.IsTrue(duration < TimeSpan.FromMilliseconds(800), $"Duration takes ${duration.Milliseconds}ms, instead of 800ms");
#endif
}
}
}

[TestMethod]
[TestMethod, TestCategory("Performance")]
public void TestWoopsaServerPerformance()
{
TestObjectServer objectServer = new TestObjectServer();
Expand Down
8 changes: 4 additions & 4 deletions Sources/DotNet/WoopsaTest/UnitTestWoopsaValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public void TestWoopsaValueExtended()
Assert.AreEqual(v.Type, WoopsaValueType.JsonData);
}

[TestMethod]
public void TestWoopsaValuePerfo()
[TestMethod, TestCategory("Performance")]
public void TestWoopsaValuePerformance()
{
Stopwatch watch = new Stopwatch();
watch.Start();
Expand Down Expand Up @@ -133,8 +133,8 @@ public void TestWoopsaValueCreateChecked()
}


[TestMethod]
public void TestWoopsaSerializationPerfo()
[TestMethod, TestCategory("Performance")]
public void TestWoopsaSerializationPerformance()
{
Stopwatch watch = new Stopwatch();
WoopsaValue v = 3.14;
Expand Down

0 comments on commit cdca4e9

Please sign in to comment.