noofakku 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2ZkOGJhOTI5MWJkMWU3NzhiYWYyZmU0NWVlNTQ5MGRjM2UyZDczNw==
4
+ ZTgyZDdhYzM4YmQ4MzY3ZTMzMGVmYmY5MGZiNWRjNjcxZDhhM2Q1OQ==
5
5
  data.tar.gz: !binary |-
6
- NWYxNjQyNjk1ZmU2YTc3NTE2YzM3NjlmMTUyYzVmZTVkODg2MzY0NQ==
6
+ MGJkM2Y4ZTgzZjY3YzFhNjM2NzhlMDEzNGU1ZDdiMmJlNjIzY2M3Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWRiOTI4MTM0NmFmOTZkYmZmZjI4YjU0YjljMTMzMzdiMjIzZDU2MDJlZGQ1
10
- MGUyN2U1NmNmZTNjMDI5ZmJlYjA0NTc3OGFhOGEzMGQ5NWY4ZmE0ZTczNDYz
11
- NjczNmI1MGQwYjgxNDUzM2QzZTVkOWY0NDg4OWI0YWZhOWNlZGM=
9
+ ZTNmODAxNDY4YzY1NTQ4ZjFmMmIyOTU3ODU0NjgyNGNiYjE3ZTM0ZWQ4ZjUy
10
+ MjAxZTNkYjhkODRlMDUxZDk5MWZmNWYxYTIzMGE0YjcyOTFlM2IyYjIyNzNh
11
+ NDk4NTUwOTZjOWM4YzZiODhmNzU4M2MxNTRmZTU4M2JmZWEwYWI=
12
12
  data.tar.gz: !binary |-
13
- MjU4ZjMzZjc0NTQ0YTliMjJkOTEwNmEzNDFmOTZlY2RhZGFiNWE5MDBhMmNm
14
- OGZhMTU2MmM3YjkzZTU1OWMwZWE5MGZiZmQ4ZmRkZjRlYjQ4MTYwOTBjMmQy
15
- NzAzYmNlMTA0YzViNjZkNTFmZWI0ZGFlNzcyODZiOWJjNGMwNDQ=
13
+ OTY5OTdjZWQzMjQxODQyNjIyMmU3ZDg5N2NlYjc2ODIwZDU0YTZiMjcwOWMz
14
+ ZjJlMmYzMDY2MTUwZjNkMjQ0YmIwZjdjZDdmMDIzODAwMGNiOTczN2ViZjc5
15
+ ZTIwYTg2MjkzYTZiZjlhNGFjYzkzMDExNDk1MDg4YmQxNGM2YzU=
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  deploy:
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.0.0
5
4
  provider: rubygems
6
5
  api_key: "4fa314a48d7f66052bf71f2f97fc543c"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- noofakku (0.0.4)
4
+ noofakku (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- Noofakku
2
- ========
1
+ Status
2
+ ======
3
3
  <a href="http://badge.fury.io/rb/noofakku"><img src="https://badge.fury.io/rb/noofakku@2x.png" alt="Gem Version" height='18'></a>
4
4
  <br/>
5
5
  <a href="https://travis-ci.org/mcodella/noofakku"><img src="https://travis-ci.org/mcodella/noofakku.png?branch=master" alt="Travis-CI Status" height='18'></a>
@@ -7,3 +7,41 @@ Noofakku
7
7
  <a href="https://codeclimate.com/github/mcodella/noofakku"><img src="https://codeclimate.com/github/mcodella/noofakku.png" height='18'/></a>
8
8
  <br/>
9
9
  <a href='https://coveralls.io/r/mcodella/noofakku'><img src='https://coveralls.io/repos/mcodella/noofakku/badge.png' alt='Coverage Status' height='18'/></a>
10
+
11
+ Usage Sample
12
+ ============
13
+
14
+ ```ruby
15
+ require 'noofakku'
16
+
17
+ input = -> { 0 }
18
+ produced = ''
19
+ output = ->value { produced << value }
20
+
21
+ # will print "Hello World!\n"
22
+ program = '++++++++++[>+++++++>++++++++++>+++>'
23
+ program << '+<<<<-]>++.>+.+++++++..+++.>++.<<++'
24
+ program << '+++++++++++++.>.+++.------.--------.>+.>.'
25
+
26
+ Noofakku::VM.start(program, input, output)
27
+
28
+ p produced #=> "Hello World!\n"
29
+ ```
30
+
31
+ ```ruby
32
+ require 'noofakku'
33
+
34
+ to_be_sorted = [5, 3, 2, 6, 0].each
35
+ input = -> { to_be_sorted.next }
36
+ produced = []
37
+ output = ->value { produced << value }
38
+
39
+ # will sort the zero-ended array in input
40
+ program = '>>,[>>,]<< [[-<+<]>[>[>>]<[.[-]<[[>>+<<-]<]>>]>]<<]'
41
+
42
+ Noofakku::VM.start(program, input, output)
43
+
44
+ p produced #=> [2, 3, 5, 6]
45
+ ```
46
+
47
+ Other usage samples can be found in https://github.com/mcodella/noofakku/blob/master/test/noofakku_smoke_test.rb
data/lib/noofakku.rb CHANGED
@@ -6,6 +6,7 @@ require 'noofakku/instruction/prev'
6
6
  require 'noofakku/instruction/next'
7
7
  require 'noofakku/instruction/input'
8
8
  require 'noofakku/instruction/output'
9
+ require 'noofakku/instruction/noop'
9
10
  require 'noofakku/processor'
10
11
 
11
12
  module Noofakku
@@ -3,7 +3,7 @@ module Noofakku
3
3
  class Noop
4
4
 
5
5
  def perform(processor, memory, program, input, output)
6
- # lazyness is prevailing over me... :(
6
+ # lazyness is prevailing on me... :(
7
7
  end
8
8
 
9
9
  end
data/noofakku.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'noofakku'
3
3
  s.version = `git describe --tags --abbrev=0`.split("\n")[0]
4
- s.date = '2013-12-08'
4
+ s.date = `date +"%Y-%m-%d"`
5
5
  s.summary = "Noofakku"
6
6
  s.description = "A simple brainfuck implementation"
7
7
  s.authors = ["Mauro Codella"]
@@ -9,31 +9,31 @@ module Noofakku
9
9
  context 'Execution' do
10
10
 
11
11
  should 'produce "Hello World" in output' do
12
- input = -> { 0 }
13
- produced = ''
14
- output = ->value { produced << value }
15
- program = '++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.'
16
- Noofakku::VM.start(program, input, output)
12
+ input = -> { 0 }
13
+ produced = ''
14
+ output = ->value { produced << value }
15
+ program = '++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.'
16
+ Noofakku::VM.start(program, input, output)
17
17
  assert_equal "Hello World!\n", produced
18
18
  end
19
19
 
20
20
  should 'produce Fibonacci numbers in output' do
21
- program = '+.>+.>>>++++++++++[<<<[->>+<<]>>[-<+<+>>]<<<[->+<]>>[-<<+>>]<.>>>-]'
22
- input = -> { 0 }
23
- produced = []
24
- output = ->value { produced << value }
25
- Noofakku::VM.start(program, input, output)
26
- assert_equal [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144], produced
21
+ program = '+.>+.>>>++++++++++[<<<[->>+<<]>>[-<+<+>>]<<<[->+<]>>[-<<+>>]<.>>>-]'
22
+ input = -> { 0 }
23
+ produced = []
24
+ output = ->value { produced << value }
25
+ Noofakku::VM.start(program, input, output)
26
+ assert_equal [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144], produced
27
27
  end
28
28
 
29
29
  should 'order numbers in input' do
30
- program = '>>,[>>,]<< [[-<+<]>[>[>>]<[.[-]<[[>>+<<-]<]>>]>]<<]'
31
- to_be_sorted = [5, 3, 2, 6, 0].each
32
- input = -> { to_be_sorted.next }
33
- produced = []
34
- output = ->value { produced << value }
35
- Noofakku::VM.start(program, input, output)
36
- assert_equal [2, 3, 5, 6], produced
30
+ program = '>>,[>>,]<< [[-<+<]>[>[>>]<[.[-]<[[>>+<<-]<]>>]>]<<]'
31
+ to_be_sorted = [5, 3, 2, 6, 0].each
32
+ input = -> { to_be_sorted.next }
33
+ produced = []
34
+ output = ->value { produced << value }
35
+ Noofakku::VM.start(program, input, output)
36
+ assert_equal [2, 3, 5, 6], produced
37
37
  end
38
38
 
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noofakku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauro Codella
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-08 00:00:00.000000000 Z
11
+ date: 2013-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake