zen0wu / topcoder-greed

greedy editor for topcoder arena
Apache License 2.0
229 stars 45 forks source link

"Dual color" templates #67

Closed vexorian closed 10 years ago

vexorian commented 10 years ago

@shivawu asked if I could add these templates to greed.

So there we go. I adapted so that they make more sense to be included in the jar. I called them "dual color". Dual because they use two files. The tester.cpp/py files do all the testing job, and in fact is always the same file, but for convenience they are made into a template so that people can generate them in the folder if they want/need to.

The test templates replace the default test templates in greed. They hold the source to send to TopCoder, also the test cases (in convenient bracket format) and the things needed to call the tester file.

The tester uses colors to decorate its output. These colors use ANSI-color codes so it is required to run the program in a terminal that supports them. I think that most terminals in sane OS like Linux and OS/X.

The test case format allows cases with unknown results (still can evaluate for TimeOut/seg fault) and also to disable tests by modifying a small function.

zen0wu commented 10 years ago

Sure, great job! Two cents here:

  1. The naming convention is description.extension.tmpl, so I think the tester should be named tester.cpp.tmpl, the other could be source.cpp.tmpl or whatever.
  2. Put a README.md in the directory, with some text and images to show how cool your templates are!
vexorian commented 10 years ago

Ok.

wookayin commented 10 years ago

Great, but a question - why do we have 'dualcolor-test' as well as 'dualcolor-tester' ? (Please let me know if we are to discuss on it in another issue)

vexorian commented 10 years ago

dualcolor-test is the test code generate for each problem, used by the source template (replace Greed's test code template) dualcolor-tester is the generic tester. It is not specific for the problem and is always saved as tester.cpp. In my setup, it is just a file in greed's root folder, but I made it a template so that it is easier for people to try. Once they decide they like the testing style, they can/should replace the dualcolor-tester template with an external file with a fixed location that they can modify however they want.