snix/third_party/nix/src/tests/store-api-test.cc
Griffin Smith 363dbeae95 refactor(tvix): Centralize arbitrary definitions
To make it easier for future tests to use the arbitrary specialisations
we've defined for some nix types, centralize them all in a single
arbitrary.hh header file.

Change-Id: I767f27949cfe7ec55c79901f7d7aa538d2f98c6b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2182
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-11-28 00:47:48 +00:00

28 lines
644 B
C++

#include "libstore/store-api.hh"
#include <gtest/gtest.h>
#include <rapidcheck/Assertions.h>
#include <rapidcheck/gtest.h>
#include "libproto/worker.pb.h"
#include "tests/arbitrary.hh"
namespace nix {
class BuildResultTest : public ::testing::Test {};
RC_GTEST_PROP(BuildResultTest, StatusToFromProtoRoundTrip,
(BuildResult::Status && status)) {
BuildResult br;
br.status = status;
auto proto_status = br.status_to_proto();
nix::proto::BuildResult br_proto;
br_proto.set_status(proto_status);
auto result = BuildResult::FromProto(br_proto);
RC_ASSERT(result.value().status == status);
}
} // namespace nix