(t *testing.T)
| 391 | } |
| 392 | |
| 393 | func TestCheckpointHash(t *testing.T) { |
| 394 | // pre-define a certificate result object |
| 395 | result := &CertificateResult{ |
| 396 | RewardRecipients: &RewardRecipients{ |
| 397 | PaymentPercents: []*PaymentPercents{{ |
| 398 | Address: newTestAddressBytes(t), |
| 399 | Percent: 100, |
| 400 | }}, |
| 401 | }, |
| 402 | Orders: &Orders{ |
| 403 | LockOrders: []*LockOrder{ |
| 404 | { |
| 405 | OrderId: newTestOrderId(t, 0), |
| 406 | BuyerReceiveAddress: newTestAddressBytes(t), |
| 407 | BuyerChainDeadline: 0, |
| 408 | }, |
| 409 | }, |
| 410 | ResetOrders: [][]byte{newTestOrderId(t, 0)}, |
| 411 | CloseOrders: [][]byte{newTestOrderId(t, 1)}, |
| 412 | }, |
| 413 | Checkpoint: &Checkpoint{ |
| 414 | Height: 1, |
| 415 | BlockHash: []byte("hash"), |
| 416 | }, |
| 417 | } |
| 418 | // calculate expected |
| 419 | bz, err := Marshal(result) |
| 420 | require.NoError(t, err) |
| 421 | expected := crypto.Hash(bz) |
| 422 | // execute function call |
| 423 | got := result.Hash() |
| 424 | // compare got vs expected |
| 425 | require.Equal(t, expected, got) |
| 426 | } |
| 427 | |
| 428 | func TestCheckpointJSONHexEncoding(t *testing.T) { |
| 429 | original := &Checkpoint{ |
nothing calls this directly
no test coverage detected