summaryrefslogtreecommitdiff
path: root/tests/src/hashmap.rs
diff options
context:
space:
mode:
authorGuillaume Boisseau2024-05-28 11:56:39 +0200
committerGitHub2024-05-28 11:56:39 +0200
commitef7792c106a1f33397c206fcb5124b5ddfe64378 (patch)
treea72fae46702fc4c2eb32e1361a2538eb7a5f5545 /tests/src/hashmap.rs
parent4f26c7f6f1e554d8ec2f46e868d5dc66c4160d16 (diff)
parentc4d2af051c18c4c81b1e57a45210c37c89c8330f (diff)
Merge pull request #213 from AeneasVerif/cleanup-tests
Diffstat (limited to '')
-rw-r--r--tests/src/hashmap.rs29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/src/hashmap.rs b/tests/src/hashmap.rs
index 4552e4f2..19832a84 100644
--- a/tests/src/hashmap.rs
+++ b/tests/src/hashmap.rs
@@ -1,9 +1,11 @@
+//@ charon-args=--opaque=utils
+//@ aeneas-args=-state -split-files
//@ [coq] aeneas-args=-use-fuel
-//@ aeneas-args=-split-files
//@ [fstar] aeneas-args=-decreases-clauses -template-clauses
//@ [lean] aeneas-args=-no-gen-lib-entry
// ^ the `-no-gen-lib-entry` is because we add a custom import in the Hashmap.lean file: we do not
// want to overwrite it.
+// Possible to add `--no-code-duplication` if we use the optimized MIR
// TODO: reactivate -test-trans-units
//! A hashmap implementation.
@@ -314,6 +316,31 @@ impl<T> HashMap<T> {
}
}
+// This is a module so we can tell charon to leave it opaque
+mod utils {
+ use crate::*;
+
+ /// Serialize a hash map - we don't have traits, so we fix the type of the
+ /// values (this is not the interesting part anyway)
+ pub(crate) fn serialize(_hm: HashMap<u64>) {
+ unimplemented!();
+ }
+ /// Deserialize a hash map - we don't have traits, so we fix the type of the
+ /// values (this is not the interesting part anyway)
+ pub(crate) fn deserialize() -> HashMap<u64> {
+ unimplemented!();
+ }
+}
+
+pub fn insert_on_disk(key: Key, value: u64) {
+ // Deserialize
+ let mut hm = utils::deserialize();
+ // Update
+ hm.insert(key, value);
+ // Serialize
+ utils::serialize(hm);
+}
+
/// I currently can't retrieve functions marked with the attribute #[test],
/// while I want to extract the unit tests and use the normalize on them,
/// so I have to define the test functions somewhere and call them from