#include #include #include #include "path-regex.hh" #include "store-api.hh" #include "tests/hash.hh" #include "tests/path.hh" namespace nix { void showValue(const StorePath & p, std::ostream & os) { os << p.to_string(); } } namespace rc { using namespace nix; Gen storePathChar() { return rc::gen::apply([](uint8_t i) -> char { switch (i) { case 0 ... 9: return '0' + i; case 10 ... 35: return 'A' + (i - 10); case 36 ... 61: return 'a' + (i - 36); case 62: return '+'; case 63: return '-'; case 64: return '.'; case 65: return '_'; case 66: return '?'; case 67: return '='; default: assert(false); } }, gen::inRange(0, 10 + 2 * 26 + 6)); } Gen Arbitrary::arbitrary() { return gen::construct( gen::suchThat( gen::container(storePathChar()), [](const std::string & s) { return !( s == "" || s == "." || s == ".." || s.starts_with(".-") || s.starts_with("..-") ); } ) ); } Gen Arbitrary::arbitrary() { return gen::construct( gen::arbitrary(), gen::apply([](StorePathName n){ return n.name; }, gen::arbitrary()) ); } } // namespace rc