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.105 spec/kern/functions_spec.rb
flok-0.0.103 spec/kern/functions_spec.rb
flok-0.0.102 spec/kern/functions_spec.rb
flok-0.0.101 spec/kern/functions_spec.rb
flok-0.0.100 spec/kern/functions_spec.rb
flok-0.0.99 spec/kern/functions_spec.rb
flok-0.0.98 spec/kern/functions_spec.rb
flok-0.0.97 spec/kern/functions_spec.rb
flok-0.0.96 spec/kern/functions_spec.rb
flok-0.0.95 spec/kern/functions_spec.rb
flok-0.0.94 spec/kern/functions_spec.rb
flok-0.0.93 spec/kern/functions_spec.rb
flok-0.0.92 spec/kern/functions_spec.rb
flok-0.0.91 spec/kern/functions_spec.rb
flok-0.0.90 spec/kern/functions_spec.rb
flok-0.0.89 spec/kern/functions_spec.rb
flok-0.0.88 spec/kern/functions_spec.rb
flok-0.0.87 spec/kern/functions_spec.rb
flok-0.0.86 spec/kern/functions_spec.rb
flok-0.0.85 spec/kern/functions_spec.rb