yarbf 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +29 -0
  3. data/.gitignore +1 -1
  4. data/.rubocop.yml +1168 -0
  5. data/bin/yarbf +2 -2
  6. data/lib/yarbf.rb +147 -73
  7. data/lib/yarbf/version.rb +1 -1
  8. data/test/bf/hello-world.bf +15 -0
  9. data/test/bf/pi.bf +229 -0
  10. data/test/bf/show-bf.bf +17 -0
  11. data/test/bf/square.bf +79 -0
  12. data/test/helper.rb +40 -0
  13. data/test/input/cell_size/pi-10 +0 -0
  14. data/test/input/cell_size/pi-11 +0 -0
  15. data/test/input/cell_size/pi-12 +0 -0
  16. data/test/input/cell_size/pi-16 +0 -0
  17. data/test/input/cell_size/pi-8 +0 -0
  18. data/test/input/cell_size/pi-9 +0 -0
  19. data/test/input/debug/hello-world +0 -0
  20. data/test/input/debug/pi +0 -0
  21. data/test/input/debug/show-bf +1 -0
  22. data/test/input/debug/square +0 -0
  23. data/test/input/hello-world +0 -0
  24. data/test/input/input_mode/show-bf-buffered +1 -0
  25. data/test/input/input_mode/show-bf-raw +1 -0
  26. data/test/input/pi +0 -0
  27. data/test/input/show-bf +1 -0
  28. data/test/input/square +0 -0
  29. data/test/input/wrap_around/pi +0 -0
  30. data/test/output/cell_size/pi-10-1 +1 -0
  31. data/test/output/cell_size/pi-10-2 +1 -0
  32. data/test/output/cell_size/pi-11-1 +1 -0
  33. data/test/output/cell_size/pi-11-2 +0 -0
  34. data/test/output/cell_size/pi-12-1 +1 -0
  35. data/test/output/cell_size/pi-12-2 +0 -0
  36. data/test/output/cell_size/pi-16-1 +1 -0
  37. data/test/output/cell_size/pi-16-2 +0 -0
  38. data/test/output/cell_size/pi-32-1 +1 -0
  39. data/test/output/cell_size/pi-32-2 +0 -0
  40. data/test/output/cell_size/pi-8-1 +0 -0
  41. data/test/output/cell_size/pi-8-2 +1 -0
  42. data/test/output/cell_size/pi-9-1 +1 -0
  43. data/test/output/cell_size/pi-9-2 +1 -0
  44. data/test/output/construct_program_units/hello-world-1 +106 -0
  45. data/test/output/construct_program_units/pi-1 +648 -0
  46. data/test/output/construct_program_units/show-bf-1 +49 -0
  47. data/test/output/construct_program_units/square-1 +191 -0
  48. data/test/output/debug/hello-world-1 +1 -0
  49. data/test/output/debug/hello-world-2 +1 -0
  50. data/test/output/debug/pi-1 +0 -0
  51. data/test/output/debug/pi-2 +1 -0
  52. data/test/output/debug/show-bf-1 +1 -0
  53. data/test/output/debug/show-bf-2 +1 -0
  54. data/test/output/debug/square-1 +101 -0
  55. data/test/output/debug/square-2 +1 -0
  56. data/test/output/hello-world-1 +1 -0
  57. data/test/output/hello-world-2 +0 -0
  58. data/test/output/input_mode/show-bf-buffered-1 +1 -0
  59. data/test/output/input_mode/show-bf-buffered-2 +0 -0
  60. data/test/output/input_mode/show-bf-raw-1 +0 -0
  61. data/test/output/input_mode/show-bf-raw-2 +1 -0
  62. data/test/output/match_brackets/hello-world-1 +106 -0
  63. data/test/output/match_brackets/pi-1 +648 -0
  64. data/test/output/match_brackets/show-bf-1 +49 -0
  65. data/test/output/match_brackets/square-1 +191 -0
  66. data/test/output/pi-1 +0 -0
  67. data/test/output/pi-2 +1 -0
  68. data/test/output/show-bf-1 +1 -0
  69. data/test/output/show-bf-2 +0 -0
  70. data/test/output/square-1 +101 -0
  71. data/test/output/square-2 +0 -0
  72. data/test/output/wrap_around/pi-1 +1 -0
  73. data/test/output/wrap_around/pi-2 +0 -0
  74. data/test/test_bf_interpreter.rb +116 -0
  75. data/test/test_cell_size.rb +29 -0
  76. data/test/test_debug.rb +25 -0
  77. data/test/test_default.rb +19 -0
  78. data/test/test_input_mode.rb +29 -0
  79. data/test/test_wrap_around.rb +25 -0
  80. data/yarbf.gemspec +1 -1
  81. metadata +76 -2
@@ -0,0 +1,29 @@
1
+ require 'helper' # for TestBase
2
+
3
+ class TestCellSize < TestBase
4
+ def setup
5
+ super
6
+ @input_dir = File.join(@input_dir, 'cell_size')
7
+ @output_dir = File.join(@output_dir, 'cell_size')
8
+ end
9
+
10
+ # test 'cell_size' option
11
+ def test_cell_size
12
+ Dir.foreach(@input_dir) do |filename|
13
+ next if filename.eql?('.') || filename.eql?('..')
14
+
15
+ input = File.join(@input_dir, filename)
16
+ next if File.directory?(input)
17
+
18
+ # input filename must match this pattern
19
+ refute_nil(/(.*)-([1-9]\d*)$/.match(filename))
20
+ filename, size = $1, $2
21
+
22
+ bf_src = File.join(@bf_src_sir, "#{filename}.bf")
23
+ stdout = File.join(@output_dir, "#{filename}-#{size}-1")
24
+ stderr = File.join(@output_dir, "#{filename}-#{size}-2")
25
+
26
+ do_test(bf_src, "-s #{size}", input, stdout, stderr)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ require 'helper' # for TestBase
2
+
3
+ class TestDebug < TestBase
4
+ def setup
5
+ super
6
+ @input_dir = File.join(@input_dir, 'debug')
7
+ @output_dir = File.join(@output_dir, 'debug')
8
+ end
9
+
10
+ # test 'debug' switch
11
+ def test_debug
12
+ Dir.foreach(@input_dir) do |filename|
13
+ next if filename.eql?('.') || filename.eql?('..')
14
+
15
+ input = File.join(@input_dir, filename)
16
+ next if File.directory?(input)
17
+
18
+ bf_src = File.join(@bf_src_sir, "#{filename}.bf")
19
+ stdout = File.join(@output_dir, "#{filename}-1")
20
+ stderr = File.join(@output_dir, "#{filename}-2")
21
+
22
+ do_test(bf_src, '-d', input, stdout, stderr)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ require 'helper' # for TestBase
2
+
3
+ class TestDefault < TestBase
4
+ # test default mode
5
+ def test_default
6
+ Dir.foreach(@input_dir) do |filename|
7
+ next if filename.eql?('.') || filename.eql?('..')
8
+
9
+ input = File.join(@input_dir, filename)
10
+ next if File.directory?(input)
11
+
12
+ bf_src = File.join(@bf_src_sir, "#{filename}.bf")
13
+ stdout = File.join(@output_dir, "#{filename}-1")
14
+ stderr = File.join(@output_dir, "#{filename}-2")
15
+
16
+ do_test(bf_src, '', input, stdout, stderr)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,29 @@
1
+ require 'helper' # for TestBase
2
+
3
+ class TestInputMode < TestBase
4
+ def setup
5
+ super
6
+ @input_dir = File.join(@input_dir, 'input_mode')
7
+ @output_dir = File.join(@output_dir, 'input_mode')
8
+ end
9
+
10
+ # test 'wrap_around' switch
11
+ def test_wrap_around
12
+ Dir.foreach(@input_dir) do |filename|
13
+ next if filename.eql?('.') || filename.eql?('..')
14
+
15
+ input = File.join(@input_dir, filename)
16
+ next if File.directory?(input)
17
+
18
+ # input filename must match this pattern
19
+ refute_nil(/(.*)-(buffered|raw)$/.match(filename))
20
+ filename, mode = $1, $2
21
+
22
+ bf_src = File.join(@bf_src_sir, "#{filename}.bf")
23
+ stdout = File.join(@output_dir, "#{filename}-#{mode}-1")
24
+ stderr = File.join(@output_dir, "#{filename}-#{mode}-2")
25
+
26
+ do_test(bf_src, "-i #{mode}", input, stdout, stderr)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ require 'helper' # for TestBase
2
+
3
+ class TestWrapAround < TestBase
4
+ def setup
5
+ super
6
+ @input_dir = File.join(@input_dir, 'wrap_around')
7
+ @output_dir = File.join(@output_dir, 'wrap_around')
8
+ end
9
+
10
+ # test 'wrap_around' switch
11
+ def test_wrap_around
12
+ Dir.foreach(@input_dir) do |filename|
13
+ next if filename.eql?('.') || filename.eql?('..')
14
+
15
+ input = File.join(@input_dir, filename)
16
+ next if File.directory?(input)
17
+
18
+ bf_src = File.join(@bf_src_sir, "#{filename}.bf")
19
+ stdout = File.join(@output_dir, "#{filename}-1")
20
+ stderr = File.join(@output_dir, "#{filename}-2")
21
+
22
+ do_test(bf_src, '-w', input, stdout, stderr)
23
+ end
24
+ end
25
+ end
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.homepage = 'http://github.com/chaosdefinition/yarbf'
15
15
  s.license = 'MIT'
16
16
 
17
- s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ s.files = `git ls-files -z`.split("\x0")
18
18
  s.bindir = 'bin'
19
19
  s.executables = ['yarbf']
20
20
  s.require_paths = ['lib']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yarbf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chaos Shen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-31 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: io-console
@@ -32,7 +32,9 @@ executables:
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
+ - ".codeclimate.yml"
35
36
  - ".gitignore"
37
+ - ".rubocop.yml"
36
38
  - ".travis.yml"
37
39
  - CODE_OF_CONDUCT.md
38
40
  - Gemfile
@@ -42,6 +44,78 @@ files:
42
44
  - bin/yarbf
43
45
  - lib/yarbf.rb
44
46
  - lib/yarbf/version.rb
47
+ - test/bf/hello-world.bf
48
+ - test/bf/pi.bf
49
+ - test/bf/show-bf.bf
50
+ - test/bf/square.bf
51
+ - test/helper.rb
52
+ - test/input/cell_size/pi-10
53
+ - test/input/cell_size/pi-11
54
+ - test/input/cell_size/pi-12
55
+ - test/input/cell_size/pi-16
56
+ - test/input/cell_size/pi-8
57
+ - test/input/cell_size/pi-9
58
+ - test/input/debug/hello-world
59
+ - test/input/debug/pi
60
+ - test/input/debug/show-bf
61
+ - test/input/debug/square
62
+ - test/input/hello-world
63
+ - test/input/input_mode/show-bf-buffered
64
+ - test/input/input_mode/show-bf-raw
65
+ - test/input/pi
66
+ - test/input/show-bf
67
+ - test/input/square
68
+ - test/input/wrap_around/pi
69
+ - test/output/cell_size/pi-10-1
70
+ - test/output/cell_size/pi-10-2
71
+ - test/output/cell_size/pi-11-1
72
+ - test/output/cell_size/pi-11-2
73
+ - test/output/cell_size/pi-12-1
74
+ - test/output/cell_size/pi-12-2
75
+ - test/output/cell_size/pi-16-1
76
+ - test/output/cell_size/pi-16-2
77
+ - test/output/cell_size/pi-32-1
78
+ - test/output/cell_size/pi-32-2
79
+ - test/output/cell_size/pi-8-1
80
+ - test/output/cell_size/pi-8-2
81
+ - test/output/cell_size/pi-9-1
82
+ - test/output/cell_size/pi-9-2
83
+ - test/output/construct_program_units/hello-world-1
84
+ - test/output/construct_program_units/pi-1
85
+ - test/output/construct_program_units/show-bf-1
86
+ - test/output/construct_program_units/square-1
87
+ - test/output/debug/hello-world-1
88
+ - test/output/debug/hello-world-2
89
+ - test/output/debug/pi-1
90
+ - test/output/debug/pi-2
91
+ - test/output/debug/show-bf-1
92
+ - test/output/debug/show-bf-2
93
+ - test/output/debug/square-1
94
+ - test/output/debug/square-2
95
+ - test/output/hello-world-1
96
+ - test/output/hello-world-2
97
+ - test/output/input_mode/show-bf-buffered-1
98
+ - test/output/input_mode/show-bf-buffered-2
99
+ - test/output/input_mode/show-bf-raw-1
100
+ - test/output/input_mode/show-bf-raw-2
101
+ - test/output/match_brackets/hello-world-1
102
+ - test/output/match_brackets/pi-1
103
+ - test/output/match_brackets/show-bf-1
104
+ - test/output/match_brackets/square-1
105
+ - test/output/pi-1
106
+ - test/output/pi-2
107
+ - test/output/show-bf-1
108
+ - test/output/show-bf-2
109
+ - test/output/square-1
110
+ - test/output/square-2
111
+ - test/output/wrap_around/pi-1
112
+ - test/output/wrap_around/pi-2
113
+ - test/test_bf_interpreter.rb
114
+ - test/test_cell_size.rb
115
+ - test/test_debug.rb
116
+ - test/test_default.rb
117
+ - test/test_input_mode.rb
118
+ - test/test_wrap_around.rb
45
119
  - yarbf.gemspec
46
120
  homepage: http://github.com/chaosdefinition/yarbf
47
121
  licenses: