Fixing CRDT tests
This commit is contained in:
@@ -109,6 +109,12 @@ pub fn derive_json_crdt(input: OgTokenStream) -> OgTokenStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// I'm pulling this out so that we can see actual CRD content in debug output.
|
||||||
|
//
|
||||||
|
// The plan is to mostly get rid of the macros anyway, so it's a reasonable first step.
|
||||||
|
// It could (alternately) be just as good to keep the macros and change this function to
|
||||||
|
// output actual field content instead of just field names.
|
||||||
|
//
|
||||||
// impl #impl_generics std::fmt::Debug for #ident #ty_generics #where_clause {
|
// impl #impl_generics std::fmt::Debug for #ident #ty_generics #where_clause {
|
||||||
// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
// let mut fields = Vec::new();
|
// let mut fields = Vec::new();
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_derive_basic() {
|
fn test_derive_basic() {
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Player {
|
struct Player {
|
||||||
x: LwwRegisterCrdt<f64>,
|
x: LwwRegisterCrdt<f64>,
|
||||||
y: LwwRegisterCrdt<f64>,
|
y: LwwRegisterCrdt<f64>,
|
||||||
@@ -564,14 +564,14 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_derive_nested() {
|
fn test_derive_nested() {
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Position {
|
struct Position {
|
||||||
x: LwwRegisterCrdt<f64>,
|
x: LwwRegisterCrdt<f64>,
|
||||||
y: LwwRegisterCrdt<f64>,
|
y: LwwRegisterCrdt<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Player {
|
struct Player {
|
||||||
pos: Position,
|
pos: Position,
|
||||||
balance: LwwRegisterCrdt<f64>,
|
balance: LwwRegisterCrdt<f64>,
|
||||||
@@ -589,7 +589,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_lww_ops() {
|
fn test_lww_ops() {
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Test {
|
struct Test {
|
||||||
a: LwwRegisterCrdt<f64>,
|
a: LwwRegisterCrdt<f64>,
|
||||||
b: LwwRegisterCrdt<bool>,
|
b: LwwRegisterCrdt<bool>,
|
||||||
@@ -649,7 +649,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_vec_and_map_ops() {
|
fn test_vec_and_map_ops() {
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Test {
|
struct Test {
|
||||||
a: ListCrdt<String>,
|
a: ListCrdt<String>,
|
||||||
}
|
}
|
||||||
@@ -689,14 +689,14 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_causal_field_dependency() {
|
fn test_causal_field_dependency() {
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Item {
|
struct Item {
|
||||||
name: LwwRegisterCrdt<String>,
|
name: LwwRegisterCrdt<String>,
|
||||||
soulbound: LwwRegisterCrdt<bool>,
|
soulbound: LwwRegisterCrdt<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Player {
|
struct Player {
|
||||||
inventory: ListCrdt<Item>,
|
inventory: ListCrdt<Item>,
|
||||||
balance: LwwRegisterCrdt<f64>,
|
balance: LwwRegisterCrdt<f64>,
|
||||||
@@ -755,7 +755,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_2d_grid() {
|
fn test_2d_grid() {
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Game {
|
struct Game {
|
||||||
grid: ListCrdt<ListCrdt<LwwRegisterCrdt<bool>>>,
|
grid: ListCrdt<ListCrdt<LwwRegisterCrdt<bool>>>,
|
||||||
}
|
}
|
||||||
@@ -816,7 +816,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_arb_json() {
|
fn test_arb_json() {
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Test {
|
struct Test {
|
||||||
reg: LwwRegisterCrdt<JsonValue>,
|
reg: LwwRegisterCrdt<JsonValue>,
|
||||||
}
|
}
|
||||||
@@ -852,13 +852,13 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_wrong_json_types() {
|
fn test_wrong_json_types() {
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Nested {
|
struct Nested {
|
||||||
list: ListCrdt<f64>,
|
list: ListCrdt<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Test {
|
struct Test {
|
||||||
reg: LwwRegisterCrdt<bool>,
|
reg: LwwRegisterCrdt<bool>,
|
||||||
strct: ListCrdt<Nested>,
|
strct: ListCrdt<Nested>,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use serde_json::json;
|
|||||||
// 5. block actual messages from honest actors (eclipse attack)
|
// 5. block actual messages from honest actors (eclipse attack)
|
||||||
|
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct ListExample {
|
struct ListExample {
|
||||||
list: ListCrdt<char>,
|
list: ListCrdt<char>,
|
||||||
}
|
}
|
||||||
@@ -91,13 +91,13 @@ fn test_forge_update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Nested {
|
struct Nested {
|
||||||
a: Nested2,
|
a: Nested2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode)]
|
#[derive(Clone, CrdtNode, Debug)]
|
||||||
struct Nested2 {
|
struct Nested2 {
|
||||||
b: LwwRegisterCrdt<bool>,
|
b: LwwRegisterCrdt<bool>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user