summaryrefslogtreecommitdiff
path: root/libc/test/src/time/asctime_test.cpp
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2022-07-27 21:24:07 +0000
committerSiva Chandra Reddy <sivachandra@google.com>2022-08-04 23:46:38 +0000
commit2e4ef9b6efcaacd5556e8c0ddf659550d3a089a0 (patch)
tree4ea73fbd6cca89a527622c51c374c394b95f9d8c /libc/test/src/time/asctime_test.cpp
parent1bfc05270576d082a258481438993a393d171226 (diff)
[libc][NFC] Add a few compiler warning flags.
A bunch of cleanup to supress the new warnings is also done. Reviewed By: abrachet Differential Revision: https://reviews.llvm.org/D130723
Diffstat (limited to 'libc/test/src/time/asctime_test.cpp')
-rw-r--r--libc/test/src/time/asctime_test.cpp74
1 files changed, 36 insertions, 38 deletions
diff --git a/libc/test/src/time/asctime_test.cpp b/libc/test/src/time/asctime_test.cpp
index 0b0c159eb53a..93591de9422b 100644
--- a/libc/test/src/time/asctime_test.cpp
+++ b/libc/test/src/time/asctime_test.cpp
@@ -28,60 +28,58 @@ TEST(LlvmLibcAsctime, Nullptr) {
// Weekdays are in the range 0 to 6. Test passing invalid value in wday.
TEST(LlvmLibcAsctime, InvalidWday) {
struct tm tm_data;
- char *result;
// Test with wday = -1.
- result = call_asctime(&tm_data,
- 1970, // year
- 1, // month
- 1, // day
- 0, // hr
- 0, // min
- 0, // sec
- -1, // wday
- 0); // yday
+ call_asctime(&tm_data,
+ 1970, // year
+ 1, // month
+ 1, // day
+ 0, // hr
+ 0, // min
+ 0, // sec
+ -1, // wday
+ 0); // yday
ASSERT_EQ(EINVAL, llvmlibc_errno);
// Test with wday = 7.
- result = call_asctime(&tm_data,
- 1970, // year
- 1, // month
- 1, // day
- 0, // hr
- 0, // min
- 0, // sec
- 7, // wday
- 0); // yday
+ call_asctime(&tm_data,
+ 1970, // year
+ 1, // month
+ 1, // day
+ 0, // hr
+ 0, // min
+ 0, // sec
+ 7, // wday
+ 0); // yday
ASSERT_EQ(EINVAL, llvmlibc_errno);
}
// Months are from January to December. Test passing invalid value in month.
TEST(LlvmLibcAsctime, InvalidMonth) {
struct tm tm_data;
- char *result;
// Test with month = 0.
- result = call_asctime(&tm_data,
- 1970, // year
- 0, // month
- 1, // day
- 0, // hr
- 0, // min
- 0, // sec
- 4, // wday
- 0); // yday
+ call_asctime(&tm_data,
+ 1970, // year
+ 0, // month
+ 1, // day
+ 0, // hr
+ 0, // min
+ 0, // sec
+ 4, // wday
+ 0); // yday
ASSERT_EQ(EINVAL, llvmlibc_errno);
// Test with month = 13.
- result = call_asctime(&tm_data,
- 1970, // year
- 13, // month
- 1, // day
- 0, // hr
- 0, // min
- 0, // sec
- 4, // wday
- 0); // yday
+ call_asctime(&tm_data,
+ 1970, // year
+ 13, // month
+ 1, // day
+ 0, // hr
+ 0, // min
+ 0, // sec
+ 4, // wday
+ 0); // yday
ASSERT_EQ(EINVAL, llvmlibc_errno);
}