Permalink
Browse files

executor cpp tests implemented

  • Loading branch information...
1 parent 9d18294 commit 2f573d86bafe4f793eaff38e4b772e746990cd16 @ixanezis ixanezis committed Feb 22, 2012
Showing with 718 additions and 63 deletions.
  1. +3 −48 executor.py
  2. +2 −0 gen_playgrounds/profile
  3. +11 −7 task.py
  4. +2 −0 tasks/CPP/1/0.in
  5. +2 −0 tasks/CPP/1/0.out
  6. +1 −0 tasks/CPP/1/1.in
  7. +2 −0 tasks/CPP/1/1.out
  8. 0 tasks/CPP/1/__init__.py
  9. +8 −0 tasks/CPP/1/solution/main.cpp
  10. +3 −0 tasks/CPP/1/task.py
  11. +2 −0 tasks/CPP/2/0.in
  12. +2 −0 tasks/CPP/2/0.out
  13. +1 −0 tasks/CPP/2/1.in
  14. +1 −0 tasks/CPP/2/1.out
  15. 0 tasks/CPP/2/__init__.py
  16. +7 −0 tasks/CPP/2/solution/main.cpp
  17. +3 −0 tasks/CPP/2/task.py
  18. +2 −0 tasks/CPP/3/0.in
  19. +2 −0 tasks/CPP/3/0.out
  20. +1 −0 tasks/CPP/3/1.in
  21. +1 −0 tasks/CPP/3/1.out
  22. 0 tasks/CPP/3/__init__.py
  23. +13 −0 tasks/CPP/3/solution/main.cpp
  24. +3 −0 tasks/CPP/3/task.py
  25. +2 −0 tasks/CPP/4/0.in
  26. +2 −0 tasks/CPP/4/0.out
  27. +1 −0 tasks/CPP/4/1.in
  28. +1 −0 tasks/CPP/4/1.out
  29. +3 −0 tasks/CPP/4/2.in
  30. +2 −0 tasks/CPP/4/2.out
  31. 0 tasks/CPP/4/__init__.py
  32. +7 −0 tasks/CPP/4/solution/main.cpp
  33. +3 −0 tasks/CPP/4/task.py
  34. +2 −0 tasks/CPP/5/0.in
  35. +2 −0 tasks/CPP/5/0.out
  36. +1 −0 tasks/CPP/5/1.in
  37. +1 −0 tasks/CPP/5/1.out
  38. +3 −0 tasks/CPP/5/2.in
  39. +2 −0 tasks/CPP/5/2.out
  40. 0 tasks/CPP/5/__init__.py
  41. +8 −0 tasks/CPP/5/solution/main.cpp
  42. +3 −0 tasks/CPP/5/task.py
  43. +2 −0 tasks/CPP/6/0.in
  44. +2 −0 tasks/CPP/6/0.out
  45. +1 −0 tasks/CPP/6/1.in
  46. +1 −0 tasks/CPP/6/1.out
  47. +3 −0 tasks/CPP/6/2.in
  48. +2 −0 tasks/CPP/6/2.out
  49. 0 tasks/CPP/6/__init__.py
  50. +19 −0 tasks/CPP/6/solution/main.cpp
  51. +3 −0 tasks/CPP/6/task.py
  52. +1 −0 tasks/CPP/7/0.in
  53. +1 −0 tasks/CPP/7/0.out
  54. +1 −0 tasks/CPP/7/1.in
  55. +1 −0 tasks/CPP/7/1.out
  56. +1 −0 tasks/CPP/7/2.in
  57. +1 −0 tasks/CPP/7/2.out
  58. 0 tasks/CPP/7/__init__.py
  59. +490 −0 tasks/CPP/7/solution/main.cpp
  60. +5 −0 tasks/CPP/7/task.py
  61. +1 −1 tools/compilers.py
  62. +5 −6 tools/testers.py
  63. +63 −1 unittests.py
