mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-06 06:06:49 +00:00
Adds new dags for GHOSTDAG tests (formatted as json files). (#1187)
* Adds new dags for ghostdag tests. * Change the error msg for the number of tests (6 instead of 3). Co-authored-by: tal <tal@daglabs.com>
This commit is contained in:
parent
49b6cc6038
commit
d72f70fabe
@ -172,8 +172,8 @@ func TestGHOSTDAG(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if testsCounter != 3 {
|
||||
t.Fatalf("Expected 3 test files, ran %d instead", testsCounter)
|
||||
if testsCounter != 6 {
|
||||
t.Fatalf("Expected 6 test files, ran %d instead", testsCounter)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
132
domain/consensus/testdata/dags/dag3.json
vendored
Normal file
132
domain/consensus/testdata/dags/dag3.json
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
{
|
||||
"K": 3,
|
||||
"GenesisID": "0",
|
||||
"Blocks": [
|
||||
{
|
||||
"ID": "1",
|
||||
"ExpectedScore": 1,
|
||||
"ExpectedSelectedParent": "0",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"0"
|
||||
],
|
||||
"Parents": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "2",
|
||||
"ExpectedScore": 2,
|
||||
"ExpectedSelectedParent": "1",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"1"
|
||||
],
|
||||
"Parents": [
|
||||
"1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "3",
|
||||
"ExpectedScore": 2,
|
||||
"ExpectedSelectedParent": "1",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"1"
|
||||
],
|
||||
"Parents": [
|
||||
"1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "4",
|
||||
"ExpectedScore": 2,
|
||||
"ExpectedSelectedParent": "1",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"1"
|
||||
],
|
||||
"Parents": [
|
||||
"1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "5",
|
||||
"ExpectedScore": 5,
|
||||
"ExpectedSelectedParent": "4",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"4",
|
||||
"2",
|
||||
"3"
|
||||
],
|
||||
"Parents": [
|
||||
"4",
|
||||
"2",
|
||||
"3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "6",
|
||||
"ExpectedScore": 1,
|
||||
"ExpectedSelectedParent": "0",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"0"
|
||||
],
|
||||
"Parents": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "7",
|
||||
"ExpectedScore": 2,
|
||||
"ExpectedSelectedParent": "6",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"6"
|
||||
],
|
||||
"Parents": [
|
||||
"6"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "8",
|
||||
"ExpectedScore": 3,
|
||||
"ExpectedSelectedParent": "7",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"7"
|
||||
],
|
||||
"Parents": [
|
||||
"7"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "9",
|
||||
"ExpectedScore": 4,
|
||||
"ExpectedSelectedParent": "8",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"8"
|
||||
],
|
||||
"Parents": [
|
||||
"8"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "10",
|
||||
"ExpectedScore": 6,
|
||||
"ExpectedSelectedParent": "5",
|
||||
"ExpectedReds": ["6", "7", "8", "9"],
|
||||
"ExpectedBlues": [
|
||||
"5"
|
||||
],
|
||||
"Parents": [
|
||||
"5",
|
||||
"9"
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
121
domain/consensus/testdata/dags/dag4.json
vendored
Normal file
121
domain/consensus/testdata/dags/dag4.json
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
{
|
||||
"K": 2,
|
||||
"GenesisID": "0",
|
||||
"Blocks": [
|
||||
{
|
||||
"ID": "1",
|
||||
"ExpectedScore": 1,
|
||||
"ExpectedSelectedParent": "0",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"0"
|
||||
],
|
||||
"Parents": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "2",
|
||||
"ExpectedScore": 1,
|
||||
"ExpectedSelectedParent": "0",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"0"
|
||||
],
|
||||
"Parents": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "3",
|
||||
"ExpectedScore": 2,
|
||||
"ExpectedSelectedParent": "2",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"2"
|
||||
],
|
||||
"Parents": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "4",
|
||||
"ExpectedScore": 2,
|
||||
"ExpectedSelectedParent": "2",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"2"
|
||||
],
|
||||
"Parents": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "5",
|
||||
"ExpectedScore": 2,
|
||||
"ExpectedSelectedParent": "1",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"1"
|
||||
],
|
||||
"Parents": [
|
||||
"1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "6",
|
||||
"ExpectedScore": 5,
|
||||
"ExpectedSelectedParent": "5",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"5",
|
||||
"2",
|
||||
"4"
|
||||
],
|
||||
"Parents": [
|
||||
"4",
|
||||
"5"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "7",
|
||||
"ExpectedScore": 5,
|
||||
"ExpectedSelectedParent": "5",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"5",
|
||||
"2",
|
||||
"3"
|
||||
],
|
||||
"Parents": [
|
||||
"3",
|
||||
"5"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "8",
|
||||
"ExpectedScore": 3,
|
||||
"ExpectedSelectedParent": "3",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"3"
|
||||
],
|
||||
"Parents": [
|
||||
"3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "9",
|
||||
"ExpectedScore": 6,
|
||||
"ExpectedSelectedParent": "7",
|
||||
"ExpectedReds": ["4", "8", "6"],
|
||||
"ExpectedBlues": [
|
||||
"7"
|
||||
],
|
||||
"Parents": [
|
||||
"6","7","8"
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
93
domain/consensus/testdata/dags/dag5.json
vendored
Normal file
93
domain/consensus/testdata/dags/dag5.json
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
{
|
||||
"K": 3,
|
||||
"GenesisID": "0",
|
||||
"Blocks": [
|
||||
{
|
||||
"ID": "1",
|
||||
"ExpectedScore": 1,
|
||||
"ExpectedSelectedParent": "0",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"0"
|
||||
],
|
||||
"Parents": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "2",
|
||||
"ExpectedScore": 1,
|
||||
"ExpectedSelectedParent": "0",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"0"
|
||||
],
|
||||
"Parents": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "3",
|
||||
"ExpectedScore": 1,
|
||||
"ExpectedSelectedParent": "0",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"0"
|
||||
],
|
||||
"Parents": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "4",
|
||||
"ExpectedScore": 1,
|
||||
"ExpectedSelectedParent": "0",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"0"
|
||||
],
|
||||
"Parents": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "5",
|
||||
"ExpectedScore": 4,
|
||||
"ExpectedSelectedParent": "3",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"3", "1", "2"
|
||||
],
|
||||
"Parents": [
|
||||
"1",
|
||||
"2",
|
||||
"3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "6",
|
||||
"ExpectedScore": 5,
|
||||
"ExpectedSelectedParent": "4",
|
||||
"ExpectedReds": [],
|
||||
"ExpectedBlues": [
|
||||
"4", "1", "2", "3"
|
||||
],
|
||||
"Parents": [
|
||||
"1", "2", "3", "4"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "7",
|
||||
"ExpectedScore": 6,
|
||||
"ExpectedSelectedParent": "6",
|
||||
"ExpectedReds": ["5"],
|
||||
"ExpectedBlues": [
|
||||
"6"
|
||||
],
|
||||
"Parents": [
|
||||
"5",
|
||||
"6"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user