ligo/src/proto_alpha/lib_protocol/test/helpers/helpers_misc.ml
Grégoire Henry 7929027793 Proto/test: do not depend on shell
For the test suite we only use the in-memory context.
2018-02-05 23:34:05 +01:00

36 lines
1.3 KiB
OCaml

(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2016. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
exception Unknown_protocol
let no_ops_hash =
Operation_list_list_hash.compute
(List.map (fun _ -> Operation_list_hash.empty)
Proto_alpha.Main.validation_passes)
let find_account accounts hpub =
let hpub_pred (x : Helpers_account.t) =
Ed25519.Public_key_hash.equal x.hpub hpub in
List.find hpub_pred accounts
let read_file path =
let (//) = Filename.concat in
let executable_path = Sys.getcwd () in
let path =
if Filename.is_relative path
then executable_path // path
else path
in
let ic = open_in path in
let n = in_channel_length ic in
let s = Bytes.create n in
really_input ic s 0 n ;
close_in ic ;
(Bytes.to_string s)