pro1-tester 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41905b266ac97fb301422be2e5decbdfeb405544
4
- data.tar.gz: ca64fdf0c1cb613d15b4c0bf468c34c5322dcfb9
3
+ metadata.gz: 81b7bdfbf3d4cd3b4025f7859e19630be068d32a
4
+ data.tar.gz: cae01b4f167d3e25c5ec47f3c70c8d7a0bf2cc71
5
5
  SHA512:
6
- metadata.gz: ce59890e42e5c02b1f3f89e8b303974d59c11be0014f6de8dc3d46b51fdd15691bf1143fca22d52ca014741c80ebd75b30e51ecd2c005081a2b2f43a4f63b966
7
- data.tar.gz: 4230f387b0456024a58a7b13f6fc5fdec1d827c8a8f4108ad0dfc158495040caefb324dfb600fd5d89a3859cb561cf251b747bcd6931941459debd13c6064cdd
6
+ metadata.gz: 10f74e80882971f68c9052302b0dcf856b52bebf69f3cb6ec131cc5141396b9e65d6e368677a050f8d1fd6193b9e789203be595062d8e8a9e624ab157ff231fd
7
+ data.tar.gz: aec16bf4de324f3c616265c91ee9d0ede976704583a20cb106f6b8878254338f2a345f87033aff45d42606871fca60f969bd1c3192b7094230243241e35f5354
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
  /*.c
11
11
  /.DS_Store
12
12
  /*.gem
13
+ /testcase.default.yml
14
+ /testcase.yml
data/bin/pro1-tester CHANGED
@@ -18,5 +18,6 @@ module Pro1Tester
18
18
  opt.parse!(ARGV)
19
19
  end
20
20
 
21
+ Pro1Tester.clear
21
22
  Pro1Tester.run
22
23
  end
data/lib/core.rb CHANGED
@@ -49,7 +49,11 @@ module Pro1Tester
49
49
 
50
50
  # compile
51
51
  # %x(gcc #{src_file} -o #{File.join(DIST_DIR, src_file_identifer)})
52
- %x(gcc #{src_file} -o #{File.join(DIR_PWD, DIST_DIR, src_file_identifer)})
52
+ # %x(gcc #{src_file} -o #{File.join(DIR_PWD, DIST_DIR, src_file_identifer)})
53
+ unless system(%(gcc #{src_file} -o #{File.join(DIR_PWD, DIST_DIR, src_file_identifer)}))
54
+ puts "-"*10 + "compile error!!" + "-"*10
55
+ exit(1)
56
+ end
53
57
 
54
58
 
55
59
  # parse testcases
@@ -1,3 +1,3 @@
1
1
  module Pro1Tester
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/pro1_tester.rb CHANGED
@@ -2,21 +2,23 @@ require "pro1_tester/version"
2
2
  require 'open3'
3
3
  require 'rspec'
4
4
  require 'yaml'
5
-
5
+ require 'fileutils'
6
6
 
7
7
  module Pro1Tester
8
8
  DIST_DIR = "tmp"
9
9
  DIR_BASE = File.expand_path(File.dirname(__FILE__))
10
- # DIR_BASE = File.expand_path(File.dirname(__FILE__))
11
10
  DIR_PWD = Dir.pwd
12
11
  ENV_KEY = "PRO1_TESTER_TESTCASE"
13
12
 
14
- Dir.mkdir DIST_DIR unless Dir.exists? DIST_DIR
15
-
16
13
  class << self
17
14
  def run
15
+ Dir.mkdir DIST_DIR unless Dir.exists? DIST_DIR
18
16
  # puts %x(rspec #{File.join(DIR_BASE, "core.rb")} --color)
19
17
  Open3.pipeline("rspec #{File.join(DIR_BASE, "core.rb")} --color")
20
18
  end
19
+
20
+ def clear
21
+ FileUtils.rm_r(File.join(DIR_PWD, DIST_DIR))
22
+ end
21
23
  end
22
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pro1-tester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kumassy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,7 +74,6 @@ files:
74
74
  - lib/pro1_tester.rb
75
75
  - lib/pro1_tester/version.rb
76
76
  - pro1-tester.gemspec
77
- - testcase.yml
78
77
  homepage: https://github.com/Kumassy/pro1-tester
79
78
  licenses:
80
79
  - MIT
data/testcase.yml DELETED
@@ -1,188 +0,0 @@
1
- - target: a-01
2
- testcase:
3
- - expect: |
4
- A(65)
5
- B(66)
6
- C(67)
7
- D(68)
8
- E(69)
9
- F(70)
10
- G(71)
11
- H(72)
12
- I(73)
13
- J(74)
14
- K(75)
15
- L(76)
16
- M(77)
17
- N(78)
18
- O(79)
19
- P(80)
20
- Q(81)
21
- R(82)
22
- S(83)
23
- T(84)
24
- U(85)
25
- V(86)
26
- W(87)
27
- X(88)
28
- Y(89)
29
- Z(90)
30
- - target: a-02
31
- testcase:
32
- - input: |
33
- 123
34
- 100
35
- 43
36
- expect: |
37
- {
38
- ---
39
- d
40
- ---
41
- +
42
- ---
43
- - target: a-03
44
- testcase:
45
- - expect: |
46
- f[0]: 0.000000
47
- f[1]: 0.000000
48
- f[2]: 0.000000
49
- f[3]: 0.000000
50
- f[4]: 0.000000
51
- f[5]: 0.000000
52
- f[6]: 0.000000
53
- f[7]: 0.000000
54
- f[8]: 0.000000
55
- f[9]: 0.000000
56
- - target: a-04
57
- testcase:
58
- - input: AsDertYUio
59
- expect: "count : 3"
60
- - target: a-05
61
- testcase:
62
- - expect: |
63
- 11 12 13 14
64
- 15 16 17 18
65
- 19 20 21 22
66
-
67
- - target: b-01
68
- testcase:
69
- - expect: "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
70
- - target: b-02
71
- testcase:
72
- - input: |
73
- 1 2 3 4 5 6 7 8 9
74
- 9 8 7 6 5 4 3
75
- 2 1
76
- expect: |
77
- a
78
- 1 2 3
79
- 4 5 6
80
- 7 8 9
81
- b
82
- 9 8 7
83
- 6 5 4
84
- 3 2 1
85
- a + b
86
- 10 10 10
87
- 10 10 10
88
- 10 10 10
89
- - target: b-03
90
- testcase:
91
- - input: abcd0123ef01gh23
92
- expect: Zero in 4 10
93
- - target: b-04
94
- testcase:
95
- - input: |
96
- a c
97
- 12
98
- expect: |
99
- 97
100
- 32
101
- 99
102
- 49
103
- 50
104
- - target: c-01
105
- testcase:
106
- - input: |
107
- heLLo WoRLD.i'm student. Programming TANOSHII!!
108
- c is programming language.
109
- expect: |
110
- Hello World.I'm Student. Programming Tanoshii!!
111
- C Is Programming Language.
112
- - input: |
113
- !!!!
114
- expect: |
115
- !!!!
116
- label: should pass through symbols.
117
- - target: c-02
118
- testcase:
119
- - input: "abcbc\n"
120
- expect: |
121
- place[0] : A
122
- place[1] : B
123
- place[2] : A
124
- place[3] : A
125
- place[4] : C
126
- place[5] : C
127
- - input: "bcd\n"
128
- expect: |
129
- place[0] : A
130
- place[1] : C
131
- place[2] : C
132
- label: should exit for unexpeced input.
133
- - input: "abcbc"
134
- expect: |
135
- place[0] : A
136
- place[1] : B
137
- place[2] : A
138
- place[3] : A
139
- place[4] : C
140
- place[5] : C
141
- - input: "bcd"
142
- expect: |
143
- place[0] : A
144
- place[1] : C
145
- place[2] : C
146
- label: should exit for unexpeced input.
147
- - input: |
148
- a
149
- b
150
- c
151
-
152
- b
153
- expect: |
154
- place[0] : A
155
- place[1] : B
156
- place[2] : A
157
- place[3] : A
158
- place[4] : C
159
- label: should ignore LF.
160
-
161
- - target: d-01
162
- testcase:
163
- - input: "2 3 +\n"
164
- expect: |
165
- Result: 5
166
- ---
167
- - input: "5 20 3 * +\n"
168
- expect: |
169
- Result: 65
170
- ---
171
- - input: "1 15 + 23 3 - *\n"
172
- expect: |
173
- Result: 320
174
- ---
175
- - input: |
176
- 2 3 +
177
- 4 7 -
178
- expect: |
179
- Result: 5
180
- ---
181
- Result: -3
182
- ---
183
- label: should accept multi-input.
184
- - input: "5 20 3 * +\n"
185
- expect: |
186
- Result: 65
187
- ---
188
- label: should ignore spaces.