From a62d3965da46012901bd19a73f3eff966b3158e8 Mon Sep 17 00:00:00 2001 From: Karchnu Date: Mon, 21 Jun 2021 19:34:40 +0200 Subject: [PATCH] Add CBOR Time tests. --- spec/cbor_time.cr | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 spec/cbor_time.cr diff --git a/spec/cbor_time.cr b/spec/cbor_time.cr new file mode 100644 index 0000000..a6e99c0 --- /dev/null +++ b/spec/cbor_time.cr @@ -0,0 +1,15 @@ +require "./spec_helper" + +describe CBOR do + describe "Time" do + it "Time#to_cbor" do + time = Time.utc(2016, 2, 15, 10, 20, 30) + time.to_cbor.hexstring.should eq "c074323031362d30322d31355431303a32303a33305a" + end + + it "Time#from_cbor" do + time = Time.from_cbor Time.utc(2016, 2, 15, 10, 20, 30).to_cbor + time.to_cbor.hexstring.should eq "c074323031362d30322d31355431303a32303a33305a" + end + end +end