Sha256: 0a04c5cb4a26d67ee30c001c746892afc2b7ad049b5fc3c68036a4e1e5c78669

Contents?: true

Size: 1.15 KB

Versions: 63

Compression:

Stored size: 1.15 KB

Contents

#Generic kernel functions

Dir.chdir File.join File.dirname(__FILE__), '../../'
require './spec/env/kern.rb'
require './spec/lib/helpers.rb'
require './spec/lib/io_extensions.rb'
require './spec/lib/rspec_extensions.rb'

RSpec.describe "kern:functions_spec" do
  include_context "kern"

 it "can use crc32" do
    ctx = flok_new_user File.read('./spec/kern/assets/controller0.rb')

    #Run the check
    res = ctx.eval("crc32(0, 'test')")
    expect(res).to eq(3632233996)
  end

 it "can use crc32 multiple times" do
    ctx = flok_new_user File.read('./spec/kern/assets/controller0.rb')

    #Run the check
    res = ctx.eval("crc32(crc32(0, 'test'), 'test2')")
    res2 = ctx.eval("crc32(crc32(0, 'test2'), 'test')")
    expect(res).not_to eq(res2)
  end

 it "can use gen_id" do
    ctx = flok_new_user File.read('./spec/kern/assets/controller0.rb')

    #Run the check
    res = ctx.eval("gen_id()")
    res2 = ctx.eval("gen_id()")
    reset_for_ctx

    ctx2 = flok_new_user File.read('./spec/kern/assets/controller0.rb')

    res3 = ctx2.eval("gen_id()")
    expect(res.class).to eq(String)
    expect(res).not_to eq(res2)
    expect(res3).not_to eq(res)
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
flok-0.0.84 spec/kern/functions_spec.rb
flok-0.0.83 spec/kern/functions_spec.rb
flok-0.0.82 spec/kern/functions_spec.rb
flok-0.0.81 spec/kern/functions_spec.rb
flok-0.0.80 spec/kern/functions_spec.rb
flok-0.0.79 spec/kern/functions_spec.rb
flok-0.0.78 spec/kern/functions_spec.rb
flok-0.0.77 spec/kern/functions_spec.rb
flok-0.0.76 spec/kern/functions_spec.rb
flok-0.0.75 spec/kern/functions_spec.rb
flok-0.0.74 spec/kern/functions_spec.rb
flok-0.0.73 spec/kern/functions_spec.rb
flok-0.0.72 spec/kern/functions_spec.rb
flok-0.0.71 spec/kern/functions_spec.rb
flok-0.0.70 spec/kern/functions_spec.rb
flok-0.0.69 spec/kern/functions_spec.rb
flok-0.0.68 spec/kern/functions_spec.rb
flok-0.0.67 spec/kern/functions_spec.rb
flok-0.0.66 spec/kern/functions_spec.rb
flok-0.0.65 spec/kern/functions_spec.rb