mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17:16:15 +02:00
Merge pull request #8339 from obsidiansystems/fix-rapid-check-instances
Fix some bounds in rapid check instances
This commit is contained in:
commit
f175b68646
3 changed files with 12 additions and 6 deletions
|
@ -95,13 +95,15 @@ Gen<NixStringContextElem::Built> Arbitrary<NixStringContextElem::Built>::arbitra
|
||||||
|
|
||||||
Gen<NixStringContextElem> Arbitrary<NixStringContextElem>::arbitrary()
|
Gen<NixStringContextElem> Arbitrary<NixStringContextElem>::arbitrary()
|
||||||
{
|
{
|
||||||
switch (*gen::inRange<uint8_t>(0, 2)) {
|
switch (*gen::inRange<uint8_t>(0, std::variant_size_v<NixStringContextElem::Raw>)) {
|
||||||
case 0:
|
case 0:
|
||||||
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::Opaque>());
|
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::Opaque>());
|
||||||
case 1:
|
case 1:
|
||||||
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::DrvDeep>());
|
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::DrvDeep>());
|
||||||
default:
|
case 2:
|
||||||
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::Built>());
|
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::Built>());
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,13 @@ Gen<DerivedPath::Built> Arbitrary<DerivedPath::Built>::arbitrary()
|
||||||
|
|
||||||
Gen<DerivedPath> Arbitrary<DerivedPath>::arbitrary()
|
Gen<DerivedPath> Arbitrary<DerivedPath>::arbitrary()
|
||||||
{
|
{
|
||||||
switch (*gen::inRange<uint8_t>(0, 1)) {
|
switch (*gen::inRange<uint8_t>(0, std::variant_size_v<DerivedPath::Raw>)) {
|
||||||
case 0:
|
case 0:
|
||||||
return gen::just<DerivedPath>(*gen::arbitrary<DerivedPath::Opaque>());
|
return gen::just<DerivedPath>(*gen::arbitrary<DerivedPath::Opaque>());
|
||||||
default:
|
case 1:
|
||||||
return gen::just<DerivedPath>(*gen::arbitrary<DerivedPath::Built>());
|
return gen::just<DerivedPath>(*gen::arbitrary<DerivedPath::Built>());
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,15 +206,17 @@ using namespace nix;
|
||||||
|
|
||||||
Gen<OutputsSpec> Arbitrary<OutputsSpec>::arbitrary()
|
Gen<OutputsSpec> Arbitrary<OutputsSpec>::arbitrary()
|
||||||
{
|
{
|
||||||
switch (*gen::inRange<uint8_t>(0, 1)) {
|
switch (*gen::inRange<uint8_t>(0, std::variant_size_v<OutputsSpec::Raw>)) {
|
||||||
case 0:
|
case 0:
|
||||||
return gen::just((OutputsSpec) OutputsSpec::All { });
|
return gen::just((OutputsSpec) OutputsSpec::All { });
|
||||||
default:
|
case 1:
|
||||||
return gen::just((OutputsSpec) OutputsSpec::Names {
|
return gen::just((OutputsSpec) OutputsSpec::Names {
|
||||||
*gen::nonEmpty(gen::container<StringSet>(gen::map(
|
*gen::nonEmpty(gen::container<StringSet>(gen::map(
|
||||||
gen::arbitrary<StorePathName>(),
|
gen::arbitrary<StorePathName>(),
|
||||||
[](StorePathName n) { return n.name; }))),
|
[](StorePathName n) { return n.name; }))),
|
||||||
});
|
});
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue