Esempio 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"));
        }
Esempio 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"));
        }
Esempio 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"));
        }
Esempio 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!"));
        }
Esempio 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"));
        }
Esempio 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"));
        }