Skip to content
Snippets Groups Projects
Commit e6323e2e authored by Michele Alberti's avatar Michele Alberti
Browse files

Rework answer API.

parent df6536db
No related branches found
No related tags found
No related merge requests found
......@@ -515,7 +515,7 @@ let verify ?format query =
call_prover ~cwd ~limit main env query.prover config_prover driver
?dataset definitions task
in
Verification_types.Answer.make ~parent_query:(Some query) answer)
Verification_types.Answer.make ~query answer)
tasks)
mstr_theory
in
......
......@@ -108,7 +108,7 @@ module Query = struct
let make ~loadpath ?memlimit ?timelimit ?onnx_out_dir ?dataset prover
?prover_altern problem =
let id = "caisar_verification_query" in
let id = "query" in
let id =
Int.incr id_int;
id ^ Int.to_string !id_int
......@@ -164,7 +164,6 @@ module Query = struct
JSON file@]"))
| Some _ as output_file -> { query with output_file }
let get_id t = t.id
let pretty fmt = Fmt.fmt "%a" fmt pp
end
......@@ -175,6 +174,7 @@ module Answer = struct
type t = {
id : string;
query_id : string;
problem_answer : problem_answer;
}
[@@deriving to_yojson, show]
......@@ -207,16 +207,14 @@ module Answer = struct
}
[@@deriving to_yojson, show]
let make ~(parent_query : Query.t option) p =
let parent_query_id =
Option.value ~default:"" @@ Option.map ~f:Query.get_id parent_query
in
let id = "caisar_verification_answer" in
let make ~(query : Query.t) problem_answer =
let id = "answer" in
let id =
Int.incr id_int;
id ^ Int.to_string !id_int ^ parent_query_id
id ^ Int.to_string !id_int
in
{ id; problem_answer = p }
let query_id = query.id in
{ id; query_id; problem_answer }
let pretty fmt = Fmt.fmt "%a" fmt pp
end
......@@ -112,7 +112,6 @@ module Query : sig
@param timelimit is the timeout granted to the verification.
@param outfile is the output file to store the result of the query. *)
val get_id : t -> string
val memlimit_of_string : string -> int (* TO BE REMOVED *)
val timelimit_of_string : string -> int (* TO BE REMOVED *)
end
......@@ -121,6 +120,7 @@ end
module Answer : sig
type t = private {
id : string;
query_id : string;
problem_answer : problem_answer;
}
[@@deriving to_yojson, show]
......@@ -152,6 +152,6 @@ module Answer : sig
}
[@@deriving to_yojson, show]
val make : parent_query:Query.t option -> problem_answer -> t
val make : query:Query.t -> problem_answer -> t
val pretty : Format.formatter -> t -> unit
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment