Nada's blog

By Nada, 9 years ago, In English

How to Generate Test Cases Using Polygon

Step 1:

Download testlib

You will have 4 folders and 1 file, one folder is "Generator", it will contain 6 cpp files, each file generates a different kind of input, if you open any file you will know what kind of input it generates.

Step 2:

On polygon, after you finish writing your problem, click on "Files" at the upper bar. at Resource files, click "Add File", select the file "testlib.h" from your hard disk and click "Add".

Step 3:

Then, at Source files, click "Add File", and you should select the suitable cpp file for your problem from the folder "Generators" on your hard disk, and click "Add".

Now you are ready to generate your test cases.

Step 4:

Select "Tests" from the upper bar, you will find an empty text box written upon it "Script". in this text box you will call your generator with different parameters to generate different values.

Example: if you are using "sgen", then your script will be like this:

sgen 1 > $

sgen 2 > $

sgen 5 > $

sgen 8 > $

(Each dollar signs will be automatically replaced with the smallest available test index)

Step 5:

Save script and select "Invocations" from the upper bar, select "Want to run solutions?" to check for the generated test cases.

And you are done.

  • Vote: I like it
  • +34
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
  Vote: I like it -28 Vote: I do not like it

boooring

  • »
    »
    9 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    i hope it's less boring than getting down votes.

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I did this but at tests tab when i press "Check generators to be compilable" it says "No generators". what can i do?

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    in Source Files how to indicate that my source is a generator?

    • »
      »
      »
      9 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Generators are cpp files that use testlib.h, make sure you added the header file for the testlib in the Resources files.

»
6 years ago, # |
  Vote: I like it +11 Vote: I do not like it

I am here for some really cool generators for non-self-crossing polygons. However, ...