Commit 328d4d08 authored by Jason Ekstrand's avatar Jason Ekstrand

util: Add tests for fast integer division by constants

While I generally trust rediculousfish to have done his homework, we've
made some adjustments to suit the needs of mesa and it'd be good to
test those.  Also, there's no better place than unit tests to clearly
document the different edge cases of the different methods.
Reviewed-by: 's avatarMarek Olšák <marek.olsak@amd.com>
parent a9be8ddd
......@@ -3195,6 +3195,7 @@ AC_CONFIG_FILES([Makefile
src/mesa/main/tests/Makefile
src/mesa/state_tracker/tests/Makefile
src/util/Makefile
src/util/tests/fast_idiv_by_const/Makefile
src/util/tests/hash_table/Makefile
src/util/tests/set/Makefile
src/util/tests/string_buffer/Makefile
......
......@@ -170,6 +170,7 @@ if with_tests
)
)
subdir('tests/fast_idiv_by_const')
subdir('tests/hash_table')
subdir('tests/string_buffer')
subdir('tests/vma')
......
# Copyright © 2018 Intel
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
AM_CPPFLAGS = \
-I$(top_srcdir)/src \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gallium/include \
-I$(top_srcdir)/src/gtest/include \
$(PTHREAD_CFLAGS) \
$(DEFINES)
TESTS = fast_idiv_by_const_test
check_PROGRAMS = $(TESTS)
fast_idiv_by_const_test_SOURCES = \
fast_idiv_by_const_test.cpp
fast_idiv_by_const_test_LDADD = \
$(top_builddir)/src/gtest/libgtest.la \
$(top_builddir)/src/util/libmesautil.la \
$(PTHREAD_LIBS) \
$(DLOPEN_LIBS)
EXTRA_DIST = meson.build
This diff is collapsed.
# Copyright © 2018 Intel Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
test(
'fast_idiv_by_const',
executable(
'fast_idiv_by_const_test',
'fast_idiv_by_const_test.cpp',
dependencies : [dep_thread, dep_dl, idep_gtest],
include_directories : inc_common,
link_with : [libmesa_util],
)
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment