xref: /llvm-project/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel (revision 1eed780a6a01b5b10de8a723318f0153b5adea0a)
1d856e5feSGuillaume Chatelet# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2d856e5feSGuillaume Chatelet# See https://llvm.org/LICENSE.txt for license information.
3d856e5feSGuillaume Chatelet# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4d856e5feSGuillaume Chatelet
5d856e5feSGuillaume Chatelet# Tests for LLVM libc stdlib.h functions.
6d856e5feSGuillaume Chatelet
787b00ef3SGuillaume Chateletload("//libc:libc_build_rules.bzl", "libc_support_library")
8d856e5feSGuillaume Chateletload("//libc/test:libc_test_rules.bzl", "libc_test")
9d856e5feSGuillaume Chatelet
10d856e5feSGuillaume Chateletpackage(default_visibility = ["//visibility:public"])
11d856e5feSGuillaume Chatelet
12d856e5feSGuillaume Chateletlicenses(["notice"])
13d856e5feSGuillaume Chatelet
142bd82c54SSiva Chandra Reddylibc_test(
152bd82c54SSiva Chandra Reddy    name = "abs_test",
162bd82c54SSiva Chandra Reddy    srcs = ["abs_test.cpp"],
1787b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:abs"],
182bd82c54SSiva Chandra Reddy)
192bd82c54SSiva Chandra Reddy
202bd82c54SSiva Chandra Reddylibc_test(
212bd82c54SSiva Chandra Reddy    name = "labs_test",
222bd82c54SSiva Chandra Reddy    srcs = ["labs_test.cpp"],
2387b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:labs"],
242bd82c54SSiva Chandra Reddy)
252bd82c54SSiva Chandra Reddy
262bd82c54SSiva Chandra Reddylibc_test(
272bd82c54SSiva Chandra Reddy    name = "llabs_test",
282bd82c54SSiva Chandra Reddy    srcs = ["llabs_test.cpp"],
2987b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:llabs"],
302bd82c54SSiva Chandra Reddy)
312bd82c54SSiva Chandra Reddy
3287b00ef3SGuillaume Chateletlibc_support_library(
332bd82c54SSiva Chandra Reddy    name = "div_test_helper",
342bd82c54SSiva Chandra Reddy    hdrs = ["DivTest.h"],
3587b00ef3SGuillaume Chatelet    deps = ["//libc/test/UnitTest:LibcUnitTest"],
362bd82c54SSiva Chandra Reddy)
372bd82c54SSiva Chandra Reddy
382bd82c54SSiva Chandra Reddylibc_test(
392bd82c54SSiva Chandra Reddy    name = "div_test",
402bd82c54SSiva Chandra Reddy    srcs = ["div_test.cpp"],
4187b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:div"],
421b1e3255SBenjamin Kramer    deps = [
431b1e3255SBenjamin Kramer        ":div_test_helper",
441b1e3255SBenjamin Kramer        "//libc:types_div_t",
451b1e3255SBenjamin Kramer    ],
462bd82c54SSiva Chandra Reddy)
472bd82c54SSiva Chandra Reddy
482bd82c54SSiva Chandra Reddylibc_test(
492bd82c54SSiva Chandra Reddy    name = "ldiv_test",
502bd82c54SSiva Chandra Reddy    srcs = ["ldiv_test.cpp"],
5187b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:ldiv"],
521b1e3255SBenjamin Kramer    deps = [
531b1e3255SBenjamin Kramer        ":div_test_helper",
541b1e3255SBenjamin Kramer        "//libc:types_ldiv_t",
551b1e3255SBenjamin Kramer    ],
562bd82c54SSiva Chandra Reddy)
572bd82c54SSiva Chandra Reddy
582bd82c54SSiva Chandra Reddylibc_test(
592bd82c54SSiva Chandra Reddy    name = "lldiv_test",
602bd82c54SSiva Chandra Reddy    srcs = ["lldiv_test.cpp"],
6187b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:lldiv"],
621b1e3255SBenjamin Kramer    deps = [
631b1e3255SBenjamin Kramer        ":div_test_helper",
641b1e3255SBenjamin Kramer        "//libc:types_lldiv_t",
651b1e3255SBenjamin Kramer    ],
662bd82c54SSiva Chandra Reddy)
672bd82c54SSiva Chandra Reddy
6887b00ef3SGuillaume Chateletlibc_support_library(
69d07c54c2SAlex Brachet    name = "atoi_test_helper",
70d07c54c2SAlex Brachet    hdrs = ["AtoiTest.h"],
7166b3f4a4STue Ly    deps = [
723490f037SDanial Klimkin        "//libc:__support_cpp_limits",
739a2cb3a6SPranav Kant        "//libc:__support_cpp_type_traits",
744d5fd9b7STue Ly        "//libc/test/UnitTest:LibcUnitTest",
7566b3f4a4STue Ly    ],
76d07c54c2SAlex Brachet)
77d07c54c2SAlex Brachet
78d856e5feSGuillaume Chateletlibc_test(
79d856e5feSGuillaume Chatelet    name = "atoi_test",
80d856e5feSGuillaume Chatelet    srcs = ["atoi_test.cpp"],
8187b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:atoi"],
82fc840808SJordan Rupprecht    deps = [":atoi_test_helper"],
83d856e5feSGuillaume Chatelet)
84d856e5feSGuillaume Chatelet
85d856e5feSGuillaume Chateletlibc_test(
86d856e5feSGuillaume Chatelet    name = "atol_test",
87d856e5feSGuillaume Chatelet    srcs = ["atol_test.cpp"],
8887b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:atol"],
89fc840808SJordan Rupprecht    deps = [":atoi_test_helper"],
90d856e5feSGuillaume Chatelet)
91d856e5feSGuillaume Chatelet
92d856e5feSGuillaume Chateletlibc_test(
93d856e5feSGuillaume Chatelet    name = "atoll_test",
94d856e5feSGuillaume Chatelet    srcs = ["atoll_test.cpp"],
9587b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:atoll"],
96fc840808SJordan Rupprecht    deps = [":atoi_test_helper"],
97d856e5feSGuillaume Chatelet)
98d856e5feSGuillaume Chatelet
99d856e5feSGuillaume Chateletlibc_test(
100dccd1d73SMichael Jones    name = "atof_test",
101dccd1d73SMichael Jones    srcs = ["atof_test.cpp"],
10287b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:atof"],
10387b00ef3SGuillaume Chatelet    deps = ["//libc:__support_fputil_fp_bits"],
104dccd1d73SMichael Jones)
105dccd1d73SMichael Jones
106dccd1d73SMichael Joneslibc_test(
107d856e5feSGuillaume Chatelet    name = "bsearch_test",
108d856e5feSGuillaume Chatelet    srcs = ["bsearch_test.cpp"],
10987b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:bsearch"],
1101b1e3255SBenjamin Kramer    deps = ["//libc:types_size_t"],
111d856e5feSGuillaume Chatelet)
112d856e5feSGuillaume Chatelet
113a6d2da8bSlntuelibc_support_library(
114a6d2da8bSlntue    name = "qsort_test_helper",
115a6d2da8bSlntue    hdrs = ["SortingTest.h"],
116a6d2da8bSlntue    deps = [
1173eb666e2SKrasimir Georgiev        "//libc:__support_macros_config",
118*1eed780aSBenjamin Kramer        "//libc:qsort",
119a6d2da8bSlntue        "//libc/test/UnitTest:LibcUnitTest",
120a6d2da8bSlntue    ],
121a6d2da8bSlntue)
1223eb666e2SKrasimir Georgiev
123d856e5feSGuillaume Chateletlibc_test(
124a738d81cSLukas Bergdoll    name = "quick_sort_test",
125a738d81cSLukas Bergdoll    srcs = ["quick_sort_test.cpp"],
12687b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:qsort"],
1271b1e3255SBenjamin Kramer    deps = [
1281b1e3255SBenjamin Kramer        ":qsort_test_helper",
12927751c39SJoelWee        "//libc:qsort_util",
1301b1e3255SBenjamin Kramer        "//libc:types_size_t",
1311b1e3255SBenjamin Kramer    ],
132a6d2da8bSlntue)
1333eb666e2SKrasimir Georgiev
134a6d2da8bSlntuelibc_test(
1350b96f1cfSSchrodinger ZHU Yifan    name = "heap_sort_test",
1360b96f1cfSSchrodinger ZHU Yifan    srcs = ["heap_sort_test.cpp"],
137a738d81cSLukas Bergdoll    libc_function_deps = ["//libc:qsort"],
1380b96f1cfSSchrodinger ZHU Yifan    deps = [
1390b96f1cfSSchrodinger ZHU Yifan        ":qsort_test_helper",
14027751c39SJoelWee        "//libc:qsort_util",
141a738d81cSLukas Bergdoll        "//libc:types_size_t",
142a6d2da8bSlntue    ],
143d856e5feSGuillaume Chatelet)
144d856e5feSGuillaume Chatelet
145d3074f16SMichael Joneslibc_test(
146d3074f16SMichael Jones    name = "qsort_r_test",
147d3074f16SMichael Jones    srcs = ["qsort_r_test.cpp"],
14887b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:qsort_r"],
1491b1e3255SBenjamin Kramer    deps = ["//libc:types_size_t"],
150d3074f16SMichael Jones)
151d3074f16SMichael Jones
15287b00ef3SGuillaume Chateletlibc_support_library(
15339f370aeSMichael Jones    name = "strtol_test_helper",
15439f370aeSMichael Jones    hdrs = ["StrtolTest.h"],
15566b3f4a4STue Ly    deps = [
15666b3f4a4STue Ly        "//libc:__support_cpp_limits",
15766b3f4a4STue Ly        "//libc:__support_cpp_type_traits",
158f6f16b5fSAugie Fackler        "//libc:__support_ctype_utils",
159c1b82977SDmitry Chernenkov        "//libc:__support_macros_properties_architectures",
160b5c661c2SJorge Gorbe Moya        "//libc:errno.__internal__",
1614d5fd9b7STue Ly        "//libc/test/UnitTest:LibcUnitTest",
16266b3f4a4STue Ly    ],
16339f370aeSMichael Jones)
16439f370aeSMichael Jones
165d856e5feSGuillaume Chateletlibc_test(
166d856e5feSGuillaume Chatelet    name = "strtol_test",
167d856e5feSGuillaume Chatelet    srcs = ["strtol_test.cpp"],
16887b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:strtol"],
169fc840808SJordan Rupprecht    deps = [":strtol_test_helper"],
170d856e5feSGuillaume Chatelet)
171d856e5feSGuillaume Chatelet
172d856e5feSGuillaume Chateletlibc_test(
173d856e5feSGuillaume Chatelet    name = "strtoll_test",
174d856e5feSGuillaume Chatelet    srcs = ["strtoll_test.cpp"],
17587b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:strtoll"],
176fc840808SJordan Rupprecht    deps = [":strtol_test_helper"],
177d856e5feSGuillaume Chatelet)
178d856e5feSGuillaume Chatelet
179d856e5feSGuillaume Chateletlibc_test(
180d856e5feSGuillaume Chatelet    name = "strtoul_test",
181d856e5feSGuillaume Chatelet    srcs = ["strtoul_test.cpp"],
18287b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:strtoul"],
183fc840808SJordan Rupprecht    deps = [":strtol_test_helper"],
184d856e5feSGuillaume Chatelet)
185d856e5feSGuillaume Chatelet
186d856e5feSGuillaume Chateletlibc_test(
187d856e5feSGuillaume Chatelet    name = "strtoull_test",
188d856e5feSGuillaume Chatelet    srcs = ["strtoull_test.cpp"],
18987b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:strtoull"],
190fc840808SJordan Rupprecht    deps = [":strtol_test_helper"],
191d856e5feSGuillaume Chatelet)
192dccd1d73SMichael Jones
193dccd1d73SMichael Joneslibc_test(
194dccd1d73SMichael Jones    name = "strtof_test",
195dccd1d73SMichael Jones    srcs = ["strtof_test.cpp"],
19687b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:strtof"],
197fc840808SJordan Rupprecht    deps = [
198fc840808SJordan Rupprecht        "//libc:__support_fputil_fp_bits",
199447d59e0SSiva Chandra Reddy        "//libc/test/UnitTest:fp_test_helpers",
200fc840808SJordan Rupprecht    ],
201dccd1d73SMichael Jones)
202dccd1d73SMichael Jones
203dccd1d73SMichael Joneslibc_test(
204dccd1d73SMichael Jones    name = "strtod_test",
205dccd1d73SMichael Jones    srcs = ["strtod_test.cpp"],
20687b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:strtod"],
207fc840808SJordan Rupprecht    deps = [
208fc840808SJordan Rupprecht        "//libc:__support_fputil_fp_bits",
209447d59e0SSiva Chandra Reddy        "//libc/test/UnitTest:fp_test_helpers",
210fc840808SJordan Rupprecht    ],
211dccd1d73SMichael Jones)
212dccd1d73SMichael Jones
213dccd1d73SMichael Joneslibc_test(
214dccd1d73SMichael Jones    name = "strtold_test",
215dccd1d73SMichael Jones    srcs = ["strtold_test.cpp"],
21687b00ef3SGuillaume Chatelet    libc_function_deps = ["//libc:strtold"],
217dccd1d73SMichael Jones    deps = [
218dccd1d73SMichael Jones        "//libc:__support_fputil_fp_bits",
219dccd1d73SMichael Jones        "//libc:__support_uint128",
220dccd1d73SMichael Jones    ],
221dccd1d73SMichael Jones)
222