Esempio n. 1
0
def get_prover(url=None, group=None, path=None):
    """ Factory that determines what prover to serve. 
  """
    if path:
        return Coq_Local(path)
    elif (url and group):
        return ProofWeb(url, group)
    elif local_which("coqtop"):
        return Coq_Local(local_which("coqtop"))
    else:
        return Prover()
Esempio n. 2
0
    def test_slow(self):
        """ Test that a slow script gets processed correctly. """
        prover = Coq_Local("/usr/local/bin/coqtop")
        self._reader.add_code("""Require Import Arith.
Lemma loop x y : x + y = y + x.
intros.
Fail Timeout 2 repeat rewrite plus_comm.
apply plus_comm.
Qed. 
    """)
        movie = self._reader.make_frames(prover=prover)
        self.assertTrue(movie.getFrame(3).getResponse())
class Test_Coq_Local(unittest.TestCase):
  """ Tests sending commands using a local installation for Coq. """
  
  def setUp(self):
    """ Setup local Coq session. """
    self._coq = Coq_Local(coqtop = "/usr/local/bin/coqtop")
    
  def test_send(self):
    """ Sending correct data to Coqtop should work. """
    self.assertEquals(self._coq.send("Goal forall x, x->x."),
                      """1 subgoal
  
  ============================
   forall x : Type, x -> x
""")
    self.assertEquals(self._coq.send("Proof."), "")

  def test_send_utf8(self):
    """ Sending utf-8 should just work. """
    self._coq.send("Lemma foo : ∀ (x y z : nat), x + y + z = y + x + z.")
    
  def test_send_incorrect(self):
    """ Sending incorrect data should give an error report. """
    self.assertEquals(self._coq.send("Bogus."),
                      "Error: Unknown command of the non proof-editing mode.\n")
    
  def test_slow(self):
    """ Slow results should still be partitioned. """
    self._coq.send("Require Import Arith.")
    self._coq.send("Lemma loop x y : x + y = y + x.")
    self._coq.send("intros.")
    self._coq.send("Fail Timeout 2 repeat rewrite plus_comm.")
    self.assertFalse(self._coq.send("apply plus_comm.").startswith(
                                               "The command has indeed failed"),
                     "Started with output of previous command.") 
 
  def test_arguments(self):
    """ Passing arguments in the coqtop string should work. """
    Coq_Local(coqtop = '/usr/local/bin/coqtop -R /path ""')
 def setUp(self):
   """ Setup local Coq session. """
   self._coq = Coq_Local(coqtop = "/usr/local/bin/coqtop")
Esempio n. 5
0
class Test_Coq_Local(unittest.TestCase):
  """ Tests sending commands using a local installation for Coq. """

  def setUp(self):
    """ Setup local Coq session. """
    self._coq = Coq_Local(coqtop = "/usr/local/bin/coqtop")

  def test_send(self):
    """ Sending correct data to Coqtop should work. """
    self.assertEquals(self._coq.send("Goal forall x, x->x."),
                      """1 subgoal

  ============================
   forall x : Type, x -> x
""")
    self.assertEquals(self._coq.send("Proof."), "")

  def test_send_utf8(self):
    """ Sending utf-8 should just work. """
    self._coq.send("Lemma foo : ∀ (x y z : nat), x + y + z = y + x + z.")

  def test_send_incorrect(self):
    """ Sending incorrect data should give an error report. """
    self.assertEquals(self._coq.send("Bogus."),
                      "Error: Unknown command of the non proof-editing mode.\n")

  def test_slow(self):
    """ Slow results should still be partitioned. """
    self._coq.send("Require Import Arith.")
    self._coq.send("Lemma loop x y : x + y = y + x.")
    self._coq.send("intros.")
    self._coq.send("Fail Timeout 2 repeat rewrite plus_comm.")
    self.assertFalse(self._coq.send("apply plus_comm.").startswith(
                                               "The command has indeed failed"),
                     "Started with output of previous command.")

  def test_arguments(self):
    """ Passing arguments in the coqtop string should work. """
    Coq_Local(coqtop = '/usr/local/bin/coqtop -R /path ""')
Esempio n. 6
0
 def test_arguments(self):
   """ Passing arguments in the coqtop string should work. """
   Coq_Local(coqtop = '/usr/local/bin/coqtop -R /path ""')
Esempio n. 7
0
 def setUp(self):
   """ Setup local Coq session. """
   self._coq = Coq_Local(coqtop = "/usr/local/bin/coqtop")