| 445 | } |
| 446 | |
| 447 | func TestNewBook(t *testing.T) { |
| 448 | testCases := []struct { |
| 449 | uuid string |
| 450 | label string |
| 451 | usn int |
| 452 | deleted bool |
| 453 | dirty bool |
| 454 | }{ |
| 455 | { |
| 456 | uuid: "b1-uuid", |
| 457 | label: "b1-label", |
| 458 | usn: 0, |
| 459 | deleted: false, |
| 460 | dirty: false, |
| 461 | }, |
| 462 | { |
| 463 | uuid: "b2-uuid", |
| 464 | label: "b2-label", |
| 465 | usn: 1008, |
| 466 | deleted: false, |
| 467 | dirty: true, |
| 468 | }, |
| 469 | } |
| 470 | |
| 471 | for idx, tc := range testCases { |
| 472 | got := NewBook(tc.uuid, tc.label, tc.usn, tc.deleted, tc.dirty) |
| 473 | |
| 474 | assert.Equal(t, got.UUID, tc.uuid, fmt.Sprintf("UUID mismatch for test case %d", idx)) |
| 475 | assert.Equal(t, got.Label, tc.label, fmt.Sprintf("Label mismatch for test case %d", idx)) |
| 476 | assert.Equal(t, got.USN, tc.usn, fmt.Sprintf("USN mismatch for test case %d", idx)) |
| 477 | assert.Equal(t, got.Deleted, tc.deleted, fmt.Sprintf("Deleted mismatch for test case %d", idx)) |
| 478 | assert.Equal(t, got.Dirty, tc.dirty, fmt.Sprintf("Dirty mismatch for test case %d", idx)) |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | func TestBookInsert(t *testing.T) { |
| 483 | testCases := []struct { |