コード例 #1
0
        public void EventTagTest()
        {
            var game = new PgnGame();
            var move = new PgnMove();

            _state.OnEnter(move);

            _state.Parse('E', 'v', game);
            _state.Parse('v', 'e', game);
            _state.Parse('e', 'n', game);
            _state.Parse('n', 't', game);
            _state.Parse('t', ' ', game);
            _state.Parse(' ', '"', game);
            _state.Parse('"', 'c', game);
            _state.Parse('c', 'o', game);
            _state.Parse('o', 'o', game);
            _state.Parse('o', 'l', game);
            _state.Parse('l', '"', game);
            _state.Parse('"', ']', game);


            _state.OnExit();
            PgnTag tag;

            game.TryGetTag(PgnTag.Event, out tag);

            Assert.AreEqual("cool", tag.Value);
        }
コード例 #2
0
        public void WhiteTagTest()
        {
            var game = new PgnGame();
            var move = new PgnMove();

            _state.OnEnter(move);

            _state.Parse('W', 'h', game);
            _state.Parse('h', 'i', game);
            _state.Parse('i', 't', game);
            _state.Parse('t', 'e', game);
            _state.Parse('e', ' ', game);
            _state.Parse(' ', '"', game);
            _state.Parse('"', 'A', game);
            _state.Parse('A', 'n', game);
            _state.Parse('n', 'a', game);
            _state.Parse('a', 'n', game);
            _state.Parse('n', 'd', game);
            _state.Parse('d', '"', game);
            _state.Parse('"', ']', game);


            _state.OnExit();
            PgnTag tag;

            game.TryGetTag(PgnTag.White, out tag);

            Assert.AreEqual("Anand", tag.Value);
        }
コード例 #3
0
        public void UnknownTagTest()
        {
            var game = new PgnGame();
            var move = new PgnMove();

            _state.OnEnter(move);

            _state.Parse('N', 'o', game);
            _state.Parse('o', 't', game);
            _state.Parse('t', 'O', game);
            _state.Parse('O', 'K', game);
            _state.Parse('K', ' ', game);
            _state.Parse(' ', '"', game);
            _state.Parse('"', 'A', game);
            _state.Parse('A', 'n', game);
            _state.Parse('n', 'a', game);
            _state.Parse('a', 'n', game);
            _state.Parse('n', 'd', game);
            _state.Parse('d', '"', game);
            _state.Parse('"', ']', game);


            _state.OnExit();
            PgnTag tag;

            game.TryGetTag("NotOK", out tag);

            Assert.AreEqual("Anand", tag.Value);
        }