| 123 | } // namespace |
| 124 | |
| 125 | BOOST_AUTO_TEST_CASE(depgraph_ser_tests) |
| 126 | { |
| 127 | // Empty cluster. |
| 128 | TestDepGraphSerialization<TestBitSet>( |
| 129 | {}, |
| 130 | "00" /* end of graph */); |
| 131 | |
| 132 | // Transactions: A(fee=0,size=1). |
| 133 | TestDepGraphSerialization<TestBitSet>( |
| 134 | {{{0, 1}, {}}}, |
| 135 | "01" /* A size */ |
| 136 | "00" /* A fee */ |
| 137 | "00" /* A insertion position (no skips): A */ |
| 138 | "00" /* end of graph */); |
| 139 | |
| 140 | // Transactions: A(fee=42,size=11), B(fee=-13,size=7), B depends on A. |
| 141 | TestDepGraphSerialization<TestBitSet>( |
| 142 | {{{42, 11}, {}}, {{-13, 7}, {0}}}, |
| 143 | "0b" /* A size */ |
| 144 | "54" /* A fee */ |
| 145 | "00" /* A insertion position (no skips): A */ |
| 146 | "07" /* B size */ |
| 147 | "19" /* B fee */ |
| 148 | "00" /* B->A dependency (no skips) */ |
| 149 | "00" /* B insertion position (no skips): A,B */ |
| 150 | "00" /* end of graph */); |
| 151 | |
| 152 | // Transactions: A(64,128), B(128,256), C(1,1), C depends on A and B. |
| 153 | TestDepGraphSerialization<TestBitSet>( |
| 154 | {{{64, 128}, {}}, {{128, 256}, {}}, {{1, 1}, {0, 1}}}, |
| 155 | "8000" /* A size */ |
| 156 | "8000" /* A fee */ |
| 157 | "00" /* A insertion position (no skips): A */ |
| 158 | "8100" /* B size */ |
| 159 | "8100" /* B fee */ |
| 160 | "01" /* B insertion position (skip B->A dependency): A,B */ |
| 161 | "01" /* C size */ |
| 162 | "02" /* C fee */ |
| 163 | "00" /* C->B dependency (no skips) */ |
| 164 | "00" /* C->A dependency (no skips) */ |
| 165 | "00" /* C insertion position (no skips): A,B,C */ |
| 166 | "00" /* end of graph */); |
| 167 | |
| 168 | // Transactions: A(-57,113), B(57,114), C(-58,115), D(58,116). Deps: B->A, C->A, D->C, in order |
| 169 | // [B,A,C,D]. This exercises non-topological ordering (internally serialized as A,B,C,D). |
| 170 | TestDepGraphSerialization<TestBitSet>( |
| 171 | {{{57, 114}, {1}}, {{-57, 113}, {}}, {{-58, 115}, {1}}, {{58, 116}, {2}}}, |
| 172 | "71" /* A size */ |
| 173 | "71" /* A fee */ |
| 174 | "00" /* A insertion position (no skips): A */ |
| 175 | "72" /* B size */ |
| 176 | "72" /* B fee */ |
| 177 | "00" /* B->A dependency (no skips) */ |
| 178 | "01" /* B insertion position (skip A): B,A */ |
| 179 | "73" /* C size */ |
| 180 | "73" /* C fee */ |
| 181 | "01" /* C->A dependency (skip C->B dependency) */ |
| 182 | "00" /* C insertion position (no skips): B,A,C */ |
nothing calls this directly
no test coverage detected