Sha256: efb6c4cde3adc1dd547c48af077f5608a7810085e02b55efcddcc1bd95d47a5d

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

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

describe "Standard Library" do
  describe "division operator" do
    before :each do
      @interpreter = Flea::Interpreter.new
    end
    
    it "should divide several integers" do
      result = @interpreter.run('(/ 10 2 2)')
      result.should == 2
    end
    
    it "should divide several floats" do
      result = @interpreter.run('(/ 10.0 2 2)')
      result.should == 2.5
    end
    
    it "should evaluate its arguments before dividing them" do
      result = @interpreter.run('
        (define a 2)
        (define b 10)
        (/ b a 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/division_operator_spec.rb