| 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 |
# Tests for LLVM libc stdbit.h functions. |
| 6 |
|
| 7 |
load("//libc/test:libc_test_rules.bzl", "libc_test") |
| 8 |
|
| 9 |
package(default_visibility = ["//visibility:public"]) |
| 10 |
|
| 11 |
licenses(["notice"]) |
| 12 |
|
| 13 |
bit_suffix_list = [ |
| 14 |
"uc", |
| 15 |
"us", |
| 16 |
"ui", |
| 17 |
"ul", |
| 18 |
"ull", |
| 19 |
] |
| 20 |
|
| 21 |
bit_prefix_list = [ |
| 22 |
"stdc_leading_zeros_", |
| 23 |
"stdc_leading_ones_", |
| 24 |
"stdc_trailing_zeros_", |
| 25 |
"stdc_trailing_ones_", |
| 26 |
"stdc_count_ones_", |
| 27 |
"stdc_has_single_bit_", |
| 28 |
"stdc_bit_width_", |
| 29 |
"stdc_bit_floor_", |
| 30 |
"stdc_bit_ceil_", |
| 31 |
"stdc_first_leading_zero_", |
| 32 |
"stdc_first_leading_one_", |
| 33 |
"stdc_first_trailing_zero_", |
| 34 |
"stdc_first_trailing_one_", |
| 35 |
"stdc_count_zeros_", |
| 36 |
] |
| 37 |
|
| 38 |
[ |
| 39 |
libc_test( |
| 40 |
name = bit_prefix + bit_suffix + "_test", |
| 41 |
srcs = [bit_prefix + bit_suffix + "_test.cpp"], |
| 42 |
deps = [ |
| 43 |
"//libc:func_name".replace( |
| 44 |
"func_name", |
| 45 |
bit_prefix + bit_suffix, |
| 46 |
), |
| 47 |
] + ["//libc:__support_cpp_limits"], |
| 48 |
) |
| 49 |
for bit_prefix in bit_prefix_list |
| 50 |
for bit_suffix in bit_suffix_list |
| 51 |
] |