Comments (10)
I am not sure about the new filetest tester template that is used by default in Greed 2.0. But the old "test" template supports this by default. You just need to change the way in which you call the program.
./program 1
runs only test case 1.
./program 2
runs only test case 2.
Etc.
I am sure you can come up with a script that runs the program with different arguments in sequence.
from topcoder-greed.
The behavior is retained in the new filetester template. This is what I do
currently, using ./a.out [arg] that is.
On Thu, Dec 5, 2013 at 8:52 PM, vexorian [email protected] wrote:
I am not sure about the new filetest tester template that is used by
default in Greed 2.0. But the old "test" template supports this by default.
You just need to change the way in which you call the program../program 1
runs only test case 1.
./program 2
runs only test case 2.
Etc.I am sure you can come up with a script that runs the program with
different arguments in sequence.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/90#issuecomment-29906306
.
from topcoder-greed.
I'm not sure how to do this and how the TC tests our program. Since the generated code is only a file, when you compile and run it, you have to clean all the global state for each testcase. Running in separate thread may not change this, unless you have an external tester which runs your program at the process level, this will initialize the global variables each time. However, I do think it's a good idea to clean the globals in your program, for example, the arrays in C++ is initialized to uncertain content if you don't clear them.
from topcoder-greed.
It is possible to make a c++ template program that calls itself for each test case. But imho that is better left as an exercise for user to make with the template engine, as it has too many specifics regarding OS and other things.
from topcoder-greed.
Modifying template program will supposedly work. Even a script [1] will work.
However greed has jumped in popularity recently and not everybody is comfortable with playing with templates.
They either go with default template or the one @vexorian linked to in his blog post.
The motivation of the bug report was due to a chat in TC arena.
I am thinking of using Testerdream once again
Greed is good, but i really need it to clear global variables
Since the generated code is only a file, when you compile and run it, you have to clean all the global state for each testcase.
I'm not sure if separate threads share memory. IIRC, it was mentioned somewhere in TC forum about the TC-tester using threads. Changing the template such that you call the executable itself rather then instances or an external script running the executable with arguments seems two options to me, both of which IMHO seems hackish option. I am not even sure how threads are supposed to manage it, if there is a global and say 5 different threads are manipulating it at the same time, will it be thread safe ? Isn't the whole point of semaphores are to protect from the same issue.
, as it has too many specifics regarding OS and other things.
I don't think there is any OS specific requirement. C++, Java, Python, all of them are cross platform.
[1] https://gist.github.com/ashashwat/7837708
from topcoder-greed.
External script is the most logical choice and it is very easy. Whoever is running greed has to eventually run the code manually anyway.
You wouldn't really use globals in Java or Python. Java and Python also have exception handling, so the other advantage for using a different process is also void in those languages. C++ is the language that needs this and c++ has the most issues with doing OS stuff in a cross platform way. I am not sure if system() works in Visual C++ compiler, I think you'd need to use winapi there.. Anyway, if you can make a template that can do this, that's fine.
As hacky as making a source file that runs itself sounds like, that's exactly what TesterDream does. In fact, it appears that the only code that is needed for current template to work is something like this:
if (argc == 1) { cout << "(First message)" << endl << endl; for (int i = 0; i < 20; i++) { ostringstream s; s << argv[0] << " " << i; int exitCode = system(s.str().c_str()); if (exitCode) cout << "#" << i << ": Runtime Error" << endl; } int T = time(NULL)-1386418445; double PT = T/60.0, TT = 75.0; cout.setf(ios::fixed,ios::floatfield); cout.precision(2); cout << endl; cout << "Time : " << T/60 << " minutes " << T%60 << " secs" << endl; cout << "Score : " << 950.0*(.3+(.7*TT*TT)/(10.0*PT*PT+TT*TT)) << " points" << endl; }
from topcoder-greed.
As usual, github ate some of the text I pasted.
if (argc == 1) { (do stuff to do before running test cases) for (int i = 0; i < 20; i++) { ostringstream s; s << argv[0] << " " << i; int exitCode = system(s.str().c_str()); if (exitCode) cout << "#" << i << ": Runtime Error" << endl; } int T = time(NULL)-1386418445; double PT = T/60.0, TT = 75.0; cout.setf(ios::fixed,ios::floatfield); cout.precision(2); cout << endl; cout << "Time : " << T/60 << " minutes " << T%60 << " secs" << endl; cout << "Score : " << 950.0*(.3+(.7*TT*TT)/(10.0*PT*PT+TT*TT)) << " points" << endl; }
Incidentally, I had to set up TesterDream to verify this and the configuration process was just an awful experience I would not like to repeat. Go greed.
from topcoder-greed.
Made a PR #92 no idea if this should be default behavior.
from topcoder-greed.
I think this is resolved with the wonderful patch from @vexorian in #93 and #92.
from topcoder-greed.
Thanks @vexorian for the patch.
@shivawu Since there has been lot of changes post 2.0 beta, are you planning to release Greed 2.0 RC before releasing Greed 2.0 ?
from topcoder-greed.
Related Issues (20)
- Cannot configure pathPattern and fileNamePattern HOT 7
- Not recognizing config file HOT 1
- Config error: Config object needed, ConfigString found HOT 3
- The return value of long[] is attached with "L" in testcase.sample HOT 3
- Question: Is it possible to detect "practice room"? HOT 5
- Allow camelCase properties in templates
- Ecosystems for community-created contents (templates) HOT 5
- Code generation fails on SRM 627 Div 2 500 point problem HOT 3
- Is it possible to get a hook when the contest starts or to get contest time when generating code?
- Is it possible to get a raw string of the problem description? HOT 3
- Is there a support to generate the tests by supplying the problem statement offline?
- Grid containing whitespaces are not displayed in HTML properly HOT 1
- Submission from terminal without going to arena HOT 1
- Tests are not working in Xcode 6.1 (Passed : 0/0 cases) HOT 1
- About Release and Roadmap plans HOT 1
- OverWrite existing workspace
- SRM 676 div2 Farmville the test code does not work
- Filtering source code before submit
- Is the default language configurable?
- "data" causes compile error in C++17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from topcoder-greed.