Sha256: 19eaa1e02c37add3ba741949dc5c0e0af43361d1bd9e2c438a250dd33166a1d1

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe "Standard Library" do
  describe "string-to-num" do
    before :each do
      @interpreter = Flea::Interpreter.new
    end
    
    it "should convert string to integer" do
      result = @interpreter.run('(string-to-num "10")')
      result.should == 10
    end
    
    it "should convert string to float" do
      result = @interpreter.run('(string-to-num "23.0")')
      result.should == 23.0
    end
    
    it "should evaluate its arguments" do
      result = @interpreter.run('
        (define a 2)
        (string-to-num a)
      ')
      result.should == 2
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flea-0.1.0 spec/flea/standard_library/string_to_num_spec.rb