Skip to content

Commit

Permalink
improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisonlabollita committed Aug 13, 2024
1 parent 6737fa3 commit 9c101ba
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ var contents []string = strings.Split(FileData, "\n")
var bib *BibEntry = CreateBibEntry(contents)

func TestAuthors(t *testing.T) {
if len(bib.authors) != 4 { // 4 Authors;
t.Errorf("Number of authors parsed %d, Number of authors expected %d", len(bib.authors), 4)
ExpectedAuthors := []string{"LastName1, FirstName1", "LastName2, FirstName2", "LastName3, FirstName3", "LastName4, FirstName4"}

if len(bib.authors) != len(ExpectedAuthors) {
t.Fatalf("Number of authors parsed %d, Number of authors expected %d", len(bib.authors), len(ExpectedAuthors))
}
authors := []string{"LastName1, FirstName1",
"LastName2, FirstName2",
"LastName3, FirstName3",
"LastName4, FirstName4"}
for i, a := range authors {
if a != bib.authors[i] {
t.Errorf("Author error: parsed %s, expected %s", bib.authors[i], a)
for i, expected := range ExpectedAuthors {
if bib.authors[i] != expected {
t.Errorf("Author mismatch at index %d: parsed %s, expected %s", i, bib.authors[i], expected)
}

}
Expand Down

0 comments on commit 9c101ba

Please sign in to comment.