public void Init()
        {
            var config        = new CommonConfig();
            var commandConfig = new BFCommandConfig();

            this._executer = new TestExecuter(config, commandConfig);
        }
示例#2
0
        public BFAnalyzer(CommonConfig commonConfig, BFCommandConfig commandConfig)
        {
            this._config          = commandConfig;
            this._definedCommands = commandConfig.GetCommands().ToList();
            var parserFactory = new ParserFactory(commandConfig);

            this._parser = parserFactory.Create(commonConfig.EnableCommentOut);
        }
示例#3
0
        public void SerializeCorrectlyTest()
        {
            var src = new BFCommandConfig
            {
                Increment    = new BFCommand("inc", BFCommandType.Increment),
                Decrement    = new BFCommand("dec", BFCommandType.Decrement),
                MoveRight    = new BFCommand("moveR", BFCommandType.MoveRight),
                MoveLeft     = new BFCommand("moveL", BFCommandType.MoveLeft),
                LoopHead     = new BFCommand("loopH", BFCommandType.LoopHead),
                LoopTail     = new BFCommand("loopT", BFCommandType.LoopTail),
                Read         = new BFCommand("read", BFCommandType.Read),
                Write        = new BFCommand("write", BFCommandType.Write),
                BeginComment = new BFCommand("beginC", BFCommandType.BeginComment),
                EndComment   = new BFCommand("endC", BFCommandType.EndComment)
            };

            var expectedFile = @"TestData\BFCommandConfigJsons\Expected.json";

            ConfigManager.Save(src, this._destPath);

            FileAssert.AreEqual(expectedFile, this._destPath);
        }
        public void DeserializeCorrectlyObsoleteTest()
        {
            var jsonPath = @"TestData\BFCommandConfigJsons\Obsolete.json";

            var expected = new BFCommandConfig
            {
                Increment    = new BFCommand("inc", BFCommandType.Increment),
                Decrement    = new BFCommand("dec", BFCommandType.Decrement),
                MoveRight    = new BFCommand("moveR", BFCommandType.MoveRight),
                MoveLeft     = new BFCommand("moveL", BFCommandType.MoveLeft),
                LoopHead     = new BFCommand("roopH", BFCommandType.LoopHead),
                LoopTail     = new BFCommand("roopT", BFCommandType.LoopTail),
                Read         = new BFCommand("read", BFCommandType.Read),
                Write        = new BFCommand("write", BFCommandType.Write),
                BeginComment = new BFCommand("beginC", BFCommandType.BeginComment),
                EndComment   = new BFCommand("endC", BFCommandType.EndComment)
            };

            var result = ConfigManager.Import <BFCommandConfig>(jsonPath);

            result.IsStructuralEqual(expected);
        }
示例#5
0
 public Executer(CommonConfig config, BFCommandConfig commandConfig) : base(config, commandConfig)
 {
 }
示例#6
0
 public BFDefaultParser(BFCommandConfig config)
 {
     this._definedCommands = config.GetCommands().ToList();
 }
示例#7
0
 public BFIgnoreCommentOutParser(BFCommandConfig config)
 {
     this._definedCommands = config.GetCommands().ToList();
 }
示例#8
0
 public BrainfxxkExecuter(CommonConfig config, BFCommandConfig commandConfig) : base(config, commandConfig)
 {
 }
示例#9
0
 public ParserFactory(BFCommandConfig commandConfig)
 {
     this._commandConfig = commandConfig;
 }
示例#10
0
 protected ExecuterBase(CommonConfig config, BFCommandConfig commandConfig)
 {
     this._config   = config;
     this._analyzer = new BFAnalyzer(config, commandConfig);
 }