A bit of test variable renaming
This commit is contained in:
@@ -14,23 +14,23 @@ struct ListExample {
|
|||||||
fn test_valid_updates() {
|
fn test_valid_updates() {
|
||||||
// Insert to crdt.doc on local node, test applying the same operation to a remote node
|
// Insert to crdt.doc on local node, test applying the same operation to a remote node
|
||||||
// and check that the view is the same
|
// and check that the view is the same
|
||||||
let key = make_keypair();
|
let keypair1 = make_keypair();
|
||||||
let mut crdt = BaseCrdt::<ListExample>::new(&key);
|
let mut crdt1 = BaseCrdt::<ListExample>::new(&keypair1);
|
||||||
let _a = crdt.doc.list.insert(ROOT_ID, 'a').sign(&key);
|
let _a = crdt1.doc.list.insert(ROOT_ID, 'a').sign(&keypair1);
|
||||||
let _b = crdt.doc.list.insert(_a.id(), 'b').sign(&key);
|
let _b = crdt1.doc.list.insert(_a.id(), 'b').sign(&keypair1);
|
||||||
let _c = crdt.doc.list.insert(_b.id(), 'c').sign(&key);
|
let _c = crdt1.doc.list.insert(_b.id(), 'c').sign(&keypair1);
|
||||||
|
|
||||||
assert_eq!(crdt.doc.list.view(), vec!['a', 'b', 'c']);
|
assert_eq!(crdt1.doc.list.view(), vec!['a', 'b', 'c']);
|
||||||
|
|
||||||
let key2 = make_keypair();
|
let keypair2 = make_keypair();
|
||||||
let mut crdt2 = BaseCrdt::<ListExample>::new(&key2);
|
let mut crdt2 = BaseCrdt::<ListExample>::new(&keypair2);
|
||||||
crdt2.apply(_a.clone());
|
crdt2.apply(_a.clone());
|
||||||
crdt2.apply(_b);
|
crdt2.apply(_b);
|
||||||
crdt2.apply(_c.clone());
|
crdt2.apply(_c.clone());
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
crdt2.doc.list.view(),
|
crdt2.doc.list.view(),
|
||||||
crdt.doc.list.view(),
|
crdt1.doc.list.view(),
|
||||||
"views should be equal"
|
"views should be equal"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ fn test_valid_updates() {
|
|||||||
crdt2.apply(_a);
|
crdt2.apply(_a);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
crdt.doc.list.view(),
|
crdt1.doc.list.view(),
|
||||||
crdt2.doc.list.view(),
|
crdt2.doc.list.view(),
|
||||||
"views are still equal after repeated applies"
|
"views are still equal after repeated applies"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user