xref: /llvm-project/libc/test/src/string/strlen_test.cpp (revision b6bc9d72f65a5086f310f321e969d96e9a559e75)
166d00febSPaula Toth //===-- Unittests for strlen ----------------------------------------------===//
21fcfd30fSPaula Toth //
31fcfd30fSPaula Toth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
41fcfd30fSPaula Toth // See https://llvm.org/LICENSE.txt for license information.
51fcfd30fSPaula Toth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
61fcfd30fSPaula Toth //
71fcfd30fSPaula Toth //===----------------------------------------------------------------------===//
81fcfd30fSPaula Toth 
91fcfd30fSPaula Toth #include "src/string/strlen.h"
10af1315c2SSiva Chandra Reddy #include "test/UnitTest/Test.h"
111fcfd30fSPaula Toth 
TEST(LlvmLibcStrLenTest,EmptyString)121df0dbfcSMichael Jones TEST(LlvmLibcStrLenTest, EmptyString) {
131fcfd30fSPaula Toth   const char *empty = "";
141fcfd30fSPaula Toth 
15*b6bc9d72SGuillaume Chatelet   size_t result = LIBC_NAMESPACE::strlen(empty);
161fcfd30fSPaula Toth   ASSERT_EQ((size_t)0, result);
171fcfd30fSPaula Toth }
181fcfd30fSPaula Toth 
TEST(LlvmLibcStrLenTest,AnyString)191df0dbfcSMichael Jones TEST(LlvmLibcStrLenTest, AnyString) {
201fcfd30fSPaula Toth   const char *any = "Hello World!";
211fcfd30fSPaula Toth 
22*b6bc9d72SGuillaume Chatelet   size_t result = LIBC_NAMESPACE::strlen(any);
231fcfd30fSPaula Toth   ASSERT_EQ((size_t)12, result);
241fcfd30fSPaula Toth }
25