gruesome 0.0.3 → 0.0.4

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.
@@ -1,90 +1,90 @@
1
1
  require_relative '../../lib/gruesome/z/memory'
2
2
 
3
3
  describe Gruesome::Z::Memory do
4
- before(:each) do
5
- zork = File.open('test/zork1.z3', 'r')
6
- @zork_memory = Gruesome::Z::Memory.new(zork.read(zork.size))
7
- end
4
+ before(:each) do
5
+ zork = File.open('test/zork1.z3', 'r')
6
+ @zork_memory = Gruesome::Z::Memory.new(zork.read(zork.size))
7
+ end
8
8
 
9
- describe "#readb" do
10
- it "should read a byte in header" do
11
- @zork_memory.readb(0x0).should eql(3)
12
- end
9
+ describe "#readb" do
10
+ it "should read a byte in header" do
11
+ @zork_memory.readb(0x0).should eql(3)
12
+ end
13
13
 
14
- it "should read a byte in dynamic memory" do
15
- @zork_memory.readb(0x100).should eql(32)
16
- end
14
+ it "should read a byte in dynamic memory" do
15
+ @zork_memory.readb(0x100).should eql(32)
16
+ end
17
17
 
18
- it "should read a byte in static memory" do
19
- @zork_memory.readb(0x2E53).should eql(47)
20
- @zork_memory.readb(0x4E36).should eql(0)
21
- end
18
+ it "should read a byte in static memory" do
19
+ @zork_memory.readb(0x2E53).should eql(47)
20
+ @zork_memory.readb(0x4E36).should eql(0)
21
+ end
22
22
 
23
- it "should not read a byte in high memory" do
24
- lambda {@zork_memory.readb(0x4E37)}.should raise_error(RuntimeError)
25
- end
26
- end
23
+ it "should not read a byte in high memory" do
24
+ lambda {@zork_memory.readb(0x4E37)}.should raise_error(RuntimeError)
25
+ end
26
+ end
27
27
 
28
- describe "#readw" do
29
- it "should read a word in header" do
30
- @zork_memory.readw(0x0).should eql(768)
31
- end
28
+ describe "#readw" do
29
+ it "should read a word in header" do
30
+ @zork_memory.readw(0x0).should eql(768)
31
+ end
32
32
 
33
- it "should read a word in dynamic memory" do
34
- @zork_memory.readw(0x100).should eql(8403)
35
- end
33
+ it "should read a word in dynamic memory" do
34
+ @zork_memory.readw(0x100).should eql(8403)
35
+ end
36
36
 
37
- it "should read a word in static memory" do
38
- @zork_memory.readw(0x2E53).should eql(12127)
39
- @zork_memory.readw(0x4E35).should eql(256)
40
- end
37
+ it "should read a word in static memory" do
38
+ @zork_memory.readw(0x2E53).should eql(12127)
39
+ @zork_memory.readw(0x4E35).should eql(256)
40
+ end
41
41
 
42
- it "should not read a word in high memory" do
43
- lambda{@zork_memory.readw(0x4E36)}.should raise_error(RuntimeError)
44
- end
45
- end
42
+ it "should not read a word in high memory" do
43
+ lambda{@zork_memory.readw(0x4E36)}.should raise_error(RuntimeError)
44
+ end
45
+ end
46
46
 
47
- describe "#writeb" do
48
- it "should write a byte in dynamic memory" do
49
- @zork_memory.writeb(0x100, 128)
50
- @zork_memory.readb(0x100).should eql(128)
51
- end
47
+ describe "#writeb" do
48
+ it "should write a byte in dynamic memory" do
49
+ @zork_memory.writeb(0x100, 128)
50
+ @zork_memory.readb(0x100).should eql(128)
51
+ end
52
52
 
53
- it "should not write a byte in static memory" do
54
- @zork_memory.force_writeb(0x2E53, 123)
55
- lambda{@zork_memory.writeb(0x2E53, 128)}.should raise_error(RuntimeError)
56
- @zork_memory.readb(0x2E53).should eql(123)
57
- @zork_memory.force_writeb(0x4E36, 123)
58
- lambda{@zork_memory.writeb(0x4E36, 128)}.should raise_error(RuntimeError)
59
- @zork_memory.readb(0x4E36).should eql(123)
60
- end
53
+ it "should not write a byte in static memory" do
54
+ @zork_memory.force_writeb(0x2E53, 123)
55
+ lambda{@zork_memory.writeb(0x2E53, 128)}.should raise_error(RuntimeError)
56
+ @zork_memory.readb(0x2E53).should eql(123)
57
+ @zork_memory.force_writeb(0x4E36, 123)
58
+ lambda{@zork_memory.writeb(0x4E36, 128)}.should raise_error(RuntimeError)
59
+ @zork_memory.readb(0x4E36).should eql(123)
60
+ end
61
61
 
62
- it "should not write a byte in high memory" do
63
- @zork_memory.force_writeb(0x4E37, 123)
64
- lambda{@zork_memory.writeb(0x4E37, 128)}.should raise_error(RuntimeError)
65
- @zork_memory.force_readb(0x4E37).should eql(123)
66
- end
67
- end
62
+ it "should not write a byte in high memory" do
63
+ @zork_memory.force_writeb(0x4E37, 123)
64
+ lambda{@zork_memory.writeb(0x4E37, 128)}.should raise_error(RuntimeError)
65
+ @zork_memory.force_readb(0x4E37).should eql(123)
66
+ end
67
+ end
68
68
 
69
- describe "#writew" do
70
- it "should write a word in dynamic memory" do
71
- @zork_memory.writew(0x100, 12345)
72
- @zork_memory.readw(0x100).should eql(12345)
73
- end
69
+ describe "#writew" do
70
+ it "should write a word in dynamic memory" do
71
+ @zork_memory.writew(0x100, 12345)
72
+ @zork_memory.readw(0x100).should eql(12345)
73
+ end
74
74
 
75
- it "should not write a word in static memory" do
76
- @zork_memory.force_writew(0x2E53, 23456)
77
- lambda{@zork_memory.writew(0x2E53, 12345)}.should raise_error(RuntimeError)
78
- @zork_memory.readw(0x2E53).should eql(23456)
79
- @zork_memory.force_writew(0x4E35, 23456)
80
- lambda{@zork_memory.writew(0x4E35, 12345)}.should raise_error(RuntimeError)
81
- @zork_memory.readw(0x4E35).should eql(23456)
82
- end
75
+ it "should not write a word in static memory" do
76
+ @zork_memory.force_writew(0x2E53, 23456)
77
+ lambda{@zork_memory.writew(0x2E53, 12345)}.should raise_error(RuntimeError)
78
+ @zork_memory.readw(0x2E53).should eql(23456)
79
+ @zork_memory.force_writew(0x4E35, 23456)
80
+ lambda{@zork_memory.writew(0x4E35, 12345)}.should raise_error(RuntimeError)
81
+ @zork_memory.readw(0x4E35).should eql(23456)
82
+ end
83
83
 
84
- it "should not write a word in high memory" do
85
- @zork_memory.force_writew(0x4E36, 23456)
86
- lambda{@zork_memory.writew(0x4E36, 12345)}.should raise_error(RuntimeError)
87
- @zork_memory.force_readw(0x4E36).should eql(23456)
88
- end
89
- end
84
+ it "should not write a word in high memory" do
85
+ @zork_memory.force_writew(0x4E36, 23456)
86
+ lambda{@zork_memory.writew(0x4E36, 12345)}.should raise_error(RuntimeError)
87
+ @zork_memory.force_readw(0x4E36).should eql(23456)
88
+ end
89
+ end
90
90
  end