LCOV - code coverage report
Current view: top level - spdk/test/unit/lib/util/base64.c - base64_ut.c (source / functions) Hit Total Coverage
Test: Combined Lines: 199 199 100.0 %
Date: 2024-07-11 03:23:54 Functions: 7 7 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 16 28 57.1 %

           Branch data     Line data    Source code
       1                 :            : /*   SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *   Copyright (C) 2018 Intel Corporation.
       3                 :            :  *   All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : #include "spdk/stdinc.h"
       7                 :            : 
       8                 :            : #include "spdk_internal/cunit.h"
       9                 :            : 
      10                 :            : #include "util/base64.c"
      11                 :            : 
      12                 :            : char text_A[] = "FZB3";
      13                 :            : uint8_t raw_A[] = {0x15, 0x90, 0x77};
      14                 :            : char text_B[] = "AbC/1+c=";
      15                 :            : char text_urlsafe_B[] = "AbC_1-c=";
      16                 :            : uint8_t raw_B[] = {0x01, 0xB0, 0xBF, 0xD7, 0xE7};
      17                 :            : char text_C[] = "AbC/1+cC";
      18                 :            : char text_urlsafe_C[] = "AbC_1-cC";
      19                 :            : uint8_t raw_C[] = {0x01, 0xB0, 0xBF, 0xD7, 0xE7, 0x02};
      20                 :            : char text_D[] = "AbC/1w==";
      21                 :            : char text_urlsafe_D[] = "AbC_1w==";
      22                 :            : uint8_t raw_D[] = {0x01, 0xB0, 0xBF, 0xD7};
      23                 :            : char text_E[] = "AbC12===";
      24                 :            : char text_F[] = "AbCd112";
      25                 :            : char text_G[] = "AbCd12";
      26                 :            : char text_H[] = "AbC12";
      27                 :            : char text_I[] = "AQu/1+cCCBUnOBFWv+HzoL3BOVUBItP2mRDdqhnxAtIT4hD1wbQ30Ylm8R+7khPS";//64 bytes
      28                 :            : char text_urlsafe_I[] =
      29                 :            :         "AQu_1-cCCBUnOBFWv-HzoL3BOVUBItP2mRDdqhnxAtIT4hD1wbQ30Ylm8R-7khPS";//64 bytes
      30                 :            : uint8_t raw_I[] = {0x01, 0x0B, 0xBF, 0xD7, 0xE7, 0x02, 0x08, 0x15, 0x27, 0x38, 0x11, 0x56, 0xBF, 0xE1, 0xF3, 0xA0,
      31                 :            :                    0xBD, 0xC1, 0x39, 0x55, 0x01, 0x22, 0xD3, 0xF6, 0x99, 0x10, 0xDD, 0xAA, 0x19, 0xF1, 0x02, 0xD2,
      32                 :            :                    0x13, 0xE2, 0x10, 0xF5, 0xC1, 0xB4, 0x37, 0xD1, 0x89, 0x66, 0xF1, 0x1F, 0xBB, 0x92, 0x13, 0xD2
      33                 :            :                   };
      34                 :            : char text_J[] =
      35                 :            :         "AQu/1+cCCBUnOBFWv+HzoL3BOVUBItP2mRDdqhnxAtIT4hD1wbQ30Ylm8R+7khPSvcE5VecCCBUZ8QLiEPVm8b3BOVUBItP2GfEC4hD1ZvE5VQEi0/aJZvEfu5LiEPUTvcE5VQEi0/YZEQ==";
      36                 :            : char text_urlsafe_J[] =
      37                 :            :         "AQu_1-cCCBUnOBFWv-HzoL3BOVUBItP2mRDdqhnxAtIT4hD1wbQ30Ylm8R-7khPSvcE5VecCCBUZ8QLiEPVm8b3BOVUBItP2GfEC4hD1ZvE5VQEi0_aJZvEfu5LiEPUTvcE5VQEi0_YZEQ==";
      38                 :            : uint8_t raw_J[] = {0x01, 0x0B, 0xBF, 0xD7, 0xE7, 0x02, 0x08, 0x15, 0x27, 0x38, 0x11, 0x56, 0xBF, 0xE1, 0xF3, 0xA0,
      39                 :            :                    0xBD, 0xC1, 0x39, 0x55, 0x01, 0x22, 0xD3, 0xF6, 0x99, 0x10, 0xDD, 0xAA, 0x19, 0xF1, 0x02, 0xD2,
      40                 :            :                    0x13, 0xE2, 0x10, 0xF5, 0xC1, 0xB4, 0x37, 0xD1, 0x89, 0x66, 0xF1, 0x1F, 0xBB, 0x92, 0x13, 0xD2,
      41                 :            :                    0xBD, 0xC1, 0x39, 0x55, 0xE7, 0x02, 0x08, 0x15, 0x19, 0xF1, 0x02, 0xE2, 0x10, 0xF5, 0x66, 0xF1,
      42                 :            :                    0xBD, 0xC1, 0x39, 0x55, 0x01, 0x22, 0xD3, 0xF6, 0x19, 0xF1, 0x02, 0xE2, 0x10, 0xF5, 0x66, 0xF1,
      43                 :            :                    0x39, 0x55, 0x01, 0x22, 0xD3, 0xF6, 0x89, 0x66, 0xF1, 0x1F, 0xBB, 0x92, 0xE2, 0x10, 0xF5, 0x13,
      44                 :            :                    0xBD, 0xC1, 0x39, 0x55, 0x01, 0x22, 0xD3, 0xF6, 0x19, 0x11
      45                 :            :                   };
      46                 :            : 
      47                 :            : static void
      48                 :          6 : test_base64_get_encoded_strlen(void)
      49                 :            : {
      50                 :          6 :         uint32_t raw_lens[4] = {8, 9, 10, 11};
      51                 :          6 :         uint32_t text_strlens[4] = {12, 12, 16, 16};
      52                 :            :         uint32_t text_strlen;
      53                 :            :         int i;
      54                 :            : 
      55         [ +  + ]:         30 :         for (i = 0; i < 4; i++) {
      56                 :         24 :                 text_strlen = spdk_base64_get_encoded_strlen(raw_lens[i]);
      57                 :         24 :                 CU_ASSERT_EQUAL(text_strlen, text_strlens[i]);
      58                 :            :         }
      59                 :          6 : }
      60                 :            : 
      61                 :            : static void
      62                 :          6 : test_base64_get_decoded_len(void)
      63                 :            : {
      64                 :          6 :         uint32_t text_strlens[4] = {8, 10, 11, 12};
      65                 :          6 :         uint32_t raw_lens[4] = {6, 7, 8, 9};
      66                 :            :         uint32_t bin_len;
      67                 :            :         int i;
      68                 :            : 
      69         [ +  + ]:         30 :         for (i = 0; i < 4; i++) {
      70                 :         24 :                 bin_len = spdk_base64_get_decoded_len(text_strlens[i]);
      71                 :         24 :                 CU_ASSERT_EQUAL(bin_len, raw_lens[i]);
      72                 :            :         }
      73                 :          6 : }
      74                 :            : 
      75                 :            : static void
      76                 :          6 : test_base64_encode(void)
      77                 :            : {
      78                 :          5 :         char text[200];
      79                 :            :         int ret;
      80                 :            : 
      81                 :          6 :         ret = spdk_base64_encode(text, raw_A, sizeof(raw_A));
      82                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
      83                 :          6 :         CU_ASSERT(strcmp(text, text_A) == 0);
      84                 :          6 :         CU_ASSERT_EQUAL(strlen(text), strlen(text_A));
      85                 :            : 
      86                 :          6 :         ret = spdk_base64_encode(text, raw_B, sizeof(raw_B));
      87                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
      88                 :          6 :         CU_ASSERT(strcmp(text, text_B) == 0);
      89                 :          6 :         CU_ASSERT_EQUAL(strlen(text), strlen(text_B));
      90                 :            : 
      91                 :          6 :         ret = spdk_base64_encode(text, raw_C, sizeof(raw_C));
      92                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
      93                 :          6 :         CU_ASSERT(strcmp(text, text_C) == 0);
      94                 :            : 
      95                 :          6 :         ret = spdk_base64_encode(text, raw_D, sizeof(raw_D));
      96                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
      97                 :          6 :         CU_ASSERT(strcmp(text, text_D) == 0);
      98                 :            : 
      99                 :          6 :         ret = spdk_base64_encode(text, raw_I, sizeof(raw_I));
     100                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     101                 :          6 :         CU_ASSERT(strcmp(text, text_I) == 0);
     102                 :            : 
     103                 :          6 :         ret = spdk_base64_encode(text, raw_J, sizeof(raw_J));
     104                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     105                 :          6 :         CU_ASSERT(strcmp(text, text_J) == 0);
     106                 :            : 
     107                 :          6 :         ret = spdk_base64_encode(NULL, raw_A, sizeof(raw_A));
     108                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     109                 :          6 :         ret = spdk_base64_encode(text, NULL, sizeof(raw_A));
     110                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     111                 :          6 :         ret = spdk_base64_encode(text, raw_A, 0);
     112                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     113                 :          6 : }
     114                 :            : 
     115                 :            : static void
     116                 :          6 : test_base64_decode(void)
     117                 :            : {
     118                 :          5 :         char raw_buf[200];
     119                 :          6 :         void *raw = (void *)raw_buf;
     120                 :          5 :         size_t raw_len;
     121                 :            :         int ret;
     122                 :            : 
     123                 :            :         /* len */
     124                 :          6 :         ret = spdk_base64_decode(NULL, &raw_len, text_A);
     125                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     126                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_A));
     127                 :            : 
     128                 :            :         /* decode */
     129                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_A);
     130                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     131                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_A));
     132         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_A, sizeof(raw_A)) == 0);
     133                 :            : 
     134                 :            :         /* len */
     135                 :          6 :         ret = spdk_base64_decode(NULL, &raw_len, text_B);
     136                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     137                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_B));
     138                 :            : 
     139                 :            :         /* decode */
     140                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_B);
     141                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     142                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_B));
     143         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_B, sizeof(raw_B)) == 0);
     144                 :            : 
     145                 :            :         /* len */
     146                 :          6 :         ret = spdk_base64_decode(NULL, &raw_len, text_C);
     147                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     148                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_C));
     149                 :            : 
     150                 :            :         /* decode */
     151                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_C);
     152                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     153                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_C));
     154         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_C, sizeof(raw_C)) == 0);
     155                 :            : 
     156                 :            :         /* len */
     157                 :          6 :         ret = spdk_base64_decode(NULL, &raw_len, text_D);
     158                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     159                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_D));
     160                 :            : 
     161                 :            :         /* decode */
     162                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_D);
     163                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     164                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_D));
     165         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_D, sizeof(raw_D)) == 0);
     166                 :            : 
     167                 :            :         /* len */
     168                 :          6 :         ret = spdk_base64_decode(NULL, &raw_len, text_I);
     169                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     170                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_I));
     171                 :            : 
     172                 :            :         /* decode */
     173                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_I);
     174                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     175                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_I));
     176         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_I, sizeof(raw_I)) == 0);
     177                 :            : 
     178                 :            :         /* len */
     179                 :          6 :         ret = spdk_base64_decode(NULL, &raw_len, text_J);
     180                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     181                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_J));
     182                 :            : 
     183                 :            :         /* decode */
     184                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_J);
     185                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     186                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_J));
     187         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_J, sizeof(raw_J)) == 0);
     188                 :            : 
     189                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_E);
     190                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     191                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_F);
     192                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     193                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_G);
     194                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     195                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, text_H);
     196                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     197                 :          6 :         ret = spdk_base64_decode(raw, &raw_len, NULL);
     198                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     199                 :          6 : }
     200                 :            : 
     201                 :            : static void
     202                 :          6 : test_base64_urlsafe_encode(void)
     203                 :            : {
     204                 :          5 :         char text[200];
     205                 :            :         int ret;
     206                 :            : 
     207                 :          6 :         ret = spdk_base64_urlsafe_encode(text, raw_A, sizeof(raw_A));
     208                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     209                 :          6 :         CU_ASSERT(strcmp(text, text_A) == 0);
     210                 :          6 :         CU_ASSERT_EQUAL(strlen(text), strlen(text_A));
     211                 :            : 
     212                 :          6 :         ret = spdk_base64_urlsafe_encode(text, raw_B, sizeof(raw_B));
     213                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     214                 :          6 :         CU_ASSERT(strcmp(text, text_urlsafe_B) == 0);
     215                 :          6 :         CU_ASSERT_EQUAL(strlen(text), strlen(text_urlsafe_B));
     216                 :            : 
     217                 :          6 :         ret = spdk_base64_urlsafe_encode(text, raw_C, sizeof(raw_C));
     218                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     219                 :          6 :         CU_ASSERT(strcmp(text, text_urlsafe_C) == 0);
     220                 :            : 
     221                 :          6 :         ret = spdk_base64_urlsafe_encode(text, raw_D, sizeof(raw_D));
     222                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     223                 :          6 :         CU_ASSERT(strcmp(text, text_urlsafe_D) == 0);
     224                 :            : 
     225                 :          6 :         ret = spdk_base64_urlsafe_encode(text, raw_I, sizeof(raw_I));
     226                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     227                 :          6 :         CU_ASSERT(strcmp(text, text_urlsafe_I) == 0);
     228                 :            : 
     229                 :          6 :         ret = spdk_base64_urlsafe_encode(text, raw_J, sizeof(raw_J));
     230                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     231                 :          6 :         CU_ASSERT(strcmp(text, text_urlsafe_J) == 0);
     232                 :            : 
     233                 :          6 :         ret = spdk_base64_urlsafe_encode(NULL, raw_A, sizeof(raw_A));
     234                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     235                 :          6 :         ret = spdk_base64_urlsafe_encode(text, NULL, sizeof(raw_A));
     236                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     237                 :          6 :         ret = spdk_base64_urlsafe_encode(text, raw_A, 0);
     238                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     239                 :          6 : }
     240                 :            : 
     241                 :            : static void
     242                 :          6 : test_base64_urlsafe_decode(void)
     243                 :            : {
     244                 :          5 :         char raw_buf[200];
     245                 :          6 :         void *raw = (void *)raw_buf;
     246                 :          6 :         size_t raw_len = 0;
     247                 :            :         int ret;
     248                 :            : 
     249                 :            :         /* len */
     250                 :          6 :         ret = spdk_base64_urlsafe_decode(NULL, &raw_len, text_A);
     251                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     252                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_A));
     253                 :            : 
     254                 :            :         /* decode */
     255                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_A);
     256                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     257                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_A));
     258         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_A, sizeof(raw_A)) == 0);
     259                 :            : 
     260                 :            :         /* len */
     261                 :          6 :         ret = spdk_base64_urlsafe_decode(NULL, &raw_len, text_urlsafe_B);
     262                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     263                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_B));
     264                 :            : 
     265                 :            :         /* decode */
     266                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_urlsafe_B);
     267                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     268                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_B));
     269         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_B, sizeof(raw_B)) == 0);
     270                 :            : 
     271                 :            :         /* len */
     272                 :          6 :         ret = spdk_base64_urlsafe_decode(NULL, &raw_len, text_urlsafe_C);
     273                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     274                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_C));
     275                 :            : 
     276                 :            :         /* decode */
     277                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_urlsafe_C);
     278                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     279                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_C));
     280         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_C, sizeof(raw_C)) == 0);
     281                 :            : 
     282                 :            :         /* len */
     283                 :          6 :         ret = spdk_base64_urlsafe_decode(NULL, &raw_len, text_urlsafe_D);
     284                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     285                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_D));
     286                 :            : 
     287                 :            :         /* decode */
     288                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_urlsafe_D);
     289                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     290                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_D));
     291         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_D, sizeof(raw_D)) == 0);
     292                 :            : 
     293                 :            :         /* len */
     294                 :          6 :         ret = spdk_base64_urlsafe_decode(NULL, &raw_len, text_urlsafe_I);
     295                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     296                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_I));
     297                 :            : 
     298                 :            :         /* decode */
     299                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_urlsafe_I);
     300                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     301                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_I));
     302         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_I, sizeof(raw_I)) == 0);
     303                 :            : 
     304                 :            :         /* len */
     305                 :          6 :         ret = spdk_base64_urlsafe_decode(NULL, &raw_len, text_urlsafe_J);
     306                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     307                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_J));
     308                 :            : 
     309                 :            :         /* decode */
     310                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_urlsafe_J);
     311                 :          6 :         CU_ASSERT_EQUAL(ret, 0);
     312                 :          6 :         CU_ASSERT_EQUAL(raw_len, sizeof(raw_J));
     313         [ -  + ]:          6 :         CU_ASSERT(memcmp(raw, raw_J, sizeof(raw_J)) == 0);
     314                 :            : 
     315                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_E);
     316                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     317                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_F);
     318                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     319                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_G);
     320                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     321                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_H);
     322                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     323                 :          6 :         ret = spdk_base64_urlsafe_decode(raw, &raw_len, NULL);
     324                 :          6 :         CU_ASSERT_EQUAL(ret, -EINVAL);
     325                 :          6 : }
     326                 :            : 
     327                 :            : int
     328                 :          6 : main(int argc, char **argv)
     329                 :            : {
     330                 :          6 :         CU_pSuite       suite = NULL;
     331                 :            :         unsigned int    num_failures;
     332                 :            : 
     333                 :          6 :         CU_initialize_registry();
     334                 :            : 
     335                 :          6 :         suite = CU_add_suite("base64", NULL, NULL);
     336                 :            : 
     337                 :          6 :         CU_ADD_TEST(suite, test_base64_get_encoded_strlen);
     338                 :          6 :         CU_ADD_TEST(suite, test_base64_get_decoded_len);
     339                 :          6 :         CU_ADD_TEST(suite, test_base64_encode);
     340                 :          6 :         CU_ADD_TEST(suite, test_base64_decode);
     341                 :          6 :         CU_ADD_TEST(suite, test_base64_urlsafe_encode);
     342                 :          6 :         CU_ADD_TEST(suite, test_base64_urlsafe_decode);
     343                 :            : 
     344                 :            : 
     345                 :          6 :         num_failures = spdk_ut_run_tests(argc, argv, NULL);
     346                 :            : 
     347                 :          6 :         CU_cleanup_registry();
     348                 :            : 
     349                 :          6 :         return num_failures;
     350                 :            : }

Generated by: LCOV version 1.14