Ejemplo n.º 1
0
        public void Contains_Case1(char start, char end, char checkTarget, bool result)
        {
            // Arrange
            var r = CharRange.Between(start, end);

            // Act
            // Assert
            Assert.That(r.Contains(checkTarget), Is.EqualTo(result));
        }
        public void Contains_Case2(char range0Start, char range0End, char range1Start, char range1End, char checkTarget, bool result)
        {
            // Arrange
            var range0 = CharRange.Between(range0Start, range0End);
            var range1 = CharRange.Between(range1Start, range1End);
            var clazz  = new CharRangeCharClass(range0, range1);

            // Act
            // Assert
            Assert.That(clazz.Contains(checkTarget), Is.EqualTo(result));
            Assert.That(clazz.Contains(checkTarget), Is.EqualTo(result));
        }
Ejemplo n.º 3
0
        public void Between_Case1(char start, char end)
        {
            // Arrange
            var less    = start <= end ? start : end;
            var greater = start <= end ? end : start;

            // Act
            var r = CharRange.Between(start, end);

            // Assert
            Assert.That(r.Start, Is.EqualTo(less));
            Assert.That(r.End, Is.EqualTo(greater));
        }
        public void Plus_Case2(char range0Start, char range0End, char range1Start, char range1End, char checkTarget)
        {
            // Arrange
            var range0 = CharRange.Between(range0Start, range0End);
            var range1 = CharRange.Between(range1Start, range1End);
            var clazz0 = new CharRangeCharClass(range0);

            // Act
            var clazz1 = clazz0.Plus(checkTarget);

            // Assert
            Assert.That(clazz1.Contains(checkTarget), Is.True);
        }
        public void Or_Case1(char range0Start, char range0End, char range1Start, char range1End, char checkTarget, bool result)
        {
            // Arrange
            var range0 = CharRange.Between(range0Start, range0End);
            var range1 = CharRange.Between(range1Start, range1End);
            var clazz0 = new CharRangeCharClass(range0);

            // Act
            var clazz1 = clazz0.Union(new CharRangeCharClass(range1));

            // Assert
            Assert.That(clazz1.Contains(checkTarget), Is.EqualTo(result));
            Assert.That(clazz1.Contains(checkTarget), Is.EqualTo(result));
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 文字の範囲から文字クラスを生成します。
 /// </summary>
 /// <param name="start">範囲の始点</param>
 /// <param name="end">範囲の終点</param>
 /// <returns>新しい文字クラス</returns>
 public static CharClass Between(char start, char end)
 {
     return(new CharRangeCharClass(CharRange.Between(start, end)));
 }