Add diverse labels test
diff --git a/src/qcbor_main_encode.c b/src/qcbor_main_encode.c
index f6ca12a..22d537d 100644
--- a/src/qcbor_main_encode.c
+++ b/src/qcbor_main_encode.c
@@ -937,12 +937,8 @@
       case CBOR_MAJOR_TYPE_NEGATIVE_INT: /* Major type 1 */
          break;
 
-      case CBOR_MAJOR_TYPE_SIMPLE:
-         return uArgument == CBOR_SIMPLE_BREAK ? QCBOR_ERR_HIT_END : QCBOR_SUCCESS;
-         break;
-
-      case CBOR_MAJOR_TYPE_BYTE_STRING:
-      case CBOR_MAJOR_TYPE_TEXT_STRING:
+      case CBOR_MAJOR_TYPE_BYTE_STRING: /* Major type 2 */
+      case CBOR_MAJOR_TYPE_TEXT_STRING: /* Major type 3 */
          if(nAdditional == LEN_IS_INDEFINITE) {
             /* Chunks of indefinite length string */
             do {
@@ -958,14 +954,13 @@
          }
          break;
 
-      case CBOR_MAJOR_TYPE_TAG:
-         uCBORError = QCBOREncode_Private_ConsumeNext(pInBuf);
-         break;
-
-      case CBOR_MAJOR_TYPE_MAP:
+      case CBOR_MAJOR_TYPE_MAP: /* Major type 5 */
          uMul = 2;
          /* Fallthrough */
-      case CBOR_MAJOR_TYPE_ARRAY:
+      case CBOR_MAJOR_TYPE_ARRAY: /* Major type 4 */
+         /* Cast is safe because this is decoding CBOR that was created
+          * by QCBOR and because QCBOREncode_Private_ConsumeNext() can
+          * never read off the end. */
          uItemCountTotal = (uint16_t)uArgument * uMul;
          if(nAdditional == LEN_IS_INDEFINITE) {
             uItemCountTotal = UINT16_MAX;
@@ -980,6 +975,14 @@
             uCBORError = QCBOR_SUCCESS;
          }
          break;
+
+      case CBOR_MAJOR_TYPE_TAG: /* Major type 6 */
+         uCBORError = QCBOREncode_Private_ConsumeNext(pInBuf);
+         break;
+
+      case CBOR_MAJOR_TYPE_SIMPLE: /* Major type 7 */
+         return uArgument == CBOR_SIMPLE_BREAK ? QCBOR_ERR_HIT_END : QCBOR_SUCCESS;
+         break;
    }
 
 Done:
diff --git a/test/qcbor_encode_tests.c b/test/qcbor_encode_tests.c
index 86b0c8e..af5b124 100644
--- a/test/qcbor_encode_tests.c
+++ b/test/qcbor_encode_tests.c
@@ -3555,14 +3555,14 @@
 
 #ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
 
-struct SortTests {
+struct SortTest {
    const char *szDescription;
-   UsefulBufC   ToBeSorted;
-   UsefulBufC   Sorted;
-   QCBORError   uError;
+   UsefulBufC  ToBeSorted;
+   UsefulBufC  Sorted;
+   QCBORError  uError;
 };
 
-static const struct SortTests sSortTests[] =
+static const struct SortTest sSortTests[] =
 {
    {
       "Simple Sort Test",
@@ -3614,6 +3614,17 @@
    },
 
    {
+      "All sorts of labels",
+      {"\x81\x00\x03\xFB\x40\x09\x1E\xB8\x51\xEB\x85\x1F\x01\xf4\x04\xa2"
+       "\x05\x05\x06\x06\x02\xc1\x38\xff\x05\x81\x01\x06\x81\x20\x07\x19"
+       "\x00\x01\x08", 35},
+      {"\xBF\x19\x00\x01\x08\x81\x00\x03\x81\x01\x06\x81\x20\x07\xA2\x05"
+       "\x05\x06\x06\x02\xC1\x38\xFF\x05\xF4\x04\xFB\x40\x09\x1E\xB8\x51"
+       "\xEB\x85\x1F\x01\xFF", 37},
+      QCBOR_SUCCESS
+   },
+
+   {
       NULL,
       NULLUsefulBufC,
       NULLUsefulBufC,
@@ -3634,13 +3645,13 @@
 #ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
 
    for(int nIndex = 0; ; nIndex++) {
-      const struct SortTests *pTest = &sSortTests[nIndex];
+      const struct SortTest *pTest = &sSortTests[nIndex];
 
       if(pTest->szDescription == NULL) {
          break;
       }
 
-      if(nIndex == 6) {
+      if(nIndex == 7) {
          uErr = 0; /* For break point */
       }