mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-22 21:07:43 +00:00
test: simplify proptest
This commit is contained in:
parent
fe12784fc3
commit
9d66aeb511
4 changed files with 23 additions and 16 deletions
|
@ -30,8 +30,8 @@ mod map_proptest {
|
|||
proptest! {
|
||||
#[test]
|
||||
fn insert(
|
||||
key in prop::collection::vec("[a-z]", 0..100),
|
||||
value in prop::collection::vec(gen_insert_value(), 0..100)
|
||||
key in prop::collection::vec("[a-z]", 0..22),
|
||||
value in prop::collection::vec(gen_insert_value(), 0..22)
|
||||
) {
|
||||
let mut loro = LoroCore::default();
|
||||
let accessor = loro.store.get_accessor();
|
||||
|
|
|
@ -545,40 +545,48 @@ mod find_common_ancestors_proptest {
|
|||
proptest! {
|
||||
#[test]
|
||||
fn test_2dags(
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(2), 0..300),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(2), 0..300)
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(2), 0..100),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(2), 0..100)
|
||||
) {
|
||||
test_single_common_ancestor(2, before_merged_insertions, after_merged_insertions)?;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_4dags(
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(4), 0..300),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(4), 0..300)
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(4), 0..100),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(4), 0..100)
|
||||
) {
|
||||
test_single_common_ancestor(4, before_merged_insertions, after_merged_insertions)?;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_10dags(
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(10), 0..300),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(10), 0..300)
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(10), 0..100),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(10), 0..100)
|
||||
) {
|
||||
test_single_common_ancestor(10, before_merged_insertions, after_merged_insertions)?;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mul_ancestors_5dags(
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(10), 0..100),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(10), 0..100)
|
||||
) {
|
||||
test_mul_ancestors::<2>(5, before_merged_insertions, after_merged_insertions)?;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mul_ancestors_10dags(
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(10), 0..300),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(10), 0..300)
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(10), 0..100),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(10), 0..100)
|
||||
) {
|
||||
test_mul_ancestors::<3>(10, before_merged_insertions, after_merged_insertions)?;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mul_ancestors_15dags_2(
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(15), 0..500),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(15), 0..500)
|
||||
before_merged_insertions in prop::collection::vec(gen_interaction(15), 0..50),
|
||||
after_merged_insertions in prop::collection::vec(gen_interaction(15), 0..50)
|
||||
) {
|
||||
test_mul_ancestors::<5>(15, before_merged_insertions, after_merged_insertions)?;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
use proptest::prop_compose;
|
||||
use rand::{rngs::StdRng, SeedableRng};
|
||||
|
||||
|
@ -343,7 +342,7 @@ mod notify_proptest {
|
|||
proptest! {
|
||||
#[test]
|
||||
fn test_notify(
|
||||
interactions in prop::collection::vec(gen_interaction(), 1..1000),
|
||||
interactions in prop::collection::vec(gen_interaction(), 1..100),
|
||||
) {
|
||||
test(&interactions);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ fn basic_string_op() {
|
|||
fn issue_0() {
|
||||
let mut tree: RleTree<CustomString, StringTreeTrait> = RleTree::default();
|
||||
let insert_keys = "0123456789abcdefghijklmnopq";
|
||||
for i in 0..(1e6 as usize) {
|
||||
for i in 0..(1e5 as usize) {
|
||||
let start = i % insert_keys.len();
|
||||
if i % 3 == 0 && tree.len() > 0 {
|
||||
let start = i % tree.len();
|
||||
|
@ -319,7 +319,7 @@ mod string_proptest {
|
|||
proptest! {
|
||||
#[test]
|
||||
fn test_tree_string_op_the_same(
|
||||
interactions in prop::collection::vec(gen_interaction(), 1..100),
|
||||
interactions in prop::collection::vec(gen_interaction(), 1..50),
|
||||
) {
|
||||
run_test(interactions);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue