pro1-tester 0.1.0
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 +7 -0
- data/.gitignore +12 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Dockerfile +10 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +131 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/pro1-tester +22 -0
- data/bin/setup +8 -0
- data/lib/core.rb +88 -0
- data/lib/pro1_tester.rb +22 -0
- data/lib/pro1_tester/version.rb +3 -0
- data/pro1-tester.gemspec +34 -0
- data/testcase.yml +188 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ad58c3c90e4dae926007384d38ae93225641ab7b
|
4
|
+
data.tar.gz: 40f4243e8203de6dca2fc8ed388525dcaf8f82cf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d45ea87e663b245cec29bc35eb076cafb190bf0817d40360a96f0bc4d18693c77bb19b2889aa329b38388ba301c533a73e462e9e89dba214420251071dbbf379
|
7
|
+
data.tar.gz: 7f37518c6c1998c3bcaf7909f21a8378e1d71b36ae221db1588e9d72e1927f043e242985e64ae02bed093f2db30a663e97eb524d2b48a73410d53aac355e65e9
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at kumassyii@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Dockerfile
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Kumassy
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# pro1-tester
|
2
|
+
BDD for Pro1
|
3
|
+
|
4
|
+
# Overview
|
5
|
+
プロ1のテストを自動化するためのスクリプトです。
|
6
|
+
テストケースはとりあえず`assignment_09-*.c`用のものが入っています。
|
7
|
+
|
8
|
+
# How to use...
|
9
|
+
**Vagrant** でも使って **CenOS** 環境で動かしましょう。
|
10
|
+
Ruby と RSpec のインストールを事前にしておきましょう。
|
11
|
+
|
12
|
+
```
|
13
|
+
git clone https://github.com/Kumassy/pro1-tester.git
|
14
|
+
cd pro1-tester
|
15
|
+
```
|
16
|
+
|
17
|
+
同じディレクトリにソースコード (*.c) を置いてください。
|
18
|
+
```
|
19
|
+
.
|
20
|
+
├── Dockerfile
|
21
|
+
├── assignment_09-a-01.c
|
22
|
+
├── assignment_09-a-02.c
|
23
|
+
├── assignment_09-a-03.c
|
24
|
+
├── assignment_09-a-04.c
|
25
|
+
├── assignment_09-a-05.c
|
26
|
+
├── assignment_09-b-01.c
|
27
|
+
├── assignment_09-b-02.c
|
28
|
+
├── assignment_09-b-03.c
|
29
|
+
├── assignment_09-b-04.c
|
30
|
+
├── assignment_09-c-01.c
|
31
|
+
├── assignment_09-c-02.c
|
32
|
+
├── assignment_09-d-01.c
|
33
|
+
├── testcase.yml
|
34
|
+
└── tester.rb
|
35
|
+
```
|
36
|
+
そして
|
37
|
+
```
|
38
|
+
rspec tester.rb --color
|
39
|
+
```
|
40
|
+
を実行するとテスト結果がでます。
|
41
|
+
|
42
|
+
# How to use (with docker)
|
43
|
+
Ruby とかのインストールが面倒くさいときは Docker から実行してもよろしいかと思います。
|
44
|
+
|
45
|
+
## Docker イメージのビルド
|
46
|
+
```
|
47
|
+
cd pro1-tester
|
48
|
+
docker build -t my-ruby-image .
|
49
|
+
```
|
50
|
+
|
51
|
+
## Docker コンテナの実行
|
52
|
+
```
|
53
|
+
cd pro1-tester
|
54
|
+
docker run -it --rm -v "$PWD":/app/ -w /app/ my-ruby-image rspec tester.rb --color
|
55
|
+
```
|
56
|
+
|
57
|
+
# Writing `testcase.yml`
|
58
|
+
**YAML** の記法で書いていきます。
|
59
|
+
基本的に雰囲気で書けばOKです。
|
60
|
+
|
61
|
+
- 出力だけ見るプログラムの場合、`input`は省略可能です。
|
62
|
+
- `label`は`it`に渡すアレです。省略した場合はデフォルトのラベルが使われます。
|
63
|
+
- `input`に特定の文字(`"`とか`\`とか)が含まれるときはエスケープが必要です。
|
64
|
+
- `input`の最後に改行が必要で`input`を1行で書くときは、`input`を`""`で囲って最後に`\n`をつけてください。
|
65
|
+
- 複数行の文字列を書くときには注意しましょう。
|
66
|
+
|
67
|
+
```
|
68
|
+
- expect: |
|
69
|
+
A(65) # ここでインデントつける
|
70
|
+
B(66)
|
71
|
+
C(67)
|
72
|
+
D(68)
|
73
|
+
E(69)
|
74
|
+
|
75
|
+
```
|
76
|
+
```
|
77
|
+
- expect: |
|
78
|
+
A(65) # これはシンタックスエラー
|
79
|
+
B(66)
|
80
|
+
C(67)
|
81
|
+
D(68)
|
82
|
+
E(69)
|
83
|
+
|
84
|
+
```
|
85
|
+
|
86
|
+
# 注意
|
87
|
+
- 無限ループ内で標準入力を読んでいて、`C-d`をスルーするプログラムの場合はこのスクリプトも無限ループに陥ります(OS がプロセスを強制終了する場合もあります)。
|
88
|
+
- 仕様上、標準入力に書き込んでその標準出力を見て、その結果に応じてさらに標準入力にデータを流すことはできません。標準入力にガーッと書き込んでダーッと結果を検証する感じでお願いします。
|
89
|
+
- 標準エラー出力は無視されます。
|
90
|
+
- このテストケースをパスすればあなたのプログラムが確実に正しい動作をする、ということは完全には保証できません。提出前には手動で最終確認をすることを推奨します。
|
91
|
+
|
92
|
+
# 仕様
|
93
|
+
- 標準入力には`input`のパース結果がそのまま渡されます
|
94
|
+
- `input` を1行で書いたときは明示的に`\n`を指定しない限り改行コードは渡されません(Enter キー押さないのと同じ)。
|
95
|
+
- `input` を`|`を使って複数行で書いたときは、最終行も含めそれぞれの行末に`\n`がつきます。
|
96
|
+
- 標準出力と`expect`は以下のルールで比較されます
|
97
|
+
- 改行の直前にある1文字以上の空白文字を取り除きます
|
98
|
+
- これにより標準出力の行末にスペースが入っていてもいい感じにマッチします。
|
99
|
+
- 最終行の改行を取り除きます
|
100
|
+
- これは`expect`が1行だけで、明示的に`\n`を指定しないときにもマッチするようにするためです。
|
101
|
+
|
102
|
+
# My Environment (on Vagrant)
|
103
|
+
```
|
104
|
+
cat /etc/redhat-release
|
105
|
+
CentOS release 6.7 (Final)
|
106
|
+
```
|
107
|
+
```
|
108
|
+
ruby -v
|
109
|
+
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
|
110
|
+
```
|
111
|
+
```
|
112
|
+
rspec -v
|
113
|
+
3.4.4
|
114
|
+
```
|
115
|
+
```
|
116
|
+
gcc -v
|
117
|
+
Using built-in specs.
|
118
|
+
Target: x86_64-redhat-linux
|
119
|
+
コンフィグオプション: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
|
120
|
+
スレッドモデル: posix
|
121
|
+
gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
|
122
|
+
```
|
123
|
+
```
|
124
|
+
docker -v
|
125
|
+
Docker version 1.7.1, build 786b29d
|
126
|
+
```
|
127
|
+
|
128
|
+
# TODO
|
129
|
+
- `Gemfile`かく
|
130
|
+
- テストケースのシンタックスみすったときのエラーをまともにする
|
131
|
+
- 無限ループするプログラムに対してのタイムアウト処理
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pro1_tester"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/pro1-tester
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
require 'optparse'
|
4
|
+
require 'pro1_tester'
|
5
|
+
|
6
|
+
|
7
|
+
module Pro1Tester
|
8
|
+
OptionParser.new do |opt|
|
9
|
+
opt.banner = "Usage: pro1-tester [options]"
|
10
|
+
opt.separator "options are:"
|
11
|
+
opt.on('-h', '--help', "Show this message") do
|
12
|
+
puts opt
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
opt.on('-d', "Use default testcase. (testcase.default.yml)") do
|
16
|
+
ENV.store(ENV_KEY,File.join(DIR_PWD, "testcase.default.yml"))
|
17
|
+
end
|
18
|
+
opt.parse!(ARGV)
|
19
|
+
end
|
20
|
+
|
21
|
+
Pro1Tester.run
|
22
|
+
end
|
data/bin/setup
ADDED
data/lib/core.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require 'rspec'
|
3
|
+
require 'yaml'
|
4
|
+
require 'pro1_tester'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.backtrace_exclusion_patterns = [
|
8
|
+
# /\/lib\d*\/ruby\/.*(?!.*pro1-tester).*/,
|
9
|
+
/\/lib\d*\/ruby\//,
|
10
|
+
/gems/,
|
11
|
+
/org\/jruby\//,
|
12
|
+
/bin\//,
|
13
|
+
/lib\/rspec\/(core|expectations|matchers|mocks)/
|
14
|
+
]
|
15
|
+
config.backtrace_inclusion_patterns = [
|
16
|
+
/pro1-tester/
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
module Pro1Tester
|
21
|
+
load_path = []
|
22
|
+
load_path << ENV[ENV_KEY]
|
23
|
+
load_path << File.join(DIR_PWD, "testcase.yml")
|
24
|
+
load_path << File.join(DIR_PWD, "testcase.default.yml")
|
25
|
+
yml_path = load_path.compact.select do |lp|
|
26
|
+
File.exists? lp
|
27
|
+
end.first
|
28
|
+
|
29
|
+
# tasks = YAML.load_file(File.join(DIR_BASE,"testcase.yml"))
|
30
|
+
|
31
|
+
tasks = nil
|
32
|
+
begin
|
33
|
+
tasks = YAML.load_file(yml_path)
|
34
|
+
rescue Psych::SyntaxError => e
|
35
|
+
puts "Syntax Error! : #{e.to_s}"
|
36
|
+
exit(1)
|
37
|
+
end
|
38
|
+
|
39
|
+
tasks.each do |task|
|
40
|
+
src_file_identifer = task["target"]
|
41
|
+
src_file = Dir.glob(DIR_PWD + "/*").grep(/#{src_file_identifer}.c/).first
|
42
|
+
# src_file = Dir.glob(DIR_BASE + "/*").grep(/#{src_file_identifer}.c/).first
|
43
|
+
# src_path = File.join(DIR_BASE,src_file)
|
44
|
+
|
45
|
+
# compile
|
46
|
+
# %x(gcc #{src_file} -o #{File.join(DIST_DIR, src_file_identifer)})
|
47
|
+
%x(gcc #{src_file} -o #{File.join(DIR_PWD, DIST_DIR, src_file_identifer)})
|
48
|
+
|
49
|
+
|
50
|
+
# parse testcases
|
51
|
+
RSpec.describe src_file do
|
52
|
+
testcases = task["testcase"]
|
53
|
+
|
54
|
+
testcases.each do |testcase|
|
55
|
+
# Open3.popen3(File.join(DIR_BASE, DIST_DIR, src_file_identifer)) do |stdin, stdout, stderr, wait_thr|
|
56
|
+
Open3.popen3(File.join(DIR_PWD, DIST_DIR, src_file_identifer)) do |stdin, stdout, stderr, wait_thr|
|
57
|
+
if testcase.has_key? "input"
|
58
|
+
stdin.write testcase["input"]
|
59
|
+
stdin.close
|
60
|
+
end
|
61
|
+
|
62
|
+
testcase["result"] = stdout.read
|
63
|
+
end
|
64
|
+
|
65
|
+
if testcase.has_key? "input"
|
66
|
+
label = testcase.fetch("label",
|
67
|
+
"should return \n--------\n#{testcase["expect"]}--------\n when gets \n--------\n#{testcase["input"]}--------")
|
68
|
+
else
|
69
|
+
label = testcase.fetch("label",
|
70
|
+
"should return \n--------\n#{testcase["expect"]}--------")
|
71
|
+
end
|
72
|
+
it(label) do
|
73
|
+
# remove space just in front of LF
|
74
|
+
# remove the last LF if exist
|
75
|
+
result = testcase["result"]
|
76
|
+
result.gsub!(/\s+\n/, "\n")
|
77
|
+
result.gsub!(/\n$/, "")
|
78
|
+
|
79
|
+
expectation = testcase["expect"]
|
80
|
+
expectation.gsub!(/\s+\n/, "\n")
|
81
|
+
expectation.gsub!(/\n$/, "")
|
82
|
+
|
83
|
+
expect(result).to eq expectation
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/pro1_tester.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "pro1_tester/version"
|
2
|
+
require 'open3'
|
3
|
+
require 'rspec'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
|
7
|
+
module Pro1Tester
|
8
|
+
DIST_DIR = "tmp"
|
9
|
+
DIR_BASE = File.expand_path(File.dirname(__FILE__))
|
10
|
+
# DIR_BASE = File.expand_path(File.dirname(__FILE__))
|
11
|
+
DIR_PWD = Dir.pwd
|
12
|
+
ENV_KEY = "PRO1_TESTER_TESTCASE"
|
13
|
+
|
14
|
+
Dir.mkdir DIST_DIR unless Dir.exists? DIST_DIR
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def run
|
18
|
+
# puts %x(rspec #{File.join(DIR_BASE, "core.rb")} --color)
|
19
|
+
Open3.pipeline("rspec #{File.join(DIR_BASE, "core.rb")} --color")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/pro1-tester.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pro1_tester/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pro1-tester"
|
8
|
+
spec.version = Pro1Tester::VERSION
|
9
|
+
spec.authors = ["Kumassy"]
|
10
|
+
spec.email = ["kumassyii@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{BDD for Pro1}
|
13
|
+
spec.description = %q{Test framework for Pro1}
|
14
|
+
spec.homepage = "https://github.com/Kumassy/pro1-tester"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
# spec.bindir = "exe"
|
27
|
+
# spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.executables = ["pro1-tester"]
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
32
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
34
|
+
end
|
data/testcase.yml
ADDED
@@ -0,0 +1,188 @@
|
|
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.
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pro1-tester
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kumassy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.4'
|
55
|
+
description: Test framework for Pro1
|
56
|
+
email:
|
57
|
+
- kumassyii@gmail.com
|
58
|
+
executables:
|
59
|
+
- pro1-tester
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- CODE_OF_CONDUCT.md
|
65
|
+
- Dockerfile
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/pro1-tester
|
72
|
+
- bin/setup
|
73
|
+
- lib/core.rb
|
74
|
+
- lib/pro1_tester.rb
|
75
|
+
- lib/pro1_tester/version.rb
|
76
|
+
- pro1-tester.gemspec
|
77
|
+
- testcase.yml
|
78
|
+
homepage: https://github.com/Kumassy/pro1-tester
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata:
|
82
|
+
allowed_push_host: https://rubygems.org
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.4.8
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: BDD for Pro1
|
103
|
+
test_files: []
|
104
|
+
has_rdoc:
|