Skip to content

Commit 6ecf845

Browse files
dfa1claude
andcommitted
chore(core): replace jqwik with seeded JUnit 5 parameterized tests
Drop net.jqwik:jqwik test dependency from core/pom.xml. Migrate two @Property adversarial tests in PcoEncodingTest to @ParameterizedTest + @MethodSource with seeded Random generators. Also correct TODO.md: MaskedEncoding decode is implemented. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8ee5290 commit 6ecf845

3 files changed

Lines changed: 28 additions & 15 deletions

File tree

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
| `vortex.listview` | `ListViewEncoding` | ✅ | ✅ | — | three children: elements + offsets (len N) + sizes (len N); fixture uses U16 for both |
140140
| `vortex.fixed_size_list` | `FixedSizeListEncoding` | ✅ | ✅ | — | one child: flat elements; no offsets |
141141
| `vortex.zstd` | `ZstdEncoding` | ✅ | ✅ | — | Primitive, Utf8, Binary (no dict, no nullable); uses airlift/aircompressor |
142-
| `vortex.masked` | | ❌ | | unknown | ID registered; no decoder yet; no S3 fixture in v0.72.0 |
142+
| `vortex.masked` | `MaskedEncoding` | ✅ | ❌ | | child[0]=payload (non-nullable), child[1]=validity Bool (optional); no S3 fixture in v0.72.0 |
143143
| `vortex.patched` | — | ❌ | ❌ | unknown | ID registered; no decoder yet; no S3 fixture in v0.72.0 |
144144
| `vortex.variant` | — | ❌ | ❌ | unknown | ID registered; no decoder yet; no S3 fixture in v0.72.0 |
145145

core/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040
<artifactId>mockito-junit-jupiter</artifactId>
4141
<scope>test</scope>
4242
</dependency>
43-
<dependency>
44-
<groupId>net.jqwik</groupId>
45-
<artifactId>jqwik</artifactId>
46-
<scope>test</scope>
47-
</dependency>
4843
</dependencies>
4944

5045
<build>

core/src/test/java/io/github/dfa1/vortex/encoding/PcoEncodingTest.java

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
import io.github.dfa1.vortex.core.array.LongArray;
88
import io.github.dfa1.vortex.core.array.MaskedArray;
99
import io.github.dfa1.vortex.proto.EncodingProtos;
10-
import net.jqwik.api.ForAll;
11-
import net.jqwik.api.Property;
12-
import net.jqwik.api.constraints.Size;
1310
import org.junit.jupiter.api.Nested;
1411
import org.junit.jupiter.api.Test;
1512
import org.junit.jupiter.params.ParameterizedTest;
1613
import org.junit.jupiter.params.provider.EnumSource;
14+
import org.junit.jupiter.params.provider.MethodSource;
1715
import org.junit.jupiter.params.provider.ValueSource;
1816

1917
import java.lang.foreign.Arena;
2018
import java.lang.foreign.MemorySegment;
2119
import java.lang.foreign.ValueLayout;
2220
import java.nio.ByteBuffer;
21+
import java.util.Random;
22+
import java.util.stream.Stream;
2323

2424
import static org.assertj.core.api.Assertions.assertThat;
2525
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -679,10 +679,28 @@ void dict_nUniqueExceedsMax_throwsVortexException() {
679679
@Nested
680680
class Adversarial {
681681

682+
static Stream<byte[]> chunkMetaBytesProvider() {
683+
Random rng = new Random(0xDEADBEEFL);
684+
return Stream.generate(() -> {
685+
byte[] b = new byte[1 + rng.nextInt(64)];
686+
rng.nextBytes(b);
687+
return b;
688+
}).limit(50);
689+
}
690+
691+
static Stream<byte[]> pageBytesProvider() {
692+
Random rng = new Random(0xCAFEBABEL);
693+
return Stream.generate(() -> {
694+
byte[] b = new byte[4 + rng.nextInt(125)];
695+
rng.nextBytes(b);
696+
return b;
697+
}).limit(50);
698+
}
699+
682700
/// Random chunk-meta bytes — any exception must be a VortexException, not a JVM crash exception.
683-
@Property(tries = 50)
684-
void randomChunkMetaBytes_neverThrowsJvmException(
685-
@ForAll @Size(min = 1, max = 64) byte[] chunkMetaBytes) {
701+
@ParameterizedTest
702+
@MethodSource("chunkMetaBytesProvider")
703+
void randomChunkMetaBytes_neverThrowsJvmException(byte[] chunkMetaBytes) {
686704
// Given — valid pco header + 1 chunk with 1 page of 1 value; garbage chunk-meta bytes.
687705
var sut = new PcoEncoding();
688706
DecodeContext ctx = ctxWith(
@@ -700,9 +718,9 @@ void randomChunkMetaBytes_neverThrowsJvmException(
700718
}
701719

702720
/// Random page bytes after a valid Classic-mode chunk meta — must not crash the JVM.
703-
@Property(tries = 50)
704-
void randomPageBytes_classicMode_neverThrowsJvmException(
705-
@ForAll @Size(min = 4, max = 128) byte[] pageBytes) {
721+
@ParameterizedTest
722+
@MethodSource("pageBytesProvider")
723+
void randomPageBytes_classicMode_neverThrowsJvmException(byte[] pageBytes) {
706724
// Given — Classic mode, delta=NoOp, ansSizeLog=0, nBins=0 chunk meta.
707725
var sut = new PcoEncoding();
708726
// byte0: mode=0 (bits3:0), deltaVariant=0 (bits7:4) → 0x00

0 commit comments

Comments
 (0)