Ejemplo n.º 1
0
        public void Equal()
        {
            Pattern Alternator = (Pattern)"Hello" | "Goodbye";

            Assert.IsTrue(Alternator.Equals("Hello"));
            Assert.IsTrue(Alternator.Equals("Goodbye"));
            Assert.IsFalse(Alternator.Equals("World"));
        }
Ejemplo n.º 2
0
        public void Equal()
        {
            Pattern Negator = !(Pattern)"Hello";

            Assert.IsTrue(Negator.Equals("World"));
            Assert.IsTrue(Negator.Equals("Hello "));
            Assert.IsFalse(Negator.Equals("Hello"));
        }
Ejemplo n.º 3
0
        public void CharCheckerEqual()
        {
            Pattern CharChecker = (Pattern)(nameof(CharChecker), (Char) => Char == 'a' || Char == '1');

            Assert.IsTrue(CharChecker.Equals("a"));
            Assert.IsTrue(CharChecker.Equals("1"));
            Assert.IsFalse(CharChecker.Equals("b"));
            Assert.IsFalse(CharChecker.Equals("a1"));
        }
Ejemplo n.º 4
0
        public void Equal()
        {
            Pattern Repeater = (Pattern)"Hi!" * 2;

            Assert.IsTrue(Repeater.Equals("Hi!Hi!"));
            Assert.IsFalse(Repeater.Equals("Hi!"));
            Assert.IsFalse(Repeater.Equals("Hi!Ho."));
            Assert.IsFalse(Repeater.Equals("Hi!Hi!Hi!"));
        }
Ejemplo n.º 5
0
        public void Equal()
        {
            Pattern Hello = "Hello";
            Pattern Space = ' ';
            Pattern World = "World";

            Assert.IsTrue(Hello.Equals("Hello"));
            Assert.IsFalse(Hello.Equals("Hello "));
            Assert.IsFalse(Hello.Equals("Hell"));
            Assert.IsFalse(Hello.Equals("World"));

            Assert.IsTrue(Space.Equals(" "));
            Assert.IsFalse(Space.Equals("  "));
            Assert.IsFalse(Space.Equals("a"));

            Pattern HelloWorld = Hello & Space & World;             //This isn't a normal concatenator, but rather, should be optimized into a single StringLiteral

            Assert.IsTrue(HelloWorld.Equals("Hello World"));
            Assert.IsFalse(HelloWorld.Equals("Hello"));
            Assert.IsFalse(HelloWorld.Equals("Hello Bacon"));
        }
Ejemplo n.º 6
0
        public void Equal()
        {
            Pattern AB = +(Pattern)"AB";

            Assert.IsFalse(AB.Equals(""));
            Assert.IsFalse(AB.Equals("A"));
            Assert.IsTrue(AB.Equals("AB"));
            Assert.IsFalse(AB.Equals("ABA"));
            Assert.IsTrue(AB.Equals("ABAB"));
            Assert.IsFalse(AB.Equals("ABABA"));

            Assert.IsFalse(AB.Equals("AAB"));
            Assert.IsFalse(AB.Equals("ABB"));
        }