about summary refs log tree commit diff
path: root/third_party/nix/src/tests/store-api-test.cc
blob: 259e4b991b577971a2c619c4b1080818f2783ab7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#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