Only test heap segments on Java 22 and greater, in JDKVectorInt7uBenchmarkTests

This commit is contained in:
ChrisHegarty 2025-06-28 10:22:18 +01:00
parent a85a8ac6bb
commit 139cebc04e
1 changed files with 7 additions and 1 deletions

View File

@ -32,6 +32,10 @@ public class JDKVectorInt7uBenchmarkTests extends ESTestCase {
assumeFalse("doesn't work on windows yet", Constants.WINDOWS);
}
static boolean supportsHeapSegments() {
return Runtime.version().feature() >= 22;
}
public void testDotProduct() {
for (int i = 0; i < 100; i++) {
var bench = new JDKVectorInt7uBenchmark();
@ -40,8 +44,10 @@ public class JDKVectorInt7uBenchmarkTests extends ESTestCase {
try {
float expected = dotProductScalar(bench.byteArrayA, bench.byteArrayB);
assertEquals(expected, bench.dotProductLucene(), delta);
assertEquals(expected, bench.dotProductNativeWithHeapSeg(), delta);
assertEquals(expected, bench.dotProductNativeWithNativeSeg(), delta);
if (supportsHeapSegments()) {
assertEquals(expected, bench.dotProductNativeWithHeapSeg(), delta);
}
} finally {
bench.teardown();
}