Skip to content

xtf0214/program-compare

Repository files navigation

program-compare-UI

A program-comparer Based on PyQt5.

Usage

prepare setData.py

writeln Pass in a list and write it on one line.

from random import randint


def randPair(a, b):
    l = randint(a, b)
    r = randint(a, b)
    return (l, r) if l < r else (r, l)


def setData(writeln, id=1):
    a = randint(1, 2e9)
    b = randint(1, 2e9)
    writeln([a, b])

program-compare

This is a program-comparer for programming competition. It's base on cyaron, but some simple encapsulation was made.

Usage

  1. Copy ProgramCompare.py to you workspace.
  2. New a python file and write from ProgramCompare import *
  3. New a ProgramCompare class and appoint the std_cpp path and the cmp_cpp path.
  4. Write the setData methods, it is a function object for making data according to the problem.

compare

compare using os.popen() to get the output from two exe files and comparing the text of two.

  • set display_input = False , display_output = False
  • set display_input = True , display_output = True

makeData

If you only want to gain test.in and test.out as data from std_exe, you can use makeData.

######## make data
compare.makeData(1e1)
compare.makeData(1e2)
compare.makeData(1e3)
compare.makeData(1e4)
compare.makeData(1e5)

lower_bound

If there is a boundary, an error will occur when the data is greater than it, and no error will occur when it is not greater than it. You can use lower_bound to find this boundary