| 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/test:libc_test_rules.bzl", "libc_test", "libc_test_library") |
| 8 |
|
| 9 |
package(default_visibility = ["//visibility:public"]) |
| 10 |
|
| 11 |
licenses(["notice"]) |
| 12 |
|
| 13 |
libc_test( |
| 14 |
name = "abs_test", |
| 15 |
srcs = ["abs_test.cpp"], |
| 16 |
deps = ["//libc:abs"], |
| 17 |
) |
| 18 |
|
| 19 |
libc_test( |
| 20 |
name = "labs_test", |
| 21 |
srcs = ["labs_test.cpp"], |
| 22 |
deps = ["//libc:labs"], |
| 23 |
) |
| 24 |
|
| 25 |
libc_test( |
| 26 |
name = "llabs_test", |
| 27 |
srcs = ["llabs_test.cpp"], |
| 28 |
deps = ["//libc:llabs"], |
| 29 |
) |
| 30 |
|
| 31 |
libc_test_library( |
| 32 |
name = "div_test_helper", |
| 33 |
hdrs = ["DivTest.h"], |
| 34 |
deps = ["//libc/test/UnitTest:LibcUnitTest"], |
| 35 |
) |
| 36 |
|
| 37 |
libc_test( |
| 38 |
name = "div_test", |
| 39 |
srcs = ["div_test.cpp"], |
| 40 |
deps = [ |
| 41 |
":div_test_helper", |
| 42 |
"//libc:div", |
| 43 |
"//libc:types_div_t", |
| 44 |
], |
| 45 |
) |
| 46 |
|
| 47 |
libc_test( |
| 48 |
name = "ldiv_test", |
| 49 |
srcs = ["ldiv_test.cpp"], |
| 50 |
deps = [ |
| 51 |
":div_test_helper", |
| 52 |
"//libc:ldiv", |
| 53 |
"//libc:types_ldiv_t", |
| 54 |
], |
| 55 |
) |
| 56 |
|
| 57 |
libc_test( |
| 58 |
name = "lldiv_test", |
| 59 |
srcs = ["lldiv_test.cpp"], |
| 60 |
deps = [ |
| 61 |
":div_test_helper", |
| 62 |
"//libc:lldiv", |
| 63 |
"//libc:types_lldiv_t", |
| 64 |
], |
| 65 |
) |
| 66 |
|
| 67 |
libc_test_library( |
| 68 |
name = "atoi_test_helper", |
| 69 |
hdrs = ["AtoiTest.h"], |
| 70 |
deps = [ |
| 71 |
"//libc:__support_cpp_limits", |
| 72 |
"//libc:__support_cpp_type_traits", |
| 73 |
"//libc/test/UnitTest:LibcUnitTest", |
| 74 |
], |
| 75 |
) |
| 76 |
|
| 77 |
libc_test( |
| 78 |
name = "atoi_test", |
| 79 |
srcs = ["atoi_test.cpp"], |
| 80 |
deps = [ |
| 81 |
":atoi_test_helper", |
| 82 |
"//libc:atoi", |
| 83 |
], |
| 84 |
) |
| 85 |
|
| 86 |
libc_test( |
| 87 |
name = "atol_test", |
| 88 |
srcs = ["atol_test.cpp"], |
| 89 |
deps = [ |
| 90 |
":atoi_test_helper", |
| 91 |
"//libc:atol", |
| 92 |
], |
| 93 |
) |
| 94 |
|
| 95 |
libc_test( |
| 96 |
name = "atoll_test", |
| 97 |
srcs = ["atoll_test.cpp"], |
| 98 |
deps = [ |
| 99 |
":atoi_test_helper", |
| 100 |
"//libc:atoll", |
| 101 |
], |
| 102 |
) |
| 103 |
|
| 104 |
libc_test( |
| 105 |
name = "atof_test", |
| 106 |
srcs = ["atof_test.cpp"], |
| 107 |
deps = [ |
| 108 |
"//libc:__support_fputil_fp_bits", |
| 109 |
"//libc:atof", |
| 110 |
"//libc/test/UnitTest:errno_test_helpers", |
| 111 |
], |
| 112 |
) |
| 113 |
|
| 114 |
libc_test( |
| 115 |
name = "bsearch_test", |
| 116 |
srcs = ["bsearch_test.cpp"], |
| 117 |
deps = [ |
| 118 |
"//libc:bsearch", |
| 119 |
"//libc:types_size_t", |
| 120 |
], |
| 121 |
) |
| 122 |
|
| 123 |
libc_test_library( |
| 124 |
name = "qsort_test_helper", |
| 125 |
hdrs = ["SortingTest.h"], |
| 126 |
deps = [ |
| 127 |
"//libc:__support_macros_config", |
| 128 |
"//libc/test/UnitTest:LibcUnitTest", |
| 129 |
], |
| 130 |
) |
| 131 |
|
| 132 |
libc_test( |
| 133 |
name = "quick_sort_test", |
| 134 |
srcs = ["quick_sort_test.cpp"], |
| 135 |
deps = [ |
| 136 |
":qsort_test_helper", |
| 137 |
"//libc:qsort", |
| 138 |
"//libc:qsort_util", |
| 139 |
"//libc:types_size_t", |
| 140 |
], |
| 141 |
) |
| 142 |
|
| 143 |
libc_test( |
| 144 |
name = "heap_sort_test", |
| 145 |
srcs = ["heap_sort_test.cpp"], |
| 146 |
deps = [ |
| 147 |
":qsort_test_helper", |
| 148 |
"//libc:qsort", |
| 149 |
"//libc:qsort_util", |
| 150 |
"//libc:types_size_t", |
| 151 |
], |
| 152 |
) |
| 153 |
|
| 154 |
libc_test( |
| 155 |
name = "qsort_r_test", |
| 156 |
srcs = ["qsort_r_test.cpp"], |
| 157 |
deps = [ |
| 158 |
"//libc:qsort_r", |
| 159 |
"//libc:types_size_t", |
| 160 |
], |
| 161 |
) |
| 162 |
|
| 163 |
libc_test_library( |
| 164 |
name = "strfrom_test_helper", |
| 165 |
hdrs = ["StrfromTest.h"], |
| 166 |
deps = [ |
| 167 |
"//libc:__support_cpp_type_traits", |
| 168 |
"//libc:__support_fputil_fp_bits", |
| 169 |
"//libc/test/UnitTest:LibcUnitTest", |
| 170 |
], |
| 171 |
) |
| 172 |
|
| 173 |
libc_test( |
| 174 |
name = "strfromf_test", |
| 175 |
srcs = ["strfromf_test.cpp"], |
| 176 |
deps = [ |
| 177 |
":strfrom_test_helper", |
| 178 |
"//libc:strfromf", |
| 179 |
], |
| 180 |
) |
| 181 |
|
| 182 |
libc_test( |
| 183 |
name = "strfromd_test", |
| 184 |
srcs = ["strfromd_test.cpp"], |
| 185 |
deps = [ |
| 186 |
":strfrom_test_helper", |
| 187 |
"//libc:strfromd", |
| 188 |
], |
| 189 |
) |
| 190 |
|
| 191 |
libc_test( |
| 192 |
name = "strfroml_test", |
| 193 |
srcs = ["strfroml_test.cpp"], |
| 194 |
deps = [ |
| 195 |
":strfrom_test_helper", |
| 196 |
"//libc:strfroml", |
| 197 |
], |
| 198 |
) |
| 199 |
|
| 200 |
libc_test_library( |
| 201 |
name = "strtol_test_helper", |
| 202 |
hdrs = ["StrtolTest.h"], |
| 203 |
deps = [ |
| 204 |
"//libc:__support_cpp_limits", |
| 205 |
"//libc:__support_cpp_type_traits", |
| 206 |
"//libc:__support_ctype_utils", |
| 207 |
"//libc:__support_libc_errno", |
| 208 |
"//libc:__support_macros_properties_architectures", |
| 209 |
"//libc:errno", |
| 210 |
"//libc/test/UnitTest:LibcUnitTest", |
| 211 |
"//libc/test/UnitTest:errno_test_helpers", |
| 212 |
], |
| 213 |
) |
| 214 |
|
| 215 |
libc_test( |
| 216 |
name = "strtol_test", |
| 217 |
srcs = ["strtol_test.cpp"], |
| 218 |
deps = [ |
| 219 |
":strtol_test_helper", |
| 220 |
"//libc:strtol", |
| 221 |
], |
| 222 |
) |
| 223 |
|
| 224 |
libc_test( |
| 225 |
name = "strtoll_test", |
| 226 |
srcs = ["strtoll_test.cpp"], |
| 227 |
deps = [ |
| 228 |
":strtol_test_helper", |
| 229 |
"//libc:strtoll", |
| 230 |
], |
| 231 |
) |
| 232 |
|
| 233 |
libc_test( |
| 234 |
name = "strtoul_test", |
| 235 |
srcs = ["strtoul_test.cpp"], |
| 236 |
deps = [ |
| 237 |
":strtol_test_helper", |
| 238 |
"//libc:strtoul", |
| 239 |
], |
| 240 |
) |
| 241 |
|
| 242 |
libc_test( |
| 243 |
name = "strtoull_test", |
| 244 |
srcs = ["strtoull_test.cpp"], |
| 245 |
deps = [ |
| 246 |
":strtol_test_helper", |
| 247 |
"//libc:strtoull", |
| 248 |
], |
| 249 |
) |
| 250 |
|
| 251 |
libc_test( |
| 252 |
name = "strtof_test", |
| 253 |
srcs = ["strtof_test.cpp"], |
| 254 |
deps = [ |
| 255 |
"//libc:__support_fputil_fp_bits", |
| 256 |
"//libc:strtof", |
| 257 |
"//libc/test/UnitTest:errno_test_helpers", |
| 258 |
"//libc/test/UnitTest:fp_test_helpers", |
| 259 |
], |
| 260 |
) |
| 261 |
|
| 262 |
libc_test( |
| 263 |
name = "strtod_test", |
| 264 |
srcs = ["strtod_test.cpp"], |
| 265 |
deps = [ |
| 266 |
"//libc:__support_fputil_fp_bits", |
| 267 |
"//libc:strtod", |
| 268 |
"//libc/test/UnitTest:errno_test_helpers", |
| 269 |
"//libc/test/UnitTest:fp_test_helpers", |
| 270 |
], |
| 271 |
) |
| 272 |
|
| 273 |
libc_test( |
| 274 |
name = "strtold_test", |
| 275 |
srcs = ["strtold_test.cpp"], |
| 276 |
deps = [ |
| 277 |
"//libc:__support_fputil_fp_bits", |
| 278 |
"//libc:__support_uint128", |
| 279 |
"//libc:strtold", |
| 280 |
"//libc/test/UnitTest:errno_test_helpers", |
| 281 |
], |
| 282 |
) |