(t *testing.T)
| 213 | } |
| 214 | |
| 215 | func TestChildrenOrder(t *testing.T) { |
| 216 | enc := newEncoder() |
| 217 | root := enc.newNode(1) |
| 218 | root.meta = 0 |
| 219 | for i := 1; i <= 10; i++ { |
| 220 | n := enc.newNode(1) |
| 221 | n.meta = uint64(i) |
| 222 | enc.addChildren(root, n) |
| 223 | } |
| 224 | |
| 225 | stepMom := enc.newNode(1) |
| 226 | stepMom.meta = 100 |
| 227 | for i := 11; i <= 20; i++ { |
| 228 | n := enc.newNode(1) |
| 229 | n.meta = uint64(i) |
| 230 | enc.addChildren(stepMom, n) |
| 231 | } |
| 232 | enc.addChildren(root, stepMom.child) |
| 233 | |
| 234 | stepDad := enc.newNode(1) |
| 235 | stepDad.meta = 101 |
| 236 | { |
| 237 | n := enc.newNode(1) |
| 238 | n.meta = uint64(21) |
| 239 | enc.addChildren(stepDad, n) |
| 240 | } |
| 241 | enc.addChildren(root, stepDad.child) |
| 242 | |
| 243 | enc.fixOrder(root) |
| 244 | enc.fixOrder(root) // Another time just to ensure it still works. |
| 245 | |
| 246 | child := root.child |
| 247 | for i := 1; i <= 21; i++ { |
| 248 | require.Equal(t, uint64(i), child.meta&^visitedBit) |
| 249 | child = child.next |
| 250 | } |
| 251 | require.Nil(t, child) |
| 252 | } |
| 253 | |
| 254 | func TestMarshalTimeJson(t *testing.T) { |
| 255 | var timesToMarshal = []struct { |
nothing calls this directly
no test coverage detected