Skip to content

Commit

Permalink
Find: test without empty arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainJoube committed Oct 2, 2024
1 parent 263cdf8 commit ccdfc24
Showing 1 changed file with 55 additions and 55 deletions.
110 changes: 55 additions & 55 deletions test/algorithm/algos/find/1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
TTS_CASE("Check for kwk::find(In, value) 1D")
{
// Empty array
{
const std::size_t input_size = 0;
std::array<int, input_size> input;
auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
auto res = kwk::find(view, 0);
TTS_EQUAL(res.has_value(), false);
}
// {
// const std::size_t input_size = 0;
// std::array<int, input_size> input;
// auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
// auto res = kwk::find(view, 0);
// TTS_EQUAL(res.has_value(), false);
// }

const std::size_t input_size = 20;
std::array<int, input_size> input;
Expand Down Expand Up @@ -59,14 +59,14 @@ TTS_CASE("Check for kwk::find(In, value) 1D")
TTS_CASE("Check for kwk::find_if(In, func) 1D")
{
// Empty array
{
const std::size_t input_size = 0;
std::array<int, input_size> input;
auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
auto func = [&](auto item) { return (item % 2) == 0; };
auto res = kwk::find_if(view, func);
TTS_EQUAL(res.has_value(), false);
}
// {
// const std::size_t input_size = 0;
// std::array<int, input_size> input;
// auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
// auto func = [&](auto item) { return (item % 2) == 0; };
// auto res = kwk::find_if(view, func);
// TTS_EQUAL(res.has_value(), false);
// }

// Array of size 20
const std::size_t input_size = 20;
Expand Down Expand Up @@ -120,16 +120,16 @@ TTS_CASE("Check for kwk::find_if(In, func) 1D")
TTS_CASE("Check for kwk::find_if_not(In, func) 1D")
{
// Empty array
{
const std::size_t input_size = 0;
std::array<int, input_size> input;
auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
// {
// const std::size_t input_size = 0;
// std::array<int, input_size> input;
// auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};

auto func = [&](auto item) { return (item % 2) == 0; };
auto res = kwk::find_if_not(view, func);
// auto func = [&](auto item) { return (item % 2) == 0; };
// auto res = kwk::find_if_not(view, func);

TTS_EQUAL(res.has_value(), false);
}
// TTS_EQUAL(res.has_value(), false);
// }

// Non-empty array
const std::size_t input_size = 20;
Expand Down Expand Up @@ -188,15 +188,15 @@ TTS_CASE("Check for kwk::find_if_not(In, func) 1D")
TTS_CASE("Check for kwk::find_first_of(In, In) 1D")
{
// Empty array
{
const std::size_t input_size = 0;
std::array<int, input_size> input;
auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
std::vector<int> search{-10, -5, 0, 8, 11};
auto sv = kwk::view{kwk::source = search, kwk::of_size(search.size())};
auto res = kwk::find_first_of(view, sv);
TTS_EQUAL(res.has_value(), false);
}
// {
// const std::size_t input_size = 0;
// std::array<int, input_size> input;
// auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
// std::vector<int> search{-10, -5, 0, 8, 11};
// auto sv = kwk::view{kwk::source = search, kwk::of_size(search.size())};
// auto res = kwk::find_first_of(view, sv);
// TTS_EQUAL(res.has_value(), false);
// }

const std::size_t input_size = 40;
std::array<int, input_size> input;
Expand Down Expand Up @@ -242,15 +242,15 @@ TTS_CASE("Check for kwk::find_first_of(In, In) 1D")

TTS_CASE("Check for kwk::find_last(In, value) 1D")
{
// Empty array
{
const std::size_t input_size = 0;
std::array<int, input_size> input;
auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
int search{6};
auto res = kwk::find_last(view, search);
TTS_EQUAL(res.has_value(), false);
}
// // Empty array
// {
// const std::size_t input_size = 0;
// std::array<int, input_size> input;
// auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
// int search{6};
// auto res = kwk::find_last(view, search);
// TTS_EQUAL(res.has_value(), false);
// }

const std::size_t input_size = 40;
std::array<int, input_size> input;
Expand Down Expand Up @@ -293,13 +293,13 @@ TTS_CASE("Check for kwk::find_last_if(In, func) 1D")
auto func = [](auto const& e) { return (e % 2) == 0; };

// Empty array
{
const std::size_t input_size = 0;
std::array<int, input_size> input;
auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
auto res = kwk::find_last_if(view, func);
TTS_EQUAL(res.has_value(), false);
}
// {
// const std::size_t input_size = 0;
// std::array<int, input_size> input;
// auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
// auto res = kwk::find_last_if(view, func);
// TTS_EQUAL(res.has_value(), false);
// }

const std::size_t input_size = 40;
std::array<int, input_size> input;
Expand Down Expand Up @@ -345,13 +345,13 @@ TTS_CASE("Check for kwk::find_last_if_not(In, func) 1D")
auto func = [](auto const& e) { return (e % 2) != 0; };

// Empty array
{
const std::size_t input_size = 0;
std::array<int, input_size> input;
auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
auto res = kwk::find_last_if_not(view, func);
TTS_EQUAL(res.has_value(), false);
}
// {
// const std::size_t input_size = 0;
// std::array<int, input_size> input;
// auto view = kwk::view{kwk::source = input, kwk::of_size(input_size)};
// auto res = kwk::find_last_if_not(view, func);
// TTS_EQUAL(res.has_value(), false);
// }

const std::size_t input_size = 40;
std::array<int, input_size> input;
Expand Down

0 comments on commit ccdfc24

Please sign in to comment.