summaryrefslogtreecommitdiff
path: root/tests/fstar/misc/External.Funs.fst
diff options
context:
space:
mode:
authorSon Ho2024-04-25 16:07:56 +0200
committerSon Ho2024-04-25 16:07:56 +0200
commit078b7f59ddfcb12a7b4c69f0a51bfd57cb391ddf (patch)
treeed45664329e24d1773be6c8bcaf827e2adbd3f65 /tests/fstar/misc/External.Funs.fst
parent1728dced8484befe35ef61fdf4ccd62b93fbb19d (diff)
parenta3e38d5f47e4780768902e49e28e471e38efd40a (diff)
Merge branch 'main' into core-option-unwrap
Diffstat (limited to '')
-rw-r--r--tests/fstar/misc/External.Funs.fst64
1 files changed, 21 insertions, 43 deletions
diff --git a/tests/fstar/misc/External.Funs.fst b/tests/fstar/misc/External.Funs.fst
index d4247b8f..d8457ce3 100644
--- a/tests/fstar/misc/External.Funs.fst
+++ b/tests/fstar/misc/External.Funs.fst
@@ -7,48 +7,26 @@ include External.FunsExternal
#set-options "--z3rlimit 50 --fuel 1 --ifuel 1"
-(** [external::swap]:
- Source: 'src/external.rs', lines 6:0-6:46 *)
-let swap (t : Type0) (x : t) (y : t) (st : state) : result (state & (t & t)) =
- core_mem_swap t x y st
-
-(** [external::test_new_non_zero_u32]:
- Source: 'src/external.rs', lines 11:0-11:60 *)
-let test_new_non_zero_u32
- (x : u32) (st : state) : result (state & core_num_nonzero_NonZeroU32_t) =
- let* (st1, o) = core_num_nonzero_NonZeroU32_new x st in
- core_option_Option_unwrap core_num_nonzero_NonZeroU32_t o st1
-
-(** [external::test_vec]:
- Source: 'src/external.rs', lines 17:0-17:17 *)
-let test_vec : result unit =
- let* _ = alloc_vec_Vec_push u32 (alloc_vec_Vec_new u32) 0 in Ok ()
-
-(** Unit test for [external::test_vec] *)
-let _ = assert_norm (test_vec = Ok ())
-
-(** [external::custom_swap]:
- Source: 'src/external.rs', lines 24:0-24:66 *)
-let custom_swap
- (t : Type0) (x : t) (y : t) (st : state) :
- result (state & (t & (t -> state -> result (state & (t & t)))))
+(** Trait implementation: [core::marker::{(core::marker::Copy for u32)#40}]
+ Source: '/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/marker.rs', lines 47:29-47:65
+ Name pattern: core::marker::Copy<u32> *)
+let core_marker_CopyU32 : core_marker_Copy_t u32 = {
+ cloneCloneInst = core_clone_CloneU32;
+}
+
+(** [external::use_get]:
+ Source: 'src/external.rs', lines 5:0-5:37 *)
+let use_get (rc : core_cell_Cell_t u32) (st : state) : result (state & u32) =
+ core_cell_Cell_get u32 core_marker_CopyU32 rc st
+
+(** [external::incr]:
+ Source: 'src/external.rs', lines 9:0-9:31 *)
+let incr
+ (rc : core_cell_Cell_t u32) (st : state) :
+ result (state & (core_cell_Cell_t u32))
=
- let* (st1, (x1, y1)) = core_mem_swap t x y st in
- let back = fun ret st2 -> Ok (st2, (ret, y1)) in
- Ok (st1, (x1, back))
-
-(** [external::test_custom_swap]:
- Source: 'src/external.rs', lines 29:0-29:59 *)
-let test_custom_swap
- (x : u32) (y : u32) (st : state) : result (state & (u32 & u32)) =
- let* (st1, (_, custom_swap_back)) = custom_swap u32 x y st in
- let* (_, (x1, y1)) = custom_swap_back 1 st1 in
- Ok (st1, (x1, y1))
-
-(** [external::test_swap_non_zero]:
- Source: 'src/external.rs', lines 35:0-35:44 *)
-let test_swap_non_zero (x : u32) (st : state) : result (state & u32) =
- let* (st1, p) = swap u32 x 0 st in
- let (x1, _) = p in
- if x1 = 0 then Fail Failure else Ok (st1, x1)
+ let* (st1, (i, get_mut_back)) = core_cell_Cell_get_mut u32 rc st in
+ let* i1 = u32_add i 1 in
+ let* (_, rc1) = get_mut_back i1 st1 in
+ Ok (st1, rc1)