Add CombinableArbitrary Numeric Types (Float, Double, BigInteger, BigDecimal) #1261
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add numeric CombinableArbitrary types (Float, Double, BigInteger, BigDecimal) for customizable numeric value generation with type-specific constraint methods.
Description
Implemented four numeric CombinableArbitrary types by wrapping existing Jqwik and Kotest arbitrary implementations, adding type-specific constraints following established CombinableArbitrary patterns.
Added components for each type:
FloatCombinableArbitraryFloatCombinableArbitraryDelegatorJqwikFloatCombinableArbitraryKotestFloatCombinableArbitraryCombinableArbitrary.floats()DoubleCombinableArbitraryDoubleCombinableArbitraryDelegatorJqwikDoubleCombinableArbitraryKotestDoubleCombinableArbitraryCombinableArbitrary.doubles()BigIntegerCombinableArbitraryBigIntegerCombinableArbitraryDelegatorJqwikBigIntegerCombinableArbitraryKotestBigIntegerCombinableArbitraryCombinableArbitrary.bigIntegers()BigDecimalCombinableArbitraryBigDecimalCombinableArbitraryDelegatorJqwikBigDecimalCombinableArbitraryKotestBigDecimalCombinableArbitraryCombinableArbitrary.bigDecimals()Key features by type:
Float/Double:
.positive(),.negative(),.nonZero(),.withRange().withPrecision(int)for decimal place specification.finite(),.infinite(),.nan().withSpecialValue(),.withStandardSpecialValues()(injects NaN, MIN_VALUE, MIN_NORMAL, POSITIVE_INFINITY, NEGATIVE_INFINITY).percentage()(0-100),.score()(0-100),.normalized()(0.0-1.0)BigInteger:
.positive(),.negative(),.nonZero(),.withRange().even(),.odd(),.multipleOf(BigInteger),.prime().percentage()(0-100),.score()(0-100),.score(min, max)BigDecimal:
.positive(),.negative(),.nonZero(),.withRange().withPrecision(int),.withScale(int),.stripTrailingZeros().percentage()(0.0-100.0),.score()(0-100),.score(min, max),.normalized()(0.0-1.0)Usage examples:
How Has This Been Tested?
Added comprehensive test suites for each type:
FloatCombinableArbitraryTestDoubleCombinableArbitraryTestBigIntegerCombinableArbitraryTestBigDecimalCombinableArbitraryTestTests cover:
Is the Document updated?
Documentation will be updated to include usage examples for all four numeric CombinableArbitrary types, with emphasis on precision control, special value handling, mathematical properties, and domain-specific constraint methods.