This is definitely a bug in rapidcheck but also rapidcheck is unmaintained (author vanished) so we can't really do anything about it on that side. lix> FAILED: tests/unit/liblixutil-test-support.dylib.p/libutil-support_tests_hash.cc.o lix> clang++ -Itests/unit/liblixutil-test-support.dylib.p -Itests/unit -I../tests/unit -I../tests/unit/libutil-support -I. -I.. -Ilix/libutil -Ilix/libexpr -fdiagnostics-color=always -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wall -Winvalid-pch -Wextra -std=c++23 -O2 -g -fpch-instantiate-templates -include config.h -Wno-unused-parameter -Wno-deprecated-declarations -Wno-missing-field-initializers -Wimplicit-fallthrough -Werror=switch -Werror=switch-enum -Werror=unused-result -Wdeprecated-copy -Wignored-qualifiers -Werror=suggest-override -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -ffile-prefix-map=../lix=lix -MD -MQ tests/unit/liblixutil-test-support.dylib.p/libutil-support_tests_hash.cc.o -MF tests/unit/liblixutil-test-support.dylib.p/libutil-support_tests_hash.cc.o.d -o tests/unit/liblixutil-test-support.dylib.p/libutil-support_tests_hash.cc.o -c ../tests/unit/libutil-support/tests/hash.cc lix> In file included from ../tests/unit/libutil-support/tests/hash.cc:3: lix> In file included from /nix/store/k8b7wc0lkr3lqxybzv458ijddpqnzlgw-rapidcheck-0-unstable-2023-12-14-dev/include/rapidcheck.h:18: lix> In file included from /nix/store/k8b7wc0lkr3lqxybzv458ijddpqnzlgw-rapidcheck-0-unstable-2023-12-14-dev/include/rapidcheck/Gen.h:74: lix> /nix/store/k8b7wc0lkr3lqxybzv458ijddpqnzlgw-rapidcheck-0-unstable-2023-12-14-dev/include/rapidcheck/Gen.hpp:72:22: error: calling 'current_exception' with incomplete return type 'exception_ptr' lix> 72 | auto exception = std::current_exception(); lix> | ^~~~~~~~~~~~~~~~~~~~~~~~ lix> /nix/store/0nhi47d5ip48wprxnava6vv973zzzndf-libcxx-19.1.5-dev/include/c++/v1/__exception/operations.h:37:41: note: 'current_exception' declared here lix> 37 | _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT; lix> | ^ lix> /nix/store/0nhi47d5ip48wprxnava6vv973zzzndf-libcxx-19.1.5-dev/include/c++/v1/__exception/operations.h:35:33: note: forward declaration of 'std::exception_ptr' lix> 35 | class _LIBCPP_EXPORTED_FROM_ABI exception_ptr; lix> | ^ lix> 1 error generated. Change-Id: Id5d0c4aa8143f2469c5a636d6773a2f5a25a0268
29 lines
733 B
C++
29 lines
733 B
C++
// required due to rapidcheck generating an incomplete-return-type error due to
|
|
// missing include on libc++ on macOS
|
|
#include <exception> // IWYU pragma: keep
|
|
#include <rapidcheck.h>
|
|
|
|
#include "hash.hh"
|
|
|
|
#include "tests/hash.hh"
|
|
|
|
namespace rc {
|
|
using namespace nix;
|
|
|
|
Gen<Hash> Arbitrary<Hash>::arbitrary()
|
|
{
|
|
Hash prototype(HashType::SHA1);
|
|
return
|
|
gen::apply(
|
|
[](const std::vector<uint8_t> & v) {
|
|
Hash hash(HashType::SHA1);
|
|
assert(v.size() == hash.hashSize);
|
|
std::copy(v.begin(), v.end(), hash.hash);
|
|
return hash;
|
|
},
|
|
gen::container<std::vector<uint8_t>>(prototype.hashSize, gen::arbitrary<uint8_t>())
|
|
);
|
|
}
|
|
|
|
}
|