Checks all characters to see if they are valid
Inheritance: IScrCheckInventory
Ejemplo n.º 1
0
        public void ParseCharacterSequences_Diacritics()
        {
            // Arabic letter alef with madda above
            // Arabic letter yeh with hamza above and immediately followed by a character without
            // diacritics (Arabic letter zain)
            string charsWithDiacritics = "\u0627\u0653 \u064A\u0654\u0632";

            // set up for this test.
            m_dataSource.m_tokens.Add(new DummyTextToken(charsWithDiacritics,
                                                         TextType.Verse, true, false, "Paragraph"));
            m_check = new CharactersCheck(m_dataSource);
            ReflectionHelper.SetField(m_check, "m_categorizer", m_dataSource.CharacterCategorizer);

            // Get the parsed character sequences.
            List <string> parsedChars = new List <string>();

            foreach (string character in ((CharactersCheck)m_check).ParseCharacterSequences(charsWithDiacritics))
            {
                parsedChars.Add(character);
            }

            // Confirm that we have four characters with the expected contents.
            Assert.AreEqual(4, parsedChars.Count, "We expected four characters");
            Assert.AreEqual("\u0627\u0653", parsedChars[0]);
            Assert.AreEqual(" ", parsedChars[1]);
            Assert.AreEqual("\u064A\u0654", parsedChars[2]);
            Assert.AreEqual("\u0632", parsedChars[3]);
        }
Ejemplo n.º 2
0
        void Test(string[] result, string text, string desiredKey)
        {
            m_UsfmDataSource.Text = text;

            CharactersCheck           check = new CharactersCheck(m_UsfmDataSource);
            List <TextTokenSubstring> tts   =
                check.GetReferences(m_UsfmDataSource.TextTokens(), desiredKey);

            Assert.AreEqual(result.GetUpperBound(0) + 1, tts.Count,
                            "A different number of results was returned than what was expected.");

            for (int i = 0; i <= result.GetUpperBound(0); ++i)
            {
                Assert.AreEqual(result[i], tts[i].InventoryText, "Result number: " + i.ToString());
            }
        }
Ejemplo n.º 3
0
 public override void TestSetup()
 {
     base.TestSetup();
     m_dataSource = new TestChecksDataSource();
     m_check      = new CharactersCheck(m_dataSource);
 }
Ejemplo n.º 4
0
		public override void TestSetup()
		{
			base.TestSetup();
			m_dataSource = new TestChecksDataSource();
			m_check = new CharactersCheck(m_dataSource);
		}
Ejemplo n.º 5
0
		void Test(string[] result, string text, string desiredKey)
		{
			m_UsfmDataSource.Text = text;

			CharactersCheck check = new CharactersCheck(m_UsfmDataSource);
			List<TextTokenSubstring> tts =
				check.GetReferences(m_UsfmDataSource.TextTokens(), desiredKey);

			Assert.AreEqual(result.GetUpperBound(0)+1, tts.Count,
				"A different number of results was returned than what was expected." );

			for (int i = 0; i <= result.GetUpperBound(0); ++i)
				Assert.AreEqual(result[i], tts[i].InventoryText, "Result number: " + i.ToString());
		}
Ejemplo n.º 6
0
		public void ParseCharacterSequences_Diacritics()
		{
			// Arabic letter alef with madda above
			// Arabic letter yeh with hamza above and immediately followed by a character without
			// diacritics (Arabic letter zain)
			string charsWithDiacritics = "\u0627\u0653 \u064A\u0654\u0632";

			// set up for this test.
			m_dataSource.m_tokens.Add(new DummyTextToken(charsWithDiacritics,
				TextType.Verse, true, false, "Paragraph"));
			m_check = new CharactersCheck(m_dataSource);
			ReflectionHelper.SetField(m_check, "m_categorizer", m_dataSource.CharacterCategorizer);

			// Get the parsed character sequences.
			List<string> parsedChars = new List<string>();
			foreach (string character in ((CharactersCheck)m_check).ParseCharacterSequences(charsWithDiacritics))
				parsedChars.Add(character);

			// Confirm that we have four characters with the expected contents.
			Assert.AreEqual(4, parsedChars.Count, "We expected four characters");
			Assert.AreEqual("\u0627\u0653", parsedChars[0]);
			Assert.AreEqual(" ", parsedChars[1]);
			Assert.AreEqual("\u064A\u0654", parsedChars[2]);
			Assert.AreEqual("\u0632", parsedChars[3]);
		}