#include #include // Needed by rapidcheck on Darwin #include #include "nix/store/tests/derived-path.hh" namespace rc { using namespace nix; Gen Arbitrary::arbitrary() { return gen::map(gen::arbitrary(), [](StorePath path) { return DerivedPath::Opaque{ .path = path, }; }); } Gen Arbitrary::arbitrary() { return gen::mapcat(gen::arbitrary(), [](SingleDerivedPath drvPath) { return gen::map(gen::arbitrary(), [drvPath](StorePathName outputPath) { return SingleDerivedPath::Built{ .drvPath = make_ref(drvPath), .output = outputPath.name, }; }); }); } Gen Arbitrary::arbitrary() { return gen::mapcat(gen::arbitrary(), [](SingleDerivedPath drvPath) { return gen::map(gen::arbitrary(), [drvPath](OutputsSpec outputs) { return DerivedPath::Built{ .drvPath = make_ref(drvPath), .outputs = outputs, }; }); }); } Gen Arbitrary::arbitrary() { return gen::mapcat(gen::inRange(0, std::variant_size_v), [](uint8_t n) { switch (n) { case 0: return gen::map(gen::arbitrary(), [](SingleDerivedPath a) { return a; }); case 1: return gen::map(gen::arbitrary(), [](SingleDerivedPath a) { return a; }); default: assert(false); } }); } Gen Arbitrary::arbitrary() { return gen::mapcat(gen::inRange(0, std::variant_size_v), [](uint8_t n) { switch (n) { case 0: return gen::map(gen::arbitrary(), [](DerivedPath a) { return a; }); case 1: return gen::map(gen::arbitrary(), [](DerivedPath a) { return a; }); default: assert(false); } }); } } // namespace rc