Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienFT committed Mar 11, 2024
1 parent 322af3f commit ead0bbc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/tests/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,33 @@ fn root_hash_similar_hashmap_db() {
assert_ne!(root_hash_1, root_hash_2);
}

#[test]
fn double_insert() {
let tempdir = tempfile::tempdir().unwrap();
let db = create_rocks_db(tempdir.path()).unwrap();
let config = BonsaiStorageConfig::default();
let mut bonsai_storage: BonsaiStorage<_, _, Pedersen> =
BonsaiStorage::new(RocksDB::new(&db, RocksDBConfig::default()), config).unwrap();
let mut id_builder = BasicIdBuilder::new();
let pair1 = (
vec![1, 2, 1],
Felt::from_hex("0x2acf9d2ae5a475818075672b04e317e9da3d5180fed2c5f8d6d8a5fd5a92257")
.unwrap(),
);
let bitvec = BitVec::from_vec(pair1.0.clone());
bonsai_storage.insert(&bitvec, &pair1.1).unwrap();
bonsai_storage.commit(id_builder.new_id()).unwrap();
let pair2 = (
vec![1, 2, 4],
Felt::from_hex("0x02808c7d8f3745e55655ad3f51f096d0c06a41f3d76caf96bad80f9be9ced171")
.unwrap(),
);
let bitvec = BitVec::from_vec(pair2.0.clone());
bonsai_storage.insert(&bitvec, &pair2.1).unwrap();
bonsai_storage.insert(&bitvec, &pair2.1).unwrap();

}

#[test]
fn get_changes() {
let tempdir = tempfile::tempdir().unwrap();
Expand Down

0 comments on commit ead0bbc

Please sign in to comment.