示例#1
0
        public void ReleasesTest()
        {
            var actionLanguageTranslator = new ActionLanguageTranslator();
            var story      = "A releases f";
            var translated = actionLanguageTranslator.Translate(story);

            Assert.AreEqual("releases(a, [[f]], []).", translated);
        }
示例#2
0
        public void InvokesAfterTest()
        {
            var actionLanguageTranslator = new ActionLanguageTranslator();
            var story = "A invokes B after 1";

            var translated = actionLanguageTranslator.Translate(story);

            Assert.AreEqual("invokes(a, b, 1, []).", translated);
        }
示例#3
0
        public void TypicallyCausesIfTest()
        {
            var actionLanguageTranslator = new ActionLanguageTranslator();
            var story = "A typically causes alfa if pi";

            var translated = actionLanguageTranslator.Translate(story);

            Assert.AreEqual("typically_causes(a, [[alfa]], [[pi]]).", translated);
        }
示例#4
0
        public void ImpossibleTest()
        {
            var actionLanguageTranslator = new ActionLanguageTranslator();
            var story = "impossible A if pi";

            var translated = actionLanguageTranslator.Translate(story);

            Assert.AreEqual("impossible(a, [[pi]]).", translated);
        }
示例#5
0
        public void DisableWhenTest()
        {
            var actionLanguageTranslator = new ActionLanguageTranslator();
            var story = "disable A when 4";

            var translated = actionLanguageTranslator.Translate(story);

            Assert.AreEqual("disable_between(a, 4, 4).", translated);
        }
示例#6
0
        public void CausesTest()
        {
            var actionLanguageTranslator = new ActionLanguageTranslator();
            var story = "A causes alfa";

            var translated = actionLanguageTranslator.Translate(story);

            Assert.AreEqual("causes(a, [[alfa]], []).", translated);
        }
示例#7
0
        public void TriggersTest()
        {
            var actionLanguageTranslator = new ActionLanguageTranslator();
            var story = "pi triggers B";

            var translated = actionLanguageTranslator.Translate(story);

            Assert.AreEqual("triggers([[pi]], b).", translated);
        }
示例#8
0
        public void InvokesIfTest()
        {
            var actionLanguageTranslator = new ActionLanguageTranslator();
            var story = "A invokes B if pi";

            var translated = actionLanguageTranslator.Translate(story);

            Assert.AreEqual("invokes(a, b, 0, [[pi]]).", translated);
        }
示例#9
0
        public void InvokesAfterMinusTest()
        {
            var actionLanguageTranslator = new ActionLanguageTranslator();
            var story = "A invokes B after -1";

            Assert.Throws <Exception>(() =>
            {
                actionLanguageTranslator.Translate(story);
            });
        }
示例#10
0
 private string TranslateStoryToProlog(string story)
 {
     try
     {
         var translatedStory = actionLanguageTranslator.Translate(story);
         var scenario        = FluentsContainer.Instance.FluentsToString();
         return(translatedStory + '\n' + scenario);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message + "\n" + e.InnerException.Message, "Błąd historyjki.", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(null);
     }
 }