Ensure that the txIDx swap, less and len are properly implemented
(t *testing.T)
| 275 | |
| 276 | // Ensure that the txIDx swap, less and len are properly implemented |
| 277 | func TestTxidSorting(t *testing.T) { |
| 278 | require.NoError(t, quick.Check(func(a []uint64) bool { |
| 279 | var txids []common.Txid |
| 280 | for _, txid := range a { |
| 281 | txids = append(txids, common.Txid(txid)) |
| 282 | } |
| 283 | |
| 284 | sort.Sort(txIDx(txids)) |
| 285 | |
| 286 | var r []uint64 |
| 287 | for _, txid := range txids { |
| 288 | r = append(r, uint64(txid)) |
| 289 | } |
| 290 | |
| 291 | if !slices.IsSorted(r) { |
| 292 | t.Errorf("txids were not sorted correctly=%v", txids) |
| 293 | return false |
| 294 | } |
| 295 | |
| 296 | return true |
| 297 | }, nil)) |
| 298 | } |
| 299 | |
| 300 | // Ensure that a freelist can deserialize from a freelist page. |
| 301 | func TestFreelist_read(t *testing.T) { |