-
Notifications
You must be signed in to change notification settings - Fork 116
Add ShortCombinableArbitrary #1240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| boolean allMultiplesOfThree = IntStream.range(0, 100) | ||
| .mapToObj(i -> CombinableArbitrary.shorts().even().multipleOf((short)3).combined()) | ||
| .allMatch(s -> s % 3 == 0); | ||
|
|
||
| // then | ||
| then(allMultiplesOfThree).isTrue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the clarity, it is better to use the report of assertj.
Instead of use boolean value in then, it is better to use the actual value Rather than using a Boolean value in the 'then' clause, it is better to use the actual value CombinableArbitrary.shorts().even().multipleOf((short)3).combined().
It works same for other tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
I've refactored all the tests to use direct assertions as suggested.
Also completed similar refactoring for other types for your reference.
dabbfca to
ad47036
Compare
- nonZero() / multipleOf(short) - percentage() - score() - year() / month() / day() - hour() / minute()
- Use Kotlin Int instead of Java Integer in SimpleValueJqwikPluginTest - Fix nonZeroWithMultipleOf test to follow Last Win strategy
- SimpleValueJqwikPluginTest - KotestByteCombinableArbitrary
8a5c092 to
a181516
Compare
seongahjo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Summary
Add ShortCombinableArbitrary for customizable Short value generation following existing CombinableArbitrary pattern with Short-specific enhancements including domain-specific constraints.
Description
Implemented ShortCombinableArbitrary to provide easy customization of Short value generation, addressing the lack of short-specific constraints in current API with enhanced domain-specific methods.
Added components:
ShortCombinableArbitraryinterface with standard constraint methods and domain-specific extensionsShortCombinableArbitraryDelegatorfor filter/null injection operationsJqwikShortCombinableArbitraryimplementationCombinableArbitrary.shorts()Key features:
.positive(),.negative(),.even(),.odd(),.withRange(short, short).nonZero()method for avoiding division by zero errors.multipleOf(short)method for generating multiples of specific values.percentage()- generates values 0-100 for percentage representation.score()- generates values 0-100 for scoring systems.year()- generates values 1900-2100 for year representation.month()- generates values 1-12 for month representation.day()- generates values 1-31 for day representation.hour()- generates values 0-23 for hour representation.minute()- generates values 0-59 for minute representationUsage example:
How Has This Been Tested?
Added comprehensive test suite in
ShortCombinableArbitraryTest:Is the Document updated?
Documentation will be updated to include ShortCombinableArbitrary usage examples alongside existing numeric arbitrary types, with special emphasis on domain-specific constraint methods for common Short use cases in business applications.