mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-14 15:04:09 +00:00
fix recursion depth O(logN): some algorithms
This commit is contained in:
parent
28697ee7a8
commit
5019f6aa96
162 changed files with 3600 additions and 1659 deletions
|
@ -44,6 +44,74 @@ namespace testspr {
|
|||
);
|
||||
TESTSPR_BOTH_ASSERT(result == 0);
|
||||
}
|
||||
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(
|
||||
testspr::reduct_input(sprout::begin(arr1)),
|
||||
testspr::reduct_input(sprout::end(arr1)),
|
||||
5
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(result == 4);
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(
|
||||
testspr::reduct_input(sprout::begin(arr1)),
|
||||
testspr::reduct_input(sprout::end(arr1)),
|
||||
11
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(result == 0);
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(
|
||||
testspr::reduct_input(sprout::begin(arr1)),
|
||||
testspr::reduct_input(sprout::begin(arr1) + 5),
|
||||
5
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(result == 2);
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(
|
||||
testspr::reduct_input(sprout::begin(arr1)),
|
||||
testspr::reduct_input(sprout::begin(arr1) + 5),
|
||||
11
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(result == 0);
|
||||
}
|
||||
|
||||
#if defined(__clang__)
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(
|
||||
testspr::reduct_random_access(sprout::begin(arr1)),
|
||||
testspr::reduct_random_access(sprout::end(arr1)),
|
||||
5
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(result == 4);
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(
|
||||
testspr::reduct_random_access(sprout::begin(arr1)),
|
||||
testspr::reduct_random_access(sprout::end(arr1)),
|
||||
11
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(result == 0);
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(
|
||||
testspr::reduct_random_access(sprout::begin(arr1)),
|
||||
testspr::reduct_random_access(sprout::begin(arr1) + 5),
|
||||
5
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(result == 2);
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(
|
||||
testspr::reduct_random_access(sprout::begin(arr1)),
|
||||
testspr::reduct_random_access(sprout::begin(arr1) + 5),
|
||||
11
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(result == 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} // namespace testspr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue