From 97311ed2b08768be1f0b6be5518eacadbf1a1266 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 15 Feb 2024 15:33:02 +0000 Subject: [PATCH] Use googletest to run tests --- .github/workflows/build_and_test.yml | 14 +- CMakeLists.txt | 183 ++++++++++++------------ README.md | 41 ++++++ include/rvvlm_fp.inc.h | 44 +++--- test/CMakeLists.txt | 202 +++++++++++---------------- test/include/test_infra.h | 7 + test/src/test_acos.cpp | 7 +- test/src/test_acosI.cpp | 7 +- test/src/test_acosh.cpp | 7 +- test/src/test_acoshI.cpp | 7 +- test/src/test_acospi.cpp | 7 +- test/src/test_acospiI.cpp | 7 +- test/src/test_asin.cpp | 7 +- test/src/test_asinI.cpp | 7 +- test/src/test_asinh.cpp | 7 +- test/src/test_asinhI.cpp | 7 +- test/src/test_asinpi.cpp | 7 +- test/src/test_asinpiI.cpp | 7 +- test/src/test_atan.cpp | 7 +- test/src/test_atan2.cpp | 7 +- test/src/test_atan2I.cpp | 7 +- test/src/test_atan2pi.cpp | 7 +- test/src/test_atan2piI.cpp | 7 +- test/src/test_atanI.cpp | 7 +- test/src/test_atanh.cpp | 7 +- test/src/test_atanhI.cpp | 7 +- test/src/test_atanpi.cpp | 7 +- test/src/test_atanpiI.cpp | 7 +- test/src/test_cbrt.cpp | 7 +- test/src/test_cbrtI.cpp | 7 +- test/src/test_cdfnorm.cpp | 7 +- test/src/test_cdfnormI.cpp | 7 +- test/src/test_cos.cpp | 7 +- test/src/test_cosI.cpp | 7 +- test/src/test_cosh.cpp | 7 +- test/src/test_coshI.cpp | 7 +- test/src/test_cospi.cpp | 7 +- test/src/test_cospiI.cpp | 7 +- test/src/test_erf.cpp | 7 +- test/src/test_erfI.cpp | 7 +- test/src/test_erfc.cpp | 7 +- test/src/test_erfcI.cpp | 7 +- test/src/test_exp.cpp | 7 +- test/src/test_exp10.cpp | 7 +- test/src/test_exp10I.cpp | 7 +- test/src/test_exp2.cpp | 7 +- test/src/test_exp2I.cpp | 7 +- test/src/test_expI.cpp | 7 +- test/src/test_expm1.cpp | 7 +- test/src/test_expm1I.cpp | 7 +- test/src/test_infra.cpp | 2 + test/src/test_log.cpp | 7 +- test/src/test_log10.cpp | 7 +- test/src/test_log10I.cpp | 7 +- test/src/test_log1p.cpp | 7 +- test/src/test_log1pI.cpp | 7 +- test/src/test_log2.cpp | 7 +- test/src/test_log2I.cpp | 7 +- test/src/test_logI.cpp | 7 +- test/src/test_pow.cpp | 7 +- test/src/test_powI.cpp | 7 +- test/src/test_sin.cpp | 7 +- test/src/test_sinI.cpp | 7 +- test/src/test_sincos.cpp | 7 +- test/src/test_sincosI.cpp | 7 +- test/src/test_sincospi.cpp | 7 +- test/src/test_sincospiI.cpp | 7 +- test/src/test_sinh.cpp | 7 +- test/src/test_sinhI.cpp | 7 +- test/src/test_sinpi.cpp | 7 +- test/src/test_sinpiI.cpp | 7 +- test/src/test_tan.cpp | 7 +- test/src/test_tanI.cpp | 7 +- test/src/test_tanh.cpp | 7 +- test/src/test_tanhI.cpp | 7 +- test/src/test_tanpi.cpp | 7 +- 76 files changed, 323 insertions(+), 653 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6eb8297..b00509a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -59,7 +59,7 @@ jobs: - name: Create sysroot run: | - sudo debootstrap --arch=riscv64 --verbose --include=fakeroot,symlinks --resolve-deps --variant=minbase --components=main,universe focal sysroot + sudo debootstrap --arch=riscv64 --verbose --include=fakeroot,symlinks,googletest --resolve-deps --variant=minbase --components=main,universe focal sysroot # Remove unused files to minimize cache sudo chroot sysroot symlinks -cr . sudo chown ${USER} -R sysroot @@ -72,6 +72,7 @@ jobs: - name: Build shell: bash -ex -o pipefail {0} run: | + export QEMU_LD_PREFIX=$(pwd)/sysroot cmake -S . -B build -GNinja \ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \ -DCMAKE_TOOLCHAIN_FILE=$(pwd)/CMakeToolchain/riscv.clang.cross.cmake \ @@ -115,11 +116,6 @@ jobs: path: sysroot key: sysroot-${{ hashFiles('./.github/workflows/build_and_test.yml') }} - - name: Install dependencies - run: | - sudo apt-get update -y -qq - sudo apt-get install -y -qq libgmp-dev libmpfr-dev - - name: Download build artifacts uses: actions/download-artifact@v4 with: @@ -133,12 +129,10 @@ jobs: env: CTEST_OUTPUT_ON_FAILURE: "TRUE" run: | - if [[ -n "${{ matrix.qemu_cpu }}" ]]; then - export QEMU_CPU="${{ matrix.qemu_cpu }}" - fi export QEMU_LD_PREFIX=$(pwd)/sysroot + export QEMU_CPU="${{ matrix.qemu_cpu }}" cd build - ctest -j$(nproc) + ctest -j$(nproc) --output-on-failure - name: Upload test-${{ strategy.job-index }} artifacts uses: actions/upload-artifact@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d7c50b..d81b937 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,107 +3,110 @@ # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.22) -project(veclibm C) +project(veclibm C CXX) -# Adds a test target -include(CTest) +option(VECLIBM_BUILD_TESTS "Build tests" ON) + +if (VECLIBM_BUILD_TESTS) + # Adds a test target + include(CTest) + + include(GoogleTest) + + set(GTest_ROOT ${CMAKE_SYSROOT}/usr/src/googletest/googletest) + add_subdirectory(${GTest_ROOT} "${CMAKE_CURRENT_BINARY_DIR}/googletest" EXCLUDE_FROM_ALL) +endif() set(PROJECT_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_acosD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_acosDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_acospiD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_acospiDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_asinD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_asinDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_asinpiD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_asinpiDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atanD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atanDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atanpiD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atanpiDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atan2D.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atan2DI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atan2piD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atan2piDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_acoshD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_acoshDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_asinhD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_asinhDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atanhD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_atanhDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_cbrtD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_cbrtDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_cdfnormD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_cdfnormDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_erfD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_erfDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_erfcD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_erfcDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_expD_tbl.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_expD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_expDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_exp2D.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_exp2DI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_exp10D.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_exp10DI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_expm1D.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_expm1DI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_logD_tbl.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_logD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_logDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_log2D.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_log2DI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_log10D.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_log10DI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_log1pD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_log1pDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_powD_tbl.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_powD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_powDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_2ovpi_tbl.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_cosD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_cosDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_cospiD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_cospiDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sinD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sinDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sinpiD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sinpiDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sincosD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sincosDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sincospiD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sincospiDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_tanD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_tanDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_tanpiD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_tanpiDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_coshD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_coshDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sinhD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_sinhDI.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_tanhD.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/rvvlm_tanhDI.c + src/rvvlm_acosD.c + src/rvvlm_acosDI.c + src/rvvlm_acospiD.c + src/rvvlm_acospiDI.c + src/rvvlm_asinD.c + src/rvvlm_asinDI.c + src/rvvlm_asinpiD.c + src/rvvlm_asinpiDI.c + src/rvvlm_atanD.c + src/rvvlm_atanDI.c + src/rvvlm_atanpiD.c + src/rvvlm_atanpiDI.c + src/rvvlm_atan2D.c + src/rvvlm_atan2DI.c + src/rvvlm_atan2piD.c + src/rvvlm_atan2piDI.c + src/rvvlm_acoshD.c + src/rvvlm_acoshDI.c + src/rvvlm_asinhD.c + src/rvvlm_asinhDI.c + src/rvvlm_atanhD.c + src/rvvlm_atanhDI.c + src/rvvlm_cbrtD.c + src/rvvlm_cbrtDI.c + src/rvvlm_cdfnormD.c + src/rvvlm_cdfnormDI.c + src/rvvlm_erfD.c + src/rvvlm_erfDI.c + src/rvvlm_erfcD.c + src/rvvlm_erfcDI.c + src/rvvlm_expD_tbl.c + src/rvvlm_expD.c + src/rvvlm_expDI.c + src/rvvlm_exp2D.c + src/rvvlm_exp2DI.c + src/rvvlm_exp10D.c + src/rvvlm_exp10DI.c + src/rvvlm_expm1D.c + src/rvvlm_expm1DI.c + src/rvvlm_logD_tbl.c + src/rvvlm_logD.c + src/rvvlm_logDI.c + src/rvvlm_log2D.c + src/rvvlm_log2DI.c + src/rvvlm_log10D.c + src/rvvlm_log10DI.c + src/rvvlm_log1pD.c + src/rvvlm_log1pDI.c + src/rvvlm_powD_tbl.c + src/rvvlm_powD.c + src/rvvlm_powDI.c + src/rvvlm_2ovpi_tbl.c + src/rvvlm_cosD.c + src/rvvlm_cosDI.c + src/rvvlm_cospiD.c + src/rvvlm_cospiDI.c + src/rvvlm_sinD.c + src/rvvlm_sinDI.c + src/rvvlm_sinpiD.c + src/rvvlm_sinpiDI.c + src/rvvlm_sincosD.c + src/rvvlm_sincosDI.c + src/rvvlm_sincospiD.c + src/rvvlm_sincospiDI.c + src/rvvlm_tanD.c + src/rvvlm_tanDI.c + src/rvvlm_tanpiD.c + src/rvvlm_tanpiDI.c + src/rvvlm_coshD.c + src/rvvlm_coshDI.c + src/rvvlm_sinhD.c + src/rvvlm_sinhDI.c + src/rvvlm_tanhD.c + src/rvvlm_tanhDI.c ) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + add_library(vecm ${PROJECT_SOURCES} ) -target_include_directories(vecm - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/include -) - target_compile_options(vecm PUBLIC $<$:-std=c11> ) -set(CMAKE_BUILD_TYPE "Release" - CACHE STRING - "The type of build to perform. Choose from [Release, Debug, RelWithDebInfo]" -) - -# Add tests as well. Split this out into its own file. This means that the tests -# are in a 'test' subdirectory of the current build directory -add_subdirectory(test) +if (VECLIBM_BUILD_TESTS) + # Add tests as well. Split this out into its own file. This means that the tests + # are in a 'test' subdirectory of the current build directory + add_subdirectory(test) +endif() diff --git a/README.md b/README.md index 9c7deb8..a127d9b 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,44 @@ We sometimes provide multiple implementations for a single function as each may A simple test program test_funcs.c uses the existing long double function as a reference. At this point we only aim to develop double-precision (and perhaps single-precision) functions, thus testing their accuracy with long-double function is deemed sufficient. +# building & testing + +It is being built and tested on GitHub Actions. See `.github/workflows/build_and_test.yml` for reference. + +## cross-compiling + +You first need a sysroot with enough dependencies: +``` +sudo debootstrap --arch=riscv64 --verbose --include=fakeroot,symlinks,googletest --resolve-deps --variant=minbase --components=main,universe jammy sysroot +``` + +Then, assuming you've the necessary toolchains installed (refer to the [GHA workflow file](https://github.com/rivosinc/veclibm/blob/main/.github/workflows/build_and_test.yml) for versions and steps), you can run cmake: +``` +cmake -S . -B build -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DCMAKE_TOOLCHAIN_FILE=$(pwd)/CMakeToolchain/riscv.clang.cross.cmake -DCMAKE_SYSROOT=$(pwd)/sysroot +``` + +Finally, you can build with: +``` +cmake --build build +``` + +This will build both the `libvecm.so` library as well as the tests. + +## testing + +_The following steps take the assumption you're cross-compiling and using QEMU to execute the riscv64 binary on your host machine._ + +The easiest is to simply run `test/test_veclibm`: +``` +QEMU_CPU=rv64,zba=true,zbb=true,zbs=true,v=true QEMU_LD_PREFIX=$(pwd)/sysroot build/test/test_veclibm +``` + +To run only a specific test, for example the `erf.test`, you can filter with: +``` +QEMU_CPU=rv64,zba=true,zbb=true,zbs=true,v=true QEMU_LD_PREFIX=$(pwd)/sysroot build/test/test_veclibm --gtest_filter=erf.test +``` + +Refer to the help for more options: +``` +QEMU_CPU=rv64,zba=true,zbb=true,zbs=true,v=true QEMU_LD_PREFIX=$(pwd)/sysroot build/test/test_veclibm --help +``` diff --git a/include/rvvlm_fp.inc.h b/include/rvvlm_fp.inc.h index 311b1d7..d26db29 100644 --- a/include/rvvlm_fp.inc.h +++ b/include/rvvlm_fp.inc.h @@ -2,6 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 +#pragma once + #include #ifndef _GNU_SOURCE @@ -189,31 +191,31 @@ static_assert(false, "API_SIGNATURE ill or undefined" __FILE__); #define VMVU_VX MAKE_FUNC(__riscv_vmv_v_x_u) #define VFMV_VF MAKE_FUNC(__riscv_vfmv_v_f_f) - const INT int_Zero = 0; -const UINT uint_Zero = 0; +static const INT int_Zero = 0; +static const UINT uint_Zero = 0; #if (BIT_WIDTH == 64) #define EXP_BIAS 1023 #define MAN_LEN 52 -const uint64_t class_sNaN = 0x100; -const uint64_t class_qNaN = 0x200; -const uint64_t class_NaN = 0x300; -const uint64_t class_negInf = 0x1; -const uint64_t class_posInf = 0x80; -const uint64_t class_Inf = 0x81; -const uint64_t class_negZero = 0x8; -const uint64_t class_posZero = 0x10; -const uint64_t class_Zero = 0x18; -const uint64_t class_negDenorm = 0x4; -const uint64_t class_posDenorm = 0x20; -const uint64_t class_Denorm = 0x24; -const uint64_t class_negNormal = 0x2; -const uint64_t class_posNormal = 0x40; -const uint64_t class_Normal = 0x42; -const uint64_t class_negative = 0x7; -const uint64_t class_positive = 0xe0; -const uint64_t class_finite_neg = 0x06; -const uint64_t class_finite_pos = 0x60; +static const uint64_t class_sNaN = 0x100; +static const uint64_t class_qNaN = 0x200; +static const uint64_t class_NaN = 0x300; +static const uint64_t class_negInf = 0x1; +static const uint64_t class_posInf = 0x80; +static const uint64_t class_Inf = 0x81; +static const uint64_t class_negZero = 0x8; +static const uint64_t class_posZero = 0x10; +static const uint64_t class_Zero = 0x18; +static const uint64_t class_negDenorm = 0x4; +static const uint64_t class_posDenorm = 0x20; +static const uint64_t class_Denorm = 0x24; +static const uint64_t class_negNormal = 0x2; +static const uint64_t class_posNormal = 0x40; +static const uint64_t class_Normal = 0x42; +static const uint64_t class_negative = 0x7; +static const uint64_t class_positive = 0xe0; +static const uint64_t class_finite_neg = 0x06; +static const uint64_t class_finite_pos = 0x60; static const double fp_sNaN = __builtin_nans(""); static const double fp_qNaN = __builtin_nan(""); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4b5b40c..42c801e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,129 +2,95 @@ # # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.22) -project(veclibm_test C CXX) - -set(TEST_INFRA_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/test_infra.cpp -) -set(TEST_INCLUDES - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${CMAKE_CURRENT_SOURCE_DIR}/../include +# Loop through the source test files, and add these to the 'test' target +set(TEST_SOURCES + src/test_infra.cpp +# src/test_acos.cpp +# src/test_acosI.cpp +# src/test_acospi.cpp +# src/test_acospiI.cpp +# src/test_asin.cpp +# src/test_asinI.cpp +# src/test_asinpi.cpp +# src/test_asinpiI.cpp +# src/test_atan.cpp +# src/test_atanI.cpp +# src/test_atanpi.cpp +# src/test_atanpiI.cpp +# src/test_atan2.cpp +# src/test_atan2I.cpp +# src/test_atan2pi.cpp +# src/test_atan2piI.cpp +# src/test_acosh.cpp +# src/test_acoshI.cpp +# src/test_asinh.cpp +# src/test_asinhI.cpp +# src/test_atanh.cpp +# src/test_atanhI.cpp +# src/test_cbrt.cpp +# src/test_cbrtI.cpp +# src/test_cdfnorm.cpp +# src/test_cdfnormI.cpp + src/test_erf.cpp + src/test_erfI.cpp +# src/test_erfc.cpp +# src/test_erfcI.cpp +# src/test_exp.cpp +# src/test_expI.cpp +# src/test_exp2.cpp +# src/test_exp2I.cpp +# src/test_exp10.cpp +# src/test_exp10I.cpp +# src/test_expm1.cpp +# src/test_expm1I.cpp +# src/test_log.cpp +# src/test_logI.cpp +# src/test_log2.cpp +# src/test_log2I.cpp +# src/test_log10.cpp +# src/test_log10I.cpp +# src/test_log1p.cpp +# src/test_log1pI.cpp +# src/test_pow.cpp +# src/test_powI.cpp +# src/test_cos.cpp +# src/test_cosI.cpp +# src/test_sin.cpp +# src/test_sinI.cpp +# src/test_cospi.cpp +# src/test_cospiI.cpp +# src/test_sinpi.cpp +# src/test_sinpiI.cpp +# src/test_sincos.cpp +# src/test_sincosI.cpp +# src/test_sincospi.cpp +# src/test_sincospiI.cpp +# src/test_tan.cpp +# src/test_tanI.cpp +# src/test_tanpi.cpp +# src/test_cosh.cpp +# src/test_coshI.cpp +# src/test_sinh.cpp +# src/test_sinhI.cpp +# src/test_tanh.cpp +# src/test_tanhI.cpp ) -# Build a library with the common test code in, to be used in every test -add_library(test_infra - EXCLUDE_FROM_ALL - ${TEST_INFRA_SOURCES} +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + +add_executable(test_veclibm ${TEST_SOURCES}) + +target_link_libraries( + test_veclibm + vecm + GTest::gtest_main ) -target_include_directories(test_infra + +target_compile_options( + test_veclibm PRIVATE - ${TEST_INCLUDES} -) -target_compile_options(test_infra - PUBLIC $<$:-std=c11> $<$:-std=c++17> ) -# Adds a function, such that given the name of a test file will compile an -# executable, and add that to a target called 'test', which runs ctest on all -# defined test executables. -function(add_veclibm_test TEST_FILE) - cmake_path(GET TEST_FILE STEM LAST_ONLY TEST_NAME) - add_executable(${TEST_NAME} - ${TEST_FILE} - ) - target_include_directories(${TEST_NAME} PRIVATE ${TEST_INCLUDES}) - target_link_libraries(${TEST_NAME} - $>,-static,> - test_infra vecm - ) - target_compile_options(${TEST_NAME} - PRIVATE - $<$:-std=c11> - $<$:-std=c++17> - ) - add_test( - NAME ${TEST_NAME} - COMMAND ${VECLIBM_TEST_RUNNER} ${TEST_NAME} - ) -endfunction() - -# Loop through the source test files, and add these to the 'test' target -set(TEST_SOURCES -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_acos.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_acosI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_acospi.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_acospiI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_asin.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_asinI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_asinpi.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_asinpiI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atan.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atanI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atanpi.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atanpiI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atan2.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atan2I.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atan2pi.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atan2piI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_acosh.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_acoshI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_asinh.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_asinhI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atanh.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_atanhI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_cbrt.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_cbrtI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_cdfnorm.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_cdfnormI.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/test_erf.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/test_erfI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_erfc.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_erfcI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_exp.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_expI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_exp2.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_exp2I.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_exp10.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_exp10I.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_expm1.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_expm1I.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_log.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_logI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_log2.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_log2I.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_log10.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_log10I.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_log1p.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_log1pI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_pow.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_powI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_cos.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_cosI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sin.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sinI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_cospi.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_cospiI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sinpi.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sinpiI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sincos.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sincosI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sincospi.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sincospiI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_tan.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_tanI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_tanpi.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_cosh.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_coshI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sinh.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_sinhI.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_tanh.cpp -# ${CMAKE_CURRENT_SOURCE_DIR}/src/test_tanhI.cpp -) - -foreach(TEST_FILE IN LISTS TEST_SOURCES) - add_veclibm_test(${TEST_FILE}) -endforeach() +gtest_discover_tests(test_veclibm) diff --git a/test/include/test_infra.h b/test/include/test_infra.h index f2df359..b240686 100644 --- a/test/include/test_infra.h +++ b/test/include/test_infra.h @@ -2,6 +2,13 @@ // // SPDX-License-Identifier: Apache-2.0 +#pragma once + +#include + +#define COMMENT(comment) \ + { printf("\n=====\t" comment "\n"); } + void report_err_fp64(void (*test_func)(size_t, const double *, double *), long double (*ref_func)(long double), double, double, int); diff --git a/test/src/test_acos.cpp b/test/src/test_acos.cpp index 4375505..a93effa 100644 --- a/test/src/test_acos.cpp +++ b/test/src/test_acos.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(acos, test) { unsigned long nb_tests; double x_start, x_end; @@ -39,6 +36,4 @@ int main() { x_end = -0.5; nb_tests = 4000000; report_err_fp64(rvvlm_acos, acosl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_acosI.cpp b/test/src/test_acosI.cpp index eea8b84..d70cc89 100644 --- a/test/src/test_acosI.cpp +++ b/test/src/test_acosI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(acosI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_acosI, acosl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_acosh.cpp b/test/src/test_acosh.cpp index c6a973a..37a5a02 100644 --- a/test/src/test_acosh.cpp +++ b/test/src/test_acosh.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(acosh, test) { unsigned long nb_tests; double x_start, x_end; @@ -38,6 +35,4 @@ int main() { x_end = 0x1.FFFFFFFFFFp1023; nb_tests = 400000; report_err_fp64(rvvlm_acosh, acoshl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_acoshI.cpp b/test/src/test_acoshI.cpp index 755e405..576ee67 100644 --- a/test/src/test_acoshI.cpp +++ b/test/src/test_acoshI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(acoshI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_acoshI, acoshl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_acospi.cpp b/test/src/test_acospi.cpp index 73c7e40..045305c 100644 --- a/test/src/test_acospi.cpp +++ b/test/src/test_acospi.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(acospi, test) { unsigned long nb_tests; double x_start, x_end; @@ -38,6 +35,4 @@ int main() { x_end = -0.5; nb_tests = 4000000; report_err_fp64(rvvlm_acospi, acospil, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_acospiI.cpp b/test/src/test_acospiI.cpp index 88f12c7..83f6821 100644 --- a/test/src/test_acospiI.cpp +++ b/test/src/test_acospiI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(acospiI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_acospiI, acospil, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_asin.cpp b/test/src/test_asin.cpp index 3b19ca6..4089482 100644 --- a/test/src/test_asin.cpp +++ b/test/src/test_asin.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(asin, test) { unsigned long nb_tests; double x_start, x_end; @@ -39,6 +36,4 @@ int main() { x_end = 1.0; nb_tests = 4000000; report_err_fp64(rvvlm_asin, asinl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_asinI.cpp b/test/src/test_asinI.cpp index 44c40c8..7071203 100644 --- a/test/src/test_asinI.cpp +++ b/test/src/test_asinI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(asinI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_asinI, asinl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_asinh.cpp b/test/src/test_asinh.cpp index 53b8c62..3a86b1c 100644 --- a/test/src/test_asinh.cpp +++ b/test/src/test_asinh.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(asinh, test) { unsigned long nb_tests; double x_start, x_end; @@ -58,6 +55,4 @@ int main() { x_end = 0x1.FFFFFFFFFFp1023; nb_tests = 40000; report_err_fp64(rvvlm_asinh, asinhl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_asinhI.cpp b/test/src/test_asinhI.cpp index fd8b2e2..40a10cb 100644 --- a/test/src/test_asinhI.cpp +++ b/test/src/test_asinhI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(asinhI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_asinhI, asinhl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_asinpi.cpp b/test/src/test_asinpi.cpp index 2b2ffb6..918f072 100644 --- a/test/src/test_asinpi.cpp +++ b/test/src/test_asinpi.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(asinpI, test) { unsigned long nb_tests; double x_start, x_end; @@ -38,6 +35,4 @@ int main() { x_end = 1.0; nb_tests = 4000000; report_err_fp64(rvvlm_asinpi, asinpil, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_asinpiI.cpp b/test/src/test_asinpiI.cpp index 55d1d69..d72e904 100644 --- a/test/src/test_asinpiI.cpp +++ b/test/src/test_asinpiI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(asinpiI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_asinpiI, asinpil, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_atan.cpp b/test/src/test_atan.cpp index 0302ee5..2dfc5ad 100644 --- a/test/src/test_atan.cpp +++ b/test/src/test_atan.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atan, test) { unsigned long nb_tests; double x_start, x_end; @@ -39,6 +36,4 @@ int main() { x_end = 10.0; nb_tests = 4000000; report_err_fp64(rvvlm_atan, atanl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_atan2.cpp b/test/src/test_atan2.cpp index ae3f763..21332af 100644 --- a/test/src/test_atan2.cpp +++ b/test/src/test_atan2.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atan2, test) { unsigned long nb_x, nb_y; double x_start, x_end, y_start, y_end; int swap_xy = 1; @@ -140,6 +137,4 @@ int main() { nb_y = 1000000; report_err2_fp64(rvvlm_atan2, atan2l, x_start, x_end, nb_x, y_start, y_end, nb_y, swap_xy); - - return 0; } diff --git a/test/src/test_atan2I.cpp b/test/src/test_atan2I.cpp index 2fd2287..1718183 100644 --- a/test/src/test_atan2I.cpp +++ b/test/src/test_atan2I.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atan2I, test) { unsigned long nb_x, nb_y; double x_start, x_end, y_start, y_end; int swap_xy = 1; @@ -31,6 +28,4 @@ int main() { report_err2_fp64(rvvlm_atan2I, atan2l, x_start, x_end, nb_x, y_start, y_end, nb_y, stride_x, stride_y, stride_z, swap_xy); - - return 0; } diff --git a/test/src/test_atan2pi.cpp b/test/src/test_atan2pi.cpp index c6ece1d..0af60a1 100644 --- a/test/src/test_atan2pi.cpp +++ b/test/src/test_atan2pi.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atan2pi, test) { unsigned long nb_x, nb_y; double x_start, x_end, y_start, y_end; int swap_xy = 1; @@ -128,6 +125,4 @@ int main() { nb_y = 1000000; report_err2_fp64(rvvlm_atan2pi, atan2pil, x_start, x_end, nb_x, y_start, y_end, nb_y, swap_xy); - - return 0; } diff --git a/test/src/test_atan2piI.cpp b/test/src/test_atan2piI.cpp index 2bd61a5..b1a5ddd 100644 --- a/test/src/test_atan2piI.cpp +++ b/test/src/test_atan2piI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atan2piI, test) { unsigned long nb_x, nb_y; double x_start, x_end, y_start, y_end; int swap_xy = 1; @@ -31,6 +28,4 @@ int main() { report_err2_fp64(rvvlm_atan2piI, atan2pil, x_start, x_end, nb_x, y_start, y_end, nb_y, stride_x, stride_y, stride_z, swap_xy); - - return 0; } diff --git a/test/src/test_atanI.cpp b/test/src/test_atanI.cpp index 4503dbc..4e40863 100644 --- a/test/src/test_atanI.cpp +++ b/test/src/test_atanI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atanI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_atanI, atanl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_atanh.cpp b/test/src/test_atanh.cpp index fbff32e..bdc0843 100644 --- a/test/src/test_atanh.cpp +++ b/test/src/test_atanh.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atanh, test) { unsigned long nb_tests; double x_start, x_end; @@ -58,6 +55,4 @@ int main() { x_end = 1.0 - 0x1.0p-51; nb_tests = 400000; report_err_fp64(rvvlm_atanh, atanhl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_atanhI.cpp b/test/src/test_atanhI.cpp index 8118dc5..4ba33d1 100644 --- a/test/src/test_atanhI.cpp +++ b/test/src/test_atanhI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atanhI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_atanhI, atanhl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_atanpi.cpp b/test/src/test_atanpi.cpp index 6825d0d..5e0be0f 100644 --- a/test/src/test_atanpi.cpp +++ b/test/src/test_atanpi.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atanpi, test) { unsigned long nb_tests; double x_start, x_end; @@ -39,6 +36,4 @@ int main() { x_end = 10.0; nb_tests = 4000000; report_err_fp64(rvvlm_atanpi, atanpil, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_atanpiI.cpp b/test/src/test_atanpiI.cpp index 9dfdadc..15e62bf 100644 --- a/test/src/test_atanpiI.cpp +++ b/test/src/test_atanpiI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(atanpiI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_atanpiI, atanpil, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_cbrt.cpp b/test/src/test_cbrt.cpp index c18f1ba..9e6a1e8 100644 --- a/test/src/test_cbrt.cpp +++ b/test/src/test_cbrt.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(cbrt, test) { unsigned long nb_tests; double x_start, x_end; @@ -58,6 +55,4 @@ int main() { x_end = -0x1.fffffp1023; nb_tests = 4000000; report_err_fp64(rvvlm_cbrt, cbrtl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_cbrtI.cpp b/test/src/test_cbrtI.cpp index 296196f..6f03f10 100644 --- a/test/src/test_cbrtI.cpp +++ b/test/src/test_cbrtI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(cbrtI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_cbrtI, cbrtl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_cdfnorm.cpp b/test/src/test_cdfnorm.cpp index a25b1a5..7c1ebb6 100644 --- a/test/src/test_cdfnorm.cpp +++ b/test/src/test_cdfnorm.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(cdfnorm, test) { unsigned long nb_tests; double x_start, x_end; @@ -53,6 +50,4 @@ int main() { nb_tests = 400000; report_err_fp64(rvvlm_cdfnorm, cdfnorml, x_start, x_end, nb_tests); report_err_fp64(rvvlm_cdfnorm, cdfnorml, -x_start, -x_end, nb_tests); - - return 0; } diff --git a/test/src/test_cdfnormI.cpp b/test/src/test_cdfnormI.cpp index 8eafaa5..5b68b2d 100644 --- a/test/src/test_cdfnormI.cpp +++ b/test/src/test_cdfnormI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(cdfnormI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_cdfnormI, cdfnorml, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_cos.cpp b/test/src/test_cos.cpp index d05539b..4298763 100644 --- a/test/src/test_cos.cpp +++ b/test/src/test_cos.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(cos, test) { unsigned long nb_tests; double x_start, x_end; @@ -38,6 +35,4 @@ int main() { x_end = 0x1.0p100; nb_tests = 4000000; report_err_fp64(rvvlm_cos, cosl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_cosI.cpp b/test/src/test_cosI.cpp index 3babaee..d21bfb3 100644 --- a/test/src/test_cosI.cpp +++ b/test/src/test_cosI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(cosI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_cosI, cosl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_cosh.cpp b/test/src/test_cosh.cpp index ac8dc58..210f8f3 100644 --- a/test/src/test_cosh.cpp +++ b/test/src/test_cosh.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(cosh, test) { unsigned long nb_tests; double x_start, x_end; @@ -38,6 +35,4 @@ int main() { x_end = 0x1.0p3; nb_tests = 4000000; report_err_fp64(rvvlm_cosh, coshl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_coshI.cpp b/test/src/test_coshI.cpp index ba03a27..6847d54 100644 --- a/test/src/test_coshI.cpp +++ b/test/src/test_coshI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(coshI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_coshI, coshl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_cospi.cpp b/test/src/test_cospi.cpp index 4008530..7601426 100644 --- a/test/src/test_cospi.cpp +++ b/test/src/test_cospi.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(cospi, test) { unsigned long nb_tests; double x_start, x_end; @@ -33,6 +30,4 @@ int main() { x_end = 0x1.0p60; nb_tests = 4000000; report_err_fp64(rvvlm_cospi, cospil, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_cospiI.cpp b/test/src/test_cospiI.cpp index b963780..8146e20 100644 --- a/test/src/test_cospiI.cpp +++ b/test/src/test_cospiI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(cospiI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_cospiI, cospil, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_erf.cpp b/test/src/test_erf.cpp index bd82b7c..c4a3379 100644 --- a/test/src/test_erf.cpp +++ b/test/src/test_erf.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(erf, test) { unsigned long nb_tests; double x_start, x_end; @@ -43,6 +40,4 @@ int main() { x_end = 6.5; nb_tests = 40000; report_err_fp64(rvvlm_erf, erfl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_erfI.cpp b/test/src/test_erfI.cpp index 19296c4..a3d316d 100644 --- a/test/src/test_erfI.cpp +++ b/test/src/test_erfI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(erfI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_erfI, erfl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_erfc.cpp b/test/src/test_erfc.cpp index 6e3baf5..7d76497 100644 --- a/test/src/test_erfc.cpp +++ b/test/src/test_erfc.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(erfc, test) { unsigned long nb_tests; double x_start, x_end; @@ -53,6 +50,4 @@ int main() { nb_tests = 400000; report_err_fp64(rvvlm_erfc, erfcl, x_start, x_end, nb_tests); report_err_fp64(rvvlm_erfc, erfcl, -x_start, -x_end, nb_tests); - - return 0; } diff --git a/test/src/test_erfcI.cpp b/test/src/test_erfcI.cpp index 3fb6d8d..93ad92e 100644 --- a/test/src/test_erfcI.cpp +++ b/test/src/test_erfcI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(erfcI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_erfcI, erfcl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_exp.cpp b/test/src/test_exp.cpp index 19a2513..998f53e 100644 --- a/test/src/test_exp.cpp +++ b/test/src/test_exp.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(exp, test) { unsigned long nb_tests; double x_start, x_end; @@ -43,6 +40,4 @@ int main() { x_end = -709.0; nb_tests = 400000; report_err_fp64(rvvlm_exp, expl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_exp10.cpp b/test/src/test_exp10.cpp index b10de25..b7acf24 100644 --- a/test/src/test_exp10.cpp +++ b/test/src/test_exp10.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(exp10, test) { unsigned long nb_tests; double x_start, x_end; @@ -43,6 +40,4 @@ int main() { x_end = -300.0; nb_tests = 400000; report_err_fp64(rvvlm_exp10, exp10l, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_exp10I.cpp b/test/src/test_exp10I.cpp index 951ad5c..419ac4e 100644 --- a/test/src/test_exp10I.cpp +++ b/test/src/test_exp10I.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(exp10I, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_exp10I, exp10l, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_exp2.cpp b/test/src/test_exp2.cpp index 283d53f..9027656 100644 --- a/test/src/test_exp2.cpp +++ b/test/src/test_exp2.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(exp2, test) { unsigned long nb_tests; double x_start, x_end; @@ -43,6 +40,4 @@ int main() { x_end = -1020.0; nb_tests = 400000; report_err_fp64(rvvlm_exp2, exp2l, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_exp2I.cpp b/test/src/test_exp2I.cpp index af28ce2..126085e 100644 --- a/test/src/test_exp2I.cpp +++ b/test/src/test_exp2I.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(exp2I, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_exp2I, exp2l, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_expI.cpp b/test/src/test_expI.cpp index 76e4e9c..9ed3c05 100644 --- a/test/src/test_expI.cpp +++ b/test/src/test_expI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(expI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_expI, expl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_expm1.cpp b/test/src/test_expm1.cpp index ae49c84..cbb20b5 100644 --- a/test/src/test_expm1.cpp +++ b/test/src/test_expm1.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(expm1, test) { unsigned long nb_tests; double x_start, x_end; @@ -58,6 +55,4 @@ int main() { x_end = -40.0; nb_tests = 400000; report_err_fp64(rvvlm_expm1, expm1l, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_expm1I.cpp b/test/src/test_expm1I.cpp index 9e9d4ea..d9fc274 100644 --- a/test/src/test_expm1I.cpp +++ b/test/src/test_expm1I.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(expm1I, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_expm1I, expm1l, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_infra.cpp b/test/src/test_infra.cpp index 6156928..464a10e 100644 --- a/test/src/test_infra.cpp +++ b/test/src/test_infra.cpp @@ -7,6 +7,8 @@ #include #include +#include "test_infra.h" + union sui32_fp32 { int32_t si; uint32_t ui; diff --git a/test/src/test_log.cpp b/test/src/test_log.cpp index c2cfef7..18dcc46 100644 --- a/test/src/test_log.cpp +++ b/test/src/test_log.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(log, test) { unsigned long nb_tests; double x_start, x_end; @@ -43,6 +40,4 @@ int main() { x_end = 0x1.0p-1022; nb_tests = 400000; report_err_fp64(rvvlm_log, logl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_log10.cpp b/test/src/test_log10.cpp index 1f831d8..82230e6 100644 --- a/test/src/test_log10.cpp +++ b/test/src/test_log10.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(log10, test) { unsigned long nb_tests; double x_start, x_end; @@ -43,6 +40,4 @@ int main() { x_end = 0x1.0p-1022; nb_tests = 400000; report_err_fp64(rvvlm_log10, log10l, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_log10I.cpp b/test/src/test_log10I.cpp index 66addc4..bc27a81 100644 --- a/test/src/test_log10I.cpp +++ b/test/src/test_log10I.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(log10I, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_log10I, log10l, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_log1p.cpp b/test/src/test_log1p.cpp index 76bcd16..4c1f05f 100644 --- a/test/src/test_log1p.cpp +++ b/test/src/test_log1p.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(log1p, test) { unsigned long nb_tests; double x_start, x_end; @@ -38,6 +35,4 @@ int main() { x_end = 0x1.0p-1022; nb_tests = 4000; report_err_fp64(rvvlm_log1p, log1pl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_log1pI.cpp b/test/src/test_log1pI.cpp index c5f79b4..15fd9cd 100644 --- a/test/src/test_log1pI.cpp +++ b/test/src/test_log1pI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(log1pI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_log1pI, log1pl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_log2.cpp b/test/src/test_log2.cpp index 794456e..c1c4bbc 100644 --- a/test/src/test_log2.cpp +++ b/test/src/test_log2.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(log2p, test) { unsigned long nb_tests; double x_start, x_end; @@ -43,6 +40,4 @@ int main() { x_end = 0x1.0p-1022; nb_tests = 400000; report_err_fp64(rvvlm_log2, log2l, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_log2I.cpp b/test/src/test_log2I.cpp index 007b180..721af91 100644 --- a/test/src/test_log2I.cpp +++ b/test/src/test_log2I.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(log2I, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_log2I, log2l, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_logI.cpp b/test/src/test_logI.cpp index 876647b..2ecd823 100644 --- a/test/src/test_logI.cpp +++ b/test/src/test_logI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(logI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_logI, logl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_pow.cpp b/test/src/test_pow.cpp index 21b5052..63f2390 100644 --- a/test/src/test_pow.cpp +++ b/test/src/test_pow.cpp @@ -9,10 +9,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(pow, test) { unsigned long nb_tests, nb_pts_x, nb_pts_y; double x_start, x_end, y_start, y_end; double target_start, target_end, delta, target; @@ -88,6 +85,4 @@ int main() { target = target_start + (double)j * delta; report_err_pow_fp64(rvvlm_pow, powl, target, x_start, x_end, nb_tests); } - - return 0; } diff --git a/test/src/test_powI.cpp b/test/src/test_powI.cpp index b29990b..34dff56 100644 --- a/test/src/test_powI.cpp +++ b/test/src/test_powI.cpp @@ -9,10 +9,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(powI, test) { unsigned long nb_pts_x, nb_pts_y, stride_x, stride_y, stride_z; double x_start, x_end, y_start, y_end; bool swap_xy; @@ -31,6 +28,4 @@ int main() { swap_xy = 0; report_err2_fp64(rvvlm_powI, powl, x_start, x_end, nb_pts_x, stride_x, y_start, y_end, nb_pts_y, stride_y, stride_z, swap_xy); - - return 0; } diff --git a/test/src/test_sin.cpp b/test/src/test_sin.cpp index 9569d5e..3c8f127 100644 --- a/test/src/test_sin.cpp +++ b/test/src/test_sin.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sin, test) { unsigned long nb_tests; double x_start, x_end; @@ -38,6 +35,4 @@ int main() { x_end = 0x1.0p100; nb_tests = 4000000; report_err_fp64(rvvlm_sin, sinl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_sinI.cpp b/test/src/test_sinI.cpp index c30add7..b50cd0a 100644 --- a/test/src/test_sinI.cpp +++ b/test/src/test_sinI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sinI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_sinI, sinl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_sincos.cpp b/test/src/test_sincos.cpp index 1000589..36d0737 100644 --- a/test/src/test_sincos.cpp +++ b/test/src/test_sincos.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sincos, test) { unsigned long nb_tests; double x_start, x_end; @@ -42,6 +39,4 @@ int main() { nb_tests = 400000; report_err_fp64(rvvlm_sincos, sinl, 1, x_start, x_end, nb_tests); report_err_fp64(rvvlm_sincos, cosl, 2, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_sincosI.cpp b/test/src/test_sincosI.cpp index c2db6b1..ab88630 100644 --- a/test/src/test_sincosI.cpp +++ b/test/src/test_sincosI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sincosI, test) { unsigned long nb_tests; double x_start, x_end; @@ -29,6 +26,4 @@ int main() { report_err_fp64(rvvlm_sincosI, cosl, 2, x_start, x_end, nb_tests, stride_x, stride_y, stride_z); - - return 0; } diff --git a/test/src/test_sincospi.cpp b/test/src/test_sincospi.cpp index 824c1b8..4d18bbb 100644 --- a/test/src/test_sincospi.cpp +++ b/test/src/test_sincospi.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sincospi, test) { unsigned long nb_tests; double x_start, x_end; @@ -37,6 +34,4 @@ int main() { nb_tests = 400000; report_err_fp64(rvvlm_sincospi, sinpil, 1, x_start, x_end, nb_tests); report_err_fp64(rvvlm_sincospi, cospil, 2, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_sincospiI.cpp b/test/src/test_sincospiI.cpp index 0c08ab2..45a211b 100644 --- a/test/src/test_sincospiI.cpp +++ b/test/src/test_sincospiI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sincospiI, test) { unsigned long nb_tests; double x_start, x_end; @@ -29,6 +26,4 @@ int main() { report_err_fp64(rvvlm_sincospiI, cospil, 2, x_start, x_end, nb_tests, stride_x, stride_y, stride_z); - - return 0; } diff --git a/test/src/test_sinh.cpp b/test/src/test_sinh.cpp index 75865f5..daa8dae 100644 --- a/test/src/test_sinh.cpp +++ b/test/src/test_sinh.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sinh, test) { unsigned long nb_tests; double x_start, x_end; @@ -38,6 +35,4 @@ int main() { x_end = 0x1.0p3; nb_tests = 4000000; report_err_fp64(rvvlm_sinh, sinhl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_sinhI.cpp b/test/src/test_sinhI.cpp index 6484305..bfb6c27 100644 --- a/test/src/test_sinhI.cpp +++ b/test/src/test_sinhI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sinhI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_sinhI, sinhl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_sinpi.cpp b/test/src/test_sinpi.cpp index 7d99f70..3fb5e92 100644 --- a/test/src/test_sinpi.cpp +++ b/test/src/test_sinpi.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sinpi, test) { unsigned long nb_tests; double x_start, x_end; @@ -33,6 +30,4 @@ int main() { x_end = 0x1.0p60; nb_tests = 4000000; report_err_fp64(rvvlm_sinpi, sinpil, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_sinpiI.cpp b/test/src/test_sinpiI.cpp index 11b9e3e..64a4e5d 100644 --- a/test/src/test_sinpiI.cpp +++ b/test/src/test_sinpiI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(sinpiI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_sinpiI, sinpil, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_tan.cpp b/test/src/test_tan.cpp index 836e1a0..1758c3c 100644 --- a/test/src/test_tan.cpp +++ b/test/src/test_tan.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(tan, test) { unsigned long nb_tests; double x_start, x_end; @@ -38,6 +35,4 @@ int main() { x_end = 0x1.0p100; nb_tests = 4000000; report_err_fp64(rvvlm_tan, tanl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_tanI.cpp b/test/src/test_tanI.cpp index dddc17f..1003538 100644 --- a/test/src/test_tanI.cpp +++ b/test/src/test_tanI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(tanI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_tanI, tanl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_tanh.cpp b/test/src/test_tanh.cpp index c774113..c3f4538 100644 --- a/test/src/test_tanh.cpp +++ b/test/src/test_tanh.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(tanh, test) { unsigned long nb_tests; double x_start, x_end; @@ -33,6 +30,4 @@ int main() { x_end = 0x1.0p3; nb_tests = 4000000; report_err_fp64(rvvlm_tanh, tanhl, x_start, x_end, nb_tests); - - return 0; } diff --git a/test/src/test_tanhI.cpp b/test/src/test_tanhI.cpp index 87e3cbd..d3a434e 100644 --- a/test/src/test_tanhI.cpp +++ b/test/src/test_tanhI.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(tanhI, test) { unsigned long nb_tests; double x_start, x_end; @@ -24,6 +21,4 @@ int main() { int stride_y = 39; report_err_fp64(rvvlm_tanhI, tanhl, x_start, x_end, nb_tests, stride_x, stride_y); - - return 0; } diff --git a/test/src/test_tanpi.cpp b/test/src/test_tanpi.cpp index 08660b0..8ffa751 100644 --- a/test/src/test_tanpi.cpp +++ b/test/src/test_tanpi.cpp @@ -8,10 +8,7 @@ #include "rvvlm.h" #include "test_infra.h" -#define COMMENT(comment) \ - { printf("\n=====\t" comment "\n"); } - -int main() { +TEST(tanpi, test) { unsigned long nb_tests; double x_start, x_end; @@ -33,6 +30,4 @@ int main() { x_end = 0x1.0p60; nb_tests = 4000000; report_err_fp64(rvvlm_tanpi, tanpil, x_start, x_end, nb_tests); - - return 0; }