From a8d76a9496256d05cae86089fb33ce2b833c20c5 Mon Sep 17 00:00:00 2001 From: Karchnu Date: Sat, 28 Nov 2020 01:38:00 +0100 Subject: [PATCH] CBOR specs: Time tests. --- spec/cbor_spec.cr | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/cbor_spec.cr b/spec/cbor_spec.cr index 66bfa87..c2de2d8 100644 --- a/spec/cbor_spec.cr +++ b/spec/cbor_spec.cr @@ -46,6 +46,18 @@ describe CBOR do end end + 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 + describe "CBOR library annotations and features" do it "Person#from_cbor with unmapped values" do h = Hash(String | Int32, String | Int32).new