From 69042fd599c2a965b9bc9d3eadc0acff314367a6 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Fri, 4 Mar 2022 12:26:22 +0100 Subject: Commit the translation of external.rs --- tests/misc/External.Funs.fst | 50 +++++++++++++++++++++++++++++++++++++++++ tests/misc/External.Opaque.fsti | 25 +++++++++++++++++++++ tests/misc/External.Types.fsti | 13 +++++++++++ 3 files changed, 88 insertions(+) create mode 100644 tests/misc/External.Funs.fst create mode 100644 tests/misc/External.Opaque.fsti create mode 100644 tests/misc/External.Types.fsti (limited to 'tests/misc') diff --git a/tests/misc/External.Funs.fst b/tests/misc/External.Funs.fst new file mode 100644 index 00000000..8030b838 --- /dev/null +++ b/tests/misc/External.Funs.fst @@ -0,0 +1,50 @@ +(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) +(** [external]: function definitions *) +module External.Funs +open Primitives +include External.Types +include External.Opaque + +#set-options "--z3rlimit 50 --fuel 0 --ifuel 1" + +(** [external::swap] *) +let swap_fwd (t : Type0) (x : t) (y : t) (st : state) : result (state & unit) = + begin match core_mem_swap_fwd t x y st with + | Fail -> Fail + | Return (st0, _) -> Return (st0, ()) + end + +(** [external::swap] *) +let swap_back + (t : Type0) (x : t) (y : t) (st : state) : result (state & (t & t)) = + begin match core_mem_swap_back0 t x y st with + | Fail -> Fail + | Return (st0, x0) -> + begin match core_mem_swap_back1 t x y st0 with + | Fail -> Fail + | Return (st1, x1) -> Return (st1, (x0, x1)) + end + end + +(** [external::test_new_non_zero_u32] *) +let test_new_non_zero_u32_fwd + (x : u32) (st : state) : result (state & core_num_nonzero_non_zero_u32_t) = + begin match core_num_nonzero_non_zero_u32_14_new_fwd x st with + | Fail -> Fail + | Return (st0, opt) -> + begin match + core_option_option_unwrap_fwd core_num_nonzero_non_zero_u32_t opt st0 + with + | Fail -> Fail + | Return (st1, cnnnzu) -> Return (st1, cnnnzu) + end + end + +(** [external::test_vec] *) +let test_vec_fwd (st : state) : result (state & unit) = + let v = vec_new u32 in + begin match vec_push_back u32 v 0 with + | Fail -> Fail + | Return _ -> Return (st, ()) + end + diff --git a/tests/misc/External.Opaque.fsti b/tests/misc/External.Opaque.fsti new file mode 100644 index 00000000..59c90b6b --- /dev/null +++ b/tests/misc/External.Opaque.fsti @@ -0,0 +1,25 @@ +(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) +(** [external]: opaque function definitions *) +module External.Opaque +open Primitives +include External.Types + +#set-options "--z3rlimit 50 --fuel 0 --ifuel 1" + +(** [core::mem::swap] *) +val core_mem_swap_fwd (t : Type0) : t -> t -> state -> result (state & unit) + +(** [core::mem::swap] *) +val core_mem_swap_back0 (t : Type0) : t -> t -> state -> result (state & t) + +(** [core::mem::swap] *) +val core_mem_swap_back1 (t : Type0) : t -> t -> state -> result (state & t) + +(** [core::num::nonzero::NonZeroU32::{14}::new] *) +val core_num_nonzero_non_zero_u32_14_new_fwd + : u32 -> state -> result (state & (option core_num_nonzero_non_zero_u32_t)) + +(** [core::option::Option::{0}::unwrap] *) +val core_option_option_unwrap_fwd + (t : Type0) : option t -> state -> result (state & t) + diff --git a/tests/misc/External.Types.fsti b/tests/misc/External.Types.fsti new file mode 100644 index 00000000..b8adf9bb --- /dev/null +++ b/tests/misc/External.Types.fsti @@ -0,0 +1,13 @@ +(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) +(** [external]: type definitions *) +module External.Types +open Primitives + +#set-options "--z3rlimit 50 --fuel 0 --ifuel 1" + +(** [core::num::nonzero::NonZeroU32] *) +val core_num_nonzero_non_zero_u32_t : Type0 + +(** The state type used in the state-error monad *) +val state : Type0 + -- cgit v1.2.3