[libc][obvious] fix tests using wrong size for string

In the code
const char *str = "abc"
if you do sizeof(str) you get the size of the pointer, not the string.
This patch fixes that mistake.

Differential Revision: https://reviews.llvm.org/D137586
This commit is contained in:
Michael Jones 2022-11-07 14:02:32 -08:00
parent 86674f66cc
commit 430ca14af8
1 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ TEST(LlvmLibcScanfStringReaderTest, SimpleRead) {
__llvm_libc::scanf_core::StringReader str_reader(str);
__llvm_libc::scanf_core::Reader reader(&str_reader);
for (size_t i = 0; i < sizeof(str); ++i) {
for (size_t i = 0; i < sizeof("abc"); ++i) {
ASSERT_EQ(str[i], reader.getc());
}
}
@ -60,7 +60,7 @@ TEST(LlvmLibcScanfStringReaderTest, ReadAndReverse) {
}
// Check the whole string.
for (size_t i = 0; i < sizeof(str); ++i) {
for (size_t i = 0; i < sizeof("abcDEF123"); ++i) {
ASSERT_EQ(str[i], reader.getc());
}
}