Skip to content

Commit 4e656eb

Browse files
blaze6950Mykyta ZotovCopilot
authored
Feature/implement data related logic for ranges (#2)
* Feature: Implement data-related logic for RangeData and update range factory methods for consistency - Introduced RangeData abstraction to couple logical ranges with data sequences and domains. - Updated RangeFactory methods to remove type parameters for cleaner usage. - Added TryCreate method for Range with validation and error messaging. - Enhanced Distance method in domain interfaces to ensure accurate step calculations. - Revised tests to reflect changes in range factory methods and ensure correctness. - Updated project metadata and CI/CD configurations for new data module. * Feature: Add validation method for RangeData to ensure data sequence matches expected logical elements * Feature: Add overview and implementation details for RangeData in README.md * Feature: Add unit tests for RangeData extensions to validate adjacency and data integrity * Feature: Add unit tests for RangeData extensions to validate equality, slicing, and domain interactions * Feature: Add benchmarks for RangeData and RangeDataExtensions to evaluate performance and memory usage * Feature: Integrate Codecov coverage reporting into CI workflows for all projects * Feature: Enhance RangeData logic for sub-range and point access with validation and improved error handling - Refine RangeData indexer to validate sub-range finiteness and containment, throwing specific exceptions for invalid cases - Update TryGet methods to ensure points and sub-ranges are within bounds before accessing data - Align index calculations with range inclusivity for accurate data mapping - Improve XML documentation for IRangeDomain to clarify complexity of Distance implementations - Update benchmarks and tests for readonly domain fields and minor cleanup - Clarify package description and README section for RangeData usage and validation * Feature: Update Microsoft.NET.Test.Sdk to version 17.11.1 in test project dependencies * Feature: Update Microsoft.NET.Test.Sdk to version 17.11.1 in test project dependencies * Feature: Update test execution paths and remove Codecov upload from Domain.Abstractions workflow * Feature: Update test paths in CI configuration and enhance documentation for TryCreate method * Feature: Update CI configuration to use test paths for dependency restoration, building, and testing * Feature: Correct test path in CI configuration for Intervals.NET.Data.Tests * Feature: Update CI configuration to use test path for dependency restoration and building * Feature: Optimize null-check for domain parameter to avoid boxing in RangeData * Feature: Enhance test coverage for RangeData and DateTime domains with edge case scenarios * chore: get rid of redundant md files * Feature: Update range comments and improve test method naming for clarity * Feature: Refine distance calculation and improve exception messages in RangeData * Feature: Improve range validation logic to handle overflow and enhance error messaging * Feature: Enhance range validation to correctly handle infinity bounds and improve exception messaging * Feature: Update range documentation for clarity and improve validation logic in TrimEnd method * Feature: Enhance TrimStart and TrimEnd methods to support inclusive/exclusive boundaries and improve documentation * Feature: Update documentation for RangeData methods to clarify return values and equality semantics * Feature: Clarify documentation for range span calculation and return type details * Feature: Update test data in IsTouching method to clarify range element counts * Feature: Update test data in IsBeforeAndAdjacentTo method to clarify element counts for ranges * Feature: Refine documentation and logic in RangeData extensions for clarity and consistency * Feature: Enhance documentation for domain interfaces and implementations to clarify performance characteristics and equality semantics * Feature: Update README to enhance structure and clarity of RangeData documentation * Fix TryGet returning false for empty subranges with exclusive parent boundaries (#3) * Initial plan * Add test case demonstrating bug with empty subranges in exclusive-start parents Co-authored-by: blaze6950 <32897401+blaze6950@users.noreply.github.com> * Fix bug where empty subranges with negative indices returned false instead of empty RangeData Co-authored-by: blaze6950 <32897401+blaze6950@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: blaze6950 <32897401+blaze6950@users.noreply.github.com> --------- Co-authored-by: Mykyta Zotov <mykyta.zotov@ihsmarkit.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
1 parent c11327f commit 4e656eb

File tree

86 files changed

+4219
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+4219
-231
lines changed

.github/workflows/domain-abstractions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
- name: Build Domain.Abstractions
3737
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore
38-
38+
3939
publish-nuget:
4040
runs-on: ubuntu-latest
4141
needs: build-and-test
@@ -66,4 +66,4 @@ jobs:
6666
uses: actions/upload-artifact@v4
6767
with:
6868
name: domain-abstractions-package
69-
path: ./artifacts/*.nupkg
69+
path: ./artifacts/*.nupkg

.github/workflows/domain-default.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,22 @@ jobs:
3636
dotnet-version: ${{ env.DOTNET_VERSION }}
3737

3838
- name: Restore dependencies
39-
run: dotnet restore ${{ env.PROJECT_PATH }}
39+
run: dotnet restore ${{ env.TEST_PATH }}
4040

4141
- name: Build Domain.Default
42-
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore
42+
run: dotnet build ${{ env.TEST_PATH }} --configuration Release --no-restore
4343

4444
- name: Run Domain.Default tests
45-
run: dotnet test ${{ env.TEST_PATH }} --configuration Release --verbosity normal
45+
run: dotnet test ${{ env.TEST_PATH }} --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults
46+
47+
- name: Upload coverage reports to Codecov
48+
uses: codecov/codecov-action@v4
49+
with:
50+
files: ./TestResults/**/coverage.cobertura.xml
51+
fail_ci_if_error: false
52+
verbose: true
53+
env:
54+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4655

4756
publish-nuget:
4857
runs-on: ubuntu-latest
@@ -74,4 +83,4 @@ jobs:
7483
uses: actions/upload-artifact@v4
7584
with:
7685
name: domain-default-package
77-
path: ./artifacts/*.nupkg
86+
path: ./artifacts/*.nupkg

.github/workflows/domain-extensions.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,22 @@ jobs:
3838
dotnet-version: ${{ env.DOTNET_VERSION }}
3939

4040
- name: Restore dependencies
41-
run: dotnet restore ${{ env.PROJECT_PATH }}
41+
run: dotnet restore ${{ env.TEST_PATH }}
4242

4343
- name: Build Domain.Extensions
44-
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore
44+
run: dotnet build ${{ env.TEST_PATH }} --configuration Release --no-restore
4545

4646
- name: Run Domain.Extensions tests
47-
run: dotnet test ${{ env.TEST_PATH }} --configuration Release --verbosity normal
47+
run: dotnet test ${{ env.TEST_PATH }} --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults
48+
49+
- name: Upload coverage reports to Codecov
50+
uses: codecov/codecov-action@v4
51+
with:
52+
files: ./TestResults/**/coverage.cobertura.xml
53+
fail_ci_if_error: false
54+
verbose: true
55+
env:
56+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4857

4958
publish-nuget:
5059
runs-on: ubuntu-latest
@@ -76,4 +85,4 @@ jobs:
7685
uses: actions/upload-artifact@v4
7786
with:
7887
name: domain-extensions-package
79-
path: ./artifacts/*.nupkg
88+
path: ./artifacts/*.nupkg
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: CI/CD - Intervals.NET.Data
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
paths:
7+
- 'src/Intervals.NET.Data/**'
8+
- 'tests/Intervals.NET.Data.Tests/**'
9+
- 'global.json'
10+
- '.github/workflows/intervals-net-data.yml'
11+
pull_request:
12+
branches: [ master, main ]
13+
paths:
14+
- 'src/Intervals.NET.Data/**'
15+
- 'tests/Intervals.NET.Data.Tests/**'
16+
- 'global.json'
17+
- '.github/workflows/intervals-net-data.yml'
18+
workflow_dispatch:
19+
20+
env:
21+
DOTNET_VERSION: '8.x.x'
22+
PROJECT_PATH: 'src/Intervals.NET.Data/Intervals.NET.Data.csproj'
23+
TEST_PATH: 'tests/Intervals.NET.Data.Tests/Intervals.NET.Data.Tests.csproj'
24+
25+
permissions:
26+
contents: read
27+
packages: write
28+
29+
concurrency:
30+
group: "intervals-net-data-${{ github.ref }}"
31+
cancel-in-progress: true
32+
33+
jobs:
34+
build-and-test:
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Setup .NET
42+
uses: actions/setup-dotnet@v4
43+
with:
44+
dotnet-version: ${{ env.DOTNET_VERSION }}
45+
46+
- name: Cache NuGet packages
47+
uses: actions/cache@v4
48+
with:
49+
path: ~/.nuget/packages
50+
key: nuget-packages-${{ runner.os }}-${{ hashFiles('src/Intervals.NET.Data/Intervals.NET.Data.csproj', 'tests/Intervals.NET.Data.Tests/Intervals.NET.Data.Tests.csproj', 'global.json') }}
51+
restore-keys: |
52+
nuget-packages-${{ runner.os }}-
53+
54+
- name: Restore dependencies
55+
run: dotnet restore ${{ env.TEST_PATH }}
56+
57+
- name: Build
58+
run: dotnet build ${{ env.TEST_PATH }} --configuration Release --no-restore
59+
60+
- name: Run tests (if present)
61+
if: always()
62+
run: |
63+
if [ -f "${{ env.TEST_PATH }}" ]; then
64+
dotnet test ${{ env.TEST_PATH }} --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults --logger "trx;LogFileName=test_results.trx"
65+
mkdir -p test-artifacts || true
66+
cp ./TestResults/*/test_results.trx test-artifacts/ || true
67+
echo "Tests executed"
68+
else
69+
echo "No test project found at ${{ env.TEST_PATH }}"
70+
fi
71+
72+
- name: Upload coverage reports to Codecov
73+
if: always()
74+
uses: codecov/codecov-action@v4
75+
with:
76+
files: ./TestResults/**/coverage.cobertura.xml
77+
fail_ci_if_error: false
78+
verbose: true
79+
env:
80+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
81+
82+
- name: Upload test results
83+
if: always()
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: intervals-net-data-test-results
87+
path: test-artifacts/
88+
89+
publish-nuget:
90+
runs-on: ubuntu-latest
91+
needs: build-and-test
92+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
93+
94+
steps:
95+
- name: Checkout code
96+
uses: actions/checkout@v4
97+
98+
- name: Setup .NET
99+
uses: actions/setup-dotnet@v4
100+
with:
101+
dotnet-version: ${{ env.DOTNET_VERSION }}
102+
103+
- name: Restore
104+
run: dotnet restore ${{ env.PROJECT_PATH }}
105+
106+
- name: Build
107+
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore
108+
109+
- name: Pack Intervals.NET.Data
110+
run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output ./artifacts
111+
112+
- name: Publish Intervals.NET.Data to NuGet
113+
env:
114+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
115+
run: |
116+
if [ -z "${NUGET_API_KEY}" ]; then
117+
echo "NUGET_API_KEY not set, skipping push"
118+
exit 0
119+
fi
120+
dotnet nuget push ./artifacts/Intervals.NET.Data.*.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json --skip-duplicate
121+
122+
- name: Upload package artifacts
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: intervals-net-data-package
126+
path: ./artifacts/*.nupkg

Intervals.NET.sln

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
1010
.github\workflows\domain-default.yml = .github\workflows\domain-default.yml
1111
.github\workflows\domain-extensions.yml = .github\workflows\domain-extensions.yml
1212
.github\workflows\intervals-net.yml = .github\workflows\intervals-net.yml
13+
.github\workflows\intervals-net-data.yml = .github\workflows\intervals-net-data.yml
1314
EndProjectSection
1415
EndProject
1516
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EAF02F30-A5E4-4237-B402-6F946F2B2C09}"
@@ -39,6 +40,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Results", "Results", "{F375
3940
benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.RealWorldScenariosBenchmarks-report-github.md = benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.RealWorldScenariosBenchmarks-report-github.md
4041
benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.SetOperationsBenchmarks-report-github.md = benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.SetOperationsBenchmarks-report-github.md
4142
benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.VariableStepDomainBenchmarks-report-github.md = benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.VariableStepDomainBenchmarks-report-github.md
43+
benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.RangeDataBenchmarks-report-github.md = benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.RangeDataBenchmarks-report-github.md
44+
benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.RangeDataExtensionsBenchmarks-report-github.md = benchmarks\Results\Intervals.NET.Benchmarks.Benchmarks.RangeDataExtensionsBenchmarks-report-github.md
4245
EndProjectSection
4346
EndProject
4447
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Domain.Abstractions", "src\Domain\Intervals.NET.Domain.Abstractions\Intervals.NET.Domain.Abstractions.csproj", "{EE258066-15D2-413B-B2F5-9122A0FA2387}"
@@ -55,6 +58,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Domain.Defaul
5558
EndProject
5659
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Domain.Extensions.Tests", "tests\Intervals.NET.Domain.Extensions.Tests\Intervals.NET.Domain.Extensions.Tests.csproj", "{9F5470DF-88E2-44DC-B6D0-176EBFAF5A25}"
5760
EndProject
61+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{07DC76CB-F380-40B5-A4C5-7241D10D180C}"
62+
EndProject
63+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Data", "src\Intervals.NET.Data\Intervals.NET.Data.csproj", "{B5095989-5E11-405B-A1C8-D38210B64C91}"
64+
EndProject
65+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{74428AFD-6630-46D5-8FE5-BD0B272DD619}"
66+
EndProject
67+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Data.Tests", "tests\Intervals.NET.Data.Tests\Intervals.NET.Data.Tests.csproj", "{AD1E4AC1-99BF-4C55-B63E-BEE289C9D144}"
68+
EndProject
5869
Global
5970
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6071
Debug|Any CPU = Debug|Any CPU
@@ -93,6 +104,14 @@ Global
93104
{9F5470DF-88E2-44DC-B6D0-176EBFAF5A25}.Debug|Any CPU.Build.0 = Debug|Any CPU
94105
{9F5470DF-88E2-44DC-B6D0-176EBFAF5A25}.Release|Any CPU.ActiveCfg = Release|Any CPU
95106
{9F5470DF-88E2-44DC-B6D0-176EBFAF5A25}.Release|Any CPU.Build.0 = Release|Any CPU
107+
{B5095989-5E11-405B-A1C8-D38210B64C91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
108+
{B5095989-5E11-405B-A1C8-D38210B64C91}.Debug|Any CPU.Build.0 = Debug|Any CPU
109+
{B5095989-5E11-405B-A1C8-D38210B64C91}.Release|Any CPU.ActiveCfg = Release|Any CPU
110+
{B5095989-5E11-405B-A1C8-D38210B64C91}.Release|Any CPU.Build.0 = Release|Any CPU
111+
{AD1E4AC1-99BF-4C55-B63E-BEE289C9D144}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
112+
{AD1E4AC1-99BF-4C55-B63E-BEE289C9D144}.Debug|Any CPU.Build.0 = Debug|Any CPU
113+
{AD1E4AC1-99BF-4C55-B63E-BEE289C9D144}.Release|Any CPU.ActiveCfg = Release|Any CPU
114+
{AD1E4AC1-99BF-4C55-B63E-BEE289C9D144}.Release|Any CPU.Build.0 = Release|Any CPU
96115
EndGlobalSection
97116
GlobalSection(NestedProjects) = preSolution
98117
{A2F7DF66-08BE-438A-A354-C09499B8B8B7} = {EAF02F30-A5E4-4237-B402-6F946F2B2C09}
@@ -106,5 +125,9 @@ Global
106125
{592DCBFE-8570-44E3-B9DD-351AA775BFC8} = {28A5727D-3EDB-4F19-8B68-1DBD790EB8E2}
107126
{EAC4D033-A7D7-4242-8661-3F231257B4FE} = {592DCBFE-8570-44E3-B9DD-351AA775BFC8}
108127
{9F5470DF-88E2-44DC-B6D0-176EBFAF5A25} = {592DCBFE-8570-44E3-B9DD-351AA775BFC8}
128+
{07DC76CB-F380-40B5-A4C5-7241D10D180C} = {EAF02F30-A5E4-4237-B402-6F946F2B2C09}
129+
{B5095989-5E11-405B-A1C8-D38210B64C91} = {07DC76CB-F380-40B5-A4C5-7241D10D180C}
130+
{74428AFD-6630-46D5-8FE5-BD0B272DD619} = {28A5727D-3EDB-4F19-8B68-1DBD790EB8E2}
131+
{AD1E4AC1-99BF-4C55-B63E-BEE289C9D144} = {74428AFD-6630-46D5-8FE5-BD0B272DD619}
109132
EndGlobalSection
110133
EndGlobal

0 commit comments

Comments
 (0)