Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Refactor Any<T> and Opt classes; enhance tests#20

Merged
trippwill merged 1 commit intomainfrom
dev/codecov-2
Jan 1, 2025
Merged

Refactor Any<T> and Opt classes; enhance tests#20
trippwill merged 1 commit intomainfrom
dev/codecov-2

Conversation

@trippwill
Copy link
Member

Refactor Any and Opt classes; enhance tests

  • Update IAnyRefMap<K, V> to change TryGetValueRef to GetValueRef, returning a reference and a found flag.
  • Modify AnyMap<K, V> to align with the new interface method.
  • Add new tests in AnyExtensionsTests for aggregate functionality and transformations on Any<int>.
  • Enhance AnyTests with equality checks for Any<T> in various states.
  • Introduce tests for the Match method and equality in the Opt class.
  • Improve AnyMapTests to verify indexer behavior and the new GetValueRef method.

- Update `IAnyRefMap<K, V>` to change `TryGetValueRef` to `GetValueRef`, returning a reference and a found flag.
- Modify `AnyMap<K, V>` to align with the new interface method.
- Add new tests in `AnyExtensionsTests` for aggregate functionality and transformations on `Any<int>`.
- Enhance `AnyTests` with equality checks for `Any<T>` in various states.
- Introduce tests for the `Match` method and equality in the `Opt` class.
- Improve `AnyMapTests` to verify indexer behavior and the new `GetValueRef` method.
@codecov
Copy link

codecov bot commented Jan 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
src/libanvl.Opt/Any.cs 91.78% <100.00%> (+9.58%) ⬆️
src/libanvl.Opt/AnyMap.cs 100.00% <100.00%> (+31.25%) ⬆️
src/libanvl.Opt/IAnyRefMap.cs 50.00% <ø> (ø)
src/libanvl.Opt/Opt.cs 66.66% <ø> (+13.04%) ⬆️

... and 1 file with indirect coverage changes

@github-actions
Copy link

github-actions bot commented Jan 1, 2025

Test Results

  3 files  ±  0    3 suites  ±0   0s ⏱️ ±0s
205 tests + 42  204 ✅ + 42  1 💤 ±0  0 ❌ ±0 
618 runs  +129  615 ✅ +129  3 💤 ±0  0 ❌ ±0 

Results for commit cd0ca1f. ± Comparison against base commit 61e1cc6.

This pull request removes 23 and adds 65 tests. Note that renamed tests count towards both.
libanvl.opt.test.AnyExtensionsTests ‑ Aggregate_ShouldAccumulateValues
libanvl.opt.test.AnyExtensionsTests ‑ All_ShouldReturnTrueIfAllElementsMatchPredicate
libanvl.opt.test.AnyExtensionsTests ‑ Any_ShouldReturnTrueIfAnyElementMatchesPredicate
libanvl.opt.test.AnyExtensionsTests ‑ FirstOrDefault_ShouldReturnFirstMatchingElementOrDefault
libanvl.opt.test.AnyExtensionsTests ‑ Match_ShouldInvokeCorrectAction
libanvl.opt.test.AnyExtensionsTests ‑ SelectMany_ShouldFlattenSequences
libanvl.opt.test.AnyExtensionsTests ‑ Select_ShouldTransformElements
libanvl.opt.test.AnyExtensionsTests ‑ ToDictionary_ShouldCreateDictionaryFromElements
libanvl.opt.test.AnyExtensionsTests ‑ ToDictionary_ShouldReturnDictionaryWithCorrectKeysAndValues_WhenSourceIsMany
libanvl.opt.test.AnyExtensionsTests ‑ ToDictionary_ShouldReturnEmptyDictionary_WhenSourceIsNone
…
libanvl.opt.test.AnyExtensionsTests ‑ Aggregate_ShouldAccumulateValues(any: [···], expected: 0)
libanvl.opt.test.AnyExtensionsTests ‑ Aggregate_ShouldAccumulateValues(any: [···], expected: 42)
libanvl.opt.test.AnyExtensionsTests ‑ Aggregate_ShouldAccumulateValues(any: [···], expected: 6)
libanvl.opt.test.AnyExtensionsTests ‑ All_ShouldReturnTrueIfAllElementsMatchPredicate(any: [···], predicate: Func`2 { Method = Boolean <GetAllTestData>b__13_0(Int32), Target = <>c { } }, expected: True)
libanvl.opt.test.AnyExtensionsTests ‑ All_ShouldReturnTrueIfAllElementsMatchPredicate(any: [···], predicate: Func`2 { Method = Boolean <GetAllTestData>b__13_1(Int32), Target = <>c { } }, expected: False)
libanvl.opt.test.AnyExtensionsTests ‑ All_ShouldReturnTrueIfAllElementsMatchPredicate(any: [···], predicate: Func`2 { Method = Boolean <GetAllTestData>b__13_2(Int32), Target = <>c { } }, expected: True)
libanvl.opt.test.AnyExtensionsTests ‑ All_ShouldReturnTrueIfAllElementsMatchPredicate(any: [···], predicate: Func`2 { Method = Boolean <GetAllTestData>b__13_3(Int32), Target = <>c { } }, expected: False)
libanvl.opt.test.AnyExtensionsTests ‑ All_ShouldReturnTrueIfAllElementsMatchPredicate(any: [···], predicate: Func`2 { Method = Boolean <GetAllTestData>b__13_4(Int32), Target = <>c { } }, expected: True)
libanvl.opt.test.AnyExtensionsTests ‑ Any_ShouldReturnTrueIfAnyElementMatchesPredicate(any: [···], expected: False)
libanvl.opt.test.AnyExtensionsTests ‑ Any_ShouldReturnTrueIfAnyElementMatchesPredicate(any: [···], expected: True)
…

@trippwill trippwill merged commit 33abd9f into main Jan 1, 2025
14 checks passed
@trippwill trippwill deleted the dev/codecov-2 branch January 1, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant