public override void TestSetup()
		{
			base.TestSetup();
			m_dataSource = new TestChecksDataSource();
			m_dataSource.SetParameterValue("StylesInfo", stylesInfo);
			m_dataSource.SetParameterValue("SentenceFinalPunctuation", ".?!");
			m_check = new CapitalizationCheck(m_dataSource);
		}
		public override void TestSetup()
		{
			base.TestSetup();
			m_dataSource = new TestChecksDataSource();
			m_dataSource.SetParameterValue("StylesInfo", stylesInfo);
			m_check = new QuotationCheck(m_dataSource);
		}
Пример #3
0
        public void GetReferences_AdvancedVerseNumBetweenNotes()
        {
            TestChecksDataSource dataSource = new TestChecksDataSource();

            dataSource.SetParameterValue("PunctCheckLevel", "Advanced");

            PunctuationCheck check = new PunctuationCheck(dataSource);

            dataSource.m_tokens.Add(new DummyTextToken("Wow",
                                                       TextType.Verse, true, false, "Paragraph"));
            dataSource.m_tokens.Add(new DummyTextToken("I am a note.",
                                                       TextType.Note, true, true, "Note General Paragraph"));
            dataSource.m_tokens.Add(new DummyTextToken("17",
                                                       TextType.VerseNumber, true, false, "Paragraph"));
            dataSource.m_tokens.Add(new DummyTextToken("\"I am a quote note!\"",
                                                       TextType.Note, true, true, "Note General Paragraph"));
            List <TextTokenSubstring> tokens =
                check.GetReferences(dataSource.TextTokens(), string.Empty);

            Assert.AreEqual(3, tokens.Count);

            Assert.AreEqual("._", tokens[0].InventoryText);
            Assert.AreEqual(11, tokens[0].Offset);
            Assert.AreEqual("I am a note.", tokens[0].FirstToken.Text);

            Assert.AreEqual("_\"", tokens[1].InventoryText);
            Assert.AreEqual(0, tokens[1].Offset);
            Assert.AreEqual("\"I am a quote note!\"", tokens[1].FirstToken.Text);

            Assert.AreEqual("!\"_", tokens[2].InventoryText);
            Assert.AreEqual(18, tokens[2].Offset);
            Assert.AreEqual("\"I am a quote note!\"", tokens[2].FirstToken.Text);
        }
Пример #4
0
        public void GetReferences_AdvancedDoubleStraightQuoteAfterVerseNum()
        {
            TestChecksDataSource dataSource = new TestChecksDataSource();

            dataSource.SetParameterValue("PunctCheckLevel", "Advanced");

            PunctuationCheck check = new PunctuationCheck(dataSource);

            dataSource.m_tokens.Add(new DummyTextToken("Wow.",
                                                       TextType.Verse, true, false, "Paragraph"));
            dataSource.m_tokens.Add(new DummyTextToken("17",
                                                       TextType.VerseNumber, true, false, "Paragraph"));
            dataSource.m_tokens.Add(new DummyTextToken("\"Word",
                                                       TextType.Verse, false, false, "Paragraph"));
            List <TextTokenSubstring> tokens =
                check.GetReferences(dataSource.TextTokens(), string.Empty);

            Assert.AreEqual(2, tokens.Count);

            Assert.AreEqual("._", tokens[0].InventoryText);
            Assert.AreEqual(3, tokens[0].Offset);
            Assert.AreEqual("Wow.", tokens[0].FirstToken.Text);

            Assert.AreEqual("_\"", tokens[1].InventoryText);
            Assert.AreEqual(0, tokens[1].Offset);
            Assert.AreEqual("\"Word", tokens[1].FirstToken.Text);
        }
        public void OpenParenFollowedByParaStartingWithVerseNum()
        {
            m_dataSource.SetParameterValue("MatchedPairs", MatchedPairsCheckUnitTest_Usfm.kMatchedPairXml1);

            m_dataSource.m_tokens.Add(new DummyTextToken("This is nice (and by nice, I mean",
                                                         TextType.Verse, true, false, "Paragraph"));
            m_dataSource.m_tokens.Add(new DummyTextToken("17",
                                                         TextType.VerseNumber, true, false, "Paragraph"));
            m_dataSource.m_tokens.Add(new DummyTextToken(" really, super nice). Amen?",
                                                         TextType.Verse, false, false, "Paragraph"));

            m_check.Check(m_dataSource.TextTokens(), RecordError);

            Assert.AreEqual(2, m_errors.Count);
            CheckError(0, m_dataSource.m_tokens[0].Text, 13, "(", "Unmatched punctuation");
            CheckError(1, m_dataSource.m_tokens[2].Text, 19, ")", "Unmatched punctuation");
        }
 public override void TestSetup()
 {
     base.TestSetup();
     m_dataSource = new TestChecksDataSource();
     m_check      = new MatchedPairsCheck(m_dataSource);
     m_dataSource.SetParameterValue("PoeticStyles", "Citation Line1" +
                                    CheckUtils.kStyleNamesDelimiter.ToString() + "Citation Line2");
 }
