Sha256: 35329e2f6975122ff7633c0a39285425041a63c49820bd25c5ef2ad246a37f1f

Contents?: true

Size: 1.16 KB

Versions: 26

Compression:

Stored size: 1.16 KB

Contents

require File.dirname(__FILE__) + '/../../../../../spec_helper'
include OpenEHR::RM::DataTypes::Quantity

describe DvAbsoluteQuantity do
  before(:each) do
    @dv_absolute_quantity = DvAbsoluteQuantity.new(:magnitude => 7)
  end

  it 'should be an instance of DvAbsoluteQuantity' do
    @dv_absolute_quantity.should be_an_instance_of DvAbsoluteQuantity
  end

  it 's add 3 method should magnitude 10' do
    dv_absolute_quantity10 =
      @dv_absolute_quantity.add(DvAbsoluteQuantity.new(:magnitude => 3))
    dv_absolute_quantity10.magnitude.should == 10
  end

  it 's diff method should return DvAmount' do    
    diff_dv_amount = @dv_absolute_quantity.diff(DvAbsoluteQuantity.new(
                                                    :magnitude => 10))
    diff_dv_amount.magnitude.should == 3
  end

  it 's subtract method should raise NotImplementedError' do
    sub_dv_absolute_quantity = @dv_absolute_quantity.subtract(DvAbsoluteQuantity.new(:magnitude => 10))
    sub_dv_absolute_quantity.magnitude.should == -3
  end

  it 'should be raise ArgumentError when type mismatched' do
    lambda {
      @dv_absolute_quantity.add(1)
    }.should raise_error ArgumentError
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
openehr-1.2.8 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.2.7 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.2.6 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.2.5 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.2.4 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.2.3 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.2.2 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.2.1 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.2.0 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.1.6 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.1.5 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.1.4 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.1.3 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.1.2 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.1.1 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
openehr-1.1.0 spec/lib/openehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
open_ehr-1.0.2 spec/lib/open_ehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
open_ehr-1.0.1 spec/lib/open_ehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
open_ehr-1.0.0 spec/lib/open_ehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb
open_ehr-0.9.5 spec/lib/open_ehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb