-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
235 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...sions/FileProviders/WebHdfs/WebHdfs.Extensions.FileProviders/VisiableToUnitTestProject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
// <copyright file="VisiableToUnitTestProject.cs" company="Shuai Zhang"> | ||
// Copyright Shuai Zhang. All rights reserved. | ||
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("WebHdfs.Extensions.FileProviders.UnitTest")] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 40 additions & 34 deletions
74
PhiFailureDetector/PhiFailureDetector.UnitTest/LongIntervalHistory_UnitTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,40 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace PhiFailureDetector.UnitTest | ||
{ | ||
[TestClass] | ||
public class LongIntervalHistory_UnitTest | ||
{ | ||
[TestMethod] | ||
public void Test_Baseline() | ||
{ | ||
var arrivalWindow = new LongIntervalHistory(5); | ||
|
||
arrivalWindow.Enqueue(1); | ||
arrivalWindow.Enqueue(2); | ||
arrivalWindow.Enqueue(3); | ||
arrivalWindow.Enqueue(4); | ||
arrivalWindow.Enqueue(5); | ||
arrivalWindow.Enqueue(6); | ||
arrivalWindow.Enqueue(7); | ||
|
||
var queueArray = arrivalWindow.ToArray(); | ||
Array.Sort(queueArray); | ||
|
||
CollectionAssert.AreEqual( | ||
new long[] { 3, 4, 5, 6, 7 }, | ||
queueArray | ||
); | ||
|
||
Assert.AreEqual(25, arrivalWindow.Sum); | ||
Assert.AreEqual(5, arrivalWindow.Avg); | ||
} | ||
} | ||
} | ||
// <copyright file="LongIntervalHistory_UnitTest.cs" company="Shuai Zhang"> | ||
// Copyright Shuai Zhang. All rights reserved. | ||
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace PhiFailureDetector.UnitTest | ||
{ | ||
[TestClass] | ||
public class LongIntervalHistory_UnitTest | ||
{ | ||
[TestMethod] | ||
public void Test_Baseline() | ||
{ | ||
var arrivalWindow = new LongIntervalHistory(5); | ||
|
||
arrivalWindow.Enqueue(1); | ||
arrivalWindow.Enqueue(2); | ||
arrivalWindow.Enqueue(3); | ||
arrivalWindow.Enqueue(4); | ||
arrivalWindow.Enqueue(5); | ||
arrivalWindow.Enqueue(6); | ||
arrivalWindow.Enqueue(7); | ||
|
||
var queueArray = arrivalWindow.ToArray(); | ||
Array.Sort(queueArray); | ||
|
||
CollectionAssert.AreEqual( | ||
new long[] { 3, 4, 5, 6, 7 }, | ||
queueArray | ||
); | ||
|
||
Assert.AreEqual(25, arrivalWindow.Sum); | ||
Assert.AreEqual(5, arrivalWindow.Avg); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
// <copyright file="AssemblyInfo.cs" company="Shuai Zhang"> | ||
// Copyright Shuai Zhang. All rights reserved. | ||
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("RateLimiter.Tests")] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.