/// ------------------------------------------------------------------------------------ /// <summary> /// Asserts the comparison works. /// </summary> /// <param name="hex1">The hex1.</param> /// <param name="hex2">The hex2.</param> /// <param name="expectedComparison">The expected comparison.</param> /// ------------------------------------------------------------------------------------ private void AssertComparisonWorks(string hex1, string hex2, int expectedComparison) { int comparison; comparison = MiscUtils.CompareHex(hex1, hex2); string NL = Environment.NewLine; Assert.AreEqual(expectedComparison, comparison, "CompareHex did not compare correctly:" + NL + "values: " + hex1 + " ? " + hex2); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determines whether the given codepoint is in any of the given ranges. /// </summary> /// <param name="codepoint">A string containing a hexidecimal value</param> /// <param name="rangesToCheck">One or more ranges of characters to check</param> /// ------------------------------------------------------------------------------------ private static bool IsInRange(string codepoint, CharacterRange[] rangesToCheck) { foreach (CharacterRange range in rangesToCheck) { if (MiscUtils.CompareHex(range.Start, codepoint) <= 0 && MiscUtils.CompareHex(range.End, codepoint) >= 0) { return(true); } } return(false); }