Skip to content

Commit a2bf810

Browse files
author
Cédric Belin
committed
Improve the file naming convention
1 parent 9e9205a commit a2bf810

20 files changed

+134
-116
lines changed

lcov.slnx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
<Folder Name="/res/">
2424
<File Path="res/lcov.info" />
2525
</Folder>
26-
<Project Path="src/lcov.csproj" />
27-
<Project Path="test/lcov.tests.csproj">
26+
<Project Path="src/Lcov.csproj" />
27+
<Project Path="test/Lcov.Tests.csproj">
2828
<Build Solution="Release|*" Project="false" />
2929
</Project>
3030
</Solution>

src/branch.cs renamed to src/BranchCoverage.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,3 @@ .. Data.Select(item => item.ToString()),
3333
$"{Token.BranchesHit}:{Hit}"
3434
]);
3535
}
36-
37-
/// <summary>
38-
/// Provides details for branch coverage.
39-
/// </summary>
40-
/// <param name="LineNumber">The line number.</param>
41-
/// <param name="BlockNumber">The block number.</param>
42-
/// <param name="BranchNumber">The branch number.</param>
43-
/// <param name="Taken">A number indicating how often this branch was taken.</param>
44-
public sealed record BranchData(int LineNumber = 0, int BlockNumber = 0, int BranchNumber = 0, int Taken = 0) {
45-
46-
/// <summary>
47-
/// Returns a string representation of this object.
48-
/// </summary>
49-
/// <returns>The string representation of this object.</returns>
50-
public override string ToString() {
51-
var value = $"{Token.BranchData}:{LineNumber},{BlockNumber},{BranchNumber}";
52-
return Taken > 0 ? $"{value},{Taken}" : $"{value},-";
53-
}
54-
}

src/BranchData.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace Belin.Lcov;
2+
3+
/// <summary>
4+
/// Provides details for branch coverage.
5+
/// </summary>
6+
/// <param name="LineNumber">The line number.</param>
7+
/// <param name="BlockNumber">The block number.</param>
8+
/// <param name="BranchNumber">The branch number.</param>
9+
/// <param name="Taken">A number indicating how often this branch was taken.</param>
10+
public sealed record BranchData(int LineNumber = 0, int BlockNumber = 0, int BranchNumber = 0, int Taken = 0) {
11+
12+
/// <summary>
13+
/// Returns a string representation of this object.
14+
/// </summary>
15+
/// <returns>The string representation of this object.</returns>
16+
public override string ToString() {
17+
var value = $"{Token.BranchData}:{LineNumber},{BlockNumber},{BranchNumber}";
18+
return Taken > 0 ? $"{value},{Taken}" : $"{value},-";
19+
}
20+
}

src/FunctionCoverage.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
namespace Belin.Lcov;
2+
3+
/// <summary>
4+
/// Provides the coverage data of functions.
5+
/// </summary>
6+
/// <param name="found">The number of functions found.</param>
7+
/// <param name="hit">The number of functions hit.</param>
8+
/// <param name="data">The coverage data.</param>
9+
public sealed class FunctionCoverage(int found = 0, int hit = 0, IEnumerable<FunctionData>? data = null) {
10+
11+
/// <summary>
12+
/// The coverage data.
13+
/// </summary>
14+
public IList<FunctionData> Data { get; set; } = [.. data ?? []];
15+
16+
/// <summary>
17+
/// The number of functions found.
18+
/// </summary>
19+
public int Found { get; set; } = found;
20+
21+
/// <summary>
22+
/// The number of functions hit.
23+
/// </summary>
24+
public int Hit { get; set; } = hit;
25+
26+
/// <summary>
27+
/// Returns a string representation of this object.
28+
/// </summary>
29+
/// <returns>The string representation of this object.</returns>
30+
public override string ToString() => string.Join('\n', [
31+
.. Data.Select(item => item.ToString(asDefinition: true)),
32+
.. Data.Select(item => item.ToString(asDefinition: false)),
33+
$"{Token.FunctionsFound}:{Found}",
34+
$"{Token.FunctionsHit}:{Hit}"
35+
]);
36+
}

src/function.cs renamed to src/FunctionData.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,5 @@
11
namespace Belin.Lcov;
22

3-
/// <summary>
4-
/// Provides the coverage data of functions.
5-
/// </summary>
6-
/// <param name="found">The number of functions found.</param>
7-
/// <param name="hit">The number of functions hit.</param>
8-
/// <param name="data">The coverage data.</param>
9-
public sealed class FunctionCoverage(int found = 0, int hit = 0, IEnumerable<FunctionData>? data = null) {
10-
11-
/// <summary>
12-
/// The coverage data.
13-
/// </summary>
14-
public IList<FunctionData> Data { get; set; } = [.. data ?? []];
15-
16-
/// <summary>
17-
/// The number of functions found.
18-
/// </summary>
19-
public int Found { get; set; } = found;
20-
21-
/// <summary>
22-
/// The number of functions hit.
23-
/// </summary>
24-
public int Hit { get; set; } = hit;
25-
26-
/// <summary>
27-
/// Returns a string representation of this object.
28-
/// </summary>
29-
/// <returns>The string representation of this object.</returns>
30-
public override string ToString() => string.Join('\n', [
31-
.. Data.Select(item => item.ToString(asDefinition: true)),
32-
.. Data.Select(item => item.ToString(asDefinition: false)),
33-
$"{Token.FunctionsFound}:{Found}",
34-
$"{Token.FunctionsHit}:{Hit}"
35-
]);
36-
}
37-
383
/// <summary>
394
/// Provides details for function coverage.
405
/// </summary>

src/lcov.csproj renamed to src/Lcov.csproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
<Version>1.0.0</Version>
88
</PropertyGroup>
99

10+
<PropertyGroup>
11+
<Authors>CedX</Authors>
12+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
13+
<PackageReadmeFile>README.md</PackageReadmeFile>
14+
<PackageTags>coverage;formatter;lcov;parser;test;writer</PackageTags>
15+
<RepositoryUrl>https://github.com/cedx/lcov.cs.git</RepositoryUrl>
16+
</PropertyGroup>
17+
1018
<PropertyGroup>
1119
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1220
<AssemblyName>Belin.Lcov</AssemblyName>
@@ -15,4 +23,8 @@
1523
<OutDir>../bin</OutDir>
1624
<TargetFramework>net8.0</TargetFramework>
1725
</PropertyGroup>
26+
27+
<ItemGroup>
28+
<None Include="../README.md" Pack="true" PackagePath="/" />
29+
</ItemGroup>
1830
</Project>

src/line.cs renamed to src/LineCoverage.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,3 @@ .. Data.Select(item => item.ToString()),
3333
$"{Token.LinesHit}:{Hit}"
3434
]);
3535
}
36-
37-
/// <summary>
38-
/// Provides details for line coverage.
39-
/// </summary>
40-
/// <param name="LineNumber">The line number.</param>
41-
/// <param name="ExecutionCount">The execution count.</param>
42-
/// <param name="Checksum">The data checksum.</param>
43-
public sealed record LineData(int LineNumber = 0, int ExecutionCount = 0, string Checksum = "") {
44-
45-
/// <summary>
46-
/// Returns a string representation of this object.
47-
/// </summary>
48-
/// <returns>The string representation of this object.</returns>
49-
public override string ToString() {
50-
var value = $"{Token.LineData}:{LineNumber},{ExecutionCount}";
51-
return string.IsNullOrWhiteSpace(Checksum) ? value : $"{value},{Checksum}";
52-
}
53-
}

src/LineData.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace Belin.Lcov;
2+
3+
/// <summary>
4+
/// Provides details for line coverage.
5+
/// </summary>
6+
/// <param name="LineNumber">The line number.</param>
7+
/// <param name="ExecutionCount">The execution count.</param>
8+
/// <param name="Checksum">The data checksum.</param>
9+
public sealed record LineData(int LineNumber = 0, int ExecutionCount = 0, string Checksum = "") {
10+
11+
/// <summary>
12+
/// Returns a string representation of this object.
13+
/// </summary>
14+
/// <returns>The string representation of this object.</returns>
15+
public override string ToString() {
16+
var value = $"{Token.LineData}:{LineNumber},{ExecutionCount}";
17+
return string.IsNullOrWhiteSpace(Checksum) ? value : $"{value},{Checksum}";
18+
}
19+
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)