ladybird/AK/Tests/TestAnyOf.cpp
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

25 lines
798 B
C++

/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/TestSuite.h>
#include <AK/AnyOf.h>
#include <AK/Array.h>
TEST_CASE(should_determine_if_predicate_applies_to_any_element_in_container)
{
constexpr Array<int, 10> a { 1 };
static_assert(any_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
static_assert(any_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
static_assert(!any_of(a.begin(), a.end(), [](auto elem) { return elem == 2; }));
EXPECT(any_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
EXPECT(any_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
EXPECT(!any_of(a.begin(), a.end(), [](auto elem) { return elem == 2; }));
}
TEST_MAIN(AllOf)