From ecd22d9d8abf68d1ffd57244071555933ab010ed Mon Sep 17 00:00:00 2001 From: Matt Sherman Date: Wed, 17 Jul 2024 15:06:34 -0400 Subject: [PATCH] lose IsExclusively --- uax29/Splitter.Test.cs | 63 ------------------------------------------ uax29/Splitter.cs | 15 ---------- 2 files changed, 78 deletions(-) delete mode 100644 uax29/Splitter.Test.cs diff --git a/uax29/Splitter.Test.cs b/uax29/Splitter.Test.cs deleted file mode 100644 index 8b73096..0000000 --- a/uax29/Splitter.Test.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Text; -using UAX29; - -namespace Tests; - -/// A bitmap of Unicode categories -using Property = uint; - -[TestFixture] -public class TestSplitter -{ - - [SetUp] - public void Setup() - { - } - - const Property Yes1 = 1; - const Property No1 = 2; - const Property Yes2 = 4; - const Property No2 = 8; - const Property Yes3 = 16; - const Property Yeses = Yes1 | Yes2 | Yes3; - - [Test] - public void TestIsExclusively() - { - { - var seen = Yes1; - Assert.That(seen.IsExclusively(Yeses), Is.True); - } - - { - var seen = Yes1 | Yes2; - Assert.That(seen.IsExclusively(Yeses), Is.True); - } - - { - var seen = No1; - Assert.That(seen.IsExclusively(Yeses), Is.False); - } - - { - var seen = No1 | No2; - Assert.That(seen.IsExclusively(Yeses), Is.False); - } - - { - var seen = Yes1 | No1; - Assert.That(seen.IsExclusively(Yeses), Is.False); - } - - { - var seen = Yes1 | Yes3 | No1; - Assert.That(seen.IsExclusively(Yeses), Is.False); - } - - { - Property seen = 0; - Assert.That(seen.IsExclusively(Yeses), Is.False); - } - } -} diff --git a/uax29/Splitter.cs b/uax29/Splitter.cs index ebcbb37..bef428a 100644 --- a/uax29/Splitter.cs +++ b/uax29/Splitter.cs @@ -25,19 +25,4 @@ internal static bool Is(this Property lookup, Property properties) { return (lookup & properties) != 0; } - - /// - /// Determines if property consists entirely of compare, i.e. no other values (flags) besides the ones in compare. - /// - /// The property to test; the haystack. - /// The property to test against; the needle. - /// True if property consists entirely of compare, otherwise false. - internal static bool IsExclusively(this Property property, Property compare) - { - Debug.Assert(compare > 0); - return - (property & compare) != 0 && // compare appears in property - (property & ~compare) == 0 // but no others do - ; - } }