waterfoul/spec/instructions/misc_spec.rb

42 lines
753 B
Ruby
Raw Normal View History

2016-05-08 09:20:05 +02:00
require 'spec_helper'
describe Waterfoul::CPU do
before { $mmu = Waterfoul::MMU.new }
subject { Waterfoul::CPU.new }
describe '#stop_0' do
it 'sets stop flag' do
subject.stop_0
expect(subject.stop).to eq 1
end
end
describe '#halt' do
it 'sets the halt flag' do
subject.halt
2016-09-26 09:30:45 +02:00
expect(subject.halt).to eq true
2016-05-08 09:20:05 +02:00
end
end
describe '#di' do
it 'resets the interupt flag' do
subject.di
2016-09-26 09:30:45 +02:00
expect(subject.ime).to eq false
2016-05-08 09:20:05 +02:00
end
end
2016-09-26 09:30:45 +02:00
describe 'prefix_cb' do
2016-05-08 09:20:05 +02:00
it 'increments pc by 1' do
subject.prefix_cb
expect(subject.pc).to eq 1
end
end
describe '#ei' do
it 'sets the interupt flag' do
subject.ei
2016-09-26 09:30:45 +02:00
expect(subject.ime).to eq true
2016-05-08 09:20:05 +02:00
end
end
end