#include #include #include #include #include "tests/derived-path.hh" #include "tests/libstore.hh" namespace rc { using namespace nix; Gen Arbitrary::arbitrary() { return gen::just(DerivedPath::Opaque { .path = *gen::arbitrary(), }); } Gen Arbitrary::arbitrary() { return gen::just(DerivedPath::Built { .drvPath = *gen::arbitrary(), .outputs = *gen::arbitrary(), }); } Gen Arbitrary::arbitrary() { switch (*gen::inRange(0, 1)) { case 0: return gen::just(*gen::arbitrary()); default: return gen::just(*gen::arbitrary()); } } } namespace nix { class DerivedPathTest : public LibStoreTest { }; // FIXME: `RC_GTEST_FIXTURE_PROP` isn't calling `SetUpTestSuite` because it is // no a real fixture. // // See https://github.com/emil-e/rapidcheck/blob/master/doc/gtest.md#rc_gtest_fixture_propfixture-name-args TEST_F(DerivedPathTest, force_init) { } RC_GTEST_FIXTURE_PROP( DerivedPathTest, prop_legacy_round_rip, (const DerivedPath & o)) { RC_ASSERT(o == DerivedPath::parseLegacy(*store, o.to_string_legacy(*store))); } RC_GTEST_FIXTURE_PROP( DerivedPathTest, prop_round_rip, (const DerivedPath & o)) { RC_ASSERT(o == DerivedPath::parse(*store, o.to_string(*store))); } }