Exemplo n.º 1
0
		public void ParseCharString_IgnoreDigraph()
		{
			DummyCharPropEngine cpe = new DummyCharPropEngine();
			List<string> validChars = TsStringUtils.ParseCharString("ch a c", " ", cpe);
			Assert.AreEqual(2, validChars.Count);
			Assert.AreEqual("a", validChars[0]);
			Assert.AreEqual("c", validChars[1]);
		}
Exemplo n.º 2
0
        public void ParseCharString_IgnoreDigraph()
        {
            DummyCharPropEngine cpe        = new DummyCharPropEngine();
            List <string>       validChars = TsStringUtils.ParseCharString("ch a c", " ", cpe);

            Assert.AreEqual(2, validChars.Count);
            Assert.AreEqual("a", validChars[0]);
            Assert.AreEqual("c", validChars[1]);
        }
		public void GetValidCharsForLocale_Digraph()
		{
			DummyICU icu = new DummyICU();
			DummyCharPropEngine cpe = new DummyCharPropEngine();
			icu.m_icu.SetupResultForParams("GetExemplarCharacters", "[{ch}]", "qwe");
			ReflectionHelper.SetField(typeof(ExemplarCharactersHelper), "s_ICU", icu);
			Assert.AreEqual("  ", ExemplarCharactersHelper.GetValidCharsForLocale("qwe", cpe));
			icu.m_icu.Verify();
			cpe.Verify();
		}
        public void GetValidCharsForLocale_Digraph()
        {
            DummyICU            icu = new DummyICU();
            DummyCharPropEngine cpe = new DummyCharPropEngine();

            icu.m_icu.SetupResultForParams("GetExemplarCharacters", "[{ch}]", "qwe");
            ReflectionHelper.SetField(typeof(ExemplarCharactersHelper), "s_ICU", icu);
            Assert.AreEqual("  ", ExemplarCharactersHelper.GetValidCharsForLocale("qwe", cpe));
            icu.m_icu.Verify();
            cpe.Verify();
        }
		public void GetValidCharsForLocale_Complex()
		{
			DummyICU icu = new DummyICU();
			DummyCharPropEngine cpe = new DummyCharPropEngine();
			icu.m_icu.SetupResultForParams("GetExemplarCharacters", "[a-c {ch} de f-g e\u0301 \u0301]", "qwe");
			ReflectionHelper.SetField(typeof(ExemplarCharactersHelper), "s_ICU", icu);
			Assert.AreEqual("  a b c f g e\u0301 A B C F G E\u0301",
				ExemplarCharactersHelper.GetValidCharsForLocale("qwe", cpe));
			icu.m_icu.Verify();
			cpe.Verify();
		}
        public void GetValidCharsForLocale_Complex()
        {
            DummyICU            icu = new DummyICU();
            DummyCharPropEngine cpe = new DummyCharPropEngine();

            icu.m_icu.SetupResultForParams("GetExemplarCharacters", "[a-c {ch} de f-g e\u0301 \u0301]", "qwe");
            ReflectionHelper.SetField(typeof(ExemplarCharactersHelper), "s_ICU", icu);
            Assert.AreEqual("  a b c f g e\u0301 A B C F G E\u0301",
                            ExemplarCharactersHelper.GetValidCharsForLocale("qwe", cpe));
            icu.m_icu.Verify();
            cpe.Verify();
        }
Exemplo n.º 7
0
		public void ParseCharString_BogusDigraph()
		{
			DummyCharPropEngine cpe = new DummyCharPropEngine();
			List<string> invalidChars;
			List<string> validChars = TsStringUtils.ParseCharString("ch a b c", " ", cpe,
				out invalidChars);
			Assert.AreEqual(3, validChars.Count);
			Assert.AreEqual("a", validChars[0]);
			Assert.AreEqual("b", validChars[1]);
			Assert.AreEqual("c", validChars[2]);
			Assert.AreEqual(1, invalidChars.Count);
			Assert.AreEqual("ch", invalidChars[0]);
		}
Exemplo n.º 8
0
        public void ParseCharString_BogusDigraph()
        {
            DummyCharPropEngine cpe = new DummyCharPropEngine();
            List <string>       invalidChars;
            List <string>       validChars = TsStringUtils.ParseCharString("ch a b c", " ", cpe,
                                                                           out invalidChars);

            Assert.AreEqual(3, validChars.Count);
            Assert.AreEqual("a", validChars[0]);
            Assert.AreEqual("b", validChars[1]);
            Assert.AreEqual("c", validChars[2]);
            Assert.AreEqual(1, invalidChars.Count);
            Assert.AreEqual("ch", invalidChars[0]);
        }
Exemplo n.º 9
0
		public void GetNaturalCharType()
		{
			ValidCharacters validChars = ValidCharacters.Load(string.Empty, "Test WS", null);
			DummyCharPropEngine cpe = new DummyCharPropEngine();
			ReflectionHelper.SetField(validChars, "m_cpe", cpe);
			Assert.AreEqual(ValidCharacterType.WordForming,
				ReflectionHelper.GetResult(validChars, "GetNaturalCharType", (int)'a'));
			Assert.AreEqual(ValidCharacterType.WordForming,
				ReflectionHelper.GetResult(validChars, "GetNaturalCharType", 0x00B2));
			Assert.AreEqual(ValidCharacterType.WordForming,
				ReflectionHelper.GetResult(validChars, "GetNaturalCharType", 0x2079));
			Assert.AreEqual(ValidCharacterType.Numeric,
				ReflectionHelper.GetResult(validChars, "GetNaturalCharType", (int)'1'));
			Assert.AreEqual(ValidCharacterType.Other,
				ReflectionHelper.GetResult(validChars, "GetNaturalCharType", (int)' '));
		}