diff options
author | Justin Clark-Casey (justincc) | 2014-10-25 00:36:50 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-11-25 23:22:20 +0000 |
commit | b114f5626ec94b27c26ba075d0c0b68743aff36c (patch) | |
tree | 29bb9024f0ff475505e42368a484db463e2b0cc2 /OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | |
parent | Add regression tests for token buckets on their own (diff) | |
download | opensim-SC-b114f5626ec94b27c26ba075d0c0b68743aff36c.zip opensim-SC-b114f5626ec94b27c26ba075d0c0b68743aff36c.tar.gz opensim-SC-b114f5626ec94b27c26ba075d0c0b68743aff36c.tar.bz2 opensim-SC-b114f5626ec94b27c26ba075d0c0b68743aff36c.tar.xz |
Add request drip rate to assertions for token bucket regression tests
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index cd87928..0d39c1d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | |||
@@ -58,29 +58,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
58 | public void TestSetRequestDripRate() | 58 | public void TestSetRequestDripRate() |
59 | { | 59 | { |
60 | TokenBucket tb = new TokenBucket("tb", null, 5000, 0); | 60 | TokenBucket tb = new TokenBucket("tb", null, 5000, 0); |
61 | AssertRates(tb, 5000, 5000, 0); | 61 | AssertRates(tb, 5000, 5000, 5000, 0); |
62 | 62 | ||
63 | tb.RequestedDripRate = 4000; | 63 | tb.RequestedDripRate = 4000; |
64 | AssertRates(tb, 4000, 4000, 0); | 64 | AssertRates(tb, 4000, 4000, 4000, 0); |
65 | 65 | ||
66 | tb.RequestedDripRate = 6000; | 66 | tb.RequestedDripRate = 6000; |
67 | AssertRates(tb, 6000, 6000, 0); | 67 | AssertRates(tb, 6000, 6000, 6000, 0); |
68 | } | 68 | } |
69 | 69 | ||
70 | [Test] | 70 | [Test] |
71 | public void TestSetRequestDripRateWithMax() | 71 | public void TestSetRequestDripRateWithMax() |
72 | { | 72 | { |
73 | TokenBucket tb = new TokenBucket("tb", null, 5000, 10000); | 73 | TokenBucket tb = new TokenBucket("tb", null, 5000, 10000); |
74 | AssertRates(tb, 5000, 5000, 10000); | 74 | AssertRates(tb, 5000, 5000, 5000, 10000); |
75 | 75 | ||
76 | tb.RequestedDripRate = 4000; | 76 | tb.RequestedDripRate = 4000; |
77 | AssertRates(tb, 4000, 4000, 10000); | 77 | AssertRates(tb, 4000, 4000, 4000, 10000); |
78 | 78 | ||
79 | tb.RequestedDripRate = 6000; | 79 | tb.RequestedDripRate = 6000; |
80 | AssertRates(tb, 6000, 6000, 10000); | 80 | AssertRates(tb, 6000, 6000, 6000, 10000); |
81 | 81 | ||
82 | tb.RequestedDripRate = 12000; | 82 | tb.RequestedDripRate = 12000; |
83 | AssertRates(tb, 10000, 10000, 10000); | 83 | AssertRates(tb, 10000, 10000, 10000, 10000); |
84 | } | 84 | } |
85 | 85 | ||
86 | [Test] | 86 | [Test] |
@@ -90,15 +90,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
90 | TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0); | 90 | TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0); |
91 | TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0); | 91 | TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0); |
92 | 92 | ||
93 | AssertRates(tbParent, 8000, 8000, 0); | 93 | AssertRates(tbParent, 8000, 8000, 8000, 0); |
94 | AssertRates(tbChild1, 3000, 3000, 0); | 94 | AssertRates(tbChild1, 3000, 3000, 3000, 0); |
95 | AssertRates(tbChild2, 5000, 5000, 0); | 95 | AssertRates(tbChild2, 5000, 5000, 5000, 0); |
96 | } | 96 | } |
97 | 97 | ||
98 | private void AssertRates(TokenBucket tb, double dripRate, double totalDripRequest, double maxDripRate) | 98 | private void AssertRates( |
99 | TokenBucket tb, double requestedDripRate, double totalDripRequest, double dripRate, double maxDripRate) | ||
99 | { | 100 | { |
100 | Assert.AreEqual((int)dripRate, tb.DripRate); | 101 | Assert.AreEqual((int)requestedDripRate, tb.RequestedDripRate); |
101 | Assert.AreEqual((int)totalDripRequest, tb.TotalDripRequest); | 102 | Assert.AreEqual((int)totalDripRequest, tb.TotalDripRequest); |
103 | Assert.AreEqual((int)dripRate, tb.DripRate); | ||
102 | Assert.AreEqual((int)maxDripRate, tb.MaxDripRate); | 104 | Assert.AreEqual((int)maxDripRate, tb.MaxDripRate); |
103 | } | 105 | } |
104 | 106 | ||