From 6111c481fac3d5c305a379b3be8afb87190db3d5 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sun, 6 Nov 2022 21:44:13 -0800 Subject: iroh-car: move vendoring into sub-module of pds crate So we don't need to re-publish this as a separate crate. --- iroh-car/tests/car_file_test.rs | 74 ---------------------------------------- iroh-car/tests/carv1_basic.car | Bin 715 -> 0 bytes iroh-car/tests/testv1.car | Bin 5090 -> 0 bytes 3 files changed, 74 deletions(-) delete mode 100644 iroh-car/tests/car_file_test.rs delete mode 100644 iroh-car/tests/carv1_basic.car delete mode 100644 iroh-car/tests/testv1.car (limited to 'iroh-car/tests') diff --git a/iroh-car/tests/car_file_test.rs b/iroh-car/tests/car_file_test.rs deleted file mode 100644 index 28340d4..0000000 --- a/iroh-car/tests/car_file_test.rs +++ /dev/null @@ -1,74 +0,0 @@ -use futures::TryStreamExt; -use iroh_car::*; -use tokio::fs::{self, File}; -use tokio::io::BufReader; - -#[tokio::test] -async fn roundtrip_carv1_test_file() { - let file = File::open("tests/testv1.car").await.unwrap(); - let buf_reader = BufReader::new(file); - - let car_reader = CarReader::new(buf_reader).await.unwrap(); - let header = car_reader.header().clone(); - let files: Vec<_> = car_reader.stream().try_collect().await.unwrap(); - assert_eq!(files.len(), 35); - - let mut buffer = Vec::new(); - let mut writer = CarWriter::new(header, &mut buffer); - for (cid, data) in &files { - writer.write(*cid, data).await.unwrap(); - } - writer.finish().await.unwrap(); - - let file = fs::read("tests/testv1.car").await.unwrap(); - assert_eq!(file, buffer); -} - -#[tokio::test] -async fn roundtrip_carv1_basic_fixtures_file() { - let file = File::open("tests/carv1_basic.car").await.unwrap(); - let buf_reader = BufReader::new(file); - - let car_reader = CarReader::new(buf_reader).await.unwrap(); - let header = car_reader.header().clone(); - - assert_eq!( - car_reader.header().roots(), - [ - "bafyreihyrpefhacm6kkp4ql6j6udakdit7g3dmkzfriqfykhjw6cad5lrm" - .parse() - .unwrap(), - "bafyreidj5idub6mapiupjwjsyyxhyhedxycv4vihfsicm2vt46o7morwlm" - .parse() - .unwrap() - ] - ); - - let files: Vec<_> = car_reader.stream().try_collect().await.unwrap(); - assert_eq!(files.len(), 8); - - let cids = [ - "bafyreihyrpefhacm6kkp4ql6j6udakdit7g3dmkzfriqfykhjw6cad5lrm", - "QmNX6Tffavsya4xgBi2VJQnSuqy9GsxongxZZ9uZBqp16d", - "bafkreifw7plhl6mofk6sfvhnfh64qmkq73oeqwl6sloru6rehaoujituke", - "QmWXZxVQ9yZfhQxLD35eDR8LiMRsYtHxYqTFCBbJoiJVys", - "bafkreiebzrnroamgos2adnbpgw5apo3z4iishhbdx77gldnbk57d4zdio4", - "QmdwjhxpxzcMsR3qUuj7vUL8pbA7MgR3GAxWi2GLHjsKCT", - "bafkreidbxzk2ryxwwtqxem4l3xyyjvw35yu4tcct4cqeqxwo47zhxgxqwq", - "bafyreidj5idub6mapiupjwjsyyxhyhedxycv4vihfsicm2vt46o7morwlm", - ]; - - for (expected_cid, (cid, _)) in cids.iter().zip(&files) { - assert_eq!(*cid, expected_cid.parse().unwrap()); - } - - let mut buffer = Vec::new(); - let mut writer = CarWriter::new(header, &mut buffer); - for (cid, data) in &files { - writer.write(*cid, data).await.unwrap(); - } - writer.finish().await.unwrap(); - - let file = fs::read("tests/carv1_basic.car").await.unwrap(); - assert_eq!(file, buffer); -} diff --git a/iroh-car/tests/carv1_basic.car b/iroh-car/tests/carv1_basic.car deleted file mode 100644 index 48c67a3..0000000 Binary files a/iroh-car/tests/carv1_basic.car and /dev/null differ diff --git a/iroh-car/tests/testv1.car b/iroh-car/tests/testv1.car deleted file mode 100644 index cdc9a13..0000000 Binary files a/iroh-car/tests/testv1.car and /dev/null differ -- cgit v1.2.3