Skip to content

Commit 27c87e6

Browse files
authored
Merge 558d412 into 9d82f46
2 parents 9d82f46 + 558d412 commit 27c87e6

File tree

8 files changed

+44
-8
lines changed

8 files changed

+44
-8
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,8 @@ _UpgradeReport_Files/
110110
Backup*/
111111
UpgradeLog*.XML
112112

113-
Thumbs.db
113+
Thumbs.db
114+
.vs/HdrHistogram/v15/Server/sqlite3/storage.ide-wal
115+
.vs/HdrHistogram/v15/Server/sqlite3/storage.ide-shm
116+
.vs/HdrHistogram/v15/Server/sqlite3/storage.ide
117+
.vs/HdrHistogram/v15/Server/sqlite3/db.lock

HdrHistogram.Benchmarking/HdrHistogram.Benchmarking.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net47;netcoreapp1.1</TargetFrameworks>
5+
<TargetFrameworks>net471;netcoreapp1.1</TargetFrameworks>
66
</PropertyGroup>
77

88
<ItemGroup>
99
<PackageReference Include="BenchmarkDotNet" Version="0.10.8" />
1010
</ItemGroup>
1111

12-
<ItemGroup Condition="'$(TargetFramework)' == 'net47'">
12+
<ItemGroup Condition="'$(TargetFramework)' == 'net471'">
1313
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows">
1414
<Version>0.10.8</Version>
1515
</PackageReference>

HdrHistogram.Examples/HdrHistogram.Examples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp1.1</TargetFramework>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

HdrHistogram.UnitTests/HdrHistogram.UnitTests.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@
8484

8585
<ItemGroup>
8686
<PackageReference Include="FluentAssertions" Version="4.19.2" />
87-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
88-
<PackageReference Include="xunit" Version="2.2.0" />
87+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
88+
<PackageReference Include="xunit" Version="2.3.1" />
8989
<PackageReference Include="Xunit.Combinatorial" Version="1.2.1" />
90+
<PackageReference Include="xunit.runner.console" Version="2.3.1" />
9091
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
9192
</ItemGroup>
9293

HdrHistogram.UnitTests/HistogramEncodingTestBase.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using HdrHistogram.Encoding;
22
using HdrHistogram.Utilities;
33
using Xunit;
4+
using FluentAssertions;
5+
using System.Linq;
46

57
namespace HdrHistogram.UnitTests
68
{
@@ -21,6 +23,22 @@ public void Given_a_populated_Histogram_When_encoded_and_decoded_Then_data_is_pr
2123
HistogramAssert.AreValueEqual(source, result);
2224
}
2325

26+
[Fact]
27+
public void Given_a_populated_Histogram_iterating_over_buckets_gives_all_buckets()
28+
{
29+
var source = Create(DefaultHighestTrackableValue, DefaultSignificantFigures);
30+
Load(source);
31+
Iteration.HistogramIterationValue lastSeen = null;
32+
foreach ( var v in source.AllValues().ToList() )
33+
{
34+
if ( lastSeen != null )
35+
{
36+
v.Should().NotBe( lastSeen );
37+
}
38+
lastSeen = v;
39+
}
40+
}
41+
2442
[Fact]
2543
public void Given_a_populated_Histogram_When_encoded_and_decoded_with_compression_Then_data_is_preserved()
2644
{

HdrHistogram/Iteration/AbstractHistogramEnumerator.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ internal abstract class AbstractHistogramEnumerator : IEnumerator<HistogramItera
3434
protected int CurrentSubBucketIndex { get; private set; }
3535
protected long TotalCountToCurrentIndex { get; private set; }
3636
protected long CountAtThisValue { get; private set; }
37-
38-
public HistogramIterationValue Current { get; private set; }
37+
38+
private HistogramIterationValue _current;
39+
public HistogramIterationValue Current
40+
{
41+
get => _current.Clone();
42+
private set => _current = value;
43+
}
3944

4045
protected AbstractHistogramEnumerator(HistogramBase histogram)
4146
{

HdrHistogram/Iteration/HistogramIterationValue.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,7 @@ public override string ToString()
103103
", Percentile:" + Percentile +
104104
", PercentileLevelIteratedTo:" + PercentileLevelIteratedTo;
105105
}
106+
107+
public HistogramIterationValue Clone() => (HistogramIterationValue) this.MemberwiseClone();
106108
}
107109
}

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ Next can you please ensure that your PR (Pull Request) has a comment in it descr
255255
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.
256256

257257

258+
### How to run tests?
259+
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.
260+
You'll just need to fill in the correct value of $(SolutionDir), which should be as defined in Visual Studio.
261+
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
262+
263+
258264
HdrHistogram Details
259265
----------------------------------------------
260266

0 commit comments

Comments
 (0)