| 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 |
], |
| 111 |
) |
| 112 |
|
| 113 |
libc_test( |
| 114 |
name = "bsearch_test", |
| 115 |
srcs = ["bsearch_test.cpp"], |
| 116 |
deps = [ |
| 117 |
"//libc:bsearch", |
| 118 |
"//libc:types_size_t", |
| 119 |
], |
| 120 |
) |
| 121 |
|
| 122 |
libc_test_library( |
| 123 |
name = "qsort_test_helper", |
| 124 |
hdrs = ["SortingTest.h"], |
| 125 |
deps = [ |
| 126 |
"//libc:__support_macros_config", |
| 127 |
"//libc/test/UnitTest:LibcUnitTest", |
| 128 |
], |
| 129 |
) |
| 130 |
|
| 131 |
libc_test( |
| 132 |
name = "quick_sort_test", |
| 133 |
srcs = ["quick_sort_test.cpp"], |
| 134 |
deps = [ |
| 135 |
":qsort_test_helper", |
| 136 |
"//libc:qsort", |
| 137 |
"//libc:qsort_util", |
| 138 |
"//libc:types_size_t", |
| 139 |
], |
| 140 |
) |
| 141 |
|
| 142 |
libc_test( |
| 143 |
name = "heap_sort_test", |
| 144 |
srcs = ["heap_sort_test.cpp"], |
| 145 |
deps = [ |
| 146 |
":qsort_test_helper", |
| 147 |
"//libc:qsort", |
| 148 |
"//libc:qsort_util", |
| 149 |
"//libc:types_size_t", |
| 150 |
], |
| 151 |
) |
| 152 |
|
| 153 |
libc_test( |
| 154 |
name = "qsort_r_test", |
| 155 |
srcs = ["qsort_r_test.cpp"], |
| 156 |
deps = [ |
| 157 |
"//libc:qsort_r", |
| 158 |
"//libc:types_size_t", |
| 159 |
], |
| 160 |
) |
| 161 |
|
| 162 |
libc_test( |
| 163 |
name = "rand_test", |
| 164 |
srcs = ["rand_test.cpp"], |
| 165 |
deps = [ |
| 166 |
"//libc:rand", |
| 167 |
"//libc:srand", |
| 168 |
], |
| 169 |
) |
| 170 |
|
| 171 |
libc_test_library( |
| 172 |
name = "strfrom_test_helper", |
| 173 |
hdrs = ["StrfromTest.h"], |
| 174 |
deps = [ |
| 175 |
"//libc:__support_cpp_type_traits", |
| 176 |
"//libc:__support_fputil_fp_bits", |
| 177 |
"//libc:__support_macros_properties_architectures", |
| 178 |
"//libc/test/UnitTest:LibcUnitTest", |
| 179 |
], |
| 180 |
) |
| 181 |
|
| 182 |
libc_test( |
| 183 |
name = "strfromf_test", |
| 184 |
srcs = ["strfromf_test.cpp"], |
| 185 |
deps = [ |
| 186 |
":strfrom_test_helper", |
| 187 |
"//libc:strfromf", |
| 188 |
], |
| 189 |
) |
| 190 |
|
| 191 |
libc_test( |
| 192 |
name = "strfromd_test", |
| 193 |
srcs = ["strfromd_test.cpp"], |
| 194 |
deps = [ |
| 195 |
":strfrom_test_helper", |
| 196 |
"//libc:strfromd", |
| 197 |
], |
| 198 |
) |
| 199 |
|
| 200 |
libc_test( |
| 201 |
name = "strfroml_test", |
| 202 |
srcs = ["strfroml_test.cpp"], |
| 203 |
deps = [ |
| 204 |
":strfrom_test_helper", |
| 205 |
"//libc:strfroml", |
| 206 |
], |
| 207 |
) |
| 208 |
|
| 209 |
libc_test_library( |
| 210 |
name = "strtol_test_helper", |
| 211 |
hdrs = ["StrtolTest.h"], |
| 212 |
deps = [ |
| 213 |
"//libc:__support_cpp_limits", |
| 214 |
"//libc:__support_cpp_type_traits", |
| 215 |
"//libc:__support_ctype_utils", |
| 216 |
"//libc:__support_libc_errno", |
| 217 |
"//libc:__support_macros_properties_architectures", |
| 218 |
"//libc:errno", |
| 219 |
"//libc/test/UnitTest:LibcUnitTest", |
| 220 |
], |
| 221 |
) |
| 222 |
|
| 223 |
libc_test( |
| 224 |
name = "strtol_test", |
| 225 |
srcs = ["strtol_test.cpp"], |
| 226 |
deps = [ |
| 227 |
":strtol_test_helper", |
| 228 |
"//libc:strtol", |
| 229 |
], |
| 230 |
) |
| 231 |
|
| 232 |
libc_test( |
| 233 |
name = "strtoll_test", |
| 234 |
srcs = ["strtoll_test.cpp"], |
| 235 |
deps = [ |
| 236 |
":strtol_test_helper", |
| 237 |
"//libc:strtoll", |
| 238 |
], |
| 239 |
) |
| 240 |
|
| 241 |
libc_test( |
| 242 |
name = "strtoul_test", |
| 243 |
srcs = ["strtoul_test.cpp"], |
| 244 |
deps = [ |
| 245 |
":strtol_test_helper", |
| 246 |
"//libc:strtoul", |
| 247 |
], |
| 248 |
) |
| 249 |
|
| 250 |
libc_test( |
| 251 |
name = "strtoull_test", |
| 252 |
srcs = ["strtoull_test.cpp"], |
| 253 |
deps = [ |
| 254 |
":strtol_test_helper", |
| 255 |
"//libc:strtoull", |
| 256 |
], |
| 257 |
) |
| 258 |
|
| 259 |
libc_test( |
| 260 |
name = "strtof_test", |
| 261 |
srcs = ["strtof_test.cpp"], |
| 262 |
deps = [ |
| 263 |
"//libc:__support_fputil_fp_bits", |
| 264 |
"//libc:strtof", |
| 265 |
"//libc/test/UnitTest:fp_test_helpers", |
| 266 |
], |
| 267 |
) |
| 268 |
|
| 269 |
libc_test( |
| 270 |
name = "strtod_test", |
| 271 |
srcs = ["strtod_test.cpp"], |
| 272 |
deps = [ |
| 273 |
"//libc:__support_fputil_fp_bits", |
| 274 |
"//libc:strtod", |
| 275 |
"//libc/test/UnitTest:fp_test_helpers", |
| 276 |
], |
| 277 |
) |
| 278 |
|
| 279 |
libc_test( |
| 280 |
name = "strtold_test", |
| 281 |
srcs = ["strtold_test.cpp"], |
| 282 |
deps = [ |
| 283 |
"//libc:__support_fputil_fp_bits", |
| 284 |
"//libc:__support_uint128", |
| 285 |
"//libc:strtold", |
| 286 |
], |
| 287 |
) |