mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Everything that is a separate subproject should live in the subprojects
directory.
Progress on #2503
This reverts commit 451f8a8c19
.
30 lines
862 B
C++
30 lines
862 B
C++
#include <rapidcheck.h>
|
|
|
|
#include "tests/path.hh"
|
|
#include "tests/value/context.hh"
|
|
|
|
namespace rc {
|
|
using namespace nix;
|
|
|
|
Gen<NixStringContextElem::DrvDeep> Arbitrary<NixStringContextElem::DrvDeep>::arbitrary()
|
|
{
|
|
return gen::just(NixStringContextElem::DrvDeep {
|
|
.drvPath = *gen::arbitrary<StorePath>(),
|
|
});
|
|
}
|
|
|
|
Gen<NixStringContextElem> Arbitrary<NixStringContextElem>::arbitrary()
|
|
{
|
|
switch (*gen::inRange<uint8_t>(0, std::variant_size_v<NixStringContextElem::Raw>)) {
|
|
case 0:
|
|
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::Opaque>());
|
|
case 1:
|
|
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::DrvDeep>());
|
|
case 2:
|
|
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::Built>());
|
|
default:
|
|
assert(false);
|
|
}
|
|
}
|
|
|
|
}
|