aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/tests/outputs-spec.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/tests/outputs-spec.cc')
-rw-r--r--src/libstore/tests/outputs-spec.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/libstore/tests/outputs-spec.cc b/src/libstore/tests/outputs-spec.cc
index 06e4cabbd..984d1d963 100644
--- a/src/libstore/tests/outputs-spec.cc
+++ b/src/libstore/tests/outputs-spec.cc
@@ -2,6 +2,7 @@
#include <nlohmann/json.hpp>
#include <gtest/gtest.h>
+#include <rapidcheck/gtest.h>
namespace nix {
@@ -199,3 +200,34 @@ TEST_JSON(ExtendedOutputsSpec, names, R"(["a","b"])", (ExtendedOutputsSpec::Expl
#undef TEST_JSON
}
+
+namespace rc {
+using namespace nix;
+
+Gen<OutputsSpec> Arbitrary<OutputsSpec>::arbitrary()
+{
+ switch (*gen::inRange<uint8_t>(0, 1)) {
+ case 0:
+ return gen::just((OutputsSpec) OutputsSpec::All { });
+ default:
+ return gen::just((OutputsSpec) OutputsSpec::Names {
+ *gen::nonEmpty(gen::container<StringSet>(gen::map(
+ gen::arbitrary<StorePathName>(),
+ [](StorePathName n) { return n.name; }))),
+ });
+ }
+}
+
+}
+
+namespace nix {
+
+RC_GTEST_PROP(
+ OutputsSpec,
+ prop_round_rip,
+ (const OutputsSpec & o))
+{
+ RC_ASSERT(o == OutputsSpec::parse(o.to_string()));
+}
+
+}