Sha256: 93317aaf2af6da7a52f376f1ccdf06e1bf2d9631e6c94a06f0f00db38fed64f6
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require 'dentaku/binary_operation' describe Dentaku::BinaryOperation do let(:operation) { described_class.new(2, 3) } let(:logical) { described_class.new(true, false) } it 'raises a number to a power' do operation.pow.should eq [:numeric, 8] end it 'adds two numbers' do operation.add.should eq [:numeric, 5] end it 'subtracts two numbers' do operation.subtract.should eq [:numeric, -1] end it 'multiplies two numbers' do operation.multiply.should eq [:numeric, 6] end it 'divides two numbers' do operation.divide.should eq [:numeric, (2.0/3.0)] end it 'compares two numbers' do operation.le.should eq [:logical, true] operation.lt.should eq [:logical, true] operation.ne.should eq [:logical, true] operation.ge.should eq [:logical, false] operation.gt.should eq [:logical, false] operation.eq.should eq [:logical, false] end it 'performs logical AND and OR' do logical.and.should eq [:logical, false] logical.or.should eq [:logical, true] end it 'mods two numbers' do operation.mod.should eq [:numeric, 2%3] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dentaku-1.0.0 | spec/binary_operation_spec.rb |
dentaku-0.2.14 | spec/binary_operation_spec.rb |
dentaku-0.2.13 | spec/binary_operation_spec.rb |