1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

Tests: Move AK tests to Tests/AK

This commit is contained in:
Brian Gianforcaro 2021-05-06 01:19:30 -07:00 committed by Andreas Kling
parent fd0dbd1ebf
commit 67322b0702
64 changed files with 1 additions and 2 deletions

30
Tests/AK/TestArray.cpp Normal file
View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibTest/TestCase.h>
#include <AK/Array.h>
static constexpr int constexpr_sum(const Span<const int> span)
{
int sum = 0;
for (auto value : span)
sum += value;
return sum;
}
TEST_CASE(compile_time_contructible)
{
constexpr Array<int, 4> array = { 0, 1, 2, 3 };
static_assert(array.size() == 4);
}
TEST_CASE(compile_time_iterable)
{
constexpr Array<int, 8> array = { 0, 1, 2, 3, 4, 5, 6, 7 };
static_assert(constexpr_sum(array) == 28);
}