LCOV - code coverage report
Current view: top level - src/cbor - oscore_aad_array.c (source / functions) Coverage Total Hit
Test: lcov.info Lines: 91.7 % 12 11
Test Date: 2026-03-12 12:01:18 Functions: 100.0 % 2 2
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 38.5 % 26 10

             Branch data     Line data    Source code
       1                 :             : /*
       2                 :             :  * Generated using zcbor version 0.8.99
       3                 :             :  * https://github.com/NordicSemiconductor/zcbor
       4                 :             :  * Generated with a --default-max-qty of 3
       5                 :             :  */
       6                 :             : 
       7                 :             : #include <stdint.h>
       8                 :             : #include <stdbool.h>
       9                 :             : #include <stddef.h>
      10                 :             : #include <string.h>
      11                 :             : #include "zcbor_encode.h"
      12                 :             : #include "cbor/oscore_aad_array.h"
      13                 :             : #include "zcbor_print.h"
      14                 :             : 
      15                 :             : #if DEFAULT_MAX_QTY != 3
      16                 :             : #error "The type file was generated with a different default_max_qty than this file"
      17                 :             : #endif
      18                 :             : 
      19                 :             : static bool encode_aad_array(zcbor_state_t *state, const struct aad_array *input);
      20                 :             : 
      21                 :             : 
      22                 :          28 : static bool encode_aad_array(
      23                 :             :                 zcbor_state_t *state, const struct aad_array *input)
      24                 :             : {
      25                 :             :         zcbor_log("%s\r\n", __func__);
      26                 :             : 
      27         [ +  - ]:          56 :         bool tmp_result = (((zcbor_list_start_encode(state, 5) && ((((zcbor_uint32_encode(state, (&(*input).aad_array_oscore_version))))
      28   [ +  -  -  + ]:          56 :         && ((zcbor_list_start_encode(state, 1) && ((((((*input).aad_array_algorithms_alg_aead_choice == aad_array_algorithms_alg_aead_int_c) ? ((zcbor_int32_encode(state, (&(*input).aad_array_algorithms_alg_aead_int))))
      29                 :           0 :         : (((*input).aad_array_algorithms_alg_aead_choice == aad_array_algorithms_alg_aead_tstr_c) ? ((zcbor_tstr_encode(state, (&(*input).aad_array_algorithms_alg_aead_tstr))))
      30   [ -  -  -  -  :          28 :         : false)))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 1)))
             -  -  +  - ]
      31         [ +  - ]:          28 :         && ((zcbor_bstr_encode(state, (&(*input).aad_array_request_kid))))
      32         [ +  - ]:          28 :         && ((zcbor_bstr_encode(state, (&(*input).aad_array_request_piv))))
      33   [ +  -  +  -  :          84 :         && ((zcbor_bstr_encode(state, (&(*input).aad_array_options))))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 5))));
             -  +  +  - ]
      34                 :             : 
      35                 :          28 :         if (!tmp_result) {
      36                 :             :                 zcbor_trace_file(state);
      37                 :             :                 zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
      38                 :             :         } else {
      39                 :             :                 zcbor_log("%s success\r\n", __func__);
      40                 :             :         }
      41                 :             : 
      42                 :          28 :         return tmp_result;
      43                 :             : }
      44                 :             : 
      45                 :             : 
      46                 :             : 
      47                 :          28 : int cbor_encode_aad_array(
      48                 :             :                 uint8_t *payload, size_t payload_len,
      49                 :             :                 struct aad_array *input,
      50                 :             :                 size_t *payload_len_out)
      51                 :             : {
      52                 :             :         zcbor_state_t states[5];
      53                 :             : 
      54                 :          28 :         return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
      55                 :             :                 (zcbor_decoder_t *)encode_aad_array, sizeof(states) / sizeof(zcbor_state_t), 1);
      56                 :             : }
        

Generated by: LCOV version 2.0-1