Skip to content

Commit

Permalink
Update test; add better error messages to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Jul 26, 2024
1 parent 27180f4 commit a9db2ef
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions tests/SIL.Machine.Tests/Corpora/UsfmMemoryTextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ public void GetRows_VerseDescriptiveTitle()
{
Assert.That(rows, Has.Length.EqualTo(1));

Assert.That(rows[0].Ref, Is.EqualTo(ScriptureRef.Parse("MAT 1:1")));
Assert.That(rows[0].Text, Is.EqualTo("Descriptive title"));
Assert.That(
rows[0].Ref,
Is.EqualTo(ScriptureRef.Parse("MAT 1:1")),
string.Join(",", rows.ToList().Select(tr => tr.Text))
);
Assert.That(
rows[0].Text,
Is.EqualTo("Descriptive title"),
string.Join(",", rows.ToList().Select(tr => tr.Text))
);
});
}

Expand All @@ -44,8 +52,16 @@ public void GetRows_LastSegment()
{
Assert.That(rows, Has.Length.EqualTo(1));

Assert.That(rows[0].Ref, Is.EqualTo(ScriptureRef.Parse("MAT 1:1")));
Assert.That(rows[0].Text, Is.EqualTo("Last segment"));
Assert.That(
rows[0].Ref,
Is.EqualTo(ScriptureRef.Parse("MAT 1:1")),
string.Join(",", rows.ToList().Select(tr => tr.Text))
);
Assert.That(
rows[0].Text,
Is.EqualTo("Last segment"),
string.Join(",", rows.ToList().Select(tr => tr.Text))
);
});
}

Expand All @@ -67,7 +83,7 @@ public void GetRows_DuplicateVerseWithTable()
includeAllText: true
);

Assert.That(rows, Has.Length.EqualTo(5));
Assert.That(rows, Has.Length.EqualTo(5), string.Join(",", rows.ToList().Select(tr => tr.Text)));
}

[Test]
Expand All @@ -77,13 +93,19 @@ public void GetRows_TriplicateVerse()
@"\id MAT - Test
\c 1
\v 1 First verse
\rem non verse
\v 1 First verse
\rem non verse
\v 1 First verse
\v 2 Second verse
",
includeAllText: true
);

Assert.That(rows, Has.Length.EqualTo(1));
Assert.Multiple(() =>
{
Assert.That(rows[0].Text, Is.EqualTo("First verse"), string.Join(",", rows.ToList().Select(tr => tr.Text)));
Assert.That(rows, Has.Length.EqualTo(4), string.Join(",", rows.ToList().Select(tr => tr.Text)));
});
}

[Test]
Expand All @@ -104,7 +126,7 @@ public void GetRows_VersePara_BeginningNonVerseSegment()
includeAllText: true
);

Assert.That(rows, Has.Length.EqualTo(4));
Assert.That(rows, Has.Length.EqualTo(4), string.Join(",", rows.ToList().Select(tr => tr.Text)));
}

private static TextRow[] GetRows(string usfm, bool includeMarkers = false, bool includeAllText = false)
Expand Down

0 comments on commit a9db2ef

Please sign in to comment.