public void VerseToInt_LargeVerseNumber() { // Test a really large number that will pass the Int16.MaxValue int firstVerse, secondVerse; ScrReference.VerseToInt("5200000000000", out firstVerse, out secondVerse); Assert.AreEqual(999, firstVerse); Assert.AreEqual(999, secondVerse); // Test a verse number just under the limit ScrReference.VerseToInt("998", out firstVerse, out secondVerse); Assert.AreEqual(998, firstVerse); Assert.AreEqual(998, secondVerse); }
public void VerseToIntTest() { int nVerseStart, nVerseEnd; // Test invalid verse number strings ScrReference.VerseToInt("-12", out nVerseStart, out nVerseEnd); Assert.AreEqual(12, nVerseStart); Assert.AreEqual(12, nVerseEnd); ScrReference.VerseToInt("14-", out nVerseStart, out nVerseEnd); Assert.AreEqual(14, nVerseStart); Assert.AreEqual(14, nVerseEnd); ScrReference.VerseToInt("a3", out nVerseStart, out nVerseEnd); Assert.AreEqual(3, nVerseStart); Assert.AreEqual(3, nVerseEnd); ScrReference.VerseToInt("15b-a", out nVerseStart, out nVerseEnd); Assert.AreEqual(15, nVerseStart); Assert.AreEqual(15, nVerseEnd); ScrReference.VerseToInt("3bb", out nVerseStart, out nVerseEnd); Assert.AreEqual(3, nVerseStart); Assert.AreEqual(3, nVerseEnd); ScrReference.VerseToInt("0", out nVerseStart, out nVerseEnd); Assert.AreEqual(0, nVerseStart); Assert.AreEqual(0, nVerseEnd); ScrReference.VerseToInt(" 12", out nVerseStart, out nVerseEnd); Assert.AreEqual(12, nVerseStart); Assert.AreEqual(12, nVerseEnd); ScrReference.VerseToInt("14 ", out nVerseStart, out nVerseEnd); Assert.AreEqual(14, nVerseStart); Assert.AreEqual(14, nVerseEnd); ScrReference.VerseToInt("12-10", out nVerseStart, out nVerseEnd); Assert.AreEqual(12, nVerseStart); //Assert.AreEqual(12, nVerseEnd); // end verse set to 12 instead of 10 ScrReference.VerseToInt("139-1140", out nVerseStart, out nVerseEnd); Assert.AreEqual(139, nVerseStart); //Assert.AreEqual(139, nVerseEnd); // end verse set to 999 instead of 139 ScrReference.VerseToInt("177-140", out nVerseStart, out nVerseEnd); //Assert.AreEqual(140, nVerseStart); // start verse set to 177 instead of 140 Assert.AreEqual(140, nVerseEnd); //Review: should this be a requirement? // ScrReference.VerseToInt("177", out nVerseStart, out nVerseEnd); // Assert.AreEqual(0, nVerseStart); // 177 is out of range of valid verse numbers // Assert.AreEqual(0, nVerseEnd); ScrReference.VerseToInt(String.Empty, out nVerseStart, out nVerseEnd); Assert.AreEqual(0, nVerseStart); Assert.AreEqual(0, nVerseEnd); ScrReference.VerseToInt(String.Empty, out nVerseStart, out nVerseEnd); Assert.AreEqual(0, nVerseStart); Assert.AreEqual(0, nVerseEnd); // Test valid verse number strings ScrReference.VerseToInt("1a", out nVerseStart, out nVerseEnd); Assert.AreEqual(1, nVerseStart); Assert.AreEqual(1, nVerseEnd); ScrReference.VerseToInt("2a-3b", out nVerseStart, out nVerseEnd); Assert.AreEqual(2, nVerseStart); Assert.AreEqual(3, nVerseEnd); ScrReference.VerseToInt("4-5d", out nVerseStart, out nVerseEnd); Assert.AreEqual(4, nVerseStart); Assert.AreEqual(5, nVerseEnd); ScrReference.VerseToInt("6", out nVerseStart, out nVerseEnd); Assert.AreEqual(6, nVerseStart); Assert.AreEqual(6, nVerseEnd); ScrReference.VerseToInt("66", out nVerseStart, out nVerseEnd); Assert.AreEqual(66, nVerseStart); Assert.AreEqual(66, nVerseEnd); ScrReference.VerseToInt("176", out nVerseStart, out nVerseEnd); Assert.AreEqual(176, nVerseStart); Assert.AreEqual(176, nVerseEnd); //We expect this test to pass //RTL verse bridge should be valid syntax ScrReference.VerseToInt("6" + '\u200f' + "-" + '\u200f' + "8", out nVerseStart, out nVerseEnd); Assert.AreEqual(6, nVerseStart); Assert.AreEqual(8, nVerseEnd); }