Skip to content

fix: Outcome of OrConstraintResult#762

Merged
vbreuss merged 2 commits intomainfrom
topic/add-node-tests
Sep 5, 2025
Merged

fix: Outcome of OrConstraintResult#762
vbreuss merged 2 commits intomainfrom
topic/add-node-tests

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Sep 5, 2025

This PR fixes the outcome logic for OrConstraintResult by correcting the order of condition checks in the Or method. The fix ensures that Success outcomes properly short-circuit the evaluation, returning Success immediately when either operand is successful, which aligns with logical OR semantics.

Key changes:

  • Corrected the Or method logic to prioritize Success outcomes over Undecided
  • Enhanced test infrastructure with better equality implementations and value handling
  • Added comprehensive test coverage for node equality, negation, and mapping behaviors

@vbreuss vbreuss self-assigned this Sep 5, 2025
Copilot AI review requested due to automatic review settings September 5, 2025 08:20
@vbreuss vbreuss added bug Something isn't working coverage Additional tests for edge cases or improvement of test coverage labels Sep 5, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the outcome logic for OrConstraintResult by correcting the order of condition checks in the Or method. The fix ensures that Success outcomes properly short-circuit the evaluation, returning Success immediately when either operand is successful, which aligns with logical OR semantics.

  • Corrected the Or method logic to prioritize Success outcomes over Undecided
  • Enhanced test infrastructure with better equality implementations and value handling
  • Added comprehensive test coverage for node equality, negation, and mapping behaviors

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Source/aweXpect.Core/Core/Nodes/OrNode.cs Fixed Or method logic and improved GetHashCode implementation
Source/aweXpect.Core/Core/Nodes/AndNode.cs Enhanced GetHashCode implementation for consistency
Source/aweXpect.Core/Core/Nodes/ExpectationNode.cs Improved GetHashCode to consider constraint and inner node
Tests/aweXpect.Core.Tests/TestHelpers/DummyNode.cs Added equality implementation and reason tracking
Tests/aweXpect.Core.Tests/TestHelpers/DummyConstraintResult.cs Enhanced with value support and additional constructor
Various test files Added comprehensive test coverage for node behaviors and edge cases

Comment thread Source/aweXpect.Core/Core/Nodes/OrNode.cs
@vbreuss vbreuss enabled auto-merge (squash) September 5, 2025 08:22
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Sep 5, 2025

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 5, 2025

Test Results

    14 files   -  24      14 suites   - 24   3m 43s ⏱️ -1s
17 571 tests + 80  17 569 ✅ + 80  2 💤 ±0  0 ❌ ±0 
49 380 runs  +240  49 378 ✅ +240  2 💤 ±0  0 ❌ ±0 

Results for commit 0afe4d9. ± Comparison against base commit 7baba98.

@vbreuss vbreuss merged commit d94595c into main Sep 5, 2025
14 checks passed
@vbreuss vbreuss deleted the topic/add-node-tests branch September 5, 2025 08:29
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 5, 2025

🚀 Benchmark Results

Details

BenchmarkDotNet v0.14.0, Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 8.0.413
[Host] : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Bool_aweXpect 216.9 ns 1.79 ns 1.68 ns 0.0300 - 504 B
Bool_FluentAssertions 256.3 ns 7.94 ns 7.42 ns 0.0567 - 952 B
Bool_TUnit 889.5 ns 25.48 ns 23.84 ns 0.1431 - 2408 B
Equivalency_aweXpect 312,766.4 ns 1,917.20 ns 1,793.35 ns 20.0195 0.9766 335556 B
Equivalency_FluentAssertions 2,396,956.6 ns 22,449.10 ns 20,998.90 ns 273.4375 46.8750 4584416 B
Equivalency_TUnit 693,706.0 ns 8,658.05 ns 8,098.75 ns 51.7578 2.9297 880545 B
Int_GreaterThan_aweXpect 267.2 ns 7.03 ns 6.58 ns 0.0486 - 816 B
Int_GreaterThan_FluentAssertions 264.0 ns 5.09 ns 4.76 ns 0.0730 - 1224 B
Int_GreaterThan_TUnit 1,265.4 ns 22.23 ns 20.80 ns 0.1774 - 2984 B
ItemsCount_AtLeast_aweXpect 508.6 ns 6.24 ns 5.21 ns 0.0868 - 1464 B
ItemsCount_AtLeast_FluentAssertions 534.6 ns 10.25 ns 9.59 ns 0.1192 - 2008 B
ItemsCount_AtLeast_TUnit 24,399.4 ns 124.14 ns 116.12 ns 1.6174 - 27480 B
String_aweXpect 434.6 ns 7.03 ns 6.23 ns 0.0734 - 1232 B
String_FluentAssertions 479.9 ns 7.08 ns 6.62 ns 0.1287 - 2168 B
String_TUnit 1,221.6 ns 10.31 ns 9.14 ns 0.1831 - 3072 B
StringArray_aweXpect 1,861.7 ns 14.64 ns 12.98 ns 0.1717 - 2888 B
StringArray_FluentAssertions 1,353.4 ns 10.15 ns 9.49 ns 0.2480 - 4152 B
StringArray_TUnit 3,283.0 ns 11.43 ns 10.13 ns 0.3128 - 5296 B
StringArrayInAnyOrder_aweXpect 2,319.4 ns 21.82 ns 19.34 ns 0.1831 - 3080 B
StringArrayInAnyOrder_FluentAssertions 149,759.5 ns 760.27 ns 711.16 ns 3.4180 - 63351 B
StringArrayInAnyOrder_TUnit 3,892.5 ns 61.32 ns 57.36 ns 0.3815 - 6488 B

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 5, 2025

👽 Mutation Results

Mutation testing badge

aweXpect

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

Coverage Thresholds: high:80 low:60 break:0

aweXpect.Core

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
Core/Nodes/AndNode.cs 96.23% 51 2 0 0 24 13 51 2 90
Core/Nodes/ExpectationNode.cs 86.96% 40 5 0 1 15 6 40 6 67
Core/Nodes/OrNode.cs 96.30% 52 2 0 0 23 11 52 2 88

The final mutation score is 93.46%

Coverage Thresholds: high:80 low:60 break:0

github-actions Bot added a commit that referenced this pull request Sep 5, 2025
github-actions Bot added a commit that referenced this pull request Sep 5, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 9, 2025

This is addressed in release v2.23.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working coverage Additional tests for edge cases or improvement of test coverage state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants