diff options
author | Craig Tiller <ctiller@google.com> | 2017-05-23 22:55:34 +0000 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-05-23 22:55:34 +0000 |
commit | 674af8f23ea1780ed0803d626df74408299e46c7 (patch) | |
tree | 2a95de9044e5d0e5d25f0bf9d1850d33ca3fa72a /src/csharp/Grpc.IntegrationTesting/HistogramTest.cs | |
parent | d3ec4aaf6f52387d27d02ae80b18bdcaf65828d6 (diff) | |
parent | 0a94f3c8ab55dfd12c14058d57f33121c8d6c411 (diff) |
Merge github.com:grpc/grpc into thread_pool
Diffstat (limited to 'src/csharp/Grpc.IntegrationTesting/HistogramTest.cs')
-rw-r--r-- | src/csharp/Grpc.IntegrationTesting/HistogramTest.cs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/csharp/Grpc.IntegrationTesting/HistogramTest.cs b/src/csharp/Grpc.IntegrationTesting/HistogramTest.cs index fa160cbd15..e8a2ed0c5b 100644 --- a/src/csharp/Grpc.IntegrationTesting/HistogramTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/HistogramTest.cs @@ -73,7 +73,7 @@ namespace Grpc.IntegrationTesting { var hist = new Histogram(0.01, 60e9); hist.AddObservation(-0.5); // should be in the first bucket - hist.AddObservation(1e12); // should be in the last bucket + hist.AddObservation(1e12); // should be in the last bucket var data = hist.GetSnapshot(); Assert.AreEqual(1, data.Bucket[0]); @@ -81,6 +81,30 @@ namespace Grpc.IntegrationTesting } [Test] + public void MergeSnapshots() + { + var data = new HistogramData(); + + var hist1 = new Histogram(0.01, 60e9); + hist1.AddObservation(-0.5); // should be in the first bucket + hist1.AddObservation(1e12); // should be in the last bucket + hist1.GetSnapshot(data, false); + + var hist2 = new Histogram(0.01, 60e9); + hist2.AddObservation(10000); + hist2.AddObservation(11000); + hist2.GetSnapshot(data, false); + + Assert.AreEqual(4, data.Count); + Assert.AreEqual(-0.5, data.MinSeen); + Assert.AreEqual(1e12, data.MaxSeen); + Assert.AreEqual(1, data.Bucket[0]); + Assert.AreEqual(1, data.Bucket[925]); + Assert.AreEqual(1, data.Bucket[935]); + Assert.AreEqual(1, data.Bucket[data.Bucket.Count - 1]); + } + + [Test] public void Reset() { var hist = new Histogram(0.01, 60e9); |