diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-07 17:20:28 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-07 17:20:28 -0800 |
commit | 9c8aa3d684575b5b5f169b8f6aca75919283d251 (patch) | |
tree | 58bc8ca8407b18e5d708d3b68c1f506e29e88be4 /adenosine-pds/tests/test_repro_mst.rs | |
parent | 2f414df00e378728701e4061cdb3bebad5df798a (diff) | |
download | adenosine-9c8aa3d684575b5b5f169b8f6aca75919283d251.tar.gz adenosine-9c8aa3d684575b5b5f169b8f6aca75919283d251.zip |
pds: implement CAR import/export at repo level
Diffstat (limited to 'adenosine-pds/tests/test_repro_mst.rs')
-rw-r--r-- | adenosine-pds/tests/test_repro_mst.rs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/adenosine-pds/tests/test_repro_mst.rs b/adenosine-pds/tests/test_repro_mst.rs index 9a23c03..df88559 100644 --- a/adenosine-pds/tests/test_repro_mst.rs +++ b/adenosine-pds/tests/test_repro_mst.rs @@ -1,9 +1,26 @@ -use adenosine_pds::mst::repro_mst; +use adenosine_pds::RepoStore; use std::path::PathBuf; use std::str::FromStr; #[test] fn test_repro_mst() { - repro_mst(&PathBuf::from_str("./tests/example_repo.car").unwrap()).unwrap(); - repro_mst(&PathBuf::from_str("./tests/bigger.car").unwrap()).unwrap(); + let mut repo = RepoStore::open_ephemeral().unwrap(); + let cid = repo + .import_car_path( + &PathBuf::from_str("./tests/example_repo.car").unwrap(), + None, + ) + .unwrap(); + repo.verify_repo_mst(&cid).unwrap(); + let cid = repo + .import_car_path(&PathBuf::from_str("./tests/bigger.car").unwrap(), None) + .unwrap(); + repo.verify_repo_mst(&cid).unwrap(); + + // test round-tripping from export + let car_bytes = repo.export_car(&cid, None).unwrap(); + let mut other_repo = RepoStore::open_ephemeral().unwrap(); + let other_cid = other_repo.import_car_bytes(&car_bytes, None).unwrap(); + other_repo.verify_repo_mst(&cid).unwrap(); + assert_eq!(cid, other_cid); } |