From aea9b6bcb5cd54c3b34a2b3a0458cbcebdd4c565 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 11 Jul 2022 19:43:53 +0200 Subject: [PATCH] add canUint tests Signed-off-by: qmuntal --- headers_test.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/headers_test.go b/headers_test.go index f63a092..f0f6e11 100644 --- a/headers_test.go +++ b/headers_test.go @@ -134,12 +134,33 @@ func TestProtectedHeader_MarshalCBOR(t *testing.T) { wantErr: true, }, { - name: "invalid content type value", + name: "content type is string", h: ProtectedHeader{ HeaderLabelContentType: []byte("foo"), }, wantErr: true, }, + { + name: "content type is negative int8", + h: ProtectedHeader{ + HeaderLabelContentType: int8(-1), + }, + wantErr: true, + }, + { + name: "content type is negative int16", + h: ProtectedHeader{ + HeaderLabelContentType: int16(-1), + }, + wantErr: true, + }, + { + name: "content type is negative int32", + h: ProtectedHeader{ + HeaderLabelContentType: int32(-1), + }, + wantErr: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {