Skip to content

test(csharp): test NaN and infinity in variant values - #4922

Merged
CurtHagenlocher merged 1 commit into
apache:mainfrom
CurtHagenlocher:variant-nan-test
Oct 18, 2026
Merged

CurtHagenlocher merged 1 commit into
apache:mainfrom
CurtHagenlocher:variant-nan-test

Conversation

@CurtHagenlocher

Copy link
Copy Markdown
Contributor

What's changed

Adds the variant test promised in #4919. Variants converted to JSON use the same writer as structs, so they already get the behavior from #4921: NaN and ±Infinity are written as the strings "NaN", "Infinity" and "-Infinity". This test pins that down.

VariantNonFiniteValues reads a variant column with a non-finite double and float inside an object and an array, and a top-level NaN:

  • With StructBehavior.JsonString, it checks the exact JSON.
  • With StructBehavior.Strict, it checks that the .NET values keep the actual NaN and infinity values.

With the #4921 change reverted, the JSON case fails with the original ArgumentException.

🤖 Generated with Claude Code

Variants converted to JSON use the same writer as structs, which writes
non-finite floats and doubles as strings since apache#4921.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CurtHagenlocher
CurtHagenlocher merged commit ac1aebe into apache:main Oct 18, 2026
9 checks passed
@CurtHagenlocher
CurtHagenlocher deleted the variant-nan-test branch October 18, 2026 18:09
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