예제 #1
0
 public void LCCTCConstCharIllegal2()
 {
     string src    = "\\777";
     var    values = ConstChar.Evaluate(new Position(1), src);
 }
예제 #2
0
        public void LCCTCConstCharEvaluateLegal()
        {
            var tests = new Dictionary <string, LinkedList <ushort> > {
                {
                    "f",
                    new LinkedList <ushort>(new List <ushort> {
                        'f'
                    })
                },
                {
                    "\\n",
                    new LinkedList <ushort>(new List <ushort> {
                        '\n'
                    })
                },
                {
                    "\\'",
                    new LinkedList <ushort>(new List <ushort> {
                        '\''
                    })
                },
                {
                    "\\c",
                    new LinkedList <ushort>(new List <ushort> {
                        'c'
                    })
                },
                {
                    "\\377",
                    new LinkedList <ushort>(new List <ushort> {
                        255
                    })
                },
                {
                    "\\xff",
                    new LinkedList <ushort>(new List <ushort> {
                        255
                    })
                },
                {
                    "\\7",
                    new LinkedList <ushort>(new List <ushort> {
                        7
                    })
                },
                {
                    "\\76",
                    new LinkedList <ushort>(new List <ushort> {
                        7 * 8 + 6
                    })
                },
                {
                    "\\0223",
                    new LinkedList <ushort>(new List <ushort> {
                        0x12, '3'
                    })
                },
                {
                    "abcd",
                    new LinkedList <ushort>(new List <ushort> {
                        'a', 'b', 'c', 'd'
                    })
                }
            };

            foreach (var test in tests)
            {
                var values = ConstChar.Evaluate(new Position(1), test.Key);
                Assert.IsTrue(values.SequenceEqual(test.Value));
            }
        }