Пример #7
0
        public void Basic()
        {
            m_dataSource.SetParameterValue("ValidCharacters", "a b c d e");

            m_dataSource.m_tokens.Add(new DummyTextToken("gha bcdefi",
                                                         TextType.Verse, true, false, "Paragraph"));
            m_check.Check(m_dataSource.TextTokens(), RecordError);

            Assert.AreEqual(4, m_errors.Count);
            CheckError(0, m_dataSource.m_tokens[0].Text, 0, "g", "Invalid or unknown character");
            CheckError(1, m_dataSource.m_tokens[0].Text, 1, "h", "Invalid or unknown character");
            CheckError(2, m_dataSource.m_tokens[0].Text, 8, "f", "Invalid or unknown character");
            CheckError(3, m_dataSource.m_tokens[0].Text, 9, "i", "Invalid or unknown character");
        }
		public override void TestSetup()
		{
			base.TestSetup();
			m_dataSource = new TestChecksDataSource();
			m_check = new MatchedPairsCheck(m_dataSource);
			m_dataSource.SetParameterValue("PoeticStyles", "Citation Line1" +
				CheckUtils.kStyleNamesDelimiter.ToString() + "Citation Line2");
		}
		public void GetReferences_AdvancedVerseNumBetweenNotes()
		{
			TestChecksDataSource dataSource = new TestChecksDataSource();
			dataSource.SetParameterValue("PunctCheckLevel", "Advanced");

			PunctuationCheck check = new PunctuationCheck(dataSource);
			dataSource.m_tokens.Add(new DummyTextToken("Wow",
				TextType.Verse, true, false, "Paragraph"));
			dataSource.m_tokens.Add(new DummyTextToken("I am a note.",
				TextType.Note, true, true, "Note General Paragraph"));
			dataSource.m_tokens.Add(new DummyTextToken("17",
				TextType.VerseNumber, true, false, "Paragraph"));
			dataSource.m_tokens.Add(new DummyTextToken("\"I am a quote note!\"",
				TextType.Note, true, true, "Note General Paragraph"));
			List<TextTokenSubstring> tokens =
				check.GetReferences(dataSource.TextTokens(), string.Empty);
			Assert.AreEqual(3, tokens.Count);

			Assert.AreEqual("._", tokens[0].InventoryText);
			Assert.AreEqual(11, tokens[0].Offset);
			Assert.AreEqual("I am a note.", tokens[0].FirstToken.Text);

			Assert.AreEqual("_\"", tokens[1].InventoryText);
			Assert.AreEqual(0, tokens[1].Offset);
			Assert.AreEqual("\"I am a quote note!\"", tokens[1].FirstToken.Text);

			Assert.AreEqual("!\"_", tokens[2].InventoryText);
			Assert.AreEqual(18, tokens[2].Offset);
			Assert.AreEqual("\"I am a quote note!\"", tokens[2].FirstToken.Text);
		}
Пример #10
0
		public void GetReferences_AdvancedDoubleStraightQuoteAfterVerseNum()
		{
			TestChecksDataSource dataSource = new TestChecksDataSource();
			dataSource.SetParameterValue("PunctCheckLevel", "Advanced");

			PunctuationCheck check = new PunctuationCheck(dataSource);
			dataSource.m_tokens.Add(new DummyTextToken("Wow.",
				TextType.Verse, true, false, "Paragraph"));
			dataSource.m_tokens.Add(new DummyTextToken("17",
				TextType.VerseNumber, true, false, "Paragraph"));
			dataSource.m_tokens.Add(new DummyTextToken("\"Word",
				TextType.Verse, false, false, "Paragraph"));
			List<TextTokenSubstring> tokens =
				check.GetReferences(dataSource.TextTokens(), string.Empty);
			Assert.AreEqual(2, tokens.Count);

			Assert.AreEqual("._", tokens[0].InventoryText);
			Assert.AreEqual(3, tokens[0].Offset);
			Assert.AreEqual("Wow.", tokens[0].FirstToken.Text);

			Assert.AreEqual("_\"", tokens[1].InventoryText);
			Assert.AreEqual(0, tokens[1].Offset);
			Assert.AreEqual("\"Word", tokens[1].FirstToken.Text);
		}