View
@@ -13,7 +13,7 @@ def execute(self):
path = self.path
try:
clean_directory(path)
- self.task.create_files(path)
+ task.create_files(path)
task.compile(path)
task.test(path)
except CompilationError as exception:
@@ -26,53 +26,8 @@ def execute(self):
return ("failed", "Wrong Answer: " + unicode(exception))
except TesterFailed as exception:
return ("failed", "Out tester failed on: " + unicode(exception))
+ except CompilationLimitExceeded as exception:
+ return ("failed", "Compilation limit exceeded")
else:
return ("accepted", None)
-if __name__ == "__main__":
- path = "./playground/"
- executor = Executor("CPP", "0", ["""#include <stdio.h>
-int main() {
- puts("Hello, world.");
- return 0;
-}
-"""], path)
- print(executor.execute())
-
- executor = Executor("CPP", "0", ["""#include <stdio.h>
-int main() {
- printf("Hello, world!%c", -1);
- return 0;
-}
-"""], path)
- print(executor.execute())
-
- executor = Executor("CPP", "0", ["""#include <stdio.hoho>
-int main() {
- printf("Hello, world!%c", -1);
- return 0;
-}
-"""], path)
- print(executor.execute())
-
- executor = Executor("CPP", "0", ["""#include <stdio.h>
-int main() {
- puts("Hello, world.");
- return 1;
-}
-"""], path)
- print(executor.execute())
-
- executor = Executor("CPP", "0", ["""#include <stdio.h>
-int main() {
- int ololo = 0;
- while (1) {
- ++ololo;
- }
- return 0;
-}
-"""], path)
- print(executor.execute())
-
- executor = Executor("PYTHON", "0", ["print('Hello, World!')"], path)
- print(executor.execute())
View
@@ -16,6 +16,8 @@
/usr/include/python2.7/** r,
/usr/lib/python2.7/** r,
/usr/local/lib/python2.7/** r,
+
+ /usr/** r,
{1} r,
View
18 task.py
@@ -9,7 +9,6 @@
from tools.preparator import *
from tools.testers import *
-
class Task(object):
"""
Class Task. It's used to store task and provides some common functions for all laguages.
@@ -23,10 +22,15 @@ def __init__(self, create_files = default_file_creator, tester = default_tester,
self.create_files = create_files.__get__(self)
self.test = tester.__get__(self)
self.checker = checker
-
+
+
+ """
+ Compiles a task
+ Overload this method if language is compilable.
+
+ Raises:
+ CompilationError
+ """
def compile(self, path):
- """
- This method should be overloaded if language is compilable. It should return None (or thing that
- can be considered as None) if everything was fine and information about error in other case
- """
- return None
+ pass
+
View
@@ -0,0 +1,2 @@
+3 4
+
View
@@ -0,0 +1,2 @@
+7
+
View
@@ -0,0 +1 @@
+5 9
View
@@ -0,0 +1,2 @@
+14
+
View
No changes.
@@ -0,0 +1,8 @@
+#include <iostream>
+
+int main() {
+ int a,b; std::cin >> a >> b;
+ std::cout << a + b << std::endl;
+ return 0;
+}
+
View
@@ -0,0 +1,3 @@
+from languages.cpp import CppTask
+
+task = CppTask()
View
@@ -0,0 +1,2 @@
+3 4
+
View
@@ -0,0 +1,2 @@
+7
+
View
@@ -0,0 +1 @@
+5 9
View
@@ -0,0 +1 @@
+14
View
No changes.
@@ -0,0 +1,7 @@
+#include <iostream>
+
+int main() {
+ int a,b; std::cin >> a >> b;
+ std::cout << a + b;
+ return 0;
+}
View
@@ -0,0 +1,3 @@
+from languages.cpp import CppTask
+
+task = CppTask()
View
@@ -0,0 +1,2 @@
+3 4
+
View
@@ -0,0 +1,2 @@
+7
+
View
@@ -0,0 +1 @@
+5 9
View
@@ -0,0 +1 @@
+14
View
No changes.
@@ -0,0 +1,13 @@
+#include <iostream>
+
+int main() {
+ int a,b; std::cin >> a >> b;
+ int sum = 0;
+ for (int i=0; i<100000; i++) {
+ for (int u=0; u<100000; u++) {
+ sum += i * u / 21;
+ }
+ }
+ std::cout << a + b + sum * 0;
+ return 0;
+}
View
@@ -0,0 +1,3 @@
+from languages.cpp import CppTask
+
+task = CppTask()
View
@@ -0,0 +1,2 @@
+3 4
+
View
@@ -0,0 +1,2 @@
+7
+
View
@@ -0,0 +1 @@
+5 9
View
@@ -0,0 +1 @@
+14
View
@@ -0,0 +1,3 @@
+12345678900
+23456789000
+
View
@@ -0,0 +1,2 @@
+35802467900
+
View
No changes.
@@ -0,0 +1,7 @@
+#include <iostream>
+
+int main() {
+ int a,b; std::cin >> a >> b;
+ std::cout << a + b;
+ return 0;
+}
View
@@ -0,0 +1,3 @@
+from languages.cpp import CppTask
+
+task = CppTask()
View
@@ -0,0 +1,2 @@
+3 4
+
View
@@ -0,0 +1,2 @@
+7
+
View
@@ -0,0 +1 @@
+5 9
View
@@ -0,0 +1 @@
+14
View
@@ -0,0 +1,3 @@
+12345678900
+23456789000
+
View
@@ -0,0 +1,2 @@
+35802467900
+
View
No changes.
@@ -0,0 +1,8 @@
+#include <iostream>
+#include </dev/urandom>
+
+int main() {
+ long long a,b; std::cin >> a >> b;
+ std::cout << a + b;
+ return 0;
+}
View
@@ -0,0 +1,3 @@
+from languages.cpp import CppTask
+
+task = CppTask()
View
@@ -0,0 +1,2 @@
+3 4
+
View
@@ -0,0 +1,2 @@
+7
+
View
@@ -0,0 +1 @@
+5 9
View
@@ -0,0 +1 @@
+14
View
@@ -0,0 +1,3 @@
+12345678900
+23456789000
+
View
@@ -0,0 +1,2 @@
+35802467900
+
View
No changes.
@@ -0,0 +1,19 @@
+#include <iostream>
+
+int main() {
+ long long a,b; std::cin >> a >> b;
+ std::cout << a + b;
+
+ Два ведра, Селёдка, Моль,
+я не ел, Сергей, постой!
+Уши жабы, я не квас!
+Вот Степан - он водолаз!
+Эй, держи скорее шпагу!
+Не могу, давай бумагу!
+Дверь и крышка унитаза!
+вспомнил Стёпку водолаза...
+эй Егор, беги сюда!
+я сломал, кругом вода!
+
+ return 0;
+}
View
@@ -0,0 +1,3 @@
+from languages.cpp import CppTask
+
+task = CppTask()
View
@@ -0,0 +1 @@
+5
View
@@ -0,0 +1 @@
+95
View
@@ -0,0 +1 @@
+4
View
@@ -0,0 +1 @@
+83
View
@@ -0,0 +1 @@
+781
View
@@ -0,0 +1 @@
+45
View
No changes.
Oops, something went wrong.

0 comments on commit 2f573d8

Please sign in to comment.