Convert src/tools/testint128.c into a test module.

This creates a new test module src/test/modules/test_int128 and moves
src/tools/testint128.c into it so that it can be built using the
normal build system, allowing the 128-bit integer arithmetic functions
in src/include/common/int128.h to be tested automatically. For now,
the tests are skipped on platforms that don't have native int128
support.

While at it, fix the test128 union in the test code: the "hl" member
of test128 was incorrectly defined to be a union instead of a struct,
which meant that the tests were only ever setting and checking half of
each 128-bit integer value.

Author: Dean Rasheed <dean.a.rash...@gmail.com>
Reviewed-by: John Naylor <johncnaylo...@gmail.com>
Discussion: 
https://postgr.es/m/caezatcwgbmc9zwkmyqqpaqz2x6gaamyrb+rnmsuncdmcl2m...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8c7445a008109100f9784ea2d8e02cb6769dfb09

Modified Files
--------------
src/include/common/int128.h                        |  2 +-
src/test/modules/Makefile                          |  1 +
src/test/modules/meson.build                       |  1 +
src/test/modules/test_int128/.gitignore            |  2 +
src/test/modules/test_int128/Makefile              | 23 +++++++++
src/test/modules/test_int128/meson.build           | 33 +++++++++++++
src/test/modules/test_int128/t/001_test_int128.pl  | 27 +++++++++++
.../modules/test_int128/test_int128.c}             | 54 +++++++++++++++-------
8 files changed, 125 insertions(+), 18 deletions(-)

Reply via email to