예제 #1
0
        protected UnicodeIntSetType()
        {
            InitMainGeneralCategories();
            InitAscii();

            Symbol = MathSymbol
                     .Union(CurrencySymbol)
                     .Union(ModifierSymbol)
                     .Union(OtherSymbol);
            Punctuation = ConnectorPunctuation
                          .Union(DashPunctuation)
                          .Union(OpenPunctuation)
                          .Union(ClosePunctuation)
                          .Union(InitialQuotePunctuation)
                          .Union(FinalQuotePunctuation)
                          .Union(OtherPunctuation);
            Other = Control
                    .Union(Format)
                    .Union(Surrogate)
                    .Union(PrivateUse)
                    .Union(Unassigned);
            Separator = SpaceSeparator
                        .Union(LineSeparator)
                        .Union(ParagraphSeparator);
            Number = DecimalDigitNumber
                     .Union(LetterNumber)
                     .Union(OtherNumber);
            Mark = NonSpacingMark
                   .Union(SpacingCombiningMark)
                   .Union(EnclosingMark);
            CasedLetter = UppercaseLetter
                          .Union(LowercaseLetter)
                          .Union(TitlecaseLetter);
            Letter = CasedLetter
                     .Union(ModifierLetter)
                     .Union(OtherLetter);
        }
예제 #2
0
 public static void UppercaseLetterParserIncorrect()
 => AssertThat(() => UppercaseLetter.Parse("xyz")).ThrowsExactlyException <ParseException>();
예제 #3
0
 public static void UppercaseLetterParserCorrectAlphabetical()
 => AssertThat(UppercaseLetter.Parse("Xyz")).IsEqualTo('X');
예제 #4
0
 public void TestPositiveCategories()
 {
     Assert.AreEqual(UppercaseLetter.ToString(), UnicodeCategory(Categories.UppercaseLetter).ToString());
     Assert.AreEqual(LowercaseLetter.ToString(), UnicodeCategory(Categories.LowercaseLetter).ToString());
     Assert.AreEqual(TitlecaseLetter.ToString(), UnicodeCategory(Categories.TitlecaseLetter).ToString());
     Assert.AreEqual(ModifierLetter.ToString(), UnicodeCategory(Categories.ModifierLetter).ToString());
     Assert.AreEqual(OtherLetter.ToString(), UnicodeCategory(Categories.OtherLetter).ToString());
     Assert.AreEqual(Letter.ToString(), UnicodeCategory(Categories.Letter).ToString());
     Assert.AreEqual(NonspacingMark.ToString(), UnicodeCategory(Categories.NonspacingMark).ToString());
     Assert.AreEqual(SpacingCombiningMark.ToString(), UnicodeCategory(Categories.SpacingCombiningMark).ToString());
     Assert.AreEqual(EnclosingMark.ToString(), UnicodeCategory(Categories.EnclosingMark).ToString());
     Assert.AreEqual(Mark.ToString(), UnicodeCategory(Categories.Mark).ToString());
     Assert.AreEqual(DecimalDigitNumber.ToString(), UnicodeCategory(Categories.DecimalDigitNumber).ToString());
     Assert.AreEqual(LetterNumber.ToString(), UnicodeCategory(Categories.LetterNumber).ToString());
     Assert.AreEqual(OtherNumber.ToString(), UnicodeCategory(Categories.OtherNumber).ToString());
     Assert.AreEqual(Number.ToString(), UnicodeCategory(Categories.Number).ToString());
     Assert.AreEqual(ConnectorPunctuation.ToString(), UnicodeCategory(Categories.ConnectorPunctuation).ToString());
     Assert.AreEqual(DashPunctuation.ToString(), UnicodeCategory(Categories.DashPunctuation).ToString());
     Assert.AreEqual(OpenPunctuation.ToString(), UnicodeCategory(Categories.OpenPunctuation).ToString());
     Assert.AreEqual(ClosePunctuation.ToString(), UnicodeCategory(Categories.ClosePunctuation).ToString());
     Assert.AreEqual(InitialquotePunctuation.ToString(), UnicodeCategory(Categories.InitialquotePunctuation).ToString());
     Assert.AreEqual(FinalquotePunctuation.ToString(), UnicodeCategory(Categories.FinalquotePunctuation).ToString());
     Assert.AreEqual(OtherPunctuation.ToString(), UnicodeCategory(Categories.OtherPunctuation).ToString());
     Assert.AreEqual(Punctuation.ToString(), UnicodeCategory(Categories.Punctuation).ToString());
     Assert.AreEqual(MathSymbol.ToString(), UnicodeCategory(Categories.MathSymbol).ToString());
     Assert.AreEqual(CurrencySymbol.ToString(), UnicodeCategory(Categories.CurrencySymbol).ToString());
     Assert.AreEqual(ModifierSymbol.ToString(), UnicodeCategory(Categories.ModifierSymbol).ToString());
     Assert.AreEqual(OtherSymbol.ToString(), UnicodeCategory(Categories.OtherSymbol).ToString());
     Assert.AreEqual(Patterns.Unicode.Symbol.ToString(), UnicodeCategory(Categories.Symbol).ToString());
     Assert.AreEqual(SpaceSeparator.ToString(), UnicodeCategory(Categories.SpaceSeparator).ToString());
     Assert.AreEqual(LineSeparator.ToString(), UnicodeCategory(Categories.LineSeparator).ToString());
     Assert.AreEqual(ParagraphSeparator.ToString(), UnicodeCategory(Categories.ParagraphSeparator).ToString());
     Assert.AreEqual(Separator.ToString(), UnicodeCategory(Categories.Separator).ToString());
     Assert.AreEqual(Format.ToString(), UnicodeCategory(Categories.Format).ToString());
     Assert.AreEqual(Surrogate.ToString(), UnicodeCategory(Categories.Surrogate).ToString());
     Assert.AreEqual(PrivateUse.ToString(), UnicodeCategory(Categories.PrivateUse).ToString());
     Assert.AreEqual(NotAssigned.ToString(), UnicodeCategory(Categories.NotAssigned).ToString());
     Assert.AreEqual(OtherControl.ToString(), UnicodeCategory(Categories.OtherControl).ToString());
     Assert.AreEqual(Control.ToString(), UnicodeCategory(Categories.Control).ToString());
     Assert.AreEqual(BasicLatin.ToString(), UnicodeCategory(Categories.BasicLatin).ToString());
     Assert.AreEqual(Latin_1Supplement.ToString(), UnicodeCategory(Categories.Latin_1Supplement).ToString());
     Assert.AreEqual(LatinExtended_A.ToString(), UnicodeCategory(Categories.LatinExtended_A).ToString());
     Assert.AreEqual(LatinExtended_B.ToString(), UnicodeCategory(Categories.LatinExtended_B).ToString());
     Assert.AreEqual(IPAExtensions.ToString(), UnicodeCategory(Categories.IPAExtensions).ToString());
     Assert.AreEqual(SpacingModifierLetters.ToString(), UnicodeCategory(Categories.SpacingModifierLetters).ToString());
     Assert.AreEqual(CombiningDiacriticalMarks.ToString(), UnicodeCategory(Categories.CombiningDiacriticalMarks).ToString());
     Assert.AreEqual(Greek.ToString(), UnicodeCategory(Categories.Greek).ToString());
     Assert.AreEqual(GreekandCoptic.ToString(), UnicodeCategory(Categories.GreekandCoptic).ToString());
     Assert.AreEqual(Cyrillic.ToString(), UnicodeCategory(Categories.Cyrillic).ToString());
     Assert.AreEqual(CyrillicSupplement.ToString(), UnicodeCategory(Categories.CyrillicSupplement).ToString());
     Assert.AreEqual(Armenian.ToString(), UnicodeCategory(Categories.Armenian).ToString());
     Assert.AreEqual(Hebrew.ToString(), UnicodeCategory(Categories.Hebrew).ToString());
     Assert.AreEqual(Arabic.ToString(), UnicodeCategory(Categories.Arabic).ToString());
     Assert.AreEqual(Syriac.ToString(), UnicodeCategory(Categories.Syriac).ToString());
     Assert.AreEqual(Thaana.ToString(), UnicodeCategory(Categories.Thaana).ToString());
     Assert.AreEqual(Devanagari.ToString(), UnicodeCategory(Categories.Devanagari).ToString());
     Assert.AreEqual(Bengali.ToString(), UnicodeCategory(Categories.Bengali).ToString());
     Assert.AreEqual(Gurmukhi.ToString(), UnicodeCategory(Categories.Gurmukhi).ToString());
     Assert.AreEqual(Gujarati.ToString(), UnicodeCategory(Categories.Gujarati).ToString());
     Assert.AreEqual(Oriya.ToString(), UnicodeCategory(Categories.Oriya).ToString());
     Assert.AreEqual(Tamil.ToString(), UnicodeCategory(Categories.Tamil).ToString());
     Assert.AreEqual(Telugu.ToString(), UnicodeCategory(Categories.Telugu).ToString());
     Assert.AreEqual(Kannada.ToString(), UnicodeCategory(Categories.Kannada).ToString());
     Assert.AreEqual(Malayalam.ToString(), UnicodeCategory(Categories.Malayalam).ToString());
     Assert.AreEqual(Sinhala.ToString(), UnicodeCategory(Categories.Sinhala).ToString());
     Assert.AreEqual(Thai.ToString(), UnicodeCategory(Categories.Thai).ToString());
     Assert.AreEqual(Lao.ToString(), UnicodeCategory(Categories.Lao).ToString());
     Assert.AreEqual(Tibetan.ToString(), UnicodeCategory(Categories.Tibetan).ToString());
     Assert.AreEqual(Myanmar.ToString(), UnicodeCategory(Categories.Myanmar).ToString());
     Assert.AreEqual(Georgian.ToString(), UnicodeCategory(Categories.Georgian).ToString());
     Assert.AreEqual(HangulJamo.ToString(), UnicodeCategory(Categories.HangulJamo).ToString());
     Assert.AreEqual(Ethiopic.ToString(), UnicodeCategory(Categories.Ethiopic).ToString());
     Assert.AreEqual(Cherokee.ToString(), UnicodeCategory(Categories.Cherokee).ToString());
     Assert.AreEqual(UnifiedCanadianAboriginalSyllabics.ToString(), UnicodeCategory(Categories.UnifiedCanadianAboriginalSyllabics).ToString());
     Assert.AreEqual(Ogham.ToString(), UnicodeCategory(Categories.Ogham).ToString());
     Assert.AreEqual(Runic.ToString(), UnicodeCategory(Categories.Runic).ToString());
     Assert.AreEqual(Tagalog.ToString(), UnicodeCategory(Categories.Tagalog).ToString());
     Assert.AreEqual(Hanunoo.ToString(), UnicodeCategory(Categories.Hanunoo).ToString());
     Assert.AreEqual(Buhid.ToString(), UnicodeCategory(Categories.Buhid).ToString());
     Assert.AreEqual(Tagbanwa.ToString(), UnicodeCategory(Categories.Tagbanwa).ToString());
     Assert.AreEqual(Khmer.ToString(), UnicodeCategory(Categories.Khmer).ToString());
     Assert.AreEqual(Mongolian.ToString(), UnicodeCategory(Categories.Mongolian).ToString());
     Assert.AreEqual(Limbu.ToString(), UnicodeCategory(Categories.Limbu).ToString());
     Assert.AreEqual(TaiLe.ToString(), UnicodeCategory(Categories.TaiLe).ToString());
     Assert.AreEqual(KhmerSymbols.ToString(), UnicodeCategory(Categories.KhmerSymbols).ToString());
     Assert.AreEqual(PhoneticExtensions.ToString(), UnicodeCategory(Categories.PhoneticExtensions).ToString());
     Assert.AreEqual(LatinExtendedAdditional.ToString(), UnicodeCategory(Categories.LatinExtendedAdditional).ToString());
     Assert.AreEqual(GreekExtended.ToString(), UnicodeCategory(Categories.GreekExtended).ToString());
     Assert.AreEqual(GeneralPunctuation.ToString(), UnicodeCategory(Categories.GeneralPunctuation).ToString());
     Assert.AreEqual(SuperscriptsandSubscripts.ToString(), UnicodeCategory(Categories.SuperscriptsandSubscripts).ToString());
     Assert.AreEqual(CurrencySymbols.ToString(), UnicodeCategory(Categories.CurrencySymbols).ToString());
     Assert.AreEqual(CombiningDiacriticalMarksforSymbols.ToString(), UnicodeCategory(Categories.CombiningDiacriticalMarksforSymbols).ToString());
     Assert.AreEqual(CombiningMarksforSymbols.ToString(), UnicodeCategory(Categories.CombiningMarksforSymbols).ToString());
     Assert.AreEqual(LetterlikeSymbols.ToString(), UnicodeCategory(Categories.LetterlikeSymbols).ToString());
     Assert.AreEqual(NumberForms.ToString(), UnicodeCategory(Categories.NumberForms).ToString());
     Assert.AreEqual(Arrows.ToString(), UnicodeCategory(Categories.Arrows).ToString());
     Assert.AreEqual(MathematicalOperators.ToString(), UnicodeCategory(Categories.MathematicalOperators).ToString());
     Assert.AreEqual(MiscellaneousTechnical.ToString(), UnicodeCategory(Categories.MiscellaneousTechnical).ToString());
     Assert.AreEqual(ControlPictures.ToString(), UnicodeCategory(Categories.ControlPictures).ToString());
     Assert.AreEqual(OpticalCharacterRecognition.ToString(), UnicodeCategory(Categories.OpticalCharacterRecognition).ToString());
     Assert.AreEqual(EnclosedAlphanumerics.ToString(), UnicodeCategory(Categories.EnclosedAlphanumerics).ToString());
     Assert.AreEqual(BoxDrawing.ToString(), UnicodeCategory(Categories.BoxDrawing).ToString());
     Assert.AreEqual(BlockElements.ToString(), UnicodeCategory(Categories.BlockElements).ToString());
     Assert.AreEqual(GeometricShapes.ToString(), UnicodeCategory(Categories.GeometricShapes).ToString());
     Assert.AreEqual(MiscellaneousSymbols.ToString(), UnicodeCategory(Categories.MiscellaneousSymbols).ToString());
     Assert.AreEqual(Dingbats.ToString(), UnicodeCategory(Categories.Dingbats).ToString());
     Assert.AreEqual(MiscellaneousMathematicalSymbols_A.ToString(), UnicodeCategory(Categories.MiscellaneousMathematicalSymbols_A).ToString());
     Assert.AreEqual(SupplementalArrows_A.ToString(), UnicodeCategory(Categories.SupplementalArrows_A).ToString());
     Assert.AreEqual(BraillePatterns.ToString(), UnicodeCategory(Categories.BraillePatterns).ToString());
     Assert.AreEqual(SupplementalArrows_B.ToString(), UnicodeCategory(Categories.SupplementalArrows_B).ToString());
     Assert.AreEqual(MiscellaneousMathematicalSymbols_B.ToString(), UnicodeCategory(Categories.MiscellaneousMathematicalSymbols_B).ToString());
     Assert.AreEqual(SupplementalMathematicalOperators.ToString(), UnicodeCategory(Categories.SupplementalMathematicalOperators).ToString());
     Assert.AreEqual(MiscellaneousSymbolsandArrows.ToString(), UnicodeCategory(Categories.MiscellaneousSymbolsandArrows).ToString());
     Assert.AreEqual(CJKRadicalsSupplement.ToString(), UnicodeCategory(Categories.CJKRadicalsSupplement).ToString());
     Assert.AreEqual(KangxiRadicals.ToString(), UnicodeCategory(Categories.KangxiRadicals).ToString());
     Assert.AreEqual(IdeographicDescriptionCharacters.ToString(), UnicodeCategory(Categories.IdeographicDescriptionCharacters).ToString());
     Assert.AreEqual(CJKSymbolsandPunctuation.ToString(), UnicodeCategory(Categories.CJKSymbolsandPunctuation).ToString());
     Assert.AreEqual(Hiragana.ToString(), UnicodeCategory(Categories.Hiragana).ToString());
     Assert.AreEqual(Katakana.ToString(), UnicodeCategory(Categories.Katakana).ToString());
     Assert.AreEqual(Bopomofo.ToString(), UnicodeCategory(Categories.Bopomofo).ToString());
     Assert.AreEqual(HangulCompatibilityJamo.ToString(), UnicodeCategory(Categories.HangulCompatibilityJamo).ToString());
     Assert.AreEqual(Kanbun.ToString(), UnicodeCategory(Categories.Kanbun).ToString());
     Assert.AreEqual(BopomofoExtended.ToString(), UnicodeCategory(Categories.BopomofoExtended).ToString());
     Assert.AreEqual(KatakanaPhoneticExtensions.ToString(), UnicodeCategory(Categories.KatakanaPhoneticExtensions).ToString());
     Assert.AreEqual(EnclosedCJKLettersandMonths.ToString(), UnicodeCategory(Categories.EnclosedCJKLettersandMonths).ToString());
     Assert.AreEqual(CJKCompatibility.ToString(), UnicodeCategory(Categories.CJKCompatibility).ToString());
     Assert.AreEqual(CJKUnifiedIdeographsExtensionA.ToString(), UnicodeCategory(Categories.CJKUnifiedIdeographsExtensionA).ToString());
     Assert.AreEqual(YijingHexagramSymbols.ToString(), UnicodeCategory(Categories.YijingHexagramSymbols).ToString());
     Assert.AreEqual(CJKUnifiedIdeographs.ToString(), UnicodeCategory(Categories.CJKUnifiedIdeographs).ToString());
     Assert.AreEqual(YiSyllables.ToString(), UnicodeCategory(Categories.YiSyllables).ToString());
     Assert.AreEqual(YiRadicals.ToString(), UnicodeCategory(Categories.YiRadicals).ToString());
     Assert.AreEqual(HangulSyllables.ToString(), UnicodeCategory(Categories.HangulSyllables).ToString());
     Assert.AreEqual(HighSurrogates.ToString(), UnicodeCategory(Categories.HighSurrogates).ToString());
     Assert.AreEqual(HighPrivateUseSurrogates.ToString(), UnicodeCategory(Categories.HighPrivateUseSurrogates).ToString());
     Assert.AreEqual(LowSurrogates.ToString(), UnicodeCategory(Categories.LowSurrogates).ToString());
     Assert.AreEqual(PrivateUseArea.ToString(), UnicodeCategory(Categories.PrivateUseArea).ToString());
     Assert.AreEqual(CJKCompatibilityIdeographs.ToString(), UnicodeCategory(Categories.CJKCompatibilityIdeographs).ToString());
     Assert.AreEqual(LettericPresentationForms.ToString(), UnicodeCategory(Categories.LettericPresentationForms).ToString());
     Assert.AreEqual(ArabicPresentationForms_A.ToString(), UnicodeCategory(Categories.ArabicPresentationForms_A).ToString());
     Assert.AreEqual(VariationSelectors.ToString(), UnicodeCategory(Categories.VariationSelectors).ToString());
     Assert.AreEqual(CombiningHalfMarks.ToString(), UnicodeCategory(Categories.CombiningHalfMarks).ToString());
     Assert.AreEqual(CJKCompatibilityForms.ToString(), UnicodeCategory(Categories.CJKCompatibilityForms).ToString());
     Assert.AreEqual(SmallFormVariants.ToString(), UnicodeCategory(Categories.SmallFormVariants).ToString());
     Assert.AreEqual(ArabicPresentationForms_B.ToString(), UnicodeCategory(Categories.ArabicPresentationForms_B).ToString());
     Assert.AreEqual(HalfwidthandFullwidthForms.ToString(), UnicodeCategory(Categories.HalfwidthandFullwidthForms).ToString());
     Assert.AreEqual(Specials.ToString(), UnicodeCategory(Categories.Specials).ToString());
 }