mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
Tests: Move AK tests to Tests/AK
This commit is contained in:
parent
fd0dbd1ebf
commit
67322b0702
Notes:
sideshowbarker
2024-07-18 18:38:20 +09:00
Author: https://github.com/bgianfo
Commit: 67322b0702
Pull-request: https://github.com/SerenityOS/serenity/pull/6891
64 changed files with 1 additions and 2 deletions
30
Tests/AK/TestArray.cpp
Normal file
30
Tests/AK/TestArray.cpp
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue