-
Notifications
You must be signed in to change notification settings - Fork 1
Mutation testing pilot: pitest profiles + bounds-guard hardening (core + reader) #93
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
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
decd0be
test(reader): mutation-testing pilot — harden segment-spec bounds guard
dfa1 4f0c2e4
build: pin maven-jar-plugin version in root pluginManagement
dfa1 9c6188f
test(reader): kill checkBlobBounds + Layout-kind mutants (pilot itera…
dfa1 d915f13
refactor(reader): drop redundant `offset > fileSize` bounds clause
dfa1 337c32c
build(core): add pitest profile targeting IoBounds
dfa1 df02ce7
test(reader): kill convertLayout/convertDType boundary mutants (pilot…
dfa1 170bb1b
docs: document how to run mutation testing (pitest)
dfa1 b23a853
build: hoist common pitest config into parent pluginManagement
dfa1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
reader/src/test/java/io/github/dfa1/vortex/reader/LayoutKindTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package io.github.dfa1.vortex.reader; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.Arguments; | ||
| import org.junit.jupiter.params.provider.MethodSource; | ||
|
|
||
| import java.util.List; | ||
| import java.util.stream.Stream; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| /// Pins the [Layout] encoding-kind predicates (`isFlat`, `isChunked`, `isStruct`, `isZoned`, | ||
| /// `isDict`). [ScanIterator] dispatches layout-tree traversal on these, so a predicate that | ||
| /// silently returns a constant would route a whole layout family down the wrong decode path. | ||
| /// One layout per encoding id, asserting the matching predicate is `true` and every other is | ||
| /// `false` — which fixes each method's return to its `encodingId` rather than a constant. | ||
| class LayoutKindTest { | ||
|
|
||
| private static Layout layout(String encodingId) { | ||
| return new Layout(encodingId, 0L, null, List.of(), List.of()); | ||
| } | ||
|
|
||
| static Stream<Arguments> kinds() { | ||
| // (encodingId, isFlat, isChunked, isStruct, isZoned, isDict) | ||
| return Stream.of( | ||
| Arguments.of(Layout.FLAT, true, false, false, false, false), | ||
| Arguments.of(Layout.CHUNKED, false, true, false, false, false), | ||
| Arguments.of(Layout.STRUCT, false, false, true, false, false), | ||
| Arguments.of(Layout.ZONED, false, false, false, true, false), | ||
| Arguments.of(Layout.DICT, false, false, false, false, true)); | ||
| } | ||
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("kinds") | ||
| void predicates_matchOnlyOwnEncodingId( | ||
| String encodingId, boolean flat, boolean chunked, boolean struct, boolean zoned, boolean dict) { | ||
| // Given | ||
| Layout sut = layout(encodingId); | ||
|
|
||
| // When / Then — exactly one predicate is true, the rest false | ||
| assertThat(sut.isFlat()).as("isFlat").isEqualTo(flat); | ||
| assertThat(sut.isChunked()).as("isChunked").isEqualTo(chunked); | ||
| assertThat(sut.isStruct()).as("isStruct").isEqualTo(struct); | ||
| assertThat(sut.isZoned()).as("isZoned").isEqualTo(zoned); | ||
| assertThat(sut.isDict()).as("isDict").isEqualTo(dict); | ||
| } | ||
|
|
||
| @Test | ||
| void predicates_allFalse_forUnknownEncodingId() { | ||
| // Given — an id matching no known layout kind | ||
| Layout sut = layout("vortex.bogus"); | ||
|
|
||
| // When / Then — no predicate claims it | ||
| assertThat(sut.isFlat()).isFalse(); | ||
| assertThat(sut.isChunked()).isFalse(); | ||
| assertThat(sut.isStruct()).isFalse(); | ||
| assertThat(sut.isZoned()).isFalse(); | ||
| assertThat(sut.isDict()).isFalse(); | ||
| } | ||
| } |
Oops, something went wrong.
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.
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.
it is possible to define this once in the parent?
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 in b23a853. Parent
pitestprofile now holds the version, junit5 engine dep, verify-phase execution, and output config under<pluginManagement>; core/reader keep only their<targetClasses>. targetTests dropped — PIT defaults to the test packages matching the targets. Scores unchanged (reader 95%, core 100%).