Sha256: 29fee69c19b47bc5752adae061b551a6d12cfe7017740a6d67dc99b01889ae5c
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' describe Stellar::Convert, "hex encoding" do subject{ Stellar::Convert } let(:raw) { "\x01\x02\x03\x04" } let(:hex) { "01020304" } let(:base64){ "AQIDBA==" } describe "hex encoding" do it "decodes" do expect(subject.from_hex(hex)).to eq(raw) end it "encodes" do expect(subject.to_hex(raw)).to eq(hex) end it "round trips" do raw1 = subject.from_hex(hex) hex1 = subject.to_hex(raw1) expect(hex1).to eq(hex) hex2 = subject.to_hex(raw) raw2 = subject.from_hex(hex2) expect(raw2).to eq(raw) end end describe "base64 encoding" do it "decodes" do expect(subject.from_base64(base64)).to eq(raw) end it "encodes" do expect(subject.to_base64(raw)).to eq(base64) end it "round trips" do raw1 = subject.from_base64(base64) base641 = subject.to_base64(raw1) expect(base641).to eq(base64) base642 = subject.to_base64(raw) raw2 = subject.from_base64(base642) expect(raw2).to eq(raw) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
stellar-base-0.0.13 | spec/lib/stellar/convert_spec.rb |
stellar-base-0.0.12 | spec/lib/stellar/convert_spec.rb |
stellar-base-0.0.11 | spec/lib/stellar/convert_spec.rb |