<commit_before>require File.expand_path('../spec_helper', __FILE__)

describe 'BadgeWars' do
  before :each do
    @world = BadgeWars::World.new
  end
  
  it "has a default world state of 0" do
    BadgeWars.core_size.times do |n|
      @world.peek(n).raw.should == "\0\0\0\0"
      @world[n].raw.should == "\0\0\0\0"
    end
  end
  
  it "can peek and poke the core" do
    @world.peek(0).raw.should == "\0\0\0\0"
    @world[0].raw.should == "\0\0\0\0"
    
    @world.poke(0, BadgeWars::Op[:mov, 42, 420])
    @world.peek(0).should be_eql(BadgeWars::Op[:mov, 42, 420])
    
    @world[0] = BadgeWars::Op[:mov, 42, 420]
    @world[0].should be_eql(BadgeWars::Op[:mov, 42, 420])
  end
  
  it "implements the MOV instruction (i.e. imps work)" do
    @world[0].raw.should == "\0\0\0\0"
    @world[1].raw.should == "\0\0\0\0"
    
    imp = BadgeWars::Op[:mov, 0, 1]
    @world[0] = imp
    @world.spawn 0
    @world.run
    
    @world[1].should be_eql(imp)
  end
end<commit_msg>Make the imp test slightly more exhaustive<commit_after>require File.expand_path('../spec_helper', __FILE__)

describe 'BadgeWars' do
  before :each do
    @world = BadgeWars::World.new
  end
  
  it "has a default world state of 0" do
    BadgeWars.core_size.times do |n|
      @world.peek(n).raw.should == "\0\0\0\0"
      @world[n].raw.should == "\0\0\0\0"
    end
  end
  
  it "can peek and poke the core" do
    @world.peek(0).raw.should == "\0\0\0\0"
    @world[0].raw.should == "\0\0\0\0"
    
    @world.poke(0, BadgeWars::Op[:mov, 42, 420])
    @world.peek(0).should be_eql(BadgeWars::Op[:mov, 42, 420])
    
    @world[0] = BadgeWars::Op[:mov, 42, 420]
    @world[0].should be_eql(BadgeWars::Op[:mov, 42, 420])
  end
  
  it "implements the MOV instruction (i.e. imps work)" do
    @world[0].raw.should == "\0\0\0\0"
    @world[1].raw.should == "\0\0\0\0"
    
    imp = BadgeWars::Op[:mov, 0, 1]
    @world[0] = imp
    @world.spawn 0
    @world.run
    
    @world[1].should be_eql(imp)
    @world[2].raw.should == "\0\0\0\0"
    @world.run
    
    @world[2].should be_eql(imp)
  end
end
{'fraction_non_alphanumeric': 0.18885151369533879, 'fraction_numerical': 0.05862566074002883, 'mean_word_length': 2.602076124567474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3357492', 'n_tokens_mistral': 953, 'n_tokens_neox': 899, 'n_words': 180}