Пример #1
0
        public void OrGroup_MultipleConsecutiveOrGroups()
        {
            var script =
                @"[
    a
    b
    c
]
[
    d
    e
    f
]
[
    g
    h
    i
]";
            var events  = TestUtils.ChronListFromString("y a d g a e i a b c a c f h b c a b c");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,d,g
a,e,i
c,f,h");
        }
Пример #2
0
        public void AndGroup_MultipleConsecutiveAndGroups()
        {
            var script =
                @"(
    a
    b
    c
)
(
    a
    b
    c
)
(
    a
    b
    c
)";
            var events  = TestUtils.ChronListFromString("y a b c a b c a b c a b c a b c a b c");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,b,c,a,b,c,a,b,c
a,b,c,a,b,c,a,b,c");
        }
Пример #3
0
        public void OrGroup_2OrGroupsNestedIntoMultipAndGropus2Ors()
        {
            var script =
                @"(
    [
        a
        g
    ]
    [
        b
        h
    ]
)
[
    c
    i
]
.
(
    [
        e
        k
    ]
)
.";
            var events  = TestUtils.ChronListFromString("a b c d e f g h i j k l");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,b,c,d,e,f
g,h,i,j,k,l");
        }
Пример #4
0
        public void AndGroup_MultiNestedAndLevels()
        {
            var script =
                @"a
(
    (
        b
        c
        (
            d
            (
                e
                f
            )
            g
            (
                h
                i
            )
        )
        j
    )
    k
    l
)
m";
            var events  = TestUtils.ChronListFromString("a b c d e f g h i j k l m");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,b,c,d,e,f,g,h,i,j,k,l,m");
        }
        public void Quant_Symbol_Star_AllOneEvents()
        {
            var events  = TestUtils.ChronListFromString("a a a a a a");
            var script  = "a*";
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual("a,a,a,a,a,a");
        }
        public void Quant_Num_OneMoreThenSpecified()
        {
            var script =
                @"b{5}";
            var events  = TestUtils.ChronListFromString("b b b b b b");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"b,b,b,b,b");
        }
        public void Quant_Num_Max_Single()
        {
            var script =
                @"b{,4}";
            var events  = TestUtils.ChronListFromString("b b b b");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"b,b,b,b");
        }
Пример #8
0
        public void MatchesMethodReturnsMatches()
        {
            var events = GetBasicCheckoutEvents();
            var script =
                @"/(Catalog|HomePage)\.Load/
.";
            var matches = ChronEx.Matches(script, events);

            Assert.AreEqual(5, matches.Count);
            Assert.AreEqual(2, matches[0].CapturedEvents.Count);
        }
        public void Quant_Num_OpenendedAtEndOfOther()
        {
            var script =
                @"c{1,3}
b{1,}";
            var events  = TestUtils.ChronListFromString("c c c b b b b");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"c,c,c,b,b,b,b");
        }
        public void Quant_Num_MinAndMax_SameLetterContinues()
        {
            var script =
                @"b{2,4}";
            var events  = TestUtils.ChronListFromString("b b b b b b");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"b,b,b,b
b,b");
        }
        public void Quant_Symbol_Star_Simple()
        {
            var script =
                @"b*";
            var events  = TestUtils.ChronListFromString("b b b a a a b b b");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"b,a,a,b,b,c,c
b,a,a,b,b,c");
        }
        public void Quant_Num_Minofzero_PassesOn()
        {
            var script =
                @"b{0,4}
c";
            var events  = TestUtils.ChronListFromString("c d");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"c");
        }
        public void Quant_Symbol_WithDashNoCapture_Simple()
        {
            var events = TestUtils.ChronListFromString("a b b");

            var script =
                @"a
-!b+
b";
            var matches = ChronEx.Matches(script, events);

            matches.AssertNoMatches();
        }
        public void Quant_Symbol_Plus_WithNeage_NoFullMatch()
        {
            var events = TestUtils.ChronListFromString("a c");

            var script =
                @"a
!b+
b";
            var matches = ChronEx.Matches(script, events);

            matches.AssertNoMatches();
        }
Пример #15
0
        public void DashSyntaxCauseNoCapture()
        {
            var events = GetBasicCheckoutEvents();
            var script =
                @"HomePage.Load
-.
HomePage.Link.Clicked";
            var matches = ChronEx.Matches(script, events);

            Assert.AreEqual(3, matches.Count);
            matches[0].CapturedEvents.AssertMatchesAreEqual("HomePage.Load,HomePage.Link.Clicked");
        }
