Пример #1
0
        public void TestIdeslaveStdfds()
        {
            var p         = runProgram(coqtopw, String.Format("-coqtopbin {0} -ideslave -main-channel stdfds", coqtopBin));
            var responses = new CoqtopXmlReader(p.StandardOutput);

            p.StandardInput.Write("<call val=\"Init\"><option val=\"none\"/></call>");
            var response1 = responses.Read();

            Assert.AreEqual("<value val=\"good\"><state_id val=\"1\" /></value>", response1);

            p.StandardInput.Write("<call val=\"Query\"><pair><string>Check nat.</string><state_id val=\"0\"/></pair></call>");
            var response2 = new String[] { responses.Read(), responses.Read(), responses.Read() };

            Assert.IsTrue(response2.Contains("<feedback object=\"state\" route=\"0\"><state_id val=\"1\" /><feedback_content val=\"processed\" /></feedback>"));
            Assert.IsTrue(response2.Contains("<message><message_level val=\"notice\" /><string>nat\n     : Set</string></message>"));
            Assert.IsTrue(response2.Contains("<value val=\"good\"><string></string></value>"));

            p.StandardInput.WriteLine("<call val=\"Quit\"><unit/></call>");
            var response3 = responses.Read();

            Assert.AreEqual("<value val=\"good\"><unit /></value>", response3);

            p.StandardInput.Flush();
            p.WaitForExit();
            Assert.AreEqual(0, p.ExitCode);
        }
Пример #2
0
    public void TestIdeslaveStdfds()
    {
      var p = runProgram(coqtopw, String.Format("-coqtopbin {0} -ideslave -main-channel stdfds", coqtopBin));
      var responses = new CoqtopXmlReader(p.StandardOutput);
      
      p.StandardInput.Write("<call val=\"Init\"><option val=\"none\"/></call>");
      var response1 = responses.Read();
      Assert.AreEqual("<value val=\"good\"><state_id val=\"1\" /></value>", response1);

      p.StandardInput.Write("<call val=\"Query\"><pair><string>Check nat.</string><state_id val=\"0\"/></pair></call>");
      var response2 = new String[] { responses.Read(), responses.Read(), responses.Read() };
      Assert.IsTrue(response2.Contains("<feedback object=\"state\" route=\"0\"><state_id val=\"1\" /><feedback_content val=\"processed\" /></feedback>"));
      Assert.IsTrue(response2.Contains("<message><message_level val=\"notice\" /><string>nat\n     : Set</string></message>"));
      Assert.IsTrue(response2.Contains("<value val=\"good\"><string></string></value>"));

      p.StandardInput.WriteLine("<call val=\"Quit\"><unit/></call>");
      var response3 = responses.Read();
      Assert.AreEqual("<value val=\"good\"><unit /></value>", response3);

      p.StandardInput.Flush();
      p.WaitForExit();
      Assert.AreEqual(0, p.ExitCode);
    }