diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-06-10 17:26:07 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-06-10 17:26:07 -0500 |
| commit | 2b6a7d54dec4e2d7a34cc1b1c1e0ace65c2a2232 (patch) | |
| tree | 8b4ca86b808a872f702e8001c88a988203b5735f /tests/slskd.Tests.Unit/Common/ComputeTests.cs | |
| parent | b9f03ace7351da1f82608e7efab72292a613ae08 (diff) | |
| download | slskd-2b6a7d54dec4e2d7a34cc1b1c1e0ace65c2a2232.tar.gz | |
add Compute tests
Diffstat (limited to 'tests/slskd.Tests.Unit/Common/ComputeTests.cs')
| -rw-r--r-- | tests/slskd.Tests.Unit/Common/ComputeTests.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/slskd.Tests.Unit/Common/ComputeTests.cs b/tests/slskd.Tests.Unit/Common/ComputeTests.cs new file mode 100644 index 00000000..99b05d3f --- /dev/null +++ b/tests/slskd.Tests.Unit/Common/ComputeTests.cs @@ -0,0 +1,21 @@ +namespace slskd.Tests.Unit +{ + using Xunit; + + public class ComputeTests + { + [Theory] + [InlineData(0, 1, 2, 300, 0)] + [InlineData(1, 1, 2, 300, 1)] + [InlineData(2, 1, 2, 300, 3)] + [InlineData(3, 1, 2, 300, 7)] + [InlineData(4, 1, 2, 300, 15)] + [InlineData(5, 1, 2, 300, 31)] + [InlineData(999999, 1, 2, 300, 300)] + public void ExponentialBackoffDelay(int iteration, int delayInSeconds, int backoffRate, int maxDelayInSeconds, int expectedDelay) + { + var computedDelay = Compute.ExponentialBackoffDelay(iteration, delayInSeconds, backoffRate, maxDelayInSeconds); + Assert.Equal(expectedDelay, computedDelay); + } + } +} |
