37# include <gtest/gtest.h>
44using namespace testing;
63 build_dynlist<char>(
'a',
'b',
'c',
'd',
'e')));
71 EXPECT_EQ(v2 + v3, 2*v2);
75 EXPECT_EQ(v2 - v3, zero);
78 EXPECT_TRUE(v5.get_domain().keys().
79 all([&v5] (
char c) {
return v5.search_entry(c); }));
84 EXPECT_THROW(VType(chars, { 1, 2, 3, 4 }), length_error);
85 VType v = { chars, { 1, 2, 3, 4, 5 } };
87 EXPECT_NO_THROW(VType v1 = { chars });
90 VType vaux = { auxd };
92 EXPECT_THROW(vaux = v, domain_error);
93 EXPECT_THROW(vaux = VType(chars), domain_error);
94 EXPECT_NO_THROW(vaux = VType(auxd));
96 VType vaux1 = { auxd };
97 EXPECT_NO_THROW(vaux = vaux1);
102 constexpr size_t N = 10000;
108 {
return (i % 2) == 0 ? 0 : i; }) };
110 {
return (i % 2) == 0 ? i : 0; }) };
114 EXPECT_EQ(odd + even, full);
115 EXPECT_EQ(odd*even, 0);
118 EXPECT_EQ(full*I,
N*(
N - 1)/2);
119 EXPECT_EQ(even*I,
N*(
N-2)/4);
120 EXPECT_EQ(odd*I,
N*
N/4);
String manipulation utilities.
High-level sorting functions for Aleph containers.
Sparse vector with named elements.
TEST_F(SmallDomain, basic)
Generic domain class based on hash set.
DynList< T > to_list() const
Convert domain to sorted list.
const DynList< T > & keys() const
Get sorted list of all elements in the domain.
Doubly-linked list (defined in tpl_dynList.H).
Number Theoretic Transform over Z / MOD Z.
const Domain & get_domain() const noexcept
Get the domain over which this vector is defined.
NumType * search_entry(const T &i) noexcept
Search for an entry and return pointer to its value.
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > maps(Operation &op) const
Main namespace for Aleph-w library functions.
bool eq(const C1 &c1, const C2 &c2, Eq e=Eq())
Check equality of two containers using a predicate.
bool all(Container &container, Operation &operation)
Return true if all elements satisfy a predicate.
DynArray< T > sort(const DynArray< T > &a, Cmp &&cmp=Cmp())
Returns a sorted copy of a DynArray.