mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:37:35 +00:00
Tests: Establish root Tests directory, move Userland/Tests there
With the goal of centralizing all tests in the system, this is a first step to establish a Tests sub-tree. It will contain all of the unit tests and test harnesses for the various components in the system.
This commit is contained in:
parent
6e641fadfa
commit
fd0dbd1ebf
49 changed files with 1 additions and 1 deletions
43
Tests/LibC/TestLibCTime.cpp
Normal file
43
Tests/LibC/TestLibCTime.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/StringView.h>
|
||||
#include <LibTest/TestCase.h>
|
||||
#include <time.h>
|
||||
|
||||
const auto expected_epoch = "Thu Jan 1 00:00:00 1970\n"sv;
|
||||
|
||||
TEST_CASE(asctime)
|
||||
{
|
||||
time_t epoch = 0;
|
||||
auto result = asctime(localtime(&epoch));
|
||||
EXPECT_EQ(expected_epoch, StringView(result));
|
||||
}
|
||||
|
||||
TEST_CASE(asctime_r)
|
||||
{
|
||||
char buffer[26] {};
|
||||
time_t epoch = 0;
|
||||
auto result = asctime_r(localtime(&epoch), buffer);
|
||||
EXPECT_EQ(expected_epoch, StringView(result));
|
||||
}
|
||||
|
||||
TEST_CASE(ctime)
|
||||
{
|
||||
time_t epoch = 0;
|
||||
auto result = ctime(&epoch);
|
||||
|
||||
EXPECT_EQ(expected_epoch, StringView(result));
|
||||
}
|
||||
|
||||
TEST_CASE(ctime_r)
|
||||
{
|
||||
char buffer[26] {};
|
||||
time_t epoch = 0;
|
||||
auto result = ctime_r(&epoch, buffer);
|
||||
|
||||
EXPECT_EQ(expected_epoch, StringView(result));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue