Skip to content

#290 Improve generator tests and assertion rules - #292

Merged
sanelli merged 3 commits into
mainfrom
290-improve-tests
Jul 31, 2026
Merged

#290 Improve generator tests and assertion rules#292
sanelli merged 3 commits into
mainfrom
290-improve-tests

Conversation

@sanelli

@sanelli sanelli commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Require full HasNextSyntaxNode syntax walks after every HaveGeneratedSourceCode() (or assert stubs where generation still emits a NoMap return).
  • Replace HaveOnlyWarnings with HaveDiagnostics + HaveDiagnostic(MappaDiagnosticDescriptors.…) and remove the assertion helpers.
  • Tighten the cursor workflow Tests rules and bump MappaVersion to 10.2.0-alpha.29.

Closes #290.

Test plan

  • dotnet test Mappa.Generator.Tests/Mappa.Generator.Tests.csproj (1877 passed)
  • .\Scripts\RunTestsAndReportCoverage.ps1 (2652 passed; line 98.4% / branch 90.6% / method 100% ≥ baseline)

sanelli and others added 3 commits July 31, 2026 21:48
Add HasNextSyntaxNode walks for previously source-count-only generator tests, including NoMap stubs, namespace shapes, multi-mapper units, and queryable projections.

Co-authored-by: Cursor <cursoragent@cursor.com>
Assert warning diagnostics via descriptors and message args; remove the HaveOnlyWarnings assertion helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
Require syntax walks after HaveGeneratedSourceCode, prefer HaveDiagnostics/HaveDiagnostic, and increment MappaVersion for CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sanelli sanelli linked an issue Jul 31, 2026 that may be closed by this pull request
@sanelli sanelli mentioned this pull request Jul 31, 2026
@github-actions

Copy link
Copy Markdown

Code coverage

Compared against the latest published coverage history from the code coverage gist.

Metric Baseline PR Δ Trend
Line 98.4% 98.4% 0 =
Branch 90.6% 90.6% 0 =
Method 100% 100% 0 =

No coverage metric dropped by more than 1 percentage point(s) versus baseline.

Benchmarks

AutoMapper is the BenchmarkDotNet ratio baseline. Absolute values are mean time in nanoseconds and allocated bytes. Ratio columns are competitor / Mappa as a percentage (n/a when either side is missing or Mappa is zero).

Benchmark Automapper Mean (ns) Automapper Allocated (B) Mapster Mean (ns) Mapster Allocated (B) Mapperly Mean (ns) Mapperly Allocated (B) Mappa Mean (ns) Mappa Allocated (B) Automapper/Mappa Time Automapper/Mappa Alloc Mapperly/Mappa Time Mapperly/Mappa Alloc Mapster/Mappa Time Mapster/Mappa Alloc
ArrayToListBenchmark 72.69 32 77987.9 194456 7578.28 38456 7673.31 38456 0.9% 0.1% 98.8% 100% 1016.4% 505.7%
DictionaryBenchmark 142820 185221.12 89140 214364.16 11490 46018.56 13730 58316.8 1040.2% 317.6% 83.7% 78.9% 649.2% 367.6%
FastListToArrayBenchmark n/a n/a 82525 194426.88 7563 38420.48 7433 38420.48 n/a n/a 101.7% 100% 1110.3% 506.1%
IQueryableProjectionBenchmark 614900 31784.96 591100 31016.96 599800 33105.92 596600 32983.04 103.1% 96.4% 100.5% 100.4% 99.1% 94%
ListToArrayBenchmark n/a n/a 80664 194426.88 7503 38420.48 7223 38420.48 n/a n/a 103.9% 100% 1116.8% 506.1%
ListToHashSetBenchmark 361.5 5765.12 2285.6 5765.12 2515.4 5806.08 2619.8 5765.12 13.8% 100% 96% 100.7% 87.2% 100%
NestedDtoBenchmark 128253 225320.96 94943 227471.36 7755 38942.72 7731 38942.72 1658.9% 578.6% 100.3% 100% 1228.1% 584.1%

Benchmark trends (Mappa)

Lower is better. Compared against the latest published Mappa-only rows from MAPPA-BENCHMARK-HISTORY.md.

Benchmark Measure Baseline PR Δ Trend
ArrayToListBenchmark TIME_NS 7458.92 7673.31 +214.39
ArrayToListBenchmark ALLOC_B 38456 38456 0 =
DictionaryBenchmark TIME_NS 13290 13730 +440
DictionaryBenchmark ALLOC_B 58316.8 58316.8 0 =
ListToArrayBenchmark TIME_NS 7267 7223 -44
ListToArrayBenchmark ALLOC_B 38420.48 38420.48 0 =
FastListToArrayBenchmark TIME_NS 7179 7433 +254
FastListToArrayBenchmark ALLOC_B 38420.48 38420.48 0 =
IQueryableProjectionBenchmark TIME_NS 598600 596600 -2000
IQueryableProjectionBenchmark ALLOC_B 32983.04 32983.04 0 =
NestedDtoBenchmark TIME_NS 6996 7731 +735
NestedDtoBenchmark ALLOC_B 38942.72 38942.72 0 =
ListToHashSetBenchmark TIME_NS 2509.3 2619.8 +110.5
ListToHashSetBenchmark ALLOC_B 5765.12 5765.12 0 =

@sanelli
sanelli merged commit 42e1fc5 into main Jul 31, 2026
1 check passed
@sanelli
sanelli deleted the 290-improve-tests branch July 31, 2026 21:10
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.

Improve tests

1 participant