AOCL-LibM includes comprehensive test suites that validate the correctness and accuracy of the mathematical functions. The test suite covers: - Unit tests for all scalar functions - Vector function validation tests - Accuracy tests comparing against reference implementations - Corner case and special value testing - Performance and conformance tests
To run the test suite:
Using CMake:
For detailed instructions, refer to aocl-libm-ose/docs/CMakeBuildSystem.md.
To build all the APIs for testing:
$ cmake --build --preset dev-release-gcc --target gtests
To build and test a single API, use the specific target name:
$ cmake --build --preset dev-release-gcc --target test_<function>
Using SCons:
For detailed instructions, refer to aocl-libm-ose/BUILDING.txt.
$ cd aocl-libm-ose
$ scons <other options> gtests
Run the test executable for the required function:
$ ./build/aocl-release/gtests/<function>/test_<function> [test parameters]
Example:
$ ./build/aocl-release/gtests/exp/test_exp
Test Parameters:
Input type:
-i(ffor single precision,dfor double precision)Vector input count:
-e(1for scalar variants; for vector variants:4/8/16for single precision,2/4/8for double precision;32for vector array variants)Test Type:
-t(perffor performance,conffor conformance,accufor accuracy,inplacefor inplace)Input count:
-c(Integer value for number of inputs)Input range:
-r(provide range: start,stop,step size. Example:-r -50,50,SIMPLE)Number type:
-z(cfor complex variant function, default is real variant function)
Note
-t inplaceis used for in-place buffer testing (where the same buffer is used for both input and output arrays). This option is applicable only for accuracy and memory testing of vector array (vrda, vrsa) variants.