Пример #16
0
        public void AndGroup_StarQuantifierEmbededInANumericMinimum()
        {
            var script =
                @"(
    a*
    b
){4,}";
            var events  = TestUtils.ChronListFromString("a a a a b a b a a b a a b q r e ");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,a,a,a,b,a,b,a,a,b,a,a,b");
        }
        public void Quant_Symbol_Star_simple()
        {
            var script =
                @"b
a*
d";
            var events  = TestUtils.ChronListFromString("b a d");
            var matches = ChronEx.Matches(script, events);

            matches[0].CapturedEvents.AssertMatchesAreEqual("b,a,d");

            Assert.AreEqual(1, matches.Count);
        }
Пример #18
0
        public void AndGroup_SimpleGroupExactMatch()
        {
            var script =
                @"(
a
b
)";
            var events  = TestUtils.ChronListFromString("a b");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,b");
        }
        public void Quant_Symbol_Star_MultipleNegations_FindOutliers()
        {
            var events = TestUtils.ChronListFromString("O F O F O A B C D F O A B O");

            var script =
                @"O
!/F|O/*
O";
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"O,A,B,O");
        }
        public void Quant_Symbol_QuestionMark()
        {
            var script =
                @"b
a?
d";
            var events  = GetQuanTestSet();
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"b,a,d
b,d");
        }
        public void Quant_Symbol_PlusWithRegexOr()
        {
            var script =
                @"a
/b|c/+
d";
            var events  = GetQuanTestSet();
            var matches = ChronEx.Matches(script, events);

            matches[0].CapturedEvents.AssertMatchesAreEqual("a,b,b,b,b,c,c,c,c,d");
            matches[1].CapturedEvents.AssertMatchesAreEqual("a,b,b,c,c,d");
            matches[2].CapturedEvents.AssertMatchesAreEqual("a,b,c,d");
            Assert.AreEqual(3, matches.Count);
        }
        public void Quant_Symbol_PlusExists()
        {
            var script =
                @"a
b+
c";
            var events  = TestUtils.ChronListFromString(@"a b b b b c a b b c a c a b c");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,b,b,b,b,c
a,b,b,c
a,b,c");
        }
Пример #23
0
        public void AndGroup_StarQuantifier()
        {
            var script =
                @"(
a
b
c
)*";
            var events  = TestUtils.ChronListFromString("a b c a b c a b c a b c a b c a b c");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,b,c,a,b,c,a,b,c,a,b,c,a,b,c,a,b,c");
        }
Пример #24
0
        public void AndGroup_SingleThenAndGroup()
        {
            var script =
                @"a
(
b
c
)";
            var events  = TestUtils.ChronListFromString("a b c");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,b,c");
        }
        public void Quant_Symbol_WithDashNoCapture()
        {
            var events = TestUtils.ChronListFromString("a a b a a a b a b b a c");

            var script =
                @"a
-!b+
b";
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,b
a,b");
        }
        public void Quant_Symbol_QuestionMark_Chained()
        {
            var script =
                @"b
a?
b?
c?
d?
e";
            var events  = TestUtils.ChronListFromString("b b d e");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual("b,b,d,e");
        }
Пример #27
0
        public void OrGroup_Negated()
        {
            var script =
                @"a
![
    b
    c
]
d";
            var events  = TestUtils.ChronListFromString("a j d a b d");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,j,d");
        }
Пример #28
0
        public void AndGroup_TrailingSelectorAfterNumericGroup()
        {
            var script =
                @"(
    a*
    b
){,4}
.
q";
            var events  = TestUtils.ChronListFromString("a a a a b a b a a b a a b r q");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,a,a,a,b,a,b,a,a,b,a,a,b,r,q");
        }
        public void Quant_Symbol_Star_InterleavedWithOther()
        {
            var script =
                @"b*
a?
a
b*
c+";
            var events  = TestUtils.ChronListFromString("b a a b b c c d d e f b a a b b c d e");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"b,a,a,b,b,c,c
b,a,a,b,b,c");
        }
Пример #30
0
        public void AndGroup_MultipleGroupSingle_DoesNotMatchEntirely()
        {
            var script =
                @"a
(
b
c
e
)";
            var events  = TestUtils.ChronListFromString("a b c d a b c e a b c d");
            var matches = ChronEx.Matches(script, events);

            matches.AssertMatchesAreEqual(
                @"a,b,c,e");
        }