MCPcopy Index your code
hub / github.com/dnote/dnote / TestNewBook

Function TestNewBook

pkg/cli/database/models_test.go:447–480  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

445}
446
447func 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
482func TestBookInsert(t *testing.T) {
483 testCases := []struct {

Callers

nothing calls this directly

Calls 2

EqualFunction · 0.92
NewBookFunction · 0.85

Tested by

no test coverage detected