Skip to content

Commit 0ab2df2

Browse files
[libc][bazel] add tests and targets for ctype (#158124)
Adds tests and targets for all the ctype functions.
1 parent b4650a4 commit 0ab2df2

File tree

2 files changed

+309
-0
lines changed

2 files changed

+309
-0
lines changed

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,168 @@ libc_support_library(
18181818
],
18191819
)
18201820

1821+
################################# ctype targets ################################
1822+
1823+
libc_function(
1824+
name = "isalnum",
1825+
srcs = ["src/ctype/isalnum.cpp"],
1826+
hdrs = ["src/ctype/isalnum.h"],
1827+
deps = [
1828+
":__support_common",
1829+
":__support_ctype_utils",
1830+
],
1831+
)
1832+
1833+
libc_function(
1834+
name = "isalpha",
1835+
srcs = ["src/ctype/isalpha.cpp"],
1836+
hdrs = ["src/ctype/isalpha.h"],
1837+
deps = [
1838+
":__support_common",
1839+
":__support_ctype_utils",
1840+
],
1841+
)
1842+
1843+
libc_function(
1844+
name = "isascii",
1845+
srcs = ["src/ctype/isascii.cpp"],
1846+
hdrs = ["src/ctype/isascii.h"],
1847+
deps = [
1848+
":__support_common",
1849+
":__support_ctype_utils",
1850+
],
1851+
)
1852+
1853+
libc_function(
1854+
name = "isblank",
1855+
srcs = ["src/ctype/isblank.cpp"],
1856+
hdrs = ["src/ctype/isblank.h"],
1857+
deps = [
1858+
":__support_common",
1859+
":__support_ctype_utils",
1860+
],
1861+
)
1862+
1863+
libc_function(
1864+
name = "iscntrl",
1865+
srcs = ["src/ctype/iscntrl.cpp"],
1866+
hdrs = ["src/ctype/iscntrl.h"],
1867+
deps = [
1868+
":__support_common",
1869+
":__support_ctype_utils",
1870+
],
1871+
)
1872+
1873+
libc_function(
1874+
name = "isdigit",
1875+
srcs = ["src/ctype/isdigit.cpp"],
1876+
hdrs = ["src/ctype/isdigit.h"],
1877+
deps = [
1878+
":__support_common",
1879+
":__support_ctype_utils",
1880+
],
1881+
)
1882+
1883+
libc_function(
1884+
name = "isgraph",
1885+
srcs = ["src/ctype/isgraph.cpp"],
1886+
hdrs = ["src/ctype/isgraph.h"],
1887+
deps = [
1888+
":__support_common",
1889+
":__support_ctype_utils",
1890+
],
1891+
)
1892+
1893+
libc_function(
1894+
name = "islower",
1895+
srcs = ["src/ctype/islower.cpp"],
1896+
hdrs = ["src/ctype/islower.h"],
1897+
deps = [
1898+
":__support_common",
1899+
":__support_ctype_utils",
1900+
],
1901+
)
1902+
1903+
libc_function(
1904+
name = "isprint",
1905+
srcs = ["src/ctype/isprint.cpp"],
1906+
hdrs = ["src/ctype/isprint.h"],
1907+
deps = [
1908+
":__support_common",
1909+
":__support_ctype_utils",
1910+
],
1911+
)
1912+
1913+
libc_function(
1914+
name = "ispunct",
1915+
srcs = ["src/ctype/ispunct.cpp"],
1916+
hdrs = ["src/ctype/ispunct.h"],
1917+
deps = [
1918+
":__support_common",
1919+
":__support_ctype_utils",
1920+
],
1921+
)
1922+
1923+
libc_function(
1924+
name = "isspace",
1925+
srcs = ["src/ctype/isspace.cpp"],
1926+
hdrs = ["src/ctype/isspace.h"],
1927+
deps = [
1928+
":__support_common",
1929+
":__support_ctype_utils",
1930+
],
1931+
)
1932+
1933+
libc_function(
1934+
name = "isupper",
1935+
srcs = ["src/ctype/isupper.cpp"],
1936+
hdrs = ["src/ctype/isupper.h"],
1937+
deps = [
1938+
":__support_common",
1939+
":__support_ctype_utils",
1940+
],
1941+
)
1942+
1943+
libc_function(
1944+
name = "isxdigit",
1945+
srcs = ["src/ctype/isxdigit.cpp"],
1946+
hdrs = ["src/ctype/isxdigit.h"],
1947+
deps = [
1948+
":__support_common",
1949+
":__support_ctype_utils",
1950+
],
1951+
)
1952+
1953+
libc_function(
1954+
name = "toascii",
1955+
srcs = ["src/ctype/toascii.cpp"],
1956+
hdrs = ["src/ctype/toascii.h"],
1957+
deps = [
1958+
":__support_common",
1959+
":__support_ctype_utils",
1960+
],
1961+
)
1962+
1963+
libc_function(
1964+
name = "tolower",
1965+
srcs = ["src/ctype/tolower.cpp"],
1966+
hdrs = ["src/ctype/tolower.h"],
1967+
deps = [
1968+
":__support_common",
1969+
":__support_ctype_utils",
1970+
],
1971+
)
1972+
1973+
libc_function(
1974+
name = "toupper",
1975+
srcs = ["src/ctype/toupper.cpp"],
1976+
hdrs = ["src/ctype/toupper.h"],
1977+
deps = [
1978+
":__support_common",
1979+
":__support_ctype_utils",
1980+
],
1981+
)
1982+
18211983
################################ fenv targets ################################
18221984

18231985
libc_function(
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
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 ctype.h functions.
6+
7+
load("//libc/test:libc_test_rules.bzl", "libc_test")
8+
9+
package(default_visibility = ["//visibility:public"])
10+
11+
licenses(["notice"])
12+
13+
libc_test(
14+
name = "isalnum_test",
15+
srcs = ["isalnum_test.cpp"],
16+
deps = [
17+
"//libc:__support_cpp_span",
18+
"//libc:isalnum",
19+
],
20+
)
21+
22+
libc_test(
23+
name = "islpha_test",
24+
srcs = ["isalpha_test.cpp"],
25+
deps = [
26+
"//libc:__support_cpp_span",
27+
"//libc:isalpha",
28+
],
29+
)
30+
31+
libc_test(
32+
name = "isascii_test",
33+
srcs = ["isascii_test.cpp"],
34+
deps = [
35+
"//libc:isascii",
36+
],
37+
)
38+
39+
libc_test(
40+
name = "isblank_test",
41+
srcs = ["isblank_test.cpp"],
42+
deps = [
43+
"//libc:isblank",
44+
],
45+
)
46+
47+
libc_test(
48+
name = "iscntrl_test",
49+
srcs = ["iscntrl_test.cpp"],
50+
deps = [
51+
"//libc:iscntrl",
52+
],
53+
)
54+
55+
libc_test(
56+
name = "isdigit_test",
57+
srcs = ["isdigit_test.cpp"],
58+
deps = [
59+
"//libc:__support_cpp_span",
60+
"//libc:isdigit",
61+
],
62+
)
63+
64+
libc_test(
65+
name = "isgraph_test",
66+
srcs = ["isgraph_test.cpp"],
67+
deps = [
68+
"//libc:isgraph",
69+
],
70+
)
71+
72+
libc_test(
73+
name = "islower_test",
74+
srcs = ["islower_test.cpp"],
75+
deps = [
76+
"//libc:__support_cpp_span",
77+
"//libc:islower",
78+
],
79+
)
80+
81+
libc_test(
82+
name = "isprint_test",
83+
srcs = ["isprint_test.cpp"],
84+
deps = [
85+
"//libc:isprint",
86+
],
87+
)
88+
89+
libc_test(
90+
name = "ispunct_test",
91+
srcs = ["ispunct_test.cpp"],
92+
deps = [
93+
"//libc:ispunct",
94+
],
95+
)
96+
97+
libc_test(
98+
name = "isspace_test",
99+
srcs = ["isspace_test.cpp"],
100+
deps = [
101+
"//libc:isspace",
102+
],
103+
)
104+
105+
libc_test(
106+
name = "isupper_test",
107+
srcs = ["isupper_test.cpp"],
108+
deps = [
109+
"//libc:__support_cpp_span",
110+
"//libc:isupper",
111+
],
112+
)
113+
114+
libc_test(
115+
name = "isxdigit_test",
116+
srcs = ["isxdigit_test.cpp"],
117+
deps = [
118+
"//libc:__support_cpp_span",
119+
"//libc:isxdigit",
120+
],
121+
)
122+
123+
libc_test(
124+
name = "toascii_test",
125+
srcs = ["toascii_test.cpp"],
126+
deps = [
127+
"//libc:toascii",
128+
],
129+
)
130+
131+
libc_test(
132+
name = "tolower_test",
133+
srcs = ["tolower_test.cpp"],
134+
deps = [
135+
"//libc:__support_cpp_span",
136+
"//libc:tolower",
137+
],
138+
)
139+
140+
libc_test(
141+
name = "toupper_test",
142+
srcs = ["toupper_test.cpp"],
143+
deps = [
144+
"//libc:__support_cpp_span",
145+
"//libc:toupper",
146+
],
147+
)

0 commit comments

Comments
 (0)