| 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 stdlib.h functions. |
| 6 |
|
| 7 |
load("//libc:libc_build_rules.bzl", "libc_support_library") |
| 8 |
load("//libc/test:libc_test_rules.bzl", "libc_test") |
| 9 |
|
| 10 |
package(default_visibility = ["//visibility:public"]) |
| 11 |
|
| 12 |
licenses(["notice"]) |
| 13 |
|
| 14 |
libc_test( |
| 15 |
name = "abs_test", |
| 16 |
srcs = ["abs_test.cpp"], |
| 17 |
libc_function_deps = ["//libc:abs"], |
| 18 |
) |
| 19 |
|
| 20 |
libc_test( |
| 21 |
name = "labs_test", |
| 22 |
srcs = ["labs_test.cpp"], |
| 23 |
libc_function_deps = ["//libc:labs"], |
| 24 |
) |
| 25 |
|
| 26 |
libc_test( |
| 27 |
name = "llabs_test", |
| 28 |
srcs = ["llabs_test.cpp"], |
| 29 |
libc_function_deps = ["//libc:llabs"], |
| 30 |
) |
| 31 |
|
| 32 |
libc_support_library( |
| 33 |
name = "div_test_helper", |
| 34 |
hdrs = ["DivTest.h"], |
| 35 |
deps = ["//libc/test/UnitTest:LibcUnitTest"], |
| 36 |
) |
| 37 |
|
| 38 |
libc_test( |
| 39 |
name = "div_test", |
| 40 |
srcs = ["div_test.cpp"], |
| 41 |
libc_function_deps = ["//libc:div"], |
| 42 |
deps = [":div_test_helper"], |
| 43 |
) |
| 44 |
|
| 45 |
libc_test( |
| 46 |
name = "ldiv_test", |
| 47 |
srcs = ["ldiv_test.cpp"], |
| 48 |
libc_function_deps = ["//libc:ldiv"], |
| 49 |
deps = [":div_test_helper"], |
| 50 |
) |
| 51 |
|
| 52 |
libc_test( |
| 53 |
name = "lldiv_test", |
| 54 |
srcs = ["lldiv_test.cpp"], |
| 55 |
libc_function_deps = ["//libc:lldiv"], |
| 56 |
deps = [":div_test_helper"], |
| 57 |
) |
| 58 |
|
| 59 |
libc_support_library( |
| 60 |
name = "atoi_test_helper", |
| 61 |
hdrs = ["AtoiTest.h"], |
| 62 |
deps = [ |
| 63 |
"//libc:__support_cpp_limits", |
| 64 |
"//libc:__support_cpp_type_traits", |
| 65 |
"//libc/test/UnitTest:LibcUnitTest", |
| 66 |
], |
| 67 |
) |
| 68 |
|
| 69 |
libc_test( |
| 70 |
name = "atoi_test", |
| 71 |
srcs = ["atoi_test.cpp"], |
| 72 |
libc_function_deps = ["//libc:atoi"], |
| 73 |
deps = [":atoi_test_helper"], |
| 74 |
) |
| 75 |
|
| 76 |
libc_test( |
| 77 |
name = "atol_test", |
| 78 |
srcs = ["atol_test.cpp"], |
| 79 |
libc_function_deps = ["//libc:atol"], |
| 80 |
deps = [":atoi_test_helper"], |
| 81 |
) |
| 82 |
|
| 83 |
libc_test( |
| 84 |
name = "atoll_test", |
| 85 |
srcs = ["atoll_test.cpp"], |
| 86 |
libc_function_deps = ["//libc:atoll"], |
| 87 |
deps = [":atoi_test_helper"], |
| 88 |
) |
| 89 |
|
| 90 |
libc_test( |
| 91 |
name = "atof_test", |
| 92 |
srcs = ["atof_test.cpp"], |
| 93 |
libc_function_deps = ["//libc:atof"], |
| 94 |
deps = ["//libc:__support_fputil_fp_bits"], |
| 95 |
) |
| 96 |
|
| 97 |
libc_test( |
| 98 |
name = "bsearch_test", |
| 99 |
srcs = ["bsearch_test.cpp"], |
| 100 |
libc_function_deps = ["//libc:bsearch"], |
| 101 |
) |
| 102 |
|
| 103 |
libc_support_library( |
| 104 |
name = "qsort_test_helper", |
| 105 |
hdrs = ["SortingTest.h"], |
| 106 |
deps = [ |
| 107 |
"//libc:__support_macros_config", |
| 108 |
"//libc:qsort_util", |
| 109 |
"//libc/test/UnitTest:LibcUnitTest", |
| 110 |
], |
| 111 |
) |
| 112 |
|
| 113 |
libc_test( |
| 114 |
name = "qsort_test", |
| 115 |
srcs = ["qsort_test.cpp"], |
| 116 |
libc_function_deps = ["//libc:qsort"], |
| 117 |
deps = [":qsort_test_helper"], |
| 118 |
) |
| 119 |
|
| 120 |
libc_test( |
| 121 |
name = "quick_sort_test", |
| 122 |
srcs = ["quick_sort_test.cpp"], |
| 123 |
deps = [ |
| 124 |
":qsort_test_helper", |
| 125 |
"//libc:qsort_util", |
| 126 |
], |
| 127 |
) |
| 128 |
|
| 129 |
libc_test( |
| 130 |
name = "heap_sort_test", |
| 131 |
srcs = ["heap_sort_test.cpp"], |
| 132 |
deps = [ |
| 133 |
":qsort_test_helper", |
| 134 |
"//libc:qsort_util", |
| 135 |
], |
| 136 |
) |
| 137 |
|
| 138 |
libc_test( |
| 139 |
name = "qsort_r_test", |
| 140 |
srcs = ["qsort_r_test.cpp"], |
| 141 |
libc_function_deps = ["//libc:qsort_r"], |
| 142 |
) |
| 143 |
|
| 144 |
libc_support_library( |
| 145 |
name = "strtol_test_helper", |
| 146 |
hdrs = ["StrtolTest.h"], |
| 147 |
deps = [ |
| 148 |
"//libc:__support_cpp_limits", |
| 149 |
"//libc:__support_cpp_type_traits", |
| 150 |
"//libc:__support_macros_properties_architectures", |
| 151 |
"//libc:errno.__internal__", |
| 152 |
"//libc/test/UnitTest:LibcUnitTest", |
| 153 |
], |
| 154 |
) |
| 155 |
|
| 156 |
libc_test( |
| 157 |
name = "strtol_test", |
| 158 |
srcs = ["strtol_test.cpp"], |
| 159 |
libc_function_deps = ["//libc:strtol"], |
| 160 |
deps = [":strtol_test_helper"], |
| 161 |
) |
| 162 |
|
| 163 |
libc_test( |
| 164 |
name = "strtoll_test", |
| 165 |
srcs = ["strtoll_test.cpp"], |
| 166 |
libc_function_deps = ["//libc:strtoll"], |
| 167 |
deps = [":strtol_test_helper"], |
| 168 |
) |
| 169 |
|
| 170 |
libc_test( |
| 171 |
name = "strtoul_test", |
| 172 |
srcs = ["strtoul_test.cpp"], |
| 173 |
libc_function_deps = ["//libc:strtoul"], |
| 174 |
deps = [":strtol_test_helper"], |
| 175 |
) |
| 176 |
|
| 177 |
libc_test( |
| 178 |
name = "strtoull_test", |
| 179 |
srcs = ["strtoull_test.cpp"], |
| 180 |
libc_function_deps = ["//libc:strtoull"], |
| 181 |
deps = [":strtol_test_helper"], |
| 182 |
) |
| 183 |
|
| 184 |
libc_test( |
| 185 |
name = "strtof_test", |
| 186 |
srcs = ["strtof_test.cpp"], |
| 187 |
libc_function_deps = ["//libc:strtof"], |
| 188 |
deps = [ |
| 189 |
"//libc:__support_fputil_fp_bits", |
| 190 |
"//libc/test/UnitTest:fp_test_helpers", |
| 191 |
], |
| 192 |
) |
| 193 |
|
| 194 |
libc_test( |
| 195 |
name = "strtod_test", |
| 196 |
srcs = ["strtod_test.cpp"], |
| 197 |
libc_function_deps = ["//libc:strtod"], |
| 198 |
deps = [ |
| 199 |
"//libc:__support_fputil_fp_bits", |
| 200 |
"//libc/test/UnitTest:fp_test_helpers", |
| 201 |
], |
| 202 |
) |
| 203 |
|
| 204 |
libc_test( |
| 205 |
name = "strtold_test", |
| 206 |
srcs = ["strtold_test.cpp"], |
| 207 |
libc_function_deps = ["//libc:strtold"], |
| 208 |
deps = [ |
| 209 |
"//libc:__support_fputil_fp_bits", |
| 210 |
"//libc:__support_uint128", |
| 211 |
], |
| 212 |
) |