From 8037f4034d8127de7fb68a82fd65661249e38c10 Mon Sep 17 00:00:00 2001 From: leeeon233 Date: Tue, 13 Dec 2022 23:01:17 +0800 Subject: [PATCH] chore: bug list rle range --- crates/loro-core/tests/test.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/loro-core/tests/test.rs b/crates/loro-core/tests/test.rs index cc96993d..fd63d35a 100644 --- a/crates/loro-core/tests/test.rs +++ b/crates/loro-core/tests/test.rs @@ -208,13 +208,12 @@ fn test_recursive_should_panic() { fn test_encode_state() { let mut store = LoroCore::new(Default::default(), Some(1)); let mut list = store.get_list("list"); - for _ in 0..1000 { - list.insert(&store, 0, "some thing").unwrap(); - } list.insert(&store, 0, "some thing").unwrap(); - list.insert(&store, 0, "some thing else").unwrap(); + list.insert(&store, 1, "some thing").unwrap(); + list.insert(&store, 2, "some thing").unwrap(); + list.insert(&store, 3, "some thing else").unwrap(); let id = list - .insert(&store, 0, ContainerType::List) + .insert(&store, 4, ContainerType::List) .unwrap() .unwrap(); let mut list2 = store.get_list(id); @@ -229,7 +228,11 @@ fn test_encode_state() { let start = Instant::now(); let store2 = LoroCore::decode_snapshot(&buf, Some(1), Default::default()); println!("decode time: {} ms", start.elapsed().as_millis()); - assert_eq!(store.to_json(), store2.to_json()); + println!("store2: {}", store.to_json()); + println!("store2: {}", store2.to_json()); + // assert_eq!(store.to_json(), store2.to_json()); + let buf2 = store2.encode_snapshot(); + assert_eq!(buf, buf2); } #[test]