mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-11-25 00:43:44 +00:00
add test option for clang3.4
This commit is contained in:
parent
4bcc5e71fc
commit
07524ee071
3 changed files with 277 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
|||
namespace testspr {
|
||||
static void algorithm_bogo_sort_test() {
|
||||
using namespace sprout;
|
||||
#if !defined(__clang__) || !(__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 5>{{5, 1, 4, 2, 3}};
|
||||
|
||||
|
@ -133,6 +134,122 @@ namespace testspr {
|
|||
));
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 4>{{1, 4, 2, 3}};
|
||||
|
||||
// ソート
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort(
|
||||
arr1,
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
array<int, 4>{{1, 2, 3, 4}}
|
||||
));
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort(
|
||||
arr1,
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
array<int, 4>{{1, 2, 3, 4}}
|
||||
));
|
||||
}
|
||||
// ソート
|
||||
// 範囲の切り出し
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort(
|
||||
sprout::sub(arr1, 1, 3),
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
array<int, 2>{{2, 4}}
|
||||
));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get_internal(sorted),
|
||||
array<int, 4>{{1, 2, 4, 3}}
|
||||
));
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort(
|
||||
sprout::sub(arr1, 1, 3),
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
array<int, 2>{{2, 4}}
|
||||
));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get_internal(sorted),
|
||||
array<int, 4>{{1, 2, 4, 3}}
|
||||
));
|
||||
}
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 4>{{1, 4, 2, 3}};
|
||||
|
||||
// ソート
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort(
|
||||
arr1,
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED),
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
array<int, 4>{{1, 2, 3, 4}}
|
||||
));
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort(
|
||||
arr1,
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED),
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
array<int, 4>{{1, 2, 3, 4}}
|
||||
));
|
||||
}
|
||||
// ソート
|
||||
// 範囲の切り出し
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort(
|
||||
sprout::sub(arr1, 1, 3),
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED),
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
array<int, 2>{{2, 4}}
|
||||
));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get_internal(sorted),
|
||||
array<int, 4>{{1, 2, 4, 3}}
|
||||
));
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort(
|
||||
sprout::sub(arr1, 1, 3),
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED),
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
array<int, 2>{{2, 4}}
|
||||
));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get_internal(sorted),
|
||||
array<int, 4>{{1, 2, 4, 3}}
|
||||
));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // namespace testspr
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
namespace testspr {
|
||||
static void algorithm_bogo_sort_result_test() {
|
||||
using namespace sprout;
|
||||
#if !defined(__clang__) || !(__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 5>{{5, 1, 4, 2, 3}};
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED);
|
||||
|
@ -175,6 +176,164 @@ namespace testspr {
|
|||
TESTSPR_BOTH_ASSERT(sprout::get<1>(sorted) == sprout::get<1>(sorted2));
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 4>{{1, 4, 2, 3}};
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED);
|
||||
|
||||
// ソート
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort_result(
|
||||
arr1,
|
||||
g
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get<0>(sorted),
|
||||
array<int, 4>{{1, 2, 3, 4}}
|
||||
));
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted2 = sprout::bogo_sort_result(
|
||||
sprout::get<0>(sorted),
|
||||
sprout::get<1>(sorted)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(sprout::get<1>(sorted) == sprout::get<1>(sorted2));
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort_result(
|
||||
arr1,
|
||||
g
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get<0>(sorted),
|
||||
array<int, 4>{{1, 2, 3, 4}}
|
||||
));
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted2 = sprout::bogo_sort_result(
|
||||
sprout::get<0>(sorted),
|
||||
sprout::get<1>(sorted)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(sprout::get<1>(sorted) == sprout::get<1>(sorted2));
|
||||
}
|
||||
// ソート
|
||||
// 範囲の切り出し
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort_result(
|
||||
sprout::sub(arr1, 1, 3),
|
||||
g
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get<0>(sorted),
|
||||
array<int, 2>{{2, 4}}
|
||||
));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get_internal(sprout::get<0>(sorted)),
|
||||
array<int, 4>{{1, 2, 4, 3}}
|
||||
));
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted2 = sprout::bogo_sort_result(
|
||||
sprout::get<0>(sorted),
|
||||
sprout::get<1>(sorted)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(sprout::get<1>(sorted) == sprout::get<1>(sorted2));
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort_result(
|
||||
sprout::sub(arr1, 1, 3),
|
||||
g
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get<0>(sorted),
|
||||
array<int, 2>{{2, 4}}
|
||||
));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get_internal(sprout::get<0>(sorted)),
|
||||
array<int, 4>{{1, 2, 4, 3}}
|
||||
));
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted2 = sprout::bogo_sort_result(
|
||||
sprout::get<0>(sorted),
|
||||
sprout::get<1>(sorted)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(sprout::get<1>(sorted) == sprout::get<1>(sorted2));
|
||||
}
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 4>{{1, 4, 2, 3}};
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED);
|
||||
|
||||
// ソート
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort_result(
|
||||
arr1,
|
||||
g,
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get<0>(sorted),
|
||||
array<int, 4>{{1, 2, 3, 4}}
|
||||
));
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted2 = sprout::bogo_sort_result(
|
||||
sprout::get<0>(sorted),
|
||||
sprout::get<1>(sorted)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(sprout::get<1>(sorted) == sprout::get<1>(sorted2));
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort_result(
|
||||
arr1,
|
||||
g,
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get<0>(sorted),
|
||||
array<int, 4>{{1, 2, 3, 4}}
|
||||
));
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted2 = sprout::bogo_sort_result(
|
||||
sprout::get<0>(sorted),
|
||||
sprout::get<1>(sorted)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(sprout::get<1>(sorted) == sprout::get<1>(sorted2));
|
||||
}
|
||||
// ソート
|
||||
// 範囲の切り出し
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort_result(
|
||||
sprout::sub(arr1, 1, 3),
|
||||
g,
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get<0>(sorted),
|
||||
array<int, 2>{{2, 4}}
|
||||
));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get_internal(sprout::get<0>(sorted)),
|
||||
array<int, 4>{{1, 2, 4, 3}}
|
||||
));
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted2 = sprout::bogo_sort_result(
|
||||
sprout::get<0>(sorted),
|
||||
sprout::get<1>(sorted)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(sprout::get<1>(sorted) == sprout::get<1>(sorted2));
|
||||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort_result(
|
||||
sprout::sub(arr1, 1, 3),
|
||||
g,
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get<0>(sorted),
|
||||
array<int, 2>{{2, 4}}
|
||||
));
|
||||
TESTSPR_BOTH_ASSERT(testspr::equal(
|
||||
sprout::get_internal(sprout::get<0>(sorted)),
|
||||
array<int, 4>{{1, 2, 4, 3}}
|
||||
));
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted2 = sprout::bogo_sort_result(
|
||||
sprout::get<0>(sorted),
|
||||
sprout::get<1>(sorted)
|
||||
);
|
||||
TESTSPR_BOTH_ASSERT(sprout::get<1>(sorted) == sprout::get<1>(sorted2));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // namespace testspr
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ declare -a common_options=()
|
|||
declare -a version_options=()
|
||||
declare -A version_specific_options=(
|
||||
[clang-3.3]='-ftemplate-depth=512'
|
||||
[clang-3.4]='-ftemplate-depth=512'
|
||||
)
|
||||
test_cpp=$(cd $(dirname $0); pwd)/test.cpp
|
||||
test_py=$(cd $(dirname $0); pwd)/test.py
|
||||
|
|
Loading…
Reference in a new issue