most 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. data/Copying.txt +679 -0
  2. data/History.txt +15 -0
  3. data/Manifest.txt +95 -0
  4. data/PostInstall.txt +6 -0
  5. data/Rakefile +44 -0
  6. data/Readme.rdoc +146 -0
  7. data/bin/most +31 -0
  8. data/lib/most.rb +52 -0
  9. data/lib/most/context.rb +244 -0
  10. data/lib/most/core.rb +171 -0
  11. data/lib/most/di/container.rb +148 -0
  12. data/lib/most/di/proxy.rb +55 -0
  13. data/lib/most/di/service.rb +63 -0
  14. data/lib/most/di/service_factory.rb +40 -0
  15. data/lib/most/environment.rb +67 -0
  16. data/lib/most/executor.rb +80 -0
  17. data/lib/most/helpers/array.rb +31 -0
  18. data/lib/most/helpers/hash.rb +25 -0
  19. data/lib/most/helpers/kernel.rb +35 -0
  20. data/lib/most/helpers/memory_out.rb +93 -0
  21. data/lib/most/helpers/numeric.rb +59 -0
  22. data/lib/most/helpers/object.rb +65 -0
  23. data/lib/most/helpers/symbol.rb +31 -0
  24. data/lib/most/interfaces/meta_programmable.rb +59 -0
  25. data/lib/most/starter.rb +126 -0
  26. data/lib/most/structures/box.rb +199 -0
  27. data/lib/most/structures/submission.rb +117 -0
  28. data/lib/most/structures/test_case.rb +173 -0
  29. data/lib/most/structures/test_runner.rb +103 -0
  30. data/lib/most/structures/types/options.rb +67 -0
  31. data/lib/most/structures/types/path.rb +39 -0
  32. data/lib/most/structures/types/report.rb +84 -0
  33. data/lib/most/submissions/cpp_memory_out_sample.rb +34 -0
  34. data/lib/most/submissions/cpp_sample.rb +36 -0
  35. data/lib/most/submissions/cpp_timeout_sample.rb +34 -0
  36. data/lib/most/submissions/cs_sample.rb +36 -0
  37. data/lib/most/submissions/erlang_sample.rb +36 -0
  38. data/lib/most/submissions/haskell_sample.rb +36 -0
  39. data/lib/most/submissions/java_sample.rb +36 -0
  40. data/lib/most/submissions/lisp_sample.rb +32 -0
  41. data/lib/most/submissions/lua_sample.rb +36 -0
  42. data/lib/most/submissions/ocaml_sample.rb +36 -0
  43. data/lib/most/submissions/pascal_sample.rb +36 -0
  44. data/lib/most/submissions/perl_sample.rb +32 -0
  45. data/lib/most/submissions/php_sample.rb +32 -0
  46. data/lib/most/submissions/python_sample.rb +32 -0
  47. data/lib/most/submissions/ruby_sample.rb +32 -0
  48. data/lib/most/submissions/vb_sample.rb +36 -0
  49. data/lib/most/tasks/general/win/cs.rb +60 -0
  50. data/lib/most/tasks/general/win/erlang.rb +86 -0
  51. data/lib/most/tasks/general/win/gcc.rb +39 -0
  52. data/lib/most/tasks/general/win/haskell.rb +75 -0
  53. data/lib/most/tasks/general/win/java.rb +72 -0
  54. data/lib/most/tasks/general/win/lisp.rb +59 -0
  55. data/lib/most/tasks/general/win/lua.rb +75 -0
  56. data/lib/most/tasks/general/win/ocaml.rb +77 -0
  57. data/lib/most/tasks/general/win/pascal.rb +73 -0
  58. data/lib/most/tasks/general/win/perl.rb +61 -0
  59. data/lib/most/tasks/general/win/php.rb +59 -0
  60. data/lib/most/tasks/general/win/python.rb +59 -0
  61. data/lib/most/tasks/general/win/ruby.rb +61 -0
  62. data/lib/most/tasks/general/win/vb.rb +60 -0
  63. data/lib/most/tasks/general/win/vc.rb +79 -0
  64. data/lib/most/tasks/general/win/vs.rb +52 -0
  65. data/samples/problem/solutions/cpp/main.cpp +9 -0
  66. data/samples/problem/solutions/cpp/tests.yml +19 -0
  67. data/samples/problem/solutions/cs/main.cs +17 -0
  68. data/samples/problem/solutions/cs/tests.yml +19 -0
  69. data/samples/problem/solutions/erlang/main.erl +2 -0
  70. data/samples/problem/solutions/erlang/tests.yml +19 -0
  71. data/samples/problem/solutions/haskell/main.hs +5 -0
  72. data/samples/problem/solutions/haskell/tests.yml +19 -0
  73. data/samples/problem/solutions/java/Main.java +14 -0
  74. data/samples/problem/solutions/java/tests.yml +19 -0
  75. data/samples/problem/solutions/lisp/main.lisp +1 -0
  76. data/samples/problem/solutions/lisp/tests.yml +19 -0
  77. data/samples/problem/solutions/lua/main.lua +4 -0
  78. data/samples/problem/solutions/lua/tests.yml +19 -0
  79. data/samples/problem/solutions/ocaml/main.ml +3 -0
  80. data/samples/problem/solutions/ocaml/tests.yml +19 -0
  81. data/samples/problem/solutions/pascal/main.pas +5 -0
  82. data/samples/problem/solutions/pascal/tests.yml +19 -0
  83. data/samples/problem/solutions/perl/main.pl +2 -0
  84. data/samples/problem/solutions/perl/tests.yml +19 -0
  85. data/samples/problem/solutions/php/main.php +1 -0
  86. data/samples/problem/solutions/php/tests.yml +19 -0
  87. data/samples/problem/solutions/python/main.py +1 -0
  88. data/samples/problem/solutions/python/tests.yml +19 -0
  89. data/samples/problem/solutions/ruby/main.rb +1 -0
  90. data/samples/problem/solutions/ruby/tests.yml +19 -0
  91. data/samples/problem/solutions/vb/main.vb +14 -0
  92. data/samples/problem/solutions/vb/tests.yml +19 -0
  93. data/samples/time_memory/solutions/cpp/main.cpp +21 -0
  94. data/samples/time_memory/solutions/cpp/tests.yml +19 -0
  95. data/tasks/samples.rb +31 -0
  96. metadata +242 -0
@@ -0,0 +1,60 @@
1
+ # Most - Modular Open Software Tester.
2
+ # Copyright (C) 2009 Dmitrii Toksaitov
3
+ #
4
+ # This file is part of Most.
5
+ #
6
+ # Most is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Most is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Most. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'rake/clean'
20
+
21
+ namespace :win do
22
+ namespace :vb do
23
+
24
+ task :compile, :source, :needs => ['win:vs:find_vsvars'] do |task, args|
25
+ path = ENV['VSVARS']
26
+
27
+ preparation_command = path.nil? ? '' : "call \"#{path}\" &&"
28
+ compilation_command = %{#{preparation_command} vbc /optimize+ #{args.source}}
29
+
30
+ service = Most::SERVICES[:open4]
31
+ service.popen4(compilation_command) do |stdin, stdout, stderr, pid|
32
+ $stdout.puts(stdout.read())
33
+ $stderr.puts(stderr.read())
34
+ end
35
+ end
36
+
37
+ task :run, :executable, :input do |task, args|
38
+ args.with_defaults(:input => '')
39
+
40
+ service = Most::SERVICES[:open4]
41
+ service.popen4(args.executable) do |stdin, stdout, stderr, pid|
42
+ Most::GLOBALS[:pid] = pid
43
+
44
+ unless args.input.is_a?(Most::Path)
45
+ stdin.write(args.input)
46
+ stdin.close()
47
+ end
48
+
49
+ process_stdout = stdout.read()
50
+ process_stderr = stderr.read()
51
+
52
+ Most::GLOBALS[:output] = process_stdout
53
+
54
+ $stdout.puts(process_stdout)
55
+ $stderr.puts(process_stderr)
56
+ end
57
+ end
58
+
59
+ end
60
+ end
@@ -0,0 +1,79 @@
1
+ # Most - Modular Open Software Tester.
2
+ # Copyright (C) 2009 Dmitrii Toksaitov
3
+ #
4
+ # This file is part of Most.
5
+ #
6
+ # Most is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Most is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Most. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'rake/clean'
20
+
21
+ CLEAN.include('*.obj')
22
+
23
+ namespace :win do
24
+ namespace :vc do
25
+
26
+ task :prepare do
27
+ vc_home = nil
28
+ Most::DIRECTORIES[:vendors].each do |directory|
29
+ possible_path = File.join(directory, 'vc')
30
+ vc_home = possible_path if File.directory?(possible_path)
31
+ end
32
+
33
+ unless vc_home.nil?
34
+ bin_path = File.join(vc_home, 'bin')
35
+ include_path = File.join(vc_home, 'include')
36
+ lib_path = File.join(vc_home, 'lib')
37
+
38
+ ENV['PATH'] ||= ''; ENV['PATH'] = "#{bin_path};#{ENV['PATH']}"
39
+ ENV['INCLUDE'] ||= ''; ENV['INCLUDE'] = "#{include_path};#{ENV['INCLUDE']}"
40
+ ENV['LIB'] ||= ''; ENV['LIB'] = "#{lib_path};#{ENV['LIB']}"
41
+ end
42
+
43
+ ENV['CL'] = '/EHsc'
44
+ end
45
+
46
+ task :compile, :source, :needs => [:prepare] do |task, args|
47
+ compilation_command = %{cl /O2 #{args.source}}
48
+
49
+ service = Most::SERVICES[:open4]
50
+ service.popen4(compilation_command) do |stdin, stdout, stderr, pid|
51
+ $stdout.puts(stdout.read())
52
+ $stderr.puts(stderr.read())
53
+ end
54
+ end
55
+
56
+ task :run, :executable, :input do |task, args|
57
+ args.with_defaults(:input => '')
58
+
59
+ service = Most::SERVICES[:open4]
60
+ service.popen4(args.executable) do |stdin, stdout, stderr, pid|
61
+ Most::GLOBALS[:pid] = pid
62
+
63
+ unless args.input.is_a?(Most::Path)
64
+ stdin.write(args.input)
65
+ stdin.close()
66
+ end
67
+
68
+ process_stdout = stdout.read()
69
+ process_stderr = stderr.read()
70
+
71
+ Most::GLOBALS[:output] = process_stdout
72
+
73
+ $stdout.puts(process_stdout)
74
+ $stderr.puts(process_stderr)
75
+ end
76
+ end
77
+
78
+ end
79
+ end
@@ -0,0 +1,52 @@
1
+ # Most - Modular Open Software Tester.
2
+ # Copyright (C) 2009 Dmitrii Toksaitov
3
+ #
4
+ # This file is part of Most.
5
+ #
6
+ # Most is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Most is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Most. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'rake/clean'
20
+
21
+ namespace :win do
22
+ namespace :vs do
23
+
24
+ task :find_vsvars do
25
+ if not ENV['VS90COMNTOOLS'].nil?
26
+ ENV['VSVARS'] = File.join(ENV['VS90COMNTOOLS'], 'vsvars32.bat')
27
+ elsif ENV['VS80COMNTOOLS'].nil?
28
+ ENV['VSVARS'] = File.join(ENV['VS80COMNTOOLS'], 'vsvars32.bat')
29
+ else
30
+ program_files_paths = [ENV['%PROGRAMW6432%'], ENV['%PROGRAMFILES(X86)%']]
31
+ vs_home_paths = ['Microsoft Visual Studio 9.0', 'Microsoft Visual Studio 8']
32
+
33
+ paths_tail = File.join('Common7', 'Tools', 'vsvars32.bat')
34
+
35
+ paths = []
36
+ vs_home_paths.each do |home|
37
+ program_files_paths.each do |path|
38
+ paths << File.join(path, home, paths_tail)
39
+ end
40
+ end
41
+
42
+ paths.each do |path|
43
+ if File.exist?(path)
44
+ ENV['VSVARS'] = path; break;
45
+ end
46
+ end
47
+
48
+ end
49
+ end
50
+
51
+ end
52
+ end
@@ -0,0 +1,9 @@
1
+ #include <iostream>
2
+
3
+ using namespace std;
4
+
5
+ void main()
6
+ {
7
+ int a, b; cin >> a >> b;
8
+ cout << a + b << endl;
9
+ }
@@ -0,0 +1,19 @@
1
+ ---
2
+ # Correct Tests
3
+ - :memory: 10485760
4
+ :input: 15 27
5
+ :time: 10
6
+ :output: "42"
7
+ - :memory: 10485760
8
+ :input: 33 9
9
+ :time: 10
10
+ :output: "42"
11
+ # Incorrect Tests
12
+ - :memory: 10485760
13
+ :input: 47774 65656
14
+ :time: 10
15
+ :output: "42"
16
+ - :memory: 10485760
17
+ :input: 547584 4857487
18
+ :time: 10
19
+ :output: "42"
@@ -0,0 +1,17 @@
1
+ using System;
2
+
3
+ namespace Main
4
+ {
5
+ public class Program
6
+ {
7
+ public static void Main(string[] args)
8
+ {
9
+ string[] numbers = Console.ReadLine().Split(new char[] { ' ' });
10
+
11
+ int a = int.Parse(numbers[0]);
12
+ int b = int.Parse(numbers[1]);
13
+
14
+ Console.WriteLine(a + b);
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,19 @@
1
+ ---
2
+ # Correct Tests
3
+ - :memory: 10485760
4
+ :input: 15 27
5
+ :time: 10
6
+ :output: "42"
7
+ - :memory: 10485760
8
+ :input: 33 9
9
+ :time: 10
10
+ :output: "42"
11
+ # Incorrect Tests
12
+ - :memory: 10485760
13
+ :input: 47774 65656
14
+ :time: 10
15
+ :output: "42"
16
+ - :memory: 10485760
17
+ :input: 547584 4857487
18
+ :time: 10
19
+ :output: "42"
@@ -0,0 +1,2 @@
1
+ -module(main). -export([start/0]).
2
+ start() -> io:write(lists:sum(element(2, io:fread("", "~d ~d")))).
@@ -0,0 +1,19 @@
1
+ ---
2
+ # Correct Tests
3
+ - :memory: 10485760
4
+ :input: 15 27
5
+ :time: 10
6
+ :output: "42"
7
+ - :memory: 10485760
8
+ :input: 33 9
9
+ :time: 10
10
+ :output: "42"
11
+ # Incorrect Tests
12
+ - :memory: 10485760
13
+ :input: 47774 65656
14
+ :time: 10
15
+ :output: "42"
16
+ - :memory: 10485760
17
+ :input: 547584 4857487
18
+ :time: 10
19
+ :output: "42"
@@ -0,0 +1,5 @@
1
+ module Main where
2
+
3
+ main = do
4
+ s <- getLine
5
+ putStrLn $ show $ sum $ map read (words s)
@@ -0,0 +1,19 @@
1
+ ---
2
+ # Correct Tests
3
+ - :memory: 10485760
4
+ :input: 15 27
5
+ :time: 10
6
+ :output: "42"
7
+ - :memory: 10485760
8
+ :input: 33 9
9
+ :time: 10
10
+ :output: "42"
11
+ # Incorrect Tests
12
+ - :memory: 10485760
13
+ :input: 47774 65656
14
+ :time: 10
15
+ :output: "42"
16
+ - :memory: 10485760
17
+ :input: 547584 4857487
18
+ :time: 10
19
+ :output: "42"
@@ -0,0 +1,14 @@
1
+ import java.util.Scanner;
2
+
3
+ public class Main
4
+ {
5
+ public static void main (String[] argv)
6
+ {
7
+ Scanner theScanner = new Scanner(System.in);
8
+
9
+ int a = theScanner.nextInt();
10
+ int b = theScanner.nextInt();
11
+
12
+ System.out.println(a + b);
13
+ }
14
+ }
@@ -0,0 +1,19 @@
1
+ ---
2
+ # Correct Tests
3
+ - :memory: 10485760
4
+ :input: 15 27
5
+ :time: 10
6
+ :output: "42"
7
+ - :memory: 10485760
8
+ :input: 33 9
9
+ :time: 10
10
+ :output: "42"
11
+ # Incorrect Tests
12
+ - :memory: 10485760
13
+ :input: 47774 65656
14
+ :time: 10
15
+ :output: "42"
16
+ - :memory: 10485760
17
+ :input: 547584 4857487
18
+ :time: 10
19
+ :output: "42"
@@ -0,0 +1 @@
1
+ (print (+ (read) (read)))
@@ -0,0 +1,19 @@
1
+ ---
2
+ # Correct Tests
3
+ - :memory: 10485760
4
+ :input: 15 27
5
+ :time: 10
6
+ :output: "42"
7
+ - :memory: 10485760
8
+ :input: 33 9
9
+ :time: 10
10
+ :output: "42"
11
+ # Incorrect Tests
12
+ - :memory: 10485760
13
+ :input: 47774 65656
14
+ :time: 10
15
+ :output: "42"
16
+ - :memory: 10485760
17
+ :input: 547584 4857487
18
+ :time: 10
19
+ :output: "42"
@@ -0,0 +1,4 @@
1
+ a = io.read("*n");
2
+ b = io.read("*n");
3
+
4
+ print(a + b)
@@ -0,0 +1,19 @@
1
+ ---
2
+ # Correct Tests
3
+ - :memory: 10485760
4
+ :input: 15 27
5
+ :time: 10
6
+ :output: "42"
7
+ - :memory: 10485760
8
+ :input: 33 9
9
+ :time: 10
10
+ :output: "42"
11
+ # Incorrect Tests
12
+ - :memory: 10485760
13
+ :input: 47774 65656
14
+ :time: 10
15
+ :output: "42"
16
+ - :memory: 10485760
17
+ :input: 547584 4857487
18
+ :time: 10
19
+ :output: "42"
@@ -0,0 +1,3 @@
1
+ let main = read_line() in
2
+ let sum = Scanf.sscanf main "%d %d" (fun x y -> x + y) in
3
+ print_int sum;;
@@ -0,0 +1,19 @@
1
+ ---
2
+ # Correct Tests
3
+ - :memory: 10485760
4
+ :input: 15 27
5
+ :time: 10
6
+ :output: "42"
7
+ - :memory: 10485760
8
+ :input: 33 9
9
+ :time: 10
10
+ :output: "42"
11
+ # Incorrect Tests
12
+ - :memory: 10485760
13
+ :input: 47774 65656
14
+ :time: 10
15
+ :output: "42"
16
+ - :memory: 10485760
17
+ :input: 547584 4857487
18
+ :time: 10
19
+ :output: "42"
@@ -0,0 +1,5 @@
1
+ var a, b: integer;
2
+ begin
3
+ Read(a, b);
4
+ Writeln(a + b);
5
+ end.
@@ -0,0 +1,19 @@
1
+ ---
2
+ # Correct Tests
3
+ - :memory: 10485760
4
+ :input: 15 27
5
+ :time: 10
6
+ :output: "42"
7
+ - :memory: 10485760
8
+ :input: 33 9
9
+ :time: 10
10
+ :output: "42"
11
+ # Incorrect Tests
12
+ - :memory: 10485760
13
+ :input: 47774 65656
14
+ :time: 10
15
+ :output: "42"
16
+ - :memory: 10485760
17
+ :input: 547584 4857487
18
+ :time: 10
19
+ :output: "42"