Debian Codegraph @

llvm-project/utils/bazel/llvm-project-overlay/libc/test/src/math/libc_math_test_rules.bzl

raw
1 # This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5 """LLVM libc starlark rules for math tests.
6
7 This rule delegates testing to libc_test_rules.bzl:libc_test.
8 It adds common math dependencies.
9 """
10
11 load("//libc/test:libc_test_rules.bzl", "libc_test")
12
13 def math_test(name, hdrs = [], deps = [], **kwargs):
14 """Add a target for the unittest of a math function.
15
16 Args:
17 name: The name of the function being tested.
18 hdrs: List of headers to add.
19 deps: The list of other libraries to be linked in to the test target.
20 **kwargs: Attributes relevant for a cc_test. For example, name, srcs.
21 """
22 test_name = name + "_test"
23 libc_test(
24 name = test_name,
25 srcs = [test_name + ".cpp"] + hdrs,
26 libc_function_deps = ["//libc:" + name],
27 deps = [
28 "//libc:__support_fputil_basic_operations",
29 "//libc:__support_builtin_wrappers",
30 "//libc:__support_fputil_fenv_impl",
31 "//libc:__support_fputil_float_properties",
32 "//libc:__support_fputil_fp_bits",
33 "//libc:__support_uint128",
34 "//libc:__support_fputil_manipulation_functions",
35 "//libc:__support_fputil_nearest_integer_operations",
36 "//libc/utils/UnitTest:fp_test_helpers",
37 ] + deps,
38 **kwargs
39 )