<commit_before>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'vm'
require 'bytecodes'
require 'pp'

describe "minimal vm" do
  it "create minimal vm" do
    vm = VM.new([])
    vm.cpu
  end
end

describe "VM tests" do
  it "should halt" do
    vm = VM.new([Bytecodes::HALT])
    rv = vm.cpu
    expect(rv).to be == Bytecodes::HALT
  end

  context "it should load, than halt" do
    vm = VM.new([Bytecodes::ICONST, 100, Bytecodes::HALT])
    rv = vm.cpu

    it "should load 100" do
      expect(vm.stack[vm.sp]).to eq(100)
    end

    it "and halt" do
      expect(rv).to eq(Bytecodes::HALT)
    end
  end
end
<commit_msg>Updated to reflect changes in Bytecodes class.<commit_after>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'vm'
require 'bytecodes'
require 'pp'

describe "VM tests:" do
  it "should halt" do
    vm = VM.new([Bytecodes::HALT])
    rv = vm.cpu
    expect(rv.opcode).to eq(Bytecodes::HALT.opcode)
  end

  context "it should load and halt" do
    vm = VM.new([Bytecodes::ICONST, 100, Bytecodes::HALT])
    rv = vm.cpu

    it "should load 100" do
      expect(vm.stack[vm.sp]).to eq(100)
    end

    it "and halt" do
      expect(rv).to eq(Bytecodes::HALT)
    end
  end

  context "it should load 2 constants and halt" do
    vm = VM.new([Bytecodes::ICONST, 1, Bytecodes::ICONST, 2, Bytecodes::HALT])
    rv = vm.cpu
    #puts "VM #{vm}"

    it "should load 35 and 88" do
      #expect(vm.stack[vm.sp]).to eq(100)
    end

    it "and halt" do
      #expect(rv).to eq(Bytecodes::HALT)
    end
  end

end

{'fraction_non_alphanumeric': 0.13636363636363635, 'fraction_numerical': 0.017676767676767676, 'mean_word_length': 2.9824120603015074, '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': '5955312', 'n_tokens_mistral': 611, 'n_tokens_neox': 574, 'n_words': 167}