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