Пример #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);
     }
 }