1add_libc_testsuite(libc_string_unittests)
2
3add_subdirectory(memory_utils)
4
5add_libc_unittest(
6  strcat_test
7  SUITE
8    libc_string_unittests
9  SRCS
10    strcat_test.cpp
11  DEPENDS
12    libc.src.string.strcat
13)
14
15add_libc_unittest(
16  strcpy_test
17  SUITE
18    libc_string_unittests
19  SRCS
20    strcpy_test.cpp
21  DEPENDS
22    libc.src.string.strcpy
23)
24
25add_libc_unittest(
26  strlen_test
27  SUITE
28    libc_string_unittests
29  SRCS
30    strlen_test.cpp
31  DEPENDS
32    libc.src.string.strlen
33)
34
35# Tests all implementations of memcpy that can run on the host.
36get_property(memcpy_implementations GLOBAL PROPERTY memcpy_implementations)
37foreach(memcpy_config_name IN LISTS memcpy_implementations)
38  get_target_property(require_cpu_features libc.src.string.${memcpy_config_name} REQUIRE_CPU_FEATURES)
39  host_supports(can_run "${require_cpu_features}")
40  if(can_run)
41    add_libc_unittest(
42      ${memcpy_config_name}_test
43      SUITE
44        libc_string_unittests
45      SRCS
46        memcpy_test.cpp
47      DEPENDS
48        libc.src.string.${memcpy_config_name}
49    )
50  else()
51    message(STATUS "Skipping test for '${memcpy_config_name}' insufficient host cpu features")
52  endif()
53endforeach()
54
55