mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-03 21:24:38 +01:00
commit
b372dc6157
272 changed files with 22238 additions and 7949 deletions
|
|
@ -10,12 +10,15 @@
|
|||
# pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
#endif
|
||||
|
||||
#include <helpers/range_test_helpers.hpp>
|
||||
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/generators/catch_generator_exception.hpp>
|
||||
#include <catch2/generators/catch_generators_adapters.hpp>
|
||||
#include <catch2/generators/catch_generators_random.hpp>
|
||||
#include <catch2/generators/catch_generators_range.hpp>
|
||||
#include <catch2/generators/catch_generator_exception.hpp>
|
||||
|
||||
// Tests of generator implementation details
|
||||
TEST_CASE("Generators internals", "[generators][internals]") {
|
||||
|
|
@ -411,6 +414,7 @@ TEST_CASE("GENERATE handles function (pointers)", "[generators][compilation][app
|
|||
|
||||
TEST_CASE("GENERATE decays arrays", "[generators][compilation][approvals]") {
|
||||
auto str = GENERATE("abc", "def", "gh");
|
||||
(void)str;
|
||||
STATIC_REQUIRE(std::is_same<decltype(str), const char*>::value);
|
||||
}
|
||||
|
||||
|
|
@ -534,3 +538,39 @@ TEST_CASE( "Random generators can be seeded", "[generators][approvals]" ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Filter generator throws exception for empty generator",
|
||||
"[generators]") {
|
||||
using namespace Catch::Generators;
|
||||
|
||||
REQUIRE_THROWS_AS(
|
||||
filter( []( int ) { return false; }, value( 3 ) ),
|
||||
Catch::GeneratorException );
|
||||
}
|
||||
|
||||
TEST_CASE("from_range(container) supports ADL begin/end and arrays", "[generators][from-range][approvals]") {
|
||||
using namespace Catch::Generators;
|
||||
|
||||
SECTION("C array") {
|
||||
int arr[3]{ 5, 6, 7 };
|
||||
auto gen = from_range( arr );
|
||||
REQUIRE( gen.get() == 5 );
|
||||
REQUIRE( gen.next() );
|
||||
REQUIRE( gen.get() == 6 );
|
||||
REQUIRE( gen.next() );
|
||||
REQUIRE( gen.get() == 7 );
|
||||
REQUIRE_FALSE( gen.next() );
|
||||
}
|
||||
|
||||
SECTION( "ADL range" ) {
|
||||
unrelated::needs_ADL_begin<int> range{ 1, 2, 3 };
|
||||
auto gen = from_range( range );
|
||||
REQUIRE( gen.get() == 1 );
|
||||
REQUIRE( gen.next() );
|
||||
REQUIRE( gen.get() == 2 );
|
||||
REQUIRE( gen.next() );
|
||||
REQUIRE( gen.get() == 3 );
|
||||
REQUIRE_FALSE( gen.next() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue