diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-29 13:52:38 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-29 17:09:59 -0500 |
commit | ecd3e4ebd777dca694d0c60431641f054ec2d1ce (patch) | |
tree | e11a073f6cf5baa207a9da8bf2f8e2bb200c3ab9 /src/libutil/tests/hash.cc | |
parent | ec0c0efec6d7eed868b424434748b97651e02bcc (diff) |
More property tests
Also put proper comparison methods on `DerivedPath` and
`NixStringContextElem`, which is needed for the tests but good in
general.
Diffstat (limited to 'src/libutil/tests/hash.cc')
-rw-r--r-- | src/libutil/tests/hash.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/libutil/tests/hash.cc b/src/libutil/tests/hash.cc index 412c03030..e4e928b3b 100644 --- a/src/libutil/tests/hash.cc +++ b/src/libutil/tests/hash.cc @@ -1,5 +1,12 @@ -#include "hash.hh" +#include <regex> + +#include <nlohmann/json.hpp> #include <gtest/gtest.h> +#include <rapidcheck/gtest.h> + +#include <hash.hh> + +#include "tests/hash.hh" namespace nix { @@ -73,3 +80,16 @@ namespace nix { "c7d329eeb6dd26545e96e55b874be909"); } } + +namespace rc { +using namespace nix; + +Gen<Hash> Arbitrary<Hash>::arbitrary() +{ + Hash hash(htSHA1); + for (size_t i = 0; i < hash.hashSize; ++i) + hash.hash[i] = *gen::arbitrary<uint8_t>(); + return gen::just(hash); +} + +} |