File: float_32bit_spec.rb

package info (click to toggle)
ruby-amq-protocol 2.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 572 kB
  • sloc: ruby: 5,975; python: 248; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 579 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# encoding: binary

RSpec.describe AMQ::Protocol::Float32Bit do
  describe "#initialize" do
    it "stores the value" do
      f = described_class.new(3.14)
      expect(f.value).to eq(3.14)
    end
  end

  describe "#value" do
    it "returns the stored value" do
      f = described_class.new(2.718)
      expect(f.value).to eq(2.718)
    end

    it "works with zero" do
      f = described_class.new(0.0)
      expect(f.value).to eq(0.0)
    end

    it "works with negative values" do
      f = described_class.new(-1.5)
      expect(f.value).to eq(-1.5)
    end
  end
end