using Tessera.Unicode; using UnitTestSharp; namespace Tessera.UnitTests.Unicode { public class SegmentationPropertiesExtensionsTests : TestFixture { public static readonly SegmentationProperties AllSet = (SegmentationProperties)0xFFFF; public static SegmentationProperties AllBut(SegmentationProperties cleared) { return AllSet & ~cleared; } public class GraphemeBreakTests : TestFixture { public void ReadsOnlyItsOwnBits() { SegmentationProperties packed = (SegmentationProperties)GraphemeBreak.LVT | AllBut(SegmentationProperties.GraphemeBreakMask); CheckEqual(GraphemeBreak.LVT, packed.GraphemeBreak()); } } public class WordBreakTests : TestFixture { public void ReadsOnlyItsOwnBits() { var packed = (SegmentationProperties)((int)WordBreak.WSegSpace << SegmentationPropertiesExtensions.WordBreakShift) | AllBut(SegmentationProperties.WordBreakMask); CheckEqual(WordBreak.WSegSpace, packed.WordBreak()); } } public class IndicConjunctBreakTests : TestFixture { public void ReadsOnlyItsOwnBits() { var packed = (SegmentationProperties)((int)IndicConjunctBreak.Extend << SegmentationPropertiesExtensions.IndicConjunctBreakShift) | AllBut(SegmentationProperties.IndicConjunctBreakMask); CheckEqual(IndicConjunctBreak.Extend, packed.IndicConjunctBreak()); } } public class IsExtendedPictographicTests : TestFixture { public void ReadsOnlyItsOwnFlag() { CheckTrue(SegmentationProperties.ExtendedPictographic.IsExtendedPictographic()); CheckFalse(AllBut(SegmentationProperties.ExtendedPictographic).IsExtendedPictographic()); } } public class IsLetterOrNumberTests : TestFixture { public void ReadsOnlyItsOwnFlag() { CheckTrue(SegmentationProperties.LetterOrNumber.IsLetterOrNumber()); CheckFalse(AllBut(SegmentationProperties.LetterOrNumber).IsLetterOrNumber()); } } } }