Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ewen/admin decoders #148

Merged
merged 9 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ FROM imandra/imandra-client-switch
COPY --chown=opam:nogroup ./fix-engine.opam .
RUN opam install . --deps-only --with-test --working-dir
COPY --chown=opam:nogroup . .
RUN make build build_server
RUN make build build_server build_tests
RUN ./_build//default/src-tests/test_roundtrip.bc
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build_tests:
@echo "(dirs :standard \ *-vg)" > dune
dune build src-tests/test_runner.bc
dune build src-tests/test_cache.bc
dune build src-tests/test_roundtrip.bc
rm dune

doc:
Expand Down
77 changes: 52 additions & 25 deletions src-core-fresh/fresh.iml
Original file line number Diff line number Diff line change
@@ -1,37 +1,64 @@
(** fresh helper functions. *)
(***
Imandra Inc.
Copyright (c) 2014 - 2020
fresh.iml
*)
[@@@import "../src-core-time-defaults-pp/time_defaults_current_time.iml"];;
[@@@import "../src-core-utils-pp/current_time.iml"];;
[@@@import "../src-core/numeric.iml"];;
[@@@import "../src-core-time-defaults/time_defaults.iml"];;
(* Imandra Inc. copyright 2021 *)
[@@@program]
[@@@import "../src-core/numeric.iml"]
open Numeric;;
[@@@import "../src-core-time-defaults-pp/time_defaults_current_time.iml"]
open Time_defaults_current_time;;

let count_string = ref 0;;

let fresh_strings_db : ('a, 'a) Hashtbl.t = Hashtbl.create 32i ;;
let count_string = ref 0;;
let fresh_ints_db : ('a, 'a) Hashtbl.t = Hashtbl.create 32i ;;
let count_int = ref 0;;
let count_float = ref (Numeric.Float_6 0);;
let fresh_floats_db : ('a, 'a) Hashtbl.t = Hashtbl.create 32i ;;
let count_float = ref (float_Create_6 0);;
let fresh_now_db : ('a, 'a) Hashtbl.t = Hashtbl.create 32i ;;
let count_now = ref (get_current_utctimestamp ());;


let incr_string () =
count_string := !count_string + 1;
Z.to_string !count_string
let incr_string seed =
match Hashtbl.find fresh_strings_db seed with
| s -> s
| exception Not_found ->
let prev = !count_string in
count_string := prev + 1;
let s = Z.to_string !count_string in
Hashtbl.add fresh_strings_db seed s;
s
;;

let incr_int () =
count_int := !count_int + 1;
!count_int
let incr_int seed =
match Hashtbl.find fresh_ints_db seed with
| i -> i
| exception Not_found ->
let prev = !count_int in
count_int := prev + 1;
let i = !count_int in
Hashtbl.add fresh_ints_db seed i;
i
;;

let incr_float () =
count_float := Numeric.float_Add_6_6 !count_float (Numeric.Float_6 1);
!count_float;;
let incr_float seed =
match Hashtbl.find fresh_floats_db seed with
| f -> f
| exception Not_found ->
let prev = !count_float in
count_float := float_Add_6_6 !count_float (float_Create_6 1);
let f = !count_float in
Hashtbl.add fresh_floats_db seed f;
f
;;

let now_UTCTimestamp () =
Time_defaults_current_time.get_current_utctimestamp ()
[@@opaque] [@@logic]
let incr_UTCTimestamp seed =
match Hashtbl.find fresh_now_db seed with
| n -> n
| exception Not_found ->
let prev = !count_now in
count_now := get_current_utctimestamp ();
let n = !count_now in
Hashtbl.add fresh_now_db seed n;
n
;;

[@@@logic]

[@@@logic]
5 changes: 5 additions & 0 deletions src-core-time-defaults-pp/time_defaults_json.iml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ let utctimestamp_opt_to_json = utctimestamp_milli_opt_to_json;;
let utctimeonly_to_json = utctimeonly_milli_to_json;;

let utctimeonly_opt_to_json = utctimeonly_milli_opt_to_json;;

let utctimestamp_decoder = utctimestamp_milli_decoder;;

let utctimeonly_decoder = utctimeonly_milli_decoder;;

[@@@logic]
12 changes: 6 additions & 6 deletions src-model/src-conversions/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(library
(name conversions)
(public_name fix-engine.conversions)
(wrapped false)
(flags
(:standard -open Imandra_prelude -warn-error -A+8+39 -alert -deprecated -w -33-58))
(libraries imandra-prelude protocol_exts venue_types))
(name conversions)
(public_name fix-engine.conversions)
(wrapped false)
(flags (:standard -open Imandra_prelude -warn-error -A+8+39 -alert -deprecated -w -33-58))
(libraries imandra-prelude protocol_exts venue_strings_venue venue_types)
)
360 changes: 273 additions & 87 deletions src-model/src-conversions/enum_converter.iml

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src-model/src-conversions/record_converter.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* Imandra Inc. copyright 2020 *)
[@@@program]
(* Imandra Inc. copyright 2021 *)


[@@@logic]
Loading