From 34dea62c1df6f7e2d6b699b7a070dc812c058931 Mon Sep 17 00:00:00 2001 From: Mikhail Tikilyaynen Date: Mon, 30 Apr 2018 21:49:49 +0100 Subject: [PATCH 1/5] Updated README with a how-to-run-tests-if-they-don't-show-up-in-VS. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 0207db1..43c0395 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,12 @@ Next can you please ensure that your PR (Pull Request) has a comment in it descr Ideally if it is fixing an issue or a bug, there would be a Unit Test proving the fix and a reference to the Issues in the PR comments. +### How to run tests? +If you are having trouble running xunit tests out of the box, it is possible to run them using a version of the command line below. +You'll just need to fill in the correct value of $(SolutionDir), which should be as defined in Visual Studio. +PS> dotnet C:\Users\%USERNAME%\.nuget\packages\xunit.runner.console\2.3.1\tools\netcoreapp2.0\xunit.console.dll $(SolutionDir)\HdrHistogram.UnitTests\bin\Debug\netcoreapp1.1\HdrHistogram.UnitTests.dll + + HdrHistogram Details ---------------------------------------------- From 0ab1485e13927deb273d15449f418321a40df96e Mon Sep 17 00:00:00 2001 From: Mikhail Tikilyaynen Date: Mon, 30 Apr 2018 22:01:13 +0100 Subject: [PATCH 2/5] Upped library and framework versions to current ones. --- HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj | 4 ++-- HdrHistogram.Examples/HdrHistogram.Examples.csproj | 2 +- HdrHistogram.UnitTests/HdrHistogram.UnitTests.csproj | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj b/HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj index 6c73a2d..e669e22 100644 --- a/HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj +++ b/HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj @@ -2,14 +2,14 @@ Exe - net47;netcoreapp1.1 + net471;netcoreapp1.1 - + 0.10.8 diff --git a/HdrHistogram.Examples/HdrHistogram.Examples.csproj b/HdrHistogram.Examples/HdrHistogram.Examples.csproj index 27a8b15..a1e58fe 100644 --- a/HdrHistogram.Examples/HdrHistogram.Examples.csproj +++ b/HdrHistogram.Examples/HdrHistogram.Examples.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp1.1 + netcoreapp2.0 diff --git a/HdrHistogram.UnitTests/HdrHistogram.UnitTests.csproj b/HdrHistogram.UnitTests/HdrHistogram.UnitTests.csproj index 56d3a98..54df436 100644 --- a/HdrHistogram.UnitTests/HdrHistogram.UnitTests.csproj +++ b/HdrHistogram.UnitTests/HdrHistogram.UnitTests.csproj @@ -84,9 +84,10 @@ - - + + + From 6ec756277162a0ffc924ca0566bfbbe695e60fa1 Mon Sep 17 00:00:00 2001 From: Mikhail Tikilyaynen Date: Mon, 30 Apr 2018 22:02:32 +0100 Subject: [PATCH 3/5] Added test to expose the issue of AllValues() returning an IEnumerable filled with the last HistogramIterationValue. --- .../HistogramEncodingTestBase.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/HdrHistogram.UnitTests/HistogramEncodingTestBase.cs b/HdrHistogram.UnitTests/HistogramEncodingTestBase.cs index f5118ad..8ba7617 100644 --- a/HdrHistogram.UnitTests/HistogramEncodingTestBase.cs +++ b/HdrHistogram.UnitTests/HistogramEncodingTestBase.cs @@ -1,6 +1,8 @@ using HdrHistogram.Encoding; using HdrHistogram.Utilities; using Xunit; +using FluentAssertions; +using System.Linq; namespace HdrHistogram.UnitTests { @@ -21,6 +23,22 @@ public void Given_a_populated_Histogram_When_encoded_and_decoded_Then_data_is_pr HistogramAssert.AreValueEqual(source, result); } + [Fact] + public void Given_a_populated_Histogram_iterating_over_buckets_gives_all_buckets() + { + var source = Create(DefaultHighestTrackableValue, DefaultSignificantFigures); + Load(source); + Iteration.HistogramIterationValue lastSeen = null; + foreach ( var v in source.AllValues().ToList() ) + { + if ( lastSeen != null ) + { + v.Should().NotBe( lastSeen ); + } + lastSeen = v; + } + } + [Fact] public void Given_a_populated_Histogram_When_encoded_and_decoded_with_compression_Then_data_is_preserved() { From b236c0ce52e031904e29048d4629218b8af220c6 Mon Sep 17 00:00:00 2001 From: Mikhail Tikilyaynen Date: Mon, 30 Apr 2018 22:03:10 +0100 Subject: [PATCH 4/5] Added fix for bug exposed in 6ec756277162a0ffc924ca0566bfbbe695e60fa1. --- HdrHistogram/Iteration/AbstractHistogramEnumerator.cs | 9 +++++++-- HdrHistogram/Iteration/HistogramIterationValue.cs | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/HdrHistogram/Iteration/AbstractHistogramEnumerator.cs b/HdrHistogram/Iteration/AbstractHistogramEnumerator.cs index 88b6e5d..fc7137b 100644 --- a/HdrHistogram/Iteration/AbstractHistogramEnumerator.cs +++ b/HdrHistogram/Iteration/AbstractHistogramEnumerator.cs @@ -34,8 +34,13 @@ internal abstract class AbstractHistogramEnumerator : IEnumerator _current.Clone(); + private set => _current = value; + } protected AbstractHistogramEnumerator(HistogramBase histogram) { diff --git a/HdrHistogram/Iteration/HistogramIterationValue.cs b/HdrHistogram/Iteration/HistogramIterationValue.cs index 2dbbfaf..d9fad0d 100644 --- a/HdrHistogram/Iteration/HistogramIterationValue.cs +++ b/HdrHistogram/Iteration/HistogramIterationValue.cs @@ -103,5 +103,7 @@ public override string ToString() ", Percentile:" + Percentile + ", PercentileLevelIteratedTo:" + PercentileLevelIteratedTo; } + + public HistogramIterationValue Clone() => (HistogramIterationValue) this.MemberwiseClone(); } } From 558d412ea2c39a824f42809b650be4569d0dad27 Mon Sep 17 00:00:00 2001 From: Mikhail Tikilyaynen Date: Mon, 30 Apr 2018 22:04:05 +0100 Subject: [PATCH 5/5] Added some bits to .gitignore to ignore VS2017 working files. --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5a8eceb..ae91b53 100644 --- a/.gitignore +++ b/.gitignore @@ -110,4 +110,8 @@ _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML -Thumbs.db \ No newline at end of file +Thumbs.db +.vs/HdrHistogram/v15/Server/sqlite3/storage.ide-wal +.vs/HdrHistogram/v15/Server/sqlite3/storage.ide-shm +.vs/HdrHistogram/v15/Server/sqlite3/storage.ide +.vs/HdrHistogram/v15/Server/sqlite3/db.lock