From b0ed7aa477c229eec1ffa2707fa836708e39f67f Mon Sep 17 00:00:00 2001 From: Karchnu Date: Mon, 21 Jun 2021 22:40:47 +0200 Subject: [PATCH] Add CBOR simple value encoding tests (Bool or Nil). --- spec/cbor_simple-values.cr | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 spec/cbor_simple-values.cr diff --git a/spec/cbor_simple-values.cr b/spec/cbor_simple-values.cr new file mode 100644 index 0000000..f35c85a --- /dev/null +++ b/spec/cbor_simple-values.cr @@ -0,0 +1,15 @@ +require "./spec_helper" + +describe CBOR do + describe "basics: to_cbor" do + it "union (Nil | Bool) (nil)" do + value = (Nil | Bool).from_cbor(nil.to_cbor).to_cbor + value.hexstring.should eq "f6" + end + it "union (Nil | Bool) (false)" do + value = (Nil | Bool).from_cbor(false.to_cbor).to_cbor + value.hexstring.should eq "f4" + end + end +end +