diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 0a7bc5a8962..b678921dd97 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Red Hat Inc. All rights reserved. * Copyright 2025 Arm Limited and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -664,16 +664,52 @@ void VM_Version::initialize() { void VM_Version::insert_features_names(uint64_t features, stringStream& ss) { int i = 0; ss.join([&]() { - while (i < MAX_CPU_FEATURES) { - if (supports_feature((VM_Version::Feature_Flag)i)) { - return _features_names[i++]; + const char* str = nullptr; + while ((i < MAX_CPU_FEATURES) && (str == nullptr)) { + if (supports_feature(features, (VM_Version::Feature_Flag)i)) { + str = _features_names[i]; } i += 1; } - return (const char*)nullptr; + return str; }, ", "); } +void VM_Version::get_cpu_features_name(void* features_buffer, stringStream& ss) { + uint64_t features = *(uint64_t*)features_buffer; + insert_features_names(features, ss); +} + +void VM_Version::get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss) { + uint64_t vm_features_set1 = *(uint64_t*)features_set1; + uint64_t vm_features_set2 = *(uint64_t*)features_set2; + int i = 0; + ss.join([&]() { + const char* str = nullptr; + while ((i < MAX_CPU_FEATURES) && (str == nullptr)) { + Feature_Flag flag = (Feature_Flag)i; + if (supports_feature(vm_features_set1, flag) && !supports_feature(vm_features_set2, flag)) { + str = _features_names[i]; + } + i += 1; + } + return str; + }, ", "); +} + +int VM_Version::cpu_features_size() { + return sizeof(_features); +} + +void VM_Version::store_cpu_features(void* buf) { + *(uint64_t*)buf = _features; +} + +bool VM_Version::supports_features(void* features_buffer) { + uint64_t features_to_test = *(uint64_t*)features_buffer; + return (_features & features_to_test) == features_to_test; +} + #if defined(LINUX) static bool check_info_file(const char* fpath, const char* virt1, VirtualizationType vt1, diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp index 38b112d9936..07f6c09e18f 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -184,6 +184,9 @@ public: static bool supports_feature(Feature_Flag flag) { return (_features & BIT_MASK(flag)) != 0; } + static bool supports_feature(uint64_t features, Feature_Flag flag) { + return (features & BIT_MASK(flag)) != 0; + } static int cpu_family() { return _cpu; } static int cpu_model() { return _model; } @@ -244,6 +247,20 @@ public: static bool use_neon_for_vector(int vector_length_in_bytes) { return vector_length_in_bytes <= 16; } + + static void get_cpu_features_name(void* features_buffer, stringStream& ss); + + // Returns names of features present in features_set1 but not in features_set2 + static void get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss); + + // Returns number of bytes required to store cpu features representation + static int cpu_features_size(); + + // Stores cpu features representation in the provided buffer. This representation is arch dependent. + // Size of the buffer must be same as returned by cpu_features_size() + static void store_cpu_features(void* buf); + + static bool supports_features(void* features_to_test); }; #endif // CPU_AARCH64_VM_VERSION_AARCH64_HPP diff --git a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp index 803bb6bfe69..45537e0ea96 100644 --- a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp +++ b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2025 SAP SE. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,11 +49,6 @@ #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") -// Workaround for C++ overloading nastiness on '0' for RegisterOrConstant. -inline static RegisterOrConstant constant(int value) { - return RegisterOrConstant(value); -} - void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg, Register temp_reg, Register temp2_reg) { if (VerifyMethodHandles) { diff --git a/src/hotspot/cpu/s390/compiledIC_s390.cpp b/src/hotspot/cpu/s390/compiledIC_s390.cpp index 8501a0cb346..43f5d80250e 100644 --- a/src/hotspot/cpu/s390/compiledIC_s390.cpp +++ b/src/hotspot/cpu/s390/compiledIC_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -29,9 +29,6 @@ #include "memory/resourceArea.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/safepoint.hpp" -#ifdef COMPILER2 -#include "opto/matcher.hpp" -#endif // ---------------------------------------------------------------------------- @@ -39,7 +36,6 @@ #define __ masm-> address CompiledDirectCall::emit_to_interp_stub(MacroAssembler *masm, address mark/* = nullptr*/) { -#ifdef COMPILER2 // Stub is fixed up when the corresponding call is converted from calling // compiled code to calling interpreted code. if (mark == nullptr) { @@ -55,7 +51,7 @@ address CompiledDirectCall::emit_to_interp_stub(MacroAssembler *masm, address ma __ relocate(static_stub_Relocation::spec(mark)); AddressLiteral meta = __ allocate_metadata_address(nullptr); - bool success = __ load_const_from_toc(as_Register(Matcher::inline_cache_reg_encode()), meta); + bool success = __ load_const_from_toc(Z_inline_cache, meta); __ set_inst_mark(); AddressLiteral a((address)-1); @@ -67,10 +63,6 @@ address CompiledDirectCall::emit_to_interp_stub(MacroAssembler *masm, address ma __ z_br(Z_R1); __ end_a_stub(); // Update current stubs pointer and restore insts_end. return stub; -#else - ShouldNotReachHere(); - return nullptr; -#endif } #undef __ diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index ef62a29c834..78d6dec08cf 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -48,7 +48,7 @@ int VM_Version::_stepping; bool VM_Version::_has_intel_jcc_erratum; VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, }; -#define DECLARE_CPU_FEATURE_NAME(id, name, bit) name, +#define DECLARE_CPU_FEATURE_NAME(id, name, bit) XSTR(name), const char* VM_Version::_features_names[] = { CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_NAME)}; #undef DECLARE_CPU_FEATURE_NAME @@ -3297,12 +3297,50 @@ bool VM_Version::is_intrinsic_supported(vmIntrinsicID id) { void VM_Version::insert_features_names(VM_Version::VM_Features features, stringStream& ss) { int i = 0; ss.join([&]() { - while (i < MAX_CPU_FEATURES) { - if (_features.supports_feature((VM_Version::Feature_Flag)i)) { - return _features_names[i++]; + const char* str = nullptr; + while ((i < MAX_CPU_FEATURES) && (str == nullptr)) { + if (features.supports_feature((VM_Version::Feature_Flag)i)) { + str = _features_names[i]; } i += 1; } - return (const char*)nullptr; + return str; }, ", "); } + +void VM_Version::get_cpu_features_name(void* features_buffer, stringStream& ss) { + VM_Features* features = (VM_Features*)features_buffer; + insert_features_names(*features, ss); +} + +void VM_Version::get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss) { + VM_Features* vm_features_set1 = (VM_Features*)features_set1; + VM_Features* vm_features_set2 = (VM_Features*)features_set2; + int i = 0; + ss.join([&]() { + const char* str = nullptr; + while ((i < MAX_CPU_FEATURES) && (str == nullptr)) { + Feature_Flag flag = (Feature_Flag)i; + if (vm_features_set1->supports_feature(flag) && !vm_features_set2->supports_feature(flag)) { + str = _features_names[i]; + } + i += 1; + } + return str; + }, ", "); +} + +int VM_Version::cpu_features_size() { + return sizeof(VM_Features); +} + +void VM_Version::store_cpu_features(void* buf) { + VM_Features copy = _features; + copy.clear_feature(CPU_HT); // HT does not result in incompatibility of aot code cache + memcpy(buf, ©, sizeof(VM_Features)); +} + +bool VM_Version::supports_features(void* features_buffer) { + VM_Features* features_to_test = (VM_Features*)features_buffer; + return _features.supports_features(features_to_test); +} diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp index a3f2a801198..e0a895737b7 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.hpp +++ b/src/hotspot/cpu/x86/vm_version_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -377,84 +377,84 @@ protected: */ enum Feature_Flag { #define CPU_FEATURE_FLAGS(decl) \ - decl(CX8, "cx8", 0) /* next bits are from cpuid 1 (EDX) */ \ - decl(CMOV, "cmov", 1) \ - decl(FXSR, "fxsr", 2) \ - decl(HT, "ht", 3) \ + decl(CX8, cx8, 0) /* next bits are from cpuid 1 (EDX) */ \ + decl(CMOV, cmov, 1) \ + decl(FXSR, fxsr, 2) \ + decl(HT, ht, 3) \ \ - decl(MMX, "mmx", 4) \ - decl(3DNOW_PREFETCH, "3dnowpref", 5) /* Processor supports 3dnow prefetch and prefetchw instructions */ \ + decl(MMX, mmx, 4) \ + decl(3DNOW_PREFETCH, 3dnowpref, 5) /* Processor supports 3dnow prefetch and prefetchw instructions */ \ /* may not necessarily support other 3dnow instructions */ \ - decl(SSE, "sse", 6) \ - decl(SSE2, "sse2", 7) \ + decl(SSE, sse, 6) \ + decl(SSE2, sse2, 7) \ \ - decl(SSE3, "sse3", 8 ) /* SSE3 comes from cpuid 1 (ECX) */ \ - decl(SSSE3, "ssse3", 9 ) \ - decl(SSE4A, "sse4a", 10) \ - decl(SSE4_1, "sse4.1", 11) \ + decl(SSE3, sse3, 8 ) /* SSE3 comes from cpuid 1 (ECX) */ \ + decl(SSSE3, ssse3, 9 ) \ + decl(SSE4A, sse4a, 10) \ + decl(SSE4_1, sse4.1, 11) \ \ - decl(SSE4_2, "sse4.2", 12) \ - decl(POPCNT, "popcnt", 13) \ - decl(LZCNT, "lzcnt", 14) \ - decl(TSC, "tsc", 15) \ + decl(SSE4_2, sse4.2, 12) \ + decl(POPCNT, popcnt, 13) \ + decl(LZCNT, lzcnt, 14) \ + decl(TSC, tsc, 15) \ \ - decl(TSCINV_BIT, "tscinvbit", 16) \ - decl(TSCINV, "tscinv", 17) \ - decl(AVX, "avx", 18) \ - decl(AVX2, "avx2", 19) \ + decl(TSCINV_BIT, tscinvbit, 16) \ + decl(TSCINV, tscinv, 17) \ + decl(AVX, avx, 18) \ + decl(AVX2, avx2, 19) \ \ - decl(AES, "aes", 20) \ - decl(ERMS, "erms", 21) /* enhanced 'rep movsb/stosb' instructions */ \ - decl(CLMUL, "clmul", 22) /* carryless multiply for CRC */ \ - decl(BMI1, "bmi1", 23) \ + decl(AES, aes, 20) \ + decl(ERMS, erms, 21) /* enhanced 'rep movsb/stosb' instructions */ \ + decl(CLMUL, clmul, 22) /* carryless multiply for CRC */ \ + decl(BMI1, bmi1, 23) \ \ - decl(BMI2, "bmi2", 24) \ - decl(RTM, "rtm", 25) /* Restricted Transactional Memory instructions */ \ - decl(ADX, "adx", 26) \ - decl(AVX512F, "avx512f", 27) /* AVX 512bit foundation instructions */ \ + decl(BMI2, bmi2, 24) \ + decl(RTM, rtm, 25) /* Restricted Transactional Memory instructions */ \ + decl(ADX, adx, 26) \ + decl(AVX512F, avx512f, 27) /* AVX 512bit foundation instructions */ \ \ - decl(AVX512DQ, "avx512dq", 28) \ - decl(AVX512PF, "avx512pf", 29) \ - decl(AVX512ER, "avx512er", 30) \ - decl(AVX512CD, "avx512cd", 31) \ + decl(AVX512DQ, avx512dq, 28) \ + decl(AVX512PF, avx512pf, 29) \ + decl(AVX512ER, avx512er, 30) \ + decl(AVX512CD, avx512cd, 31) \ \ - decl(AVX512BW, "avx512bw", 32) /* Byte and word vector instructions */ \ - decl(AVX512VL, "avx512vl", 33) /* EVEX instructions with smaller vector length */ \ - decl(SHA, "sha", 34) /* SHA instructions */ \ - decl(FMA, "fma", 35) /* FMA instructions */ \ + decl(AVX512BW, avx512bw, 32) /* Byte and word vector instructions */ \ + decl(AVX512VL, avx512vl, 33) /* EVEX instructions with smaller vector length */ \ + decl(SHA, sha, 34) /* SHA instructions */ \ + decl(FMA, fma, 35) /* FMA instructions */ \ \ - decl(VZEROUPPER, "vzeroupper", 36) /* Vzeroupper instruction */ \ - decl(AVX512_VPOPCNTDQ, "avx512_vpopcntdq", 37) /* Vector popcount */ \ - decl(AVX512_VPCLMULQDQ, "avx512_vpclmulqdq", 38) /* Vector carryless multiplication */ \ - decl(AVX512_VAES, "avx512_vaes", 39) /* Vector AES instruction */ \ + decl(VZEROUPPER, vzeroupper, 36) /* Vzeroupper instruction */ \ + decl(AVX512_VPOPCNTDQ, avx512_vpopcntdq, 37) /* Vector popcount */ \ + decl(AVX512_VPCLMULQDQ, avx512_vpclmulqdq, 38) /* Vector carryless multiplication */ \ + decl(AVX512_VAES, avx512_vaes, 39) /* Vector AES instruction */ \ \ - decl(AVX512_VNNI, "avx512_vnni", 40) /* Vector Neural Network Instructions */ \ - decl(FLUSH, "clflush", 41) /* flush instruction */ \ - decl(FLUSHOPT, "clflushopt", 42) /* flusopth instruction */ \ - decl(CLWB, "clwb", 43) /* clwb instruction */ \ + decl(AVX512_VNNI, avx512_vnni, 40) /* Vector Neural Network Instructions */ \ + decl(FLUSH, clflush, 41) /* flush instruction */ \ + decl(FLUSHOPT, clflushopt, 42) /* flusopth instruction */ \ + decl(CLWB, clwb, 43) /* clwb instruction */ \ \ - decl(AVX512_VBMI2, "avx512_vbmi2", 44) /* VBMI2 shift left double instructions */ \ - decl(AVX512_VBMI, "avx512_vbmi", 45) /* Vector BMI instructions */ \ - decl(HV, "hv", 46) /* Hypervisor instructions */ \ - decl(SERIALIZE, "serialize", 47) /* CPU SERIALIZE */ \ - decl(RDTSCP, "rdtscp", 48) /* RDTSCP instruction */ \ - decl(RDPID, "rdpid", 49) /* RDPID instruction */ \ - decl(FSRM, "fsrm", 50) /* Fast Short REP MOV */ \ - decl(GFNI, "gfni", 51) /* Vector GFNI instructions */ \ - decl(AVX512_BITALG, "avx512_bitalg", 52) /* Vector sub-word popcount and bit gather instructions */\ - decl(F16C, "f16c", 53) /* Half-precision and single precision FP conversion instructions*/ \ - decl(PKU, "pku", 54) /* Protection keys for user-mode pages */ \ - decl(OSPKE, "ospke", 55) /* OS enables protection keys */ \ - decl(CET_IBT, "cet_ibt", 56) /* Control Flow Enforcement - Indirect Branch Tracking */ \ - decl(CET_SS, "cet_ss", 57) /* Control Flow Enforcement - Shadow Stack */ \ - decl(AVX512_IFMA, "avx512_ifma", 58) /* Integer Vector FMA instructions*/ \ - decl(AVX_IFMA, "avx_ifma", 59) /* 256-bit VEX-coded variant of AVX512-IFMA*/ \ - decl(APX_F, "apx_f", 60) /* Intel Advanced Performance Extensions*/ \ - decl(SHA512, "sha512", 61) /* SHA512 instructions*/ \ - decl(AVX512_FP16, "avx512_fp16", 62) /* AVX512 FP16 ISA support*/ \ - decl(AVX10_1, "avx10_1", 63) /* AVX10 512 bit vector ISA Version 1 support*/ \ - decl(AVX10_2, "avx10_2", 64) /* AVX10 512 bit vector ISA Version 2 support*/ \ - decl(HYBRID, "hybrid", 65) /* Hybrid architecture */ + decl(AVX512_VBMI2, avx512_vbmi2, 44) /* VBMI2 shift left double instructions */ \ + decl(AVX512_VBMI, avx512_vbmi, 45) /* Vector BMI instructions */ \ + decl(HV, hv, 46) /* Hypervisor instructions */ \ + decl(SERIALIZE, serialize, 47) /* CPU SERIALIZE */ \ + decl(RDTSCP, rdtscp, 48) /* RDTSCP instruction */ \ + decl(RDPID, rdpid, 49) /* RDPID instruction */ \ + decl(FSRM, fsrm, 50) /* Fast Short REP MOV */ \ + decl(GFNI, gfni, 51) /* Vector GFNI instructions */ \ + decl(AVX512_BITALG, avx512_bitalg, 52) /* Vector sub-word popcount and bit gather instructions */\ + decl(F16C, f16c, 53) /* Half-precision and single precision FP conversion instructions*/ \ + decl(PKU, pku, 54) /* Protection keys for user-mode pages */ \ + decl(OSPKE, ospke, 55) /* OS enables protection keys */ \ + decl(CET_IBT, cet_ibt, 56) /* Control Flow Enforcement - Indirect Branch Tracking */ \ + decl(CET_SS, cet_ss, 57) /* Control Flow Enforcement - Shadow Stack */ \ + decl(AVX512_IFMA, avx512_ifma, 58) /* Integer Vector FMA instructions*/ \ + decl(AVX_IFMA, avx_ifma, 59) /* 256-bit VEX-coded variant of AVX512-IFMA*/ \ + decl(APX_F, apx_f, 60) /* Intel Advanced Performance Extensions*/ \ + decl(SHA512, sha512, 61) /* SHA512 instructions*/ \ + decl(AVX512_FP16, avx512_fp16, 62) /* AVX512 FP16 ISA support*/ \ + decl(AVX10_1, avx10_1, 63) /* AVX10 512 bit vector ISA Version 1 support*/ \ + decl(AVX10_2, avx10_2, 64) /* AVX10 512 bit vector ISA Version 2 support*/ \ + decl(HYBRID, hybrid, 65) /* Hybrid architecture */ #define DECLARE_CPU_FEATURE_FLAG(id, name, bit) CPU_##id = (bit), CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_FLAG) @@ -516,6 +516,15 @@ protected: int idx = index(feature); return (_features_bitmap[idx] & bit_mask(feature)) != 0; } + + bool supports_features(VM_Features* features_to_test) { + for (int i = 0; i < features_bitmap_element_count(); i++) { + if ((_features_bitmap[i] & features_to_test->_features_bitmap[i]) != features_to_test->_features_bitmap[i]) { + return false; + } + } + return true; + } }; // CPU feature flags vector, can be affected by VM settings. @@ -1103,6 +1112,20 @@ public: static bool supports_tscinv_ext(void); static void initialize_cpu_information(void); + + static void get_cpu_features_name(void* features_buffer, stringStream& ss); + + // Returns names of features present in features_set1 but not in features_set2 + static void get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss); + + // Returns number of bytes required to store cpu features representation + static int cpu_features_size(); + + // Stores cpu features representation in the provided buffer. This representation is arch dependent. + // Size of the buffer must be same as returned by cpu_features_size() + static void store_cpu_features(void* buf); + + static bool supports_features(void* features_to_test); }; #endif // CPU_X86_VM_VERSION_X86_HPP diff --git a/src/hotspot/os/aix/os_perf_aix.cpp b/src/hotspot/os/aix/os_perf_aix.cpp index aa8819d035f..cbf78083483 100644 --- a/src/hotspot/os/aix/os_perf_aix.cpp +++ b/src/hotspot/os/aix/os_perf_aix.cpp @@ -143,12 +143,6 @@ static OSReturn get_jvm_load(double* jvm_uload, double* jvm_sload) { return OS_OK; } -static void update_prev_time(jvm_time_store_t* from, jvm_time_store_t* to) { - if (from && to) { - memcpy(to, from, sizeof(jvm_time_store_t)); - } -} - static void update_prev_ticks(cpu_tick_store_t* from, cpu_tick_store_t* to) { if (from && to) { memcpy(to, from, sizeof(cpu_tick_store_t)); diff --git a/src/hotspot/share/cds/aotClassLocation.cpp b/src/hotspot/share/cds/aotClassLocation.cpp index f77aac3540c..9275b914ef9 100644 --- a/src/hotspot/share/cds/aotClassLocation.cpp +++ b/src/hotspot/share/cds/aotClassLocation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -426,7 +426,8 @@ bool AOTClassLocation::check(const char* runtime_path, bool has_aot_linked_class bool size_differs = _filesize != st.st_size; bool time_differs = _check_time && (_timestamp != st.st_mtime); if (size_differs || time_differs) { - aot_log_warning(aot)("This file is not the one used while building the shared archive file: '%s'%s%s", + aot_log_warning(aot)("This file is not the one used while building the %s: '%s'%s%s", + CDSConfig::type_of_archive_being_loaded(), runtime_path, time_differs ? ", timestamp has changed" : "", size_differs ? ", size has changed" : ""); @@ -448,6 +449,13 @@ void AOTClassLocationConfig::dumptime_init(JavaThread* current) { java_lang_Throwable::print(current->pending_exception(), tty); vm_exit_during_initialization("AOTClassLocationConfig::dumptime_init_helper() failed unexpectedly"); } + + if (CDSConfig::is_dumping_final_static_archive()) { + // The _max_used_index is usually updated by ClassLoader::record_result(). However, + // when dumping the final archive, the classes are loaded from their images in + // the AOT config file, so we don't go through ClassLoader::record_result(). + dumptime_update_max_used_index(runtime()->_max_used_index); // Same value as recorded in the training run. + } } void AOTClassLocationConfig::dumptime_init_helper(TRAPS) { diff --git a/src/hotspot/share/cds/aotMetaspace.cpp b/src/hotspot/share/cds/aotMetaspace.cpp index 544eaa07a4d..b75d7628aa9 100644 --- a/src/hotspot/share/cds/aotMetaspace.cpp +++ b/src/hotspot/share/cds/aotMetaspace.cpp @@ -1148,7 +1148,7 @@ void AOTMetaspace::dump_static_archive_impl(StaticArchiveBuilder& builder, TRAPS if (CDSConfig::is_dumping_full_module_graph()) { ClassLoaderDataShared::ensure_module_entry_tables_exist(); ClassLoaderDataShared::build_tables(CHECK); - HeapShared::reset_archived_object_states(CHECK); + HeapShared::prepare_for_archiving(CHECK); } AOTReferenceObjSupport::initialize(CHECK); diff --git a/src/hotspot/share/cds/heapShared.cpp b/src/hotspot/share/cds/heapShared.cpp index c01e6ded25a..0c0f70eac0a 100644 --- a/src/hotspot/share/cds/heapShared.cpp +++ b/src/hotspot/share/cds/heapShared.cpp @@ -247,6 +247,28 @@ void HeapShared::reset_archived_object_states(TRAPS) { reset_states(boot_loader(), CHECK); } +void HeapShared::ensure_determinism(TRAPS) { + TempNewSymbol class_name = SymbolTable::new_symbol("jdk/internal/util/WeakReferenceKey"); + TempNewSymbol method_name = SymbolTable::new_symbol("ensureDeterministicAOTCache"); + + Klass* weak_ref_key_class = SystemDictionary::resolve_or_fail(class_name, true, CHECK); + precond(weak_ref_key_class != nullptr); + + log_debug(aot)("Calling WeakReferenceKey::ensureDeterministicAOTCache(Object.class)"); + JavaValue result(T_BOOLEAN); + JavaCalls::call_static(&result, + weak_ref_key_class, + method_name, + vmSymbols::void_boolean_signature(), + CHECK); + assert(result.get_jboolean() == false, "sanity"); +} + +void HeapShared::prepare_for_archiving(TRAPS) { + reset_archived_object_states(CHECK); + ensure_determinism(CHECK); +} + HeapShared::ArchivedObjectCache* HeapShared::_archived_object_cache = nullptr; bool HeapShared::is_archived_heap_in_use() { diff --git a/src/hotspot/share/cds/heapShared.hpp b/src/hotspot/share/cds/heapShared.hpp index ba17ddda267..2cb330160e4 100644 --- a/src/hotspot/share/cds/heapShared.hpp +++ b/src/hotspot/share/cds/heapShared.hpp @@ -382,8 +382,10 @@ private: static bool walk_one_object(PendingOopStack* stack, int level, KlassSubGraphInfo* subgraph_info, oop orig_obj, oop referrer); - public: static void reset_archived_object_states(TRAPS); + static void ensure_determinism(TRAPS); + public: + static void prepare_for_archiving(TRAPS); static void create_archived_object_cache() { _archived_object_cache = new (mtClass)ArchivedObjectCache(INITIAL_TABLE_SIZE, MAX_TABLE_SIZE); diff --git a/src/hotspot/share/code/aotCodeCache.cpp b/src/hotspot/share/code/aotCodeCache.cpp index f51c068f1e7..32a53691f3f 100644 --- a/src/hotspot/share/code/aotCodeCache.cpp +++ b/src/hotspot/share/code/aotCodeCache.cpp @@ -399,7 +399,7 @@ AOTCodeCache::~AOTCodeCache() { } } -void AOTCodeCache::Config::record() { +void AOTCodeCache::Config::record(uint cpu_features_offset) { _flags = 0; #ifdef ASSERT _flags |= debugVM; @@ -430,9 +430,50 @@ void AOTCodeCache::Config::record() { _compressedKlassShift = CompressedKlassPointers::shift(); _contendedPaddingWidth = ContendedPaddingWidth; _gc = (uint)Universe::heap()->kind(); + _cpu_features_offset = cpu_features_offset; } -bool AOTCodeCache::Config::verify() const { +bool AOTCodeCache::Config::verify_cpu_features(AOTCodeCache* cache) const { + LogStreamHandle(Debug, aot, codecache, init) log; + uint offset = _cpu_features_offset; + uint cpu_features_size = *(uint *)cache->addr(offset); + assert(cpu_features_size == (uint)VM_Version::cpu_features_size(), "must be"); + offset += sizeof(uint); + + void* cached_cpu_features_buffer = (void *)cache->addr(offset); + if (log.is_enabled()) { + ResourceMark rm; // required for stringStream::as_string() + stringStream ss; + VM_Version::get_cpu_features_name(cached_cpu_features_buffer, ss); + log.print_cr("CPU features recorded in AOTCodeCache: %s", ss.as_string()); + } + + if (VM_Version::supports_features(cached_cpu_features_buffer)) { + if (log.is_enabled()) { + ResourceMark rm; // required for stringStream::as_string() + stringStream ss; + char* runtime_cpu_features = NEW_RESOURCE_ARRAY(char, VM_Version::cpu_features_size()); + VM_Version::store_cpu_features(runtime_cpu_features); + VM_Version::get_missing_features_name(runtime_cpu_features, cached_cpu_features_buffer, ss); + if (!ss.is_empty()) { + log.print_cr("Additional runtime CPU features: %s", ss.as_string()); + } + } + } else { + if (log.is_enabled()) { + ResourceMark rm; // required for stringStream::as_string() + stringStream ss; + char* runtime_cpu_features = NEW_RESOURCE_ARRAY(char, VM_Version::cpu_features_size()); + VM_Version::store_cpu_features(runtime_cpu_features); + VM_Version::get_missing_features_name(cached_cpu_features_buffer, runtime_cpu_features, ss); + log.print_cr("AOT Code Cache disabled: required cpu features are missing: %s", ss.as_string()); + } + return false; + } + return true; +} + +bool AOTCodeCache::Config::verify(AOTCodeCache* cache) const { // First checks affect all cached AOT code #ifdef ASSERT if ((_flags & debugVM) == 0) { @@ -478,6 +519,9 @@ bool AOTCodeCache::Config::verify() const { AOTStubCaching = false; } + if (!verify_cpu_features(cache)) { + return false; + } return true; } @@ -679,6 +723,17 @@ extern "C" { } } +void AOTCodeCache::store_cpu_features(char*& buffer, uint buffer_size) { + uint* size_ptr = (uint *)buffer; + *size_ptr = buffer_size; + buffer += sizeof(uint); + + VM_Version::store_cpu_features(buffer); + log_debug(aot, codecache, exit)("CPU features recorded in AOTCodeCache: %s", VM_Version::features_string()); + buffer += buffer_size; + buffer = align_up(buffer, DATA_ALIGNMENT); +} + bool AOTCodeCache::finish_write() { if (!align_write()) { return false; @@ -698,23 +753,32 @@ bool AOTCodeCache::finish_write() { uint store_count = _store_entries_cnt; if (store_count > 0) { - uint header_size = (uint)align_up(sizeof(AOTCodeCache::Header), DATA_ALIGNMENT); + uint header_size = (uint)align_up(sizeof(AOTCodeCache::Header), DATA_ALIGNMENT); uint code_count = store_count; uint search_count = code_count * 2; uint search_size = search_count * sizeof(uint); uint entries_size = (uint)align_up(code_count * sizeof(AOTCodeEntry), DATA_ALIGNMENT); // In bytes // _write_position includes size of code and strings uint code_alignment = code_count * DATA_ALIGNMENT; // We align_up code size when storing it. - uint total_size = header_size + _write_position + code_alignment + search_size + entries_size; + uint cpu_features_size = VM_Version::cpu_features_size(); + uint total_cpu_features_size = sizeof(uint) + cpu_features_size; // sizeof(uint) to store cpu_features_size + uint total_size = header_size + _write_position + code_alignment + search_size + entries_size + + align_up(total_cpu_features_size, DATA_ALIGNMENT); assert(total_size < max_aot_code_size(), "AOT Code size (" UINT32_FORMAT " bytes) is greater than AOTCodeMaxSize(" UINT32_FORMAT " bytes).", total_size, max_aot_code_size()); - // Create ordered search table for entries [id, index]; - uint* search = NEW_C_HEAP_ARRAY(uint, search_count, mtCode); // Allocate in AOT Cache buffer char* buffer = (char *)AOTCacheAccess::allocate_aot_code_region(total_size + DATA_ALIGNMENT); char* start = align_up(buffer, DATA_ALIGNMENT); char* current = start + header_size; // Skip header + uint cpu_features_offset = current - start; + store_cpu_features(current, cpu_features_size); + assert(is_aligned(current, DATA_ALIGNMENT), "sanity check"); + assert(current < start + total_size, "sanity check"); + + // Create ordered search table for entries [id, index]; + uint* search = NEW_C_HEAP_ARRAY(uint, search_count, mtCode); + AOTCodeEntry* entries_address = _store_entries; // Pointer to latest entry uint adapters_count = 0; uint shared_blobs_count = 0; @@ -790,7 +854,7 @@ bool AOTCodeCache::finish_write() { header->init(size, (uint)strings_count, strings_offset, entries_count, new_entries_offset, adapters_count, shared_blobs_count, - C1_blobs_count, C2_blobs_count); + C1_blobs_count, C2_blobs_count, cpu_features_offset); log_info(aot, codecache, exit)("Wrote %d AOT code entries to AOT Code Cache", entries_count); } diff --git a/src/hotspot/share/code/aotCodeCache.hpp b/src/hotspot/share/code/aotCodeCache.hpp index 778ad34e448..45b4a15510d 100644 --- a/src/hotspot/share/code/aotCodeCache.hpp +++ b/src/hotspot/share/code/aotCodeCache.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -185,10 +185,12 @@ protected: restrictContendedPadding = 128 }; uint _flags; + uint _cpu_features_offset; // offset in the cache where cpu features are stored public: - void record(); - bool verify() const; + void record(uint cpu_features_offset); + bool verify_cpu_features(AOTCodeCache* cache) const; + bool verify(AOTCodeCache* cache) const; }; class Header : public CHeapObj { @@ -206,14 +208,15 @@ protected: uint _shared_blobs_count; uint _C1_blobs_count; uint _C2_blobs_count; - Config _config; + Config _config; // must be the last element as there is trailing data stored immediately after Config public: void init(uint cache_size, uint strings_count, uint strings_offset, uint entries_count, uint entries_offset, uint adapters_count, uint shared_blobs_count, - uint C1_blobs_count, uint C2_blobs_count) { + uint C1_blobs_count, uint C2_blobs_count, + uint cpu_features_offset) { _version = AOT_CODE_VERSION; _cache_size = cache_size; _strings_count = strings_count; @@ -224,7 +227,7 @@ protected: _shared_blobs_count = shared_blobs_count; _C1_blobs_count = C1_blobs_count; _C2_blobs_count = C2_blobs_count; - _config.record(); + _config.record(cpu_features_offset); } @@ -239,8 +242,8 @@ protected: uint C2_blobs_count() const { return _C2_blobs_count; } bool verify(uint load_size) const; - bool verify_config() const { // Called after Universe initialized - return _config.verify(); + bool verify_config(AOTCodeCache* cache) const { // Called after Universe initialized + return _config.verify(cache); } }; @@ -320,6 +323,8 @@ public: AOTCodeEntry* find_entry(AOTCodeEntry::Kind kind, uint id); + void store_cpu_features(char*& buffer, uint buffer_size); + bool finish_write(); bool write_relocations(CodeBlob& code_blob); @@ -361,7 +366,7 @@ private: static bool open_cache(bool is_dumping, bool is_using); bool verify_config() { if (for_use()) { - return _load_header->verify_config(); + return _load_header->verify_config(this); } return true; } diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index 094b4f82cf0..fcc0b42a461 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -336,6 +336,7 @@ RuntimeBlob::RuntimeBlob( void RuntimeBlob::free(RuntimeBlob* blob) { assert(blob != nullptr, "caller must check for nullptr"); + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock blob->purge(); { diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp index c695ad977fe..fd70796251d 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp @@ -24,10 +24,9 @@ #include "gc/g1/g1BlockOffsetTable.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1RegionToSpaceMapper.hpp" +#include "gc/shared/memset_with_concurrent_readers.hpp" #include "logging/log.hpp" -#include "oops/oop.inline.hpp" -#include "runtime/java.hpp" #include "runtime/os.hpp" size_t G1BlockOffsetTable::compute_size(size_t mem_region_words) { @@ -52,6 +51,12 @@ void G1BlockOffsetTable::set_offset_array(Atomic* addr, uint8_t offset) addr->store_relaxed(offset); } +static void check_offset(size_t offset, const char* msg) { + assert(offset < CardTable::card_size_in_words(), + "%s - offset: %zu, N_words: %u", + msg, offset, CardTable::card_size_in_words()); +} + void G1BlockOffsetTable::set_offset_array(Atomic* addr, HeapWord* high, HeapWord* low) { assert(high >= low, "addresses out of order"); size_t offset = pointer_delta(high, low); diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp index 89c68ce96d2..21d447549a6 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp @@ -37,19 +37,12 @@ // for each such subregion indicates how far back one must go to find the // start of the chunk that includes the first word of the subregion. class G1BlockOffsetTable : public CHeapObj { -private: // The reserved region covered by the table. MemRegion _reserved; // Biased array-start of BOT array for fast BOT entry translation Atomic* _offset_base; - void check_offset(size_t offset, const char* msg) const { - assert(offset < CardTable::card_size_in_words(), - "%s - offset: %zu, N_words: %u", - msg, offset, CardTable::card_size_in_words()); - } - // Bounds checking accessors: // For performance these have to devolve to array accesses in product builds. inline uint8_t offset_array(Atomic* addr) const; @@ -85,7 +78,6 @@ private: } public: - // Return the number of slots needed for an offset array // that covers mem_region_words words. static size_t compute_size(size_t mem_region_words); @@ -99,22 +91,14 @@ public: // in the heap parameter. G1BlockOffsetTable(MemRegion heap, G1RegionToSpaceMapper* storage); - static bool is_crossing_card_boundary(HeapWord* const obj_start, - HeapWord* const obj_end) { - HeapWord* cur_card_boundary = align_up_by_card_size(obj_start); - // strictly greater-than - return obj_end > cur_card_boundary; - } + inline static bool is_crossing_card_boundary(HeapWord* const obj_start, + HeapWord* const obj_end); // Returns the address of the start of the block reaching into the card containing // "addr". inline HeapWord* block_start_reaching_into_card(const void* addr) const; - void update_for_block(HeapWord* blk_start, HeapWord* blk_end) { - if (is_crossing_card_boundary(blk_start, blk_end)) { - update_for_block_work(blk_start, blk_end); - } - } + inline void update_for_block(HeapWord* blk_start, HeapWord* blk_end); }; #endif // SHARE_GC_G1_G1BLOCKOFFSETTABLE_HPP diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp index 0d809b65526..b707e310781 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp @@ -27,10 +27,7 @@ #include "gc/g1/g1BlockOffsetTable.hpp" -#include "gc/g1/g1HeapRegion.hpp" #include "gc/shared/cardTable.hpp" -#include "gc/shared/memset_with_concurrent_readers.hpp" -#include "oops/oop.inline.hpp" inline HeapWord* G1BlockOffsetTable::block_start_reaching_into_card(const void* addr) const { assert(_reserved.contains(addr), "invalid address"); @@ -70,4 +67,17 @@ inline HeapWord* G1BlockOffsetTable::addr_for_entry(const Atomic* const return result; } +inline bool G1BlockOffsetTable::is_crossing_card_boundary(HeapWord* const obj_start, + HeapWord* const obj_end) { + HeapWord* cur_card_boundary = align_up_by_card_size(obj_start); + // strictly greater-than + return obj_end > cur_card_boundary; +} + +inline void G1BlockOffsetTable::update_for_block(HeapWord* blk_start, HeapWord* blk_end) { + if (is_crossing_card_boundary(blk_start, blk_end)) { + update_for_block_work(blk_start, blk_end); + } +} + #endif // SHARE_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index 8f3cafe1f5b..c739907e2b4 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -24,6 +24,7 @@ #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" +#include "cppstdlib/new.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BatchedTask.hpp" #include "gc/g1/g1CardSetMemory.hpp" @@ -519,8 +520,8 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, _max_concurrent_workers(0), _region_mark_stats(NEW_C_HEAP_ARRAY(G1RegionMarkStats, _g1h->max_num_regions(), mtGC)), - _top_at_mark_starts(NEW_C_HEAP_ARRAY(HeapWord*, _g1h->max_num_regions(), mtGC)), - _top_at_rebuild_starts(NEW_C_HEAP_ARRAY(HeapWord*, _g1h->max_num_regions(), mtGC)), + _top_at_mark_starts(NEW_C_HEAP_ARRAY(Atomic, _g1h->max_num_regions(), mtGC)), + _top_at_rebuild_starts(NEW_C_HEAP_ARRAY(Atomic, _g1h->max_num_regions(), mtGC)), _needs_remembered_set_rebuild(false) { assert(G1CGC_lock != nullptr, "CGC_lock must be initialized"); @@ -564,6 +565,12 @@ void G1ConcurrentMark::fully_initialize() { _tasks[i] = new G1CMTask(i, this, task_queue, _region_mark_stats); } + for (uint i = 0; i < _g1h->max_num_regions(); i++) { + ::new (&_region_mark_stats[i]) G1RegionMarkStats{}; + ::new (&_top_at_mark_starts[i]) Atomic{}; + ::new (&_top_at_rebuild_starts[i]) Atomic{}; + } + reset_at_marking_complete(); } @@ -576,7 +583,7 @@ PartialArrayStateManager* G1ConcurrentMark::partial_array_state_manager() const } void G1ConcurrentMark::reset() { - _has_aborted = false; + _has_aborted.store_relaxed(false); reset_marking_for_restart(); @@ -588,7 +595,7 @@ void G1ConcurrentMark::reset() { uint max_num_regions = _g1h->max_num_regions(); for (uint i = 0; i < max_num_regions; i++) { - _top_at_rebuild_starts[i] = nullptr; + _top_at_rebuild_starts[i].store_relaxed(nullptr); _region_mark_stats[i].clear(); } @@ -600,7 +607,7 @@ void G1ConcurrentMark::clear_statistics(G1HeapRegion* r) { for (uint j = 0; j < _max_num_tasks; ++j) { _tasks[j]->clear_mark_stats_cache(region_idx); } - _top_at_rebuild_starts[region_idx] = nullptr; + _top_at_rebuild_starts[region_idx].store_relaxed(nullptr); _region_mark_stats[region_idx].clear(); } @@ -636,7 +643,7 @@ void G1ConcurrentMark::reset_marking_for_restart() { } clear_has_overflown(); - _finger = _heap.start(); + _finger.store_relaxed(_heap.start()); for (uint i = 0; i < _max_num_tasks; ++i) { _tasks[i]->reset_for_restart(); @@ -657,14 +664,14 @@ void G1ConcurrentMark::set_concurrency(uint active_tasks) { void G1ConcurrentMark::set_concurrency_and_phase(uint active_tasks, bool concurrent) { set_concurrency(active_tasks); - _concurrent = concurrent; + _concurrent.store_relaxed(concurrent); if (!concurrent) { // At this point we should be in a STW phase, and completed marking. assert_at_safepoint_on_vm_thread(); assert(out_of_regions(), "only way to get here: _finger: " PTR_FORMAT ", _heap_end: " PTR_FORMAT, - p2i(_finger), p2i(_heap.end())); + p2i(finger()), p2i(_heap.end())); } } @@ -695,8 +702,8 @@ void G1ConcurrentMark::reset_at_marking_complete() { } G1ConcurrentMark::~G1ConcurrentMark() { - FREE_C_HEAP_ARRAY(HeapWord*, _top_at_mark_starts); - FREE_C_HEAP_ARRAY(HeapWord*, _top_at_rebuild_starts); + FREE_C_HEAP_ARRAY(Atomic, _top_at_mark_starts); + FREE_C_HEAP_ARRAY(Atomic, _top_at_rebuild_starts); FREE_C_HEAP_ARRAY(G1RegionMarkStats, _region_mark_stats); // The G1ConcurrentMark instance is never freed. ShouldNotReachHere(); @@ -921,6 +928,8 @@ public: bool do_heap_region(G1HeapRegion* r) override { if (r->is_old_or_humongous() && !r->is_collection_set_candidate() && !r->in_collection_set()) { _cm->update_top_at_mark_start(r); + } else { + _cm->reset_top_at_mark_start(r); } return false; } @@ -1163,7 +1172,7 @@ void G1ConcurrentMark::concurrent_cycle_start() { } uint G1ConcurrentMark::completed_mark_cycles() const { - return AtomicAccess::load(&_completed_mark_cycles); + return _completed_mark_cycles.load_relaxed(); } void G1ConcurrentMark::concurrent_cycle_end(bool mark_cycle_completed) { @@ -1172,7 +1181,7 @@ void G1ConcurrentMark::concurrent_cycle_end(bool mark_cycle_completed) { _g1h->trace_heap_after_gc(_gc_tracer_cm); if (mark_cycle_completed) { - AtomicAccess::inc(&_completed_mark_cycles, memory_order_relaxed); + _completed_mark_cycles.add_then_fetch(1u, memory_order_relaxed); } if (has_aborted()) { @@ -1186,7 +1195,7 @@ void G1ConcurrentMark::concurrent_cycle_end(bool mark_cycle_completed) { } void G1ConcurrentMark::mark_from_roots() { - _restart_for_overflow = false; + _restart_for_overflow.store_relaxed(false); uint active_workers = calc_active_marking_workers(); @@ -1355,7 +1364,7 @@ void G1ConcurrentMark::remark() { } } else { // We overflowed. Restart concurrent marking. - _restart_for_overflow = true; + _restart_for_overflow.store_relaxed(true); verify_during_pause(G1HeapVerifier::G1VerifyRemark, VerifyLocation::RemarkOverflow); @@ -1784,44 +1793,45 @@ void G1ConcurrentMark::clear_bitmap_for_region(G1HeapRegion* hr) { } G1HeapRegion* G1ConcurrentMark::claim_region(uint worker_id) { - // "checkpoint" the finger - HeapWord* finger = _finger; + // "Checkpoint" the finger. + HeapWord* local_finger = finger(); - while (finger < _heap.end()) { - assert(_g1h->is_in_reserved(finger), "invariant"); + while (local_finger < _heap.end()) { + assert(_g1h->is_in_reserved(local_finger), "invariant"); - G1HeapRegion* curr_region = _g1h->heap_region_containing_or_null(finger); + G1HeapRegion* curr_region = _g1h->heap_region_containing_or_null(local_finger); // Make sure that the reads below do not float before loading curr_region. OrderAccess::loadload(); // Above heap_region_containing may return null as we always scan claim // until the end of the heap. In this case, just jump to the next region. - HeapWord* end = curr_region != nullptr ? curr_region->end() : finger + G1HeapRegion::GrainWords; + HeapWord* end = curr_region != nullptr ? curr_region->end() : local_finger + G1HeapRegion::GrainWords; // Is the gap between reading the finger and doing the CAS too long? - HeapWord* res = AtomicAccess::cmpxchg(&_finger, finger, end); - if (res == finger && curr_region != nullptr) { - // we succeeded + HeapWord* res = _finger.compare_exchange(local_finger, end); + if (res == local_finger && curr_region != nullptr) { + // We succeeded. HeapWord* bottom = curr_region->bottom(); HeapWord* limit = top_at_mark_start(curr_region); log_trace(gc, marking)("Claim region %u bottom " PTR_FORMAT " tams " PTR_FORMAT, curr_region->hrm_index(), p2i(curr_region->bottom()), p2i(top_at_mark_start(curr_region))); - // notice that _finger == end cannot be guaranteed here since, - // someone else might have moved the finger even further - assert(_finger >= end, "the finger should have moved forward"); + // Notice that _finger == end cannot be guaranteed here since, + // someone else might have moved the finger even further. + assert(finger() >= end, "The finger should have moved forward"); if (limit > bottom) { return curr_region; } else { assert(limit == bottom, - "the region limit should be at bottom"); + "The region limit should be at bottom"); // We return null and the caller should try calling // claim_region() again. return nullptr; } } else { - assert(_finger > finger, "the finger should have moved forward"); - // read it again - finger = _finger; + // Read the finger again. + HeapWord* next_finger = finger(); + assert(next_finger > local_finger, "The finger should have moved forward " PTR_FORMAT " " PTR_FORMAT, p2i(local_finger), p2i(next_finger)); + local_finger = next_finger; } } @@ -1957,7 +1967,7 @@ bool G1ConcurrentMark::concurrent_cycle_abort() { void G1ConcurrentMark::abort_marking_threads() { assert(!_root_regions.scan_in_progress(), "still doing root region scan"); - _has_aborted = true; + _has_aborted.store_relaxed(true); _first_overflow_barrier_sync.abort(); _second_overflow_barrier_sync.abort(); } diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp index 0271e6a4208..11da6dae5b3 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp @@ -368,7 +368,7 @@ class G1ConcurrentMark : public CHeapObj { // For grey objects G1CMMarkStack _global_mark_stack; // Grey objects behind global finger - HeapWord* volatile _finger; // The global finger, region aligned, + Atomic _finger; // The global finger, region aligned, // always pointing to the end of the // last claimed region @@ -395,19 +395,19 @@ class G1ConcurrentMark : public CHeapObj { WorkerThreadsBarrierSync _second_overflow_barrier_sync; // Number of completed mark cycles. - volatile uint _completed_mark_cycles; + Atomic _completed_mark_cycles; // This is set by any task, when an overflow on the global data // structures is detected - volatile bool _has_overflown; + Atomic _has_overflown; // True: marking is concurrent, false: we're in remark - volatile bool _concurrent; + Atomic _concurrent; // Set at the end of a Full GC so that marking aborts - volatile bool _has_aborted; + Atomic _has_aborted; // Used when remark aborts due to an overflow to indicate that // another concurrent marking phase should start - volatile bool _restart_for_overflow; + Atomic _restart_for_overflow; ConcurrentGCTimer* _gc_timer_cm; @@ -461,8 +461,8 @@ class G1ConcurrentMark : public CHeapObj { void print_and_reset_taskqueue_stats(); - HeapWord* finger() { return _finger; } - bool concurrent() { return _concurrent; } + HeapWord* finger() { return _finger.load_relaxed(); } + bool concurrent() { return _concurrent.load_relaxed(); } uint active_tasks() { return _num_active_tasks; } TaskTerminator* terminator() { return &_terminator; } @@ -487,7 +487,7 @@ class G1ConcurrentMark : public CHeapObj { // to satisfy an allocation without doing a GC. This is fine, because all // objects in those regions will be considered live anyway because of // SATB guarantees (i.e. their TAMS will be equal to bottom). - bool out_of_regions() { return _finger >= _heap.end(); } + bool out_of_regions() { return finger() >= _heap.end(); } // Returns the task with the given id G1CMTask* task(uint id) { @@ -499,10 +499,10 @@ class G1ConcurrentMark : public CHeapObj { // Access / manipulation of the overflow flag which is set to // indicate that the global stack has overflown - bool has_overflown() { return _has_overflown; } - void set_has_overflown() { _has_overflown = true; } - void clear_has_overflown() { _has_overflown = false; } - bool restart_for_overflow() { return _restart_for_overflow; } + bool has_overflown() { return _has_overflown.load_relaxed(); } + void set_has_overflown() { _has_overflown.store_relaxed(true); } + void clear_has_overflown() { _has_overflown.store_relaxed(false); } + bool restart_for_overflow() { return _restart_for_overflow.load_relaxed(); } // Methods to enter the two overflow sync barriers void enter_first_sync_barrier(uint worker_id); @@ -516,12 +516,12 @@ class G1ConcurrentMark : public CHeapObj { G1RegionMarkStats* _region_mark_stats; // Top pointer for each region at the start of marking. Must be valid for all committed // regions. - HeapWord* volatile* _top_at_mark_starts; + Atomic* _top_at_mark_starts; // Top pointer for each region at the start of the rebuild remembered set process // for regions which remembered sets need to be rebuilt. A null for a given region // means that this region does not be scanned during the rebuilding remembered // set phase at all. - HeapWord* volatile* _top_at_rebuild_starts; + Atomic* _top_at_rebuild_starts; // True when Remark pause selected regions for rebuilding. bool _needs_remembered_set_rebuild; public: @@ -679,7 +679,7 @@ public: uint completed_mark_cycles() const; - bool has_aborted() { return _has_aborted; } + bool has_aborted() { return _has_aborted.load_relaxed(); } void print_summary_info(); diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp index 2f4824e4cae..21167d5cae9 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp @@ -194,11 +194,11 @@ inline void G1CMTask::process_array_chunk(objArrayOop obj, size_t start, size_t inline void G1ConcurrentMark::update_top_at_mark_start(G1HeapRegion* r) { uint const region = r->hrm_index(); assert(region < _g1h->max_num_regions(), "Tried to access TAMS for region %u out of bounds", region); - _top_at_mark_starts[region] = r->top(); + _top_at_mark_starts[region].store_relaxed(r->top()); } inline void G1ConcurrentMark::reset_top_at_mark_start(G1HeapRegion* r) { - _top_at_mark_starts[r->hrm_index()] = r->bottom(); + _top_at_mark_starts[r->hrm_index()].store_relaxed(r->bottom()); } inline HeapWord* G1ConcurrentMark::top_at_mark_start(const G1HeapRegion* r) const { @@ -207,7 +207,7 @@ inline HeapWord* G1ConcurrentMark::top_at_mark_start(const G1HeapRegion* r) cons inline HeapWord* G1ConcurrentMark::top_at_mark_start(uint region) const { assert(region < _g1h->max_num_regions(), "Tried to access TARS for region %u out of bounds", region); - return _top_at_mark_starts[region]; + return _top_at_mark_starts[region].load_relaxed(); } inline bool G1ConcurrentMark::obj_allocated_since_mark_start(oop obj) const { @@ -217,7 +217,7 @@ inline bool G1ConcurrentMark::obj_allocated_since_mark_start(oop obj) const { } inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(G1HeapRegion* r) const { - return _top_at_rebuild_starts[r->hrm_index()]; + return _top_at_rebuild_starts[r->hrm_index()].load_relaxed(); } inline void G1ConcurrentMark::update_top_at_rebuild_start(G1HeapRegion* r) { @@ -225,10 +225,10 @@ inline void G1ConcurrentMark::update_top_at_rebuild_start(G1HeapRegion* r) { uint const region = r->hrm_index(); assert(region < _g1h->max_num_regions(), "Tried to access TARS for region %u out of bounds", region); - assert(_top_at_rebuild_starts[region] == nullptr, + assert(top_at_rebuild_start(r) == nullptr, "TARS for region %u has already been set to " PTR_FORMAT " should be null", - region, p2i(_top_at_rebuild_starts[region])); - _top_at_rebuild_starts[region] = r->top(); + region, p2i(top_at_rebuild_start(r))); + _top_at_rebuild_starts[region].store_relaxed(r->top()); } inline void G1CMTask::update_liveness(oop const obj, const size_t obj_size) { diff --git a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp index 4dcdd33846e..b8f13f4553d 100644 --- a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp +++ b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp @@ -44,6 +44,8 @@ struct G1RegionMarkStats { Atomic _live_words; Atomic _incoming_refs; + G1RegionMarkStats() : _live_words(0), _incoming_refs(0) { } + // Clear all members. void clear() { _live_words.store_relaxed(0); diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index 3f47d386015..557941981e4 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -497,10 +497,6 @@ class G1PostEvacuateCollectionSetCleanupTask2::ProcessEvacuationFailedRegionsTas G1CollectedHeap* g1h = G1CollectedHeap::heap(); G1ConcurrentMark* cm = g1h->concurrent_mark(); - HeapWord* top_at_mark_start = cm->top_at_mark_start(r); - assert(top_at_mark_start == r->bottom(), "TAMS must not have been set for region %u", r->hrm_index()); - assert(cm->live_bytes(r->hrm_index()) == 0, "Marking live bytes must not be set for region %u", r->hrm_index()); - // Concurrent mark does not mark through regions that we retain (they are root // regions wrt to marking), so we must clear their mark data (tams, bitmap, ...) // set eagerly or during evacuation failure. diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp index f257f4c9177..0f00b3ec2f9 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp @@ -30,8 +30,11 @@ #include "gc/parallel/psScavenge.hpp" inline bool ParallelScavengeHeap::should_alloc_in_eden(const size_t size) const { - const size_t eden_size = young_gen()->eden_space()->capacity_in_words(); - return size < eden_size / 2; + const size_t max_young_gen_bytes = young_gen()->max_gen_size(); + const size_t survivor_size_bytes = young_gen()->from_space()->capacity_in_bytes(); + const size_t max_eden_size_bytes = max_young_gen_bytes - survivor_size_bytes * 2; + const size_t max_eden_size_words = max_eden_size_bytes / HeapWordSize; + return size < max_eden_size_words / 2; } inline bool ParallelScavengeHeap::is_in_young(const void* p) const { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp index 36ea0b9e497..98d30a3481f 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp @@ -1108,6 +1108,10 @@ void ShenandoahGenerationalHeap::complete_degenerated_cycle() { ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc_coalesce_and_fill); coalesce_and_fill_old_regions(false); } + + log_info(gc, cset)("Degenerated cycle complete, promotions reserved: %zu, promotions expended: %zu, failed count: %zu, failed bytes: %zu", + old_generation()->get_promoted_reserve(), old_generation()->get_promoted_expended(), + old_generation()->get_promotion_failed_count(), old_generation()->get_promotion_failed_words() * HeapWordSize); } void ShenandoahGenerationalHeap::complete_concurrent_cycle() { @@ -1121,6 +1125,10 @@ void ShenandoahGenerationalHeap::complete_concurrent_cycle() { // throw off the heuristics. entry_global_coalesce_and_fill(); } + + log_info(gc, cset)("Concurrent cycle complete, promotions reserved: %zu, promotions expended: %zu, failed count: %zu, failed bytes: %zu", + old_generation()->get_promoted_reserve(), old_generation()->get_promoted_expended(), + old_generation()->get_promotion_failed_count(), old_generation()->get_promotion_failed_words() * HeapWordSize); } void ShenandoahGenerationalHeap::entry_global_coalesce_and_fill() { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 767da5f9bf3..9dd837b90d2 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -86,6 +86,7 @@ #include "nmt/memTracker.hpp" #include "oops/compressedOops.inline.hpp" #include "prims/jvmtiTagMap.hpp" +#include "runtime/atomic.hpp" #include "runtime/atomicAccess.hpp" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.inline.hpp" @@ -201,9 +202,9 @@ jint ShenandoahHeap::initialize() { assert(num_min_regions <= _num_regions, "sanity"); _minimum_size = num_min_regions * reg_size_bytes; - _soft_max_size = clamp(SoftMaxHeapSize, min_capacity(), max_capacity()); + _soft_max_size.store_relaxed(clamp(SoftMaxHeapSize, min_capacity(), max_capacity())); - _committed = _initial_size; + _committed.store_relaxed(_initial_size); size_t heap_page_size = UseLargePages ? os::large_page_size() : os::vm_page_size(); size_t bitmap_page_size = UseLargePages ? os::large_page_size() : os::vm_page_size(); @@ -725,17 +726,17 @@ size_t ShenandoahHeap::used() const { } size_t ShenandoahHeap::committed() const { - return AtomicAccess::load(&_committed); + return _committed.load_relaxed(); } void ShenandoahHeap::increase_committed(size_t bytes) { shenandoah_assert_heaplocked_or_safepoint(); - _committed += bytes; + _committed.fetch_then_add(bytes, memory_order_relaxed); } void ShenandoahHeap::decrease_committed(size_t bytes) { shenandoah_assert_heaplocked_or_safepoint(); - _committed -= bytes; + _committed.fetch_then_sub(bytes, memory_order_relaxed); } size_t ShenandoahHeap::capacity() const { @@ -747,7 +748,7 @@ size_t ShenandoahHeap::max_capacity() const { } size_t ShenandoahHeap::soft_max_capacity() const { - size_t v = AtomicAccess::load(&_soft_max_size); + size_t v = _soft_max_size.load_relaxed(); assert(min_capacity() <= v && v <= max_capacity(), "Should be in bounds: %zu <= %zu <= %zu", min_capacity(), v, max_capacity()); @@ -758,7 +759,7 @@ void ShenandoahHeap::set_soft_max_capacity(size_t v) { assert(min_capacity() <= v && v <= max_capacity(), "Should be in bounds: %zu <= %zu <= %zu", min_capacity(), v, max_capacity()); - AtomicAccess::store(&_soft_max_size, v); + _soft_max_size.store_relaxed(v); } size_t ShenandoahHeap::min_capacity() const { @@ -1941,7 +1942,7 @@ private: size_t const _stride; shenandoah_padding(0); - volatile size_t _index; + Atomic _index; shenandoah_padding(1); public: @@ -1954,8 +1955,8 @@ public: size_t stride = _stride; size_t max = _heap->num_regions(); - while (AtomicAccess::load(&_index) < max) { - size_t cur = AtomicAccess::fetch_then_add(&_index, stride, memory_order_relaxed); + while (_index.load_relaxed() < max) { + size_t cur = _index.fetch_then_add(stride, memory_order_relaxed); size_t start = cur; size_t end = MIN2(cur + stride, max); if (start >= max) break; @@ -2703,11 +2704,11 @@ ShenandoahRegionIterator::ShenandoahRegionIterator(ShenandoahHeap* heap) : _index(0) {} void ShenandoahRegionIterator::reset() { - _index = 0; + _index.store_relaxed(0); } bool ShenandoahRegionIterator::has_next() const { - return _index < _heap->num_regions(); + return _index.load_relaxed() < _heap->num_regions(); } ShenandoahLiveData* ShenandoahHeap::get_liveness_cache(uint worker_id) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index 9240091070b..4a4499667ff 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -88,7 +88,7 @@ private: ShenandoahHeap* _heap; shenandoah_padding(0); - volatile size_t _index; + Atomic _index; shenandoah_padding(1); // No implicit copying: iterators should be passed by reference to capture the state @@ -208,9 +208,9 @@ private: size_t _initial_size; size_t _minimum_size; - volatile size_t _soft_max_size; + Atomic _soft_max_size; shenandoah_padding(0); - volatile size_t _committed; + Atomic _committed; shenandoah_padding(1); public: @@ -340,7 +340,7 @@ private: ShenandoahSharedFlag _full_gc_move_in_progress; ShenandoahSharedFlag _concurrent_strong_root_in_progress; - size_t _gc_no_progress_count; + Atomic _gc_no_progress_count; // This updates the singular, global gc state. This call must happen on a safepoint. void set_gc_state_at_safepoint(uint mask, bool value); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp index e35f116b843..02f2beaf4e0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp @@ -49,7 +49,7 @@ #include "gc/shenandoah/shenandoahWorkGroup.hpp" #include "oops/compressedOops.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomicAccess.hpp" +#include "runtime/atomic.hpp" #include "runtime/javaThread.hpp" #include "runtime/objectMonitor.inline.hpp" #include "runtime/prefetch.inline.hpp" @@ -61,7 +61,7 @@ inline ShenandoahHeap* ShenandoahHeap::heap() { } inline ShenandoahHeapRegion* ShenandoahRegionIterator::next() { - size_t new_index = AtomicAccess::add(&_index, (size_t) 1, memory_order_relaxed); + size_t new_index = _index.add_then_fetch((size_t) 1, memory_order_relaxed); // get_region() provides the bounds-check and returns null on OOB. return _heap->get_region(new_index - 1); } @@ -75,15 +75,15 @@ inline WorkerThreads* ShenandoahHeap::safepoint_workers() { } inline void ShenandoahHeap::notify_gc_progress() { - AtomicAccess::store(&_gc_no_progress_count, (size_t) 0); + _gc_no_progress_count.store_relaxed((size_t) 0); } inline void ShenandoahHeap::notify_gc_no_progress() { - AtomicAccess::inc(&_gc_no_progress_count); + _gc_no_progress_count.add_then_fetch((size_t) 1); } inline size_t ShenandoahHeap::get_gc_no_progress_count() const { - return AtomicAccess::load(&_gc_no_progress_count); + return _gc_no_progress_count.load_relaxed(); } inline size_t ShenandoahHeap::heap_region_index_containing(const void* addr) const { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp index 55cec63f045..facaefd4b62 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp @@ -433,8 +433,8 @@ void ShenandoahNMethodTableSnapshot::parallel_nmethods_do(NMethodClosure *f) { ShenandoahNMethod** const list = _list->list(); size_t max = (size_t)_limit; - while (_claimed < max) { - size_t cur = AtomicAccess::fetch_then_add(&_claimed, stride, memory_order_relaxed); + while (_claimed.load_relaxed() < max) { + size_t cur = _claimed.fetch_then_add(stride, memory_order_relaxed); size_t start = cur; size_t end = MIN2(cur + stride, max); if (start >= max) break; @@ -457,8 +457,8 @@ void ShenandoahNMethodTableSnapshot::concurrent_nmethods_do(NMethodClosure* cl) ShenandoahNMethod** list = _list->list(); size_t max = (size_t)_limit; - while (_claimed < max) { - size_t cur = AtomicAccess::fetch_then_add(&_claimed, stride, memory_order_relaxed); + while (_claimed.load_relaxed() < max) { + size_t cur = _claimed.fetch_then_add(stride, memory_order_relaxed); size_t start = cur; size_t end = MIN2(cur + stride, max); if (start >= max) break; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp index 5387870c9dc..77faf6c0dcb 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp @@ -30,6 +30,7 @@ #include "gc/shenandoah/shenandoahLock.hpp" #include "gc/shenandoah/shenandoahPadding.hpp" #include "memory/allocation.hpp" +#include "runtime/atomic.hpp" #include "utilities/growableArray.hpp" // ShenandoahNMethod tuple records the internal locations of oop slots within reclocation stream in @@ -115,7 +116,7 @@ private: int _limit; shenandoah_padding(0); - volatile size_t _claimed; + Atomic _claimed; shenandoah_padding(1); public: diff --git a/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp b/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp index e5e2b14a3a1..4299bdb8126 100644 --- a/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp +++ b/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp @@ -36,7 +36,7 @@ nonstatic_field(ShenandoahHeap, _regions, ShenandoahHeapRegion**) \ nonstatic_field(ShenandoahHeap, _log_min_obj_alignment_in_bytes, int) \ nonstatic_field(ShenandoahHeap, _free_set, ShenandoahFreeSet*) \ - volatile_nonstatic_field(ShenandoahHeap, _committed, size_t) \ + volatile_nonstatic_field(ShenandoahHeap, _committed, Atomic) \ static_field(ShenandoahHeapRegion, RegionSizeBytes, size_t) \ static_field(ShenandoahHeapRegion, RegionSizeBytesShift, size_t) \ nonstatic_field(ShenandoahHeapRegion, _state, Atomic) \ diff --git a/src/hotspot/share/opto/callnode.hpp b/src/hotspot/share/opto/callnode.hpp index 41d0c9f5aac..95d1fc27d45 100644 --- a/src/hotspot/share/opto/callnode.hpp +++ b/src/hotspot/share/opto/callnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -120,7 +120,6 @@ public: virtual int Opcode() const; virtual bool is_CFG() const { return true; } virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash - virtual bool depends_only_on_test() const { return false; } virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual const Type* Value(PhaseGVN* phase) const; virtual uint ideal_reg() const { return NotAMachineReg; } @@ -141,7 +140,6 @@ class RethrowNode : public Node { virtual int Opcode() const; virtual bool is_CFG() const { return true; } virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash - virtual bool depends_only_on_test() const { return false; } virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual const Type* Value(PhaseGVN* phase) const; virtual uint match_edge(uint idx) const; diff --git a/src/hotspot/share/opto/castnode.cpp b/src/hotspot/share/opto/castnode.cpp index 2ebbdd7cdb3..4e3750b5ee5 100644 --- a/src/hotspot/share/opto/castnode.cpp +++ b/src/hotspot/share/opto/castnode.cpp @@ -207,6 +207,11 @@ bool ConstraintCastNode::higher_equal_types(PhaseGVN* phase, const Node* other) return true; } +Node* ConstraintCastNode::pin_node_under_control_impl() const { + assert(_dependency.is_floating(), "already pinned"); + return make_cast_for_type(in(0), in(1), bottom_type(), _dependency.with_pinned_dependency(), _extra_types); +} + #ifndef PRODUCT void ConstraintCastNode::dump_spec(outputStream *st) const { TypeNode::dump_spec(st); @@ -277,12 +282,9 @@ void CastIINode::dump_spec(outputStream* st) const { } #endif -CastIINode* CastIINode::pin_array_access_node() const { +CastIINode* CastIINode::pin_node_under_control_impl() const { assert(_dependency.is_floating(), "already pinned"); - if (has_range_check()) { - return new CastIINode(in(0), in(1), bottom_type(), _dependency.with_pinned_dependency(), has_range_check()); - } - return nullptr; + return new CastIINode(in(0), in(1), bottom_type(), _dependency.with_pinned_dependency(), _range_check_dependency, _extra_types); } void CastIINode::remove_range_check_cast(Compile* C) { diff --git a/src/hotspot/share/opto/castnode.hpp b/src/hotspot/share/opto/castnode.hpp index f22df546f41..38545fd6f41 100644 --- a/src/hotspot/share/opto/castnode.hpp +++ b/src/hotspot/share/opto/castnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -166,8 +166,6 @@ protected: virtual int Opcode() const; virtual uint ideal_reg() const = 0; bool carry_dependency() const { return !_dependency.cmp(DependencyType::FloatingNarrowing); } - // A cast node depends_only_on_test if and only if it is floating - virtual bool depends_only_on_test() const { return _dependency.is_floating(); } const DependencyType& dependency() const { return _dependency; } TypeNode* dominating_cast(PhaseGVN* gvn, PhaseTransform* pt) const; static Node* make_cast_for_basic_type(Node* c, Node* n, const Type* t, const DependencyType& dependency, BasicType bt); @@ -191,6 +189,12 @@ protected: const Type* extra_type_at(int i) const { return _extra_types->field_at(i); } + +protected: + virtual bool depends_only_on_test_impl() const { return _dependency.is_floating(); } + +private: + virtual Node* pin_node_under_control_impl() const; }; //------------------------------CastIINode------------------------------------- @@ -222,13 +226,15 @@ class CastIINode: public ConstraintCastNode { #endif } - CastIINode* pin_array_access_node() const; CastIINode* make_with(Node* parent, const TypeInteger* type, const DependencyType& dependency) const; void remove_range_check_cast(Compile* C); #ifndef PRODUCT virtual void dump_spec(outputStream* st) const; #endif + +private: + virtual CastIINode* pin_node_under_control_impl() const; }; class CastLLNode: public ConstraintCastNode { @@ -320,8 +326,10 @@ class CheckCastPPNode: public ConstraintCastNode { virtual const Type* Value(PhaseGVN* phase) const; virtual int Opcode() const; virtual uint ideal_reg() const { return Op_RegP; } - bool depends_only_on_test() const { return !type()->isa_rawptr() && ConstraintCastNode::depends_only_on_test(); } - }; + +private: + virtual bool depends_only_on_test_impl() const { return !type()->isa_rawptr() && ConstraintCastNode::depends_only_on_test_impl(); } +}; //------------------------------CastX2PNode------------------------------------- @@ -349,8 +357,10 @@ class CastP2XNode : public Node { virtual Node* Identity(PhaseGVN* phase); virtual uint ideal_reg() const { return Op_RegX; } virtual const Type *bottom_type() const { return TypeX_X; } + +private: // Return false to keep node from moving away from an associated card mark. - virtual bool depends_only_on_test() const { return false; } + virtual bool depends_only_on_test_impl() const { return false; } }; diff --git a/src/hotspot/share/opto/cfgnode.hpp b/src/hotspot/share/opto/cfgnode.hpp index ca549af1554..6af2972e688 100644 --- a/src/hotspot/share/opto/cfgnode.hpp +++ b/src/hotspot/share/opto/cfgnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -124,7 +124,6 @@ public: virtual bool pinned() const { return (const Node*)in(0) == this; } virtual bool is_CFG() const { return true; } virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash - virtual bool depends_only_on_test() const { return false; } virtual const Type* bottom_type() const { return Type::CONTROL; } virtual const Type* Value(PhaseGVN* phase) const; virtual Node* Identity(PhaseGVN* phase); @@ -287,7 +286,6 @@ public: virtual bool is_CFG() const { return true; } virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash virtual const Node *is_block_proj() const { return this; } - virtual bool depends_only_on_test() const { return false; } virtual const Type *bottom_type() const { return Type::CONTROL; } virtual const Type* Value(PhaseGVN* phase) const; virtual Node* Identity(PhaseGVN* phase); @@ -462,7 +460,7 @@ public: Node* fold_compares(PhaseIterGVN* phase); static Node* up_one_dom(Node* curr, bool linear_only = false); bool is_zero_trip_guard() const; - Node* dominated_by(Node* prev_dom, PhaseIterGVN* igvn, bool pin_array_access_nodes); + Node* dominated_by(Node* prev_dom, PhaseIterGVN* igvn, bool prev_dom_not_imply_this); ProjNode* uncommon_trap_proj(CallStaticJavaNode*& call, Deoptimization::DeoptReason reason = Deoptimization::Reason_none) const; // Takes the type of val and filters it through the test represented @@ -565,7 +563,7 @@ public: return in(0)->as_If()->proj_out(1 - _con)->as_IfProj(); } - void pin_array_access_nodes(PhaseIterGVN* igvn); + void pin_dependent_nodes(PhaseIterGVN* igvn); protected: // Type of If input when this branch is always taken diff --git a/src/hotspot/share/opto/divnode.hpp b/src/hotspot/share/opto/divnode.hpp index b13460c89f5..43432b271a4 100644 --- a/src/hotspot/share/opto/divnode.hpp +++ b/src/hotspot/share/opto/divnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,15 +35,33 @@ // Optimization - Graph Style +class DivModIntegerNode : public Node { +private: + bool _pinned; + +protected: + DivModIntegerNode(Node* c, Node* dividend, Node* divisor) : Node(c, dividend, divisor), _pinned(false) {} + +private: + virtual uint size_of() const override { return sizeof(DivModIntegerNode); } + virtual uint hash() const override { return Node::hash() + _pinned; } + virtual bool cmp(const Node& o) const override { return Node::cmp(o) && _pinned == static_cast(o)._pinned; } + virtual bool depends_only_on_test_impl() const override { return !_pinned; } + virtual DivModIntegerNode* pin_node_under_control_impl() const override { + DivModIntegerNode* res = static_cast(clone()); + res->_pinned = true; + return res; + } +}; //------------------------------DivINode--------------------------------------- // Integer division // Note: this is division as defined by JVMS, i.e., MinInt/-1 == MinInt. // On processors which don't naturally support this special case (e.g., x86), // the matcher or runtime system must take care of this. -class DivINode : public Node { +class DivINode : public DivModIntegerNode { public: - DivINode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {} + DivINode(Node* c, Node* dividend, Node* divisor) : DivModIntegerNode(c, dividend, divisor) {} virtual int Opcode() const; virtual Node* Identity(PhaseGVN* phase); virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); @@ -54,9 +72,9 @@ public: //------------------------------DivLNode--------------------------------------- // Long division -class DivLNode : public Node { +class DivLNode : public DivModIntegerNode { public: - DivLNode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {} + DivLNode(Node* c, Node* dividend, Node* divisor) : DivModIntegerNode(c, dividend, divisor) {} virtual int Opcode() const; virtual Node* Identity(PhaseGVN* phase); virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); @@ -107,9 +125,9 @@ public: //------------------------------UDivINode--------------------------------------- // Unsigned integer division -class UDivINode : public Node { +class UDivINode : public DivModIntegerNode { public: - UDivINode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {} + UDivINode(Node* c, Node* dividend, Node* divisor) : DivModIntegerNode(c, dividend, divisor) {} virtual int Opcode() const; virtual Node* Identity(PhaseGVN* phase); virtual const Type* Value(PhaseGVN* phase) const; @@ -120,9 +138,9 @@ public: //------------------------------UDivLNode--------------------------------------- // Unsigned long division -class UDivLNode : public Node { +class UDivLNode : public DivModIntegerNode { public: - UDivLNode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {} + UDivLNode(Node* c, Node* dividend, Node* divisor) : DivModIntegerNode(c, dividend, divisor) {} virtual int Opcode() const; virtual Node* Identity(PhaseGVN* phase); virtual const Type* Value(PhaseGVN* phase) const; @@ -133,9 +151,9 @@ public: //------------------------------ModINode--------------------------------------- // Integer modulus -class ModINode : public Node { +class ModINode : public DivModIntegerNode { public: - ModINode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {} + ModINode(Node* c, Node* in1, Node* in2) : DivModIntegerNode(c, in1, in2) {} virtual int Opcode() const; virtual const Type* Value(PhaseGVN* phase) const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); @@ -145,9 +163,9 @@ public: //------------------------------ModLNode--------------------------------------- // Long modulus -class ModLNode : public Node { +class ModLNode : public DivModIntegerNode { public: - ModLNode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {} + ModLNode(Node* c, Node* in1, Node* in2) : DivModIntegerNode(c, in1, in2) {} virtual int Opcode() const; virtual const Type* Value(PhaseGVN* phase) const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); @@ -199,9 +217,9 @@ public: //------------------------------UModINode--------------------------------------- // Unsigned integer modulus -class UModINode : public Node { +class UModINode : public DivModIntegerNode { public: - UModINode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {} + UModINode(Node* c, Node* in1, Node* in2) : DivModIntegerNode(c, in1, in2) {} virtual int Opcode() const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual const Type *bottom_type() const { return TypeInt::INT; } @@ -211,9 +229,9 @@ public: //------------------------------UModLNode--------------------------------------- // Unsigned long modulus -class UModLNode : public Node { +class UModLNode : public DivModIntegerNode { public: - UModLNode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {} + UModLNode(Node* c, Node* in1, Node* in2) : DivModIntegerNode(c, in1, in2) {} virtual int Opcode() const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual const Type *bottom_type() const { return TypeLong::LONG; } @@ -243,6 +261,9 @@ public: ProjNode* div_proj() { return proj_out_or_null(div_proj_num); } ProjNode* mod_proj() { return proj_out_or_null(mod_proj_num); } + +private: + virtual bool depends_only_on_test() const { return false; } }; //------------------------------DivModINode--------------------------------------- diff --git a/src/hotspot/share/opto/ifnode.cpp b/src/hotspot/share/opto/ifnode.cpp index cd8017f9fb3..762791d467d 100644 --- a/src/hotspot/share/opto/ifnode.cpp +++ b/src/hotspot/share/opto/ifnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -604,7 +604,7 @@ static void adjust_check(IfProjNode* proj, Node* range, Node* index, // at the lowest/nearest dominating check in the graph. To ensure that these Loads/Casts do not float above any of the // dominating checks (even when the lowest dominating check is later replaced by yet another dominating check), we // need to pin them at the lowest dominating check. - proj->pin_array_access_nodes(igvn); + proj->pin_dependent_nodes(igvn); } //------------------------------up_one_dom------------------------------------- @@ -1539,7 +1539,7 @@ Node* IfNode::Ideal(PhaseGVN *phase, bool can_reshape) { } //------------------------------dominated_by----------------------------------- -Node* IfNode::dominated_by(Node* prev_dom, PhaseIterGVN* igvn, bool pin_array_access_nodes) { +Node* IfNode::dominated_by(Node* prev_dom, PhaseIterGVN* igvn, bool prev_dom_not_imply_this) { #ifndef PRODUCT if (TraceIterativeGVN) { tty->print(" Removing IfNode: "); this->dump(); @@ -1570,20 +1570,16 @@ Node* IfNode::dominated_by(Node* prev_dom, PhaseIterGVN* igvn, bool pin_array_ac // Loop ends when projection has no more uses. for (DUIterator_Last jmin, j = ifp->last_outs(jmin); j >= jmin; --j) { Node* s = ifp->last_out(j); // Get child of IfTrue/IfFalse - if (s->depends_only_on_test() && igvn->no_dependent_zero_check(s)) { - // For control producers. - // Do not rewire Div and Mod nodes which could have a zero divisor to avoid skipping their zero check. + if (s->depends_only_on_test()) { + // For control producers igvn->replace_input_of(s, 0, data_target); // Move child to data-target - if (pin_array_access_nodes && data_target != top) { - // As a result of range check smearing, Loads and range check Cast nodes that are control dependent on this - // range check (that is about to be removed) now depend on multiple dominating range checks. After the removal - // of this range check, these control dependent nodes end up at the lowest/nearest dominating check in the - // graph. To ensure that these Loads/Casts do not float above any of the dominating checks (even when the - // lowest dominating check is later replaced by yet another dominating check), we need to pin them at the - // lowest dominating check. - Node* clone = s->pin_array_access_node(); + if (prev_dom_not_imply_this && data_target != top) { + // If prev_dom_not_imply_this, s now depends on multiple tests with prev_dom being the + // lowest dominating one. As a result, it must be pinned there. Otherwise, it can be + // incorrectly moved to a dominating test equivalent to the lowest one here. + Node* clone = s->pin_node_under_control(); if (clone != nullptr) { - clone = igvn->transform(clone); + igvn->register_new_node_with_optimizer(clone, s); igvn->replace_node(s, clone); } } @@ -1831,16 +1827,15 @@ bool IfNode::is_zero_trip_guard() const { return false; } -void IfProjNode::pin_array_access_nodes(PhaseIterGVN* igvn) { +void IfProjNode::pin_dependent_nodes(PhaseIterGVN* igvn) { for (DUIterator i = outs(); has_out(i); i++) { Node* u = out(i); if (!u->depends_only_on_test()) { continue; } - Node* clone = u->pin_array_access_node(); + Node* clone = u->pin_node_under_control(); if (clone != nullptr) { - clone = igvn->transform(clone); - assert(clone != u, "shouldn't common"); + igvn->register_new_node_with_optimizer(clone, u); igvn->replace_node(u, clone); --i; } diff --git a/src/hotspot/share/opto/intrinsicnode.hpp b/src/hotspot/share/opto/intrinsicnode.hpp index 2672402881e..02b6ee2d775 100644 --- a/src/hotspot/share/opto/intrinsicnode.hpp +++ b/src/hotspot/share/opto/intrinsicnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,9 @@ class PartialSubtypeCheckNode : public Node { virtual int Opcode() const; virtual const Type* bottom_type() const { return TypeRawPtr::BOTTOM; } virtual uint ideal_reg() const { return Op_RegP; } + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; //------------------------------StrIntrinsic------------------------------- @@ -74,13 +77,15 @@ class StrIntrinsicNode: public Node { Node(control, char_array_mem, s1, s2), _encoding(encoding) { } - virtual bool depends_only_on_test() const { return false; } virtual const TypePtr* adr_type() const { return TypeAryPtr::BYTES; } virtual uint match_edge(uint idx) const; virtual uint ideal_reg() const { return Op_RegI; } virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); virtual const Type* Value(PhaseGVN* phase) const; ArgEncoding encoding() const { return _encoding; } + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; //------------------------------StrComp------------------------------------- @@ -172,13 +177,15 @@ class VectorizedHashCodeNode: public Node { VectorizedHashCodeNode(Node* control, Node* ary_mem, Node* arg1, Node* cnt1, Node* result, Node* basic_type) : Node(control, ary_mem, arg1, cnt1, result, basic_type) {}; virtual int Opcode() const; - virtual bool depends_only_on_test() const { return false; } virtual const Type* bottom_type() const { return TypeInt::INT; } virtual const TypePtr* adr_type() const { return TypePtr::BOTTOM; } virtual uint match_edge(uint idx) const; virtual uint ideal_reg() const { return Op_RegI; } virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); virtual const Type* Value(PhaseGVN* phase) const; + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; //------------------------------EncodeISOArray-------------------------------- @@ -191,7 +198,6 @@ class EncodeISOArrayNode: public Node { bool is_ascii() { return _ascii; } virtual int Opcode() const; - virtual bool depends_only_on_test() const { return false; } virtual const Type* bottom_type() const { return TypeInt::INT; } virtual const TypePtr* adr_type() const { return TypePtr::BOTTOM; } virtual uint match_edge(uint idx) const; @@ -203,6 +209,9 @@ class EncodeISOArrayNode: public Node { virtual bool cmp(const Node& n) const { return Node::cmp(n) && _ascii == ((EncodeISOArrayNode&)n).is_ascii(); } + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; //-------------------------------DigitNode---------------------------------------- diff --git a/src/hotspot/share/opto/locknode.hpp b/src/hotspot/share/opto/locknode.hpp index ee54e893e59..7d1507ae998 100644 --- a/src/hotspot/share/opto/locknode.hpp +++ b/src/hotspot/share/opto/locknode.hpp @@ -147,6 +147,9 @@ public: virtual int Opcode() const; virtual const Type* Value(PhaseGVN* phase) const { return TypeInt::CC; } const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;} + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; @@ -169,6 +172,8 @@ public: virtual const Type* Value(PhaseGVN* phase) const { return TypeInt::CC; } const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;} +private: + virtual bool depends_only_on_test_impl() const { return false; } }; #endif // SHARE_OPTO_LOCKNODE_HPP diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp index 61a7ed29c3e..be099747fc0 100644 --- a/src/hotspot/share/opto/loopPredicate.cpp +++ b/src/hotspot/share/opto/loopPredicate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -334,7 +334,7 @@ class Invariance : public StackObj { // loop, it was marked invariant but n is only invariant if // it depends only on that test. Otherwise, unless that test // is out of the loop, it's not invariant. - if (n->is_CFG() || (n->depends_only_on_test() && _phase->igvn().no_dependent_zero_check(n)) || n->in(0) == nullptr || !_phase->is_member(_lpt, n->in(0))) { + if (n->is_CFG() || n->in(0) == nullptr || n->depends_only_on_test() || !_phase->is_member(_lpt, n->in(0))) { _invariant.set(n->_idx); // I am a invariant too } } diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 5b06f0555ab..986cfdaa3f1 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -1676,8 +1676,8 @@ public: Node *has_local_phi_input( Node *n ); // Mark an IfNode as being dominated by a prior test, // without actually altering the CFG (and hence IDOM info). - void dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip = false, bool pin_array_access_nodes = false); - void rewire_safe_outputs_to_dominator(Node* source, Node* dominator, bool pin_array_access_nodes); + void dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip = false, bool prev_dom_not_imply_this = false); + void rewire_safe_outputs_to_dominator(Node* source, Node* dominator, bool dominator_not_imply_source); // Split Node 'n' through merge point RegionNode* split_thru_region(Node* n, RegionNode* region); @@ -1960,7 +1960,7 @@ public: bool can_move_to_inner_loop(Node* n, LoopNode* n_loop, Node* x); - void pin_array_access_nodes_dependent_on(Node* ctrl); + void pin_nodes_dependent_on(Node* ctrl, bool old_iff_is_rangecheck); Node* ensure_node_and_inputs_are_above_pre_end(CountedLoopEndNode* pre_end, Node* node); diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index 2b48780f9b0..862cb7067ec 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -345,7 +345,7 @@ bool PhaseIdealLoop::loop_phi_backedge_type_contains_zero(const Node* phi_diviso // Replace the dominated test with an obvious true or false. Place it on the // IGVN worklist for later cleanup. Move control-dependent data Nodes on the // live path up to the dominating control. -void PhaseIdealLoop::dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip, bool pin_array_access_nodes) { +void PhaseIdealLoop::dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip, bool prevdom_not_imply_this) { if (VerifyLoopOptimizations && PrintOpto) { tty->print_cr("dominating test"); } // prevdom is the dominating projection of the dominating test. @@ -386,26 +386,25 @@ void PhaseIdealLoop::dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip, b return; } - rewire_safe_outputs_to_dominator(dp, prevdom, pin_array_access_nodes); + rewire_safe_outputs_to_dominator(dp, prevdom, prevdom_not_imply_this); } -void PhaseIdealLoop::rewire_safe_outputs_to_dominator(Node* source, Node* dominator, const bool pin_array_access_nodes) { +void PhaseIdealLoop::rewire_safe_outputs_to_dominator(Node* source, Node* dominator, const bool dominator_not_imply_source) { IdealLoopTree* old_loop = get_loop(source); for (DUIterator_Fast imax, i = source->fast_outs(imax); i < imax; i++) { Node* out = source->fast_out(i); // Control-dependent node - // Do not rewire Div and Mod nodes which could have a zero divisor to avoid skipping their zero check. - if (out->depends_only_on_test() && _igvn.no_dependent_zero_check(out)) { + if (out->depends_only_on_test()) { assert(out->in(0) == source, "must be control dependent on source"); _igvn.replace_input_of(out, 0, dominator); - if (pin_array_access_nodes) { + if (dominator_not_imply_source) { // Because of Loop Predication, Loads and range check Cast nodes that are control dependent on this range // check (that is about to be removed) now depend on multiple dominating Hoisted Check Predicates. After the // removal of this range check, these control dependent nodes end up at the lowest/nearest dominating predicate // in the graph. To ensure that these Loads/Casts do not float above any of the dominating checks (even when the // lowest dominating check is later replaced by yet another dominating check), we need to pin them at the lowest // dominating check. - Node* clone = out->pin_array_access_node(); + Node* clone = out->pin_node_under_control(); if (clone != nullptr) { clone = _igvn.register_new_node_with_optimizer(clone, out); _igvn.replace_node(out, clone); @@ -1644,7 +1643,7 @@ bool PhaseIdealLoop::try_merge_identical_ifs(Node* n) { void PhaseIdealLoop::push_pinned_nodes_thru_region(IfNode* dom_if, Node* region) { for (DUIterator i = region->outs(); region->has_out(i); i++) { Node* u = region->out(i); - if (!has_ctrl(u) || u->is_Phi() || !u->depends_only_on_test() || !_igvn.no_dependent_zero_check(u)) { + if (!has_ctrl(u) || u->is_Phi() || !u->depends_only_on_test()) { continue; } assert(u->in(0) == region, "not a control dependent node?"); @@ -1724,11 +1723,11 @@ void PhaseIdealLoop::try_sink_out_of_loop(Node* n) { Node* outside_ctrl = place_outside_loop(n_ctrl, loop_ctrl); if (!would_sink_below_pre_loop_exit(loop_ctrl, outside_ctrl)) { if (n->depends_only_on_test()) { - Node* pinned_clone = n->pin_array_access_node(); + // If this node depends_only_on_test, it will be rewired to a control input that is not + // the correct test. As a result, it must be pinned otherwise it can be incorrectly + // rewired to a dominating test equivalent to the new control. + Node* pinned_clone = n->pin_node_under_control(); if (pinned_clone != nullptr) { - // Pin array access nodes: if this is an array load, it's going to be dependent on a condition that's not a - // range check for that access. If that condition is replaced by an identical dominating one, then an - // unpinned load would risk floating above its range check. register_new_node(pinned_clone, n_ctrl); maybe_pinned_n = pinned_clone; _igvn.replace_node(n, pinned_clone); @@ -1754,11 +1753,11 @@ void PhaseIdealLoop::try_sink_out_of_loop(Node* n) { Node* u = n->last_out(j); // Clone private computation per use _igvn.rehash_node_delayed(u); Node* x = nullptr; - if (n->depends_only_on_test()) { - // Pin array access nodes: if this is an array load, it's going to be dependent on a condition that's not a - // range check for that access. If that condition is replaced by an identical dominating one, then an - // unpinned load would risk floating above its range check. - x = n->pin_array_access_node(); + if (n->in(0) != nullptr && n->depends_only_on_test()) { + // If this node depends_only_on_test, it will be rewired to a control input that is not + // the correct test. As a result, it must be pinned otherwise it can be incorrectly + // rewired to a dominating test equivalent to the new control. + x = n->pin_node_under_control(); } if (x == nullptr) { x = n->clone(); @@ -2328,14 +2327,12 @@ void PhaseIdealLoop::clone_loop_handle_data_uses(Node* old, Node_List &old_new, // We notify all uses of old, including use, and the indirect uses, // that may now be optimized because we have replaced old with phi. _igvn.add_users_to_worklist(old); - if (idx == 0 && - use->depends_only_on_test()) { - Node* pinned_clone = use->pin_array_access_node(); + if (idx == 0 && use->depends_only_on_test()) { + // If this node depends_only_on_test, it will be rewired to a control input that is not the + // correct test. As a result, it must be pinned otherwise it can be incorrectly rewired to + // a dominating test equivalent to the new control. + Node* pinned_clone = use->pin_node_under_control(); if (pinned_clone != nullptr) { - // Pin array access nodes: control is updated here to a region. If, after some transformations, only one path - // into the region is left, an array load could become dependent on a condition that's not a range check for - // that access. If that condition is replaced by an identical dominating one, then an unpinned load would risk - // floating above its range check. pinned_clone->set_req(0, phi); register_new_node_with_ctrl_of(pinned_clone, use); _igvn.replace_node(use, pinned_clone); @@ -4102,11 +4099,9 @@ bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) { not_peel.test(n->_idx) && peel.test(n->in(0)->_idx)) { Node* n_clone = old_new[n->_idx]; if (n_clone->depends_only_on_test()) { - // Pin array access nodes: control is updated here to the loop head. If, after some transformations, the - // backedge is removed, an array load could become dependent on a condition that's not a range check for that - // access. If that condition is replaced by an identical dominating one, then an unpinned load would risk - // floating above its range check. - Node* pinned_clone = n_clone->pin_array_access_node(); + // If this node depends_only_on_test, it will be rewire to the loop head, which is not the + // correct test + Node* pinned_clone = n_clone->pin_node_under_control(); if (pinned_clone != nullptr) { register_new_node_with_ctrl_of(pinned_clone, n_clone); old_new.map(n->_idx, pinned_clone); diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index 7f152eddd65..f296b153f4b 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Alibaba Group Holding Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -900,7 +900,7 @@ void LoadNode::dump_spec(outputStream *st) const { // standard dump does this in Verbose and WizardMode st->print(" #"); _type->dump_on(st); } - if (!depends_only_on_test()) { + if (in(0) != nullptr && !depends_only_on_test()) { st->print(" (does not depend only on test, "); if (control_dependency() == UnknownControl) { st->print("unknown control"); @@ -1025,14 +1025,6 @@ static bool skip_through_membars(Compile::AliasType* atp, const TypeInstPtr* tp, return false; } -LoadNode* LoadNode::pin_array_access_node() const { - const TypePtr* adr_type = this->adr_type(); - if (adr_type != nullptr && adr_type->isa_aryptr()) { - return clone_pinned(); - } - return nullptr; -} - // Is the value loaded previously stored by an arraycopy? If so return // a load node that reads from the source array so we may be able to // optimize out the ArrayCopy node later. @@ -2585,6 +2577,21 @@ LoadNode* LoadNode::clone_pinned() const { return ld; } +// Pin a LoadNode if it carries a dependency on its control input. There are cases when the node +// does not actually have any dependency on its control input. For example, if we have a LoadNode +// being used only outside a loop but it must be scheduled inside the loop, we can clone the node +// for each of its use so that all the clones can be scheduled outside the loop. Then, to prevent +// the clones from being GVN-ed again, we add a control input for each of them at the loop exit. In +// those case, since there is not a dependency between the node and its control input, we do not +// need to pin it. +LoadNode* LoadNode::pin_node_under_control_impl() const { + const TypePtr* adr_type = this->adr_type(); + if (adr_type != nullptr && adr_type->isa_aryptr()) { + // Only array accesses have dependencies on their control input + return clone_pinned(); + } + return nullptr; +} //------------------------------Value------------------------------------------ const Type* LoadNKlassNode::Value(PhaseGVN* phase) const { diff --git a/src/hotspot/share/opto/memnode.hpp b/src/hotspot/share/opto/memnode.hpp index 249df51beb9..39b1ee88333 100644 --- a/src/hotspot/share/opto/memnode.hpp +++ b/src/hotspot/share/opto/memnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Alibaba Group Holding Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -299,8 +299,6 @@ public: bool has_unknown_control_dependency() const { return _control_dependency == UnknownControl; } bool has_pinned_control_dependency() const { return _control_dependency == Pinned; } - LoadNode* pin_array_access_node() const; - #ifndef PRODUCT virtual void dump_spec(outputStream *st) const; #endif @@ -314,6 +312,7 @@ protected: Node* can_see_arraycopy_value(Node* st, PhaseGVN* phase) const; +private: // depends_only_on_test is almost always true, and needs to be almost always // true to enable key hoisting & commoning optimizations. However, for the // special case of RawPtr loads from TLS top & end, and other loads performed by @@ -323,11 +322,12 @@ protected: // which produce results (new raw memory state) inside of loops preventing all // manner of other optimizations). Basically, it's ugly but so is the alternative. // See comment in macro.cpp, around line 125 expand_allocate_common(). - virtual bool depends_only_on_test() const { + virtual bool depends_only_on_test_impl() const { return adr_type() != TypeRawPtr::BOTTOM && _control_dependency == DependsOnlyOnTest; } LoadNode* clone_pinned() const; + virtual LoadNode* pin_node_under_control_impl() const; }; //------------------------------LoadBNode-------------------------------------- @@ -534,7 +534,6 @@ public: virtual int Opcode() const; virtual const Type* Value(PhaseGVN* phase) const; virtual Node* Identity(PhaseGVN* phase); - virtual bool depends_only_on_test() const { return true; } // Polymorphic factory method: static Node* make(PhaseGVN& gvn, Node* mem, Node* adr, const TypePtr* at, @@ -563,7 +562,6 @@ public: virtual const Type* Value(PhaseGVN* phase) const; virtual Node* Identity(PhaseGVN* phase); - virtual bool depends_only_on_test() const { return true; } }; @@ -580,7 +578,6 @@ private: virtual uint size_of() const { return sizeof(*this); } protected: virtual bool cmp( const Node &n ) const; - virtual bool depends_only_on_test() const { return false; } Node *Ideal_masked_input (PhaseGVN *phase, uint mask); Node* Ideal_sign_extended_input(PhaseGVN* phase, int num_rejected_bits); @@ -660,6 +657,9 @@ public: Node* convert_to_reinterpret_store(PhaseGVN& gvn, Node* val, const Type* vt); MemBarNode* trailing_membar() const; + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; //------------------------------StoreBNode------------------------------------- @@ -816,7 +816,6 @@ private: #endif // ASSERT public: LoadStoreNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at, const Type* rt, uint required ); - virtual bool depends_only_on_test() const { return false; } virtual uint match_edge(uint idx) const { return idx == MemNode::Address || idx == MemNode::ValueIn; } virtual const Type *bottom_type() const { return _type; } @@ -829,6 +828,9 @@ public: uint8_t barrier_data() { return _barrier_data; } void set_barrier_data(uint8_t barrier_data) { _barrier_data = barrier_data; } + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; class LoadStoreConditionalNode : public LoadStoreNode { @@ -1115,6 +1117,9 @@ public: // Return allocation input memory edge if it is different instance // or itself if it is the one we are looking for. static bool step_through(Node** np, uint instance_id, PhaseValues* phase); + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; //------------------------------MemBar----------------------------------------- @@ -1677,6 +1682,9 @@ public: virtual uint match_edge(uint idx) const { return (idx == 2); } virtual const TypePtr *adr_type() const { return TypePtr::BOTTOM; } virtual const Type *bottom_type() const { return Type::MEMORY; } + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; // cachewb pre sync node for ensuring that writebacks are serialised @@ -1689,6 +1697,9 @@ public: virtual uint match_edge(uint idx) const { return false; } virtual const TypePtr *adr_type() const { return TypePtr::BOTTOM; } virtual const Type *bottom_type() const { return Type::MEMORY; } + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; // cachewb pre sync node for ensuring that writebacks are serialised @@ -1701,6 +1712,9 @@ public: virtual uint match_edge(uint idx) const { return false; } virtual const TypePtr *adr_type() const { return TypePtr::BOTTOM; } virtual const Type *bottom_type() const { return Type::MEMORY; } + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; //------------------------------Prefetch--------------------------------------- @@ -1713,6 +1727,9 @@ public: virtual uint ideal_reg() const { return NotAMachineReg; } virtual uint match_edge(uint idx) const { return idx==2; } virtual const Type *bottom_type() const { return ( AllocatePrefetchStyle == 3 ) ? Type::MEMORY : Type::ABIO; } + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; #endif // SHARE_OPTO_MEMNODE_HPP diff --git a/src/hotspot/share/opto/mulnode.cpp b/src/hotspot/share/opto/mulnode.cpp index aa8d6cfce2e..ac7d1925667 100644 --- a/src/hotspot/share/opto/mulnode.cpp +++ b/src/hotspot/share/opto/mulnode.cpp @@ -1238,20 +1238,26 @@ Node* RShiftNode::IdentityIL(PhaseGVN* phase, BasicType bt) { return in(1); } // Check for useless sign-masking + int lshift_count = 0; if (in(1)->Opcode() == Op_LShift(bt) && in(1)->req() == 3 && - in(1)->in(2) == in(2)) { + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 31) + const_shift_count(phase, in(1), &lshift_count)) { count &= bits_per_java_integer(bt) - 1; // semantics of Java shifts - // Compute masks for which this shifting doesn't change - jlong lo = (CONST64(-1) << (bits_per_java_integer(bt) - ((uint)count)-1)); // FFFF8000 - jlong hi = ~lo; // 00007FFF - const TypeInteger* t11 = phase->type(in(1)->in(1))->isa_integer(bt); - if (t11 == nullptr) { - return this; - } - // Does actual value fit inside of mask? - if (lo <= t11->lo_as_long() && t11->hi_as_long() <= hi) { - return in(1)->in(1); // Then shifting is a nop + lshift_count &= bits_per_java_integer(bt) - 1; + if (count == lshift_count) { + // Compute masks for which this shifting doesn't change + jlong lo = (CONST64(-1) << (bits_per_java_integer(bt) - ((uint)count)-1)); // FFFF8000 + jlong hi = ~lo; // 00007FFF + const TypeInteger* t11 = phase->type(in(1)->in(1))->isa_integer(bt); + if (t11 == nullptr) { + return this; + } + // Does actual value fit inside of mask? + if (lo <= t11->lo_as_long() && t11->hi_as_long() <= hi) { + return in(1)->in(1); // Then shifting is a nop + } } } } @@ -1524,11 +1530,14 @@ Node* URShiftINode::Ideal(PhaseGVN* phase, bool can_reshape) { // If Q is "X << z" the rounding is useless. Look for patterns like // ((X<>> Z and replace with (X + Y>>>Z) & Z-mask. Node *add = in(1); - const TypeInt *t2 = phase->type(in(2))->isa_int(); if (in1_op == Op_AddI) { Node *lshl = add->in(1); - if( lshl->Opcode() == Op_LShiftI && - phase->type(lshl->in(2)) == t2 ) { + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 31) + int lshl_con = 0; + if (lshl->Opcode() == Op_LShiftI && + const_shift_count(phase, lshl, &lshl_con) && + (lshl_con & (BitsPerJavaInteger - 1)) == con) { Node *y_z = phase->transform( new URShiftINode(add->in(2),in(2)) ); Node *sum = phase->transform( new AddINode( lshl->in(1), y_z ) ); return new AndINode( sum, phase->intcon(mask) ); @@ -1555,11 +1564,16 @@ Node* URShiftINode::Ideal(PhaseGVN* phase, bool can_reshape) { // Check for "(X << z ) >>> z" which simply zero-extends Node *shl = in(1); - if( in1_op == Op_LShiftI && - phase->type(shl->in(2)) == t2 ) - return new AndINode( shl->in(1), phase->intcon(mask) ); + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 31) + int shl_con = 0; + if (in1_op == Op_LShiftI && + const_shift_count(phase, shl, &shl_con) && + (shl_con & (BitsPerJavaInteger - 1)) == con) + return new AndINode(shl->in(1), phase->intcon(mask)); // Check for (x >> n) >>> 31. Replace with (x >>> 31) + const TypeInt* t2 = phase->type(in(2))->isa_int(); Node *shr = in(1); if ( in1_op == Op_RShiftI ) { Node *in11 = shr->in(1); @@ -1677,11 +1691,15 @@ Node* URShiftLNode::Ideal(PhaseGVN* phase, bool can_reshape) { const TypeInt *t2 = phase->type(in(2))->isa_int(); if (add->Opcode() == Op_AddL) { Node *lshl = add->in(1); - if( lshl->Opcode() == Op_LShiftL && - phase->type(lshl->in(2)) == t2 ) { - Node *y_z = phase->transform( new URShiftLNode(add->in(2),in(2)) ); - Node *sum = phase->transform( new AddLNode( lshl->in(1), y_z ) ); - return new AndLNode( sum, phase->longcon(mask) ); + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 63) + int lshl_con = 0; + if (lshl->Opcode() == Op_LShiftL && + const_shift_count(phase, lshl, &lshl_con) && + (lshl_con & (BitsPerJavaLong - 1)) == con) { + Node* y_z = phase->transform(new URShiftLNode(add->in(2), in(2))); + Node* sum = phase->transform(new AddLNode(lshl->in(1), y_z)); + return new AndLNode(sum, phase->longcon(mask)); } } @@ -1701,9 +1719,14 @@ Node* URShiftLNode::Ideal(PhaseGVN* phase, bool can_reshape) { // Check for "(X << z ) >>> z" which simply zero-extends Node *shl = in(1); - if( shl->Opcode() == Op_LShiftL && - phase->type(shl->in(2)) == t2 ) - return new AndLNode( shl->in(1), phase->longcon(mask) ); + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 63) + int shl_con = 0; + if (shl->Opcode() == Op_LShiftL && + const_shift_count(phase, shl, &shl_con) && + (shl_con & (BitsPerJavaLong - 1)) == con) { + return new AndLNode(shl->in(1), phase->longcon(mask)); + } // Check for (x >> n) >>> 63. Replace with (x >>> 63) Node *shr = in(1); diff --git a/src/hotspot/share/opto/multnode.hpp b/src/hotspot/share/opto/multnode.hpp index 20ab59aeabc..b63d418b742 100644 --- a/src/hotspot/share/opto/multnode.hpp +++ b/src/hotspot/share/opto/multnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,6 @@ public: virtual const Type *bottom_type() const = 0; virtual bool is_CFG() const { return true; } virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash - virtual bool depends_only_on_test() const { return false; } virtual const RegMask &out_RegMask() const; virtual Node *match( const ProjNode *proj, const Matcher *m ); virtual uint ideal_reg() const { return NotAMachineReg; } @@ -176,8 +175,7 @@ public: const bool _is_io_use; // Used to distinguish between the projections // used on the control and io paths from a macro node virtual int Opcode() const; - virtual bool is_CFG() const; - virtual bool depends_only_on_test() const { return false; } + virtual bool is_CFG() const; virtual const Type *bottom_type() const; virtual const TypePtr *adr_type() const; virtual bool pinned() const; diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index e65578924d1..46b89aa2c5f 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -1059,14 +1059,135 @@ public: virtual bool is_CFG() const { return false; } - // If this node is control-dependent on a test, can it be - // rerouted to a dominating equivalent test? This is usually - // true of non-CFG nodes, but can be false for operations which - // depend for their correct sequencing on more than one test. - // (In that case, hoisting to a dominating test may silently - // skip some other important test.) - virtual bool depends_only_on_test() const { assert(!is_CFG(), ""); return true; }; + // If this node is control-dependent on a test, can it be rerouted to a dominating equivalent + // test? This means that the node can be executed safely as long as it happens after the test + // that is its control input without worrying about the whole control flow. On the contrary, if + // the node depends on a test that is not its control input, or if it depends on more than one + // tests, then this method must return false. + // + // Pseudocode examples: + // 1. if (y != 0) { + // x / y; + // } + // The division depends only on the test y != 0 and can be executed anywhere y != 0 holds true. + // As a result, depends_only_on_test returns true. + // 2. if (y != 0) { + // if (x > 1) { + // x / y; + // } + // } + // If the division x / y has its control input being the IfTrueNode of the test y != 0, then + // depends_only_on_test returns true. Otherwise, if the division has its control input being the + // IfTrueNode of the test x > 1, then depends_only_on_test returns false. + // 3. if (y > z) { + // if (z > 0) { + // x / y + // } + // } + // The division depends on both tests y > z and z > 0. As a result, depends_only_on_test returns + // false. + // + // This method allows more freedom in certain nodes with regards to scheduling, for example it + // allows nodes to float out of loops together with its test. + // + // This method is pessimistic, this means that it may return false even if the node satisfy the + // requirements. However, it must return false if the node does not satisfy the requirements. + // When a test is decomposed into multiple tests, all nodes that depend on the decomposed test + // must be pinned at the lowest dominating test of those. For example, when a zero check of a + // division is split through a region but the division itself is not, it must be pinned at the + // merge point by returning false when calling this method. + bool depends_only_on_test() const { + if (is_CFG() || pinned()) { + return false; + } + assert(in(0) != nullptr, "must have a control input"); + return depends_only_on_test_impl(); + } + // Return a clone of the current node that's pinned. The current node must return true for + // depends_only_on_test, and the retuned node must return false. This method is called when the + // node is disconnected from its test. + // + // Examples: + // 1. for (int i = start; i <= limit; i++) { + // if (!rangecheck(i, a)) { + // trap; + // } + // a[i]; + // } + // Loop predication can then hoist the range check out of the loop: + // if (!rangecheck(start, a)) { + // trap; + // } + // if (!rangecheck(limit, a)) { + // trap; + // } + // for (int i = start; i <= limit; i++) { + // a[i]; + // } + // As the load a[i] now depends on both tests rangecheck(start, a) and rangecheck(limit, a), it + // must be pinned at the lowest dominating test of those. + // + // 2. if (y > x) { + // if (x >= 0) { + // if (y != 0) { + // x / y; + // } + // } + // } + // The test (y != 0) == true can be deduced from (y > x) == true and (x >= 0) == true, so we may + // choose to elide it. In such cases, the division x / y now depends on both tests + // (y > x) == true and (x >= 0) == true, so it must be pinned at the lowest dominating test of + // those. + // + // 3. if (b) { + // ... + // } else { + // ... + // } + // if (y == 0) { + // trap; + // } + // x / y; + // The division x / y depends only on the test (y == 0) == false, but if we split the test + // through the merge point but not the division: + // if (b) { + // ... + // if (y == 0) { + // trap; + // } + // } else { + // ... + // if (y == 0) { + // trap; + // } + // } + // x / y; + // The division now has the control input being the RegionNode merge the branches of if(b) + // instead of a test that proves y != 0. As a result, it must be pinned at that node. + // + // There are cases where the node does not actually have a dependency on its control input. For + // example, when we try to sink a LoadNode out of a loop in PhaseIdealLoop::try_sink_out_of_loop, + // we clone the node so that all of the clones can be scheduled out of the loop. To prevent the + // clones from being GVN-ed again, we add a control input for the node at the loop exit. For the + // cases when the node does provably not depend on its control input, this method can return + // nullptr. + Node* pin_node_under_control() const { + assert(depends_only_on_test(), "must be a depends_only_on_test node"); + Node* res = pin_node_under_control_impl(); + if (res == nullptr) { + assert(is_Load(), "unexpected failure to pin for %s", Name()); + return nullptr; + } + assert(!res->depends_only_on_test(), "the result must not depends_only_on_test"); + return res; + } + +private: + virtual bool depends_only_on_test_impl() const { assert(false, "%s", Name()); return false; } + virtual Node* pin_node_under_control_impl() const { assert(false, "%s", Name()); return nullptr; } + +public: // When building basic blocks, I need to have a notion of block beginning // Nodes, next block selector Nodes (block enders), and next block // projections. These calls need to work on their machine equivalents. The @@ -1201,13 +1322,6 @@ public: template void visit_uses(Callback callback, Check is_boundary) const; - // Returns a clone of the current node that's pinned (if the current node is not) for nodes found in array accesses - // (Load and range check CastII nodes). - // This is used when an array access is made dependent on 2 or more range checks (range check smearing or Loop Predication). - virtual Node* pin_array_access_node() const { - return nullptr; - } - //----------------- Code Generation // Ideal register class for Matching. Zero means unmatched instruction diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index be92d4116b0..94f38e86239 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -1722,11 +1722,6 @@ void PhaseIterGVN::verify_Ideal_for(Node* n, bool can_reshape) { case Op_MergeMem: return; - // URShiftINode::Ideal - // Found in tier1-3. Did not investigate further yet. - case Op_URShiftI: - return; - // CMoveINode::Ideal // Found in tier1-3. Did not investigate further yet. case Op_CMoveI: @@ -2594,12 +2589,15 @@ void PhaseIterGVN::add_users_of_use_to_worklist(Node* n, Node* use, Unique_Node_ auto is_boundary = [](Node* n){ return !n->is_ConstraintCast(); }; use->visit_uses(push_the_uses_to_worklist, is_boundary); } - // If changed LShift inputs, check RShift users for useless sign-ext + // If changed LShift inputs, check RShift/URShift users for + // "(X << C) >> C" sign-ext and "(X << C) >>> C" zero-ext optimizations. if (use_op == Op_LShiftI || use_op == Op_LShiftL) { for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) { Node* u = use->fast_out(i2); - if (u->Opcode() == Op_RShiftI || u->Opcode() == Op_RShiftL) + if (u->Opcode() == Op_RShiftI || u->Opcode() == Op_RShiftL || + u->Opcode() == Op_URShiftI || u->Opcode() == Op_URShiftL) { worklist.push(u); + } } } // If changed LShift inputs, check And users for shift and mask (And) operation @@ -2796,37 +2794,6 @@ void PhaseIterGVN::remove_speculative_types() { _table.check_no_speculative_types(); } -// Check if the type of a divisor of a Div or Mod node includes zero. -bool PhaseIterGVN::no_dependent_zero_check(Node* n) const { - switch (n->Opcode()) { - case Op_DivI: - case Op_ModI: - case Op_UDivI: - case Op_UModI: { - // Type of divisor includes 0? - if (type(n->in(2)) == Type::TOP) { - // 'n' is dead. Treat as if zero check is still there to avoid any further optimizations. - return false; - } - const TypeInt* type_divisor = type(n->in(2))->is_int(); - return (type_divisor->_hi < 0 || type_divisor->_lo > 0); - } - case Op_DivL: - case Op_ModL: - case Op_UDivL: - case Op_UModL: { - // Type of divisor includes 0? - if (type(n->in(2)) == Type::TOP) { - // 'n' is dead. Treat as if zero check is still there to avoid any further optimizations. - return false; - } - const TypeLong* type_divisor = type(n->in(2))->is_long(); - return (type_divisor->_hi < 0 || type_divisor->_lo > 0); - } - } - return true; -} - //============================================================================= #ifndef PRODUCT uint PhaseCCP::_total_invokes = 0; diff --git a/src/hotspot/share/opto/phaseX.hpp b/src/hotspot/share/opto/phaseX.hpp index cc0d47bd634..cd38f37ccf5 100644 --- a/src/hotspot/share/opto/phaseX.hpp +++ b/src/hotspot/share/opto/phaseX.hpp @@ -604,7 +604,6 @@ public: } bool is_dominator(Node *d, Node *n) { return is_dominator_helper(d, n, false); } - bool no_dependent_zero_check(Node* n) const; #ifndef PRODUCT static bool is_verify_def_use() { diff --git a/src/hotspot/share/opto/rootnode.hpp b/src/hotspot/share/opto/rootnode.hpp index 3838578b4db..76f0ec440a9 100644 --- a/src/hotspot/share/opto/rootnode.hpp +++ b/src/hotspot/share/opto/rootnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,6 @@ public: virtual const Type *bottom_type() const; virtual bool is_CFG() const { return true; } virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash - virtual bool depends_only_on_test() const { return false; } virtual const Node *is_block_proj() const { return this; } virtual const RegMask &out_RegMask() const; virtual uint ideal_reg() const { return NotAMachineReg; } diff --git a/src/hotspot/share/opto/split_if.cpp b/src/hotspot/share/opto/split_if.cpp index de9ddb60b0c..dff8bf86606 100644 --- a/src/hotspot/share/opto/split_if.cpp +++ b/src/hotspot/share/opto/split_if.cpp @@ -29,6 +29,7 @@ #include "opto/movenode.hpp" #include "opto/node.hpp" #include "opto/opaquenode.hpp" +#include "opto/opcodes.hpp" #include "opto/predicates.hpp" //------------------------------split_thru_region------------------------------ @@ -716,14 +717,11 @@ void PhaseIdealLoop::do_split_if(Node* iff, RegionNode** new_false_region, Regio } // End of while merge point has phis _igvn.remove_dead_node(region); - if (iff->Opcode() == Op_RangeCheck) { - // Pin array access nodes: control is updated here to a region. If, after some transformations, only one path - // into the region is left, an array load could become dependent on a condition that's not a range check for - // that access. If that condition is replaced by an identical dominating one, then an unpinned load would risk - // floating above its range check. - pin_array_access_nodes_dependent_on(new_true); - pin_array_access_nodes_dependent_on(new_false); - } + + // Control is updated here to a region, which is not a test, so any node that + // depends_only_on_test must be pinned + pin_nodes_dependent_on(new_true, iff->Opcode() == Op_RangeCheck); + pin_nodes_dependent_on(new_false, iff->Opcode() == Op_RangeCheck); if (new_false_region != nullptr) { *new_false_region = new_false; @@ -735,13 +733,22 @@ void PhaseIdealLoop::do_split_if(Node* iff, RegionNode** new_false_region, Regio DEBUG_ONLY( if (VerifyLoopOptimizations) { verify(); } ); } -void PhaseIdealLoop::pin_array_access_nodes_dependent_on(Node* ctrl) { +void PhaseIdealLoop::pin_nodes_dependent_on(Node* ctrl, bool old_iff_is_rangecheck) { for (DUIterator i = ctrl->outs(); ctrl->has_out(i); i++) { Node* use = ctrl->out(i); if (!use->depends_only_on_test()) { continue; } - Node* pinned_clone = use->pin_array_access_node(); + + + // When a RangeCheckNode is folded because its condition is a constant, IfProjNode::Identity + // returns the control input of the RangeCheckNode. As a result, when the old IfNode is not a + // RangeCheckNode, and a Load output of it depends_only_on_test, we don't need to pin the Load. + if (use->is_Load() && !old_iff_is_rangecheck) { + continue; + } + + Node* pinned_clone = use->pin_node_under_control(); if (pinned_clone != nullptr) { register_new_node_with_ctrl_of(pinned_clone, use); _igvn.replace_node(use, pinned_clone); diff --git a/src/hotspot/share/opto/subnode.hpp b/src/hotspot/share/opto/subnode.hpp index 463d9e020cb..a90661c49ee 100644 --- a/src/hotspot/share/opto/subnode.hpp +++ b/src/hotspot/share/opto/subnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -507,6 +507,9 @@ public: virtual int Opcode() const; const Type *bottom_type() const { return Type::DOUBLE; } virtual uint ideal_reg() const { return Op_RegD; } + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; @@ -522,6 +525,9 @@ public: const Type *bottom_type() const { return Type::DOUBLE; } virtual uint ideal_reg() const { return Op_RegD; } virtual const Type* Value(PhaseGVN* phase) const; + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; //------------------------------SqrtFNode-------------------------------------- @@ -541,6 +547,9 @@ public: const Type *bottom_type() const { return Type::FLOAT; } virtual uint ideal_reg() const { return Op_RegF; } virtual const Type* Value(PhaseGVN* phase) const; + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; //------------------------------SqrtHFNode------------------------------------- diff --git a/src/hotspot/share/opto/subtypenode.hpp b/src/hotspot/share/opto/subtypenode.hpp index abf9cad4844..2dac3866209 100644 --- a/src/hotspot/share/opto/subtypenode.hpp +++ b/src/hotspot/share/opto/subtypenode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,6 @@ public: virtual int Opcode() const; const Type* bottom_type() const { return TypeInt::CC; } - bool depends_only_on_test() const { return false; } ciMethod* method() const { return _method; } int bci() const { return _bci; } @@ -71,6 +70,8 @@ private: static bool is_oop(PhaseGVN* phase, Node* n); Node* load_klass(PhaseGVN* phase) const; + + virtual bool depends_only_on_test_impl() const { return false; } #endif // ASSERT }; diff --git a/src/hotspot/share/runtime/abstract_vm_version.hpp b/src/hotspot/share/runtime/abstract_vm_version.hpp index 5a6b41506c7..17ade2c068d 100644 --- a/src/hotspot/share/runtime/abstract_vm_version.hpp +++ b/src/hotspot/share/runtime/abstract_vm_version.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,7 @@ typedef enum { } VirtualizationType; class outputStream; +class stringStream; enum class vmIntrinsicID; // Abstract_VM_Version provides information about the VM. @@ -226,6 +227,21 @@ class Abstract_VM_Version: AllStatic { static const char* cpu_name(void); static const char* cpu_description(void); + + static void get_cpu_features_name(void* features_buffer, stringStream& ss) { return; } + + // Returns names of features present in features_set1 but not in features_set2 + static void get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss) { return; } + + // Returns number of bytes required to store cpu features representation + static int cpu_features_size() { return 0; } + + // Stores arch dependent cpu features representation in the provided buffer. + // Size of the buffer must be same as returned by cpu_features_size() + static void store_cpu_features(void* buf) { return; } + + // features_to_test is an opaque object that stores arch specific representation of cpu features + static bool supports_features(void* features_to_test) { return false; }; }; #endif // SHARE_RUNTIME_ABSTRACT_VM_VERSION_HPP diff --git a/src/hotspot/share/runtime/vmOperations.cpp b/src/hotspot/share/runtime/vmOperations.cpp index c5539fd5e50..ef480f04c57 100644 --- a/src/hotspot/share/runtime/vmOperations.cpp +++ b/src/hotspot/share/runtime/vmOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,6 +51,7 @@ #include "runtime/threadSMR.inline.hpp" #include "runtime/vmOperations.hpp" #include "services/threadService.hpp" +#include "utilities/growableArray.hpp" #include "utilities/ticks.hpp" #define VM_OP_NAME_INITIALIZE(name) #name, @@ -286,42 +287,27 @@ class ObjectMonitorsDump : public MonitorClosure, public ObjectMonitorsView { } private: - class ObjectMonitorLinkedList : - public LinkedListImpl {}; + using ObjectMonitorList = GrowableArrayCHeap; // HashTable SIZE is specified at compile time so we // use 1031 which is the first prime after 1024. - typedef HashTable PtrTable; PtrTable* _ptrs; size_t _key_count; size_t _om_count; - void add_list(int64_t key, ObjectMonitorLinkedList* list) { - _ptrs->put(key, list); - _key_count++; - } - - ObjectMonitorLinkedList* get_list(int64_t key) { - ObjectMonitorLinkedList** listpp = _ptrs->get(key); - return (listpp == nullptr) ? nullptr : *listpp; - } - void add(ObjectMonitor* monitor) { int64_t key = monitor->owner(); - ObjectMonitorLinkedList* list = get_list(key); - if (list == nullptr) { - // Create new list and add it to the hash table: - list = new (mtThread) ObjectMonitorLinkedList; - _ptrs->put(key, list); + bool created = false; + ObjectMonitorList* list = _ptrs->put_if_absent(key, &created); + if (created) { _key_count++; } - assert(list->find(monitor) == nullptr, "Should not contain duplicates"); - list->add(monitor); // Add the ObjectMonitor to the list. + assert(list->find(monitor) == -1, "Should not contain duplicates"); + list->push(monitor); // Add the ObjectMonitor to the list. _om_count++; } @@ -332,17 +318,7 @@ class ObjectMonitorsDump : public MonitorClosure, public ObjectMonitorsView { ObjectMonitorsDump() : _ptrs(new (mtThread) PtrTable), _key_count(0), _om_count(0) {} ~ObjectMonitorsDump() { - class CleanupObjectMonitorsDump: StackObj { - public: - bool do_entry(int64_t& key, ObjectMonitorLinkedList*& list) { - list->clear(); // clear the LinkListNodes - delete list; // then delete the LinkedList - return true; - } - } cleanup; - - _ptrs->unlink(&cleanup); // cleanup the LinkedLists - delete _ptrs; // then delete the hash table + delete _ptrs; } // Implements MonitorClosure used to collect all owned monitors in the system @@ -368,11 +344,12 @@ class ObjectMonitorsDump : public MonitorClosure, public ObjectMonitorsView { // Implements the ObjectMonitorsView interface void visit(MonitorClosure* closure, JavaThread* thread) override { int64_t key = ObjectMonitor::owner_id_from(thread); - ObjectMonitorLinkedList* list = get_list(key); - LinkedListIterator iter(list != nullptr ? list->head() : nullptr); - while (!iter.is_empty()) { - ObjectMonitor* monitor = *iter.next(); - closure->do_monitor(monitor); + ObjectMonitorList* list = _ptrs->get(key); + if (list == nullptr) { + return; + } + for (int i = 0; i < list->length(); i++) { + closure->do_monitor(list->at(i)); } } diff --git a/src/hotspot/share/utilities/rbTree.hpp b/src/hotspot/share/utilities/rbTree.hpp index a2f84ac2373..89f9eb256bf 100644 --- a/src/hotspot/share/utilities/rbTree.hpp +++ b/src/hotspot/share/utilities/rbTree.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,9 +26,8 @@ #define SHARE_UTILITIES_RBTREE_HPP #include "cppstdlib/type_traits.hpp" -#include "metaprogramming/enableIf.hpp" +#include "memory/allocation.hpp" #include "nmt/memTag.hpp" -#include "runtime/os.hpp" #include "utilities/globalDefinitions.hpp" // An intrusive red-black tree is constructed with two template parameters: @@ -64,8 +63,9 @@ enum class RBTreeOrdering : int { LT, EQ, GT }; template class AbstractRBTree; - +class Arena; class outputStream; +class ResourceArea; class IntrusiveRBNode { template @@ -81,7 +81,7 @@ class IntrusiveRBNode { DEBUG_ONLY(mutable bool _visited); public: - IntrusiveRBNode() : _parent(0), _left(nullptr), _right(nullptr) DEBUG_ONLY(COMMA _visited(false)) {} + IntrusiveRBNode(); // Gets the previous in-order node in the tree. // nullptr is returned if there is no previous node. @@ -96,22 +96,18 @@ public: void print_on(outputStream* st, int depth = 0) const; private: - bool is_black() const { return (_parent & 0x1) != 0; } - bool is_red() const { return (_parent & 0x1) == 0; } + bool is_black() const; + bool is_red() const; - void set_black() { _parent |= 0x1; } - void set_red() { _parent &= ~0x1; } + void set_black(); + void set_red(); - IntrusiveRBNode* parent() const { return (IntrusiveRBNode*)(_parent & ~0x1); } - void set_parent(IntrusiveRBNode* new_parent) { _parent = (_parent & 0x1) | (uintptr_t)new_parent; } + IntrusiveRBNode* parent() const; + void set_parent(IntrusiveRBNode* new_parent); - bool is_right_child() const { - return parent() != nullptr && parent()->_right == this; - } + bool is_right_child() const; - bool is_left_child() const { - return parent() != nullptr && parent()->_left == this; - } + bool is_left_child() const; void replace_child(IntrusiveRBNode* old_child, IntrusiveRBNode* new_child); @@ -142,20 +138,20 @@ private: V _value; public: - const K& key() const { return _key; } + const K& key() const; - V& val() { return _value; } - const V& val() const { return _value; } - void set_val(const V& v) { _value = v; } + V& val(); + const V& val() const; + void set_val(const V& v); - RBNode() {} - RBNode(const K& key) : IntrusiveRBNode(), _key(key) {} - RBNode(const K& key, const V& val) : IntrusiveRBNode(), _key(key), _value(val) {} + RBNode(); + RBNode(const K& key); + RBNode(const K& key, const V& val); - const RBNode* prev() const { return (RBNode*)IntrusiveRBNode::prev(); } - const RBNode* next() const { return (RBNode*)IntrusiveRBNode::next(); } - RBNode* prev() { return (RBNode*)IntrusiveRBNode::prev(); } - RBNode* next() { return (RBNode*)IntrusiveRBNode::next(); } + const RBNode* prev() const; + const RBNode* next() const; + RBNode* prev(); + RBNode* next(); void print_on(outputStream* st, int depth = 0) const; @@ -176,17 +172,15 @@ public: friend AbstractRBTree; NodeType** _insert_location; NodeType* _parent; - Cursor() : _insert_location(nullptr), _parent(nullptr) {} - Cursor(NodeType** insert_location, NodeType* parent) - : _insert_location(insert_location), _parent(parent) {} - Cursor(NodeType* const* insert_location, NodeType* parent) - : _insert_location((NodeType**)insert_location), _parent(parent) {} + Cursor(); + Cursor(NodeType** insert_location, NodeType* parent); + Cursor(NodeType* const* insert_location, NodeType* parent); public: - bool valid() const { return _insert_location != nullptr; } - bool found() const { return *_insert_location != nullptr; } - NodeType* node() { return _insert_location == nullptr ? nullptr : *_insert_location; } - NodeType* node() const { return _insert_location == nullptr ? nullptr : *_insert_location; } + bool valid() const; + bool found() const; + NodeType* node(); + NodeType* node() const; }; protected: @@ -212,36 +206,16 @@ private: static constexpr bool HasNodeVerifier = HasNodeVerifierImpl::value; - RBTreeOrdering cmp(const K& a, const NodeType* b) const { - if constexpr (HasNodeComparator) { - return COMPARATOR::cmp(a, b); - } else if constexpr (HasKeyComparator) { - return COMPARATOR::cmp(a, b->key()); - } - } + RBTreeOrdering cmp(const K& a, const NodeType* b) const; - bool less_than(const NodeType* a, const NodeType* b) const { - if constexpr (HasNodeVerifier) { - return COMPARATOR::less_than(a, b); - } else { - return true; - } - } + bool less_than(const NodeType* a, const NodeType* b) const; - void assert_key_leq(K a, K b) const { - if constexpr (HasKeyComparator) { // Cannot assert if no key comparator exist. - assert(COMPARATOR::cmp(a, b) != RBTreeOrdering::GT, "key a must be less or equal to key b"); - } - } + void assert_key_leq(K a, K b) const; // True if node is black (nil nodes count as black) - static inline bool is_black(const IntrusiveRBNode* node) { - return node == nullptr || node->is_black(); - } + static inline bool is_black(const IntrusiveRBNode* node); - static inline bool is_red(const IntrusiveRBNode* node) { - return node != nullptr && node->is_red(); - } + static inline bool is_red(const IntrusiveRBNode* node); void fix_insert_violations(IntrusiveRBNode* node); @@ -251,18 +225,14 @@ private: void remove_from_tree(IntrusiveRBNode* node); struct empty_verifier { - bool operator()(const NodeType* n) const { - return true; - } + bool operator()(const NodeType* n) const; }; template void verify_self(NODE_VERIFIER verifier, const USER_VERIFIER& extra_verifier) const; struct default_printer { - void operator()(outputStream* st, const NodeType* n, int depth) const { - n->print_on(st, depth); - } + void operator()(outputStream* st, const NodeType* n, int depth) const; }; template @@ -271,12 +241,9 @@ private: public: NONCOPYABLE(AbstractRBTree); - AbstractRBTree() : _num_nodes(0), _root(nullptr) DEBUG_ONLY(COMMA _expected_visited(false)) { - static_assert(std::is_trivially_destructible::value, "key type must be trivially destructable"); - static_assert(HasKeyComparator || HasNodeComparator, "comparator must be of correct type"); - } + AbstractRBTree(); - size_t size() const { return _num_nodes; } + size_t size() const; // Gets the cursor associated with the given node or key. Cursor cursor(const K& key, const NodeType* hint_node = nullptr); @@ -311,87 +278,39 @@ public: void replace_at_cursor(NodeType* new_node, const Cursor& node_cursor); // Finds the node associated with the given key. - NodeType* find_node(const K& key, const NodeType* hint_node = nullptr) const { - Cursor node_cursor = cursor(key, hint_node); - return node_cursor.node(); - } - - NodeType* find_node(const K& key, const NodeType* hint_node = nullptr) { - Cursor node_cursor = cursor(key, hint_node); - return node_cursor.node(); - } + NodeType* find_node(const K& key, const NodeType* hint_node = nullptr); + NodeType* find_node(const K& key, const NodeType* hint_node = nullptr) const; // Inserts the given node into the tree. - void insert(const K& key, NodeType* node, const NodeType* hint_node = nullptr) { - Cursor node_cursor = cursor(key, hint_node); - insert_at_cursor(node, node_cursor); - } + void insert(const K& key, NodeType* node, const NodeType* hint_node = nullptr); - void remove(NodeType* node) { - Cursor node_cursor = cursor(node); - remove_at_cursor(node_cursor); - } + // Removes the given node from the tree. + void remove(NodeType* node); // Finds the node with the closest key <= the given key. // If no node is found, null is returned instead. - NodeType* closest_leq(const K& key) const { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? node_cursor.node() : prev(node_cursor).node(); - } - - NodeType* closest_leq(const K& key) { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? node_cursor.node() : prev(node_cursor).node(); - } + NodeType* closest_leq(const K& key); + NodeType* closest_leq(const K& key) const; // Finds the node with the closest key > the given key. // If no node is found, null is returned instead. - NodeType* closest_gt(const K& key) const { - Cursor node_cursor = cursor(key); - return next(node_cursor).node(); - } - - NodeType* closest_gt(const K& key) { - Cursor node_cursor = cursor(key); - return next(node_cursor).node(); - } + NodeType* closest_gt(const K& key); + NodeType* closest_gt(const K& key) const; // Finds the node with the closest key >= the given key. // If no node is found, null is returned instead. - NodeType* closest_ge(const K& key) const { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? node_cursor.node() : next(node_cursor).node(); - } - - NodeType* closest_ge(const K& key) { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? node_cursor.node() : next(node_cursor).node(); - } + NodeType* closest_ge(const K& key); + NodeType* closest_ge(const K& key) const; // Returns leftmost node, nullptr if tree is empty. // If COMPARATOR::cmp(a, b) behaves canonically (positive value for a > b), this will the smallest key value. - const NodeType* leftmost() const { - IntrusiveRBNode* n = _root, *n2 = nullptr; - while (n != nullptr) { - n2 = n; - n = n->_left; - } - return (NodeType*)n2; - } + NodeType* leftmost(); + const NodeType* leftmost() const; // Returns rightmost node, nullptr if tree is empty. // If COMPARATOR::cmp(a, b) behaves canonically (positive value for a > b), this will the largest key value. - const NodeType* rightmost() const { - IntrusiveRBNode* n = _root, *n2 = nullptr; - while (n != nullptr) { - n2 = n; - n = n->_right; - } - return (NodeType*)n2; - } - - NodeType* leftmost() { return const_cast(static_cast(this)->leftmost()); } - NodeType* rightmost() { return const_cast(static_cast(this)->rightmost()); } + NodeType* rightmost(); + const NodeType* rightmost() const; struct Range { NodeType* start; @@ -403,11 +322,7 @@ public: // Return the range [start, end) // where start->key() <= addr < end->key(). // Failure to find the range leads to start and/or end being null. - Range find_enclosing_range(K key) const { - NodeType* start = closest_leq(key); - NodeType* end = closest_gt(key); - return Range(start, end); - } + Range find_enclosing_range(K key) const; // Visit all RBNodes in ascending order, calling f on each node. // If f returns `true` the iteration continues, otherwise it is stopped at the current node. @@ -417,7 +332,6 @@ public: template void visit_in_order(F f); - // Visit all RBNodes in ascending order whose keys are in range [from, to], calling f on each node. // If f returns `true` the iteration continues, otherwise it is stopped at the current node. template @@ -433,15 +347,7 @@ public: // This should return true if the node is valid. // If provided, each node is also verified through this callable. template - void verify_self(const USER_VERIFIER& extra_verifier = USER_VERIFIER()) const { - if constexpr (HasNodeVerifier) { - verify_self([](const NodeType* a, const NodeType* b){ return COMPARATOR::less_than(a, b);}, extra_verifier); - } else if constexpr (HasKeyComparator) { - verify_self([](const NodeType* a, const NodeType* b){ return COMPARATOR::cmp(a->key(), b->key()) == RBTreeOrdering::LT; }, extra_verifier); - } else { - verify_self([](const NodeType*, const NodeType*){ return true;}, extra_verifier); - } - } + void verify_self(const USER_VERIFIER& extra_verifier = USER_VERIFIER()) const; // Accepts an optional printing callable `void node_printer(outputStream* st, const Node* n, int depth)`. // If provided, each node is printed through this callable rather than the default `print_on`. @@ -458,9 +364,10 @@ class RBTree : public AbstractRBTree, COMPARATOR> { ALLOCATOR _allocator; public: - RBTree() : BaseType(), _allocator() {} + template + RBTree(AllocArgs... alloc_args); + ~RBTree(); NONCOPYABLE(RBTree); - ~RBTree() { remove_all(); } bool copy_into(RBTree& other) const; @@ -471,118 +378,68 @@ public: using BaseType::next; using BaseType::prev; - void replace_at_cursor(RBNode* new_node, const Cursor& node_cursor) { - RBNode* old_node = node_cursor.node(); - BaseType::replace_at_cursor(new_node, node_cursor); - free_node(old_node); - } + void replace_at_cursor(RBNode* new_node, const Cursor& node_cursor); - RBNode* allocate_node(const K& key) { - void* node_place = _allocator.allocate(sizeof(RBNode)); - if (node_place == nullptr) { - return nullptr; - } - return new (node_place) RBNode(key); - } + RBNode* allocate_node(const K& key); + RBNode* allocate_node(const K& key, const V& val); - RBNode* allocate_node(const K& key, const V& val) { - void* node_place = _allocator.allocate(sizeof(RBNode)); - if (node_place == nullptr) { - return nullptr; - } - return new (node_place) RBNode(key, val); - } - - void free_node(RBNode* node) { - node->_value.~V(); - _allocator.free(node); - } + void free_node(RBNode* node); // Inserts a node with the given key/value into the tree, // if the key already exist, the value is updated instead. // Returns false if and only if allocation of a new node failed. - bool upsert(const K& key, const V& val, const RBNode* hint_node = nullptr) { - Cursor node_cursor = cursor(key, hint_node); - RBNode* node = node_cursor.node(); - if (node != nullptr) { - node->set_val(val); - return true; - } - - node = allocate_node(key, val); - if (node == nullptr) { - return false; - } - insert_at_cursor(node, node_cursor); - return true; - } + bool upsert(const K& key, const V& val, const RBNode* hint_node = nullptr); // Finds the value of the node associated with the given key. - V* find(const K& key) { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? &node_cursor.node()->_value : nullptr; - } + V* find(const K& key); + V* find(const K& key) const; - V* find(const K& key) const { - const Cursor node_cursor = cursor(key); - return node_cursor.found() ? &node_cursor.node()->_value : nullptr; - } - - void remove(RBNode* node) { - Cursor node_cursor = cursor(node); - remove_at_cursor(node_cursor); - free_node(node); - } + void remove(RBNode* node); // Removes the node with the given key from the tree if it exists. // Returns true if the node was successfully removed, false otherwise. - bool remove(const K& key) { - Cursor node_cursor = cursor(key); - if (!node_cursor.found()) { - return false; - } - RBNode* node = node_cursor.node(); - remove_at_cursor(node_cursor); - free_node((RBNode*)node); - return true; - } + bool remove(const K& key); // Removes all existing nodes from the tree. - void remove_all() { - IntrusiveRBNode* to_delete[64]; - int stack_idx = 0; - to_delete[stack_idx++] = BaseType::_root; - - while (stack_idx > 0) { - IntrusiveRBNode* head = to_delete[--stack_idx]; - if (head == nullptr) continue; - to_delete[stack_idx++] = head->_left; - to_delete[stack_idx++] = head->_right; - free_node((RBNode*)head); - } - BaseType::_num_nodes = 0; - BaseType::_root = nullptr; - } + void remove_all(); }; template class RBTreeCHeapAllocator { public: - void* allocate(size_t sz) { - void* allocation = os::malloc(sz, mem_tag); - if (allocation == nullptr && strategy == AllocFailStrategy::EXIT_OOM) { - vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, - "red-black tree failed allocation"); - } - return allocation; - } - - void free(void* ptr) { os::free(ptr); } + void* allocate(size_t sz); + void free(void* ptr); }; +template +class RBTreeArenaAllocator { + Arena* _arena; +public: + RBTreeArenaAllocator(Arena* arena); + void* allocate(size_t sz); + void free(void* ptr); +}; + +template +class RBTreeResourceAreaAllocator { + ResourceArea* _rarea; +public: + RBTreeResourceAreaAllocator(ResourceArea* rarea); + void* allocate(size_t sz); + void free(void* ptr); +}; + + + template using RBTreeCHeap = RBTree>; +template +using RBTreeArena = RBTree>; + +template +using RBTreeResourceArea = RBTree>; + template using IntrusiveRBTree = AbstractRBTree; diff --git a/src/hotspot/share/utilities/rbTree.inline.hpp b/src/hotspot/share/utilities/rbTree.inline.hpp index 6e01f92d12a..ed8884b2d27 100644 --- a/src/hotspot/share/utilities/rbTree.inline.hpp +++ b/src/hotspot/share/utilities/rbTree.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,12 +27,49 @@ #include "utilities/rbTree.hpp" +#include "memory/allocation.hpp" +#include "memory/arena.hpp" +#include "memory/resourceArea.hpp" #include "metaprogramming/enableIf.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ostream.hpp" #include "utilities/powerOfTwo.hpp" +inline IntrusiveRBNode::IntrusiveRBNode() + : _parent(0), _left(nullptr), _right(nullptr) DEBUG_ONLY(COMMA _visited(false)) {} + +inline bool IntrusiveRBNode::is_black() const { + return (_parent & 0x1) != 0; +} + +inline bool IntrusiveRBNode::is_red() const { + return (_parent & 0x1) == 0; +} + +inline void IntrusiveRBNode::set_black() { + _parent |= 0x1; +} +inline void IntrusiveRBNode::set_red() { + _parent &= ~0x1; +} + +inline IntrusiveRBNode* IntrusiveRBNode::parent() const { + return reinterpret_cast(_parent & ~0x1); +} + +inline void IntrusiveRBNode::set_parent(IntrusiveRBNode* new_parent) { + _parent = (_parent & 0x1) | reinterpret_cast(new_parent); +} + +inline bool IntrusiveRBNode::is_right_child() const { + return parent() != nullptr && parent()->_right == this; +} + +inline bool IntrusiveRBNode::is_left_child() const { + return parent() != nullptr && parent()->_left == this; +} + inline void IntrusiveRBNode::replace_child(IntrusiveRBNode* old_child, IntrusiveRBNode* new_child) { if (_left == old_child) { _left = new_child; @@ -185,6 +222,144 @@ inline void IntrusiveRBNode::verify( } +template +inline const K& RBNode::key() const { + return _key; +} + +template +inline V& RBNode::val() { + return _value; +} + +template +inline const V& RBNode::val() const { + return _value; +} + +template +inline void RBNode::set_val(const V& v) { + _value = v; +} + +template +inline RBNode::RBNode() {} + +template +inline RBNode::RBNode(const K& key) : IntrusiveRBNode(), _key(key) {} + +template +inline RBNode::RBNode(const K& key, const V& val) : IntrusiveRBNode(), _key(key), _value(val) {} + +template +inline const RBNode* RBNode::prev() const { + return static_cast*>(IntrusiveRBNode::prev()); +} + +template +inline const RBNode* RBNode::next() const { + return static_cast*>(IntrusiveRBNode::next()); +} + +template +inline RBNode* RBNode::prev() { + return static_cast*>(IntrusiveRBNode::prev()); +} + +template +inline RBNode* RBNode::next() { + return static_cast*>(IntrusiveRBNode::next()); +} + +template +inline AbstractRBTree::Cursor::Cursor() + : _insert_location(nullptr), _parent(nullptr) {} + +template +inline AbstractRBTree::Cursor::Cursor(NodeType** insert_location, NodeType* parent) + : _insert_location(insert_location), _parent(parent) {} + +template +inline AbstractRBTree::Cursor::Cursor(NodeType* const* insert_location, NodeType* parent) + : _insert_location(const_cast(insert_location)), _parent(parent) {} + +template +inline bool AbstractRBTree::Cursor::valid() const { + return _insert_location != nullptr; +} + +template +inline bool AbstractRBTree::Cursor::found() const { + return *_insert_location != nullptr; +} + +template +inline NodeType* AbstractRBTree::Cursor::node() { + return _insert_location == nullptr ? nullptr : *_insert_location; +} + +template +inline NodeType* AbstractRBTree::Cursor::node() const { + return _insert_location == nullptr ? nullptr : *_insert_location; +} + +template +inline RBTreeOrdering AbstractRBTree::cmp(const K& a, const NodeType* b) const { + if constexpr (HasNodeComparator) { + return COMPARATOR::cmp(a, b); + } else if constexpr (HasKeyComparator) { + return COMPARATOR::cmp(a, b->key()); + } +} + +template +inline bool AbstractRBTree::less_than(const NodeType* a, const NodeType* b) const { + if constexpr (HasNodeVerifier) { + return COMPARATOR::less_than(a, b); + } else { + return true; + } +} + +template +inline void AbstractRBTree::assert_key_leq(K a, K b) const { + if constexpr (HasKeyComparator) { // Cannot assert if no key comparator exist. + assert(COMPARATOR::cmp(a, b) != RBTreeOrdering::GT, "key a must be less or equal to key b"); + } +} + +template +inline bool AbstractRBTree::is_black(const IntrusiveRBNode* node) { + return node == nullptr || node->is_black(); +} + +template +inline bool AbstractRBTree::is_red(const IntrusiveRBNode* node) { + return node != nullptr && node->is_red(); +} + +template +inline bool AbstractRBTree::empty_verifier::operator()(const NodeType* n) const { + return true; +} + +template +inline void AbstractRBTree::default_printer::operator()(outputStream* st, const NodeType* n, int depth) const { + n->print_on(st, depth); +} + +template +inline AbstractRBTree::AbstractRBTree() + : _num_nodes(0), _root(nullptr) DEBUG_ONLY(COMMA _expected_visited(false)) { + static_assert(std::is_trivially_destructible::value, "key type must be trivially destructable"); + static_assert(HasKeyComparator || HasNodeComparator, "comparator must be of correct type"); +} + +template +inline size_t AbstractRBTree::size() const { + return _num_nodes; +} + template inline const typename AbstractRBTree::Cursor AbstractRBTree::cursor(const K& key, const NodeType* hint_node) const { @@ -596,6 +771,104 @@ AbstractRBTree::prev(const Cursor& node_cursor) { return static_cast*>(this)->prev(node_cursor); } +template +inline NodeType* AbstractRBTree::find_node(const K& key, const NodeType* hint_node) const { + Cursor node_cursor = cursor(key, hint_node); + return node_cursor.node(); +} + +template +inline NodeType* AbstractRBTree::find_node(const K& key, const NodeType* hint_node) { + Cursor node_cursor = cursor(key, hint_node); + return node_cursor.node(); +} + +template +inline void AbstractRBTree::insert(const K& key, NodeType* node, const NodeType* hint_node) { + Cursor node_cursor = cursor(key, hint_node); + insert_at_cursor(node, node_cursor); +} + +template +inline void AbstractRBTree::remove(NodeType* node) { + Cursor node_cursor = cursor(node); + remove_at_cursor(node_cursor); +} + +template +inline NodeType* AbstractRBTree::closest_leq(const K& key) const { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? node_cursor.node() : prev(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_leq(const K& key) { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? node_cursor.node() : prev(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_gt(const K& key) const { + Cursor node_cursor = cursor(key); + return next(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_gt(const K& key) { + Cursor node_cursor = cursor(key); + return next(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_ge(const K& key) const { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? node_cursor.node() : next(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_ge(const K& key) { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? node_cursor.node() : next(node_cursor).node(); +} + +template +inline const NodeType* AbstractRBTree::leftmost() const { + IntrusiveRBNode* n = _root, *n2 = nullptr; + while (n != nullptr) { + n2 = n; + n = n->_left; + } + return static_cast(n2); +} + +template +inline const NodeType* AbstractRBTree::rightmost() const { + IntrusiveRBNode* n = _root, *n2 = nullptr; + while (n != nullptr) { + n2 = n; + n = n->_right; + } + return static_cast(n2); +} + +template +inline NodeType* AbstractRBTree::leftmost() { + return const_cast(static_cast*>(this)->leftmost()); +} + +template +inline NodeType* AbstractRBTree::rightmost() { + return const_cast(static_cast*>(this)->rightmost()); +} + +template +inline typename AbstractRBTree::Range +AbstractRBTree::find_enclosing_range(K key) const { + NodeType* start = closest_leq(key); + NodeType* end = closest_gt(key); + return Range(start, end); +} + template template inline void AbstractRBTree::visit_in_order(F f) const { @@ -662,6 +935,18 @@ inline void AbstractRBTree::visit_range_in_order(const } } +template +template +inline void AbstractRBTree::verify_self(const USER_VERIFIER& extra_verifier) const { + if constexpr (HasNodeVerifier) { + verify_self([](const NodeType* a, const NodeType* b){ return COMPARATOR::less_than(a, b);}, extra_verifier); + } else if constexpr (HasKeyComparator) { + verify_self([](const NodeType* a, const NodeType* b){ return COMPARATOR::cmp(a->key(), b->key()) == RBTreeOrdering::LT; }, extra_verifier); + } else { + verify_self([](const NodeType*, const NodeType*){ return true;}, extra_verifier); + } +} + template template inline void AbstractRBTree::verify_self(NODE_VERIFIER verifier, const USER_VERIFIER& extra_verifier) const { @@ -753,6 +1038,15 @@ void AbstractRBTree::print_on(outputStream* st, const P } } +template +template +inline RBTree::RBTree(AllocArgs... alloc_args) : BaseType(), _allocator(alloc_args...) {} + +template +inline RBTree::~RBTree() { + remove_all(); +} + template bool RBTree::copy_into(RBTree& other) const { assert(other.size() == 0, "You can only copy into an empty RBTree"); @@ -802,4 +1096,132 @@ bool RBTree::copy_into(RBTree& other) const { return true; } +template +inline void RBTree::replace_at_cursor(RBNode* new_node, const Cursor& node_cursor) { + RBNode* old_node = node_cursor.node(); + BaseType::replace_at_cursor(new_node, node_cursor); + free_node(old_node); +} + +template +inline RBNode* RBTree::allocate_node(const K& key) { + void* node_place = _allocator.allocate(sizeof(RBNode)); + if (node_place == nullptr) { + return nullptr; + } + return new (node_place) RBNode(key); +} + +template +inline RBNode* RBTree::allocate_node(const K& key, const V& val) { + void* node_place = _allocator.allocate(sizeof(RBNode)); + if (node_place == nullptr) { + return nullptr; + } + return new (node_place) RBNode(key, val); +} + +template +inline void RBTree::free_node(RBNode* node) { + node->_value.~V(); + _allocator.free(node); +} + +template +inline bool RBTree::upsert(const K& key, const V& val, const RBNode* hint_node) { + Cursor node_cursor = cursor(key, hint_node); + RBNode* node = node_cursor.node(); + if (node != nullptr) { + node->set_val(val); + return true; + } + + node = allocate_node(key, val); + if (node == nullptr) { + return false; + } + insert_at_cursor(node, node_cursor); + return true; +} + +template +inline V* RBTree::find(const K& key) { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? &node_cursor.node()->_value : nullptr; +} + +template +inline V* RBTree::find(const K& key) const { + const Cursor node_cursor = cursor(key); + return node_cursor.found() ? &node_cursor.node()->_value : nullptr; +} + +template +inline void RBTree::remove(RBNode* node) { + Cursor node_cursor = cursor(node); + remove_at_cursor(node_cursor); + free_node(node); +} + +template +inline bool RBTree::remove(const K& key) { + Cursor node_cursor = cursor(key); + if (!node_cursor.found()) { + return false; + } + RBNode* node = node_cursor.node(); + remove_at_cursor(node_cursor); + free_node((RBNode*)node); + return true; +} + +template +inline void RBTree::remove_all() { + IntrusiveRBNode* to_delete[64]; + int stack_idx = 0; + to_delete[stack_idx++] = BaseType::_root; + + while (stack_idx > 0) { + IntrusiveRBNode* head = to_delete[--stack_idx]; + if (head == nullptr) continue; + to_delete[stack_idx++] = head->_left; + to_delete[stack_idx++] = head->_right; + free_node((RBNode*)head); + } + BaseType::_num_nodes = 0; + BaseType::_root = nullptr; +} + +template +inline void* RBTreeCHeapAllocator::allocate(size_t sz) { + return AllocateHeap(sz, mem_tag, strategy); +} + +template +inline void RBTreeCHeapAllocator::free(void* ptr) { + FreeHeap(ptr); +} + +template +inline RBTreeArenaAllocator::RBTreeArenaAllocator(Arena* arena) : _arena(arena) {} + +template +inline void* RBTreeArenaAllocator::allocate(size_t sz) { + return _arena->Amalloc(sz, strategy); +} + +template +inline void RBTreeArenaAllocator::free(void* ptr) { /* NOP */ } + +template +inline RBTreeResourceAreaAllocator::RBTreeResourceAreaAllocator(ResourceArea* rarea) : _rarea(rarea) {} + +template +inline void* RBTreeResourceAreaAllocator::allocate(size_t sz) { + return _rarea->Amalloc(sz, strategy); +} + +template +inline void RBTreeResourceAreaAllocator::free(void* ptr) { /* NOP */ } + #endif // SHARE_UTILITIES_RBTREE_INLINE_HPP diff --git a/src/java.base/share/classes/java/lang/FdLibm.java b/src/java.base/share/classes/java/lang/FdLibm.java index 78090be2b05..8e75f8f6994 100644 --- a/src/java.base/share/classes/java/lang/FdLibm.java +++ b/src/java.base/share/classes/java/lang/FdLibm.java @@ -3561,4 +3561,50 @@ final class FdLibm { return hx > 0 ? w : -w; } } + + /** + * Return the Inverse Hyperbolic Cosine of x + * + * Method : + * + * + * acosh(x) is defined so that acosh(cosh(alpha)) = alpha, -∞ < alpha < ∞ + * and cosh(acosh(x)) = x, 1 <= x < ∞. + * It can be written as acosh(x) = log(x + sqrt(x^2 - 1)), 1 <= x < ∞. + * acosh(x) := log(x)+ln2, if x is large; else + * := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else + * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. + * + * + * + * Special cases: + * acosh(x) is NaN with signal if x < 1. + * acosh(NaN) is NaN without signal. + */ + static final class Acosh { + private static final double ln2 = 6.93147180559945286227e-01; + + static double compute(double x) { + double t; + int hx; + hx = __HI(x); + if (hx < 0x3ff0_0000) { // x < 1 */ + return (x - x) / (x - x); + } else if (hx >= 0x41b0_0000) { // x > 2**28 + if (hx >= 0x7ff0_0000) { // x is inf of NaN + return x + x; + } else { + return Log.compute(x) + ln2; // acosh(huge) = log(2x) + } + } else if (((hx - 0x3ff0_0000) | __LO(x)) == 0) { + return 0.0; // acosh(1) = 0 + } else if (hx > 0x4000_0000) { // 2**28 > x > 2 + t = x * x; + return Log.compute(2.0 * x - 1.0 / (x + Sqrt.compute(t - 1.0))); + } else { // 1< x <2 + t = x - 1.0; + return Log1p.compute(t + Sqrt.compute(2.0 * t + t * t)); + } + } + } } diff --git a/src/java.base/share/classes/java/lang/Math.java b/src/java.base/share/classes/java/lang/Math.java index 7add99f9325..4f729fe82cb 100644 --- a/src/java.base/share/classes/java/lang/Math.java +++ b/src/java.base/share/classes/java/lang/Math.java @@ -109,10 +109,10 @@ import static java.lang.Double.*; * acos acos}, {@link atan atan}, {@link exp exp}, {@link expm1 * expm1}, {@link log log}, {@link log10 log10}, {@link log1p log1p}, * {@link sinh sinh}, {@link cosh cosh}, {@link tanh tanh}, {@link asinh asinh}, - * {@link hypot hypot}, and {@link pow pow}. (The {@link sqrt sqrt} - * operation is a required part of IEEE 754 from a different section - * of the standard.) The special case behavior of the recommended - * operations generally follows the guidance of the IEEE 754 + * {@link acosh acosh}, {@link hypot hypot}, and {@link pow pow}. + * (The {@link sqrt sqrt} operation is a required part of IEEE 754 + * from a different section of the standard.) The special case behavior + * of the recommended operations generally follows the guidance of the IEEE 754 * standard. However, the {@code pow} method defines different * behavior for some arguments, as noted in its {@linkplain pow * specification}. The IEEE 754 standard defines its operations to be @@ -2785,6 +2785,35 @@ public final class Math { return StrictMath.asinh(x); } + + + /** + * Returns the inverse hyperbolic cosine of a {@code double} value. + * The inverse hyperbolic cosine of x is defined to be the function such that + * acosh({@linkplain Math#cosh cosh(x)}) = x for any x >= 0. + * Note that range of the exact acosh(x) is >= 0. + *

Special cases: + *

    + * + *
  • If the argument is positive infinity, then the result is + * positive infinity + * + *
  • If the argument less than 1, then the result is NaN. + * + *
  • If the argument is NaN, then the result is NaN. + * + *
  • If the argument is {@code 1.0}, then the result is positive zero. + * + *
+ *

The computed result must be within 2.5 ulps of the exact result. + * @param x The number whose inverse hyperbolic cosine is to be returned. + * @return The inverse hyperbolic cosine of {@code x}. + * @since 27 + */ + public static double acosh(double x) { + return StrictMath.acosh(x); + } + /** * Returns sqrt(x2 +y2) * without intermediate overflow or underflow. diff --git a/src/java.base/share/classes/java/lang/ProcessBuilder.java b/src/java.base/share/classes/java/lang/ProcessBuilder.java index d461818eedf..bc92ea4ee82 100644 --- a/src/java.base/share/classes/java/lang/ProcessBuilder.java +++ b/src/java.base/share/classes/java/lang/ProcessBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -930,6 +930,12 @@ public final class ProcessBuilder * command interpreters, or the standard C library function * {@code system()}. * + * @implNote + * When the process is {@link #start started}, + * if {#code System.out} and/or {#code System.err} have been + * closed in the current process, the corresponding output + * in the subprocess will be discarded. + * * @return this process builder * @since 1.7 */ diff --git a/src/java.base/share/classes/java/lang/StrictMath.java b/src/java.base/share/classes/java/lang/StrictMath.java index 9540c4b05b4..9421b41620b 100644 --- a/src/java.base/share/classes/java/lang/StrictMath.java +++ b/src/java.base/share/classes/java/lang/StrictMath.java @@ -76,8 +76,8 @@ import jdk.internal.vm.annotation.IntrinsicCandidate; * {@code exp}, {@code log}, {@code log10}, * {@code cbrt}, {@code atan2}, {@code pow}, * {@code sinh}, {@code cosh}, {@code tanh}, - * {@code asinh}, {@code hypot}, {@code expm1}, - * and {@code log1p}. + * {@code asinh}, {@code acosh}, {@code hypot}, + * {@code expm1}, and {@code log1p}. * *

* The platform uses signed two's complement integer arithmetic with @@ -2196,6 +2196,32 @@ public final class StrictMath { return FdLibm.Asinh.compute(x); } + /** + * Returns the inverse hyperbolic cosine of a {@code double} value. + * The inverse hyperbolic cosine of x is defined to be the function such that + * acosh({@linkplain Math#cosh cosh(x)}) = x for any x >= 0. + * Note that range of the exact acosh(x) is >= 0. + *

Special cases: + *

    + * + *
  • If the argument is positive infinity, then the result is + * positive infinity + * + *
  • If the argument less than {@code 1.0}, then the result is NaN. + * + *
  • If the argument is NaN, then the result is NaN. + * + *
  • If the argument is {@code 1.0}, then the result is positive zero. + * + *
+ * @param x The number whose inverse hyperbolic cosine is to be returned. + * @return The inverse hyperbolic cosine of {@code x}. + * @since 27 + */ + public static double acosh(double x) { + return FdLibm.Acosh.compute(x); + } + /** * Returns sqrt(x2 +y2) * without intermediate overflow or underflow. diff --git a/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java b/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java index 10aa0397f0c..1c565a52c0f 100644 --- a/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java +++ b/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java @@ -195,10 +195,9 @@ public class BasicImageReader implements AutoCloseable { } if (result.getMajorVersion() != ImageHeader.MAJOR_VERSION || - result.getMinorVersion() != ImageHeader.MINOR_VERSION) { - throw new IOException("The image file \"" + name + "\" is not " + - "the correct version. Major: " + result.getMajorVersion() + - ". Minor: " + result.getMinorVersion()); + result.getMinorVersion() != ImageHeader.MINOR_VERSION) { + throw new ImageVersionMismatchException( + name, result.getMajorVersion(), result.getMinorVersion()); } return result; @@ -447,4 +446,14 @@ public class BasicImageReader implements AutoCloseable { return new ByteArrayInputStream(bytes); } + + public static final class ImageVersionMismatchException extends IOException { + @Deprecated + private static final long serialVersionUID = 1L; + // If needed we could capture major/minor version for use by JImageTask. + ImageVersionMismatchException(String name, int majorVersion, int minorVersion) { + super("The image file \"" + name + "\" is not the correct version. " + + "Major: " + majorVersion + ". Minor: " + minorVersion); + } + } } diff --git a/src/java.base/share/classes/jdk/internal/util/WeakReferenceKey.java b/src/java.base/share/classes/jdk/internal/util/WeakReferenceKey.java index 3fe6d6026d7..0b26aa40c0d 100644 --- a/src/java.base/share/classes/jdk/internal/util/WeakReferenceKey.java +++ b/src/java.base/share/classes/jdk/internal/util/WeakReferenceKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -88,4 +88,18 @@ final class WeakReferenceKey extends WeakReference implements ReferenceKey public String toString() { return this.getClass().getCanonicalName() + "#" + System.identityHashCode(this); } + + // WeakReferenceKey.equals() is usually executed in the AOT assembly phase. However, + // in some rare occasions, it's not executed (due to peculiarity of hash code and + // memory addressing??). As a result, the constant pool entries used by + // equals() are not resolved. + // + // The JVM calls ensureDeterministicAOTCache() during the AOT assembly phase to ensure + // that the constant pool entries used by equals() are resolved, so that the + // the JDK's default CDS archives have deterministic contents. + private static boolean ensureDeterministicAOTCache() { + WeakReferenceKey k1 = new WeakReferenceKey<>("1", null); + WeakReferenceKey k2 = new WeakReferenceKey<>("2", null); + return k1.equals(k2); + } } diff --git a/src/java.base/windows/classes/java/lang/ProcessImpl.java b/src/java.base/windows/classes/java/lang/ProcessImpl.java index 1a08aca52e9..26d7afc5363 100644 --- a/src/java.base/windows/classes/java/lang/ProcessImpl.java +++ b/src/java.base/windows/classes/java/lang/ProcessImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -119,6 +119,12 @@ final class ProcessImpl extends Process { stdHandles[1] = -1L; } else if (redirects[1] == Redirect.INHERIT) { stdHandles[1] = fdAccess.getHandle(FileDescriptor.out); + if (stdHandles[1] == -1L) { + // FileDescriptor.out has been closed. + f1 = newFileOutputStream(Redirect.DISCARD.file(), + Redirect.DISCARD.append()); + stdHandles[1] = fdAccess.getHandle(f1.getFD()); + } } else if (redirects[1] instanceof ProcessBuilder.RedirectPipeImpl) { stdHandles[1] = fdAccess.getHandle(((ProcessBuilder.RedirectPipeImpl) redirects[1]).getFd()); // Force getInputStream to return a null stream, @@ -134,6 +140,12 @@ final class ProcessImpl extends Process { stdHandles[2] = -1L; } else if (redirects[2] == Redirect.INHERIT) { stdHandles[2] = fdAccess.getHandle(FileDescriptor.err); + if (stdHandles[2] == -1L) { + // FileDescriptor.err has been closed. + f2 = newFileOutputStream(Redirect.DISCARD.file(), + Redirect.DISCARD.append()); + stdHandles[2] = fdAccess.getHandle(f2.getFD()); + } } else if (redirects[2] instanceof ProcessBuilder.RedirectPipeImpl) { stdHandles[2] = fdAccess.getHandle(((ProcessBuilder.RedirectPipeImpl) redirects[2]).getFd()); } else { diff --git a/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java b/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java index 11099f6a8e6..634f578df02 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,7 +64,6 @@ import javax.swing.JComponent; import sun.awt.AWTAccessor; import sun.awt.AWTAccessor.ComponentAccessor; -import sun.awt.AppContext; import sun.awt.CGraphicsDevice; import sun.awt.DisplayChangedListener; import sun.awt.ExtendedKeyCodes; @@ -1236,9 +1235,7 @@ public class LWWindowPeer return false; } - AppContext targetAppContext = AWTAccessor.getComponentAccessor().getAppContext(getTarget()); - KeyboardFocusManager kfm = AWTAccessor.getKeyboardFocusManagerAccessor() - .getCurrentKeyboardFocusManager(targetAppContext); + KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Window currentActive = kfm.getActiveWindow(); diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java index 4947d1a109e..494995735e6 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1030,13 +1030,19 @@ final class CAccessibility implements PropertyChangeListener { } if (!allowIgnored) { - final AccessibleRole role = context.getAccessibleRole(); - if (role != null && ignoredRoles != null && ignoredRoles.contains(roleKey(role))) { - // Get the child's unignored children. - _addChildren(child, whichChildren, false, childrenAndRoles, ChildrenOperations.COMMON); - } else { - childrenAndRoles.add(child); - childrenAndRoles.add(getAccessibleRole(child)); + // If a Component isn't showing then it should be classified as + // "ignored", and we should skip it and its descendants + if (isShowing(context)) { + final AccessibleRole role = context.getAccessibleRole(); + if (role != null && ignoredRoles != null && + ignoredRoles.contains(roleKey(role))) { + // Get the child's unignored children. + _addChildren(child, whichChildren, false, + childrenAndRoles, ChildrenOperations.COMMON); + } else { + childrenAndRoles.add(child); + childrenAndRoles.add(getAccessibleRole(child)); + } } } else { childrenAndRoles.add(child); @@ -1050,6 +1056,46 @@ final class CAccessibility implements PropertyChangeListener { } } + /** + * Return false if an AccessibleContext is not showing + *

+ * This first checks {@link AccessibleComponent#isShowing()}, if possible. + * If there is no AccessibleComponent then this checks the + * AccessibleStateSet for {@link AccessibleState#SHOWING}. If there is no + * AccessibleStateSet then we assume (given the lack of information) the + * AccessibleContext may be visible, and we recursive check its parent if + * possible. + * + * Return false if an AccessibleContext is not showing + */ + private static boolean isShowing(final AccessibleContext context) { + AccessibleComponent c = context.getAccessibleComponent(); + if (c != null) { + return c.isShowing(); + } + + AccessibleStateSet ass = context.getAccessibleStateSet(); + if (ass != null && ass.contains((AccessibleState.SHOWING))) { + return true; + } else { + // We don't have an AccessibleComponent. And either we don't + // have an AccessibleStateSet OR it doesn't include useful + // info to determine visibility/showing. So our status is + // unknown. When in doubt: assume we're showing and ask our + // parent if it is visible/showing. + } + + Accessible parent = context.getAccessibleParent(); + if (parent == null) { + return true; + } + AccessibleContext parentContext = parent.getAccessibleContext(); + if (parentContext == null) { + return true; + } + return isShowing(parentContext); + } + private static native String roleKey(AccessibleRole aRole); public static Object[] getChildren(final Accessible a, final Component c) { diff --git a/src/java.desktop/share/classes/java/awt/Component.java b/src/java.desktop/share/classes/java/awt/Component.java index e48255aaf00..7f021dcdb85 100644 --- a/src/java.desktop/share/classes/java/awt/Component.java +++ b/src/java.desktop/share/classes/java/awt/Component.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -7938,7 +7938,7 @@ public abstract class Component implements ImageObserver, MenuContainer, (this, temporary, focusedWindowChangeAllowed, time, cause); if (!success) { KeyboardFocusManager.getCurrentKeyboardFocusManager - (appContext).dequeueKeyEvents(time, this); + ().dequeueKeyEvents(time, this); if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("Peer request failed"); } diff --git a/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java b/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java index 8ee336548d2..cf3c849829f 100644 --- a/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java +++ b/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,6 @@ import java.util.ListIterator; import java.util.Set; import sun.awt.AWTAccessor; -import sun.awt.AppContext; import sun.awt.SunToolkit; import sun.awt.TimedWindowEvent; import sun.util.logging.PlatformLogger; @@ -231,9 +230,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { @Serial private static final long serialVersionUID = -2924743257508701758L; - public DefaultKeyboardFocusManagerSentEvent(AWTEvent nested, - AppContext toNotify) { - super(nested, toNotify); + public DefaultKeyboardFocusManagerSentEvent(AWTEvent nested) { + super(nested); } public final void dispatch() { KeyboardFocusManager manager = @@ -260,76 +258,12 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { } /** - * Sends a synthetic AWTEvent to a Component. If the Component is in - * the current AppContext, then the event is immediately dispatched. - * If the Component is in a different AppContext, then the event is - * posted to the other AppContext's EventQueue, and this method blocks - * until the event is handled or target AppContext is disposed. - * Returns true if successfully dispatched event, false if failed - * to dispatch. + * Sends a synthetic AWTEvent to a Component. */ static boolean sendMessage(Component target, AWTEvent e) { e.isPosted = true; - AppContext myAppContext = AppContext.getAppContext(); - final AppContext targetAppContext = target.appContext; - final SentEvent se = - new DefaultKeyboardFocusManagerSentEvent(e, myAppContext); - - if (myAppContext == targetAppContext) { - se.dispatch(); - } else { - if (targetAppContext.isDisposed()) { - return false; - } - SunToolkit.postEvent(targetAppContext, se); - if (EventQueue.isDispatchThread()) { - if (Thread.currentThread() instanceof EventDispatchThread) { - EventDispatchThread edt = (EventDispatchThread) - Thread.currentThread(); - edt.pumpEvents(SentEvent.ID, new Conditional() { - public boolean evaluate() { - return !se.dispatched && !targetAppContext.isDisposed(); - } - }); - } else { - if (fxAppThreadIsDispatchThread) { - Thread fxCheckDispatchThread = new Thread() { - @Override - public void run() { - while (!se.dispatched && !targetAppContext.isDisposed()) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - break; - } - } - } - }; - fxCheckDispatchThread.start(); - try { - // check if event is dispatched or disposed - // but since this user app thread is same as - // dispatch thread in fx when run with - // javafx.embed.singleThread=true - // we do not wait infinitely to avoid deadlock - // as dispatch will ultimately be done by this thread - fxCheckDispatchThread.join(500); - } catch (InterruptedException ex) { - } - } - } - } else { - synchronized (se) { - while (!se.dispatched && !targetAppContext.isDisposed()) { - try { - se.wait(1000); - } catch (InterruptedException ie) { - break; - } - } - } - } - } + final SentEvent se = new DefaultKeyboardFocusManagerSentEvent(e); + se.dispatch(); return se.dispatched; } @@ -356,7 +290,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { // Check that the component awaiting focus belongs to // the current focused window. See 8015454. if (toplevel != null && toplevel.isFocused()) { - SunToolkit.postEvent(AppContext.getAppContext(), new SequencedEvent(e)); + SunToolkit.postEvent(new SequencedEvent(e)); return true; } } diff --git a/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java b/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java index 348d0772cf4..06932d33f8a 100644 --- a/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java +++ b/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,6 @@ import java.util.WeakHashMap; import sun.util.logging.PlatformLogger; -import sun.awt.AppContext; import sun.awt.SunToolkit; import sun.awt.KeyboardFocusManagerPeerProvider; import sun.awt.AWTAccessor; @@ -127,9 +126,6 @@ public abstract class KeyboardFocusManager public void setMostRecentFocusOwner(Window window, Component component) { KeyboardFocusManager.setMostRecentFocusOwner(window, component); } - public KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx) { - return KeyboardFocusManager.getCurrentKeyboardFocusManager(ctx); - } public Container getCurrentFocusCycleRoot() { return KeyboardFocusManager.currentFocusCycleRoot; } @@ -183,53 +179,40 @@ public abstract class KeyboardFocusManager static final int TRAVERSAL_KEY_LENGTH = DOWN_CYCLE_TRAVERSAL_KEYS + 1; + private static KeyboardFocusManager manager; + /** - * Returns the current KeyboardFocusManager instance for the calling - * thread's context. + * Returns the current KeyboardFocusManager instance * - * @return this thread's context's KeyboardFocusManager + * @return the current KeyboardFocusManager * @see #setCurrentKeyboardFocusManager */ - public static KeyboardFocusManager getCurrentKeyboardFocusManager() { - return getCurrentKeyboardFocusManager(AppContext.getAppContext()); - } - - static synchronized KeyboardFocusManager - getCurrentKeyboardFocusManager(AppContext appcontext) - { - KeyboardFocusManager manager = (KeyboardFocusManager) - appcontext.get(KeyboardFocusManager.class); + public static synchronized KeyboardFocusManager getCurrentKeyboardFocusManager() { if (manager == null) { manager = new DefaultKeyboardFocusManager(); - appcontext.put(KeyboardFocusManager.class, manager); } return manager; } /** - * Sets the current KeyboardFocusManager instance for the calling thread's - * context. If null is specified, then the current KeyboardFocusManager + * Sets the current KeyboardFocusManager instance. + * If null is specified, then the current KeyboardFocusManager * is replaced with a new instance of DefaultKeyboardFocusManager. * - * @param newManager the new KeyboardFocusManager for this thread's context + * @param newManager the new KeyboardFocusManager * @see #getCurrentKeyboardFocusManager * @see DefaultKeyboardFocusManager */ public static void setCurrentKeyboardFocusManager(KeyboardFocusManager newManager) { - KeyboardFocusManager oldManager = null; + KeyboardFocusManager oldManager = manager; + + if (newManager == null) { + newManager = new DefaultKeyboardFocusManager(); + } synchronized (KeyboardFocusManager.class) { - AppContext appcontext = AppContext.getAppContext(); - - if (newManager != null) { - oldManager = getCurrentKeyboardFocusManager(appcontext); - - appcontext.put(KeyboardFocusManager.class, newManager); - } else { - oldManager = getCurrentKeyboardFocusManager(appcontext); - appcontext.remove(KeyboardFocusManager.class); - } + manager = newManager; } if (oldManager != null) { @@ -344,7 +327,7 @@ public abstract class KeyboardFocusManager private static java.util.Map> mostRecentFocusOwners = new WeakHashMap<>(); /* - * SequencedEvent which is currently dispatched in AppContext. + * SequencedEvent which is currently dispatched. */ transient SequencedEvent currentSequencedEvent = null; @@ -431,13 +414,7 @@ public abstract class KeyboardFocusManager */ public Component getFocusOwner() { synchronized (KeyboardFocusManager.class) { - if (focusOwner == null) { - return null; - } - - return (focusOwner.appContext == AppContext.getAppContext()) - ? focusOwner - : null; + return focusOwner; } } @@ -599,42 +576,32 @@ public abstract class KeyboardFocusManager } /** - * Returns the permanent focus owner, if the permanent focus owner is in - * the same context as the calling thread. The permanent focus owner is + * Returns the permanent focus owner. The permanent focus owner is * defined as the last Component in an application to receive a permanent * FOCUS_GAINED event. The focus owner and permanent focus owner are * equivalent unless a temporary focus change is currently in effect. In * such a situation, the permanent focus owner will again be the focus * owner when the temporary focus change ends. * - * @return the permanent focus owner, or null if the permanent focus owner - * is not a member of the calling thread's context + * @return the permanent focus owner, or null if there is none * @see #getGlobalPermanentFocusOwner * @see #setGlobalPermanentFocusOwner */ public Component getPermanentFocusOwner() { synchronized (KeyboardFocusManager.class) { - if (permanentFocusOwner == null) { - return null; - } - - return (permanentFocusOwner.appContext == - AppContext.getAppContext()) - ? permanentFocusOwner - : null; + return permanentFocusOwner; } } /** - * Returns the permanent focus owner, even if the calling thread is in a - * different context than the permanent focus owner. The permanent focus + * Returns the permanent focus owner. The permanent focus * owner is defined as the last Component in an application to receive a * permanent FOCUS_GAINED event. The focus owner and permanent focus owner * are equivalent unless a temporary focus change is currently in effect. * In such a situation, the permanent focus owner will again be the focus * owner when the temporary focus change ends. * - * @return the permanent focus owner + * @return the permanent focus owner, or null if there is none * @see #getPermanentFocusOwner * @see #setGlobalPermanentFocusOwner */ @@ -701,24 +668,16 @@ public abstract class KeyboardFocusManager } /** - * Returns the focused Window, if the focused Window is in the same context - * as the calling thread. The focused Window is the Window that is or - * contains the focus owner. + * Returns the focused Window. + * The focused Window is the Window that is or contains the focus owner. * - * @return the focused Window, or null if the focused Window is not a - * member of the calling thread's context + * @return the focused Window, or null if there is none * @see #getGlobalFocusedWindow * @see #setGlobalFocusedWindow */ public Window getFocusedWindow() { synchronized (KeyboardFocusManager.class) { - if (focusedWindow == null) { - return null; - } - - return (focusedWindow.appContext == AppContext.getAppContext()) - ? focusedWindow - : null; + return focusedWindow; } } @@ -785,27 +744,19 @@ public abstract class KeyboardFocusManager } /** - * Returns the active Window, if the active Window is in the same context - * as the calling thread. Only a Frame or a Dialog can be the active + * Returns the active Window. Only a Frame or a Dialog can be the active * Window. The native windowing system may denote the active Window or its * children with special decorations, such as a highlighted title bar. * The active Window is always either the focused Window, or the first * Frame or Dialog that is an owner of the focused Window. * - * @return the active Window, or null if the active Window is not a member - * of the calling thread's context + * @return the active Window, or null if there is none * @see #getGlobalActiveWindow * @see #setGlobalActiveWindow */ public Window getActiveWindow() { synchronized (KeyboardFocusManager.class) { - if (activeWindow == null) { - return null; - } - - return (activeWindow.appContext == AppContext.getAppContext()) - ? activeWindow - : null; + return activeWindow; } } @@ -1100,14 +1051,7 @@ public abstract class KeyboardFocusManager */ public Container getCurrentFocusCycleRoot() { synchronized (KeyboardFocusManager.class) { - if (currentFocusCycleRoot == null) { - return null; - } - - return (currentFocusCycleRoot.appContext == - AppContext.getAppContext()) - ? currentFocusCycleRoot - : null; + return currentFocusCycleRoot; } } @@ -2159,7 +2103,7 @@ public abstract class KeyboardFocusManager descendant = heavyweight; } - KeyboardFocusManager manager = getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(descendant)); + KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); FocusEvent currentFocusOwnerEvent = null; FocusEvent newFocusOwnerEvent = null; @@ -2268,8 +2212,7 @@ public abstract class KeyboardFocusManager descendant = heavyweight; } - KeyboardFocusManager manager = - getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(descendant)); + KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); KeyboardFocusManager thisManager = getCurrentKeyboardFocusManager(); Component currentFocusOwner = thisManager.getGlobalFocusOwner(); Component nativeFocusOwner = thisManager.getNativeFocusOwner(); @@ -2484,16 +2427,6 @@ public abstract class KeyboardFocusManager KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); LinkedList localLightweightRequests = null; - Component globalFocusOwner = manager.getGlobalFocusOwner(); - if ((globalFocusOwner != null) && - (globalFocusOwner.appContext != AppContext.getAppContext())) - { - // The current app context differs from the app context of a focus - // owner (and all pending lightweight requests), so we do nothing - // now and wait for a next event. - return; - } - synchronized(heavyweightRequests) { if (currentLightweightRequests != null) { clearingCurrentLightweightRequests = true; diff --git a/src/java.desktop/share/classes/java/awt/SystemTray.java b/src/java.desktop/share/classes/java/awt/SystemTray.java index bf1871765eb..c873d849213 100644 --- a/src/java.desktop/share/classes/java/awt/SystemTray.java +++ b/src/java.desktop/share/classes/java/awt/SystemTray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,6 @@ import java.beans.PropertyChangeSupport; import java.util.Vector; import sun.awt.AWTAccessor; -import sun.awt.AppContext; import sun.awt.HeadlessToolkit; import sun.awt.SunToolkit; @@ -213,6 +212,8 @@ public class SystemTray { } } + private Vector icons; + /** * Adds a {@code TrayIcon} to the {@code SystemTray}. * The tray icon becomes visible in the system tray once it is @@ -240,15 +241,10 @@ public class SystemTray { } TrayIcon[] oldArray; TrayIcon[] newArray; - Vector icons; synchronized (this) { oldArray = systemTray.getTrayIcons(); - @SuppressWarnings("unchecked") - Vector tmp = (Vector)AppContext.getAppContext().get(TrayIcon.class); - icons = tmp; if (icons == null) { icons = new Vector<>(3); - AppContext.getAppContext().put(TrayIcon.class, icons); } else if (icons.contains(trayIcon)) { throw new IllegalArgumentException("adding TrayIcon that is already added"); @@ -291,8 +287,6 @@ public class SystemTray { TrayIcon[] newArray; synchronized (this) { oldArray = systemTray.getTrayIcons(); - @SuppressWarnings("unchecked") - Vector icons = (Vector)AppContext.getAppContext().get(TrayIcon.class); // TrayIcon with no peer is not contained in the array. if (icons == null || !icons.remove(trayIcon)) { return; @@ -320,12 +314,12 @@ public class SystemTray { * @see TrayIcon */ public TrayIcon[] getTrayIcons() { - @SuppressWarnings("unchecked") - Vector icons = (Vector)AppContext.getAppContext().get(TrayIcon.class); - if (icons != null) { - return icons.toArray(EMPTY_TRAY_ARRAY); + synchronized (this) { + if (icons != null) { + return icons.toArray(EMPTY_TRAY_ARRAY); + } + return EMPTY_TRAY_ARRAY; } - return EMPTY_TRAY_ARRAY; } /** @@ -374,8 +368,6 @@ public class SystemTray { * * *

- * The {@code listener} listens to property changes only in this context. - *

* If {@code listener} is {@code null}, no exception is thrown * and no action is performed. * @@ -398,8 +390,6 @@ public class SystemTray { * Removes a {@code PropertyChangeListener} from the listener list * for a specific property. *

- * The {@code PropertyChangeListener} must be from this context. - *

* If {@code propertyName} or {@code listener} is {@code null} or invalid, * no exception is thrown and no action is taken. * @@ -421,8 +411,6 @@ public class SystemTray { /** * Returns an array of all the listeners that have been associated * with the named property. - *

- * Only the listeners in this context are returned. * * @param propertyName the specified property * @return all of the {@code PropertyChangeListener}s associated with @@ -461,19 +449,16 @@ public class SystemTray { getCurrentChangeSupport().firePropertyChange(propertyName, oldValue, newValue); } + private PropertyChangeSupport changeSupport; + /** - * Returns the current PropertyChangeSupport instance for the - * calling thread's context. + * Returns the current PropertyChangeSupport instance * - * @return this thread's context's PropertyChangeSupport + * @return the current PropertyChangeSupport for this {@code SystemTray} */ private synchronized PropertyChangeSupport getCurrentChangeSupport() { - PropertyChangeSupport changeSupport = - (PropertyChangeSupport)AppContext.getAppContext().get(SystemTray.class); - if (changeSupport == null) { changeSupport = new PropertyChangeSupport(this); - AppContext.getAppContext().put(SystemTray.class, changeSupport); } return changeSupport; } diff --git a/src/java.desktop/share/classes/java/awt/TrayIcon.java b/src/java.desktop/share/classes/java/awt/TrayIcon.java index b53174ef05e..c72c018867c 100644 --- a/src/java.desktop/share/classes/java/awt/TrayIcon.java +++ b/src/java.desktop/share/classes/java/awt/TrayIcon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ package java.awt; import java.awt.event.*; import java.awt.peer.TrayIconPeer; -import sun.awt.AppContext; import sun.awt.SunToolkit; import sun.awt.AWTAccessor; import sun.awt.HeadlessToolkit; @@ -126,7 +125,7 @@ public class TrayIcon { if (!SystemTray.isSupported()) { throw new UnsupportedOperationException(); } - SunToolkit.insertTargetMapping(this, AppContext.getAppContext()); + SunToolkit.insertTargetMapping(this); } /** diff --git a/src/java.desktop/share/classes/java/awt/geom/Arc2D.java b/src/java.desktop/share/classes/java/awt/geom/Arc2D.java index 6646a14537e..7402dc98691 100644 --- a/src/java.desktop/share/classes/java/awt/geom/Arc2D.java +++ b/src/java.desktop/share/classes/java/awt/geom/Arc2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ package java.awt.geom; +import java.awt.Rectangle; import java.io.IOException; import java.io.Serial; import java.io.Serializable; @@ -1052,19 +1053,7 @@ public abstract class Arc2D extends RectangularShape { } /** - * Returns the high-precision framing rectangle of the arc. The framing - * rectangle contains only the part of this {@code Arc2D} that is - * in between the starting and ending angles and contains the pie - * wedge, if this {@code Arc2D} has a {@code PIE} closure type. - *

- * This method differs from the - * {@link RectangularShape#getBounds() getBounds} in that the - * {@code getBounds} method only returns the bounds of the - * enclosing ellipse of this {@code Arc2D} without considering - * the starting and ending angles of this {@code Arc2D}. - * - * @return the {@code Rectangle2D} that represents the arc's - * framing rectangle. + * {@inheritDoc java.awt.Shape} * @since 1.2 */ public Rectangle2D getBounds2D() { @@ -1110,6 +1099,15 @@ public abstract class Arc2D extends RectangularShape { return makeBounds(x1, y1, x2, y2); } + /** + * {@inheritDoc java.awt.Shape} + * @since 1.2 + */ + @Override + public Rectangle getBounds() { + return getBounds2D().getBounds(); + } + /** * Constructs a {@code Rectangle2D} of the appropriate precision * to hold the parameters calculated to be the framing rectangle diff --git a/src/java.desktop/share/classes/javax/swing/MenuSelectionManager.java b/src/java.desktop/share/classes/javax/swing/MenuSelectionManager.java index c84a218b877..ba80fc3bc95 100644 --- a/src/java.desktop/share/classes/javax/swing/MenuSelectionManager.java +++ b/src/java.desktop/share/classes/javax/swing/MenuSelectionManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ import java.util.*; import java.awt.event.*; import javax.swing.event.*; -import sun.awt.AppContext; import sun.awt.AWTAccessor; import sun.awt.AWTAccessor.MouseEventAccessor; import sun.swing.SwingUtilities2; @@ -48,8 +47,7 @@ public class MenuSelectionManager { private static final boolean VERBOSE = false; // show reuse hits/misses private static final boolean DEBUG = false; // show bad params, misc. - private static final StringBuilder MENU_SELECTION_MANAGER_KEY = - new StringBuilder("javax.swing.MenuSelectionManager"); + private static final MenuSelectionManager DEFAULT_MSM = new MenuSelectionManager(); /** * Constructs a {@code MenuSelectionManager}. @@ -62,23 +60,7 @@ public class MenuSelectionManager { * @return a MenuSelectionManager object */ public static MenuSelectionManager defaultManager() { - synchronized (MENU_SELECTION_MANAGER_KEY) { - AppContext context = AppContext.getAppContext(); - MenuSelectionManager msm = (MenuSelectionManager)context.get( - MENU_SELECTION_MANAGER_KEY); - if (msm == null) { - msm = new MenuSelectionManager(); - context.put(MENU_SELECTION_MANAGER_KEY, msm); - - // installing additional listener if found in the AppContext - Object o = context.get(SwingUtilities2.MENU_SELECTION_MANAGER_LISTENER_KEY); - if (o instanceof ChangeListener listener) { - msm.addChangeListener(listener); - } - } - - return msm; - } + return DEFAULT_MSM; } /** diff --git a/src/java.desktop/share/classes/sun/awt/AWTAccessor.java b/src/java.desktop/share/classes/sun/awt/AWTAccessor.java index 22df71f564d..3c63a390a81 100644 --- a/src/java.desktop/share/classes/sun/awt/AWTAccessor.java +++ b/src/java.desktop/share/classes/sun/awt/AWTAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -441,11 +441,6 @@ public final class AWTAccessor { */ void setMostRecentFocusOwner(Window window, Component component); - /** - * Returns current KFM of the specified AppContext. - */ - KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx); - /** * Return the current focus cycle root */ diff --git a/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java b/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java index 8310b7cb604..ab2ad5dfbf0 100644 --- a/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java +++ b/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -218,7 +218,7 @@ public abstract class EmbeddedFrame extends Frame */ public boolean dispatchKeyEvent(KeyEvent e) { - Container currentRoot = AWTAccessor.getKeyboardFocusManagerAccessor() + Container currentRoot = KeyboardFocusManager.getCurrentKeyboardFocusManager() .getCurrentFocusCycleRoot(); // if we are not in EmbeddedFrame's cycle, we should not try to leave. diff --git a/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/src/java.desktop/share/classes/sun/awt/SunToolkit.java index 9b2f756fd56..7429656eb30 100644 --- a/src/java.desktop/share/classes/sun/awt/SunToolkit.java +++ b/src/java.desktop/share/classes/sun/awt/SunToolkit.java @@ -414,6 +414,11 @@ public abstract class SunToolkit extends Toolkit cont.setFocusTraversalPolicy(defaultPolicy); } + /* This method should be removed at the same time as targetToAppContext() */ + public static void insertTargetMapping(Object target) { + insertTargetMapping(target, AppContext.getAppContext()); + } + /* * Insert a mapping from target to AppContext, for later retrieval * via targetToAppContext() above. diff --git a/src/java.desktop/share/classes/sun/awt/datatransfer/DataTransferer.java b/src/java.desktop/share/classes/sun/awt/datatransfer/DataTransferer.java index 6c03fa83369..9f247ed7fbd 100644 --- a/src/java.desktop/share/classes/sun/awt/datatransfer/DataTransferer.java +++ b/src/java.desktop/share/classes/sun/awt/datatransfer/DataTransferer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,7 +87,6 @@ import javax.imageio.spi.ImageWriterSpi; import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageOutputStream; -import sun.awt.AppContext; import sun.awt.ComponentFactory; import sun.awt.SunToolkit; import sun.awt.image.ImageRepresentation; @@ -154,9 +153,9 @@ public abstract class DataTransferer { Collections.synchronizedMap(new HashMap<>()); /** - * The key used to store pending data conversion requests for an AppContext. + * The Runnable for pending data conversion requests. */ - private static final String DATA_CONVERTER_KEY = "DATA_CONVERTER_KEY"; + private static volatile Runnable dataConverterInstance; static { DataFlavor tJavaTextEncodingFlavor = null; @@ -1769,13 +1768,9 @@ search: } }; - final AppContext appContext = SunToolkit.targetToAppContext(source); - getToolkitThreadBlockedHandler().lock(); - if (appContext != null) { - appContext.put(DATA_CONVERTER_KEY, dataConverter); - } + dataConverterInstance = dataConverter; SunToolkit.executeOnEventHandlerThread(source, dataConverter); @@ -1783,9 +1778,7 @@ search: getToolkitThreadBlockedHandler().enter(); } - if (appContext != null) { - appContext.remove(DATA_CONVERTER_KEY); - } + dataConverterInstance = null; ret = stack.pop(); } finally { @@ -1802,14 +1795,12 @@ search: public void processDataConversionRequests() { if (EventQueue.isDispatchThread()) { - AppContext appContext = AppContext.getAppContext(); getToolkitThreadBlockedHandler().lock(); try { - Runnable dataConverter = - (Runnable)appContext.get(DATA_CONVERTER_KEY); + Runnable dataConverter = dataConverterInstance; if (dataConverter != null) { dataConverter.run(); - appContext.remove(DATA_CONVERTER_KEY); + dataConverterInstance = null; } } finally { getToolkitThreadBlockedHandler().unlock(); diff --git a/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java b/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java index faf31e0b426..58a0f28bb02 100644 --- a/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java +++ b/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java @@ -121,9 +121,6 @@ import static java.awt.geom.AffineTransform.TYPE_TRANSLATION; */ public class SwingUtilities2 { - public static final Object MENU_SELECTION_MANAGER_LISTENER_KEY = - new StringBuffer("MenuSelectionManager listener key"); - // Maintain a cache of CACHE_SIZE fonts and the left side bearing // of the characters falling into the range MIN_CHAR_INDEX to // MAX_CHAR_INDEX. The values in fontCache are created as needed. diff --git a/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslOutputStream.java b/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslOutputStream.java index 30d64fc8611..8787df8c498 100644 --- a/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslOutputStream.java +++ b/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,9 +35,10 @@ import java.io.OutputStream; class SaslOutputStream extends FilterOutputStream { private static final boolean debug = false; - private byte[] lenBuf = new byte[4]; // buffer for storing length + private final byte[] lenBuf = new byte[4]; // buffer for storing length private int rawSendSize = 65536; - private SaslClient sc; + private final SaslClient sc; + private boolean closed; SaslOutputStream(SaslClient sc, OutputStream out) throws SaslException { super(out); @@ -60,8 +61,9 @@ class SaslOutputStream extends FilterOutputStream { // Override this method to call write(byte[], int, int) counterpart // super.write(int) simply calls out.write(int) - + @Override public void write(int b) throws IOException { + ensureOpen(); byte[] buffer = new byte[1]; buffer[0] = (byte)b; write(buffer, 0, 1); @@ -71,7 +73,9 @@ class SaslOutputStream extends FilterOutputStream { * Override this method to "wrap" the outgoing buffer before * writing it to the underlying output stream. */ + @Override public void write(byte[] buffer, int offset, int total) throws IOException { + ensureOpen(); int count; byte[] wrappedToken; @@ -101,7 +105,12 @@ class SaslOutputStream extends FilterOutputStream { } } + @Override public void close() throws IOException { + if (closed) { + return; + } + closed = true; SaslException save = null; try { sc.dispose(); // Dispose of SaslClient's state @@ -121,8 +130,7 @@ class SaslOutputStream extends FilterOutputStream { * Encodes an integer into 4 bytes in network byte order in the buffer * supplied. */ - private static void intToNetworkByteOrder(int num, byte[] buf, int start, - int count) { + private static void intToNetworkByteOrder(int num, byte[] buf, int start, int count) { if (count > 4) { throw new IllegalArgumentException("Cannot handle more than 4 bytes"); } @@ -132,4 +140,10 @@ class SaslOutputStream extends FilterOutputStream { num >>>= 8; } } + + private void ensureOpen() throws IOException { + if (closed) { + throw new IOException("stream closed"); + } + } } diff --git a/src/java.naming/share/classes/javax/naming/InitialContext.java b/src/java.naming/share/classes/javax/naming/InitialContext.java index f2ab1676f4e..a66e843e641 100644 --- a/src/java.naming/share/classes/javax/naming/InitialContext.java +++ b/src/java.naming/share/classes/javax/naming/InitialContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,7 +117,7 @@ import com.sun.naming.internal.ResourceManager; * @see Context * @see NamingManager#setInitialContextFactoryBuilder * NamingManager.setInitialContextFactoryBuilder - * @since 1.3, JNDI 1.1 + * @since 1.3 */ public class InitialContext implements Context { diff --git a/src/java.net.http/share/classes/java/net/http/package-info.java b/src/java.net.http/share/classes/java/net/http/package-info.java index 1b8395c2706..ce954404c81 100644 --- a/src/java.net.http/share/classes/java/net/http/package-info.java +++ b/src/java.net.http/share/classes/java/net/http/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,6 +68,8 @@ *

Unless otherwise stated, {@code null} parameter values will cause methods * of all classes in this package to throw {@code NullPointerException}. * + * @see java.net.http/ + * * @spec https://www.rfc-editor.org/info/rfc9114 * RFC 9114: HTTP/3 * @spec https://www.rfc-editor.org/info/rfc7540 diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java index 72a47eca42c..006c4b30bea 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -473,11 +473,10 @@ class Http1Exchange extends ExchangeImpl { @Override Http1ResponseBodySubscriber createResponseSubscriber(BodyHandler handler, ResponseInfo response) { - BodySubscriber subscriber = handler.apply(response); var cancelTimerOnTermination = cancelTimerOnResponseBodySubscriberTermination( exchange.request().isWebSocket(), response.statusCode()); - return new Http1ResponseBodySubscriber<>(subscriber, cancelTimerOnTermination, this); + return new Http1ResponseBodySubscriber<>(handler.apply(response), cancelTimerOnTermination, this); } @Override diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java index 671874b8fb5..670b8cf3c25 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -384,6 +384,7 @@ class MultiExchange implements Cancelable { private CompletableFuture> handleNoBody(Response r, Exchange exch) { BodySubscriber bs = responseHandler.apply(new ResponseInfoImpl(r.statusCode(), r.headers(), r.version())); + Objects.requireNonNull(bs, "BodyHandler returned a null BodySubscriber"); bs.onSubscribe(new NullSubscription()); bs.onComplete(); CompletionStage cs = ResponseSubscribers.getBodyAsync(executor, bs); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java index f1c1f6f2d2a..86a93f67dcd 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -70,6 +70,7 @@ public class HttpBodySubscriberWrapper implements TrustedSubscriber { volatile SubscriptionWrapper subscription; volatile Throwable withError; public HttpBodySubscriberWrapper(BodySubscriber userSubscriber) { + Objects.requireNonNull(userSubscriber, "BodySubscriber"); this.userSubscriber = userSubscriber; } diff --git a/src/java.net.http/share/classes/module-info.java b/src/java.net.http/share/classes/module-info.java index 48f23953ad0..fdfd1bf7e0d 100644 --- a/src/java.net.http/share/classes/module-info.java +++ b/src/java.net.http/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ */ /** - * Defines the HTTP Client and WebSocket APIs. + * Defines the {@linkplain java.net.http HTTP Client and WebSocket APIs}. *

* System properties used by the java.net.http API *

@@ -144,15 +144,21 @@ * The value for HTTP/2 and HTTP/3 can be overridden with the * {@code jdk.httpclient.keepalive.timeout.h2} and {@code jdk.httpclient.keepalive.timeout.h3} * properties respectively. The value specified for HTTP/2 acts as default value for HTTP/3. + * If the provided value is negative, the default value is used. + * A value of 0 is valid and has no special meaning other than the connection is closed + * when it becomes idle. * *

  • {@systemProperty jdk.httpclient.keepalive.timeout.h2} (default: see - * below)
    The number of seconds to keep idle HTTP/2 connections alive. If not set, then the - * {@code jdk.httpclient.keepalive.timeout} setting is used. + * below)
    The number of seconds to keep idle HTTP/2 connections alive. If not set, or negative, + * then the {@code jdk.httpclient.keepalive.timeout} setting is used. + * A value of 0 is valid and has no special meaning other than the connection is closed + * when it becomes idle. *

  • *
  • {@systemProperty jdk.httpclient.keepalive.timeout.h3} (default: see - * below)
    The number of seconds to keep idle HTTP/3 connections alive. If not set, then the - * {@code jdk.httpclient.keepalive.timeout.h2} setting is used. - *

  • + * below)
    The number of seconds to keep idle HTTP/3 connections alive. If not set, + * or negative, then the {@code jdk.httpclient.keepalive.timeout.h2} setting is used. + * A value of 0 is valid and has no special meaning other than the connection is closed + * when it becomes idle. *
  • {@systemProperty jdk.httpclient.maxframesize} (default: 16384 or 16kB)
    * The HTTP/2 client maximum frame size in bytes. The server is not permitted to send a frame * larger than this. diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java index af7d79d4195..e8ab1b9349c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -181,17 +181,17 @@ public final class SourceLauncher { ProgramDescriptor program = context.getProgramDescriptor(); // 1. Find a main method in the first class and if there is one - invoke it - Class firstClass; + Class mainClass; String firstClassName = program.qualifiedTypeNames().getFirst(); ClassLoader loader = context.newClassLoaderFor(parentLoader, firstClassName); Thread.currentThread().setContextClassLoader(loader); try { - firstClass = Class.forName(firstClassName, false, loader); + mainClass = Class.forName(firstClassName, false, loader); } catch (ClassNotFoundException e) { throw new Fault(Errors.CantFindClass(firstClassName)); } - Method mainMethod = MethodFinder.findMainMethod(firstClass); + Method mainMethod = MethodFinder.findMainMethod(mainClass); if (mainMethod == null) { // 2. If the first class doesn't have a main method, look for a class with a matching name var compilationUnitName = program.fileObject().getFile().getFileName().toString(); @@ -206,22 +206,18 @@ public final class SourceLauncher { .findFirst() .orElseThrow(() -> new Fault(Errors.CantFindClass(expectedName))); - Class actualClass; try { - actualClass = Class.forName(actualName, false, firstClass.getClassLoader()); + mainClass = Class.forName(actualName, false, mainClass.getClassLoader()); } catch (ClassNotFoundException ignore) { throw new Fault(Errors.CantFindClass(actualName)); } - mainMethod = MethodFinder.findMainMethod(actualClass); + mainMethod = MethodFinder.findMainMethod(mainClass); if (mainMethod == null) { throw new Fault(Errors.CantFindMainMethod(actualName)); } } - // selected main method instance points back to its declaring class - Class mainClass = mainMethod.getDeclaringClass(); String mainClassName = mainClass.getName(); - var isStatic = Modifier.isStatic(mainMethod.getModifiers()); Object instance = null; diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h index 262e99f4a64..62b1b4d0d6b 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h @@ -96,7 +96,7 @@ struct core_data { int classes_jsa_fd; // file descriptor of class share archive uintptr_t dynamic_addr; // address of dynamic section of a.out uintptr_t vdso_addr; // address of vDSO - off64_t vdso_offset; // offset of vDSO in core + off_t vdso_offset; // offset of vDSO in core size_t vdso_size; // size of vDSO uintptr_t ld_base_addr; // base address of ld.so size_t num_maps; // number of maps. diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c index 6a991b18c10..6298f569aaf 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c @@ -635,8 +635,8 @@ static int handle_vdso(struct ps_prochandle* ph, char* lib_name, size_t lib_name lib_fd = -1; } else { lib_fd = fileno(tmpf); - off64_t ofs = ph->core->vdso_offset; - if (sendfile64(lib_fd, ph->core->core_fd, &ofs, ph->core->vdso_size) == -1) { + off_t ofs = ph->core->vdso_offset; + if (sendfile(lib_fd, ph->core->core_fd, &ofs, ph->core->vdso_size) == -1) { print_debug("can't copy vDSO (%d)\n", errno); fclose(tmpf); lib_fd = -1; diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java index fd1a940c0a5..0af59f1d1a7 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -154,9 +154,7 @@ class ChunkedOutputStream extends FilterOutputStream } finally { closed = true; } - - Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent(e); + t.postExchangeFinished(true); } public void flush() throws IOException { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/Event.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/Event.java index 18c2535492b..41ce83596b7 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/Event.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/Event.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,13 +47,15 @@ abstract sealed class Event { } /** - * Event indicating that writing is finished for a given exchange. + * Event indicating that the exchange is finished, + * without having necessarily read the complete + * request or sent the complete response. + * Typically, this event is posted when invoking + * the filter chain throws an exception. */ - static final class WriteFinished extends Event { - WriteFinished(ExchangeImpl t) { + static final class ExchangeFinished extends Event { + ExchangeFinished(ExchangeImpl t) { super(Objects.requireNonNull(t)); - assert !t.writefinished; - t.writefinished = true; } } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java index ad6805938a2..57296842db2 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,10 +32,10 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.lang.System.Logger; import java.lang.System.Logger.Level; -import java.text.*; import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Stream; import com.sun.net.httpserver.*; import static com.sun.net.httpserver.HttpExchange.RSPBODY_EMPTY; @@ -46,7 +46,7 @@ class ExchangeImpl { Headers reqHdrs, rspHdrs; Request req; String method; - boolean writefinished; + private boolean writefinished; URI uri; HttpConnection connection; long reqContentLen; @@ -87,6 +87,19 @@ class ExchangeImpl { HttpPrincipal principal; ServerImpl server; + // Used to control that ServerImpl::endExchange is called + // exactly once for this exchange. ServerImpl::endExchange decrements + // the refcount that was incremented by calling ServerImpl::startExchange + // in this ExchangeImpl constructor. + private final AtomicBoolean ended = new AtomicBoolean(); + + // Used to ensure that the Event.ExchangeFinished is posted only + // once for this exchange. The Event.ExchangeFinished is what will + // eventually cause the ServerImpl::finishedLatch to be triggered, + // once the number of active exchanges reaches 0 and ServerImpl::stop + // has been requested. + private final AtomicBoolean finished = new AtomicBoolean(); + ExchangeImpl( String m, URI u, Request req, long len, HttpConnection connection ) throws IOException { @@ -107,6 +120,55 @@ class ExchangeImpl { server.startExchange(); } + /** + * When true, writefinished indicates that all bytes expected + * by the client have been written to the response body + * outputstream, and that the response body outputstream has + * been closed. When all bytes have also been pulled from + * the request body input stream, this makes it possible to + * reuse the connection for the next request. + */ + synchronized boolean writefinished() { + return writefinished; + } + + /** + * Calls ServerImpl::endExchange if not already called for this + * exchange. ServerImpl::endExchange must be called exactly once + * per exchange, and this method ensures that it is not called + * more than once for this exchange. + * @return the new (or current) value of the exchange count. + */ + int endExchange() { + // only call server.endExchange(); once per exchange + if (ended.compareAndSet(false, true)) { + return server.endExchange(); + } + return server.getExchangeCount(); + } + + /** + * Posts the ExchangeFinished event if not already posted. + * If `writefinished` is true, marks the exchange as {@link + * #writefinished()} so that the connection can be reused. + * @param writefinished whether all bytes expected by the + * client have been writen out to the + * response body output stream. + */ + void postExchangeFinished(boolean writefinished) { + // only post ExchangeFinished once per exchange + if (finished.compareAndSet(false, true)) { + if (writefinished) { + synchronized (this) { + assert this.writefinished == false; + this.writefinished = true; + } + } + Event e = new Event.ExchangeFinished(this); + getHttpContext().getServerImpl().addEvent(e); + } + } + public Headers getRequestHeaders() { return reqHdrs; } @@ -140,7 +202,7 @@ class ExchangeImpl { /* close the underlying connection if, * a) the streams not set up yet, no response can be sent, or * b) if the wrapper output stream is not set up, or - * c) if the close of the input/outpu stream fails + * c) if the close of the input/output stream fails */ try { if (uis_orig == null || uos == null) { @@ -157,6 +219,8 @@ class ExchangeImpl { uos.close(); } catch (IOException e) { connection.close(); + } finally { + postExchangeFinished(false); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java index 95de03d27fa..e9dbd93bb12 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,8 +94,7 @@ class FixedLengthOutputStream extends FilterOutputStream is.close(); } catch (IOException e) {} } - Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent(e); + t.postExchangeFinished(true); } // flush is a pass-through diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java index e8c8d336e03..94fe78b9c64 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -419,7 +419,8 @@ class ServerImpl { // Stopping marking the state as finished if stop is requested, // termination is in progress and exchange count is 0 if (r instanceof Event.StopRequested) { - logger.log(Level.TRACE, "Handling Stop Requested Event"); + logger.log(Level.TRACE, "Handling {0} event", + r.getClass().getSimpleName()); // checking if terminating is set to true final boolean terminatingCopy = terminating; @@ -437,10 +438,11 @@ class ServerImpl { HttpConnection c = t.getConnection(); try { - if (r instanceof Event.WriteFinished) { + if (r instanceof Event.ExchangeFinished) { - logger.log(Level.TRACE, "Write Finished"); - int exchanges = endExchange(); + logger.log(Level.TRACE, "Handling {0} event", + r.getClass().getSimpleName()); + int exchanges = t.endExchange(); if (terminating && exchanges == 0 && reqConnections.isEmpty()) { finishedLatch.countDown(); } @@ -842,68 +844,77 @@ class ServerImpl { tx = new ExchangeImpl( method, uri, req, clen, connection ); - String chdr = headers.getFirst("Connection"); - Headers rheaders = tx.getResponseHeaders(); + try { - if (chdr != null && chdr.equalsIgnoreCase("close")) { - tx.close = true; - } - if (version.equalsIgnoreCase("http/1.0")) { - tx.http10 = true; - if (chdr == null) { + String chdr = headers.getFirst("Connection"); + Headers rheaders = tx.getResponseHeaders(); + + if (chdr != null && chdr.equalsIgnoreCase("close")) { tx.close = true; - rheaders.set("Connection", "close"); - } else if (chdr.equalsIgnoreCase("keep-alive")) { - rheaders.set("Connection", "keep-alive"); - int idleSeconds = (int) (ServerConfig.getIdleIntervalMillis() / 1000); - String val = "timeout=" + idleSeconds; - rheaders.set("Keep-Alive", val); } - } + if (version.equalsIgnoreCase("http/1.0")) { + tx.http10 = true; + if (chdr == null) { + tx.close = true; + rheaders.set("Connection", "close"); + } else if (chdr.equalsIgnoreCase("keep-alive")) { + rheaders.set("Connection", "keep-alive"); + int idleSeconds = (int) (ServerConfig.getIdleIntervalMillis() / 1000); + String val = "timeout=" + idleSeconds; + rheaders.set("Keep-Alive", val); + } + } - if (newconnection) { - connection.setParameters( - rawin, rawout, chan, engine, sslStreams, - sslContext, protocol, ctx, rawin - ); - } - /* check if client sent an Expect 100 Continue. - * In that case, need to send an interim response. - * In future API may be modified to allow app to - * be involved in this process. - */ - String exp = headers.getFirst("Expect"); - if (exp != null && exp.equalsIgnoreCase("100-continue")) { - logReply(100, requestLine, null); - sendReply( - Code.HTTP_CONTINUE, false, null - ); - } - /* uf is the list of filters seen/set by the user. - * sf is the list of filters established internally - * and which are not visible to the user. uc and sc - * are the corresponding Filter.Chains. - * They are linked together by a LinkHandler - * so that they can both be invoked in one call. - */ - final List sf = ctx.getSystemFilters(); - final List uf = ctx.getFilters(); + if (newconnection) { + connection.setParameters( + rawin, rawout, chan, engine, sslStreams, + sslContext, protocol, ctx, rawin + ); + } + /* check if client sent an Expect 100 Continue. + * In that case, need to send an interim response. + * In future API may be modified to allow app to + * be involved in this process. + */ + String exp = headers.getFirst("Expect"); + if (exp != null && exp.equalsIgnoreCase("100-continue")) { + logReply(100, requestLine, null); + sendReply( + Code.HTTP_CONTINUE, false, null + ); + } + /* uf is the list of filters seen/set by the user. + * sf is the list of filters established internally + * and which are not visible to the user. uc and sc + * are the corresponding Filter.Chains. + * They are linked together by a LinkHandler + * so that they can both be invoked in one call. + */ + final List sf = ctx.getSystemFilters(); + final List uf = ctx.getFilters(); - final Filter.Chain sc = new Filter.Chain(sf, ctx.getHandler()); - final Filter.Chain uc = new Filter.Chain(uf, new LinkHandler(sc)); + final Filter.Chain sc = new Filter.Chain(sf, ctx.getHandler()); + final Filter.Chain uc = new Filter.Chain(uf, new LinkHandler(sc)); - /* set up the two stream references */ - tx.getRequestBody(); - tx.getResponseBody(); - if (https) { - uc.doFilter(new HttpsExchangeImpl(tx)); - } else { - uc.doFilter(new HttpExchangeImpl(tx)); + /* set up the two stream references */ + tx.getRequestBody(); + tx.getResponseBody(); + if (https) { + uc.doFilter(new HttpsExchangeImpl(tx)); + } else { + uc.doFilter(new HttpExchangeImpl(tx)); + } + } catch (Throwable t) { + // release the exchange. + logger.log(Level.TRACE, "ServerImpl.Exchange", t); + if (!tx.writefinished()) { + closeConnection(connection); + } + tx.postExchangeFinished(false); } - } catch (Exception e) { logger.log(Level.TRACE, "ServerImpl.Exchange", e); - if (tx == null || !tx.writefinished) { + if (tx == null || !tx.writefinished()) { closeConnection(connection); } } catch (Throwable t) { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java index ecda32ecc31..9e1f949321a 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,8 +75,7 @@ class UndefLengthOutputStream extends FilterOutputStream is.close(); } catch (IOException e) {} } - Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent(e); + t.postExchangeFinished(true); } // flush is a pass-through diff --git a/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java b/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java index df2aca02d68..3f324ba1364 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java @@ -435,7 +435,10 @@ class JImageTask { } } } catch (IOException ioe) { - throw TASK_HELPER.newBadArgs("err.invalid.jimage", file, ioe.getMessage()); + boolean isVersionMismatch = ioe instanceof BasicImageReader.ImageVersionMismatchException; + // Both messages take the file name and underlying message. + String msgKey = isVersionMismatch ? "err.wrong.version" : "err.invalid.jimage"; + throw TASK_HELPER.newBadArgs(msgKey, file, ioe.getMessage()); } } } diff --git a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties index ac13505a0d9..3038dfcc5ec 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties @@ -89,15 +89,20 @@ main.opt.footer=\ \ glob:\n\ \ regex: - - err.not.a.task=task must be one of : {0} err.missing.arg=no value given for {0} err.ambiguous.arg=value for option {0} starts with \"--\" should use {0}= format err.not.a.dir=not a directory: {0} err.not.a.jimage=not a jimage file: {0} -err.invalid.jimage=Unable to open {0}: {1} err.no.jimage=no jimage provided err.option.unsupported={0} not supported: {1} err.unknown.option=unknown option: {0} err.cannot.create.dir=cannot create directory {0} + +# General failure to open a jimage file. +# {0} = path of jimage file, {1} = underlying error message +err.invalid.jimage=Unable to open {0}: {1} +# More specific alternative for cases of version mismatch +err.wrong.version=Unable to open {0}: mismatched file and tool version\n\ +Use ''/bin/jimage'' for the JDK associated with the jimage file:\n\ +{1} diff --git a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java index ab471694890..b3db11eb1fe 100644 --- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1233,7 +1233,7 @@ class ZipFileSystem extends FileSystem { private volatile boolean isOpen = true; private final SeekableByteChannel ch; // channel to the zipfile - final byte[] cen; // CEN & ENDHDR + final byte[] cen; // CEN private END end; private long locpos; // position of first LOC header (usually 0) @@ -1585,15 +1585,15 @@ class ZipFileSystem extends FileSystem { if (locpos < 0) throw new ZipException("invalid END header (bad central directory offset)"); - // read in the CEN and END - byte[] cen = new byte[(int)(end.cenlen + ENDHDR)]; - if (readNBytesAt(cen, 0, cen.length, cenpos) != end.cenlen + ENDHDR) { + // read in the CEN + byte[] cen = new byte[(int)(end.cenlen)]; + if (readNBytesAt(cen, 0, cen.length, cenpos) != end.cenlen) { throw new ZipException("read CEN tables failed"); } // Iterate through the entries in the central directory inodes = LinkedHashMap.newLinkedHashMap(end.centot + 1); int pos = 0; - int limit = cen.length - ENDHDR; + int limit = cen.length; while (pos < limit) { if (!cenSigAt(cen, pos)) throw new ZipException("invalid CEN header (bad signature)"); @@ -1641,7 +1641,7 @@ class ZipFileSystem extends FileSystem { // skip ext and comment pos += (CENHDR + nlen + elen + clen); } - if (pos + ENDHDR != cen.length) { + if (pos != cen.length) { throw new ZipException("invalid CEN header (bad header size)"); } buildNodeTree(); @@ -1671,7 +1671,7 @@ class ZipFileSystem extends FileSystem { } // CEN Offset where this Extra field ends int extraEndOffset = startingOffset + extraFieldLen; - if (extraEndOffset > cen.length - ENDHDR) { + if (extraEndOffset > cen.length) { zerror("Invalid CEN header (extra data field size too long)"); } int currentOffset = startingOffset; diff --git a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java index 66af78e53d2..adfa975c1c3 100644 --- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,6 +55,8 @@ import static java.nio.file.StandardOpenOption.WRITE; */ final class ZipPath implements Path { + private static final byte[] EMPTY_PATH = new byte[0]; + private final ZipFileSystem zfs; private final byte[] path; private volatile int[] offsets; @@ -93,8 +95,15 @@ final class ZipPath implements Path { @Override public ZipPath getFileName() { int off = path.length; - if (off == 0 || off == 1 && path[0] == '/') + if (off == 0) { + // empty path, which is defined as consisting solely of + // one name element that is empty + return new ZipPath(getFileSystem(), EMPTY_PATH, true); + } + if (off == 1 && path[0] == '/') { + // root path, which is defined as having 0 name elements return null; + } while (--off >= 0 && path[off] != '/') {} if (off < 0) return this; diff --git a/test/hotspot/gtest/utilities/test_rbtree.cpp b/test/hotspot/gtest/utilities/test_rbtree.cpp index a351e2141e8..17df34fb07a 100644 --- a/test/hotspot/gtest/utilities/test_rbtree.cpp +++ b/test/hotspot/gtest/utilities/test_rbtree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1252,3 +1252,17 @@ TEST_VM_F(RBTreeTest, AllocatorMayReturnNull) { EXPECT_EQ(false, success); // The test didn't exit the VM, so it was succesful. } + +TEST_VM_F(RBTreeTest, ArenaAllocator) { + Arena arena(mtTest); + RBTreeArena rbtree(&arena); + bool success = rbtree.upsert(5, 5); + ASSERT_EQ(true, success); +} + +TEST_VM_F(RBTreeTest, ResourceAreaAllocator) { + ResourceArea area(mtTest); + RBTreeResourceArea rbtree(&area); + bool success = rbtree.upsert(5, 5); + ASSERT_EQ(true, success); +} diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 3e4814180f6..09c0244addf 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -59,6 +59,10 @@ compiler/codecache/jmx/PoolsIndependenceTest.java 8264632 macosx-all compiler/vectorapi/reshape/TestVectorReinterpret.java 8320897,8348519 aix-ppc64,linux-ppc64le,linux-s390x compiler/vectorapi/VectorRebracket128Test.java 8330538 generic-all +compiler/vectorization/TestVectorAlgorithms.java#noSuperWord 8376803 aix-ppc64,linux-s390x +compiler/vectorization/TestVectorAlgorithms.java#vanilla 8376803 aix-ppc64,linux-s390x +compiler/vectorization/TestVectorAlgorithms.java#noOptimizeFill 8376803 aix-ppc64,linux-s390x + compiler/jvmci/TestUncaughtErrorInCompileMethod.java 8309073 generic-all compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java 8331704 linux-riscv64 compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java 8331704 linux-riscv64 diff --git a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java index 2461f1ae92b..cf8000b7a21 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java +++ b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java @@ -52,7 +52,7 @@ public class TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU { private static final String UNLOCK_DIAGNOSTIC = "-XX:+UnlockDiagnosticVMOptions"; public static void main(String[] args) throws Throwable { - if (!IntrinsicPredicates.isSHA3IntrinsicAvailable().getAsBoolean()) { + if (!IntrinsicPredicates.SHA3_INSTRUCTION_AVAILABLE.getAsBoolean()) { throw new SkippedException("Skipping... SHA3 intrinsics are not available on this platform."); } diff --git a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java index 067bc723b5c..1e0df1874b6 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java +++ b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java @@ -51,7 +51,7 @@ public class TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU { private static final String UNLOCK_DIAGNOSTIC = "-XX:+UnlockDiagnosticVMOptions"; public static void main(String[] args) throws Throwable { - if (IntrinsicPredicates.isSHA3IntrinsicAvailable().getAsBoolean()) { + if (IntrinsicPredicates.SHA3_INSTRUCTION_AVAILABLE.getAsBoolean()) { throw new SkippedException("Skipping... SHA3 intrinsics are available on this platform."); } diff --git a/test/hotspot/jtreg/compiler/c2/gvn/MissedRShiftLShiftIdentity.java b/test/hotspot/jtreg/compiler/c2/gvn/MissedRShiftLShiftIdentity.java new file mode 100644 index 00000000000..9f8eaab514f --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/gvn/MissedRShiftLShiftIdentity.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package compiler.c2.gvn; + +/* + * @test + * @bug 8374798 + * @summary RShift(LShift(x, C), C) Identity missed when shift counts are different + * constant nodes for the same effective count (e.g. -1 vs 31) due to + * mask_and_replace_shift_amount normalizing them at different times. + * + * @run main ${test.main.class} + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:+StressIGVN -XX:+StressCCP -XX:VerifyIterativeGVN=1000 -Xbatch -XX:-TieredCompilation + * -XX:CompileCommand=compileonly,${test.main.class}::test* ${test.main.class} + */ + +public class MissedRShiftLShiftIdentity { + public static int iFld = 0; + + public static void test() { + int[] iArr = new int[10]; + int i2 = -1, i3 = 0; + + for (int i11 : iArr) { + iFld = i11; + for (int i1 = 0; i1 < 10; i1++) { + iFld <<= i3; + iFld >>= i2; // RShift + i3 = i2; + } + int i16 = 0; + do { + for (int f3 = 1; f3 < 1; f3 += 3) { + i2 = -1; + } + } while (++i16 < 5); + } + } + + public static void main(String[] args) { + test(); + } +} diff --git a/test/hotspot/jtreg/compiler/c2/gvn/MissedURShiftLShiftIdeal.java b/test/hotspot/jtreg/compiler/c2/gvn/MissedURShiftLShiftIdeal.java new file mode 100644 index 00000000000..774b218b1ca --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/gvn/MissedURShiftLShiftIdeal.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package compiler.c2.gvn; + +/* + * @test + * @bug 8374798 8377389 + * @summary URShift(LShift(x, C), C) Ideal optimization missed due to missing IGVN notification: + * when LShift inputs change, its URShift users were not re-queued for the + * (X << C) >>> C -> X & mask optimization. + * + * @run main ${test.main.class} + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:+StressIGVN -XX:+StressCCP -XX:VerifyIterativeGVN=0100 -Xbatch -XX:-TieredCompilation + * -XX:CompileCommand=compileonly,${test.main.class}::test* ${test.main.class} + */ + +public class MissedURShiftLShiftIdeal { + public static int iFld = 0; + + public static void test() { + int[] iArr = new int[10]; + int i2 = -1, i3 = 0; + + for (int i11 : iArr) { + iFld = i11; + for (int i1 = 0; i1 < 10; i1++) { + iFld <<= i3; + iFld >>>= i2; // URShift + i3 = i2; + } + int i16 = 0; + do { + for (int f3 = 1; f3 < 1; f3 += 3) { + i2 = -1; + } + } while (++i16 < 5); + } + } + + public static void main(String[] args) { + test(); + } +} diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestPushAddThruCast.java b/test/hotspot/jtreg/compiler/c2/irTests/TestPushAddThruCast.java index 3aee78e9d6a..81a88791b07 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestPushAddThruCast.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestPushAddThruCast.java @@ -86,7 +86,7 @@ public class TestPushAddThruCast { // Test commoning of Casts after loop opts when they are at the same control @Test @IR(phase = CompilePhase.ITER_GVN1, counts = { IRNode.CAST_II, "4" }) - @IR(phase = CompilePhase.OPTIMIZE_FINISHED, counts = { IRNode.CAST_II, "2" }) + @IR(phase = CompilePhase.OPTIMIZE_FINISHED, counts = { IRNode.CAST_II, "3" }) public static int test3() { int j = Objects.checkIndex(i - 3, length); j += Objects.checkIndex(i, length); diff --git a/test/hotspot/jtreg/compiler/integerArithmetic/TestHoistDivision.java b/test/hotspot/jtreg/compiler/integerArithmetic/TestHoistDivision.java new file mode 100644 index 00000000000..26fce864c12 --- /dev/null +++ b/test/hotspot/jtreg/compiler/integerArithmetic/TestHoistDivision.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package compiler.integerArithmetic; + +import compiler.lib.ir_framework.*; +import jdk.test.lib.Asserts; + +/* + * @test + * @bug 8347365 + * @summary Tests that divisions are hoisted when their zero checks are elided. + * @library /test/lib / + * @run driver ${test.main.class} + */ +public class TestHoistDivision { + public static void main(String[] args) { + TestFramework.run(); + } + + @DontInline + private static void dontInline() {} + + @Run(test = {"testCommon", "testHoistOutOfLoop"}) + public void run() { + Asserts.assertEQ(2, testCommon(1, 1)); + Asserts.assertEQ(0, testHoistOutOfLoop(1, 1, true, 1, 4, 2)); + Asserts.assertEQ(0, testHoistOutOfLoop(1, 1, false, 1, 4, 2)); + } + + @Test + @IR(counts = {IRNode.DIV_I, "1", IRNode.DIV_BY_ZERO_TRAP, "1"}) + public int testCommon(int x, int y) { + // The 2 divisions should be commoned + int result = x / y; + dontInline(); + return result + x / y; + } + + @Test + @IR(failOn = IRNode.DIV_BY_ZERO_TRAP, counts = {IRNode.DIV_I, "1", IRNode.TRAP, "1"}) + public int testHoistOutOfLoop(int x, int y, boolean b, int start, int limit, int step) { + // The divisions should be hoisted out of the loop, allowing them to be commoned + int result = 0; + for (int i = start; i < limit; i *= step) { + if (b) { + dontInline(); + result += x / y; + } else { + result -= x / y; + } + b = !b; + } + return result; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java index 137efd18136..debb025f449 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java @@ -881,8 +881,7 @@ public class TestFramework { if (shouldVerifyIR) { try { TestClassParser testClassParser = new TestClassParser(testClass, allowNotCompilable); - Matchable testClassMatchable = testClassParser.parse(testVMProcess.getHotspotPidFileName(), - testVMProcess.getApplicableIRRules()); + Matchable testClassMatchable = testClassParser.parse(testVMProcess.testVmData()); IRMatcher matcher = new IRMatcher(testClassMatchable); matcher.match(); } catch (IRViolationException e) { diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java index 931d687b0bc..9a55db01fa0 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java @@ -24,6 +24,7 @@ package compiler.lib.ir_framework.driver; import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.driver.network.TestVMData; import compiler.lib.ir_framework.shared.TestFrameworkException; import compiler.lib.ir_framework.shared.TestFrameworkSocket; import compiler.lib.ir_framework.shared.NoTestsRunException; @@ -58,10 +59,9 @@ public class TestVMProcess { private static String lastTestVMOutput = ""; private final ArrayList cmds; - private String hotspotPidFileName; private String commandLine; private OutputAnalyzer oa; - private String applicableIRRules; + private final TestVMData testVmData; public TestVMProcess(List additionalFlags, Class testClass, Set> helperClasses, int defaultWarmup, boolean allowNotCompilable, boolean testClassesOnBootClassPath) { @@ -72,20 +72,17 @@ public class TestVMProcess { allowNotCompilable, testClassesOnBootClassPath); start(); } - processSocketOutput(socket); checkTestVMExitCode(); + String hotspotPidFileName = String.format("hotspot_pid%d.log", oa.pid()); + testVmData = socket.testVmData(hotspotPidFileName, allowNotCompilable); } public String getCommandLine() { return commandLine; } - public String getApplicableIRRules() { - return applicableIRRules; - } - - public String getHotspotPidFileName() { - return hotspotPidFileName; + public TestVMData testVmData() { + return testVmData; } public static String getLastTestVMOutput() { @@ -172,55 +169,9 @@ public class TestVMProcess { process.command().add(1, "-DReproduce=true"); // Add after "/path/to/bin/java" in order to rerun the Test VM directly commandLine = "Command Line:" + System.lineSeparator() + String.join(" ", process.command()) + System.lineSeparator(); - hotspotPidFileName = String.format("hotspot_pid%d.log", oa.pid()); lastTestVMOutput = oa.getOutput(); } - /** - * Process the socket output: All prefixed lines are dumped to the standard output while the remaining lines - * represent the Applicable IR Rules used for IR matching later. - */ - private void processSocketOutput(TestFrameworkSocket socket) { - String output = socket.getOutput(); - if (socket.hasStdOut()) { - StringBuilder testListBuilder = new StringBuilder(); - StringBuilder messagesBuilder = new StringBuilder(); - StringBuilder nonStdOutBuilder = new StringBuilder(); - Scanner scanner = new Scanner(output); - while (scanner.hasNextLine()) { - String line = scanner.nextLine(); - if (line.startsWith(TestFrameworkSocket.STDOUT_PREFIX)) { - // Exclude [STDOUT] from message. - line = line.substring(TestFrameworkSocket.STDOUT_PREFIX.length()); - if (line.startsWith(TestFrameworkSocket.TESTLIST_TAG)) { - // Exclude [TESTLIST] from message for better formatting. - line = "> " + line.substring(TestFrameworkSocket.TESTLIST_TAG.length() + 1); - testListBuilder.append(line).append(System.lineSeparator()); - } else { - messagesBuilder.append(line).append(System.lineSeparator()); - } - } else { - nonStdOutBuilder.append(line).append(System.lineSeparator()); - } - } - System.out.println(); - if (!testListBuilder.isEmpty()) { - System.out.println("Run flag defined test list"); - System.out.println("--------------------------"); - System.out.println(testListBuilder); - System.out.println(); - } - if (!messagesBuilder.isEmpty()) { - System.out.println("Messages from Test VM"); - System.out.println("---------------------"); - System.out.println(messagesBuilder); - } - applicableIRRules = nonStdOutBuilder.toString(); - } else { - applicableIRRules = output; - } - } - private void checkTestVMExitCode() { final int exitCode = oa.getExitValue(); if (EXCLUDE_RANDOM || REPORT_STDOUT || (VERBOSE && exitCode == 0)) { diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestClassParser.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestClassParser.java index 2329b41afbe..6c899af2116 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestClassParser.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestClassParser.java @@ -30,6 +30,7 @@ import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethodMatchable; import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.HotSpotPidFileParser; import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.LoggedMethods; +import compiler.lib.ir_framework.driver.network.TestVMData; import compiler.lib.ir_framework.shared.TestFormat; import java.util.SortedSet; @@ -53,13 +54,13 @@ public class TestClassParser { * Parse the Applicable IR Rules and hotspot_pid* file to create a collection of {@link IRMethod} objects. * Return a default/empty TestClass object if there are no applicable @IR rules in any method of the test class. */ - public Matchable parse(String hotspotPidFileName, String applicableIRRules) { + public Matchable parse(TestVMData testVmData) { ApplicableIRRulesParser applicableIRRulesParser = new ApplicableIRRulesParser(testClass); - TestMethods testMethods = applicableIRRulesParser.parse(applicableIRRules); - VMInfo vmInfo = VMInfoParser.parseVMInfo(applicableIRRules); + TestMethods testMethods = applicableIRRulesParser.parse(testVmData.applicableIRRules()); + VMInfo vmInfo = VMInfoParser.parseVMInfo(testVmData.applicableIRRules()); if (testMethods.hasTestMethods()) { HotSpotPidFileParser hotSpotPidFileParser = new HotSpotPidFileParser(testClass.getName(), testMethods); - LoggedMethods loggedMethods = hotSpotPidFileParser.parse(hotspotPidFileName); + LoggedMethods loggedMethods = hotSpotPidFileParser.parse(testVmData.hotspotPidFileName()); return createTestClass(testMethods, loggedMethods, vmInfo); } return new NonIRTestClass(); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/TestVMData.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/TestVMData.java new file mode 100644 index 00000000000..daa6a590ddf --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/TestVMData.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.lib.ir_framework.driver.network; + +import compiler.lib.ir_framework.driver.irmatching.IRMatcher; +import compiler.lib.ir_framework.driver.network.testvm.java.JavaMessages; +import compiler.lib.ir_framework.shared.TestFrameworkSocket; +import compiler.lib.ir_framework.test.network.MessageTag; + +import java.util.Scanner; + +/** + * This class collects all the parsed data received over the {@link TestFrameworkSocket}. This data is required later + * in the {@link IRMatcher}. + */ +public class TestVMData { + private final boolean allowNotCompilable; + private final String hotspotPidFileName; + private final String applicableIRRules; + + public TestVMData(JavaMessages javaMessages, String hotspotPidFileName, boolean allowNotCompilable) { + this.applicableIRRules = processOutput(javaMessages); + this.hotspotPidFileName = hotspotPidFileName; + this.allowNotCompilable = allowNotCompilable; + } + + public String hotspotPidFileName() { + return hotspotPidFileName; + } + + public boolean allowNotCompilable() { + return allowNotCompilable; + } + + public String applicableIRRules() { + return applicableIRRules; + } + + /** + * Process the socket output: All prefixed lines are dumped to the standard output while the remaining lines + * represent the Applicable IR Rules used for IR matching later. + */ + private String processOutput(JavaMessages javaMessages) { + String output = javaMessages.output(); + if (javaMessages.hasStdOut()) { + StringBuilder testListBuilder = new StringBuilder(); + StringBuilder messagesBuilder = new StringBuilder(); + StringBuilder nonStdOutBuilder = new StringBuilder(); + Scanner scanner = new Scanner(output); + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + if (line.startsWith(MessageTag.STDOUT)) { + // Exclude [STDOUT] from message. + line = line.substring(MessageTag.STDOUT.length()); + if (line.startsWith(MessageTag.TEST_LIST)) { + // Exclude [TEST_LIST] from message for better formatting. + line = "> " + line.substring(MessageTag.TEST_LIST.length() + 1); + testListBuilder.append(line).append(System.lineSeparator()); + } else { + messagesBuilder.append(line).append(System.lineSeparator()); + } + } else { + nonStdOutBuilder.append(line).append(System.lineSeparator()); + } + } + System.out.println(); + if (!testListBuilder.isEmpty()) { + System.out.println("Run flag defined test list"); + System.out.println("--------------------------"); + System.out.println(testListBuilder); + System.out.println(); + } + if (!messagesBuilder.isEmpty()) { + System.out.println("Messages from Test VM"); + System.out.println("---------------------"); + System.out.println(messagesBuilder); + } + return nonStdOutBuilder.toString(); + } else { + return output; + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/TestVmMessageReader.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/TestVmMessageReader.java new file mode 100644 index 00000000000..b438794964d --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/TestVmMessageReader.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.lib.ir_framework.driver.network.testvm; + +import compiler.lib.ir_framework.driver.network.testvm.java.JavaMessages; +import compiler.lib.ir_framework.shared.TestFrameworkException; +import compiler.lib.ir_framework.shared.TestFrameworkSocket; +import compiler.lib.ir_framework.test.network.MessageTag; + +import java.io.BufferedReader; +import java.net.Socket; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; + +/** + * Dedicated reader for Test VM messages received by the {@link TestFrameworkSocket}. The reader is used as a task + * wrapped in a {@link Future}. The received messages are returned in a new {@link JavaMessages} wrapper. Once the + * Test VM is terminated, the client connection is closed and the parsed messages can be fetched with + * {@link Future#get()} which calls {@link #call()}. + */ +public class TestVmMessageReader implements Callable { + private final Socket socket; + private final BufferedReader reader; + private boolean receivedStdOut; + + public TestVmMessageReader(Socket socket, BufferedReader reader) { + this.socket = socket; + this.reader = reader; + this.receivedStdOut = false; + } + + @Override + public JavaMessages call() { + try (socket; reader) { + StringBuilder builder = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + builder.append(line).append(System.lineSeparator()); + if (line.startsWith(MessageTag.STDOUT)) { + receivedStdOut = true; + } + } + return new JavaMessages(builder.toString(), receivedStdOut); + } catch (Exception e) { + throw new TestFrameworkException("Error while reading Test VM socket messages", e); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/java/JavaMessages.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/java/JavaMessages.java new file mode 100644 index 00000000000..b8a3f39c637 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/java/JavaMessages.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.lib.ir_framework.driver.network.testvm.java; + +import compiler.lib.ir_framework.test.network.MessageTag; + +/** + * Class to collect all Java messages sent from the Test VM to the Driver VM. + */ +public class JavaMessages { + private final String output; + private final boolean receivedStdOut; + + public JavaMessages(String output, boolean receivedStdOut) { + this.output = output; + this.receivedStdOut = receivedStdOut; + } + + public String output() { + return output; + } + + /** + * Return whether Test VM sent messages to be put on stdout (starting with {@link MessageTag#STDOUT}). + */ + public boolean hasStdOut() { + return receivedStdOut; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java index f10540ebc5b..77d560952f1 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java @@ -24,40 +24,27 @@ package compiler.lib.ir_framework.shared; import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.driver.network.*; +import compiler.lib.ir_framework.driver.network.testvm.TestVmMessageReader; +import compiler.lib.ir_framework.driver.network.testvm.java.JavaMessages; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.FutureTask; +import java.net.*; +import java.util.concurrent.*; /** - * Dedicated socket to send data from the flag and Test VM back to the Driver VM. + * Dedicated Driver VM socket to receive data from the Test VM. Could either be received from Java and C2 code. */ public class TestFrameworkSocket implements AutoCloseable { - public static final String STDOUT_PREFIX = "[STDOUT]"; - public static final String TESTLIST_TAG = "[TESTLIST]"; - public static final String DEFAULT_REGEX_TAG = "[DEFAULT_REGEX]"; - public static final String PRINT_TIMES_TAG = "[PRINT_TIMES]"; - public static final String NOT_COMPILABLE_TAG = "[NOT_COMPILABLE]"; - - // Static fields used for Test VM only. private static final String SERVER_PORT_PROPERTY = "ir.framework.server.port"; - private static final int SERVER_PORT = Integer.getInteger(SERVER_PORT_PROPERTY, -1); - private static final boolean REPRODUCE = Boolean.getBoolean("Reproduce"); - private static Socket clientSocket = null; - private static PrintWriter clientWriter = null; - - private final String serverPortPropertyFlag; - private FutureTask socketTask; + private final int serverSocketPort; private final ServerSocket serverSocket; - private boolean receivedStdOut = false; + private boolean running; + private final ExecutorService executor; + private Future javaFuture; public TestFrameworkSocket() { try { @@ -66,140 +53,80 @@ public class TestFrameworkSocket implements AutoCloseable { } catch (IOException e) { throw new TestFrameworkException("Failed to create TestFramework server socket", e); } - int port = serverSocket.getLocalPort(); + serverSocketPort = serverSocket.getLocalPort(); + executor = Executors.newCachedThreadPool(); if (TestFramework.VERBOSE) { - System.out.println("TestFramework server socket uses port " + port); + System.out.println("TestFramework server socket uses port " + serverSocketPort); } - serverPortPropertyFlag = "-D" + SERVER_PORT_PROPERTY + "=" + port; start(); } public String getPortPropertyFlag() { - return serverPortPropertyFlag; + return "-D" + SERVER_PORT_PROPERTY + "=" + serverSocketPort; } private void start() { - socketTask = initSocketTask(); - Thread socketThread = new Thread(socketTask); - socketThread.start(); + running = true; + executor.submit(this::acceptLoop); } /** - * Waits for a client (created by flag or Test VM) to connect. Return the messages received from the client. + * Main loop to wait for new client connections and handling them upon connection request. */ - private FutureTask initSocketTask() { - return new FutureTask<>(() -> { - try (Socket clientSocket = serverSocket.accept(); - BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())) - ) { - StringBuilder builder = new StringBuilder(); - String next; - while ((next = in.readLine()) != null) { - builder.append(next).append(System.lineSeparator()); - if (next.startsWith(STDOUT_PREFIX)) { - receivedStdOut = true; - } - } - return builder.toString(); - } catch (IOException e) { + private void acceptLoop() { + while (running) { + try { + acceptNewClientConnection(); + } catch (TestFrameworkException e) { + running = false; + throw e; + } catch (Exception e) { + running = false; throw new TestFrameworkException("Server socket error", e); } - }); + } + } + + /** + * Accept new client connection and then submit a task accordingly to manage incoming message on that connection/socket. + */ + private void acceptNewClientConnection() throws IOException { + Socket client = serverSocket.accept(); + BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream())); + submitTask(client, reader); + } + + /** + * Submit dedicated tasks which are wrapped into {@link Future} objects. The tasks will read all messages sent + * over that connection. + */ + private void submitTask(Socket client, BufferedReader reader) { + javaFuture = executor.submit(new TestVmMessageReader(client, reader)); } @Override public void close() { try { + running = false; serverSocket.close(); } catch (IOException e) { throw new TestFrameworkException("Could not close socket", e); } + executor.shutdown(); } - /** - * Only called by Test VM to write to server socket. - */ - public static void write(String msg, String tag) { - write(msg, tag, false); + public TestVMData testVmData(String hotspotPidFileName, boolean allowNotCompilable) { + JavaMessages javaMessages = testVmMessages(); + return new TestVMData(javaMessages, hotspotPidFileName, allowNotCompilable); } - /** - * Only called by Test VM to write to server socket. - *

    - * The Test VM is spawned by the main jtreg VM. The stdout of the Test VM is hidden - * unless the Verbose or ReportStdout flag is used. TestFrameworkSocket is used by the parent jtreg - * VM and the Test VM to communicate. By sending the prints through the TestFrameworkSocket with the - * parameter stdout set to true, the parent VM will print the received messages to its stdout, making it - * visible to the user. - */ - public static void write(String msg, String tag, boolean stdout) { - if (REPRODUCE) { - System.out.println("Debugging Test VM: Skip writing due to -DReproduce"); - return; - } - TestFramework.check(SERVER_PORT != -1, "Server port was not set correctly for flag and/or Test VM " - + "or method not called from flag or Test VM"); + private JavaMessages testVmMessages() { try { - // Keep the client socket open until the Test VM terminates (calls closeClientSocket before exiting main()). - if (clientSocket == null) { - clientSocket = new Socket(InetAddress.getLoopbackAddress(), SERVER_PORT); - clientWriter = new PrintWriter(clientSocket.getOutputStream(), true); - } - if (stdout) { - msg = STDOUT_PREFIX + tag + " " + msg; - } - clientWriter.println(msg); - } catch (Exception e) { - // When the Test VM is directly run, we should ignore all messages that would normally be sent to the - // Driver VM. - String failMsg = System.lineSeparator() + System.lineSeparator() + """ - ########################################################### - Did you directly run the Test VM (TestVM class) - to reproduce a bug? - => Append the flag -DReproduce=true and try again! - ########################################################### - """; - throw new TestRunException(failMsg, e); - } - if (TestFramework.VERBOSE) { - System.out.println("Written " + tag + " to socket:"); - System.out.println(msg); - } - } - - /** - * Closes (and flushes) the printer to the socket and the socket itself. Is called as last thing before exiting - * the main() method of the flag and the Test VM. - */ - public static void closeClientSocket() { - if (clientSocket != null) { - try { - clientWriter.close(); - clientSocket.close(); - } catch (IOException e) { - throw new RuntimeException("Could not close TestVM socket", e); - } - } - } - - /** - * Get the socket output of the Flag VM. - */ - public String getOutput() { - try { - return socketTask.get(); + return javaFuture.get(); } catch (ExecutionException e) { - // Thrown when socket task was not finished, yet (i.e. no client sent data) but socket was already closed. - return ""; + throw new TestFrameworkException("No test VM messages were received", e); } catch (Exception e) { - throw new TestFrameworkException("Could not read from socket task", e); + throw new TestFrameworkException("Error while fetching Test VM Future", e); } } - - /** - * Return whether Test VM sent messages to be put on stdout (starting with {@link ::STDOUT_PREFIX}). - */ - public boolean hasStdOut() { - return receivedStdOut; - } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/AbstractTest.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/AbstractTest.java index 4d227900e2e..152dcab273a 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/AbstractTest.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/AbstractTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,13 @@ package compiler.lib.ir_framework.test; import compiler.lib.ir_framework.*; import compiler.lib.ir_framework.shared.TestRun; import compiler.lib.ir_framework.shared.TestRunException; +import compiler.lib.ir_framework.test.network.TestVmSocket; import jdk.test.whitebox.WhiteBox; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import compiler.lib.ir_framework.shared.TestFrameworkSocket; - /** * Abstract super class for base, checked and custom run tests. */ @@ -118,7 +117,7 @@ abstract class AbstractTest { tryCompileMethod(test); } catch (MethodNotCompilableException e) { final Method testMethod = test.getTestMethod(); - TestFrameworkSocket.write("Method not compilable: " + testMethod, TestFrameworkSocket.NOT_COMPILABLE_TAG, true); + TestVmSocket.send("Method not compilable: " + testMethod); TestRun.check(test.isAllowNotCompilable(), "Method " + testMethod + " not compilable (anymore) at level " + test.getCompLevel() + ". Most likely, this is not expected, but if it is, you can use 'allowNotCompilable'."); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java index 7a868c172dd..15d9a2e4e34 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java @@ -27,6 +27,8 @@ import compiler.lib.ir_framework.IR; import compiler.lib.ir_framework.IRNode; import compiler.lib.ir_framework.TestFramework; import compiler.lib.ir_framework.shared.*; +import compiler.lib.ir_framework.test.network.MessageTag; +import compiler.lib.ir_framework.test.network.TestVmSocket; import jdk.test.lib.Platform; import jdk.test.whitebox.WhiteBox; @@ -171,9 +173,8 @@ public class ApplicableIRRulesPrinter { } private void printDisableReason(String method, String reason, String[] apply, int ruleIndex, int ruleMax) { - TestFrameworkSocket.write("Disabling IR matching for rule " + ruleIndex + " of " + ruleMax + " in " + - method + ": " + reason + ": " + String.join(", ", apply), - "[ApplicableIRRules]", true); + TestVmSocket.send("Disabling IR matching for rule " + ruleIndex + " of " + ruleMax + " in " + method + ": " + + reason + ": " + String.join(", ", apply)); } private boolean shouldApplyIrRule(IR irAnno, String m, int ruleIndex, int ruleMax) { @@ -286,7 +287,7 @@ public class ApplicableIRRulesPrinter { IRNode.checkIRNodeSupported(s); } } catch (CheckedTestFrameworkException e) { - TestFrameworkSocket.write("Skip Rule " + ruleIndex + ": " + e.getMessage(), TestFrameworkSocket.DEFAULT_REGEX_TAG, true); + TestVmSocket.send("Skip Rule " + ruleIndex + ": " + e.getMessage()); return true; } return false; @@ -524,7 +525,7 @@ public class ApplicableIRRulesPrinter { public void emit() { output.append(END); - TestFrameworkSocket.write(output.toString(), "ApplicableIRRules"); + TestVmSocket.sendWithTag(MessageTag.APPLICABLE_IR_RULES, output.toString()); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java index 14551141cd7..c5e94c32c08 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java @@ -26,6 +26,8 @@ package compiler.lib.ir_framework.test; import compiler.lib.ir_framework.*; import compiler.lib.ir_framework.Compiler; import compiler.lib.ir_framework.shared.*; +import compiler.lib.ir_framework.test.network.MessageTag; +import compiler.lib.ir_framework.test.network.TestVmSocket; import jdk.test.lib.Platform; import jdk.test.lib.Utils; import jdk.test.whitebox.WhiteBox; @@ -38,8 +40,6 @@ import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; -import static compiler.lib.ir_framework.shared.TestFrameworkSocket.PRINT_TIMES_TAG; - /** * This class' main method is called from {@link TestFramework} and represents the so-called "Test VM". The class is * the heart of the framework and is responsible for executing all the specified tests in the test class. It uses the @@ -159,6 +159,7 @@ public class TestVM { */ public static void main(String[] args) { try { + TestVmSocket.connect(); String testClassName = args[0]; System.out.println("TestVM main() called - about to run tests in class " + testClassName); Class testClass = getClassObject(testClassName, "test"); @@ -167,7 +168,7 @@ public class TestVM { framework.addHelperClasses(args); framework.start(); } finally { - TestFrameworkSocket.closeClientSocket(); + TestVmSocket.close(); } } @@ -864,7 +865,7 @@ public class TestVM { System.out.println("Run " + test.toString()); } if (testFilterPresent) { - TestFrameworkSocket.write("Run " + test.toString(), TestFrameworkSocket.TESTLIST_TAG, true); + TestVmSocket.send(MessageTag.TEST_LIST + "Run " + test.toString()); } try { test.run(); @@ -892,10 +893,9 @@ public class TestVM { // Print execution times if (PRINT_TIMES) { - TestFrameworkSocket.write("Test execution times:", PRINT_TIMES_TAG, true); + TestVmSocket.send(MessageTag.PRINT_TIMES + " Test execution times:"); for (Map.Entry entry : durations.entrySet()) { - TestFrameworkSocket.write(String.format("%-25s%15d ns%n", entry.getValue() + ":", entry.getKey()), - PRINT_TIMES_TAG, true); + TestVmSocket.send(MessageTag.PRINT_TIMES + String.format("%-25s%15d ns%n", entry.getValue() + ":", entry.getKey())); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/VMInfoPrinter.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/VMInfoPrinter.java index 470569122dd..2227c7760d5 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/VMInfoPrinter.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/VMInfoPrinter.java @@ -23,7 +23,8 @@ package compiler.lib.ir_framework.test; -import compiler.lib.ir_framework.shared.TestFrameworkSocket; +import compiler.lib.ir_framework.test.network.MessageTag; +import compiler.lib.ir_framework.test.network.TestVmSocket; import jdk.test.whitebox.WhiteBox; /** @@ -65,6 +66,6 @@ public class VMInfoPrinter { .append(System.lineSeparator()); vmInfo.append(END_VM_INFO); - TestFrameworkSocket.write(vmInfo.toString(), "VMInfo"); + TestVmSocket.sendWithTag(MessageTag.VM_INFO, vmInfo.toString()); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/MessageTag.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/MessageTag.java new file mode 100644 index 00000000000..2981f203e65 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/MessageTag.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.lib.ir_framework.test.network; + +public class MessageTag { + public static final String STDOUT = "[STDOUT]"; + public static final String TEST_LIST = "[TEST_LIST]"; + public static final String PRINT_TIMES = "[PRINT_TIMES]"; + public static final String VM_INFO = "[VM_INFO]"; + public static final String APPLICABLE_IR_RULES = "[APPLICABLE_IR_RULES]"; +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/TestVmSocket.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/TestVmSocket.java new file mode 100644 index 00000000000..c1065c84320 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/TestVmSocket.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.lib.ir_framework.test.network; + +import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.shared.TestRunException; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.InetAddress; +import java.net.Socket; + +public class TestVmSocket { + private static final boolean REPRODUCE = Boolean.getBoolean("Reproduce"); + private static final String SERVER_PORT_PROPERTY = "ir.framework.server.port"; + private static final int SERVER_PORT = Integer.getInteger(SERVER_PORT_PROPERTY, -1); + + private static Socket socket = null; + private static PrintWriter writer = null; + + /** + * Send a message to the Driver VM which is unconditionally shown in the Driver VM output. + */ + public static void send(String message) { + sendWithTag(MessageTag.STDOUT, message); + } + + /** + * Send a message to the Driver VM with a {@link MessageTag}. Not all messages are shown by default in the + * Driver VM output and require setting some property flags first like {@code -DPrintTimes=true}. + */ + public static void sendWithTag(String tag, String message) { + if (REPRODUCE) { + // Debugging Test VM: Skip writing due to -DReproduce; + return; + } + + TestFramework.check(socket != null, "must be connected"); + writer.println(tag + " " + message); + } + + public static void connect() { + if (REPRODUCE) { + // Debugging Test VM: Skip writing due to -DReproduce; + return; + } + + TestFramework.check(SERVER_PORT != -1, "Server port was not set correctly for flag and/or test VM " + + "or method not called from flag or test VM"); + + try { + // Keep the client socket open until the test VM terminates (calls closeClientSocket before exiting main()). + socket = new Socket(InetAddress.getLoopbackAddress(), SERVER_PORT); + writer = new PrintWriter(socket.getOutputStream(), true); + } catch (Exception e) { + // When the test VM is directly run, we should ignore all messages that would normally be sent to the + // driver VM. + String failMsg = System.lineSeparator() + System.lineSeparator() + """ + ########################################################### + Did you directly run the test VM (TestVM class) + to reproduce a bug? + => Append the flag -DReproduce=true and try again! + ########################################################### + """; + throw new TestRunException(failMsg, e); + } + + } + + /** + * Closes (and flushes) the printer to the socket and the socket itself. Is called as last thing before exiting + * the main() method of the flag and the test VM. + */ + public static void close() { + if (socket != null) { + writer.close(); + try { + socket.close(); + } catch (IOException e) { + throw new RuntimeException("Could not close TestVM socket", e); + } + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java b/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java index b789da45d44..c8541ac1fa6 100644 --- a/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java +++ b/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -141,6 +141,35 @@ public final class PrimitiveType implements CodeGenerationDataNameType { }; } + /** + * Provides the field descriptor for primitive types as per JVMS§4.3.2. + * + * @return the field descriptor of the type. + */ + public String fieldDesc() { + return switch (kind) { + case LONG -> "J"; + case BOOLEAN -> "Z"; + default -> boxedTypeName().substring(0, 1); + }; + } + + /** + * Provides the abbreviation of the type as it would be used for node classes in the + * IR-Framework. Note the the abbreviations for boolean and char are used inconsistently. + * This method maps boolean to "UB", even though it might sometimes be mapped under "B" since + * it is loaded as a byte, and char to "C", even though it might sometimes be mapped to "US" + * for "unsigned short". + * + * @return the abbreviation of the type. + */ + public String abbrev() { + return switch (kind) { + case BOOLEAN -> "UB"; + default -> boxedTypeName().substring(0, 1); + }; + } + /** * Indicates if the type is a floating point type. * diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java index 00b5becdbfa..6fe00498797 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -108,13 +108,19 @@ public class TestDwarf { if (Platform.isX64() || Platform.isX86()) { // Not all platforms raise SIGFPE but x86_32 and x86_64 do. runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeDivByZero"), - new DwarfConstraint(0, "Java_TestDwarf_crashNativeDivByZero", "libTestDwarf.c", 59)); + new DwarfConstraint(0, "Java_TestDwarf_crashNativeDivByZero", "libTestDwarf.c", 62)); runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeMultipleMethods"), - new DwarfConstraint(0, "foo", "libTestDwarf.c", 42), - new DwarfConstraint(1, "Java_TestDwarf_crashNativeMultipleMethods", "libTestDwarf.c", 70)); + new DwarfConstraint(0, "foo", "libTestDwarf.c", 45), + new DwarfConstraint(1, "Java_TestDwarf_crashNativeMultipleMethods", "libTestDwarf.c", 73)); + } + // Null pointer dereferences exhibit different behaviour depending on if GCC or Clang is used. + // When using GCC, the VM will crash gracefully and generate a hs_err which can be parsed. + // On the contrary, with Clang the process exits immediately without hs_err. + // Since runAndCheck needs an hs_err file, we have to skip this subtest. + if (!isUsingClang()) { + runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeDereferenceNull"), + new DwarfConstraint(0, "dereference_null", "libTestDwarfHelper.h", 49)); } - runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeDereferenceNull"), - new DwarfConstraint(0, "dereference_null", "libTestDwarfHelper.h", 46)); } // A full pattern could check for lines like: @@ -240,6 +246,7 @@ public class TestDwarf { private static native void crashNativeDivByZero(); private static native void crashNativeDereferenceNull(); private static native void crashNativeMultipleMethods(int x); + private static native boolean isUsingClang(); } class UnsupportedDwarfVersionException extends RuntimeException { } diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarf.c b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarf.c index 616a6f07d12..19993d17de3 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarf.c +++ b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,10 @@ int zero = 0; int result = 0; int limit = 20; -// Just big enough by doing some random things such that it is not inlined. +// Explicitly don't inline. foo needs complexity so GCC/Clang don't optimize it away. +#if !defined(_MSC_VER) +__attribute__((noinline)) +#endif void foo(int x) { printf("foo3:"); printf(" %d\n", x); @@ -76,3 +79,12 @@ JNIEXPORT void JNICALL Java_TestDwarf_crashNativeMultipleMethods(JNIEnv* env, jc } } +// Need to tell if Clang was used to build libTestDwarf. +JNIEXPORT jboolean JNICALL Java_TestDwarf_isUsingClang(JNIEnv* env, jobject obj) { +#if defined(__clang__) + return JNI_TRUE; +#else + return JNI_FALSE; +#endif +} + diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h index 1da05c1c3d3..9f9ef33add2 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h +++ b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,9 @@ void unused4() { void unused5() { } +#if !defined(_MSC_VER) +__attribute__((noinline)) +#endif EXPORT void dereference_null() { int* x = (int*)0; *x = 34; // Crash diff --git a/test/hotspot/jtreg/runtime/cds/appcds/aotCache/ChangedJarFile.java b/test/hotspot/jtreg/runtime/cds/appcds/aotCache/ChangedJarFile.java new file mode 100644 index 00000000000..a717b267347 --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/aotCache/ChangedJarFile.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/* + * @test + * @summary AOT cache should be rejected if JAR file(s) in the classpath have changed + * @bug 8377932 + * @requires vm.cds.supports.aot.class.linking + * @library /test/lib + * @build ChangedJarFile + * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar MyTestApp OtherClass + * @run driver ChangedJarFile AOT + */ + +import jdk.jfr.Event; +import jdk.test.lib.cds.CDSAppTester; +import jdk.test.lib.helpers.ClassFileInstaller; +import jdk.test.lib.process.OutputAnalyzer; + +public class ChangedJarFile { + static final String appJar = ClassFileInstaller.getJarPath("app.jar"); + static final String mainClass = MyTestApp.class.getName(); + + public static void main(String[] args) throws Exception { + // Train and run with unchanged JAR file (which has OtherClass.class) + Tester tester = new Tester(); + tester.run(args); + + // Run again with changed JAR file (which doesn't have OtherClass.class anymore) + ClassFileInstaller.writeJar(appJar, "MyTestApp"); + + // First disable AOT cache to verify test login + tester.productionRun(new String[] {"-XX:AOTMode=off"}, + new String[] {"jarHasChanged"}); + + // Now see if the AOT cache will be automatically disabled + OutputAnalyzer out = + tester.productionRun(new String[] {"-XX:AOTMode=auto", "-Xlog:aot"}, + new String[] {"jarHasChanged"}); + out.shouldMatch("This file is not the one used while building the " + + "AOT cache: '.*app.jar', timestamp has changed, size has changed"); + } + + static class Tester extends CDSAppTester { + public Tester() { + super(mainClass); + } + + @Override + public String classpath(RunMode runMode) { + return appJar; + } + + @Override + public String[] appCommandLine(RunMode runMode) { + return new String[] { mainClass }; + } + + @Override + public void checkExecution(OutputAnalyzer out, RunMode runMode) { + + } + } + + +} + +class MyTestApp { + public static void main(String args[]) { + boolean jarHasChanged = (args.length != 0); + + System.out.println("JAR has changed = " + (jarHasChanged)); + Class c = null; + try { + c = Class.forName("OtherClass"); + System.out.println("Other class = " + c); + } catch (Throwable t) { + if (!jarHasChanged) { + throw new RuntimeException("OtherClass should have been loaded because JAR has not been changed yet", t); + } + } + + if (jarHasChanged && c != null) { + throw new RuntimeException("OtherClass should not be in JAR file"); + } + } +} + +class OtherClass {} diff --git a/test/hotspot/jtreg/runtime/cds/appcds/aotCode/AOTCodeCPUFeatureIncompatibilityTest.java b/test/hotspot/jtreg/runtime/cds/appcds/aotCode/AOTCodeCPUFeatureIncompatibilityTest.java new file mode 100644 index 00000000000..8d1e190d1e3 --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/aotCode/AOTCodeCPUFeatureIncompatibilityTest.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/** + * @test + * @summary CPU feature compatibility test for AOT Code Cache + * @requires vm.cds.supports.aot.code.caching + * @requires vm.compMode != "Xcomp" & vm.compMode != "Xint" + * @requires os.simpleArch == "x64" | os.simpleArch == "aarch64" + * @comment The test verifies AOT checks during VM startup and not code generation. + * No need to run it with -Xcomp. + * @library /test/lib /test/setup_aot + * @build AOTCodeCPUFeatureIncompatibilityTest JavacBenchApp + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar + * JavacBenchApp + * JavacBenchApp$ClassFile + * JavacBenchApp$FileManager + * JavacBenchApp$SourceFile + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AOTCodeCPUFeatureIncompatibilityTest + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import jdk.test.lib.Platform; +import jdk.test.lib.cds.CDSAppTester; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +import jdk.test.whitebox.WhiteBox; +import jdk.test.whitebox.cpuinfo.CPUInfo; + +public class AOTCodeCPUFeatureIncompatibilityTest { + public static void main(String... args) throws Exception { + List cpuFeatures = CPUInfo.getFeatures(); + if (Platform.isX64()) { + // Minimum value of UseSSE required by JVM is 2. So the production run has to be executed with UseSSE=2. + // To simulate the case of incmpatible SSE feature, we can run this test only on system with higher SSE level (sse3 or above). + if (isSSE3Supported(cpuFeatures)) { + testIncompatibleFeature("-XX:UseSSE=2", "sse3"); + } + if (isAVXSupported(cpuFeatures)) { + testIncompatibleFeature("-XX:UseAVX=0", "avx"); + } + } + } + + // vmOption = command line option to disable CPU feature + // featureName = name of the CPU feature used by the JVM in the log messages + public static void testIncompatibleFeature(String vmOption, String featureName) throws Exception { + new CDSAppTester("AOTCodeCPUFeatureIncompatibilityTest") { + @Override + public String[] vmArgs(RunMode runMode) { + if (runMode == RunMode.PRODUCTION) { + return new String[] {vmOption, "-Xlog:aot+codecache+init=debug"}; + } + return new String[] {}; + } + @Override + public void checkExecution(OutputAnalyzer out, RunMode runMode) throws Exception { + if (runMode == RunMode.ASSEMBLY) { + out.shouldMatch("CPU features recorded in AOTCodeCache:.*" + featureName + ".*"); + } else if (runMode == RunMode.PRODUCTION) { + out.shouldMatch("AOT Code Cache disabled: required cpu features are missing:.*" + featureName + ".*"); + out.shouldContain("Unable to use AOT Code Cache"); + } + } + @Override + public String classpath(RunMode runMode) { + return "app.jar"; + } + @Override + public String[] appCommandLine(RunMode runMode) { + return new String[] { + "JavacBenchApp", "10" + }; + } + }.runAOTWorkflow("--two-step-training"); + } + + // Only used on x86-64 platform + static boolean isSSE3Supported(List cpuFeatures) { + return cpuFeatures.contains("sse3"); + } + + // Only used on x86-64 platform + static boolean isAVXSupported(List cpuFeatures) { + return cpuFeatures.contains("avx"); + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestPhaseIRMatching.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestPhaseIRMatching.java index 70e4c463c55..8bec7c03bfe 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestPhaseIRMatching.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestPhaseIRMatching.java @@ -69,8 +69,7 @@ public class TestPhaseIRMatching { List testVMFlags = flagVMProcess.getTestVMFlags(); TestVMProcess testVMProcess = new TestVMProcess(testVMFlags, testClass, null, -1, false, false); TestClassParser testClassParser = new TestClassParser(testClass, false); - Matchable testClassMatchable = testClassParser.parse(testVMProcess.getHotspotPidFileName(), - testVMProcess.getApplicableIRRules()); + Matchable testClassMatchable = testClassParser.parse(testVMProcess.testVmData()); MatchResult result = testClassMatchable.match(); List expectedFails = new ExpectedFailsBuilder().build(testClass); List foundFailures = new FailureBuilder().build(result); diff --git a/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java b/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java index b1f5f74e682..6193b6aad0c 100644 --- a/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java +++ b/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -174,6 +174,46 @@ public class TestPrimitiveTypes { tests.put("test_names", namesTemplate.asToken()); + var abbrevDefTemplate = Template.make("type", (PrimitiveType type) -> scope( + let("CON1", type.con()), + let("CON2", type.con()), + let("abbrev", type.abbrev()), + let("fieldDesc", type.fieldDesc()), + """ + static #type varAbbrev#abbrev = #CON1; + static #type varFieldDesc#fieldDesc = #CON2; + """ + )); + var swapTemplate = Template.make("type", (PrimitiveType type) -> scope( + let("abbrev", type.abbrev()), + let("fieldDesc", type.fieldDesc()), + """ + #type tmp#abbrev = varAbbrev#abbrev; + varAbbrev#abbrev = varFieldDesc#fieldDesc; + varFieldDesc#fieldDesc = tmp#abbrev; + """ + )); + var abbrevTemplate = Template.make(() -> scope( + """ + public static void test_abbrev() { + """, + Hooks.CLASS_HOOK.insert(scope( + // Create fields that would collide if the abbrev() or fieldDesc() methods produced colliding + // strings for different types + CodeGenerationDataNameType.PRIMITIVE_TYPES.stream().map(type -> + abbrevDefTemplate.asToken(type) + ).toList() + )), + CodeGenerationDataNameType.PRIMITIVE_TYPES.stream().map(type -> + swapTemplate.asToken(type) + ).toList(), + """ + } + """ + )); + + tests.put("test_abbrev", abbrevTemplate.asToken()); + // Test runtime random value generation with LibraryRNG // Runtime random number generation of a given primitive type can be very helpful // when writing tests that require random inputs. @@ -231,6 +271,9 @@ public class TestPrimitiveTypes { import compiler.lib.generators.*; public class InnerTest { + """, + Hooks.CLASS_HOOK.anchor(scope( + """ public static void main() { """, // Call all test methods from main. @@ -241,7 +284,8 @@ public class TestPrimitiveTypes { } """, // Now add all the test methods. - tests.values().stream().toList(), + tests.values().stream().toList() + )), """ } """ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001.java index 09fdb1ae3f7..cf840e56c07 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,6 @@ package nsk.jvmti.CompiledMethodUnload; import java.io.*; -import java.math.*; -import java.util.*; import nsk.share.*; import nsk.share.jvmti.*; @@ -93,8 +91,11 @@ public class compmethunload001 { hotCls = null; c = null; - boolean clsUnloaded = clsUnLoader.unloadClass(); - clsUnLoader = null; + // BackgroundCompilation is on by default so wait for compiler threads + // to drop references to the to-be-unloaded class. + if (!clsUnLoader.unloadClassAndWait(10_000)) { + throw new Failure("Class should have been unloaded"); + } } private int runThis(String argv[], PrintStream out) throws Exception { @@ -114,7 +115,7 @@ public class compmethunload001 { num = unloaded(); iter++; if (iter > MAX_ITERATIONS) { - throw new Failure("PRODUCT BUG: class was not unloaded in " + MAX_ITERATIONS); + throw new Failure("PRODUCT BUG: no classunloading callback in " + MAX_ITERATIONS); } } System.out.println("Number of unloaded events " + num + " number of iterations " + iter); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java b/test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java index 5c7d2b8d640..8f473bf60c5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java @@ -33,6 +33,7 @@ import java.util.*; import nsk.share.gc.gp.*; import nsk.share.test.ExecutionController; import nsk.share.test.Stresser; +import jdk.test.lib.Utils; import jdk.test.whitebox.WhiteBox; /** @@ -231,45 +232,49 @@ public class ClassUnloader { * Forces GC to unload previously loaded classes by cleaning all references * to class loader with its loaded classes. * - * @return true if classes unloading has been detected + * @return true if the class has been unloaded or false otherwise * - * @throws Failure if exception other than OutOfMemoryError - * is thrown while triggering full GC - * * @see WhiteBox.getWhiteBox().fullGC() */ - - public static final int MAX_UNLOAD_ATTEMPS = 10; - public boolean unloadClass() { - // free references to class and class loader to be able for collecting by GC classObjects.removeAllElements(); customClassLoader = null; // force class unloading by triggering full GC WhiteBox.getWhiteBox().fullGC(); - int count = 0; - while (count++ < MAX_UNLOAD_ATTEMPS && !isClassLoaderReclaimed()) { - System.out.println("ClassUnloader: waiting for class loader reclaiming... " + count); - WhiteBox.getWhiteBox().fullGC(); - try { - // small delay to give more changes to process objects - // inside VM like jvmti deferred queue - Thread.sleep(100); - } catch (InterruptedException e) { - } - } - // force GC to unload marked class loader and its classes if (isClassLoaderReclaimed()) { System.out.println("ClassUnloader: class loader has been reclaimed."); return true; + } else { + System.out.println("ClassUnloader: class loader is still reachable."); + return false; } + } - // class loader has not been reclaimed - System.out.println("ClassUnloader: class loader is still reachable."); - return false; + /** + * Forces GC to unload previously loaded classes by cleaning all references + * to class loader with its loaded classes and wait for class loader to be reclaimed. + * + * @param timeout max time to wait for class loader to be reclaimed in milliseconds + * @return true if the class has been unloaded + or false otherwise + */ + public boolean unloadClassAndWait(long timeout) { + timeout = Utils.adjustTimeout(timeout); + boolean wasUnloaded; + final long waitTime = 100; + do { + try { + Thread.sleep(waitTime); + } catch (InterruptedException e) { + // ignore + } + timeout -= waitTime; + wasUnloaded = unloadClass(); + } while (!wasUnloaded && timeout > 0); + return wasUnloaded; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/AbstractDebuggeeTest.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/AbstractDebuggeeTest.java index 74516fd5a69..ec4dcd87d67 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/AbstractDebuggeeTest.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/AbstractDebuggeeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -153,7 +153,18 @@ public class AbstractDebuggeeTest { ClassUnloader classUnloader = loadedClasses.get(className); if (classUnloader != null) { - boolean wasUnloaded = classUnloader.unloadClass(); + boolean wasUnloaded; + if (expectedUnloadingResult) { + // We expect unloading to succeed. Retry multiple times because + // the debug agent creates global references (NewGlobalRef) + // when handling ClassPrepare events. These global references + // are released only by the agent thread, whose scheduling can + // be delayed, causing class unloading to occur later than + // expected. + wasUnloaded = classUnloader.unloadClassAndWait(10_000); + } else { + wasUnloaded = classUnloader.unloadClass(); + } if (wasUnloaded) loadedClasses.remove(className); diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 94015ebc680..070f9b0ce03 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -223,6 +223,7 @@ sun/awt/shell/ShellFolderMemoryLeak.java 8197794 windows-all sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java 8196102 generic-all sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java 8196180 windows-all,macosx-all sun/java2d/OpenGL/OpaqueDest.java#id1 8367574 macosx-all +sun/java2d/OpenGL/ScaleParamsOOB.java#id0 8377908 linux-all sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java 8144029 macosx-all,linux-all sun/java2d/SunGraphics2D/DrawImageBilinear.java 8297175 linux-all sun/java2d/SunGraphics2D/PolyVertTest.java 6986565 generic-all diff --git a/test/jdk/com/sun/jndi/ldap/SaslOutputStreamCloseTest.java b/test/jdk/com/sun/jndi/ldap/SaslOutputStreamCloseTest.java new file mode 100644 index 00000000000..5558a4ab196 --- /dev/null +++ b/test/jdk/com/sun/jndi/ldap/SaslOutputStreamCloseTest.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.lang.reflect.Constructor; + +import javax.security.sasl.SaslClient; +import javax.security.sasl.SaslException; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.fail; + +/* + * @test + * @bug 8377486 + * @summary Verify that SaslOutputStream.write() methods throw an IOException, if invoked + * when the stream is closed + * @modules java.security.sasl/com.sun.security.sasl + * java.naming/com.sun.jndi.ldap.sasl:+open + * @run junit ${test.main.class} + */ +class SaslOutputStreamCloseTest { + + /* + * Verifies that SaslOutputStream.write(...) throws IOException if the SaslOutputStream + * is closed. + */ + @Test + void testWriteThrowsIOExceptionOnClose() throws Exception { + try (final OutputStream os = createSaslOutputStream(new ByteArrayOutputStream())) { + os.write(new byte[]{0x42, 0x42}); + os.close(); + try { + os.write(new byte[]{0x42}, 0, 1); + fail("OutputStream.write(...) on closed " + os + " did not throw IOException"); + } catch (IOException ioe) { + // verify it was thrown for right reason + if (!"stream closed".equals(ioe.getMessage())) { + throw ioe; // propagate original exception + } + // expected + System.err.println("received expected IOException: " + ioe); + } + } + } + + // reflectively construct an instance of + // (package private) com.sun.jndi.ldap.sasl.SaslOutputStream class + private static OutputStream createSaslOutputStream(final OutputStream underlying) throws Exception { + final Constructor constructor = Class.forName("com.sun.jndi.ldap.sasl.SaslOutputStream") + .getDeclaredConstructor(new Class[]{SaslClient.class, OutputStream.class}); + constructor.setAccessible(true); + return (OutputStream) constructor.newInstance(new DummySaslClient(), underlying); + } + + + private static final class DummySaslClient implements SaslClient { + private boolean closed; + + @Override + public String getMechanismName() { + return "DUMMY"; + } + + @Override + public boolean hasInitialResponse() { + return false; + } + + @Override + public byte[] evaluateChallenge(byte[] challenge) throws SaslException { + return new byte[0]; + } + + @Override + public boolean isComplete() { + return true; + } + + @Override + public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException { + if (closed) { + // intentionally throw something other than a IOException + throw new IllegalStateException(this + " is closed"); + } + return incoming; + } + + @Override + public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException { + if (closed) { + // intentionally throw something other than a IOException + throw new IllegalStateException(this + " is closed"); + } + return outgoing; + } + + @Override + public Object getNegotiatedProperty(String propName) { + return null; + } + + @Override + public void dispose() { + this.closed = true; + } + } +} diff --git a/test/jdk/com/sun/net/httpserver/FailAndStopTest.java b/test/jdk/com/sun/net/httpserver/FailAndStopTest.java new file mode 100644 index 00000000000..005d78add18 --- /dev/null +++ b/test/jdk/com/sun/net/httpserver/FailAndStopTest.java @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8377302 + * @summary HttpServer.stop() blocks indefinitely if handler throws + * @modules jdk.httpserver java.logging + * @library /test/lib + * @run main/othervm ${test.main.class} + */ + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.Optional; +import java.util.function.BiPredicate; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; +import com.sun.net.httpserver.HttpsConfigurator; +import com.sun.net.httpserver.HttpsServer; +import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; +import jdk.test.lib.Utils; +import static com.sun.net.httpserver.HttpExchange.RSPBODY_CHUNKED; + +public class FailAndStopTest implements HttpHandler { + // Keep that logger in a static field to make sure it doesn't + // get GC'ed and recreated before the HttpServer is initialized. + private static final Logger LOGGER = Logger.getLogger("com.sun.net.httpserver"); + private static final String BODY = "OK"; + + static enum TestCases { + FAILNOW("failNow", TestCases::shouldAlwaysFail), + ASSERTNOW("assertNow", TestCases::shouldAlwaysFail), + RESPANDFAIL("failAfterResponseStatus", TestCases::shouldFailExceptForHead), + RESPANDASSERT("assertAfterResponseStatus", TestCases::shouldFailExceptForHead), + CLOSEAFTERRESP("closeExchangeAfterResponseStatus", TestCases::shouldFailExceptForHead), + BODYANDFAIL("failAfterBody", TestCases::shouldFailExceptForHeadOrHttps), + BODYANDASSERT("assertAfterBody", TestCases::shouldFailExceptForHeadOrHttps), + CLOSEBEFOREOS("closeExchangeBeforeOS", TestCases::shouldNeverFail), + CLOSEANDRETURN("closeAndReturn", TestCases::shouldNeverFail), + CLOSEANDFAIL("closeAndFail", TestCases::shouldNeverFail), + CLOSEANDASSERT("closeAndAssert", TestCases::shouldNeverFail); + + private final String query; + private BiPredicate shouldFail; + TestCases(String query, BiPredicate shouldFail) { + this.query = query; + this.shouldFail = shouldFail; + } + boolean shouldFail(String scheme, String method) { + // in case of HEAD method the client should not + // fail if we throw after sending response headers + return shouldFail.test(scheme, method); + } + private static boolean shouldAlwaysFail(String scheme, String method) { + return true; + } + private static boolean shouldNeverFail(String scheme, String method) { + return false; + } + private static boolean shouldFailExceptForHead(String scheme, String method) { + return !"HEAD".equals(method); + } + private static boolean shouldFailExceptForHeadOrHttps(String scheme, String method) { + // When using https, the buffered response bytes may be sent + // when the connection is closed, in which case the full body + // will be correctly received, and the client connection + // will not fail. With plain http, the bytes are not sent and + // the client fails with premature end of file. + return !"HEAD".equals(method) && !"https".equalsIgnoreCase(scheme); + } + + } + + @Override + public void handle(HttpExchange ex) throws IOException { + String query = ex.getRequestURI().getRawQuery(); + TestCases step = TestCases.FAILNOW; + if (query == null || query.equals(step.query)) { + System.out.println("Server: " + step); + throw new NullPointerException("Got you!"); + } + step = TestCases.ASSERTNOW; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new AssertionError("Got you!"); + } + byte[] body = BODY.getBytes(StandardCharsets.UTF_8); + ex.sendResponseHeaders(200, body.length); + step = TestCases.RESPANDFAIL; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new NullPointerException("Got you!"); + } + step = TestCases.RESPANDASSERT; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new AssertionError("Got you!"); + } + step = TestCases.CLOSEAFTERRESP; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + ex.close(); + return; + } + if (!"HEAD".equals(ex.getRequestMethod())) { + ex.getResponseBody().write(body); + } + step = TestCases.BODYANDFAIL; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new NullPointerException("Got you!"); + } + step = TestCases.BODYANDASSERT; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new AssertionError("Got you!"); + } + step = TestCases.CLOSEBEFOREOS; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + ex.close(); + return; + } + System.out.println("Server: closing response body"); + ex.getResponseBody().close(); + step = TestCases.CLOSEANDRETURN; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + ex.close(); + return; + } + step = TestCases.CLOSEANDFAIL; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new NullPointerException("Got you!"); + } + step = TestCases.CLOSEANDASSERT; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new AssertionError("Got you!"); + } + } + + private static void enableHttpServerLogging() { + // set HttpServer's logger to ALL + LOGGER.setLevel(Level.ALL); + // get the root logger, get its first handler (by default + // it's a ConsoleHandler), and set its level to ALL (by + // default its level is INFO). + Logger.getLogger("").getHandlers()[0].setLevel(Level.ALL); + } + + + public static void main(String[] args) throws Exception { + + enableHttpServerLogging(); + + // test with GET + for (var test : TestCases.values()) { + test(test, Optional.empty(), "http"); + test(test, Optional.empty(), "https"); + } + // test with HEAD + for (var test : TestCases.values()) { + test(test, Optional.of("HEAD"), "http"); + test(test, Optional.of("HEAD"), "https"); + } + } + + private static SSLContext initSSLContext(boolean secure) { + SSLContext context = secure ? SimpleSSLContext.findSSLContext() : null; + if (secure) { + SSLContext.setDefault(context); + } + return context; + } + + private static HttpServer createHttpServer(SSLContext context) throws IOException { + var address = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); + if (context != null) { + var server = HttpsServer.create(address, 0); + server.setHttpsConfigurator(new HttpsConfigurator(context)); + return server; + } else { + return HttpServer.create(address, 0); + } + } + + private static HttpURLConnection createConnection(URL url, boolean secure) + throws IOException { + HttpURLConnection urlc = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY); + if (secure) { + ((HttpsURLConnection)urlc).setHostnameVerifier(new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + } + return urlc; + } + + private static void test(TestCases test, Optional method, String scheme) + throws Exception { + boolean secure = "https".equalsIgnoreCase(scheme); + SSLContext context = initSSLContext(secure); + HttpServer server = createHttpServer(context); + + System.out.println("Test: " + method.orElse("GET") + " " + test.query); + System.out.println("Server listening at: " + server.getAddress()); + try { + server.createContext("/FailAndStopTest/", new FailAndStopTest()); + server.start(); + + URL url = URIBuilder.newBuilder() + .scheme(scheme) + .loopback() + .port(server.getAddress().getPort()) + .path("/FailAndStopTest/") + .query(test.query) + .toURLUnchecked(); + System.out.println("Connecting to: " + url); + HttpURLConnection urlc = createConnection(url, secure); + if (method.isPresent()) urlc.setRequestMethod(method.get()); + try { + System.out.println("Client: Response code received: " + urlc.getResponseCode()); + InputStream is = urlc.getInputStream(); + String body = new String(is.readAllBytes(), StandardCharsets.UTF_8); + is.close(); + System.out.printf("Client: read body: \"%s\"%n", body); + if (test.shouldFail(scheme, urlc.getRequestMethod())) { + throw new AssertionError(test.query + ": test did not fail"); + } + if (!method.orElse("GET").equals("HEAD")) { + if (!BODY.equals(body)) { + throw new AssertionError( + String.format("\"%s\" != \"%s\"", body, BODY)); + } + } else if (!body.isEmpty()) { + throw new AssertionError("Body is not empty: " + body); + } + } catch (IOException so) { + if (test.shouldFail(scheme, urlc.getRequestMethod())) { + // expected + System.out.println(test.query + ": Got expected exception: " + so); + } else if (!test.shouldFail("http", urlc.getRequestMethod())) { + // When using https, the buffered response bytes may be sent + // when the connection is closed, in which case the full body + // will be correctly received, and the client connection + // will not fail. With plain http, the bytes are not sent and + // the client fails with premature end of file. + // So only fail here if the test should not fail with plain + // http - we want to accept possible exception for https... + throw new AssertionError( + String.format("%s: test failed with %s", test.query, so), so); + } else { + System.out.printf("%s: WARNING: unexpected exception: %s%n", test.query, so); + // should only happen in those two cases: + assert secure && !"HEAD".equals(method) && + (test == TestCases.BODYANDFAIL || test == TestCases.BODYANDASSERT); + } + } + } finally { + // if not fixed will cause the test to fail in jtreg timeout + server.stop((int)Utils.adjustTimeout(5000)); + System.out.println("Server stopped as expected"); + } + } +} diff --git a/test/jdk/java/awt/geom/Arc2D/Arc2DGetBoundsTest.java b/test/jdk/java/awt/geom/Arc2D/Arc2DGetBoundsTest.java new file mode 100644 index 00000000000..983c4583708 --- /dev/null +++ b/test/jdk/java/awt/geom/Arc2D/Arc2DGetBoundsTest.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4197755 + * @summary Verifies that Arc2D.getBounds() is similar to Arc2D.getBounds2D() + */ + +import java.awt.geom.Arc2D; +import java.awt.geom.Point2D; +import java.util.ArrayList; +import java.util.List; + +public class Arc2DGetBoundsTest { + public static void main(String[] args) { + // Imagine a circle that represents a compass. + // This arc represents the northern / top quarter. + Arc2D arc = new Arc2D.Double(0, 0, 1000, 1000, 45, 90, Arc2D.PIE); + + // Create 8 pie slices, and place a dot in the center of each + List samples = new ArrayList<>(); + for (int segment = 0; segment < 8; segment++) { + double theta = -(segment + .5) / 8.0 * 2 * Math.PI; + Point2D p = new Point2D.Double( + 500 + 100 * Math.cos(theta), + 500 + 100 * Math.sin(theta) + ); + samples.add(p); + } + + // these assertions have never been known to fail: + assertTrue(!arc.contains(samples.get(0))); + assertTrue(arc.contains(samples.get(1))); + assertTrue(arc.contains(samples.get(2))); + assertTrue(!arc.contains(samples.get(3))); + assertTrue(!arc.contains(samples.get(4))); + assertTrue(!arc.contains(samples.get(5))); + assertTrue(!arc.contains(samples.get(6))); + assertTrue(!arc.contains(samples.get(7))); + + assertTrue(arc.getBounds2D().contains(samples.get(0))); + assertTrue(arc.getBounds2D().contains(samples.get(1))); + assertTrue(arc.getBounds2D().contains(samples.get(2))); + assertTrue(arc.getBounds2D().contains(samples.get(3))); + assertTrue(!arc.getBounds2D().contains(samples.get(4))); + assertTrue(!arc.getBounds2D().contains(samples.get(5))); + assertTrue(!arc.getBounds2D().contains(samples.get(6))); + assertTrue(!arc.getBounds2D().contains(samples.get(7))); + + + assertTrue(arc.getBounds().contains(samples.get(0))); + assertTrue(arc.getBounds().contains(samples.get(1))); + assertTrue(arc.getBounds().contains(samples.get(2))); + assertTrue(arc.getBounds().contains(samples.get(3))); + + // these are the assertions that failed before resolving 4197755 + assertTrue(!arc.getBounds().contains(samples.get(4))); + assertTrue(!arc.getBounds().contains(samples.get(5))); + assertTrue(!arc.getBounds().contains(samples.get(6))); + assertTrue(!arc.getBounds().contains(samples.get(7))); + } + + private static void assertTrue(boolean b) { + if (!b) + throw new Error(); + } +} diff --git a/test/jdk/java/io/FileDescriptor/Sharing.java b/test/jdk/java/io/FileDescriptor/Sharing.java index 24f4fb70b02..e4ceb2d6906 100644 --- a/test/jdk/java/io/FileDescriptor/Sharing.java +++ b/test/jdk/java/io/FileDescriptor/Sharing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,14 @@ * @run main/othervm Sharing */ -import java.io.*; +import java.io.File; +import java.io.FileDescriptor; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.io.Writer; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; import java.util.concurrent.CountDownLatch; @@ -71,7 +78,7 @@ public class Sharing { // encourage gc System.gc(); // read from fis2 - when fis1 is gc'ed and finalizer is run, read will fail - System.out.print("."); + System.err.print("."); ret = fis2.read(); } } @@ -93,7 +100,7 @@ public class Sharing { * read from fis3 - when raf is gc'ed and finalizer is run, * fd should still be valid. */ - System.out.print("."); + System.err.print("."); ret = fis3.read(); } } finally { @@ -290,7 +297,7 @@ public class Sharing { FileInputStream fis = new FileInputStream(raf.getFD()); fis.close(); if (raf.getFD().valid()) { - throw new RuntimeException("FD should not be valid."); + throw new RuntimeException("FD should not be valid."); } // Test the suppressed exception handling - FileInputStream @@ -308,7 +315,7 @@ public class Sharing { ioe.printStackTrace(); if (ioe.getSuppressed().length != 2) { throw new RuntimeException("[FIS]Incorrect number of suppressed " + - "exceptions received : " + ioe.getSuppressed().length); + "exceptions received : " + ioe.getSuppressed().length); } } if (raf.getFD().valid()) { @@ -332,7 +339,7 @@ public class Sharing { ioe.printStackTrace(); if (ioe.getSuppressed().length != 2) { throw new RuntimeException("[FOS]Incorrect number of suppressed " + - "exceptions received : " + ioe.getSuppressed().length); + "exceptions received : " + ioe.getSuppressed().length); } } if (raf.getFD().valid()) { @@ -347,10 +354,8 @@ public class Sharing { * FileOutputStreams referencing the same native file descriptor. */ private static class OpenClose extends Thread { - private FileDescriptor fd = null; - private CountDownLatch done; - FileInputStream[] fisArray = new FileInputStream[numFiles]; - FileOutputStream[] fosArray = new FileOutputStream[numFiles]; + private final FileDescriptor fd; + private final CountDownLatch done; OpenClose(FileDescriptor filedescriptor, CountDownLatch done) { this.fd = filedescriptor; @@ -358,29 +363,32 @@ public class Sharing { } public void run() { - try { - for(int i=0;i 0) { System.err.println("Testing the hyperbolic functions incurred " @@ -1732,4 +1733,372 @@ public class HyperbolicTests { failures += Tests.testUlpDiffWithAbsBound("StrictMath.asinh", -input, StrictMath::asinh, -expected, ulps, Double.NEGATIVE_INFINITY); return failures; } + + /** + * Test accuracy of {Math, StrictMath}.acosh. The specified + * accuracy is 2.5 ulps. + * + * The defintion of acosh(x) is + * + * acosh(cosh(x)) = x + * + * Can be also written as + * + * acosh(x) = ln(x + sqrt(x * x - 1)) + * + * The series expansion of acosh(x) = + * + * ln(2 * x) - (x^-2 / 4 + 3 * x^-4 / 32 + 15 * x^-6 / 288 ...) + * + * Therefore, + * + * 1. acosh(1) = 0. + * + * 2. The domain is x >= 1. + * + * 3. The function is neither odd nor even. + * + */ + static int testAcosh() { + int failures = 0; + /* + * Array elements below generated using a quad acosh + * implementation. Rounded to a double, the quad result + * *should* be correctly rounded, unless we are quite unlucky. + * Assuming the quad value is a correctly rounded double, the + * allowed error is 3.0 ulps instead of 2.5 since the quad + * value rounded to double can have its own 1/2 ulp error. + */ + double [][] testCases = { + // x acosh(x) + {1.0000, +0.00000000000000000000000000000000000e+00 }, + {1.0625, +3.51737390043260579770744786121122844e-01 }, + {1.1250, +4.94932923094526905889563099576718556e-01 }, + {1.1875, +6.03186598686334413155297365190676416e-01 }, + {1.2500, +6.93147180559945309417232121458176575e-01 }, + {1.3125, +7.71307459173256653700937951825817144e-01 }, + {1.3750, +8.41019322011445738489485196126304665e-01 }, + {1.4375, +9.04286762705515769042139988689583282e-01 }, + {1.5000, +9.62423650119206894995517826848736845e-01 }, + {1.5625, +1.01634809667840380541358127166594224e+00 }, + {1.6250, +1.06673243190143557362309154628644597e+00 }, + {1.6875, +1.11408700135293645158376433073169476e+00 }, + {1.7500, +1.15881036042994681173087299087873020e+00 }, + {1.8125, +1.20122101997969472087682270695675759e+00 }, + {1.8750, +1.24157842330772117651284669611837885e+00 }, + {1.9375, +1.28009731675807455651225000558265526e+00 }, + {2.0000, +1.31695789692481670862504634730796848e+00 }, + {2.0625, +1.35231316261931093541047819670045078e+00 }, + {2.1250, +1.38629436111989061883446424291635315e+00 }, + {2.1875, +1.41901510140371506613255066437684651e+00 }, + {2.2500, +1.45057451382258020872826178236677635e+00 }, + {2.3125, +1.48105971405608381331792780208719133e+00 }, + {2.3750, +1.51054775047320739150161777699985299e+00 }, + {2.4375, +1.53910716184424377297903295285722198e+00 }, + {2.5000, +1.56679923697241107866405686258048358e+00 }, + {2.5625, +1.59367904336440765353731339657532894e+00 }, + {2.6250, +1.61979627485649999465013597110633349e+00 }, + {2.6875, +1.64519595581279452177517379518794699e+00 }, + {2.7500, +1.66991903058776998677838891147712239e+00 }, + {2.8125, +1.69400286038199600062127876942753998e+00 }, + {2.8750, +1.71748164473336519458386901818676709e+00 }, + {2.9375, +1.74038678120611400701568860843885133e+00 }, + {3.0000, +1.76274717403908605046521864995958460e+00 }, + {3.0625, +1.78458950036205246630242932084698860e+00 }, + {3.1250, +1.80593844091928647006641838950547765e+00 }, + {3.1875, +1.82681688093354809536648865402886324e+00 }, + {3.2500, +1.84724608571383784130004129627716938e+00 }, + {3.3125, +1.86724585479221893347421970944127165e+00 }, + {3.3750, +1.88683465772058517690549455261749833e+00 }, + {3.4375, +1.90602975413127236084850555002346490e+00 }, + {3.5000, +1.92484730023841378999103565369747369e+00 }, + {3.5625, +1.94330244360892107348697778473632964e+00 }, + {3.6250, +1.96140940774674480423275041043129955e+00 }, + {3.6875, +1.97918156779907568924375778194574535e+00 }, + {3.7500, +1.99663151849857170393899871209510294e+00 }, + {3.8125, +2.01377113529382496280930762219993708e+00 }, + {3.8750, +2.03061162948500957172739654092925159e+00 }, + {3.9375, +2.04716359806812267677620352283230977e+00 }, + {4.0000, +2.06343706889556054672728117262013178e+00 }, + {4.0625, +2.07944154167983592825169636437452953e+00 }, + {4.1250, +2.09518602529851747179664246793750599e+00 }, + {4.1875, +2.11067907179990670152964344211957784e+00 }, + {4.2500, +2.12592880745889053593506179143141713e+00 }, + {4.3125, +2.14094296118944770996055814756135545e+00 }, + {4.3750, +2.15572889058331846311473049052403906e+00 }, + {4.4375, +2.17029360581243752070499251797833202e+00 }, + {4.5000, +2.18464379160510872667627813307212784e+00 }, + {4.5625, +2.19878582748192321247116242073983256e+00 }, + {4.6250, +2.21272580641655511554559532685274022e+00 }, + {4.6875, +2.22646955206835990390469193746457694e+00 }, + {4.7500, +2.24002263471777221819301091423172581e+00 }, + {4.8125, +2.25339038602153389445857144762743321e+00 }, + {4.8750, +2.26657791269250866199452039018610592e+00 }, + {4.9375, +2.27959010919802897270925407255393153e+00 }, + {5.0000, +2.29243166956117768780078731134801529e+00 }, + {5.0625, +2.30510709834096668441430402487399027e+00 }, + {5.1250, +2.31762072085989362346174598175746039e+00 }, + {5.1875, +2.32997669274071514661824152082627607e+00 }, + {5.2500, +2.34217900880836474718960439585388779e+00 }, + {5.3125, +2.35423151140767607019354831300009086e+00 }, + {5.3750, +2.36613789818286932753788120137389157e+00 }, + {5.4375, +2.37790172936055222645518871553565388e+00 }, + {5.5000, +2.38952643457421860822386165703818122e+00 }, + {5.5625, +2.40101531926484683717268315699636478e+00 }, + {5.6250, +2.41237157068916138816151585667001780e+00 }, + {5.6875, +2.42359826356438621752612199535640197e+00 }, + {5.7500, +2.43469836537585339202679859270163341e+00 }, + {5.8125, +2.44567474137160531324234100032920604e+00 }, + {5.8750, +2.45653015926611756205299063862500772e+00 }, + {5.9375, +2.46726729367344889723552955806057589e+00 }, + {6.0000, +2.47788873028847500481395074507450545e+00 }, + {6.0625, +2.48839696983336532007430913631752335e+00 }, + {6.1250, +2.49879443178510181484789673802222733e+00 }, + {6.1875, +2.50908345789860105234876846349648239e+00 }, + {6.2500, +2.51926631553887363826303725428234388e+00 }, + {6.3125, +2.52934520083462740598919885177286592e+00 }, + {6.3750, +2.53932224166478245066792464622248188e+00 }, + {6.4375, +2.54919950048850872717547586051387259e+00 }, + {6.5000, +2.55897897702861255144554182625683448e+00 }, + {6.5625, +2.56866261081738002442374329274624674e+00 }, + {6.6250, +2.57825228361332690085894009323471199e+00 }, + {6.6875, +2.58774982169670016849316580209717247e+00 }, + {6.7500, +2.59715699805102158059159611581476354e+00 }, + {6.8125, +2.60647553443745310075195298905494613e+00 }, + {6.8750, +2.61570710336829463210497297146055746e+00 }, + {6.9375, +2.62485332998549187571842397668306463e+00 }, + {7.0000, +2.63391579384963341725009269461593696e+00 }, + {7.0625, +2.64289603064454821939888620389440586e+00 }, + {7.1250, +2.65179553380227492960508448932353394e+00 }, + {7.1875, +2.66061575605286038291043830648413625e+00 }, + {7.2500, +2.66935811090315420323249076787858338e+00 }, + {7.3125, +2.67802397404849750222123152071366765e+00 }, + {7.3750, +2.68661468472095454727243455865687717e+00 }, + {7.4375, +2.69513154697750528856415868272675449e+00 }, + {7.5000, +2.70357583093140231733394963705451385e+00 }, + {7.5625, +2.71194877392969682611305770501597479e+00 }, + {7.6250, +2.72025158167975322903284501674667068e+00 }, + {7.6875, +2.72848542932740015820479864569947040e+00 }, + {7.7500, +2.73665146248920556040148045776356816e+00 }, + {7.8125, +2.74475079824121464549309272530654441e+00 }, + {7.8750, +2.75278452606635063332660947345292156e+00 }, + {7.9375, +2.76075370876254883072567909046267813e+00 }, + {8.0000, +2.76865938331357383273200140938374547e+00 }, + {8.0625, +2.77650256172435692961336760207948251e+00 }, + {8.1250, +2.78428423182258551535630273235901386e+00 }, + {8.1875, +2.79200535802817788553087801705861609e+00 }, + {8.2500, +2.79966688209218477865004528925200022e+00 }, + {8.3125, +2.80726972380657289240925980113428074e+00 }, + {8.3750, +2.81481478168626496869015857854363587e+00 }, + {8.4375, +2.82230293362473549711106510083524230e+00 }, + {8.5000, +2.82973503752439027536610108611637391e+00 }, + {8.5625, +2.83711193190289165307916749543060640e+00 }, + {8.6250, +2.84443443647652896774770544175385075e+00 }, + {8.6875, +2.85170335272167517356988163822694873e+00 }, + {8.7500, +2.85891946441531570520913194770155741e+00 }, + {8.8125, +2.86608353815558396737111566993889866e+00 }, + {8.8750, +2.87319632386318927416511462539646535e+00 }, + {8.9375, +2.88025855526457737300290165271813925e+00 }, + {9.0000, +2.88727095035762068498655348054621044e+00 }, + {9.0625, +2.89423421186059490016531823326821096e+00 }, + {9.1250, +2.90114902764516041745652356473355270e+00 }, + {9.1875, +2.90801607115403116308966232802812480e+00 }, + {9.2500, +2.91483600180397941677005500735563642e+00 }, + {9.3125, +2.92160946537479329008903038647778851e+00 }, + {9.3750, +2.92833709438477331505751565470704144e+00 }, + {9.4375, +2.93501950845332609861824133070706912e+00 }, + {9.5000, +2.94165731465118607612817277397561825e+00 }, + {9.5625, +2.94825110783877095494122437627939968e+00 }, + {9.6250, +2.95480147099315238696389016790268450e+00 }, + {9.6875, +2.96130897552410066125326263536732120e+00 }, + {9.7500, +2.96777418157964068500790378422486329e+00 }, + {9.8125, +2.97419763834153614964672155497739057e+00 }, + {9.8750, +2.98057988431109948901325801645778406e+00 }, + {9.9375, +2.98692144758570696460723739938555692e+00 }, + {10.0000, +2.99322284612638089791266771377418276e+00 }, + }; + + + for (double [] testCase : testCases) { + failures += testAcoshCaseWithUlpDiff(testCase[0], + testCase[1], + 3.0); + } + + + + for (double nan : Tests.NaNs) { + failures += testAcoshCaseWithUlpDiff(nan, NaNd, 0); + } + + + + double [][] specialTestCases = { + {0.0, NaNd}, + {-0.0, NaNd}, + {1.0, 0.0}, + {Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY}, + {Double.NEGATIVE_INFINITY, NaNd} + }; + + + + for (double [] specialTestCase : specialTestCases) { + failures += testAcoshCaseWithUlpDiff(specialTestCase[0], + specialTestCase[1], + 0.0); + } + + + failures += testAcoshAdditionalTests(); + + return failures; + } + + /** + * Test accuracy of {Math, StrictMath}.acosh using quad precision + * acosh implementation as the reference. There are additional tests. + * The specified accuracy is 2.5 ulps. + * + */ + static int testAcoshAdditionalTests() { + int failures = 0; + /* + * Array elements below are generated using a quad precision acosh + * implementation (libquadmath). Rounded to a double, the quad result + * *should* be correctly rounded, unless we are quite unlucky. + * Assuming the quad value is a correctly rounded double, the + * allowed error is 3.0 ulps instead of 2.5 since the quad + * value rounded to double can have its own 1/2 ulp error. + */ + double[][] testCases = { + // x acosh(x) + {+1.40222409861373051853661308996379375e+01 , +3.33251799248457675610296187717275023e+00 }, + {+4.64063630702987595100239559542387724e+01 , +4.53046765794427717250009108708063951e+00 }, + {+2.26769594350354175560369185404852033e+01 , +3.81401008174403012773998497198756862e+00 }, + {+6.82076069573278687130368780344724655e+01 , +4.91564953670154039555101045371992145e+00 }, + {+9.35345967264471340740783489309251308e+01 , +5.23144999004817476451595194893686997e+00 }, + {+5.24222208302520016331982333213090897e+01 , +4.65238675892723943927493345614044802e+00 }, + {+4.42263893601989721560130419675260782e+00 , +2.16685013650055071552269762531726701e+00 }, + {+5.34403191209646664106003299821168184e+01 , +4.67162513077968730816736013866320559e+00 }, + {+1.76212042009831870714720025716815144e+00 , +1.16720688415256589829633745537084420e+00 }, + {+7.61738148899418732185040425974875689e+00 , +2.71924321506064362327407359954437453e+00 }, + {+6.89904985284954790358824538998305798e+01 , +4.92706344460967378866907640972706781e+00 }, + {+9.31132130019995969405499636195600033e+01 , +5.22693444138174309022758439394131022e+00 }, + {+5.31659489982307036370912101119756699e+01 , +4.66647685890886539018247877652269347e+00 }, + {+6.57379772558717405672723543830215931e+01 , +4.87876612392399046931262815776348806e+00 }, + {+7.04178688554184901704502408392727375e+01 , +4.94754380999195554008986754487841587e+00 }, + {+7.64576059598647788106973166577517986e+01 , +5.02984082858162069509313975886000718e+00 }, + {+5.69898682524488275902285749907605350e+00 , +2.42564775130097776080234839595030019e+00 }, + {+3.34951883898407629658322548493742943e+01 , +4.20432607363489310218001177932001376e+00 }, + {+7.58846381271260241874188068322837353e+01 , +5.02231803118503396528914607189891829e+00 }, + {+3.71685284182660993224089907016605139e+01 , +4.30842856158112686719805147741579474e+00 }, + {+9.82724783457824031529526109807193279e+01 , +5.28086530470046881951663865035216936e+00 }, + {+7.55822276853527057483006501570343971e+01 , +5.01832458735915146090685859231899627e+00 }, + {+8.19590239920287544350685493554919958e+00 , +2.79303880830104526461764198808709567e+00 }, + {+8.85860057527683011358021758496761322e+01 , +5.17708921820009272972577332594088089e+00 }, + {+4.42047291460483080527410493232309818e+01 , +4.48185099473614683233384262644114551e+00 }, + {+4.82954447467224099455052055418491364e+01 , +4.57037722443775069839008053496876858e+00 }, + {+2.82157771675713533454654680099338293e+01 , +4.03271430903366741210592839999395032e+00 }, + {+1.74842128192706276479384541744366288e+01 , +3.55362672330870909254873232512209322e+00 }, + {+8.98679723864892281426364206708967686e+01 , +5.19145784395917044408731940940225234e+00 }, + {+6.99586842581785273154082460678182542e+00 , +2.63331927275597158625520354348567456e+00 }, + {+5.09477665985264778214514080900698900e+01 , +4.62385177612510228171242777653641979e+00 }, + {+3.25842611674598501281252538319677114e+01 , +4.17674101901473628570827854743466486e+00 }, + {+4.99036918354616290116609889082610607e+01 , +4.60314176379122016396592518510391469e+00 }, + {+9.98255656348235120844947232399135828e+00 , +2.99146816849131388203109739268493125e+00 }, + {+8.30115844701927940718633180949836969e+00 , +2.80589439276611715849813780991570715e+00 }, + {+3.90300726488373044276158907450735569e+01 , +4.35731547033614744103231173076054669e+00 }, + {+9.14679267650316347726402455009520054e+01 , +5.20910568139874158502888666687786843e+00 }, + {+4.69801366698952662659394263755530119e+01 , +4.54275878054294975578025810303600533e+00 }, + {+5.95831438716205052941177200409583747e+00 , +2.47081727711668636777886134527797777e+00 }, + {+7.72502501531925105382470064796507359e+01 , +5.04015543904862200893429166398240913e+00 }, + {+1.34111721821950098387787875253707170e+01 , +3.28784240452352224920507313116967307e+00 }, + {+6.91570748043642566926791914738714695e+01 , +4.92947526860125472538045310739830979e+00 }, + {+6.33247983942767831422315794043242931e+01 , +4.84136184327272941501425426966065239e+00 }, + {+7.28157878674183933753738529048860073e+01 , +4.98103282444372675567185179132668151e+00 }, + {+8.89686491926590150569609249942004681e+01 , +5.18139964655774166552638928730792362e+00 }, + {+3.13258612573789463340290240012109280e+01 , +4.13733631620326521460511053592093813e+00 }, + {+5.18140965157089325998640561010688543e+01 , +4.64071629304849263117175976059711265e+00 }, + {+8.47521744710507647369013284333050251e+01 , +5.13284377741645310577993893073249440e+00 }, + {+8.43095533174532931752764852717518806e+01 , +5.12760719138905245783659501854598879e+00 }, + {+4.21240669274286076984026294667273760e+01 , +4.43362549935510675489581351410263443e+00 }, + {+4.73238194816935475728314486332237720e+01 , +4.55004928385543400029944037596031391e+00 }, + {+1.86544426645817758014800347154960036e+01 , +3.61851232034069491499592508470176552e+00 }, + {+5.75938262601410571051019360311329365e+01 , +4.74648718281138202967444216845950983e+00 }, + {+4.27232167589609090896374254953116179e+00 , +2.13131771884641485793724599940809626e+00 }, + {+5.03495317868001706074210233055055141e+01 , +4.61203786952239923442865869830624998e+00 }, + {+7.50809724725515792442820384167134762e+01 , +5.01166999309632169153897035236491293e+00 }, + {+8.91830106756043647919796057976782322e+01 , +5.18380630497515107426424373476548239e+00 }, + {+8.43619216604083419497328577563166618e+01 , +5.12822818585720472109565051928260461e+00 }, + {+2.20623999405381177041363116586580873e+01 , +3.78650797260310183157107999251647380e+00 }, + {+1.39122989185065399908580729970708489e+01 , +3.32462629189603078991830801184905350e+00 }, + {+2.81842266001629120353300095302984118e+01 , +4.03159479043564760795745665884328416e+00 }, + {+4.20150330398823186328627343755215406e+01 , +4.43103301227168439924256715079001048e+00 }, + {+7.12721396815986594219793914817273617e+01 , +4.95960346484961706088932387548050013e+00 }, + {+2.47511696812483386054282163968309760e+01 , +3.90161159523447275422094662483857801e+00 }, + {+3.24364140945400691862232633866369724e+01 , +4.17219116407069688318499622366971673e+00 }, + {+6.55538099356552947938325814902782440e+01 , +4.87596033055444598453664902130389245e+00 }, + {+6.84532751547124860280746361240744591e+01 , +4.91924522217897758728929410442650248e+00 }, + {+3.93848083647737539081390423234552145e+01 , +4.36636613965538581613443666385597861e+00 }, + {+1.56057673113820580823585260077379644e+01 , +3.43975961616459237301460093608428409e+00 }, + {+8.47119903068781923138885758817195892e+01 , +5.13236949468185791854133268753960238e+00 }, + {+9.55854738436600683826327440328896046e+01 , +5.25314067817929358802774910100252994e+00 }, + {+1.56670046394655830823694486753083766e+01 , +3.44368399001615451248068997740627574e+00 }, + {+4.14679026870443507846175634767860174e+01 , +4.41792146385299219920359657474436019e+00 }, + {+5.69249693750823269056127173826098442e+01 , +4.73480409586514749627990327668077645e+00 }, + {+4.93629403713561600852699484676122665e+01 , +4.59224451473128480136302652897840027e+00 }, + {+9.61484189551490686653778539039194584e+01 , +5.25901316478560252169572160735164898e+00 }, + {+2.07759627057374345326934417244046926e+01 , +3.72636417050318935004571518016144611e+00 }, + {+6.32976464844313539970244164578616619e+01 , +4.84093292566853424246928339764776273e+00 }, + {+6.54741204020067897317858296446502209e+01 , +4.87474381391982909784974793043917201e+00 }, + {+8.05042266117176978923453134484589100e+01 , +5.08141829115959617683933639313475601e+00 }, + {+4.81667484910552587962229154072701931e+01 , +4.56770832383321482034955903243661906e+00 }, + {+2.11217831158012465664342016680166125e+01 , +3.74289121691996804899454065396184575e+00 }, + {+9.02656763961261532358548720367252827e+01 , +5.19587377817524068279272963615894387e+00 }, + {+1.50600821596306779781571094645187259e+01 , +3.40409076820438745807924396441229869e+00 }, + {+4.16209905361957765990155166946351528e+01 , +4.42160745328229554045710868854157175e+00 }, + {+8.86791887429291563194055925123393536e+01 , +5.17814062516654447520446624771754712e+00 }, + {+1.70576566142218695176779874600470066e+01 , +3.52888602841986989717710320391598297e+00 }, + {+3.71685638271143758970538328867405653e+01 , +4.30842951458236820308439636796433560e+00 }, + {+1.43758274343816250251393284997902811e+01 , +3.35748343469042965382754422758946510e+00 }, + {+4.60754211385189549332608294207602739e+01 , +4.52330904257767828148397295029679237e+00 }, + {+4.57777167466274974572115752380341291e+01 , +4.51682530040123678433942314310447564e+00 }, + {+9.32357656650976593937230063602328300e+01 , +5.22824982009254837221678766114741857e+00 }, + {+2.23095900244694895775410259375348687e+01 , +3.79766114099573434402313460678612040e+00 }, + {+9.09832666680431856320865335874259472e+01 , +5.20379258533493176911574496349341434e+00 }, + {+8.62251237613208019183730357326567173e+01 , +5.15007514723643448859452771190406728e+00 }, + {+5.10896316393437928127241320908069611e+01 , +4.62663296015956482467254446322296917e+00 }, + {+8.19385868289117524909670464694499969e+01 , +5.09907996803279765921917143342322948e+00 }, + {+4.67622529628467802353952720295637846e+01 , +4.53810915071314717336273606975590283e+00 }, + {+6.36411313235143367705859418492764235e+01 , +4.84634542963631730817381276671897779e+00 }, + {+8.26450413110590460519233602099120617e+01 , +5.10766540264697663339669119714720544e+00 }, + }; + + for (double[] testCase : testCases) { + failures += testAcoshCaseWithUlpDiff(testCase[0], + testCase[1], + 3.0); + } + + return failures; + } + + public static int testAcoshCaseWithTolerance(double input, + double expected, + double tolerance) { + int failures = 0; + failures += Tests.testTolerance("Math.acosh", input, Math::acosh, expected, tolerance); + failures += Tests.testTolerance("StrictMath.acosh", input, StrictMath::acosh, expected, tolerance); + return failures; + } + + public static int testAcoshCaseWithUlpDiff(double input, + double expected, + double ulps) { + int failures = 0; + failures += Tests.testUlpDiffWithAbsBound("Math.acosh", input, Math::acosh, expected, ulps, Double.POSITIVE_INFINITY); + failures += Tests.testUlpDiffWithAbsBound("StrictMath.acosh", input, StrictMath::acosh, expected, ulps, Double.POSITIVE_INFINITY); + return failures; + } } diff --git a/test/jdk/java/lang/ProcessBuilder/InheritIOClosed.java b/test/jdk/java/lang/ProcessBuilder/InheritIOClosed.java new file mode 100644 index 00000000000..3e96a49bd3b --- /dev/null +++ b/test/jdk/java/lang/ProcessBuilder/InheritIOClosed.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @summary child process should not hang even if parent process has closed System.out/err + * @bug 8366736 + * @run main/othervm InheritIOClosed close dontclose + * @run main/othervm InheritIOClosed dontclose close + * @run main/othervm InheritIOClosed close close + */ + +import java.nio.file.Path; + +public class InheritIOClosed { + private final static Path JAVA_EXE = + Path.of(System.getProperty("java.home"), "bin", "java"); + + private static final String s = "1234567890".repeat(10); + + public static void main(String[] args) throws Exception { + if (args.length == 2) { + // Main test process + if (args[0].equals("close")) { + System.out.close(); + } + if (args[1].equals("close")) { + System.err.close(); + } + + ProcessBuilder pb = new ProcessBuilder().inheritIO() + .command(JAVA_EXE.toString(), + "-cp", + System.getProperty("java.class.path"), + InheritIOClosed.class.getName()); + Process process = pb.start(); + process.waitFor(); + + System.out.println("Done"); + } else { + // Child process -- print to System.out/err. Without the fix in + // JDK-8366736, this process will hang on Windows. + for (int i = 0; i < 100; i++) { + System.out.println(s); + } + for (int i = 0; i < 100; i++) { + System.err.println(s); + } + } + } +} diff --git a/test/jdk/java/lang/StrictMath/ExhaustingTests.java b/test/jdk/java/lang/StrictMath/ExhaustingTests.java index 143227c4cc3..d028f0541fa 100644 --- a/test/jdk/java/lang/StrictMath/ExhaustingTests.java +++ b/test/jdk/java/lang/StrictMath/ExhaustingTests.java @@ -93,6 +93,7 @@ public class ExhaustingTests { new UnaryTestCase("atan", FdlibmTranslit::atan, StrictMath::atan, DEFAULT_SHIFT), new UnaryTestCase("asinh", FdlibmTranslit::asinh, StrictMath::asinh, DEFAULT_SHIFT), + new UnaryTestCase("acosh", FdlibmTranslit::acosh, StrictMath::acosh, DEFAULT_SHIFT), }; for (var testCase : testCases) { diff --git a/test/jdk/java/lang/StrictMath/FdlibmTranslit.java b/test/jdk/java/lang/StrictMath/FdlibmTranslit.java index 3001fed911f..6ac90c826d5 100644 --- a/test/jdk/java/lang/StrictMath/FdlibmTranslit.java +++ b/test/jdk/java/lang/StrictMath/FdlibmTranslit.java @@ -144,6 +144,10 @@ public class FdlibmTranslit { return Asinh.compute(x); } + public static double acosh(double x) { + return Acosh.compute(x); + } + public static double IEEEremainder(double f1, double f2) { return IEEEremainder.compute(f1, f2); } @@ -2796,4 +2800,45 @@ public class FdlibmTranslit { if(hx>0) return w; else return -w; } } + + /* + * Return the Inverse Hyperbolic Cosine of x + * + * Method : + * Based on + * acosh(x) = log [ x + sqrt(x*x-1) ] + * we have + * acosh(x) := log(x)+ln2, if x is large; else + * := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else + * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. + * + * Special cases: + * acosh(x) is NaN with signal if x<1. + * acosh(NaN) is NaN without signal. + */ + private static final class Acosh { + private static final double one = 1.0; + private static final double ln2 = 6.93147180559945286227e-01; + static double compute(double x) { + double t; + int hx; + hx = __HI(x); + if(hx<0x3ff00000) { /* x < 1 */ + return (x-x)/(x-x); + } else if(hx >=0x41b00000) { /* x > 2**28 */ + if(hx >=0x7ff00000) { /* x is inf of NaN */ + return x+x; + } else + return log(x)+ln2; /* acosh(huge)=log(2x) */ + } else if(((hx-0x3ff00000)|__LO(x))==0) { + return 0.0; /* acosh(1) = 0 */ + } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ + t=x*x; + return log(2.0*x-one/(x+sqrt(t-one))); + } else { /* 1 0) { System.err.println("Testing the hyperbolics incurred " @@ -80,7 +81,8 @@ public class HyperbolicTests { SINH(HyperbolicTests::testSinhCase, FdlibmTranslit::sinh), COSH(HyperbolicTests::testCoshCase, FdlibmTranslit::cosh), TANH(HyperbolicTests::testTanhCase, FdlibmTranslit::tanh), - ASINH(HyperbolicTests::testAsinhCase, FdlibmTranslit::asinh); + ASINH(HyperbolicTests::testAsinhCase, FdlibmTranslit::asinh), + ACOSH(HyperbolicTests::testAcoshCase, FdlibmTranslit::acosh); private DoubleDoubleToInt testCase; private DoubleUnaryOperator transliteration; @@ -260,6 +262,11 @@ public class HyperbolicTests { StrictMath::asinh, expected); } + private static int testAcoshCase(double input, double expected) { + return Tests.test("StrictMath.asinh(double)", input, + StrictMath::acosh, expected); + } + private static int testSinh() { int failures = 0; double [][] testCases = { @@ -563,4 +570,52 @@ public class HyperbolicTests { return failures; } + + private static int testAcosh() { + int failures = 0; + double [][] testCases = { + {0x1.00020000aaaabp+0, 0x1.fffffffff749fp-8}, + {0x1.000346de27853p+0, 0x1.47ae147ae274p-7}, + {0x1.0008000aaab05p+0, 0x1.fffffffffe9f1p-7}, + {0x1.0008000aaab05p+0, 0x1.fffffffffe9f1p-7}, + {0x1.002000aaac169p+0, 0x1.fffffffffe67bp-6}, + {0x1.002000aaac16bp+0, 0x1.ffffffffff679p-6}, + {0x1.00800aab05b1ep+0, 0x1.ffffffffffc9cp-5}, + {0x1.00800aab05b1fp+0, 0x1.ffffffffffe9bp-5}, + {0x1.0147f40224b2ep+0, 0x1.9999999999318p-4}, + {0x1.0147f40224b35p+0, 0x1.9999999999776p-4}, + {0x1.0200aac16db6cp+0, 0x1.ffffffffffe91p-4}, + {0x1.0200aac16db6ep+0, 0x1.fffffffffff91p-4}, + {0x1.080ab05ca613bp+0, 0x1.ffffffffffea5p-3}, + {0x1.080ab05ca6146p+0, 0x1.0000000000001p-2}, + {0x1.20ac1862ae8cep+0, 0x1.fffffffffffedp-2}, + {0x1.20ac1862ae8dp+0, 0x1.ffffffffffffdp-2}, + {0x1.8b07551d9f551p+0, 0x1p+0}, + {0x1.e18fa0df2d9b3p+1, 0x1.ffffffffffffbp+0}, + {0x1.e18fa0df2d9b8p+1, 0x1.ffffffffffffep+0}, + {0x1.e18fa0df2d9bap+1, 0x1.fffffffffffffp+0}, + {0x1.b4ee858de3e68p+4, 0x1.ffffffffffff9p+1}, + {0x1.b4ee858de3e7ap+4, 0x1.ffffffffffffep+1}, + {0x1.b4ee858de3e7dp+4, 0x1.fffffffffffffp+1}, + {0x1.749eaa93f4e5ep+10, 0x1.ffffffffffffcp+2}, + {0x1.749eaa93f4e64p+10, 0x1.ffffffffffffdp+2}, + {0x1.749eaa93f4e76p+10, 0x1p+3}, + {0x1.0f2ebd0a7fb9p+22, 0x1.fffffffffff6fp+3}, + {0x1.0f2ebd0a8005cp+22, 0x1p+4}, + {0x1.1f43fcc4b6316p+45, 0x1.fffffffffffd3p+4}, + {0x1.1f43fcc4b662cp+45, 0x1.fffffffffffffp+4}, + {0x1.fdf25fc26e7cp+1023, 0x1.633c654fee2bap+9}, + {0x1.fdf25fc26e7cp+1023, 0x1.633c654fee2bap+9}, + {0x1.e0976c8f0ebdfp+1, 0x1.ff76fb3f476d5p+0}, + {0x1.ff66e0de4dc6fp+1023, 0x1.633cc2ae1c934p+9}, + {0x1.f97ccb0aef314p+11, 0x1.1ff088806d82ep+3}, + {0x1.fdf28623ef923p+1021, 0x1.628af341989dap+9}, + }; + + for (double[] testCase: testCases) { + failures += testAcoshCase(testCase[0], testCase[1]); + } + + return failures; + } } diff --git a/test/jdk/java/net/httpclient/EchoHandler.java b/test/jdk/java/net/httpclient/EchoHandler.java deleted file mode 100644 index 9fd86083801..00000000000 --- a/test/jdk/java/net/httpclient/EchoHandler.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import com.sun.net.httpserver.*; -import java.net.*; -import java.net.http.*; -import java.io.*; -import java.util.concurrent.*; -import javax.net.ssl.*; -import java.nio.file.*; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Random; -import jdk.test.lib.net.SimpleSSLContext; -import static java.net.http.HttpRequest.*; -import static java.net.http.HttpResponse.*; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class EchoHandler implements HttpHandler { - static final Path CWD = Paths.get("."); - public EchoHandler() {} - - @Override - public void handle(HttpExchange t) - throws IOException { - try { - System.err.println("EchoHandler received request to " + t.getRequestURI()); - InputStream is = t.getRequestBody(); - Headers map = t.getRequestHeaders(); - Headers map1 = t.getResponseHeaders(); - map1.add("X-Hello", "world"); - map1.add("X-Bye", "universe"); - String fixedrequest = map.getFirst("XFixed"); - File outfile = Files.createTempFile(CWD, "foo", "bar").toFile(); - FileOutputStream fos = new FileOutputStream(outfile); - int count = (int) is.transferTo(fos); - is.close(); - fos.close(); - InputStream is1 = new FileInputStream(outfile); - OutputStream os = null; - // return the number of bytes received (no echo) - String summary = map.getFirst("XSummary"); - if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); - os = t.getResponseBody(); - is1.transferTo(os); - } else { - t.sendResponseHeaders(200, 0); - os = t.getResponseBody(); - is1.transferTo(os); - - if (summary != null) { - String s = Integer.toString(count); - os.write(s.getBytes()); - } - } - outfile.delete(); - os.close(); - is1.close(); - } catch (Throwable e) { - e.printStackTrace(); - throw new IOException(e); - } - } -} diff --git a/test/jdk/java/net/httpclient/HttpEchoHandler.java b/test/jdk/java/net/httpclient/HttpEchoHandler.java deleted file mode 100644 index 319a5b901f9..00000000000 --- a/test/jdk/java/net/httpclient/HttpEchoHandler.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import com.sun.net.httpserver.*; -import java.net.*; -import java.net.http.*; -import java.io.*; -import java.util.concurrent.*; -import javax.net.ssl.*; -import java.nio.file.*; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Random; -import jdk.test.lib.net.SimpleSSLContext; -import static java.net.http.HttpRequest.*; -import static java.net.http.HttpResponse.*; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class HttpEchoHandler implements HttpHandler { - static final Path CWD = Paths.get("."); - - public HttpEchoHandler() {} - - @Override - public void handle(HttpExchange t) - throws IOException { - try { - System.err.println("EchoHandler received request to " + t.getRequestURI()); - InputStream is = t.getRequestBody(); - Headers map = t.getRequestHeaders(); - Headers map1 = t.getResponseHeaders(); - map1.add("X-Hello", "world"); - map1.add("X-Bye", "universe"); - String fixedrequest = map.getFirst("XFixed"); - File outfile = Files.createTempFile(CWD, "foo", "bar").toFile(); - FileOutputStream fos = new FileOutputStream(outfile); - int count = (int) is.transferTo(fos); - is.close(); - fos.close(); - InputStream is1 = new FileInputStream(outfile); - OutputStream os = null; - // return the number of bytes received (no echo) - String summary = map.getFirst("XSummary"); - if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); - os = t.getResponseBody(); - is1.transferTo(os); - } else { - t.sendResponseHeaders(200, 0); - os = t.getResponseBody(); - is1.transferTo(os); - - if (summary != null) { - String s = Integer.toString(count); - os.write(s.getBytes()); - } - } - outfile.delete(); - os.close(); - is1.close(); - } catch (Throwable e) { - e.printStackTrace(); - throw new IOException(e); - } - } -} diff --git a/test/jdk/java/net/httpclient/LightWeightHttpServer.java b/test/jdk/java/net/httpclient/LightWeightHttpServer.java index 496aa2c5778..9045d00829e 100644 --- a/test/jdk/java/net/httpclient/LightWeightHttpServer.java +++ b/test/jdk/java/net/httpclient/LightWeightHttpServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,6 @@ /** * library /test/lib / * build jdk.test.lib.net.SimpleSSLContext ProxyServer - * compile ../../../com/sun/net/httpserver/LogFilter.java - * compile ../../../com/sun/net/httpserver/EchoHandler.java - * compile ../../../com/sun/net/httpserver/FileServerHandler.java */ import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpContext; @@ -39,6 +36,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.net.http.HttpClient.Version; import java.nio.file.Path; import java.util.HashSet; import java.util.concurrent.BrokenBarrierException; @@ -50,14 +48,21 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestEchoHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestExchange; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestFileServerHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; import jdk.httpclient.test.lib.common.TestServerConfigurator; import jdk.test.lib.net.SimpleSSLContext; public class LightWeightHttpServer { static final SSLContext ctx = SimpleSSLContext.findSSLContext(); - static HttpServer httpServer; - static HttpsServer httpsServer; + static HttpTestServer httpServer; + static HttpTestServer httpsServer; static ExecutorService executor; static int port; static int httpsport; @@ -82,36 +87,31 @@ public class LightWeightHttpServer { ch.setLevel(Level.ALL); logger.addHandler(ch); + executor = Executors.newCachedThreadPool(); + String root = System.getProperty("test.src", ".") + "/docs"; InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - httpServer = HttpServer.create(addr, 0); - if (httpServer instanceof HttpsServer) { - throw new RuntimeException("should not be httpsserver"); - } - httpsServer = HttpsServer.create(addr, 0); - HttpHandler h = new FileServerHandler(root); + httpServer = HttpTestServer.create(Version.HTTP_1_1, null, executor); + httpsServer = HttpTestServer.create(Version.HTTP_1_1, ctx, executor); + HttpTestHandler h = new HttpTestFileServerHandler(root); - HttpContext c1 = httpServer.createContext("/files", h); - HttpContext c2 = httpsServer.createContext("/files", h); - HttpContext c3 = httpServer.createContext("/echo", new EchoHandler()); + HttpTestContext c1 = httpServer.createContext("/files", h); + HttpTestContext c2 = httpsServer.createContext("/files", h); + HttpTestContext c3 = httpServer.createContext("/echo", new EchoHandler()); redirectHandler = new RedirectHandler("/redirect"); redirectHandlerSecure = new RedirectHandler("/redirect"); - HttpContext c4 = httpServer.createContext("/redirect", redirectHandler); - HttpContext c41 = httpsServer.createContext("/redirect", redirectHandlerSecure); - HttpContext c5 = httpsServer.createContext("/echo", new EchoHandler()); - HttpContext c6 = httpServer.createContext("/keepalive", new KeepAliveHandler()); + HttpTestContext c4 = httpServer.createContext("/redirect", redirectHandler); + HttpTestContext c41 = httpsServer.createContext("/redirect", redirectHandlerSecure); + HttpTestContext c5 = httpsServer.createContext("/echo", new EchoHandler()); + HttpTestContext c6 = httpServer.createContext("/keepalive", new KeepAliveHandler()); redirectErrorHandler = new RedirectErrorHandler("/redirecterror"); redirectErrorHandlerSecure = new RedirectErrorHandler("/redirecterror"); - HttpContext c7 = httpServer.createContext("/redirecterror", redirectErrorHandler); - HttpContext c71 = httpsServer.createContext("/redirecterror", redirectErrorHandlerSecure); + HttpTestContext c7 = httpServer.createContext("/redirecterror", redirectErrorHandler); + HttpTestContext c71 = httpsServer.createContext("/redirecterror", redirectErrorHandlerSecure); delayHandler = new DelayHandler(); - HttpContext c8 = httpServer.createContext("/delay", delayHandler); - HttpContext c81 = httpsServer.createContext("/delay", delayHandler); + HttpTestContext c8 = httpServer.createContext("/delay", delayHandler); + HttpTestContext c81 = httpsServer.createContext("/delay", delayHandler); - executor = Executors.newCachedThreadPool(); - httpServer.setExecutor(executor); - httpsServer.setExecutor(executor); - httpsServer.setHttpsConfigurator(new TestServerConfigurator(addr.getAddress(), ctx)); httpServer.start(); httpsServer.start(); @@ -136,10 +136,10 @@ public class LightWeightHttpServer { public static void stop() throws IOException { if (httpServer != null) { - httpServer.stop(0); + httpServer.stop(); } if (httpsServer != null) { - httpsServer.stop(0); + httpsServer.stop(); } if (proxy != null) { proxy.close(); @@ -149,7 +149,14 @@ public class LightWeightHttpServer { } } - static class RedirectErrorHandler implements HttpHandler { + static class EchoHandler extends HttpServerAdapters.HttpTestEchoHandler { + @Override + protected boolean useXFixed() { + return true; + } + } + + static class RedirectErrorHandler implements HttpTestHandler { String root; volatile int count = 1; @@ -167,23 +174,23 @@ public class LightWeightHttpServer { } @Override - public synchronized void handle(HttpExchange t) + public synchronized void handle(HttpTestExchange t) throws IOException { byte[] buf = new byte[2048]; try (InputStream is = t.getRequestBody()) { while (is.read(buf) != -1) ; } - Headers map = t.getResponseHeaders(); - String redirect = root + "/foo/" + Integer.toString(count); + var map = t.getResponseHeaders(); + String redirect = root + "/foo/" + count; increment(); - map.add("Location", redirect); - t.sendResponseHeaders(301, -1); + map.addHeader("Location", redirect); + t.sendResponseHeaders(301, HttpTestExchange.RSPBODY_EMPTY); t.close(); } } - static class RedirectHandler implements HttpHandler { + static class RedirectHandler implements HttpTestHandler { String root; volatile int count = 0; @@ -193,21 +200,21 @@ public class LightWeightHttpServer { } @Override - public synchronized void handle(HttpExchange t) + public synchronized void handle(HttpTestExchange t) throws IOException { byte[] buf = new byte[2048]; try (InputStream is = t.getRequestBody()) { while (is.read(buf) != -1) ; } - Headers map = t.getResponseHeaders(); + var map = t.getResponseHeaders(); if (count++ < 1) { - map.add("Location", root + "/foo/" + count); + map.addHeader("Location", root + "/foo/" + count); } else { - map.add("Location", SmokeTest.midSizedFilename); + map.addHeader("Location", SmokeTest.midSizedFilename); } - t.sendResponseHeaders(301, -1); + t.sendResponseHeaders(301, HttpTestExchange.RSPBODY_EMPTY); t.close(); } @@ -220,7 +227,7 @@ public class LightWeightHttpServer { } } - static class KeepAliveHandler implements HttpHandler { + static class KeepAliveHandler implements HttpTestHandler { volatile int counter = 0; HashSet portSet = new HashSet<>(); @@ -234,7 +241,7 @@ public class LightWeightHttpServer { } @Override - public synchronized void handle(HttpExchange t) + public synchronized void handle(HttpTestExchange t) throws IOException { int remotePort = t.getRemoteAddress().getPort(); String result = "OK"; @@ -286,14 +293,15 @@ public class LightWeightHttpServer { try (InputStream is = t.getRequestBody()) { while (is.read(buf) != -1) ; } - t.sendResponseHeaders(200, result.length()); + byte[] bytes = result.getBytes("US-ASCII"); + t.sendResponseHeaders(200, HttpTestExchange.fixedRsp(bytes.length)); OutputStream o = t.getResponseBody(); - o.write(result.getBytes("US-ASCII")); + o.write(bytes); t.close(); } } - static class DelayHandler implements HttpHandler { + static class DelayHandler implements HttpTestHandler { CyclicBarrier bar1 = new CyclicBarrier(2); CyclicBarrier bar2 = new CyclicBarrier(2); @@ -308,7 +316,7 @@ public class LightWeightHttpServer { } @Override - public synchronized void handle(HttpExchange he) throws IOException { + public synchronized void handle(HttpTestExchange he) throws IOException { try(InputStream is = he.getRequestBody()) { is.readAllBytes(); bar1.await(); @@ -316,7 +324,7 @@ public class LightWeightHttpServer { } catch (InterruptedException | BrokenBarrierException e) { throw new IOException(e); } - he.sendResponseHeaders(200, -1); // will probably fail + he.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); // will probably fail he.close(); } } diff --git a/test/jdk/java/net/httpclient/ManyRequests.java b/test/jdk/java/net/httpclient/ManyRequests.java index ee79ac80b68..3609aa8337a 100644 --- a/test/jdk/java/net/httpclient/ManyRequests.java +++ b/test/jdk/java/net/httpclient/ManyRequests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,8 @@ * @test * @bug 8087112 8180044 8256459 * @key intermittent - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib - * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestServerConfigurator - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/EchoHandler.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters * @run main/othervm/timeout=160 -Djdk.httpclient.HttpClient.log=ssl,channel ManyRequests * @run main/othervm/timeout=160 -Djdk.httpclient.HttpClient.log=channel -Dtest.insertDelay=true ManyRequests * @run main/othervm/timeout=160 -Djdk.httpclient.HttpClient.log=channel -Dtest.chunkSize=64 ManyRequests @@ -41,19 +35,14 @@ */ // * @run main/othervm/timeout=40 -Djdk.httpclient.HttpClient.log=ssl,channel ManyRequests -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsParameters; -import com.sun.net.httpserver.HttpsServer; -import com.sun.net.httpserver.HttpExchange; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ConnectException; -import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpClient.Builder; +import java.net.http.HttpClient.Version; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; @@ -61,7 +50,6 @@ import java.net.http.HttpResponse.BodyHandlers; import java.time.Duration; import java.util.Arrays; import java.util.Formatter; -import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Random; @@ -77,15 +65,14 @@ import java.util.logging.Level; import java.util.concurrent.CompletableFuture; import java.util.stream.Stream; import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLParameters; -import jdk.httpclient.test.lib.common.TestServerConfigurator; +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.test.lib.Platform; import jdk.test.lib.RandomFactory; import jdk.test.lib.net.SimpleSSLContext; import jdk.test.lib.net.URIBuilder; -public class ManyRequests { +public class ManyRequests implements HttpServerAdapters { static final int MAX_COUNT = 50; static final int MAX_LIMIT = 40; @@ -106,11 +93,8 @@ public class ManyRequests { + ", XFixed=" + XFIXED); SSLContext ctx = SimpleSSLContext.findSSLContext(); - InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - HttpsServer server = HttpsServer.create(addr, 0); ExecutorService executor = executorFor("HTTPS/1.1 Server Thread"); - server.setHttpsConfigurator(new Configurator(addr.getAddress(), ctx)); - server.setExecutor(executor); + HttpTestServer server = HttpTestServer.create(Version.HTTP_1_1, ctx, executor); ExecutorService virtualExecutor = Executors.newThreadPerTaskExecutor(Thread.ofVirtual() .name("HttpClient-Worker", 0).factory()); @@ -125,7 +109,7 @@ public class ManyRequests { System.out.println("OK"); } finally { client.close(); - server.stop(0); + server.stop(); virtualExecutor.close(); executor.shutdownNow(); } @@ -138,15 +122,15 @@ public class ManyRequests { Integer.parseInt(System.getProperty("test.chunkSize", "0"))); static final boolean XFIXED = Boolean.getBoolean("test.XFixed"); - static class TestEchoHandler extends EchoHandler { + static class TestEchoHandler extends HttpTestEchoHandler { final Random rand = RANDOM; @Override - public void handle(HttpExchange e) throws IOException { + public void handle(HttpTestExchange e) throws IOException { System.out.println("Server: received " + e.getRequestURI()); super.handle(e); } @Override - protected void close(HttpExchange t, OutputStream os) throws IOException { + protected void close(HttpTestExchange t, OutputStream os) throws IOException { if (INSERT_DELAY) { try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {} @@ -155,7 +139,7 @@ public class ManyRequests { super.close(t, os); } @Override - protected void close(HttpExchange t, InputStream is) throws IOException { + protected void close(HttpTestExchange t, InputStream is) throws IOException { if (INSERT_DELAY) { try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {} @@ -181,7 +165,7 @@ public class ManyRequests { return s; } - static void test(HttpsServer server, HttpClient client) throws Exception { + static void test(HttpTestServer server, HttpClient client) throws Exception { int port = server.getAddress().getPort(); URI baseURI = URIBuilder.newBuilder() @@ -213,8 +197,11 @@ public class ManyRequests { byte[] buf = new byte[(i + 1) * CHUNK_SIZE + i + 1]; // different size bodies rand.nextBytes(buf); URI uri = new URI(baseURI.toString() + String.valueOf(i + 1)); - HttpRequest r = HttpRequest.newBuilder(uri) - .header("XFixed", "true") + HttpRequest.Builder reqBuilder = HttpRequest.newBuilder(uri); + if (XFIXED) { + reqBuilder.header("XFixed", "yes"); + } + HttpRequest r = reqBuilder .POST(BodyPublishers.ofByteArray(buf)) .build(); bodies.put(r, buf); @@ -367,21 +354,6 @@ public class ManyRequests { throw new RuntimeException(sb.toString()); } - static class Configurator extends HttpsConfigurator { - private final InetAddress serverAddr; - public Configurator(InetAddress serverAddr, SSLContext ctx) { - super(ctx); - this.serverAddr = serverAddr; - } - - @Override - public void configure(HttpsParameters params) { - final SSLParameters parameters = getSSLContext().getSupportedSSLParameters(); - TestServerConfigurator.addSNIMatcher(this.serverAddr, parameters); - params.setSSLParameters(parameters); - } - } - private static ExecutorService executorFor(String serverThreadName) { ThreadFactory factory = new ThreadFactory() { final AtomicInteger counter = new AtomicInteger(); diff --git a/test/jdk/java/net/httpclient/ManyRequests2.java b/test/jdk/java/net/httpclient/ManyRequests2.java index a1e2307b820..09fdc18f687 100644 --- a/test/jdk/java/net/httpclient/ManyRequests2.java +++ b/test/jdk/java/net/httpclient/ManyRequests2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,8 @@ /* * @test * @bug 8087112 8180044 8256459 - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib - * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestServerConfigurator - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/EchoHandler.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters * @build ManyRequests ManyRequests2 * @run main/othervm/timeout=400 -Dsun.net.httpserver.idleInterval=400 -Dtest.XFixed=true * -Djdk.httpclient.HttpClient.log=channel ManyRequests2 diff --git a/test/jdk/java/net/httpclient/ManyRequestsLegacy.java b/test/jdk/java/net/httpclient/ManyRequestsLegacy.java index 2e58ee50bff..f1c4f881058 100644 --- a/test/jdk/java/net/httpclient/ManyRequestsLegacy.java +++ b/test/jdk/java/net/httpclient/ManyRequestsLegacy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,14 +23,8 @@ /* * @test - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib - * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestServerConfigurator - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/EchoHandler.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters * @run main/othervm/timeout=80 -Dsun.net.httpserver.idleInterval=50000 ManyRequestsLegacy * @run main/othervm/timeout=80 -Dtest.insertDelay=true -Dsun.net.httpserver.idleInterval=50000 ManyRequestsLegacy * @run main/othervm/timeout=80 -Dtest.chunkSize=64 -Dsun.net.httpserver.idleInterval=50000 ManyRequestsLegacy @@ -44,16 +38,11 @@ import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HostnameVerifier; -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsParameters; -import com.sun.net.httpserver.HttpsServer; -import com.sun.net.httpserver.HttpExchange; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ConnectException; import java.net.HttpURLConnection; -import java.net.InetAddress; import java.net.URI; import java.net.URLConnection; import java.util.Map; @@ -62,10 +51,12 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.CompletionStage; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLSession; import java.net.http.HttpClient; import java.net.http.HttpClient.Version; @@ -73,22 +64,22 @@ import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; -import java.net.InetSocketAddress; import java.util.Arrays; import java.util.Formatter; -import java.util.HashMap; import java.util.LinkedList; import java.util.Random; import java.util.logging.Logger; import java.util.logging.Level; -import jdk.httpclient.test.lib.common.TestServerConfigurator; +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.test.lib.Platform; import jdk.test.lib.RandomFactory; import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; + import static java.net.Proxy.NO_PROXY; -public class ManyRequestsLegacy { +public class ManyRequestsLegacy implements HttpServerAdapters { static final int MAX_COUNT = 20; static final int MAX_LIMIT = 40; @@ -112,9 +103,8 @@ public class ManyRequestsLegacy { return true; } }); - InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - HttpsServer server = HttpsServer.create(addr, 0); - server.setHttpsConfigurator(new Configurator(addr.getAddress(), ctx)); + ExecutorService executor = executorFor("HTTPS/1.1 Server Thread"); + HttpTestServer server = HttpTestServer.create(Version.HTTP_1_1, ctx, executor); LegacyHttpClient client = new LegacyHttpClient(); @@ -122,7 +112,7 @@ public class ManyRequestsLegacy { test(server, client); System.out.println("OK"); } finally { - server.stop(0); + server.stop(); } } @@ -210,15 +200,15 @@ public class ManyRequestsLegacy { } } - static class TestEchoHandler extends EchoHandler { + static class TestEchoHandler extends HttpTestEchoHandler { final Random rand = RANDOM; @Override - public void handle(HttpExchange e) throws IOException { + public void handle(HttpTestExchange e) throws IOException { System.out.println("Server: received " + e.getRequestURI()); super.handle(e); } @Override - protected void close(HttpExchange t, OutputStream os) throws IOException { + protected void close(HttpTestExchange t, OutputStream os) throws IOException { if (INSERT_DELAY) { try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {} @@ -227,7 +217,7 @@ public class ManyRequestsLegacy { os.close(); } @Override - protected void close(HttpExchange t, InputStream is) throws IOException { + protected void close(HttpTestExchange t, InputStream is) throws IOException { if (INSERT_DELAY) { try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {} @@ -253,9 +243,13 @@ public class ManyRequestsLegacy { return s; } - static void test(HttpsServer server, LegacyHttpClient client) throws Exception { + static void test(HttpTestServer server, LegacyHttpClient client) throws Exception { int port = server.getAddress().getPort(); - URI baseURI = new URI("https://localhost:" + port + "/foo/x"); + URI baseURI = URIBuilder.newBuilder() + .scheme("https") + .loopback() + .port(port) + .path("/foo/x").build(); server.createContext("/foo", new TestEchoHandler()); server.start(); @@ -279,8 +273,11 @@ public class ManyRequestsLegacy { byte[] buf = new byte[(i + 1) * CHUNK_SIZE + i + 1]; // different size bodies rand.nextBytes(buf); URI uri = new URI(baseURI.toString() + String.valueOf(i + 1)); - HttpRequest r = HttpRequest.newBuilder(uri) - .header("XFixed", "true") + HttpRequest.Builder reqBuilder = HttpRequest.newBuilder(uri); + if (XFIXED) { + reqBuilder.header("XFixed", "yes"); + } + HttpRequest r = reqBuilder .POST(BodyPublishers.ofByteArray(buf)) .build(); bodies.put(r, buf); @@ -432,19 +429,16 @@ public class ManyRequestsLegacy { throw new RuntimeException(sb.toString()); } - static class Configurator extends HttpsConfigurator { - private final InetAddress serverAddr; - - public Configurator(InetAddress serverAddr, SSLContext ctx) { - super(ctx); - this.serverAddr = serverAddr; - } - - @Override - public void configure(HttpsParameters params) { - final SSLParameters parameters = getSSLContext().getSupportedSSLParameters(); - TestServerConfigurator.addSNIMatcher(this.serverAddr, parameters); - params.setSSLParameters(parameters); - } + private static ExecutorService executorFor(String serverThreadName) { + ThreadFactory factory = new ThreadFactory() { + final AtomicInteger counter = new AtomicInteger(); + @Override + public Thread newThread(Runnable r) { + Thread thread = new Thread(r); + thread.setName(serverThreadName + "#" + counter.incrementAndGet()); + return thread; + } + }; + return Executors.newCachedThreadPool(factory); } } diff --git a/test/jdk/java/net/httpclient/NullReturningBodyHandlerTest.java b/test/jdk/java/net/httpclient/NullReturningBodyHandlerTest.java new file mode 100644 index 00000000000..2b2e6b2135d --- /dev/null +++ b/test/jdk/java/net/httpclient/NullReturningBodyHandlerTest.java @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpClient.Version; +import java.net.http.HttpOption; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandler; +import java.net.http.HttpResponse.BodySubscriber; +import java.net.http.HttpResponse.ResponseInfo; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import javax.net.ssl.SSLContext; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestEchoHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; +import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import static java.net.http.HttpClient.Builder.NO_PROXY; +import static java.net.http.HttpOption.Http3DiscoveryMode.HTTP_3_URI_ONLY; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/* + * @test + * @bug 8377796 + * @summary Verify that HttpClient.send()/sendAsync() complete exceptionally + * when BodyHandler.apply() returns null + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.test.lib.net.SimpleSSLContext + * jdk.test.lib.net.URIBuilder + * @run junit ${test.main.class} + */ +class NullReturningBodyHandlerTest { + private static final String CTX_PATH = "/" + NullReturningBodyHandlerTest.class.getName(); + + private static final SSLContext sslContext = SimpleSSLContext.findSSLContext(); + private static HttpClient client; + + private static HttpTestServer h1HttpServer; + private static HttpTestServer h1HttpsServer; + + private static HttpTestServer h2HttpServer; + private static HttpTestServer h2HttpsServer; + + private static HttpTestServer h3Server; + + @BeforeAll + static void beforeAll() throws Exception { + h1HttpServer = HttpTestServer.create(Version.HTTP_1_1); + h1HttpServer.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h1HttpServer.start(); + System.err.println("HTTP/1.1 http server started at " + h1HttpServer.getAddress()); + + h1HttpsServer = HttpTestServer.create(Version.HTTP_1_1, sslContext); + h1HttpsServer.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h1HttpsServer.start(); + System.err.println("HTTP/1.1 https server started at " + h1HttpsServer.getAddress()); + + h2HttpServer = HttpTestServer.create(Version.HTTP_2); + h2HttpServer.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h2HttpServer.start(); + System.err.println("HTTP/2 http server started at " + h2HttpServer.getAddress()); + + h2HttpsServer = HttpTestServer.create(Version.HTTP_2, sslContext); + h2HttpsServer.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h2HttpsServer.start(); + System.err.println("HTTP/2 https server started at " + h2HttpsServer.getAddress()); + + h3Server = HttpTestServer.create(HTTP_3_URI_ONLY, sslContext); + h3Server.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h3Server.start(); + System.err.println("HTTP/3 server started at " + h3Server.getAddress()); + + client = HttpServerAdapters.createClientBuilderForH3() + .sslContext(sslContext) + .proxy(NO_PROXY) + .build(); + } + + @AfterAll + static void afterAll() throws Exception { + close(h1HttpServer); + close(h1HttpsServer); + + close(h2HttpServer); + close(h2HttpsServer); + + close(h3Server); + + close(client); + } + + private static void close(final AutoCloseable resource) throws Exception { + if (resource == null) { + return; + } + System.err.println("closing " + resource); + resource.close(); + } + + static List params() throws Exception { + final List args = new ArrayList<>(); + + final URI h1HttpsReq = URIBuilder.newBuilder() + .scheme("https") + .host(h1HttpsServer.getAddress().getAddress()) + .port(h1HttpsServer.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h1") + .build(); + args.add(Arguments.of(h1HttpsReq, Version.HTTP_1_1, false)); + + final URI h1HttpReq = URIBuilder.newBuilder() + .scheme("http") + .host(h1HttpServer.getAddress().getAddress()) + .port(h1HttpServer.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h1&scheme=http") + .build(); + args.add(Arguments.of(h1HttpReq, Version.HTTP_1_1, false)); + + final URI h2Req = URIBuilder.newBuilder() + .scheme("https") + .host(h2HttpsServer.getAddress().getAddress()) + .port(h2HttpsServer.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h2") + .build(); + args.add(Arguments.of(h2Req, Version.HTTP_2, false)); + + final URI h2HttpReq = URIBuilder.newBuilder() + .scheme("http") + .host(h2HttpServer.getAddress().getAddress()) + .port(h2HttpServer.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h2&scheme=http") + .build(); + // test for HTTP/2 upgrade when there are no already established connections + args.add(Arguments.of(h2HttpReq, Version.HTTP_2, false)); + // test for HTTP/2 upgrade when there is an established connection + args.add(Arguments.of(h2HttpReq, Version.HTTP_2, true)); + + final URI h3Req = URIBuilder.newBuilder() + .scheme("https") + .host(h3Server.getAddress().getAddress()) + .port(h3Server.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h3") + .build(); + args.add(Arguments.of(h3Req, Version.HTTP_3, false)); + return args; + } + + /* + * Issues a HTTP request with a BodyHandler implementation that returns a null + * BodySubscriber. The test then verifies that the request fails and the exception + * that's raised contains the expected NullPointerException (raised due to + * BodyHandler.apply(...) returning null). + */ + @ParameterizedTest + @MethodSource("params") + void test(final URI reqURI, final Version version, + final boolean requiresWarmupHEADRequest) throws Exception { + if (requiresWarmupHEADRequest) { + // the test only issues a warmup request for HTTP/2 requests + assertEquals(Version.HTTP_2, version, "unexpected HTTP version"); + final HttpRequest head = HttpRequest.newBuilder().HEAD() + .version(version) + .uri(reqURI) + .build(); + System.err.println("issuing warmup head request " + head); + HttpResponse headResp = client.send(head, HttpResponse.BodyHandlers.discarding()); + assertEquals(200, headResp.statusCode(), "unexpected status code for HEAD request"); + } + // now run the actual test + final HttpRequest.Builder builder = HttpRequest.newBuilder() + .version(version) + .uri(reqURI); + if (version == Version.HTTP_3) { + builder.setOption(HttpOption.H3_DISCOVERY, HTTP_3_URI_ONLY); + } + final HttpRequest req = builder.build(); + // test synchronous send() + System.err.println("issuing request " + reqURI); + final IOException ioe = assertThrows(IOException.class, + () -> client.send(req, new AlwaysReturnsNull())); + if (!(ioe.getCause() instanceof NullPointerException)) { + throw ioe; // propagate the original exception + } + // now test with sendAsync() + System.err.println("issuing async request " + reqURI); + final Future> f = client.sendAsync(req, new AlwaysReturnsNull()); + final ExecutionException ee = assertThrows(ExecutionException.class, f::get); + if (!(ee.getCause() instanceof IOException cause) + || !(cause.getCause() instanceof NullPointerException)) { + throw ee; // propagate the original exception + } + } + + private static final class AlwaysReturnsNull implements BodyHandler { + @Override + public BodySubscriber apply(final ResponseInfo responseInfo) { + return null; + } + } +} diff --git a/test/jdk/java/net/httpclient/RequestBodyTest.java b/test/jdk/java/net/httpclient/RequestBodyTest.java index 668e834e1f0..e43336610f0 100644 --- a/test/jdk/java/net/httpclient/RequestBodyTest.java +++ b/test/jdk/java/net/httpclient/RequestBodyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,14 +56,9 @@ import static org.testng.Assert.*; /* * @test * @bug 8087112 - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/EchoHandler.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java - * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestServerConfigurator + * @build jdk.test.lib.net.SimpleSSLContext + * jdk.httpclient.test.lib.common.HttpServerAdapters * @build LightWeightHttpServer * @build jdk.test.lib.Platform * @build jdk.test.lib.util.FileUtils diff --git a/test/jdk/java/net/httpclient/SmokeTest.java b/test/jdk/java/net/httpclient/SmokeTest.java index 42c082a5e0f..f87cc462fac 100644 --- a/test/jdk/java/net/httpclient/SmokeTest.java +++ b/test/jdk/java/net/httpclient/SmokeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,39 +24,25 @@ /* * @test * @bug 8087112 8178699 8338569 - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib / * @build jdk.test.lib.net.SimpleSSLContext ProxyServer * jdk.httpclient.test.lib.common.TestServerConfigurator - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java * @run main/othervm * -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=errors,ssl,trace * SmokeTest */ -import com.sun.net.httpserver.Headers; -import com.sun.net.httpserver.HttpContext; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsParameters; -import com.sun.net.httpserver.HttpsServer; - import java.net.InetAddress; import java.net.Proxy; import java.net.SocketAddress; +import java.net.http.HttpClient.Version; import java.net.http.HttpHeaders; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; import java.net.InetSocketAddress; import java.net.PasswordAuthentication; @@ -94,7 +80,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Random; -import jdk.httpclient.test.lib.common.TestServerConfigurator; +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.test.lib.net.SimpleSSLContext; import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING; import static java.nio.file.StandardOpenOption.WRITE; @@ -120,11 +106,11 @@ import java.util.logging.Logger; * Uses a FileServerHandler serving a couple of known files * in docs directory. */ -public class SmokeTest { +public class SmokeTest implements HttpServerAdapters { private static final SSLContext ctx = SimpleSSLContext.findSSLContext(); static SSLParameters sslparams; - static HttpServer s1 ; - static HttpsServer s2; + static HttpTestServer s1 ; + static HttpTestServer s2; static ExecutorService executor; static int port; static int httpsport; @@ -142,19 +128,10 @@ public class SmokeTest { static Path smallFile; static String fileroot; - static class HttpEchoHandler implements HttpHandler { - + static class HttpEchoHandler extends HttpTestEchoHandler { @Override - public void handle(HttpExchange exchange) throws IOException { - try (InputStream is = exchange.getRequestBody(); - OutputStream os = exchange.getResponseBody()) { - byte[] bytes = is.readAllBytes(); - long responseLength = bytes.length == 0 ? -1 : bytes.length; - boolean fixedLength = "yes".equals(exchange.getRequestHeaders() - .getFirst("XFixed")); - exchange.sendResponseHeaders(200, fixedLength ? responseLength : 0); - os.write(bytes); - } + protected boolean useXFixed() { + return true; } } @@ -242,8 +219,8 @@ public class SmokeTest { //test12(httproot + "delay/foo", delayHandler); } finally { - s1.stop(0); - s2.stop(0); + s1.stop(); + s2.stop(); proxy.close(); e.shutdownNow(); executor.shutdownNow(); @@ -779,38 +756,31 @@ public class SmokeTest { ch.setLevel(Level.SEVERE); logger.addHandler(ch); - String root = System.getProperty ("test.src", ".")+ "/docs"; - InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - s1 = HttpServer.create (addr, 0); - if (s1 instanceof HttpsServer) { - throw new RuntimeException ("should not be httpsserver"); - } - s2 = HttpsServer.create (addr, 0); - HttpHandler h = new FileServerHandler(root); + sslparams = ctx.getDefaultSSLParameters(); + executor = Executors.newCachedThreadPool(); - HttpContext c1 = s1.createContext("/files", h); - HttpContext c2 = s2.createContext("/files", h); - HttpContext c3 = s1.createContext("/echo", new HttpEchoHandler()); + String root = System.getProperty ("test.src", ".")+ "/docs"; + s1 = HttpTestServer.create(Version.HTTP_1_1, null, executor); + s2 = HttpTestServer.create(Version.HTTP_1_1, ctx, executor); + HttpTestHandler h = new HttpTestFileServerHandler(root); + + HttpTestContext c1 = s1.createContext("/files", h); + HttpTestContext c2 = s2.createContext("/files", h); + HttpTestContext c3 = s1.createContext("/echo", new HttpEchoHandler()); redirectHandler = new RedirectHandler("/redirect"); redirectHandlerSecure = new RedirectHandler("/redirect"); - HttpContext c4 = s1.createContext("/redirect", redirectHandler); - HttpContext c41 = s2.createContext("/redirect", redirectHandlerSecure); - HttpContext c5 = s2.createContext("/echo", new HttpEchoHandler()); - HttpContext c6 = s1.createContext("/keepalive", new KeepAliveHandler()); + HttpTestContext c4 = s1.createContext("/redirect", redirectHandler); + HttpTestContext c41 = s2.createContext("/redirect", redirectHandlerSecure); + HttpTestContext c5 = s2.createContext("/echo", new HttpEchoHandler()); + HttpTestContext c6 = s1.createContext("/keepalive", new KeepAliveHandler()); redirectErrorHandler = new RedirectErrorHandler("/redirecterror"); redirectErrorHandlerSecure = new RedirectErrorHandler("/redirecterror"); - HttpContext c7 = s1.createContext("/redirecterror", redirectErrorHandler); - HttpContext c71 = s2.createContext("/redirecterror", redirectErrorHandlerSecure); + HttpTestContext c7 = s1.createContext("/redirecterror", redirectErrorHandler); + HttpTestContext c71 = s2.createContext("/redirecterror", redirectErrorHandlerSecure); delayHandler = new DelayHandler(); - HttpContext c8 = s1.createContext("/delay", delayHandler); - HttpContext c81 = s2.createContext("/delay", delayHandler); + HttpTestContext c8 = s1.createContext("/delay", delayHandler); + HttpTestContext c81 = s2.createContext("/delay", delayHandler); - executor = Executors.newCachedThreadPool(); - s1.setExecutor(executor); - s2.setExecutor(executor); - sslparams = ctx.getDefaultSSLParameters(); - //sslparams.setProtocols(new String[]{"TLSv1.2"}); - s2.setHttpsConfigurator(new Configurator(addr.getAddress(), ctx)); s1.start(); s2.start(); @@ -839,7 +809,7 @@ public class SmokeTest { } } - static class RedirectHandler implements HttpHandler { + static class RedirectHandler implements HttpTestHandler { private final String root; private volatile int count = 0; @@ -848,17 +818,17 @@ public class SmokeTest { } @Override - public synchronized void handle(HttpExchange t) throws IOException { + public synchronized void handle(HttpTestExchange t) throws IOException { try (InputStream is = t.getRequestBody()) { is.readAllBytes(); } - Headers responseHeaders = t.getResponseHeaders(); + var responseHeaders = t.getResponseHeaders(); if (count++ < 1) { - responseHeaders.add("Location", root + "/foo/" + count); + responseHeaders.addHeader("Location", root + "/foo/" + count); } else { - responseHeaders.add("Location", SmokeTest.midSizedFilename); + responseHeaders.addHeader("Location", SmokeTest.midSizedFilename); } t.sendResponseHeaders(301, 64 * 1024); byte[] bb = new byte[1024]; @@ -879,7 +849,7 @@ public class SmokeTest { } } - static class RedirectErrorHandler implements HttpHandler { + static class RedirectErrorHandler implements HttpTestHandler { private final String root; private volatile int count = 1; @@ -896,21 +866,21 @@ public class SmokeTest { } @Override - public synchronized void handle(HttpExchange t) throws IOException { + public synchronized void handle(HttpTestExchange t) throws IOException { try (InputStream is = t.getRequestBody()) { is.readAllBytes(); } - Headers map = t.getResponseHeaders(); - String redirect = root + "/foo/" + Integer.toString(count); + var map = t.getResponseHeaders(); + String redirect = root + "/foo/" + count; increment(); - map.add("Location", redirect); - t.sendResponseHeaders(301, -1); + map.addHeader("Location", redirect); + t.sendResponseHeaders(301, HttpTestExchange.RSPBODY_EMPTY); t.close(); } } - static class DelayHandler implements HttpHandler { + static class DelayHandler implements HttpTestHandler { CyclicBarrier bar1 = new CyclicBarrier(2); CyclicBarrier bar2 = new CyclicBarrier(2); @@ -925,34 +895,17 @@ public class SmokeTest { } @Override - public synchronized void handle(HttpExchange he) throws IOException { + public synchronized void handle(HttpTestExchange he) throws IOException { he.getRequestBody().readAllBytes(); try { bar1.await(); bar2.await(); } catch (Exception e) { } - he.sendResponseHeaders(200, -1); // will probably fail + he.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); // will probably fail he.close(); } } - static class Configurator extends HttpsConfigurator { - private final InetAddress serverAddr; - - public Configurator(InetAddress serverAddr, SSLContext ctx) { - super(ctx); - this.serverAddr = serverAddr; - } - - @Override - public void configure(final HttpsParameters params) { - final SSLParameters p = getSSLContext().getDefaultSSLParameters(); - TestServerConfigurator.addSNIMatcher(this.serverAddr, p); - //p.setProtocols(new String[]{"TLSv1.2"}); - params.setSSLParameters(p); - } - } - static final Path CWD = Paths.get("."); static Path getTempFile(int size) throws IOException { @@ -971,120 +924,132 @@ public class SmokeTest { fos.close(); return f.toPath(); } -} -// check for simple hardcoded sequence and use remote address -// to check. -// First 4 requests executed in sequence (should use same connection/address) -// Next 4 requests parallel (should use different addresses) -// Then send 4 requests in parallel x 100 times (same four addresses used all time) -class KeepAliveHandler implements HttpHandler { - final AtomicInteger counter = new AtomicInteger(0); - final AtomicInteger nparallel = new AtomicInteger(0); + // check for simple hardcoded sequence and use remote address + // to check. + // First 4 requests executed in sequence (should use same connection/address) + // Next 4 requests parallel (should use different addresses) + // Then send 4 requests in parallel x 100 times (same four addresses used all time) - final Set portSet = Collections.synchronizedSet(new HashSet<>()); + static class KeepAliveHandler implements HttpTestHandler { + final AtomicInteger counter = new AtomicInteger(0); + final AtomicInteger nparallel = new AtomicInteger(0); - final int[] ports = new int[8]; + final Set portSet = Collections.synchronizedSet(new HashSet<>()); - void sleep(int n) { - try { - Thread.sleep(n); - } catch (InterruptedException e) {} - } + final int[] ports = new int[8]; - synchronized void setPort(int index, int value) { - ports[index] = value; - } - - synchronized int getPort(int index) { - return ports[index]; - } - - synchronized void getPorts(int[] dest, int from) { - dest[0] = ports[from+0]; - dest[1] = ports[from+1]; - dest[2] = ports[from+2]; - dest[3] = ports[from+3]; - } - - static final CountDownLatch latch = new CountDownLatch(4); - static final CountDownLatch latch7 = new CountDownLatch(4); - static final CountDownLatch latch8 = new CountDownLatch(1); - - @Override - public void handle (HttpExchange t) - throws IOException - { - int np = nparallel.incrementAndGet(); - int remotePort = t.getRemoteAddress().getPort(); - String result = "OK"; - int[] lports = new int[4]; - - int n = counter.getAndIncrement(); - - /// First test - if (n < 4) { - setPort(n, remotePort); - } - if (n == 3) { - getPorts(lports, 0); - // check all values in ports[] are the same - if (lports[0] != lports[1] || lports[2] != lports[3] - || lports[0] != lports[2]) { - result = "Error " + Integer.toString(n); - System.out.println(result); - } - } - // Second test - if (n >=4 && n < 8) { - // delay so that this connection doesn't get reused - // before all 4 requests sent - setPort(n, remotePort); - latch.countDown(); - try {latch.await();} catch (InterruptedException e) {} - latch7.countDown(); - } - if (n == 7) { - // wait until all n <= 7 have called setPort(...) - try {latch7.await();} catch (InterruptedException e) {} - getPorts(lports, 4); - // should be all different - if (lports[0] == lports[1] || lports[2] == lports[3] - || lports[0] == lports[2]) { - result = "Error " + Integer.toString(n); - System.out.println(result); - } - // setup for third test - for (int i=0; i<4; i++) { - portSet.add(lports[i]); - } - System.out.printf("Ports: %d, %d, %d, %d\n", lports[0], lports[1], lports[2], lports[3]); - latch8.countDown(); - } - // Third test - if (n > 7) { - // wait until all n == 7 has updated portSet - try {latch8.await();} catch (InterruptedException e) {} - if (np > 4) { - System.err.println("XXX np = " + np); - } - // just check that port is one of the ones in portSet - if (!portSet.contains(remotePort)) { - System.out.println ("UNEXPECTED REMOTE PORT " - + remotePort + " not in " + portSet); - result = "Error " + Integer.toString(n); - System.out.println(result); + void sleep(int n) { + try { + Thread.sleep(n); + } catch (InterruptedException e) { } } - try (InputStream is = t.getRequestBody()) { - is.readAllBytes(); + synchronized void setPort(int index, int value) { + ports[index] = value; + } + + synchronized int getPort(int index) { + return ports[index]; + } + + synchronized void getPorts(int[] dest, int from) { + dest[0] = ports[from + 0]; + dest[1] = ports[from + 1]; + dest[2] = ports[from + 2]; + dest[3] = ports[from + 3]; + } + + static final CountDownLatch latch = new CountDownLatch(4); + static final CountDownLatch latch7 = new CountDownLatch(4); + static final CountDownLatch latch8 = new CountDownLatch(1); + + @Override + public void handle(HttpTestExchange t) + throws IOException { + int np = nparallel.incrementAndGet(); + int remotePort = t.getRemoteAddress().getPort(); + String result = "OK"; + int[] lports = new int[4]; + + int n = counter.getAndIncrement(); + + /// First test + if (n < 4) { + setPort(n, remotePort); + } + if (n == 3) { + getPorts(lports, 0); + // check all values in ports[] are the same + if (lports[0] != lports[1] || lports[2] != lports[3] + || lports[0] != lports[2]) { + result = "Error " + Integer.toString(n); + System.out.println(result); + } + } + // Second test + if (n >= 4 && n < 8) { + // delay so that this connection doesn't get reused + // before all 4 requests sent + setPort(n, remotePort); + latch.countDown(); + try { + latch.await(); + } catch (InterruptedException e) { + } + latch7.countDown(); + } + if (n == 7) { + // wait until all n <= 7 have called setPort(...) + try { + latch7.await(); + } catch (InterruptedException e) { + } + getPorts(lports, 4); + // should be all different + if (lports[0] == lports[1] || lports[2] == lports[3] + || lports[0] == lports[2]) { + result = "Error " + Integer.toString(n); + System.out.println(result); + } + // setup for third test + for (int i = 0; i < 4; i++) { + portSet.add(lports[i]); + } + System.out.printf("Ports: %d, %d, %d, %d\n", lports[0], lports[1], lports[2], lports[3]); + latch8.countDown(); + } + // Third test + if (n > 7) { + // wait until all n == 7 has updated portSet + try { + latch8.await(); + } catch (InterruptedException e) { + } + if (np > 4) { + System.err.println("XXX np = " + np); + } + // just check that port is one of the ones in portSet + if (!portSet.contains(remotePort)) { + System.out.println("UNEXPECTED REMOTE PORT " + + remotePort + " not in " + portSet); + result = "Error " + Integer.toString(n); + System.out.println(result); + } + } + + try (InputStream is = t.getRequestBody()) { + is.readAllBytes(); + } + byte[] bytes = result.getBytes(StandardCharsets.UTF_8); + long responseLength = HttpTestExchange.fixedRsp(bytes.length); + t.sendResponseHeaders(200, responseLength); + OutputStream o = t.getResponseBody(); + o.write(bytes); + t.close(); + nparallel.getAndDecrement(); } - t.sendResponseHeaders(200, result.length()); - OutputStream o = t.getResponseBody(); - o.write(result.getBytes(StandardCharsets.UTF_8)); - t.close(); - nparallel.getAndDecrement(); } } diff --git a/test/jdk/java/net/httpclient/http2/BasicTest.java b/test/jdk/java/net/httpclient/http2/BasicTest.java index 58ab191fc6f..ddcf707e875 100644 --- a/test/jdk/java/net/httpclient/http2/BasicTest.java +++ b/test/jdk/java/net/httpclient/http2/BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,6 @@ * @library /test/jdk/java/net/httpclient/lib * /test/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer - * jdk.httpclient.test.lib.http2.Http2TestExchange - * jdk.httpclient.test.lib.http2.Http2EchoHandler * jdk.test.lib.Asserts * jdk.test.lib.Utils * jdk.test.lib.net.SimpleSSLContext @@ -49,9 +47,9 @@ import java.util.concurrent.*; import java.util.Collections; import java.util.LinkedList; import java.util.List; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2TestExchange; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; import org.junit.jupiter.api.Test; @@ -60,13 +58,13 @@ import static jdk.test.lib.Asserts.assertFileContentsEqual; import static jdk.test.lib.Utils.createTempFile; import static jdk.test.lib.Utils.createTempFileOfSize; -public class BasicTest { +public class BasicTest implements HttpServerAdapters { private static final String TEMP_FILE_PREFIX = HttpClient.class.getPackageName() + '-' + BasicTest.class.getSimpleName() + '-'; static int httpPort, httpsPort; - static Http2TestServer httpServer, httpsServer; + static HttpTestServer httpServer, httpsServer; static HttpClient client = null; static ExecutorService clientExec; static ExecutorService serverExec; @@ -77,18 +75,20 @@ public class BasicTest { static void initialize() throws Exception { try { client = getClient(); - httpServer = new Http2TestServer(false, 0, serverExec, sslContext); - httpServer.addHandler(new Http2EchoHandler(), "/"); + httpServer = HttpTestServer.of( + new Http2TestServer(false, 0, serverExec, sslContext)); + httpServer.addHandler(new HttpTestFileEchoHandler(), "/"); httpServer.addHandler(new EchoWithPingHandler(), "/ping"); httpPort = httpServer.getAddress().getPort(); - httpsServer = new Http2TestServer(true, 0, serverExec, sslContext); - httpsServer.addHandler(new Http2EchoHandler(), "/"); + httpsServer = HttpTestServer.of( + new Http2TestServer(true, 0, serverExec, sslContext)); + httpsServer.addHandler(new HttpTestFileEchoHandler(), "/"); httpsPort = httpsServer.getAddress().getPort(); - httpURIString = "http://localhost:" + httpPort + "/foo/"; - pingURIString = "http://localhost:" + httpPort + "/ping/"; - httpsURIString = "https://localhost:" + httpsPort + "/bar/"; + httpURIString = "http://" + httpServer.serverAuthority() + "/foo/"; + pingURIString = "http://" + httpServer.serverAuthority() + "/ping/"; + httpsURIString = "https://" + httpsServer.serverAuthority() + "/bar/"; httpServer.start(); httpsServer.start(); @@ -104,11 +104,11 @@ public class BasicTest { static CompletableFuture currentCF; - static class EchoWithPingHandler extends Http2EchoHandler { + static class EchoWithPingHandler extends HttpTestFileEchoHandler { private final Object lock = new Object(); @Override - public void handle(Http2TestExchange exchange) throws IOException { + public void handle(HttpTestExchange exchange) throws IOException { // for now only one ping active at a time. don't want to saturate synchronized(lock) { CompletableFuture cf = currentCF; @@ -221,17 +221,17 @@ public class BasicTest { } static void paramsTest() throws Exception { - httpsServer.addHandler((t -> { + httpsServer.addHandler(((HttpTestExchange t) -> { SSLSession s = t.getSSLSession(); String prot = s.getProtocol(); if (prot.equals("TLSv1.2") || prot.equals("TLSv1.3")) { - t.sendResponseHeaders(200, -1); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); } else { System.err.printf("Protocols =%s\n", prot); - t.sendResponseHeaders(500, -1); + t.sendResponseHeaders(500, HttpTestExchange.RSPBODY_EMPTY); } }), "/"); - URI u = new URI("https://localhost:"+httpsPort+"/foo"); + URI u = new URI("https://" + httpsServer.serverAuthority() + "/foo"); HttpClient client = getClient(); HttpRequest req = HttpRequest.newBuilder(u).build(); HttpResponse resp = client.send(req, BodyHandlers.ofString()); diff --git a/test/jdk/java/net/httpclient/http2/ErrorTest.java b/test/jdk/java/net/httpclient/http2/ErrorTest.java index 6ecc27441e1..6b36529b38f 100644 --- a/test/jdk/java/net/httpclient/http2/ErrorTest.java +++ b/test/jdk/java/net/httpclient/http2/ErrorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,8 +60,9 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLParameters; import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; import static java.net.http.HttpClient.Version.HTTP_2; @@ -73,7 +74,7 @@ import org.testng.annotations.Test; * But, the exception that was thrown was not being returned up to application * causing hang problems */ -public class ErrorTest { +public class ErrorTest implements HttpServerAdapters { static final String[] CIPHER_SUITES = new String[]{ "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" }; @@ -91,16 +92,17 @@ public class ErrorTest { .version(HTTP_2) .build(); - Http2TestServer httpsServer = null; + HttpTestServer httpsServer = null; try { SSLContext serverContext = SimpleSSLContext.findSSLContext(); SSLParameters p = serverContext.getSupportedSSLParameters(); p.setApplicationProtocols(new String[]{"h2"}); - httpsServer = new Http2TestServer(true, + Http2TestServer httpsServerImpl = new Http2TestServer(true, 0, exec, serverContext); - httpsServer.addHandler(new Http2EchoHandler(), "/"); + httpsServer = HttpTestServer.of(httpsServerImpl); + httpsServer.addHandler(new HttpTestFileEchoHandler(), "/"); int httpsPort = httpsServer.getAddress().getPort(); String httpsURIString = "https://localhost:" + httpsPort + "/bar/"; diff --git a/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java b/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java index 0f807c33dff..2378b0b6982 100644 --- a/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java +++ b/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ * @library /test/jdk/java/net/httpclient/lib * /test/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer - * jdk.httpclient.test.lib.http2.Http2EchoHandler * jdk.test.lib.Asserts * jdk.test.lib.Utils * jdk.test.lib.net.SimpleSSLContext @@ -41,8 +40,10 @@ import java.net.http.HttpResponse.BodyHandlers; import javax.net.ssl.*; import java.nio.file.*; import java.util.concurrent.*; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestExchange; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; import static java.net.http.HttpClient.Version.HTTP_2; @@ -52,14 +53,13 @@ import static jdk.test.lib.Utils.createTempFileOfSize; import org.testng.annotations.Test; -@Test -public class FixedThreadPoolTest { +public class FixedThreadPoolTest implements HttpServerAdapters { private static final String TEMP_FILE_PREFIX = HttpClient.class.getPackageName() + '-' + FixedThreadPoolTest.class.getSimpleName() + '-'; static int httpPort, httpsPort; - static Http2TestServer httpServer, httpsServer; + static HttpTestServer httpServer, httpsServer; static HttpClient client = null; static ExecutorService exec; private static final SSLContext sslContext = SimpleSSLContext.findSSLContext(); @@ -69,16 +69,18 @@ public class FixedThreadPoolTest { static void initialize() throws Exception { try { client = getClient(); - httpServer = new Http2TestServer(false, 0, exec, sslContext); - httpServer.addHandler(new Http2EchoHandler(), "/"); + httpServer = HttpTestServer.of( + new Http2TestServer(false, 0, exec, sslContext)); + httpServer.addHandler(new HttpTestFileEchoHandler(), "/"); httpPort = httpServer.getAddress().getPort(); - httpsServer = new Http2TestServer(true, 0, exec, sslContext); - httpsServer.addHandler(new Http2EchoHandler(), "/"); + httpsServer = HttpTestServer.of( + new Http2TestServer(true, 0, exec, sslContext)); + httpsServer.addHandler(new HttpTestFileEchoHandler(), "/"); httpsPort = httpsServer.getAddress().getPort(); - httpURIString = "http://localhost:" + httpPort + "/foo/"; - httpsURIString = "https://localhost:" + httpsPort + "/bar/"; + httpURIString = "http://" + httpServer.serverAuthority() + "/foo/"; + httpsURIString = "https://" + httpsServer.serverAuthority() + "/bar/"; httpServer.start(); httpsServer.start(); @@ -193,7 +195,7 @@ public class FixedThreadPoolTest { static void paramsTest() throws Exception { System.err.println("paramsTest"); Http2TestServer server = new Http2TestServer(true, 0, exec, sslContext); - server.addHandler((t -> { + server.addHandler(((Http2TestExchange t) -> { SSLSession s = t.getSSLSession(); String prot = s.getProtocol(); if (prot.equals(expectedTLSVersion(sslContext))) { diff --git a/test/jdk/java/net/httpclient/http2/RedirectTest.java b/test/jdk/java/net/httpclient/http2/RedirectTest.java index 1d7b894bc40..e2acd807bd5 100644 --- a/test/jdk/java/net/httpclient/http2/RedirectTest.java +++ b/test/jdk/java/net/httpclient/http2/RedirectTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.http2.Http2TestExchange * jdk.httpclient.test.lib.http2.Http2TestServer - * jdk.httpclient.test.lib.http2.Http2EchoHandler * jdk.httpclient.test.lib.http2.Http2RedirectHandler * jdk.test.lib.Asserts * jdk.test.lib.net.SimpleSSLContext @@ -48,16 +47,17 @@ import java.util.concurrent.*; import java.util.function.*; import java.util.Arrays; import java.util.Iterator; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.httpclient.test.lib.http2.Http2TestExchange; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.httpclient.test.lib.http2.Http2RedirectHandler; import org.testng.annotations.Test; import static java.net.http.HttpClient.Version.HTTP_2; -public class RedirectTest { +public class RedirectTest implements HttpServerAdapters { static int httpPort; - static Http2TestServer httpServer; + static HttpTestServer httpServer; static HttpClient client; static String httpURIString, altURIString1, altURIString2; @@ -105,23 +105,26 @@ public class RedirectTest { static void initialize() throws Exception { try { client = getClient(); - httpServer = new Http2TestServer(false, 0, null, null); + Http2TestServer http2ServerImpl = + new Http2TestServer(false, 0, null, null); + httpServer = HttpTestServer.of(http2ServerImpl); httpPort = httpServer.getAddress().getPort(); // urls are accessed in sequence below. The first two are on // different servers. Third on same server as second. So, the // client should use the same http connection. - httpURIString = "http://localhost:" + httpPort + "/foo/"; + httpURIString = "http://" + httpServer.serverAuthority() + "/foo/"; httpURI = URI.create(httpURIString); - altURIString1 = "http://localhost:" + httpPort + "/redir"; + altURIString1 = "http://" + httpServer.serverAuthority() + "/redir"; altURI1 = URI.create(altURIString1); - altURIString2 = "http://localhost:" + httpPort + "/redir_again"; + altURIString2 = "http://" + httpServer.serverAuthority() + "/redir_again"; altURI2 = URI.create(altURIString2); + // TODO: remove dependency on Http2RedirectHandler Redirector r = new Redirector(sup(altURIString1, altURIString2)); - httpServer.addHandler(r, "/foo"); - httpServer.addHandler(r, "/redir"); - httpServer.addHandler(new Http2EchoHandler(), "/redir_again"); + http2ServerImpl.addHandler(r, "/foo"); + http2ServerImpl.addHandler(r, "/redir"); + httpServer.addHandler(new HttpTestFileEchoHandler(), "/redir_again"); httpServer.start(); } catch (Throwable e) { diff --git a/test/jdk/java/net/httpclient/http3/H3BasicTest.java b/test/jdk/java/net/httpclient/http3/H3BasicTest.java index 79002d98995..a03df11c1a3 100644 --- a/test/jdk/java/net/httpclient/http3/H3BasicTest.java +++ b/test/jdk/java/net/httpclient/http3/H3BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,8 +57,6 @@ import java.util.concurrent.atomic.AtomicInteger; import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2TestExchange; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.httpclient.test.lib.http3.Http3TestServer; import jdk.test.lib.RandomFactory; import jdk.test.lib.net.SimpleSSLContext; @@ -79,8 +77,8 @@ public class H3BasicTest implements HttpServerAdapters { private static final String CLASS_NAME = H3BasicTest.class.getSimpleName(); static int http3Port, https2Port; - static Http3TestServer http3OnlyServer; - static Http2TestServer https2AltSvcServer; + static HttpTestServer http3OnlyServer; + static HttpTestServer https2AltSvcServer; static HttpClient client = null; static ExecutorService clientExec; static ExecutorService serverExec; @@ -92,20 +90,21 @@ public class H3BasicTest implements HttpServerAdapters { client = getClient(); // server that only supports HTTP/3 - http3OnlyServer = new Http3TestServer(sslContext, serverExec); - http3OnlyServer.addHandler("/", new Http2EchoHandler()); - http3OnlyServer.addHandler("/ping", new EchoWithPingHandler()); + http3OnlyServer = HttpTestServer.of(new Http3TestServer(sslContext, serverExec)); + http3OnlyServer.createContext("/", new HttpTestFileEchoHandler()); + http3OnlyServer.createContext("/ping", new EchoWithPingHandler()); http3Port = http3OnlyServer.getAddress().getPort(); System.out.println("HTTP/3 server started at localhost:" + http3Port); // server that supports both HTTP/2 and HTTP/3, with HTTP/3 on an altSvc port. - https2AltSvcServer = new Http2TestServer(true, 0, serverExec, sslContext); + Http2TestServer http2ServerImpl = new Http2TestServer(true, 0, serverExec, sslContext); if (RANDOM.nextBoolean()) { - https2AltSvcServer.enableH3AltServiceOnEphemeralPort(); + http2ServerImpl.enableH3AltServiceOnEphemeralPort(); } else { - https2AltSvcServer.enableH3AltServiceOnSamePort(); + http2ServerImpl.enableH3AltServiceOnSamePort(); } - https2AltSvcServer.addHandler(new Http2EchoHandler(), "/"); + https2AltSvcServer = HttpTestServer.of(http2ServerImpl); + https2AltSvcServer.addHandler(new HttpTestFileEchoHandler(), "/"); https2Port = https2AltSvcServer.getAddress().getPort(); if (https2AltSvcServer.supportsH3DirectConnection()) { System.out.println("HTTP/2 server (same HTTP/3 origin) started at localhost:" + https2Port); @@ -113,9 +112,9 @@ public class H3BasicTest implements HttpServerAdapters { System.out.println("HTTP/2 server (different HTTP/3 origin) started at localhost:" + https2Port); } - http3URIString = "https://localhost:" + http3Port + "/foo/"; - pingURIString = "https://localhost:" + http3Port + "/ping/"; - https2URIString = "https://localhost:" + https2Port + "/bar/"; + http3URIString = "https://" + http3OnlyServer.serverAuthority() + "/foo/"; + pingURIString = "https://" + http3OnlyServer.serverAuthority() + "/ping/"; + https2URIString = "https://" + https2AltSvcServer.serverAuthority() + "/bar/"; http3OnlyServer.start(); https2AltSvcServer.start(); @@ -131,11 +130,11 @@ public class H3BasicTest implements HttpServerAdapters { static CompletableFuture currentCF; - static class EchoWithPingHandler extends Http2EchoHandler { + static class EchoWithPingHandler extends HttpTestFileEchoHandler { private final Object lock = new Object(); @Override - public void handle(Http2TestExchange exchange) throws IOException { + public void handle(HttpTestExchange exchange) throws IOException { // for now only one ping active at a time. don't want to saturate System.out.println("PING handler invoked for " + exchange.getRequestURI()); synchronized(lock) { @@ -292,16 +291,16 @@ public class H3BasicTest implements HttpServerAdapters { } static void paramsTest() throws Exception { - URI u = new URI("https://localhost:"+https2Port+"/foo"); + URI u = new URI("https://" + https2AltSvcServer.serverAuthority() + "/foo"); System.out.println("paramsTest: Request to " + u); - https2AltSvcServer.addHandler((t -> { + https2AltSvcServer.addHandler(((HttpTestExchange t) -> { SSLSession s = t.getSSLSession(); String prot = s.getProtocol(); if (prot.equals("TLSv1.3")) { - t.sendResponseHeaders(200, -1); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); } else { System.err.printf("Protocols =%s\n", prot); - t.sendResponseHeaders(500, -1); + t.sendResponseHeaders(500, HttpTestExchange.RSPBODY_EMPTY); } }), "/"); HttpClient client = getClient(); diff --git a/test/jdk/java/net/httpclient/http3/H3ConnectionPoolTest.java b/test/jdk/java/net/httpclient/http3/H3ConnectionPoolTest.java index 0449db3e961..c90059ccbfd 100644 --- a/test/jdk/java/net/httpclient/http3/H3ConnectionPoolTest.java +++ b/test/jdk/java/net/httpclient/http3/H3ConnectionPoolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,6 @@ import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -51,9 +50,7 @@ import java.util.function.Supplier; import javax.net.ssl.SSLContext; import jdk.httpclient.test.lib.common.HttpServerAdapters; -import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.httpclient.test.lib.http3.Http3TestServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.Test; @@ -73,17 +70,17 @@ public class H3ConnectionPoolTest implements HttpServerAdapters { private static final String CLASS_NAME = H3ConnectionPoolTest.class.getSimpleName(); static int altsvcPort, https2Port, http3Port; - static Http3TestServer http3OnlyServer; - static Http2TestServer https2AltSvcServer; + static HttpTestServer http3OnlyServer; + static HttpTestServer https2AltSvcServer; static volatile HttpClient client = null; private static final SSLContext sslContext = SimpleSSLContext.findSSLContext(); static volatile String http3OnlyURIString, https2URIString, http3AltSvcURIString, http3DirectURIString; static void initialize(boolean samePort) throws Exception { - initialize(samePort, Http2EchoHandler::new); + initialize(samePort, HttpTestFileEchoHandler::new); } - static void initialize(boolean samePort, Supplier handlers) throws Exception { + static void initialize(boolean samePort, Supplier handlers) throws Exception { System.out.println("\nConfiguring for advertised AltSvc on " + (samePort ? "same port" : "ephemeral port")); try { @@ -91,16 +88,17 @@ public class H3ConnectionPoolTest implements HttpServerAdapters { client = getClient(); // server that supports both HTTP/2 and HTTP/3, with HTTP/3 on an altSvc port. - https2AltSvcServer = new Http2TestServer(true, sslContext); + Http2TestServer serverImpl = new Http2TestServer(true, sslContext); if (samePort) { System.out.println("Attempting to enable advertised HTTP/3 service on same port"); - https2AltSvcServer.enableH3AltServiceOnSamePort(); + serverImpl.enableH3AltServiceOnSamePort(); System.out.println("Advertised AltSvc on same port " + - (https2AltSvcServer.supportsH3DirectConnection() ? "enabled" : " not enabled")); + (serverImpl.supportsH3DirectConnection() ? "enabled" : " not enabled")); } else { System.out.println("Attempting to enable advertised HTTP/3 service on different port"); - https2AltSvcServer.enableH3AltServiceOnEphemeralPort(); + serverImpl.enableH3AltServiceOnEphemeralPort(); } + https2AltSvcServer = HttpTestServer.of(serverImpl); https2AltSvcServer.addHandler(handlers.get(), "/" + CLASS_NAME + "/https2/"); https2AltSvcServer.addHandler(handlers.get(), "/" + CLASS_NAME + "/h2h3/"); https2Port = https2AltSvcServer.getAddress().getPort(); @@ -113,18 +111,20 @@ public class H3ConnectionPoolTest implements HttpServerAdapters { // one advertised (the alt service endpoint og the HTTP/2 server) // one non advertised (the direct endpoint, at the same authority as HTTP/2, but which // is in fact our http3OnlyServer) + Http3TestServer http3ServerImpl; try { - http3OnlyServer = new Http3TestServer(sslContext, samePort ? 0 : https2Port); + http3ServerImpl = new Http3TestServer(sslContext, samePort ? 0 : https2Port); System.out.println("Unadvertised service enabled on " + (samePort ? "ephemeral port" : "same port")); } catch (IOException ex) { System.out.println("Can't create HTTP/3 server on same port: " + ex); - http3OnlyServer = new Http3TestServer(sslContext, 0); + http3ServerImpl = new Http3TestServer(sslContext, 0); } - http3OnlyServer.addHandler("/" + CLASS_NAME + "/http3/", handlers.get()); - http3OnlyServer.addHandler("/" + CLASS_NAME + "/h2h3/", handlers.get()); + http3OnlyServer = HttpTestServer.of(http3ServerImpl); + http3OnlyServer.createContext("/" + CLASS_NAME + "/http3/", handlers.get()); + http3OnlyServer.createContext("/" + CLASS_NAME + "/h2h3/", handlers.get()); http3OnlyServer.start(); - http3Port = http3OnlyServer.getQuicServer().getAddress().getPort(); + http3Port = http3ServerImpl.getQuicServer().getAddress().getPort(); if (http3Port == https2Port) { System.out.println("HTTP/3 server enabled on same port than HTTP/2 server"); diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java index 10633340a66..b40cef5d4e6 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -251,6 +251,60 @@ public interface HttpServerAdapters { * A version agnostic adapter class for HTTP Server Exchange. */ public static abstract class HttpTestExchange implements AutoCloseable { + /** + * This constant can be passed to {@link #sendResponseHeaders(int, long)} + * to indicate an empty response. + */ + public static final int RSPBODY_EMPTY = 0; + /** + * This constant can be passed to {@link #sendResponseHeaders(int, long)} + * to indicate that the response will be chunked. + */ + public static final int RSPBODY_CHUNKED = -1; + + /** + * {@return the response length to pass to {@link #sendResponseHeaders(int, long)} + * if the response is not chunked} + * @param bytes the response length + */ + public static long fixedRsp(long bytes) { + return bytes == 0 ? RSPBODY_EMPTY : bytes; + } + + /** + * {@return the response length to pass to {@link #sendResponseHeaders(int, long)}} + * This is the response length when `chunked` is false, and + * {@link #RSPBODY_CHUNKED} otherwise. + * @param length The number of bytes to send + * @param chunked Whether the response should be chunked + */ + public static long responseLength(long length, boolean chunked) { + return chunked ? HttpTestExchange.RSPBODY_CHUNKED : fixedRsp(length); + } + + /** + * {@return true if the {@linkplain #getRequestHeaders() request headers} + * contain {@code XFixed: yes}} + */ + public boolean rspFixedRequested() { + return "yes".equals(getRequestHeaders() + .firstValue("XFixed") + .orElse(null)); + } + + /** + * {@return the length to be passed to {@link #sendResponseHeaders(int, long)}, + * taking into account whether using {@linkplain #rspFixedRequested() + * fixed length was requested} in the {@linkplain #getRequestHeaders() + * request headers}.} + * By default, returns {@link #RSPBODY_CHUNKED} unless {@linkplain + * #rspFixedRequested() fixed length was requested}. + * @param length the length to use in content-length if fixed length is used. + */ + public long responseLength(long length) { + return responseLength(length, !rspFixedRequested()); + } + public abstract Version getServerVersion(); public abstract Version getExchangeVersion(); public abstract InputStream getRequestBody(); @@ -265,6 +319,10 @@ public interface HttpServerAdapters { public abstract InetSocketAddress getLocalAddress(); public abstract String getConnectionKey(); public abstract SSLSession getSSLSession(); + public CompletableFuture sendPing() { + throw new UnsupportedOperationException("sendPing not supported on " + + getExchangeVersion()); + } public void serverPush(URI uri, HttpHeaders reqHeaders, byte[] body) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(body); serverPush(uri, reqHeaders, bais); @@ -543,6 +601,11 @@ public interface HttpServerAdapters { throws IOException { exchange.serverPush(uri, reqHeaders, rspHeaders, body); } + @Override + public CompletableFuture sendPing() { + return exchange.sendPing(); + } + @Override public void requestStopSending(long errorCode) { exchange.requestStopSending(errorCode); @@ -701,7 +764,8 @@ public interface HttpServerAdapters { /** * An echo handler that can be used to transfer large amount of data, and - * uses file on the file system to download the input. + * uses file on the file system to download the input. This handler honors + * the {@code XFixed} header. */ // TODO: it would be good if we could merge this with the Http2EchoHandler, // from which this code was copied and adapted. @@ -737,7 +801,7 @@ public interface HttpServerAdapters { assertFileContentsEqual(check, outfile.toPath()); } catch (Throwable x) { System.err.println("Files do not match: " + x); - t.sendResponseHeaders(500, -1); + t.sendResponseHeaders(500, HttpTestExchange.RSPBODY_EMPTY); outfile.delete(); os.close(); return; @@ -747,7 +811,7 @@ public interface HttpServerAdapters { // return the number of bytes received (no echo) String summary = requestHeaders.firstValue("XSummary").orElse(null); if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); + t.sendResponseHeaders(200, HttpTestExchange.fixedRsp(count)); os = t.getResponseBody(); if (!t.getRequestMethod().equals("HEAD")) { long count1 = is1.transferTo(os); @@ -756,7 +820,7 @@ public interface HttpServerAdapters { System.err.printf("EchoHandler HEAD received, no bytes sent%n"); } } else { - t.sendResponseHeaders(200, -1); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_CHUNKED); os = t.getResponseBody(); if (!t.getRequestMethod().equals("HEAD")) { long count1 = is1.transferTo(os); @@ -780,6 +844,14 @@ public interface HttpServerAdapters { } } + /** + * An echo handler that can be used to transfer small amounts of data. + * All the request data is read in memory in a single byte array before + * being sent back. If the handler is {@linkplain #useXFixed() configured + * to honor the {@code XFixed} header}, and the request headers do not + * specify {@code XFixed: yes}, the data is sent back in chunk mode. + * Otherwise, chunked mode is not used (this is the default). + */ public static class HttpTestEchoHandler implements HttpTestHandler { private final boolean printBytes; @@ -791,10 +863,26 @@ public interface HttpServerAdapters { this.printBytes = printBytes; } + /** + * {@return whether the {@code XFixed} header should be + * honored. If this method returns false, chunked mode will + * not be used. If this method returns true, chunked mode + * will be used unless the request headers contain + * {@code XFixed: yes}} + */ + protected boolean useXFixed() { + return false; + } + @Override public void handle(HttpTestExchange t) throws IOException { - try (InputStream is = t.getRequestBody(); - OutputStream os = t.getResponseBody()) { + System.err.printf("EchoHandler received request to %s from %s (version %s)%n", + t.getRequestURI(), t.getRemoteAddress(), t.getExchangeVersion()); + InputStream is = null; + OutputStream os = null; + try { + is = t.getRequestBody(); + os = t.getResponseBody(); byte[] bytes = is.readAllBytes(); if (printBytes) { printBytes(System.out, "Echo server got " @@ -804,12 +892,31 @@ public interface HttpServerAdapters { t.getResponseHeaders().addHeader("Content-type", t.getRequestHeaders().firstValue("Content-type").get()); } - t.sendResponseHeaders(200, bytes.length); - if (!t.getRequestMethod().equals("HEAD")) { + + long responseLength = useXFixed() + ? t.responseLength(bytes.length) + : HttpTestExchange.fixedRsp(bytes.length); + t.sendResponseHeaders(200, responseLength); + if (!t.getRequestMethod().equals("HEAD") && bytes.length > 0) { os.write(bytes); } + } finally { + if (os != null) close(t, os); + if (is != null) close(t, is); } } + protected void close(OutputStream os) throws IOException { + os.close(); + } + protected void close(InputStream is) throws IOException { + is.close(); + } + protected void close(HttpTestExchange t, OutputStream os) throws IOException { + close(os); + } + protected void close(HttpTestExchange t, InputStream is) throws IOException { + close(is); + } } public static class HttpTestRedirectHandler implements HttpTestHandler { @@ -854,6 +961,117 @@ public interface HttpServerAdapters { } } + /** + * A simple FileServerHandler that understand "XFixed" header. + * If the request headers contain {@code XFixed: yes}, a fixed + * length response is sent. Otherwise, the response will be + * chunked. Note that for directories the response is always + * chunked. + */ + class HttpTestFileServerHandler implements HttpTestHandler { + + String docroot; + + public HttpTestFileServerHandler(String docroot) { + this.docroot = docroot; + } + + public void handle(HttpTestExchange t) + throws IOException + { + InputStream is = t.getRequestBody(); + var rspHeaders = t.getResponseHeaders(); + URI uri = t.getRequestURI(); + String path = uri.getPath(); + + int x = 0; + while (is.read() != -1) x++; + is.close(); + File f = new File(docroot, path); + if (!f.exists()) { + notfound(t, path); + return; + } + + String method = t.getRequestMethod(); + if (method.equals("HEAD")) { + rspHeaders.addHeader("Content-Length", Long.toString(f.length())); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); + t.close(); + } else if (!method.equals("GET")) { + t.sendResponseHeaders(405, HttpTestExchange.RSPBODY_EMPTY); + t.close(); + return; + } + + if (path.endsWith(".html") || path.endsWith(".htm")) { + rspHeaders.addHeader("Content-Type", "text/html"); + } else { + rspHeaders.addHeader("Content-Type", "text/plain"); + } + if (f.isDirectory()) { + if (!path.endsWith("/")) { + moved (t); + return; + } + rspHeaders.addHeader("Content-Type", "text/html"); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_CHUNKED); + String[] list = f.list(); + try (final OutputStream os = t.getResponseBody(); + final PrintStream p = new PrintStream(os)) { + p.println("

    Directory listing for: " + path + "

    "); + p.println("
      "); + for (int i = 0; i < list.length; i++) { + p.println("
    • " + list[i] + "
    • "); + } + p.println("


    "); + p.flush(); + } + } else { + long clen = f.length(); + t.sendResponseHeaders(200, t.responseLength(clen)); + long count = 0; + try (final OutputStream os = t.getResponseBody(); + final FileInputStream fis = new FileInputStream (f)) { + byte[] buf = new byte [16 * 1024]; + int len; + while ((len=fis.read(buf)) != -1) { + os.write(buf, 0, len); + count += len; + } + if (clen != count) { + System.err.println("FileServerHandler: WARNING: count of bytes sent does not match content-length"); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + void moved(HttpTestExchange t) throws IOException { + var req = t.getRequestHeaders(); + var rsp = t.getResponseHeaders(); + URI uri = t.getRequestURI(); + String host = req.firstValue("Host").get(); + String location = "http://"+host+uri.getPath() + "/"; + rsp.addHeader("Content-Type", "text/html"); + rsp.addHeader("Location", location); + t.sendResponseHeaders(301, HttpTestExchange.RSPBODY_EMPTY); + t.close(); + } + + void notfound(HttpTestExchange t, String p) throws IOException { + t.getResponseHeaders().addHeader("Content-Type", "text/html"); + t.sendResponseHeaders(404, HttpTestExchange.RSPBODY_CHUNKED); + OutputStream os = t.getResponseBody(); + String s = "

    File not found

    "; + s = s + p + "

    "; + os.write(s.getBytes()); + os.close(); + t.close(); + } + } + public static boolean expectException(HttpTestExchange e) { HttpTestRequestHeaders h = e.getRequestHeaders(); Optional expectException = h.firstValue("X-expect-exception"); @@ -1144,6 +1362,22 @@ public interface HttpServerAdapters { public abstract InetSocketAddress getAddress(); public abstract Version getVersion(); + /** + * Adds a new handler and return its context. + * @implSpec + * This method just returns {@link #addHandler(HttpTestHandler, String) + * addHandler(context, root)} + * @apiNote + * This is a convenience method to help migrate from + * {@link HttpServer#createContext(String, HttpHandler)}. + * @param root The context root + * @param handler The handler to attach to the context + * @return the context to which the new handler is attached + */ + public HttpTestContext createContext(String root, HttpTestHandler handler) { + return addHandler(handler, root); + } + /** * {@return the HTTP3 test server which is acting as an alt-service for this server, * if any} diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java deleted file mode 100644 index 047b52b3699..00000000000 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.httpclient.test.lib.http2; - -import java.io.*; -import java.net.http.HttpHeaders; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import jdk.internal.net.http.common.HttpHeadersBuilder; - -public class EchoHandler implements Http2Handler { - static final Path CWD = Paths.get("."); - - public EchoHandler() {} - - @Override - public void handle(Http2TestExchange t) - throws IOException { - try { - System.err.println("EchoHandler received request to " + t.getRequestURI()); - InputStream is = t.getRequestBody(); - HttpHeaders map = t.getRequestHeaders(); - HttpHeadersBuilder map1 = t.getResponseHeaders(); - map1.addHeader("X-Hello", "world"); - map1.addHeader("X-Bye", "universe"); - String fixedrequest = map.firstValue("XFixed").orElse(null); - File outfile = Files.createTempFile(CWD, "foo", "bar").toFile(); - //System.err.println ("QQQ = " + outfile.toString()); - FileOutputStream fos = new FileOutputStream(outfile); - int count = (int) is.transferTo(fos); - System.err.printf("EchoHandler read %d bytes\n", count); - is.close(); - fos.close(); - InputStream is1 = new FileInputStream(outfile); - OutputStream os = null; - // return the number of bytes received (no echo) - String summary = map.firstValue("XSummary").orElse(null); - if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); - os = t.getResponseBody(); - int count1 = (int)is1.transferTo(os); - System.err.printf("EchoHandler wrote %d bytes\n", count1); - } else { - t.sendResponseHeaders(200, 0); - os = t.getResponseBody(); - int count1 = (int)is1.transferTo(os); - System.err.printf("EchoHandler wrote %d bytes\n", count1); - - if (summary != null) { - String s = Integer.toString(count); - os.write(s.getBytes()); - } - } - outfile.delete(); - os.close(); - is1.close(); - } catch (Throwable e) { - e.printStackTrace(); - throw new IOException(e); - } - } -} diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java deleted file mode 100644 index fd0b03ac691..00000000000 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.httpclient.test.lib.http2; - -import java.io.*; -import java.net.http.HttpHeaders; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import jdk.internal.net.http.common.HttpHeadersBuilder; - -import static jdk.test.lib.Asserts.assertFileContentsEqual; - -public class Http2EchoHandler implements Http2Handler { - static final Path CWD = Paths.get("."); - - public Http2EchoHandler() {} - - @Override - public void handle(Http2TestExchange t) - throws IOException { - try { - System.err.printf("EchoHandler received request to %s from %s\n", - t.getRequestURI(), t.getRemoteAddress()); - InputStream is = t.getRequestBody(); - HttpHeaders map = t.getRequestHeaders(); - HttpHeadersBuilder headersBuilder = t.getResponseHeaders(); - headersBuilder.addHeader("X-Hello", "world"); - headersBuilder.addHeader("X-Bye", "universe"); - String fixedrequest = map.firstValue("XFixed").orElse(null); - File outfile = Files.createTempFile(CWD, "foo", "bar").toFile(); - //System.err.println ("QQQ = " + outfile.toString()); - FileOutputStream fos = new FileOutputStream(outfile); - long count = is.transferTo(fos); - System.err.printf("EchoHandler read %s bytes\n", count); - is.close(); - fos.close(); - InputStream is1 = new FileInputStream(outfile); - OutputStream os = null; - - Path check = map.firstValue("X-Compare").map((String s) -> Path.of(s)).orElse(null); - if (check != null) { - System.err.println("EchoHandler checking file match: " + check); - try { - assertFileContentsEqual(check, outfile.toPath()); - } catch (Throwable x) { - System.err.println("Files do not match: " + x); - t.sendResponseHeaders(500, -1); - outfile.delete(); - os.close(); - return; - } - } - - // return the number of bytes received (no echo) - String summary = map.firstValue("XSummary").orElse(null); - if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); - os = t.getResponseBody(); - long count1 = is1.transferTo(os); - System.err.printf("EchoHandler wrote %s bytes\n", count1); - } else { - t.sendResponseHeaders(200, 0); - os = t.getResponseBody(); - long count1 = is1.transferTo(os); - System.err.printf("EchoHandler wrote %s bytes\n", count1); - - if (summary != null) { - String s = Long.toString(count); - os.write(s.getBytes()); - } - } - outfile.delete(); - os.close(); - is1.close(); - } catch (Throwable e) { - e.printStackTrace(); - throw new IOException(e); - } - } -} diff --git a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java index f1f32bee310..641fbf2e495 100644 --- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java +++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java @@ -37,7 +37,9 @@ /* * @test id=default * @summary Conformance testing variant of JSR-166 tck tests. + * @library /test/lib * @build * + * @build jdk.test.lib.Platform * @modules java.management java.base/jdk.internal.util * @run junit/othervm/timeout=1000 JSR166TestCase */ @@ -46,7 +48,9 @@ * @test id=forkjoinpool-common-parallelism * @summary Test implementation details variant of JSR-166 * tck tests with ForkJoinPool common parallelism. + * @library /test/lib * @build * + * @build jdk.test.lib.Platform * @modules java.management java.base/jdk.internal.util * @run junit/othervm/timeout=1000 * --add-opens java.base/java.util.concurrent=ALL-UNNAMED @@ -68,7 +72,9 @@ * @summary Remaining test implementation details variant of * JSR-166 tck tests apart from ForkJoinPool common * parallelism. + * @library /test/lib * @build * + * @build jdk.test.lib.Platform * @modules java.management java.base/jdk.internal.util * @run junit/othervm/timeout=1000 * --add-opens java.base/java.util.concurrent=ALL-UNNAMED @@ -135,6 +141,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Pattern; +import jdk.test.lib.Platform; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestResult; @@ -624,6 +631,13 @@ public class JSR166TestCase extends TestCase { "SynchronousQueue20Test", "ReentrantReadWriteLock20Test" }; + + if (Platform.isS390x()) { + java20TestClassNames = new String[] { + "ForkJoinPool20Test", + }; + } + addNamedTestClasses(suite, java20TestClassNames); } diff --git a/test/jdk/javax/accessibility/8377428/TestVoiceOverHiddenComponentNavigation.java b/test/jdk/javax/accessibility/8377428/TestVoiceOverHiddenComponentNavigation.java new file mode 100644 index 00000000000..f8af95159c2 --- /dev/null +++ b/test/jdk/javax/accessibility/8377428/TestVoiceOverHiddenComponentNavigation.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.accessibility.AccessibleComponent; +import javax.accessibility.AccessibleContext; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; + +/* + * @test + * @key headful + * @bug 8377428 + * @summary manual test for VoiceOver reading hidden components + * @requires os.family == "mac" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestVoiceOverHiddenComponentNavigation + */ + +public class TestVoiceOverHiddenComponentNavigation { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Test UI contains four rows. Each row contains a JButton. + Two of the rows are hidden, and two are visible. + + Follow these steps to test the behaviour: + + 1. Start the VoiceOver (Press Command + F5) application + 2. Move VoiceOver cursor to one of the visible buttons. + 3. Press CTRL + ALT + LEFT to move the VoiceOver cursor back + 4. Repeat step 3 until you reach the "Close" button. + + If VoiceOver ever references a "Hidden Button": then this test + fails. + """; + + PassFailJFrame.builder() + .title("TestVoiceOverHiddenComponentNavigation Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TestVoiceOverHiddenComponentNavigation::createUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createUI() { + JPanel rows = new JPanel(); + rows.setLayout(new BoxLayout(rows, BoxLayout.Y_AXIS)); + rows.add(createRow("Hidden Button", "Row 1", false, false)); + rows.add(createRow("Hidden Button", "Row 2", false, true)); + rows.add(createRow("Visible Button", "Row 3", true, false)); + rows.add(createRow("Visible Button", "Row 4", true, true)); + + JFrame frame = new JFrame("A Frame hidden JButtons"); + frame.getContentPane().add(rows); + frame.pack(); + return frame; + } + + /** + * Create a row to add to this demo frame. + * + * @param buttonText the button name/text + * @param panelAXName the panel accessible name + * @param isVisible whether JPanel.isVisible() should be true + * @param useNullAXComponent if true then + * AccessibleJPanel.getAccessibleComponent + * returns null. This was added to test a + * particular code path. + * @return a row for the demo frame + */ + private static JPanel createRow(String buttonText, String panelAXName, + boolean isVisible, + boolean useNullAXComponent) { + JPanel returnValue = new JPanel() { + @Override + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJPanel() { + @Override + public AccessibleComponent getAccessibleComponent() { + if (useNullAXComponent) { + return null; + } else { + return super.getAccessibleComponent(); + } + } + }; + accessibleContext.setAccessibleName(panelAXName); + } + return accessibleContext; + } + }; + returnValue.setVisible(isVisible); + JButton button = new JButton(buttonText); + returnValue.add(button); + return returnValue; + } +} \ No newline at end of file diff --git a/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java index e450e3ead7e..1a50b5d8945 100644 --- a/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -957,11 +972,11 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -972,11 +987,11 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -992,7 +1007,7 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1005,7 +1020,7 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java index fae7b678a09..fa801f05a19 100644 --- a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java @@ -62,6 +62,49 @@ public class Byte128VectorTests extends AbstractVectorTest { ByteVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final byte CONST_SHIFT = Byte.SIZE / 2; @@ -96,10 +139,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Byte128VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Byte128VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Byte128VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Byte128VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Byte128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Byte128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Byte128VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Byte128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Byte128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Byte128VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1025,10 +1068,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1036,10 +1079,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1047,10 +1090,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1586,7 +1629,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1601,19 +1644,19 @@ public class Byte128VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,7 +1671,7 @@ public class Byte128VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3665,20 +3708,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3767,20 +3810,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3869,20 +3912,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3971,20 +4014,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4073,20 +4116,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4175,20 +4218,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4277,20 +4320,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4379,20 +4422,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4481,20 +4524,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4583,20 +4626,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4733,20 +4776,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4825,7 +4868,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4845,7 +4888,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4866,7 +4909,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4886,7 +4929,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4905,7 +4948,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4924,7 +4967,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4947,7 +4990,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4966,7 +5009,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4989,7 +5032,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5008,7 +5051,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5027,7 +5070,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5050,7 +5093,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5069,7 +5112,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5092,7 +5135,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5111,7 +5154,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5134,7 +5177,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5153,7 +5196,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5176,7 +5219,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5195,7 +5238,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5218,7 +5261,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5237,7 +5280,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5260,7 +5303,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5279,7 +5322,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5302,7 +5345,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5321,7 +5364,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5344,7 +5387,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5361,7 +5404,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5381,7 +5424,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5397,7 +5440,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5417,7 +5460,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5433,7 +5476,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5453,7 +5496,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5469,7 +5512,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5489,7 +5532,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5770,7 +5813,7 @@ public class Byte128VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6720,10 +6763,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6752,7 +6795,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6768,7 +6811,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7019,7 +7062,7 @@ public class Byte128VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7047,7 +7090,7 @@ public class Byte128VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7062,7 +7105,7 @@ public class Byte128VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7165,7 +7208,7 @@ public class Byte128VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7191,7 +7234,7 @@ public class Byte128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7205,7 +7248,7 @@ public class Byte128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7227,7 +7270,7 @@ public class Byte128VectorTests extends AbstractVectorTest { static void loopBoundByte128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7235,14 +7278,14 @@ public class Byte128VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByte128VectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7296,7 +7339,7 @@ public class Byte128VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByte128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java index a818043aedc..1b1f6c0ed36 100644 --- a/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -957,11 +972,11 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -972,11 +987,11 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -992,7 +1007,7 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1005,7 +1020,7 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java index 0e59db7d05d..ec8958e0605 100644 --- a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java @@ -62,6 +62,49 @@ public class Byte256VectorTests extends AbstractVectorTest { ByteVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final byte CONST_SHIFT = Byte.SIZE / 2; @@ -96,10 +139,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Byte256VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Byte256VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Byte256VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Byte256VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Byte256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Byte256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Byte256VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Byte256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Byte256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Byte256VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1025,10 +1068,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1036,10 +1079,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1047,10 +1090,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1586,7 +1629,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1601,19 +1644,19 @@ public class Byte256VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,7 +1671,7 @@ public class Byte256VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3665,20 +3708,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3767,20 +3810,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3869,20 +3912,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3971,20 +4014,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4073,20 +4116,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4175,20 +4218,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4277,20 +4320,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4379,20 +4422,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4481,20 +4524,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4583,20 +4626,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4733,20 +4776,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4825,7 +4868,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4845,7 +4888,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4866,7 +4909,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4886,7 +4929,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4905,7 +4948,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4924,7 +4967,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4947,7 +4990,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4966,7 +5009,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4989,7 +5032,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5008,7 +5051,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5027,7 +5070,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5050,7 +5093,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5069,7 +5112,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5092,7 +5135,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5111,7 +5154,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5134,7 +5177,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5153,7 +5196,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5176,7 +5219,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5195,7 +5238,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5218,7 +5261,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5237,7 +5280,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5260,7 +5303,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5279,7 +5322,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5302,7 +5345,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5321,7 +5364,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5344,7 +5387,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5361,7 +5404,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5381,7 +5424,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5397,7 +5440,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5417,7 +5460,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5433,7 +5476,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5453,7 +5496,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5469,7 +5512,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5489,7 +5532,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5770,7 +5813,7 @@ public class Byte256VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6720,10 +6763,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6752,7 +6795,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6768,7 +6811,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7019,7 +7062,7 @@ public class Byte256VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7047,7 +7090,7 @@ public class Byte256VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7062,7 +7105,7 @@ public class Byte256VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7165,7 +7208,7 @@ public class Byte256VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7191,7 +7234,7 @@ public class Byte256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7205,7 +7248,7 @@ public class Byte256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7227,7 +7270,7 @@ public class Byte256VectorTests extends AbstractVectorTest { static void loopBoundByte256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7235,14 +7278,14 @@ public class Byte256VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByte256VectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7296,7 +7339,7 @@ public class Byte256VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByte256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java index 7df9c1fbf10..61168532de0 100644 --- a/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -957,11 +972,11 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -972,11 +987,11 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -992,7 +1007,7 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1005,7 +1020,7 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java index 5ad3bbdbc05..711cff6bca3 100644 --- a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java @@ -62,6 +62,49 @@ public class Byte512VectorTests extends AbstractVectorTest { ByteVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final byte CONST_SHIFT = Byte.SIZE / 2; @@ -96,10 +139,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Byte512VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Byte512VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Byte512VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Byte512VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Byte512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Byte512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Byte512VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Byte512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Byte512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Byte512VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1025,10 +1068,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1036,10 +1079,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1047,10 +1090,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1586,7 +1629,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1601,19 +1644,19 @@ public class Byte512VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,7 +1671,7 @@ public class Byte512VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3665,20 +3708,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3767,20 +3810,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3869,20 +3912,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3971,20 +4014,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4073,20 +4116,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4175,20 +4218,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4277,20 +4320,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4379,20 +4422,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4481,20 +4524,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4583,20 +4626,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4733,20 +4776,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4825,7 +4868,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4845,7 +4888,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4866,7 +4909,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4886,7 +4929,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4905,7 +4948,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4924,7 +4967,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4947,7 +4990,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4966,7 +5009,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4989,7 +5032,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5008,7 +5051,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5027,7 +5070,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5050,7 +5093,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5069,7 +5112,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5092,7 +5135,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5111,7 +5154,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5134,7 +5177,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5153,7 +5196,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5176,7 +5219,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5195,7 +5238,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5218,7 +5261,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5237,7 +5280,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5260,7 +5303,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5279,7 +5322,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5302,7 +5345,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5321,7 +5364,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5344,7 +5387,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5361,7 +5404,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5381,7 +5424,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5397,7 +5440,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5417,7 +5460,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5433,7 +5476,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5453,7 +5496,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5469,7 +5512,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5489,7 +5532,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5770,7 +5813,7 @@ public class Byte512VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6720,10 +6763,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6752,7 +6795,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6768,7 +6811,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7019,7 +7062,7 @@ public class Byte512VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7047,7 +7090,7 @@ public class Byte512VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7062,7 +7105,7 @@ public class Byte512VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7165,7 +7208,7 @@ public class Byte512VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7191,7 +7234,7 @@ public class Byte512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7205,7 +7248,7 @@ public class Byte512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7227,7 +7270,7 @@ public class Byte512VectorTests extends AbstractVectorTest { static void loopBoundByte512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7235,14 +7278,14 @@ public class Byte512VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByte512VectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7296,7 +7339,7 @@ public class Byte512VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByte512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java index 870b9f9b8fb..9b0687c73f2 100644 --- a/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -957,11 +972,11 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -972,11 +987,11 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -992,7 +1007,7 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1005,7 +1020,7 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java index e28fb2b2001..b71d642d447 100644 --- a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java @@ -62,6 +62,49 @@ public class Byte64VectorTests extends AbstractVectorTest { ByteVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final byte CONST_SHIFT = Byte.SIZE / 2; @@ -96,10 +139,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Byte64VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Byte64VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Byte64VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Byte64VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Byte64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Byte64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Byte64VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Byte64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Byte64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Byte64VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1025,10 +1068,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1036,10 +1079,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1047,10 +1090,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1586,7 +1629,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1601,19 +1644,19 @@ public class Byte64VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,7 +1671,7 @@ public class Byte64VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3665,20 +3708,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3767,20 +3810,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3869,20 +3912,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3971,20 +4014,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4073,20 +4116,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4175,20 +4218,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4277,20 +4320,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4379,20 +4422,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4481,20 +4524,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4583,20 +4626,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4733,20 +4776,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4825,7 +4868,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4845,7 +4888,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4866,7 +4909,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4886,7 +4929,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4905,7 +4948,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4924,7 +4967,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4947,7 +4990,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4966,7 +5009,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4989,7 +5032,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5008,7 +5051,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5027,7 +5070,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5050,7 +5093,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5069,7 +5112,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5092,7 +5135,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5111,7 +5154,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5134,7 +5177,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5153,7 +5196,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5176,7 +5219,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5195,7 +5238,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5218,7 +5261,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5237,7 +5280,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5260,7 +5303,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5279,7 +5322,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5302,7 +5345,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5321,7 +5364,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5344,7 +5387,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5361,7 +5404,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5381,7 +5424,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5397,7 +5440,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5417,7 +5460,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5433,7 +5476,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5453,7 +5496,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5469,7 +5512,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5489,7 +5532,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5770,7 +5813,7 @@ public class Byte64VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6720,10 +6763,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6752,7 +6795,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6768,7 +6811,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7019,7 +7062,7 @@ public class Byte64VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7047,7 +7090,7 @@ public class Byte64VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7062,7 +7105,7 @@ public class Byte64VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7165,7 +7208,7 @@ public class Byte64VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7191,7 +7234,7 @@ public class Byte64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7205,7 +7248,7 @@ public class Byte64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7227,7 +7270,7 @@ public class Byte64VectorTests extends AbstractVectorTest { static void loopBoundByte64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7235,14 +7278,14 @@ public class Byte64VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByte64VectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7296,7 +7339,7 @@ public class Byte64VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByte64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java index bd5afc3f05a..76c6e9ff49f 100644 --- a/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -964,11 +979,11 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -979,11 +994,11 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -999,7 +1014,7 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1012,7 +1027,7 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java index b6932785b55..ccbc2e078b9 100644 --- a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java @@ -62,6 +62,49 @@ public class ByteMaxVectorTests extends AbstractVectorTest { ByteVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -102,10 +145,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -117,13 +160,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -133,10 +176,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -152,13 +195,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -174,13 +217,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -196,13 +239,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -218,13 +261,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -236,10 +279,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -251,10 +294,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,12 +306,12 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -279,20 +322,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -304,19 +347,19 @@ public class ByteMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -332,11 +375,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -345,12 +388,12 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -360,17 +403,17 @@ public class ByteMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -380,17 +423,17 @@ public class ByteMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -404,10 +447,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -419,10 +462,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -434,10 +477,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -458,18 +501,18 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -484,18 +527,18 @@ public class ByteMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -503,10 +546,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -514,10 +557,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -525,10 +568,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -537,10 +580,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -553,10 +596,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -568,10 +611,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -583,10 +626,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -601,10 +644,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -617,11 +660,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -635,11 +678,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -661,11 +704,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -679,11 +722,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -703,10 +746,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -718,10 +761,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -730,10 +773,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -743,10 +786,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -762,11 +805,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -783,11 +826,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -798,11 +841,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -819,11 +862,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -841,13 +884,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -868,13 +911,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -889,13 +932,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -916,13 +959,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -936,13 +979,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -957,13 +1000,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -978,13 +1021,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1000,13 +1043,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1019,10 +1062,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1031,10 +1074,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1042,10 +1085,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1053,10 +1096,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1592,7 +1635,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1607,19 +1650,19 @@ public class ByteMaxVectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1634,7 +1677,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3671,20 +3714,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3773,20 +3816,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3875,20 +3918,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3977,20 +4020,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4079,20 +4122,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4181,20 +4224,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4283,20 +4326,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4385,20 +4428,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4487,20 +4530,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4589,20 +4632,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4739,20 +4782,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4831,7 +4874,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4851,7 +4894,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4872,7 +4915,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4892,7 +4935,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4911,7 +4954,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4930,7 +4973,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4953,7 +4996,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4972,7 +5015,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4995,7 +5038,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5014,7 +5057,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5056,7 +5099,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5075,7 +5118,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5098,7 +5141,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5117,7 +5160,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5140,7 +5183,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5159,7 +5202,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5182,7 +5225,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5201,7 +5244,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5224,7 +5267,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5243,7 +5286,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5266,7 +5309,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5285,7 +5328,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5308,7 +5351,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5327,7 +5370,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5350,7 +5393,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5367,7 +5410,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5387,7 +5430,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5403,7 +5446,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5423,7 +5466,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5439,7 +5482,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5459,7 +5502,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5475,7 +5518,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5495,7 +5538,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5776,7 +5819,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6726,10 +6769,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6758,7 +6801,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6774,7 +6817,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7025,7 +7068,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7053,7 +7096,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7068,7 +7111,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7171,7 +7214,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7197,7 +7240,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7211,7 +7254,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7233,7 +7276,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { static void loopBoundByteMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7241,14 +7284,14 @@ public class ByteMaxVectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByteMaxVectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7302,7 +7345,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByteMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java index fed75349f68..e4a0a6bf40e 100644 --- a/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -870,11 +885,11 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Double128VectorTests.java b/test/jdk/jdk/incubator/vector/Double128VectorTests.java index 1d4cadd2158..685590f06e1 100644 --- a/test/jdk/jdk/incubator/vector/Double128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double128VectorTests.java @@ -61,6 +61,43 @@ public class Double128VectorTests extends AbstractVectorTest { DoubleVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final double ADD_IDENTITY = (double)0; @@ -95,10 +132,10 @@ public class Double128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +147,13 @@ public class Double128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +163,10 @@ public class Double128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +188,13 @@ public class Double128VectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +216,14 @@ public class Double128VectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +239,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +261,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +279,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +294,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +306,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +322,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -310,19 +347,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -338,11 +375,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +388,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +403,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +423,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +447,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +462,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +477,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +501,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +527,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +546,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +557,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +568,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +596,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +611,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +626,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +644,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +660,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +678,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +704,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +722,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +746,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +761,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +786,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +805,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +826,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +841,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +862,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +958,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +985,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1006,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1033,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1053,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1074,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1095,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1117,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1169,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1215,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1584,7 +1621,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1599,19 +1636,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,15 +1665,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2432,20 +2469,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2534,20 +2571,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2636,20 +2673,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2738,20 +2775,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2840,20 +2877,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2933,7 +2970,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2953,7 +2990,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2974,7 +3011,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -2994,7 +3031,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3015,7 +3052,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3035,7 +3072,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3056,7 +3093,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3076,7 +3113,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3097,7 +3134,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3117,7 +3154,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3136,7 +3173,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3155,7 +3192,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3178,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3197,7 +3234,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3220,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3239,7 +3276,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3258,7 +3295,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3281,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3300,7 +3337,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3323,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3342,7 +3379,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3365,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3384,7 +3421,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3407,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3444,7 +3481,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3460,7 +3497,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3480,7 +3517,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3496,7 +3533,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3516,7 +3553,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3532,7 +3569,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3552,7 +3589,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3833,7 +3870,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5052,10 +5089,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5084,7 +5121,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5100,7 +5137,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5330,7 +5367,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5358,7 +5395,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5373,7 +5410,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5476,7 +5513,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5502,7 +5539,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5516,7 +5553,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5538,7 +5575,7 @@ relativeError)); static void loopBoundDouble128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5546,14 +5583,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDouble128VectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5607,7 +5644,7 @@ relativeError)); @Test static void MaskAllTrueDouble128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java index d8a7eca2bda..56d5608a89d 100644 --- a/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -870,11 +885,11 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Double256VectorTests.java b/test/jdk/jdk/incubator/vector/Double256VectorTests.java index b5acfe0ef34..d39b6f9c923 100644 --- a/test/jdk/jdk/incubator/vector/Double256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double256VectorTests.java @@ -61,6 +61,43 @@ public class Double256VectorTests extends AbstractVectorTest { DoubleVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final double ADD_IDENTITY = (double)0; @@ -95,10 +132,10 @@ public class Double256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +147,13 @@ public class Double256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +163,10 @@ public class Double256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +188,13 @@ public class Double256VectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +216,14 @@ public class Double256VectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +239,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +261,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +279,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +294,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +306,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +322,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -310,19 +347,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -338,11 +375,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +388,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +403,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +423,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +447,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +462,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +477,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +501,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +527,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +546,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +557,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +568,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +596,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +611,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +626,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +644,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +660,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +678,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +704,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +722,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +746,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +761,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +786,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +805,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +826,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +841,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +862,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +958,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +985,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1006,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1033,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1053,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1074,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1095,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1117,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1169,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1215,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1584,7 +1621,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1599,19 +1636,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,15 +1665,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2432,20 +2469,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2534,20 +2571,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2636,20 +2673,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2738,20 +2775,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2840,20 +2877,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2933,7 +2970,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2953,7 +2990,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2974,7 +3011,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -2994,7 +3031,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3015,7 +3052,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3035,7 +3072,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3056,7 +3093,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3076,7 +3113,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3097,7 +3134,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3117,7 +3154,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3136,7 +3173,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3155,7 +3192,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3178,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3197,7 +3234,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3220,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3239,7 +3276,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3258,7 +3295,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3281,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3300,7 +3337,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3323,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3342,7 +3379,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3365,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3384,7 +3421,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3407,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3444,7 +3481,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3460,7 +3497,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3480,7 +3517,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3496,7 +3533,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3516,7 +3553,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3532,7 +3569,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3552,7 +3589,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3833,7 +3870,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5052,10 +5089,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5084,7 +5121,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5100,7 +5137,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5330,7 +5367,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5358,7 +5395,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5373,7 +5410,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5476,7 +5513,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5502,7 +5539,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5516,7 +5553,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5538,7 +5575,7 @@ relativeError)); static void loopBoundDouble256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5546,14 +5583,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDouble256VectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5607,7 +5644,7 @@ relativeError)); @Test static void MaskAllTrueDouble256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java index ddf76df1f3a..ea76ba814d5 100644 --- a/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -870,11 +885,11 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Double512VectorTests.java b/test/jdk/jdk/incubator/vector/Double512VectorTests.java index 3f85d0e52a6..7983ae0efe7 100644 --- a/test/jdk/jdk/incubator/vector/Double512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double512VectorTests.java @@ -61,6 +61,43 @@ public class Double512VectorTests extends AbstractVectorTest { DoubleVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final double ADD_IDENTITY = (double)0; @@ -95,10 +132,10 @@ public class Double512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +147,13 @@ public class Double512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +163,10 @@ public class Double512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +188,13 @@ public class Double512VectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +216,14 @@ public class Double512VectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +239,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +261,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +279,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +294,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +306,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +322,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -310,19 +347,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -338,11 +375,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +388,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +403,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +423,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +447,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +462,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +477,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +501,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +527,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +546,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +557,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +568,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +596,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +611,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +626,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +644,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +660,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +678,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +704,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +722,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +746,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +761,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +786,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +805,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +826,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +841,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +862,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +958,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +985,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1006,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1033,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1053,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1074,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1095,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1117,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1169,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1215,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1584,7 +1621,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1599,19 +1636,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,15 +1665,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2432,20 +2469,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2534,20 +2571,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2636,20 +2673,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2738,20 +2775,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2840,20 +2877,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2933,7 +2970,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2953,7 +2990,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2974,7 +3011,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -2994,7 +3031,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3015,7 +3052,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3035,7 +3072,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3056,7 +3093,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3076,7 +3113,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3097,7 +3134,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3117,7 +3154,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3136,7 +3173,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3155,7 +3192,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3178,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3197,7 +3234,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3220,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3239,7 +3276,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3258,7 +3295,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3281,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3300,7 +3337,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3323,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3342,7 +3379,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3365,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3384,7 +3421,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3407,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3444,7 +3481,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3460,7 +3497,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3480,7 +3517,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3496,7 +3533,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3516,7 +3553,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3532,7 +3569,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3552,7 +3589,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3833,7 +3870,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5052,10 +5089,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5084,7 +5121,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5100,7 +5137,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5330,7 +5367,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5358,7 +5395,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5373,7 +5410,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5476,7 +5513,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5502,7 +5539,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5516,7 +5553,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5538,7 +5575,7 @@ relativeError)); static void loopBoundDouble512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5546,14 +5583,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDouble512VectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5607,7 +5644,7 @@ relativeError)); @Test static void MaskAllTrueDouble512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java index e2c48d84529..30c4b92aa86 100644 --- a/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -870,11 +885,11 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Double64VectorTests.java b/test/jdk/jdk/incubator/vector/Double64VectorTests.java index ab3586fb424..2cc56b1bce3 100644 --- a/test/jdk/jdk/incubator/vector/Double64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double64VectorTests.java @@ -61,6 +61,43 @@ public class Double64VectorTests extends AbstractVectorTest { DoubleVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final double ADD_IDENTITY = (double)0; @@ -95,10 +132,10 @@ public class Double64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +147,13 @@ public class Double64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +163,10 @@ public class Double64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +188,13 @@ public class Double64VectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +216,14 @@ public class Double64VectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +239,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +261,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +279,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +294,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +306,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +322,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -310,19 +347,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -338,11 +375,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +388,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +403,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +423,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +447,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +462,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +477,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +501,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +527,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +546,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +557,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +568,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +596,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +611,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +626,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +644,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +660,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +678,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +704,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +722,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +746,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +761,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +786,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +805,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +826,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +841,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +862,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +958,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +985,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1006,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1033,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1053,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1074,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1095,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1117,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1169,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1215,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1584,7 +1621,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1599,19 +1636,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,15 +1665,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2432,20 +2469,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2534,20 +2571,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2636,20 +2673,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2738,20 +2775,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2840,20 +2877,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2933,7 +2970,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2953,7 +2990,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2974,7 +3011,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -2994,7 +3031,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3015,7 +3052,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3035,7 +3072,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3056,7 +3093,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3076,7 +3113,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3097,7 +3134,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3117,7 +3154,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3136,7 +3173,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3155,7 +3192,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3178,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3197,7 +3234,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3220,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3239,7 +3276,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3258,7 +3295,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3281,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3300,7 +3337,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3323,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3342,7 +3379,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3365,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3384,7 +3421,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3407,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3444,7 +3481,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3460,7 +3497,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3480,7 +3517,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3496,7 +3533,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3516,7 +3553,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3532,7 +3569,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3552,7 +3589,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3833,7 +3870,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5052,10 +5089,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5084,7 +5121,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5100,7 +5137,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5330,7 +5367,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5358,7 +5395,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5373,7 +5410,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5476,7 +5513,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5502,7 +5539,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5516,7 +5553,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5538,7 +5575,7 @@ relativeError)); static void loopBoundDouble64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5546,14 +5583,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDouble64VectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5607,7 +5644,7 @@ relativeError)); @Test static void MaskAllTrueDouble64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java index f8ea6d7c4a2..7d372239435 100644 --- a/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -877,11 +892,11 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -892,11 +907,11 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -912,7 +927,7 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -925,7 +940,7 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java b/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java index 8f135cd221a..9130698d5e4 100644 --- a/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java @@ -61,6 +61,43 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { DoubleVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -101,10 +138,10 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -116,13 +153,13 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -132,10 +169,10 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -157,13 +194,13 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -185,14 +222,14 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -208,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -230,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -248,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -275,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -291,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -316,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -344,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -357,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -372,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -392,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -416,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -431,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -446,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -470,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -496,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -515,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -526,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -537,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -549,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -565,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -580,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -595,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -613,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -629,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -647,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -673,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -691,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -715,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -730,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -742,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -755,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -774,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -795,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -810,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -831,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -927,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -954,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -975,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1002,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1022,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1043,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1064,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1086,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1138,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1184,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1590,7 +1627,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1605,19 +1642,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1634,15 +1671,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2438,20 +2475,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2540,20 +2577,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2642,20 +2679,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2744,20 +2781,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2846,20 +2883,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2939,7 +2976,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2959,7 +2996,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2980,7 +3017,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3000,7 +3037,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3021,7 +3058,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3041,7 +3078,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3062,7 +3099,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3082,7 +3119,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3103,7 +3140,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3123,7 +3160,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3142,7 +3179,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3161,7 +3198,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3184,7 +3221,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3203,7 +3240,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3226,7 +3263,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3245,7 +3282,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3264,7 +3301,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3287,7 +3324,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3306,7 +3343,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3329,7 +3366,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3348,7 +3385,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3371,7 +3408,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3390,7 +3427,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3413,7 +3450,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3430,7 +3467,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3450,7 +3487,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3466,7 +3503,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3486,7 +3523,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3502,7 +3539,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3522,7 +3559,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3538,7 +3575,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3558,7 +3595,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3839,7 +3876,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5058,10 +5095,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5090,7 +5127,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5106,7 +5143,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5336,7 +5373,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5364,7 +5401,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5379,7 +5416,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5482,7 +5519,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5508,7 +5545,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5522,7 +5559,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5544,7 +5581,7 @@ relativeError)); static void loopBoundDoubleMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5552,14 +5589,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDoubleMaxVectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5613,7 +5650,7 @@ relativeError)); @Test static void MaskAllTrueDoubleMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java index 4421c355c14..33a02167a90 100644 --- a/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -870,11 +885,11 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Float128VectorTests.java b/test/jdk/jdk/incubator/vector/Float128VectorTests.java index f97c5b0064c..71ca2b3b701 100644 --- a/test/jdk/jdk/incubator/vector/Float128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float128VectorTests.java @@ -61,6 +61,49 @@ public class Float128VectorTests extends AbstractVectorTest { FloatVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final float ADD_IDENTITY = (float)0; @@ -95,10 +138,10 @@ public class Float128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +153,13 @@ public class Float128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +169,10 @@ public class Float128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +194,13 @@ public class Float128VectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +222,14 @@ public class Float128VectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -310,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -338,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1189,10 +1232,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1595,7 +1638,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1610,19 +1653,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1639,15 +1682,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2443,20 +2486,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2545,20 +2588,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2647,20 +2690,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2749,20 +2792,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2851,20 +2894,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2944,7 +2987,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2964,7 +3007,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2985,7 +3028,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3005,7 +3048,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3026,7 +3069,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3046,7 +3089,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3067,7 +3110,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3087,7 +3130,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3108,7 +3151,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3128,7 +3171,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3147,7 +3190,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3166,7 +3209,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3189,7 +3232,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3208,7 +3251,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3231,7 +3274,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3250,7 +3293,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3269,7 +3312,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3292,7 +3335,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3311,7 +3354,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3334,7 +3377,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3353,7 +3396,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3376,7 +3419,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3395,7 +3438,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3418,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3435,7 +3478,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3455,7 +3498,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3471,7 +3514,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3491,7 +3534,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3507,7 +3550,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3527,7 +3570,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3543,7 +3586,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3563,7 +3606,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3844,7 +3887,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5021,10 +5064,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5053,7 +5096,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5069,7 +5112,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5309,7 +5352,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5337,7 +5380,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5352,7 +5395,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5455,7 +5498,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5481,7 +5524,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5495,7 +5538,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5517,7 +5560,7 @@ relativeError)); static void loopBoundFloat128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5525,14 +5568,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloat128VectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5586,7 +5629,7 @@ relativeError)); @Test static void MaskAllTrueFloat128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java index 0ad426d9954..0c1d8e9d443 100644 --- a/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -870,11 +885,11 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Float256VectorTests.java b/test/jdk/jdk/incubator/vector/Float256VectorTests.java index d9746d3291c..cc61a5cdc5d 100644 --- a/test/jdk/jdk/incubator/vector/Float256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float256VectorTests.java @@ -61,6 +61,49 @@ public class Float256VectorTests extends AbstractVectorTest { FloatVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final float ADD_IDENTITY = (float)0; @@ -95,10 +138,10 @@ public class Float256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +153,13 @@ public class Float256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +169,10 @@ public class Float256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +194,13 @@ public class Float256VectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +222,14 @@ public class Float256VectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -310,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -338,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1189,10 +1232,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1595,7 +1638,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1610,19 +1653,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1639,15 +1682,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2443,20 +2486,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2545,20 +2588,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2647,20 +2690,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2749,20 +2792,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2851,20 +2894,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2944,7 +2987,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2964,7 +3007,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2985,7 +3028,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3005,7 +3048,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3026,7 +3069,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3046,7 +3089,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3067,7 +3110,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3087,7 +3130,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3108,7 +3151,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3128,7 +3171,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3147,7 +3190,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3166,7 +3209,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3189,7 +3232,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3208,7 +3251,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3231,7 +3274,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3250,7 +3293,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3269,7 +3312,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3292,7 +3335,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3311,7 +3354,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3334,7 +3377,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3353,7 +3396,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3376,7 +3419,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3395,7 +3438,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3418,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3435,7 +3478,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3455,7 +3498,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3471,7 +3514,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3491,7 +3534,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3507,7 +3550,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3527,7 +3570,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3543,7 +3586,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3563,7 +3606,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3844,7 +3887,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5021,10 +5064,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5053,7 +5096,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5069,7 +5112,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5309,7 +5352,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5337,7 +5380,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5352,7 +5395,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5455,7 +5498,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5481,7 +5524,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5495,7 +5538,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5517,7 +5560,7 @@ relativeError)); static void loopBoundFloat256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5525,14 +5568,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloat256VectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5586,7 +5629,7 @@ relativeError)); @Test static void MaskAllTrueFloat256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java index 56da27f1149..b3fe49e2121 100644 --- a/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -870,11 +885,11 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Float512VectorTests.java b/test/jdk/jdk/incubator/vector/Float512VectorTests.java index ca395221c6b..830001ac268 100644 --- a/test/jdk/jdk/incubator/vector/Float512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float512VectorTests.java @@ -61,6 +61,49 @@ public class Float512VectorTests extends AbstractVectorTest { FloatVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final float ADD_IDENTITY = (float)0; @@ -95,10 +138,10 @@ public class Float512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +153,13 @@ public class Float512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +169,10 @@ public class Float512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +194,13 @@ public class Float512VectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +222,14 @@ public class Float512VectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -310,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -338,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1189,10 +1232,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1595,7 +1638,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1610,19 +1653,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1639,15 +1682,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2443,20 +2486,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2545,20 +2588,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2647,20 +2690,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2749,20 +2792,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2851,20 +2894,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2944,7 +2987,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2964,7 +3007,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2985,7 +3028,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3005,7 +3048,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3026,7 +3069,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3046,7 +3089,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3067,7 +3110,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3087,7 +3130,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3108,7 +3151,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3128,7 +3171,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3147,7 +3190,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3166,7 +3209,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3189,7 +3232,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3208,7 +3251,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3231,7 +3274,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3250,7 +3293,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3269,7 +3312,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3292,7 +3335,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3311,7 +3354,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3334,7 +3377,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3353,7 +3396,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3376,7 +3419,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3395,7 +3438,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3418,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3435,7 +3478,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3455,7 +3498,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3471,7 +3514,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3491,7 +3534,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3507,7 +3550,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3527,7 +3570,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3543,7 +3586,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3563,7 +3606,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3844,7 +3887,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5021,10 +5064,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5053,7 +5096,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5069,7 +5112,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5309,7 +5352,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5337,7 +5380,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5352,7 +5395,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5455,7 +5498,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5481,7 +5524,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5495,7 +5538,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5517,7 +5560,7 @@ relativeError)); static void loopBoundFloat512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5525,14 +5568,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloat512VectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5586,7 +5629,7 @@ relativeError)); @Test static void MaskAllTrueFloat512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java index b3ee68a4aca..afa08dc8f33 100644 --- a/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -870,11 +885,11 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Float64VectorTests.java b/test/jdk/jdk/incubator/vector/Float64VectorTests.java index 1b14cdb7791..4a8f917b50e 100644 --- a/test/jdk/jdk/incubator/vector/Float64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float64VectorTests.java @@ -61,6 +61,49 @@ public class Float64VectorTests extends AbstractVectorTest { FloatVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final float ADD_IDENTITY = (float)0; @@ -95,10 +138,10 @@ public class Float64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +153,13 @@ public class Float64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +169,10 @@ public class Float64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +194,13 @@ public class Float64VectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +222,14 @@ public class Float64VectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -310,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -338,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1189,10 +1232,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1595,7 +1638,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1610,19 +1653,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1639,15 +1682,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2443,20 +2486,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2545,20 +2588,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2647,20 +2690,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2749,20 +2792,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2851,20 +2894,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2944,7 +2987,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2964,7 +3007,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2985,7 +3028,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3005,7 +3048,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3026,7 +3069,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3046,7 +3089,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3067,7 +3110,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3087,7 +3130,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3108,7 +3151,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3128,7 +3171,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3147,7 +3190,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3166,7 +3209,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3189,7 +3232,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3208,7 +3251,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3231,7 +3274,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3250,7 +3293,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3269,7 +3312,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3292,7 +3335,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3311,7 +3354,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3334,7 +3377,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3353,7 +3396,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3376,7 +3419,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3395,7 +3438,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3418,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3435,7 +3478,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3455,7 +3498,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3471,7 +3514,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3491,7 +3534,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3507,7 +3550,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3527,7 +3570,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3543,7 +3586,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3563,7 +3606,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3844,7 +3887,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5021,10 +5064,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5053,7 +5096,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5069,7 +5112,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5309,7 +5352,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5337,7 +5380,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5352,7 +5395,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5455,7 +5498,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5481,7 +5524,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5495,7 +5538,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5517,7 +5560,7 @@ relativeError)); static void loopBoundFloat64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5525,14 +5568,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloat64VectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5586,7 +5629,7 @@ relativeError)); @Test static void MaskAllTrueFloat64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java index 5c86ab350d2..931e9b78306 100644 --- a/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -877,11 +892,11 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -892,11 +907,11 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -912,7 +927,7 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -925,7 +940,7 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java b/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java index 53edb408035..6ea96388706 100644 --- a/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java @@ -61,6 +61,49 @@ public class FloatMaxVectorTests extends AbstractVectorTest { FloatVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -101,10 +144,10 @@ public class FloatMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -116,13 +159,13 @@ public class FloatMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -132,10 +175,10 @@ public class FloatMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -157,13 +200,13 @@ public class FloatMaxVectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -185,14 +228,14 @@ public class FloatMaxVectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -208,13 +251,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -230,13 +273,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -248,10 +291,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,10 +306,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -275,12 +318,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -291,20 +334,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -316,19 +359,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -344,11 +387,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -357,12 +400,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -372,17 +415,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -392,17 +435,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -416,10 +459,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -431,10 +474,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -446,10 +489,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -470,18 +513,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -496,18 +539,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -515,10 +558,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -526,10 +569,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -537,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -549,10 +592,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -565,10 +608,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -580,10 +623,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -595,10 +638,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -613,10 +656,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -629,11 +672,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -647,11 +690,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -673,11 +716,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -691,11 +734,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -715,10 +758,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -730,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -742,10 +785,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -755,10 +798,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -774,11 +817,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -795,11 +838,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -810,11 +853,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -831,11 +874,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -927,13 +970,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -954,13 +997,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -975,13 +1018,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1002,13 +1045,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1022,13 +1065,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1043,13 +1086,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1064,13 +1107,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1086,13 +1129,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1138,10 +1181,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1184,10 +1227,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1195,10 +1238,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1601,7 +1644,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1616,19 +1659,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1645,15 +1688,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2449,20 +2492,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2551,20 +2594,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2653,20 +2696,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2755,20 +2798,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2857,20 +2900,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2950,7 +2993,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2970,7 +3013,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2991,7 +3034,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3011,7 +3054,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3032,7 +3075,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3052,7 +3095,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3073,7 +3116,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3093,7 +3136,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3114,7 +3157,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3134,7 +3177,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3153,7 +3196,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3172,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3195,7 +3238,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3214,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3237,7 +3280,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3256,7 +3299,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3275,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3298,7 +3341,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3317,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3340,7 +3383,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3359,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3382,7 +3425,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3401,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3467,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3441,7 +3484,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3461,7 +3504,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3477,7 +3520,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3497,7 +3540,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3513,7 +3556,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3533,7 +3576,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3549,7 +3592,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3569,7 +3612,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3850,7 +3893,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5027,10 +5070,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5059,7 +5102,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5075,7 +5118,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5315,7 +5358,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5343,7 +5386,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5358,7 +5401,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5461,7 +5504,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5487,7 +5530,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5501,7 +5544,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5523,7 +5566,7 @@ relativeError)); static void loopBoundFloatMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5531,14 +5574,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloatMaxVectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5592,7 +5635,7 @@ relativeError)); @Test static void MaskAllTrueFloatMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java index f2448365138..f6e640e9615 100644 --- a/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -870,11 +885,11 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Int128VectorTests.java b/test/jdk/jdk/incubator/vector/Int128VectorTests.java index 69bb0c84588..1f254abbf0c 100644 --- a/test/jdk/jdk/incubator/vector/Int128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int128VectorTests.java @@ -62,6 +62,49 @@ public class Int128VectorTests extends AbstractVectorTest { IntVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final int CONST_SHIFT = Integer.SIZE / 2; @@ -96,10 +139,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Int128VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Int128VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Int128VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Int128VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Int128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Int128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Int128VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Int128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Int128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Int128VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1543,7 +1586,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1558,19 +1601,19 @@ public class Int128VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1585,7 +1628,7 @@ public class Int128VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1593,9 +1636,9 @@ public class Int128VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3709,20 +3752,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3811,20 +3854,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3913,20 +3956,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4015,20 +4058,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4117,20 +4160,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4219,20 +4262,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4321,20 +4364,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4423,20 +4466,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4525,20 +4568,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4627,20 +4670,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4777,20 +4820,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4869,7 +4912,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4889,7 +4932,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4910,7 +4953,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4930,7 +4973,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4949,7 +4992,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4968,7 +5011,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4991,7 +5034,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5010,7 +5053,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5052,7 +5095,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5071,7 +5114,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5094,7 +5137,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5113,7 +5156,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5136,7 +5179,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5155,7 +5198,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5178,7 +5221,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5197,7 +5240,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5220,7 +5263,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5239,7 +5282,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5262,7 +5305,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5281,7 +5324,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5304,7 +5347,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5323,7 +5366,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5346,7 +5389,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5365,7 +5408,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5388,7 +5431,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5405,7 +5448,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5425,7 +5468,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5441,7 +5484,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5461,7 +5504,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5477,7 +5520,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5497,7 +5540,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5513,7 +5556,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5533,7 +5576,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5814,7 +5857,7 @@ public class Int128VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6764,10 +6807,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6796,7 +6839,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6812,7 +6855,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7052,7 +7095,7 @@ public class Int128VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7080,7 +7123,7 @@ public class Int128VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7095,7 +7138,7 @@ public class Int128VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7198,7 +7241,7 @@ public class Int128VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7224,7 +7267,7 @@ public class Int128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7238,7 +7281,7 @@ public class Int128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7260,7 +7303,7 @@ public class Int128VectorTests extends AbstractVectorTest { static void loopBoundInt128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7268,14 +7311,14 @@ public class Int128VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeInt128VectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7329,7 +7372,7 @@ public class Int128VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueInt128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java index 1a8c113d3b9..333757be0f8 100644 --- a/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -870,11 +885,11 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Int256VectorTests.java b/test/jdk/jdk/incubator/vector/Int256VectorTests.java index 4e63de95b7b..f9f0faad32b 100644 --- a/test/jdk/jdk/incubator/vector/Int256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int256VectorTests.java @@ -62,6 +62,49 @@ public class Int256VectorTests extends AbstractVectorTest { IntVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final int CONST_SHIFT = Integer.SIZE / 2; @@ -96,10 +139,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Int256VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Int256VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Int256VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Int256VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Int256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Int256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Int256VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Int256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Int256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Int256VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1543,7 +1586,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1558,19 +1601,19 @@ public class Int256VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1585,7 +1628,7 @@ public class Int256VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1593,9 +1636,9 @@ public class Int256VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3709,20 +3752,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3811,20 +3854,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3913,20 +3956,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4015,20 +4058,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4117,20 +4160,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4219,20 +4262,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4321,20 +4364,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4423,20 +4466,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4525,20 +4568,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4627,20 +4670,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4777,20 +4820,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4869,7 +4912,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4889,7 +4932,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4910,7 +4953,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4930,7 +4973,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4949,7 +4992,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4968,7 +5011,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4991,7 +5034,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5010,7 +5053,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5052,7 +5095,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5071,7 +5114,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5094,7 +5137,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5113,7 +5156,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5136,7 +5179,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5155,7 +5198,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5178,7 +5221,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5197,7 +5240,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5220,7 +5263,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5239,7 +5282,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5262,7 +5305,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5281,7 +5324,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5304,7 +5347,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5323,7 +5366,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5346,7 +5389,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5365,7 +5408,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5388,7 +5431,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5405,7 +5448,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5425,7 +5468,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5441,7 +5484,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5461,7 +5504,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5477,7 +5520,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5497,7 +5540,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5513,7 +5556,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5533,7 +5576,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5814,7 +5857,7 @@ public class Int256VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6764,10 +6807,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6796,7 +6839,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6812,7 +6855,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7052,7 +7095,7 @@ public class Int256VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7080,7 +7123,7 @@ public class Int256VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7095,7 +7138,7 @@ public class Int256VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7198,7 +7241,7 @@ public class Int256VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7224,7 +7267,7 @@ public class Int256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7238,7 +7281,7 @@ public class Int256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7260,7 +7303,7 @@ public class Int256VectorTests extends AbstractVectorTest { static void loopBoundInt256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7268,14 +7311,14 @@ public class Int256VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeInt256VectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7329,7 +7372,7 @@ public class Int256VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueInt256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java index 4c4ab6c4bc5..1479dc57df5 100644 --- a/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -870,11 +885,11 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Int512VectorTests.java b/test/jdk/jdk/incubator/vector/Int512VectorTests.java index e2de7905a83..d2eda11e6f5 100644 --- a/test/jdk/jdk/incubator/vector/Int512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int512VectorTests.java @@ -62,6 +62,49 @@ public class Int512VectorTests extends AbstractVectorTest { IntVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final int CONST_SHIFT = Integer.SIZE / 2; @@ -96,10 +139,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Int512VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Int512VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Int512VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Int512VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Int512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Int512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Int512VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Int512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Int512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Int512VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1543,7 +1586,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1558,19 +1601,19 @@ public class Int512VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1585,7 +1628,7 @@ public class Int512VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1593,9 +1636,9 @@ public class Int512VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3709,20 +3752,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3811,20 +3854,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3913,20 +3956,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4015,20 +4058,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4117,20 +4160,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4219,20 +4262,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4321,20 +4364,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4423,20 +4466,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4525,20 +4568,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4627,20 +4670,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4777,20 +4820,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4869,7 +4912,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4889,7 +4932,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4910,7 +4953,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4930,7 +4973,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4949,7 +4992,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4968,7 +5011,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4991,7 +5034,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5010,7 +5053,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5052,7 +5095,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5071,7 +5114,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5094,7 +5137,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5113,7 +5156,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5136,7 +5179,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5155,7 +5198,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5178,7 +5221,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5197,7 +5240,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5220,7 +5263,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5239,7 +5282,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5262,7 +5305,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5281,7 +5324,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5304,7 +5347,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5323,7 +5366,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5346,7 +5389,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5365,7 +5408,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5388,7 +5431,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5405,7 +5448,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5425,7 +5468,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5441,7 +5484,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5461,7 +5504,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5477,7 +5520,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5497,7 +5540,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5513,7 +5556,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5533,7 +5576,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5814,7 +5857,7 @@ public class Int512VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6764,10 +6807,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6796,7 +6839,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6812,7 +6855,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7052,7 +7095,7 @@ public class Int512VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7080,7 +7123,7 @@ public class Int512VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7095,7 +7138,7 @@ public class Int512VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7198,7 +7241,7 @@ public class Int512VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7224,7 +7267,7 @@ public class Int512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7238,7 +7281,7 @@ public class Int512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7260,7 +7303,7 @@ public class Int512VectorTests extends AbstractVectorTest { static void loopBoundInt512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7268,14 +7311,14 @@ public class Int512VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeInt512VectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7329,7 +7372,7 @@ public class Int512VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueInt512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java index a1fa9a8b16c..5dfc0ac2f4f 100644 --- a/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -870,11 +885,11 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Int64VectorTests.java b/test/jdk/jdk/incubator/vector/Int64VectorTests.java index d64db80b94d..6eb6322ba2b 100644 --- a/test/jdk/jdk/incubator/vector/Int64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int64VectorTests.java @@ -62,6 +62,49 @@ public class Int64VectorTests extends AbstractVectorTest { IntVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final int CONST_SHIFT = Integer.SIZE / 2; @@ -96,10 +139,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Int64VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Int64VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Int64VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Int64VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Int64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Int64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Int64VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Int64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Int64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Int64VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1543,7 +1586,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1558,19 +1601,19 @@ public class Int64VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1585,7 +1628,7 @@ public class Int64VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1593,9 +1636,9 @@ public class Int64VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3709,20 +3752,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3811,20 +3854,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3913,20 +3956,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4015,20 +4058,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4117,20 +4160,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4219,20 +4262,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4321,20 +4364,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4423,20 +4466,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4525,20 +4568,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4627,20 +4670,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4777,20 +4820,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4869,7 +4912,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4889,7 +4932,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4910,7 +4953,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4930,7 +4973,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4949,7 +4992,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4968,7 +5011,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4991,7 +5034,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5010,7 +5053,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5052,7 +5095,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5071,7 +5114,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5094,7 +5137,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5113,7 +5156,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5136,7 +5179,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5155,7 +5198,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5178,7 +5221,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5197,7 +5240,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5220,7 +5263,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5239,7 +5282,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5262,7 +5305,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5281,7 +5324,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5304,7 +5347,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5323,7 +5366,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5346,7 +5389,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5365,7 +5408,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5388,7 +5431,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5405,7 +5448,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5425,7 +5468,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5441,7 +5484,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5461,7 +5504,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5477,7 +5520,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5497,7 +5540,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5513,7 +5556,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5533,7 +5576,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5814,7 +5857,7 @@ public class Int64VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6764,10 +6807,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6796,7 +6839,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6812,7 +6855,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7052,7 +7095,7 @@ public class Int64VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7080,7 +7123,7 @@ public class Int64VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7095,7 +7138,7 @@ public class Int64VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7198,7 +7241,7 @@ public class Int64VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7224,7 +7267,7 @@ public class Int64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7238,7 +7281,7 @@ public class Int64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7260,7 +7303,7 @@ public class Int64VectorTests extends AbstractVectorTest { static void loopBoundInt64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7268,14 +7311,14 @@ public class Int64VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeInt64VectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7329,7 +7372,7 @@ public class Int64VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueInt64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java index 564849e22fd..d72c428659f 100644 --- a/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -877,11 +892,11 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -892,11 +907,11 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -912,7 +927,7 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -925,7 +940,7 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java index 7bf4dc48171..fc4cf4ea21e 100644 --- a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java @@ -62,6 +62,49 @@ public class IntMaxVectorTests extends AbstractVectorTest { IntVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -102,10 +145,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -117,13 +160,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -133,10 +176,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -152,13 +195,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -174,13 +217,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -196,13 +239,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -218,13 +261,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -236,10 +279,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -251,10 +294,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,12 +306,12 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -279,20 +322,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -304,19 +347,19 @@ public class IntMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -332,11 +375,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -345,12 +388,12 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -360,17 +403,17 @@ public class IntMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -380,17 +423,17 @@ public class IntMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -404,10 +447,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -419,10 +462,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -434,10 +477,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -458,18 +501,18 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -484,18 +527,18 @@ public class IntMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -503,10 +546,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -514,10 +557,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -525,10 +568,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -537,10 +580,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -553,10 +596,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -568,10 +611,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -583,10 +626,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -601,10 +644,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -617,11 +660,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -635,11 +678,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -661,11 +704,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -679,11 +722,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -703,10 +746,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -718,10 +761,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -730,10 +773,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -743,10 +786,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -762,11 +805,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -783,11 +826,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -798,11 +841,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -819,11 +862,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -841,13 +884,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -868,13 +911,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -889,13 +932,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -916,13 +959,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -936,13 +979,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -957,13 +1000,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -978,13 +1021,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1000,13 +1043,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1019,10 +1062,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1032,10 +1075,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1043,10 +1086,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1549,7 +1592,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1564,19 +1607,19 @@ public class IntMaxVectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1591,7 +1634,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1599,9 +1642,9 @@ public class IntMaxVectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3715,20 +3758,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3817,20 +3860,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3919,20 +3962,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4021,20 +4064,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4123,20 +4166,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4225,20 +4268,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4327,20 +4370,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4429,20 +4472,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4531,20 +4574,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4633,20 +4676,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4783,20 +4826,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4875,7 +4918,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4895,7 +4938,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4916,7 +4959,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4936,7 +4979,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4955,7 +4998,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4974,7 +5017,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4997,7 +5040,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5016,7 +5059,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5039,7 +5082,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5058,7 +5101,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5077,7 +5120,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5100,7 +5143,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5119,7 +5162,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5142,7 +5185,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5161,7 +5204,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5184,7 +5227,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5203,7 +5246,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5226,7 +5269,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5245,7 +5288,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5268,7 +5311,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5287,7 +5330,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5310,7 +5353,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5329,7 +5372,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5371,7 +5414,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5394,7 +5437,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5411,7 +5454,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5431,7 +5474,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5447,7 +5490,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5467,7 +5510,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5483,7 +5526,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5503,7 +5546,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5519,7 +5562,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5539,7 +5582,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5820,7 +5863,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6770,10 +6813,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6802,7 +6845,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6818,7 +6861,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7058,7 +7101,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7086,7 +7129,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7101,7 +7144,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7204,7 +7247,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7230,7 +7273,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7244,7 +7287,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7266,7 +7309,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { static void loopBoundIntMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7274,14 +7317,14 @@ public class IntMaxVectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeIntMaxVectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7335,7 +7378,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { @Test static void MaskAllTrueIntMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java index 57a0880aed3..20df291542f 100644 --- a/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -870,11 +885,11 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Long128VectorTests.java b/test/jdk/jdk/incubator/vector/Long128VectorTests.java index 227f196ffdf..9847f79fc04 100644 --- a/test/jdk/jdk/incubator/vector/Long128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long128VectorTests.java @@ -62,6 +62,43 @@ public class Long128VectorTests extends AbstractVectorTest { LongVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final long CONST_SHIFT = Long.SIZE / 2; @@ -96,10 +133,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +148,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +164,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +183,13 @@ public class Long128VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +205,13 @@ public class Long128VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -187,10 +224,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -202,10 +239,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -214,12 +251,12 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -230,20 +267,20 @@ public class Long128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -255,19 +292,19 @@ public class Long128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -283,11 +320,11 @@ public class Long128VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -296,12 +333,12 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -311,17 +348,17 @@ public class Long128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -331,17 +368,17 @@ public class Long128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -355,10 +392,10 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -370,10 +407,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -385,10 +422,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -409,18 +446,18 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -435,18 +472,18 @@ public class Long128VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -454,10 +491,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -465,10 +502,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -476,10 +513,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -488,10 +525,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -504,10 +541,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -519,10 +556,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -534,10 +571,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -552,10 +589,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -568,11 +605,11 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -586,11 +623,11 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -612,11 +649,11 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -630,11 +667,11 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -654,10 +691,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -669,10 +706,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -681,10 +718,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -694,10 +731,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -713,11 +750,11 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -734,11 +771,11 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -749,11 +786,11 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -770,11 +807,11 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -792,13 +829,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -819,13 +856,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -840,13 +877,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -867,13 +904,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -887,13 +924,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -908,13 +945,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -929,13 +966,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -951,13 +988,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1003,10 +1040,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1016,10 +1053,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1027,10 +1064,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1565,7 +1602,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1580,19 +1617,19 @@ public class Long128VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1607,7 +1644,7 @@ public class Long128VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1615,9 +1652,9 @@ public class Long128VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3731,20 +3768,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3833,20 +3870,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3935,20 +3972,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4037,20 +4074,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4139,20 +4176,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4241,20 +4278,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4343,20 +4380,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4445,20 +4482,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4547,20 +4584,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4649,20 +4686,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4799,20 +4836,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4891,7 +4928,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4911,7 +4948,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4932,7 +4969,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4952,7 +4989,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4971,7 +5008,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4990,7 +5027,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5013,7 +5050,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5032,7 +5069,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5055,7 +5092,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5074,7 +5111,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5093,7 +5130,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5116,7 +5153,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5135,7 +5172,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5158,7 +5195,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5177,7 +5214,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5200,7 +5237,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5219,7 +5256,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5242,7 +5279,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5261,7 +5298,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5284,7 +5321,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5303,7 +5340,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5326,7 +5363,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5345,7 +5382,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5368,7 +5405,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5387,7 +5424,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5410,7 +5447,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5427,7 +5464,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5447,7 +5484,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5464,7 +5501,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5484,7 +5521,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5766,7 +5803,7 @@ public class Long128VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6716,10 +6753,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6748,7 +6785,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6764,7 +6801,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6938,7 +6975,7 @@ public class Long128VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6966,7 +7003,7 @@ public class Long128VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6981,7 +7018,7 @@ public class Long128VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7084,7 +7121,7 @@ public class Long128VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7110,7 +7147,7 @@ public class Long128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7124,7 +7161,7 @@ public class Long128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7146,7 +7183,7 @@ public class Long128VectorTests extends AbstractVectorTest { static void loopBoundLong128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7154,14 +7191,14 @@ public class Long128VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLong128VectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7215,7 +7252,7 @@ public class Long128VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLong128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java index f07cf3e68b7..675536ee67b 100644 --- a/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -870,11 +885,11 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Long256VectorTests.java b/test/jdk/jdk/incubator/vector/Long256VectorTests.java index c37e68e3728..0f3e3347480 100644 --- a/test/jdk/jdk/incubator/vector/Long256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long256VectorTests.java @@ -62,6 +62,43 @@ public class Long256VectorTests extends AbstractVectorTest { LongVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final long CONST_SHIFT = Long.SIZE / 2; @@ -96,10 +133,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +148,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +164,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +183,13 @@ public class Long256VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +205,13 @@ public class Long256VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -187,10 +224,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -202,10 +239,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -214,12 +251,12 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -230,20 +267,20 @@ public class Long256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -255,19 +292,19 @@ public class Long256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -283,11 +320,11 @@ public class Long256VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -296,12 +333,12 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -311,17 +348,17 @@ public class Long256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -331,17 +368,17 @@ public class Long256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -355,10 +392,10 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -370,10 +407,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -385,10 +422,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -409,18 +446,18 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -435,18 +472,18 @@ public class Long256VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -454,10 +491,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -465,10 +502,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -476,10 +513,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -488,10 +525,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -504,10 +541,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -519,10 +556,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -534,10 +571,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -552,10 +589,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -568,11 +605,11 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -586,11 +623,11 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -612,11 +649,11 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -630,11 +667,11 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -654,10 +691,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -669,10 +706,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -681,10 +718,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -694,10 +731,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -713,11 +750,11 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -734,11 +771,11 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -749,11 +786,11 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -770,11 +807,11 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -792,13 +829,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -819,13 +856,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -840,13 +877,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -867,13 +904,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -887,13 +924,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -908,13 +945,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -929,13 +966,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -951,13 +988,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1003,10 +1040,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1016,10 +1053,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1027,10 +1064,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1565,7 +1602,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1580,19 +1617,19 @@ public class Long256VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1607,7 +1644,7 @@ public class Long256VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1615,9 +1652,9 @@ public class Long256VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3731,20 +3768,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3833,20 +3870,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3935,20 +3972,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4037,20 +4074,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4139,20 +4176,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4241,20 +4278,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4343,20 +4380,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4445,20 +4482,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4547,20 +4584,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4649,20 +4686,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4799,20 +4836,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4891,7 +4928,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4911,7 +4948,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4932,7 +4969,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4952,7 +4989,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4971,7 +5008,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4990,7 +5027,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5013,7 +5050,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5032,7 +5069,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5055,7 +5092,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5074,7 +5111,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5093,7 +5130,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5116,7 +5153,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5135,7 +5172,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5158,7 +5195,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5177,7 +5214,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5200,7 +5237,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5219,7 +5256,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5242,7 +5279,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5261,7 +5298,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5284,7 +5321,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5303,7 +5340,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5326,7 +5363,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5345,7 +5382,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5368,7 +5405,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5387,7 +5424,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5410,7 +5447,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5427,7 +5464,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5447,7 +5484,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5464,7 +5501,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5484,7 +5521,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5766,7 +5803,7 @@ public class Long256VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6716,10 +6753,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6748,7 +6785,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6764,7 +6801,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6938,7 +6975,7 @@ public class Long256VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6966,7 +7003,7 @@ public class Long256VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6981,7 +7018,7 @@ public class Long256VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7084,7 +7121,7 @@ public class Long256VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7110,7 +7147,7 @@ public class Long256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7124,7 +7161,7 @@ public class Long256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7146,7 +7183,7 @@ public class Long256VectorTests extends AbstractVectorTest { static void loopBoundLong256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7154,14 +7191,14 @@ public class Long256VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLong256VectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7215,7 +7252,7 @@ public class Long256VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLong256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java index 1b70f8d1ba4..dfdafc91d1a 100644 --- a/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -870,11 +885,11 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Long512VectorTests.java b/test/jdk/jdk/incubator/vector/Long512VectorTests.java index 5f8abb5bdd5..a575c80a0ce 100644 --- a/test/jdk/jdk/incubator/vector/Long512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long512VectorTests.java @@ -62,6 +62,43 @@ public class Long512VectorTests extends AbstractVectorTest { LongVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final long CONST_SHIFT = Long.SIZE / 2; @@ -96,10 +133,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +148,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +164,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +183,13 @@ public class Long512VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +205,13 @@ public class Long512VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -187,10 +224,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -202,10 +239,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -214,12 +251,12 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -230,20 +267,20 @@ public class Long512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -255,19 +292,19 @@ public class Long512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -283,11 +320,11 @@ public class Long512VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -296,12 +333,12 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -311,17 +348,17 @@ public class Long512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -331,17 +368,17 @@ public class Long512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -355,10 +392,10 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -370,10 +407,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -385,10 +422,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -409,18 +446,18 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -435,18 +472,18 @@ public class Long512VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -454,10 +491,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -465,10 +502,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -476,10 +513,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -488,10 +525,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -504,10 +541,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -519,10 +556,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -534,10 +571,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -552,10 +589,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -568,11 +605,11 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -586,11 +623,11 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -612,11 +649,11 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -630,11 +667,11 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -654,10 +691,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -669,10 +706,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -681,10 +718,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -694,10 +731,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -713,11 +750,11 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -734,11 +771,11 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -749,11 +786,11 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -770,11 +807,11 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -792,13 +829,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -819,13 +856,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -840,13 +877,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -867,13 +904,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -887,13 +924,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -908,13 +945,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -929,13 +966,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -951,13 +988,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1003,10 +1040,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1016,10 +1053,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1027,10 +1064,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1565,7 +1602,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1580,19 +1617,19 @@ public class Long512VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1607,7 +1644,7 @@ public class Long512VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1615,9 +1652,9 @@ public class Long512VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3731,20 +3768,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3833,20 +3870,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3935,20 +3972,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4037,20 +4074,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4139,20 +4176,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4241,20 +4278,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4343,20 +4380,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4445,20 +4482,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4547,20 +4584,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4649,20 +4686,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4799,20 +4836,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4891,7 +4928,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4911,7 +4948,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4932,7 +4969,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4952,7 +4989,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4971,7 +5008,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4990,7 +5027,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5013,7 +5050,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5032,7 +5069,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5055,7 +5092,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5074,7 +5111,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5093,7 +5130,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5116,7 +5153,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5135,7 +5172,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5158,7 +5195,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5177,7 +5214,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5200,7 +5237,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5219,7 +5256,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5242,7 +5279,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5261,7 +5298,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5284,7 +5321,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5303,7 +5340,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5326,7 +5363,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5345,7 +5382,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5368,7 +5405,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5387,7 +5424,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5410,7 +5447,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5427,7 +5464,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5447,7 +5484,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5464,7 +5501,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5484,7 +5521,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5766,7 +5803,7 @@ public class Long512VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6716,10 +6753,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6748,7 +6785,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6764,7 +6801,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6938,7 +6975,7 @@ public class Long512VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6966,7 +7003,7 @@ public class Long512VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6981,7 +7018,7 @@ public class Long512VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7084,7 +7121,7 @@ public class Long512VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7110,7 +7147,7 @@ public class Long512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7124,7 +7161,7 @@ public class Long512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7146,7 +7183,7 @@ public class Long512VectorTests extends AbstractVectorTest { static void loopBoundLong512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7154,14 +7191,14 @@ public class Long512VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLong512VectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7215,7 +7252,7 @@ public class Long512VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLong512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java index 53df5e4e092..c4894fd86a4 100644 --- a/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -870,11 +885,11 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Long64VectorTests.java b/test/jdk/jdk/incubator/vector/Long64VectorTests.java index 5f8a9018384..3118ce5a4a2 100644 --- a/test/jdk/jdk/incubator/vector/Long64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long64VectorTests.java @@ -62,6 +62,43 @@ public class Long64VectorTests extends AbstractVectorTest { LongVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final long CONST_SHIFT = Long.SIZE / 2; @@ -96,10 +133,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +148,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +164,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +183,13 @@ public class Long64VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +205,13 @@ public class Long64VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -187,10 +224,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -202,10 +239,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -214,12 +251,12 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -230,20 +267,20 @@ public class Long64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -255,19 +292,19 @@ public class Long64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -283,11 +320,11 @@ public class Long64VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -296,12 +333,12 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -311,17 +348,17 @@ public class Long64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -331,17 +368,17 @@ public class Long64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -355,10 +392,10 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -370,10 +407,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -385,10 +422,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -409,18 +446,18 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -435,18 +472,18 @@ public class Long64VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -454,10 +491,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -465,10 +502,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -476,10 +513,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -488,10 +525,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -504,10 +541,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -519,10 +556,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -534,10 +571,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -552,10 +589,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -568,11 +605,11 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -586,11 +623,11 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -612,11 +649,11 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -630,11 +667,11 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -654,10 +691,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -669,10 +706,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -681,10 +718,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -694,10 +731,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -713,11 +750,11 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -734,11 +771,11 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -749,11 +786,11 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -770,11 +807,11 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -792,13 +829,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -819,13 +856,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -840,13 +877,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -867,13 +904,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -887,13 +924,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -908,13 +945,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -929,13 +966,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -951,13 +988,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1003,10 +1040,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1016,10 +1053,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1027,10 +1064,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1565,7 +1602,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1580,19 +1617,19 @@ public class Long64VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1607,7 +1644,7 @@ public class Long64VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1615,9 +1652,9 @@ public class Long64VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3731,20 +3768,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3833,20 +3870,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3935,20 +3972,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4037,20 +4074,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4139,20 +4176,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4241,20 +4278,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4343,20 +4380,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4445,20 +4482,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4547,20 +4584,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4649,20 +4686,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4799,20 +4836,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4891,7 +4928,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4911,7 +4948,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4932,7 +4969,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4952,7 +4989,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4971,7 +5008,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4990,7 +5027,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5013,7 +5050,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5032,7 +5069,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5055,7 +5092,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5074,7 +5111,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5093,7 +5130,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5116,7 +5153,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5135,7 +5172,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5158,7 +5195,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5177,7 +5214,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5200,7 +5237,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5219,7 +5256,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5242,7 +5279,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5261,7 +5298,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5284,7 +5321,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5303,7 +5340,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5326,7 +5363,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5345,7 +5382,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5368,7 +5405,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5387,7 +5424,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5410,7 +5447,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5427,7 +5464,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5447,7 +5484,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5464,7 +5501,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5484,7 +5521,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5766,7 +5803,7 @@ public class Long64VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6716,10 +6753,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6748,7 +6785,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6764,7 +6801,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6938,7 +6975,7 @@ public class Long64VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6966,7 +7003,7 @@ public class Long64VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6981,7 +7018,7 @@ public class Long64VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7084,7 +7121,7 @@ public class Long64VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7110,7 +7147,7 @@ public class Long64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7124,7 +7161,7 @@ public class Long64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7146,7 +7183,7 @@ public class Long64VectorTests extends AbstractVectorTest { static void loopBoundLong64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7154,14 +7191,14 @@ public class Long64VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLong64VectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7215,7 +7252,7 @@ public class Long64VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLong64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java index e0f8b548228..6994ee7c770 100644 --- a/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -877,11 +892,11 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -892,11 +907,11 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -912,7 +927,7 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -925,7 +940,7 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java index 17fee0a7765..0e19a587093 100644 --- a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java @@ -62,6 +62,43 @@ public class LongMaxVectorTests extends AbstractVectorTest { LongVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -102,10 +139,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -117,13 +154,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -133,10 +170,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -152,13 +189,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -174,13 +211,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -193,10 +230,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -208,10 +245,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -220,12 +257,12 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -236,20 +273,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -261,19 +298,19 @@ public class LongMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -289,11 +326,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -302,12 +339,12 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -317,17 +354,17 @@ public class LongMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -337,17 +374,17 @@ public class LongMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -361,10 +398,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -376,10 +413,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -391,10 +428,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -415,18 +452,18 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -441,18 +478,18 @@ public class LongMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -460,10 +497,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -471,10 +508,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -482,10 +519,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -494,10 +531,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -510,10 +547,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -525,10 +562,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -540,10 +577,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -558,10 +595,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -574,11 +611,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -592,11 +629,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -618,11 +655,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -636,11 +673,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -660,10 +697,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -675,10 +712,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -687,10 +724,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -700,10 +737,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -719,11 +756,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -740,11 +777,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -755,11 +792,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -776,11 +813,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -798,13 +835,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -825,13 +862,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -846,13 +883,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -873,13 +910,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -893,13 +930,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -914,13 +951,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -935,13 +972,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -957,13 +994,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1009,10 +1046,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1022,10 +1059,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1033,10 +1070,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1571,7 +1608,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1586,19 +1623,19 @@ public class LongMaxVectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1613,7 +1650,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1621,9 +1658,9 @@ public class LongMaxVectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3737,20 +3774,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3839,20 +3876,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3941,20 +3978,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4043,20 +4080,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4145,20 +4182,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4247,20 +4284,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4349,20 +4386,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4451,20 +4488,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4553,20 +4590,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4655,20 +4692,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4805,20 +4842,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4897,7 +4934,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4917,7 +4954,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4938,7 +4975,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4958,7 +4995,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4977,7 +5014,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4996,7 +5033,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5019,7 +5056,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5038,7 +5075,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5061,7 +5098,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5080,7 +5117,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5099,7 +5136,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5122,7 +5159,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5141,7 +5178,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5164,7 +5201,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5183,7 +5220,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5206,7 +5243,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5225,7 +5262,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5248,7 +5285,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5267,7 +5304,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5290,7 +5327,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5309,7 +5346,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5332,7 +5369,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5351,7 +5388,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5374,7 +5411,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5393,7 +5430,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5416,7 +5453,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5433,7 +5470,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5453,7 +5490,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5470,7 +5507,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5490,7 +5527,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5772,7 +5809,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6722,10 +6759,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6754,7 +6791,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6770,7 +6807,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6944,7 +6981,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6972,7 +7009,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6987,7 +7024,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7090,7 +7127,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7116,7 +7153,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7130,7 +7167,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7152,7 +7189,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { static void loopBoundLongMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7160,14 +7197,14 @@ public class LongMaxVectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLongMaxVectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7221,7 +7258,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLongMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java index 5a71c5550f3..18974b65164 100644 --- a/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1114,11 +1129,11 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1129,11 +1144,11 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1149,7 +1164,7 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1162,7 +1177,7 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Short128VectorTests.java b/test/jdk/jdk/incubator/vector/Short128VectorTests.java index fb740fedfd4..50dc1931663 100644 --- a/test/jdk/jdk/incubator/vector/Short128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short128VectorTests.java @@ -62,6 +62,49 @@ public class Short128VectorTests extends AbstractVectorTest { ShortVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final short CONST_SHIFT = Short.SIZE / 2; @@ -96,10 +139,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Short128VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Short128VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Short128VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Short128VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Short128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Short128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Short128VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Short128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Short128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Short128VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1577,7 +1620,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1592,19 +1635,19 @@ public class Short128VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1619,7 +1662,7 @@ public class Short128VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3656,20 +3699,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3758,20 +3801,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3860,20 +3903,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3962,20 +4005,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4064,20 +4107,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4166,20 +4209,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4268,20 +4311,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4370,20 +4413,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4472,20 +4515,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4574,20 +4617,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4724,20 +4767,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4816,7 +4859,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4836,7 +4879,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4857,7 +4900,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4877,7 +4920,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4896,7 +4939,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4915,7 +4958,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4938,7 +4981,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4957,7 +5000,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4980,7 +5023,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -4999,7 +5042,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5018,7 +5061,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5041,7 +5084,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5060,7 +5103,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5083,7 +5126,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5102,7 +5145,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5125,7 +5168,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5144,7 +5187,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5167,7 +5210,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5186,7 +5229,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5209,7 +5252,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5228,7 +5271,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5251,7 +5294,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5270,7 +5313,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5293,7 +5336,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5312,7 +5355,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5335,7 +5378,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5372,7 +5415,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5388,7 +5431,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5408,7 +5451,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5424,7 +5467,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5444,7 +5487,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5460,7 +5503,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5480,7 +5523,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5761,7 +5804,7 @@ public class Short128VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6711,10 +6754,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6743,7 +6786,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6759,7 +6802,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6999,7 +7042,7 @@ public class Short128VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7027,7 +7070,7 @@ public class Short128VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7042,7 +7085,7 @@ public class Short128VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7145,7 +7188,7 @@ public class Short128VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7171,7 +7214,7 @@ public class Short128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7185,7 +7228,7 @@ public class Short128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7207,7 +7250,7 @@ public class Short128VectorTests extends AbstractVectorTest { static void loopBoundShort128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7215,14 +7258,14 @@ public class Short128VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShort128VectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7276,7 +7319,7 @@ public class Short128VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShort128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java index 335d51add59..a7f1d67659e 100644 --- a/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1114,11 +1129,11 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1129,11 +1144,11 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1149,7 +1164,7 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1162,7 +1177,7 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Short256VectorTests.java b/test/jdk/jdk/incubator/vector/Short256VectorTests.java index cd6aa113b84..b23014665af 100644 --- a/test/jdk/jdk/incubator/vector/Short256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short256VectorTests.java @@ -62,6 +62,49 @@ public class Short256VectorTests extends AbstractVectorTest { ShortVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final short CONST_SHIFT = Short.SIZE / 2; @@ -96,10 +139,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Short256VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Short256VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Short256VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Short256VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Short256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Short256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Short256VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Short256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Short256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Short256VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1577,7 +1620,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1592,19 +1635,19 @@ public class Short256VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1619,7 +1662,7 @@ public class Short256VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3656,20 +3699,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3758,20 +3801,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3860,20 +3903,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3962,20 +4005,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4064,20 +4107,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4166,20 +4209,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4268,20 +4311,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4370,20 +4413,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4472,20 +4515,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4574,20 +4617,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4724,20 +4767,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4816,7 +4859,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4836,7 +4879,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4857,7 +4900,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4877,7 +4920,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4896,7 +4939,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4915,7 +4958,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4938,7 +4981,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4957,7 +5000,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4980,7 +5023,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -4999,7 +5042,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5018,7 +5061,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5041,7 +5084,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5060,7 +5103,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5083,7 +5126,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5102,7 +5145,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5125,7 +5168,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5144,7 +5187,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5167,7 +5210,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5186,7 +5229,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5209,7 +5252,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5228,7 +5271,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5251,7 +5294,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5270,7 +5313,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5293,7 +5336,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5312,7 +5355,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5335,7 +5378,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5372,7 +5415,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5388,7 +5431,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5408,7 +5451,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5424,7 +5467,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5444,7 +5487,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5460,7 +5503,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5480,7 +5523,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5761,7 +5804,7 @@ public class Short256VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6711,10 +6754,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6743,7 +6786,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6759,7 +6802,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6999,7 +7042,7 @@ public class Short256VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7027,7 +7070,7 @@ public class Short256VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7042,7 +7085,7 @@ public class Short256VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7145,7 +7188,7 @@ public class Short256VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7171,7 +7214,7 @@ public class Short256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7185,7 +7228,7 @@ public class Short256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7207,7 +7250,7 @@ public class Short256VectorTests extends AbstractVectorTest { static void loopBoundShort256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7215,14 +7258,14 @@ public class Short256VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShort256VectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7276,7 +7319,7 @@ public class Short256VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShort256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java index 7a273986bef..accbe0008b5 100644 --- a/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1114,11 +1129,11 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1129,11 +1144,11 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1149,7 +1164,7 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1162,7 +1177,7 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Short512VectorTests.java b/test/jdk/jdk/incubator/vector/Short512VectorTests.java index 722f826f3e9..7a08de22cb8 100644 --- a/test/jdk/jdk/incubator/vector/Short512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short512VectorTests.java @@ -62,6 +62,49 @@ public class Short512VectorTests extends AbstractVectorTest { ShortVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final short CONST_SHIFT = Short.SIZE / 2; @@ -96,10 +139,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Short512VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Short512VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Short512VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Short512VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Short512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Short512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Short512VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Short512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Short512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Short512VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1577,7 +1620,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1592,19 +1635,19 @@ public class Short512VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1619,7 +1662,7 @@ public class Short512VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3656,20 +3699,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3758,20 +3801,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3860,20 +3903,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3962,20 +4005,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4064,20 +4107,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4166,20 +4209,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4268,20 +4311,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4370,20 +4413,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4472,20 +4515,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4574,20 +4617,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4724,20 +4767,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4816,7 +4859,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4836,7 +4879,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4857,7 +4900,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4877,7 +4920,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4896,7 +4939,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4915,7 +4958,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4938,7 +4981,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4957,7 +5000,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4980,7 +5023,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -4999,7 +5042,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5018,7 +5061,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5041,7 +5084,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5060,7 +5103,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5083,7 +5126,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5102,7 +5145,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5125,7 +5168,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5144,7 +5187,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5167,7 +5210,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5186,7 +5229,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5209,7 +5252,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5228,7 +5271,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5251,7 +5294,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5270,7 +5313,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5293,7 +5336,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5312,7 +5355,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5335,7 +5378,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5372,7 +5415,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5388,7 +5431,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5408,7 +5451,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5424,7 +5467,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5444,7 +5487,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5460,7 +5503,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5480,7 +5523,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5761,7 +5804,7 @@ public class Short512VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6711,10 +6754,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6743,7 +6786,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6759,7 +6802,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6999,7 +7042,7 @@ public class Short512VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7027,7 +7070,7 @@ public class Short512VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7042,7 +7085,7 @@ public class Short512VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7145,7 +7188,7 @@ public class Short512VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7171,7 +7214,7 @@ public class Short512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7185,7 +7228,7 @@ public class Short512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7207,7 +7250,7 @@ public class Short512VectorTests extends AbstractVectorTest { static void loopBoundShort512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7215,14 +7258,14 @@ public class Short512VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShort512VectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7276,7 +7319,7 @@ public class Short512VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShort512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java index 952d71c80a6..063b3e8ca61 100644 --- a/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1114,11 +1129,11 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1129,11 +1144,11 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1149,7 +1164,7 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1162,7 +1177,7 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Short64VectorTests.java b/test/jdk/jdk/incubator/vector/Short64VectorTests.java index 9ec8ac08789..4181dbce164 100644 --- a/test/jdk/jdk/incubator/vector/Short64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short64VectorTests.java @@ -62,6 +62,49 @@ public class Short64VectorTests extends AbstractVectorTest { ShortVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final short CONST_SHIFT = Short.SIZE / 2; @@ -96,10 +139,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Short64VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Short64VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Short64VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Short64VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Short64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Short64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Short64VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Short64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Short64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Short64VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1577,7 +1620,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1592,19 +1635,19 @@ public class Short64VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1619,7 +1662,7 @@ public class Short64VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3656,20 +3699,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3758,20 +3801,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3860,20 +3903,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3962,20 +4005,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4064,20 +4107,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4166,20 +4209,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4268,20 +4311,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4370,20 +4413,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4472,20 +4515,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4574,20 +4617,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4724,20 +4767,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4816,7 +4859,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4836,7 +4879,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4857,7 +4900,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4877,7 +4920,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4896,7 +4939,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4915,7 +4958,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4938,7 +4981,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4957,7 +5000,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4980,7 +5023,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -4999,7 +5042,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5018,7 +5061,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5041,7 +5084,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5060,7 +5103,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5083,7 +5126,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5102,7 +5145,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5125,7 +5168,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5144,7 +5187,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5167,7 +5210,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5186,7 +5229,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5209,7 +5252,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5228,7 +5271,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5251,7 +5294,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5270,7 +5313,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5293,7 +5336,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5312,7 +5355,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5335,7 +5378,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5372,7 +5415,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5388,7 +5431,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5408,7 +5451,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5424,7 +5467,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5444,7 +5487,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5460,7 +5503,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5480,7 +5523,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5761,7 +5804,7 @@ public class Short64VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6711,10 +6754,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6743,7 +6786,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6759,7 +6802,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6999,7 +7042,7 @@ public class Short64VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7027,7 +7070,7 @@ public class Short64VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7042,7 +7085,7 @@ public class Short64VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7145,7 +7188,7 @@ public class Short64VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7171,7 +7214,7 @@ public class Short64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7185,7 +7228,7 @@ public class Short64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7207,7 +7250,7 @@ public class Short64VectorTests extends AbstractVectorTest { static void loopBoundShort64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7215,14 +7258,14 @@ public class Short64VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShort64VectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7276,7 +7319,7 @@ public class Short64VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShort64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java index 91db367808a..ebed7dd0226 100644 --- a/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1121,11 +1136,11 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1136,11 +1151,11 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1156,7 +1171,7 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1169,7 +1184,7 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java index ad2efd3575d..f71cf3ca322 100644 --- a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java @@ -62,6 +62,49 @@ public class ShortMaxVectorTests extends AbstractVectorTest { ShortVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -102,10 +145,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -117,13 +160,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -133,10 +176,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -152,13 +195,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -174,13 +217,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -196,13 +239,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -218,13 +261,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -236,10 +279,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -251,10 +294,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,12 +306,12 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -279,20 +322,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -304,19 +347,19 @@ public class ShortMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -332,11 +375,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -345,12 +388,12 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -360,17 +403,17 @@ public class ShortMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -380,17 +423,17 @@ public class ShortMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -404,10 +447,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -419,10 +462,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -434,10 +477,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -458,18 +501,18 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -484,18 +527,18 @@ public class ShortMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -503,10 +546,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -514,10 +557,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -525,10 +568,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -537,10 +580,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -553,10 +596,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -568,10 +611,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -583,10 +626,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -601,10 +644,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -617,11 +660,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -635,11 +678,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -661,11 +704,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -679,11 +722,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -703,10 +746,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -718,10 +761,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -730,10 +773,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -743,10 +786,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -762,11 +805,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -783,11 +826,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -798,11 +841,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -819,11 +862,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -841,13 +884,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -868,13 +911,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -889,13 +932,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -916,13 +959,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -936,13 +979,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -957,13 +1000,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -978,13 +1021,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1000,13 +1043,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1019,10 +1062,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1032,10 +1075,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1043,10 +1086,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1583,7 +1626,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1598,19 +1641,19 @@ public class ShortMaxVectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1625,7 +1668,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3662,20 +3705,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3764,20 +3807,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3866,20 +3909,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3968,20 +4011,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4070,20 +4113,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4172,20 +4215,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4274,20 +4317,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4376,20 +4419,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4478,20 +4521,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4580,20 +4623,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4730,20 +4773,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4822,7 +4865,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4842,7 +4885,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4863,7 +4906,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4883,7 +4926,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4902,7 +4945,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4921,7 +4964,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4944,7 +4987,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4963,7 +5006,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4986,7 +5029,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5005,7 +5048,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5024,7 +5067,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5047,7 +5090,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5066,7 +5109,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5089,7 +5132,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5108,7 +5151,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5131,7 +5174,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5150,7 +5193,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5173,7 +5216,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5192,7 +5235,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5215,7 +5258,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5234,7 +5277,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5257,7 +5300,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5276,7 +5319,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5299,7 +5342,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5318,7 +5361,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5341,7 +5384,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5358,7 +5401,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5378,7 +5421,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5394,7 +5437,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5414,7 +5457,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5430,7 +5473,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5450,7 +5493,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5466,7 +5509,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5486,7 +5529,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5767,7 +5810,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6717,10 +6760,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6749,7 +6792,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6765,7 +6808,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7005,7 +7048,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7033,7 +7076,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7048,7 +7091,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7151,7 +7194,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7177,7 +7220,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7191,7 +7234,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7213,7 +7256,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { static void loopBoundShortMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7221,14 +7264,14 @@ public class ShortMaxVectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShortMaxVectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7282,7 +7325,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShortMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/gen-tests.sh b/test/jdk/jdk/incubator/vector/gen-tests.sh index 8b87d9d9efb..239e53367c0 100644 --- a/test/jdk/jdk/incubator/vector/gen-tests.sh +++ b/test/jdk/jdk/incubator/vector/gen-tests.sh @@ -64,6 +64,7 @@ do MinValue=MIN_VALUE kind=BITWISE + fpkind=BITWISE bitstype=$type Bitstype=$Type @@ -99,6 +100,7 @@ do ;; float) kind=FP + fpkind=FP32 bitstype=int Bitstype=Int Boxbitstype=Integer @@ -108,6 +110,7 @@ do ;; double) kind=FP + fpkind=FP64 bitstype=long Bitstype=Long Boxbitstype=Long @@ -117,7 +120,7 @@ do ;; esac - args="$args -K$kind -K$Type -DBoxtype=$Boxtype -DWideboxtype=$Wideboxtype -DMaxValue=$MaxValue -DMinValue=$MinValue" + args="$args -K$kind -K$fpkind -K$Type -DBoxtype=$Boxtype -DWideboxtype=$Wideboxtype -DMaxValue=$MaxValue -DMinValue=$MinValue" args="$args -Dbitstype=$bitstype -DBitstype=$Bitstype -DBoxbitstype=$Boxbitstype" args="$args -Dfptype=$fptype -DFptype=$Fptype -DBoxfptype=$Boxfptype" diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template index e3fcdf57e83..92e612e8184 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template @@ -10,7 +10,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] b[i]); } } } @@ -30,7 +30,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] b[i])); } } } @@ -47,7 +47,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] ($type$)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] ($type$)((long)b[i])); } } } @@ -67,7 +67,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] ($type$)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] ($type$)((long)b[i]))); } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template index b34658ffc4c..6620dc679b8 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template @@ -16,7 +16,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && [[TEST_OP]](a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && [[TEST_OP]](a[i + j], b[i + j])); } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template b/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template index 47ddfaf4ab0..f3c7b52f70f 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template @@ -12,7 +12,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), [[TEST_OP]](a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), [[TEST_OP]](a[i + j], b[i + j])); } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Mask-FromToLong.template b/test/jdk/jdk/incubator/vector/templates/Unit-Mask-FromToLong.template index 784ef5f81b9..3f8bd186ca4 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Mask-FromToLong.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Mask-FromToLong.template @@ -5,10 +5,10 @@ int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template b/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template index 460f7624f2c..8411565628d 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template @@ -10,7 +10,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -26,7 +26,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -350,7 +350,7 @@ int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -378,7 +378,7 @@ var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -393,7 +393,7 @@ var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -496,7 +496,7 @@ trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -522,7 +522,7 @@ assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -536,7 +536,7 @@ assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -558,7 +558,7 @@ static void loopBound$vectorteststype$SmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -566,14 +566,14 @@ long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSize$vectorteststype$SmokeTest() { $abstractvectortype$ av = $abstractvectortype$.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, $Wideboxtype$.SIZE); + assertEquals(elsize, $Wideboxtype$.SIZE); } @Test @@ -627,6 +627,6 @@ @Test static void MaskAllTrue$vectorteststype$SmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template index c797ad907fb..4be33efd57c 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template @@ -11,20 +11,20 @@ $type$[] a = fa.apply(SPECIES.length()); $type$ id = [[TEST_INIT]]; - Assert.assertEquals([[TEST_OP]](id, id), id, + assertEquals([[TEST_OP]](id, id), id, "[[TEST]]([[TEST_INIT]], [[TEST_INIT]]) != [[TEST_INIT]]"); $type$ x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals([[TEST_OP]](id, x), x); - Assert.assertEquals([[TEST_OP]](x, id), x); + assertEquals([[TEST_OP]](id, x), x); + assertEquals([[TEST_OP]](x, id), x); } } catch (AssertionError e) { - Assert.assertEquals([[TEST_OP]](id, x), x, + assertEquals([[TEST_OP]](id, x), x, "[[TEST]]([[TEST_INIT]], " + x + ") != " + x); - Assert.assertEquals([[TEST_OP]](x, id), x, + assertEquals([[TEST_OP]](x, id), x, "[[TEST]](" + x + ", [[TEST_INIT]]) != " + x); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template index f8438fa58c8..25ae3ba2f12 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template @@ -15,20 +15,20 @@ $type$[] a = fa.apply(SPECIES.length()); $type$ id = [[TEST_INIT]]; - Assert.assertEquals(($type$) (id [[TEST_OP]] id), id, + assertEquals(($type$) (id [[TEST_OP]] id), id, "[[TEST]]([[TEST_INIT]], [[TEST_INIT]]) != [[TEST_INIT]]"); $type$ x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(($type$) (id [[TEST_OP]] x), x); - Assert.assertEquals(($type$) (x [[TEST_OP]] id), x); + assertEquals(($type$) (id [[TEST_OP]] x), x); + assertEquals(($type$) (x [[TEST_OP]] id), x); } } catch (AssertionError e) { - Assert.assertEquals(($type$) (id [[TEST_OP]] x), x, + assertEquals(($type$) (id [[TEST_OP]] x), x, "[[TEST]]([[TEST_INIT]], " + x + ") != " + x); - Assert.assertEquals(($type$) (x [[TEST_OP]] id), x, + assertEquals(($type$) (x [[TEST_OP]] id), x, "[[TEST]](" + x + ", [[TEST_INIT]]) != " + x); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-SaturatingReduction-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-SaturatingReduction-op.template index d961a29e5c8..4769b67fe3e 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-SaturatingReduction-op.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-SaturatingReduction-op.template @@ -11,20 +11,20 @@ $type$[] a = fa.apply(SPECIES.length()); $type$ id = [[TEST_INIT]]; - Assert.assertEquals([[TEST_OP]](id, id), id, + assertEquals([[TEST_OP]](id, id), id, "[[TEST]]([[TEST_INIT]], [[TEST_INIT]]) != [[TEST_INIT]]"); $type$ x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals([[TEST_OP]](id, x), x); - Assert.assertEquals([[TEST_OP]](x, id), x); + assertEquals([[TEST_OP]](id, x), x); + assertEquals([[TEST_OP]](x, id), x); } } catch (AssertionError e) { - Assert.assertEquals([[TEST_OP]](id, x), x, + assertEquals([[TEST_OP]](id, x), x, "[[TEST]]([[TEST_INIT]], " + x + ") != " + x); - Assert.assertEquals([[TEST_OP]](x, id), x, + assertEquals([[TEST_OP]](x, id), x, "[[TEST]](" + x + ", [[TEST_INIT]]) != " + x); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Test.template b/test/jdk/jdk/incubator/vector/templates/Unit-Test.template index 080773ede1a..8af517cfe56 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Test.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Test.template @@ -14,7 +14,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), test[[TEST]](a[i + j])); + assertEquals(mv.laneIsSet(j), test[[TEST]](a[i + j])); } } } @@ -34,7 +34,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && test[[TEST]](a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && test[[TEST]](a[i + j])); } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template b/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template index a277d66ae3e..a5b13c1ab00 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template @@ -2,5 +2,5 @@ @Test(dataProvider = "$type$UnaryOpProvider") static void Zero$vectorteststype$(IntFunction<$type$[]> fa) { [[KERNEL]] - Assert.assertEquals(a, r); + assertEquals(a, r); } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-header.template b/test/jdk/jdk/incubator/vector/templates/Unit-header.template index e1ec6624022..00a7766492c 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-header.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-header.template @@ -86,6 +86,53 @@ public class $vectorteststype$ extends AbstractVectorTest { #end[MaxBit] static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals($type$ actual, $type$ expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals($type$ actual, $type$ expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals($type$ actual, $type$ expected, $type$ delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals($type$ actual, $type$ expected, $type$ delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals($type$ [] actual, $type$ [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals($type$ [] actual, $type$ [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } +#if[!long] + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } +#end[!long] + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } +#if[!FP64] + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } +#end[!FP64] + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + #if[MaxBit] static VectorShape getMaxBit() { @@ -154,10 +201,10 @@ public class $vectorteststype$ extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -169,13 +216,13 @@ public class $vectorteststype$ extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { $type$[] ref = f.apply(a[i]); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -185,10 +232,10 @@ public class $vectorteststype$ extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -207,13 +254,13 @@ public class $vectorteststype$ extends AbstractVectorTest { #else[FP] int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } #end[FP] } @@ -224,13 +271,13 @@ public class $vectorteststype$ extends AbstractVectorTest { $type$ relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } #end[FP] @@ -250,13 +297,13 @@ public class $vectorteststype$ extends AbstractVectorTest { #else[FP] int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } #end[FP] } @@ -267,14 +314,14 @@ public class $vectorteststype$ extends AbstractVectorTest { $type$ relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } #end[FP] @@ -292,13 +339,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -314,13 +361,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } #end[!Long] @@ -333,10 +380,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -348,10 +395,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -360,12 +407,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -376,20 +423,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], ($type$)0); + assertEquals(r[i + k], ($type$)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], ($type$)0, "at index #" + idx); + assertEquals(r[idx], ($type$)0, "at index #" + idx); } } } @@ -401,19 +448,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], ($type$)0); + assertEquals(r[i + j], ($type$)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], ($type$)0, "at index #" + idx); + assertEquals(r[idx], ($type$)0, "at index #" + idx); } } } @@ -429,11 +476,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -442,12 +489,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -457,17 +504,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], ($type$)0); + assertEquals(r[i+j], ($type$)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], ($type$)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], ($type$)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -477,17 +524,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], ($type$)0); + assertEquals(r[i+j], ($type$)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], ($type$)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], ($type$)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -501,10 +548,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -516,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -531,10 +578,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -555,18 +602,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -581,18 +628,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -600,10 +647,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -611,10 +658,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -622,10 +669,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -634,10 +681,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -650,10 +697,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -665,10 +712,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -680,10 +727,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -698,10 +745,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -714,11 +761,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -732,11 +779,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -758,11 +805,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -776,11 +823,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -800,10 +847,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -815,10 +862,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -827,10 +874,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -840,10 +887,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -859,11 +906,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -880,11 +927,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -895,11 +942,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -916,11 +963,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -1014,13 +1061,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, i, b, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1041,13 +1088,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, i, mask, b, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1062,13 +1109,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(r, a, i, mask, b, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1089,13 +1136,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, origin, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1109,13 +1156,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, b, origin, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1130,13 +1177,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, b, origin, mask, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1151,13 +1198,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, b, origin, part, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1173,13 +1220,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, b, origin, part, mask, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1229,10 +1276,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1279,10 +1326,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } #end[byte] @@ -1291,10 +1338,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } #if[!Double] @@ -1303,10 +1350,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } #end[!Double] @@ -1958,7 +2005,7 @@ relativeError)); // Do some zipping and shuffling. $abstractvectortype$ io = ($abstractvectortype$) SPECIES.broadcast(0).addIndex(1); $abstractvectortype$ io2 = ($abstractvectortype$) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); $abstractvectortype$ a = io.add(($type$)1); //[1,2] $abstractvectortype$ b = a.neg(); //[-1,-2] $type$[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1973,19 +2020,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle<$Boxtype$> unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle<$Boxtype$> unz1 = VectorShuffle.makeUnzip(SPECIES, 1); $abstractvectortype$ uab0 = zab0.rearrange(unz0,zab1); $abstractvectortype$ uab1 = zab0.rearrange(unz1,zab1); $type$[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { $abstractvectortype$ io = ($abstractvectortype$) SPECIES.broadcast(0).addIndex(1); $abstractvectortype$ io2 = ($abstractvectortype$) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -2003,12 +2050,12 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); #else[FP] Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); #end[FP] } #if[FP] @@ -2016,7 +2063,7 @@ relativeError)); @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } #else[FP] #if[byteOrShort] @@ -2032,9 +2079,9 @@ relativeError)); Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } #end[byteOrShort] #end[FP] diff --git a/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template b/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template index a68103e1060..6779c78a490 100644 --- a/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template +++ b/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,14 +81,29 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / $bits$); + static void assertEquals($type$ actual, $type$ expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals($type$ actual, $type$ expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals($type$ [] actual, $type$ [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals($type$ [] actual, $type$ [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals($type$[] r, $type$[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : ($type$) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : ($type$) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : ($type$) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : ($type$) 0, "at index #" + i); } } @@ -342,7 +357,7 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "$type$ProviderForIOOBE") @@ -1225,11 +1240,11 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1240,11 +1255,11 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: ($type$) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: ($type$) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: ($type$) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: ($type$) 0, "at index #" + j); } } @@ -1260,7 +1275,7 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals($type$[] r, $type$[] a, int[] indexMap) { @@ -1273,7 +1288,7 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/nio/zipfs/PathOps.java b/test/jdk/jdk/nio/zipfs/PathOps.java index 0fefd16fa0f..b976894a301 100644 --- a/test/jdk/jdk/nio/zipfs/PathOps.java +++ b/test/jdk/jdk/nio/zipfs/PathOps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,10 +30,10 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.ProviderMismatchException; -/** +/* * * @test - * @bug 8038500 8040059 8139956 8146754 8172921 8186142 + * @bug 8038500 8040059 8139956 8146754 8172921 8186142 8326487 * @summary Tests path operations for zip provider. * * @modules jdk.zipfs @@ -92,6 +92,10 @@ public class PathOps { check(result, Boolean.toString(expected)); } + void check(Object result, int expected) { + check(result, Integer.toString(expected)); + } + PathOps root(String expected) { out.println("check root"); checkPath(); @@ -113,6 +117,13 @@ public class PathOps { return this; } + PathOps nameCount(int expected) { + out.println("check nameCount"); + checkPath(); + check(path.getNameCount(), expected); + return this; + } + PathOps element(int index, String expected) { out.format("check element %d\n", index); checkPath(); @@ -284,7 +295,15 @@ public class PathOps { test("/") .root("/") .parent(null) - .name(null); + .name(null) + .nameCount(0); + + // empty name + test("") + .root(null) + .parent(null) + .name("") + .nameCount(1); // no root component test("a/b") diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java b/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java index ebd2c1c3436..4c9ab1faf81 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6687725 + * @bug 6687725 8365883 * @summary Test internal PKCS5Padding impl with various error conditions. * @author Valerie Peng * @library /test/lib .. @@ -35,6 +35,7 @@ import java.security.AlgorithmParameters; import java.security.NoSuchAlgorithmException; import java.security.Provider; import java.security.Security; +import java.util.Arrays; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; @@ -80,7 +81,7 @@ public class TestPKCS5PaddingError extends PKCS11Test { private void doTest(final Provider p) throws Exception { try { - byte[] plainText = new byte[200]; + byte[] plainText = "testtexttesttext".getBytes(); // 16 bytes text for (CI currTest : TEST_LIST) { System.out.println("===" + currTest.transformation + "==="); @@ -88,14 +89,16 @@ public class TestPKCS5PaddingError extends PKCS11Test { KeyGenerator kg = KeyGenerator.getInstance(currTest.keyAlgo, p); SecretKey key = kg.generateKey(); - Cipher c1 = Cipher.getInstance(currTest.transformation, + // Encrypting without padding to guarantee bad padding + // exception when decrypting + Cipher c1 = Cipher.getInstance(currTest.transformation + .replace("/PKCS5Padding", "/NoPadding"), sunJCEProvider); c1.init(Cipher.ENCRYPT_MODE, key); byte[] cipherText = c1.doFinal(plainText); AlgorithmParameters params = c1.getParameters(); Cipher c2 = Cipher.getInstance(currTest.transformation, p); c2.init(Cipher.DECRYPT_MODE, key, params); - c2.doFinal(cipherText); // 1st test: wrong output length // NOTE: Skip NSS since it reports CKR_DEVICE_ERROR when the @@ -118,9 +121,17 @@ public class TestPKCS5PaddingError extends PKCS11Test { // 2nd test: wrong padding value try { System.out.println("Testing with wrong padding bytes"); - cipherText[cipherText.length - 1]++; - c2.doFinal(cipherText); - System.out.println("WARNING: Expected BPE NOT thrown"); + byte[] result = c2.doFinal(cipherText); + + final String errorDescription = + "Decrypted text " + Arrays.toString(result); + if (Arrays.equals(result, plainText)) { + System.out.println("WARNING: initial text and " + + "decoded text are the same"); + } + System.out.println(errorDescription); + throw new RuntimeException( + "Expected BPE NOT thrown \n" + errorDescription); } catch (BadPaddingException bpe) { // expected } catch (Exception ex) { diff --git a/test/jdk/tools/jimage/JImageBadFileTest.java b/test/jdk/tools/jimage/JImageBadFileTest.java new file mode 100644 index 00000000000..26795f68d16 --- /dev/null +++ b/test/jdk/tools/jimage/JImageBadFileTest.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.function.Consumer; + +import static java.nio.file.StandardOpenOption.READ; +import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING; +import static java.util.regex.Pattern.quote; + +/* + * @test + * @summary Tests to verify behavior for "invalid" jimage files + * @library /test/lib + * @modules jdk.jlink/jdk.tools.jimage + * @build jdk.test.lib.Asserts + * @run main JImageBadFileTest + */ +public class JImageBadFileTest extends JImageCliTest { + // src/java.base/share/native/libjimage/imageFile.hpp + // + // 31 -------- bits -------- 0 + // IDX +-------------------------+ + // 0 | Magic (0xCAFEDADA) | + // +------------+------------+ + // 1 | Major Vers | Minor Vers | + // +------------+------------+ + // 2 | Flags | + // +-------------------------+ + // 3 | Resource Count | + // +-------------------------+ + // 4 | Table Length | + // +-------------------------+ + // 5 | Attributes Size | + // +-------------------------+ + // 6 | Strings Size | + // +-------------------------+ + private static final int HEADER_SIZE_BYTES = 7 * 4; + + /** + * Helper to copy the default jimage file for the runtime under test and + * allow it to be corrupted in various ways. + * + * @param label label for the temporary file (arbitrary debug name) + * @param maxLen maximum number of bytes to copy (-1 to copy all) + * @param headerFn function which may corrupt specific header values + * @return the path of a temporary jimage file in the test directory containing + * the possibly corrupted jimage file (caller should delete) + */ + private Path writeModifiedJimage(String label, int maxLen, Consumer headerFn) + throws IOException { + int remaining = maxLen >= 0 ? maxLen : Integer.MAX_VALUE; + Path dst = Files.createTempFile(Path.of("."), "modules-" + label, ""); + try (InputStream rest = Files.newInputStream(Path.of(getImagePath()), READ); + OutputStream out = Files.newOutputStream(dst, TRUNCATE_EXISTING)) { + ByteBuffer bytes = ByteBuffer.wrap(rest.readNBytes(HEADER_SIZE_BYTES)); + bytes.order(ByteOrder.nativeOrder()); + headerFn.accept(bytes.asIntBuffer()); + int headerSize = Math.min(remaining, HEADER_SIZE_BYTES); + out.write(bytes.array(), 0, headerSize); + remaining -= headerSize; + if (remaining > 0) { + byte[] block = new byte[8192]; + do { + int copySize = Math.min(remaining, block.length); + out.write(block, 0, rest.readNBytes(block, 0, copySize)); + remaining -= copySize; + } while (rest.available() > 0 && remaining > 0); + } + return dst.toAbsolutePath(); + } catch (IOException e) { + Files.deleteIfExists(dst); + throw e; + } + } + + public void testBadMagicNumber() throws IOException { + // Flip some bits in the magic number. + Path tempJimage = writeModifiedJimage("bad_magic", -1, b -> b.put(0, b.get(1) ^ 0x1010)); + try { + JImageResult result = jimage("info", tempJimage.toString()); + result.assertShowsError(); + assertMatches(quote("Unable to open"), result.output); + assertMatches(quote("is not an image file"), result.output); + } finally { + Files.delete(tempJimage); + } + } + + public void testMismatchedVersion() throws IOException { + // Add one to minor version (lowest bits). + Path tempJimage = writeModifiedJimage("bad_version", -1, b -> b.put(1, b.get(1) + 1)); + try { + JImageResult result = jimage("info", tempJimage.toString()); + result.assertShowsError(); + assertMatches(quote("Unable to open"), result.output); + assertMatches(quote("/bin/jimage"), result.output); + assertMatches(quote("not the correct version"), result.output); + assertMatches("Major: \\d+", result.output); + assertMatches("Minor: \\d+", result.output); + } finally { + Files.delete(tempJimage); + } + } + + public void testTruncatedHeader() throws IOException { + // Copy less than the header. + Path tempJimage = writeModifiedJimage("truncated_header", HEADER_SIZE_BYTES - 4, b -> {}); + try { + JImageResult result = jimage("info", tempJimage.toString()); + result.assertShowsError(); + assertMatches(quote("Unable to open"), result.output); + assertMatches(quote("is not an image file"), result.output); + } finally { + Files.delete(tempJimage); + } + } + + public void testTruncatedData() throws IOException { + // Copy more than the header, but definitely less than the whole file. + Path tempJimage = writeModifiedJimage("truncated_data", HEADER_SIZE_BYTES + 1024, b -> {}); + try { + JImageResult result = jimage("info", tempJimage.toString()); + result.assertShowsError(); + assertMatches(quote("Unable to open"), result.output); + assertMatches("image file \".*\" is corrupted", result.output); + } finally { + Files.delete(tempJimage); + } + } + + public void testGoodFileCopy() throws IOException { + // Self test that the file copying isn't itself corrupting anything. + Path tempJimage = writeModifiedJimage("good_file", -1, b -> {}); + try { + jimage("info", tempJimage.toString()).assertSuccess(); + } finally { + Files.delete(tempJimage); + } + } + + public static void main(String[] args) throws Throwable { + new JImageBadFileTest().runTests(); + } +} diff --git a/test/jdk/tools/sincechecker/modules/java.naming/JavaNamingCheckSince.java b/test/jdk/tools/sincechecker/modules/java.naming/JavaNamingCheckSince.java new file mode 100644 index 00000000000..6d99ab9b727 --- /dev/null +++ b/test/jdk/tools/sincechecker/modules/java.naming/JavaNamingCheckSince.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary Test for "@since" in java.naming module + * @library /test/lib /test/jdk/tools/sincechecker + * @run main SinceChecker java.naming + */ diff --git a/test/langtools/tools/javac/launcher/SourceLauncherTest.java b/test/langtools/tools/javac/launcher/SourceLauncherTest.java index 37d50674855..c3c8fb19a1b 100644 --- a/test/langtools/tools/javac/launcher/SourceLauncherTest.java +++ b/test/langtools/tools/javac/launcher/SourceLauncherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @bug 8192920 8204588 8246774 8248843 8268869 8235876 8328339 8335896 8344706 - * 8362237 + * 8362237 8376534 * @summary Test source launcher * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -890,6 +890,57 @@ public class SourceLauncherTest extends TestRunner { "correct\n"); } + @Test + public void testInheritedMain(Path base) throws IOException { + tb.writeJavaFiles(base, + """ + class Sub extends Super {} + """, + """ + class Super { + void main() { + System.out.println(getClass().getName()); + } + } + """); + testSuccess(base.resolve("Sub.java"), + "Sub\n"); + } + + @Test + public void testInheritedMainFromAbstract(Path base) throws IOException { + tb.writeJavaFiles(base, + """ + class Sub extends Super {} + """, + """ + abstract class Super { + void main() { + System.out.println(getClass().getName()); + } + } + """); + testSuccess(base.resolve("Sub.java"), + "Sub\n"); + } + + @Test + public void testInheritedMainFromInterface(Path base) throws IOException { + tb.writeJavaFiles(base, + """ + public class Sub implements Super {} + """, + """ + public interface Super { + default void main() { + System.out.println(getClass().getName()); + } + } + """); + testSuccess(base.resolve("Sub.java"), + "Sub\n"); + } + Result run(Path file, List runtimeArgs, List appArgs) { List args = new ArrayList<>(); args.add(file.toString()); diff --git a/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsReproducibleTest.java b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsReproducibleTest.java index ee3bb8c897d..334db17fe39 100644 --- a/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsReproducibleTest.java +++ b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsReproducibleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,7 @@ import org.junit.jupiter.api.Test; * @summary verifies that the ct.sym file created by build.tools.symbolgenerator.CreateSymbols * is reproducible * @library /test/lib + * @requires os.arch != "s390x" * @modules java.compiler * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.jvm