LCOV - code coverage report
Current view: top level - src/cbor - oscore_info.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: 43.3 % 30 13

             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_info.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_oscore_info(zcbor_state_t *state, const struct oscore_info *input);
      20                 :             : 
      21                 :             : 
      22                 :          34 : static bool encode_oscore_info(
      23                 :             :                 zcbor_state_t *state, const struct oscore_info *input)
      24                 :             : {
      25                 :             :         zcbor_log("%s\r\n", __func__);
      26                 :             : 
      27         [ +  - ]:          68 :         bool tmp_result = (((zcbor_list_start_encode(state, 5) && ((((zcbor_bstr_encode(state, (&(*input).oscore_info_id))))
      28   [ +  -  +  -  :          34 :         && ((((*input).oscore_info_id_context_choice == oscore_info_id_context_bstr_c) ? ((zcbor_bstr_encode(state, (&(*input).oscore_info_id_context_bstr))))
                   +  - ]
      29         [ +  - ]:          27 :         : (((*input).oscore_info_id_context_choice == oscore_info_id_context_nil_c) ? ((zcbor_nil_put(state, NULL)))
      30                 :             :         : false)))
      31   [ +  -  -  -  :          34 :         && ((((*input).oscore_info_alg_aead_choice == oscore_info_alg_aead_int_c) ? ((zcbor_int32_encode(state, (&(*input).oscore_info_alg_aead_int))))
                   -  - ]
      32         [ #  # ]:           0 :         : (((*input).oscore_info_alg_aead_choice == oscore_info_alg_aead_tstr_c) ? ((zcbor_tstr_encode(state, (&(*input).oscore_info_alg_aead_tstr))))
      33                 :             :         : false)))
      34         [ +  - ]:          34 :         && ((zcbor_tstr_encode(state, (&(*input).oscore_info_type))))
      35   [ +  -  +  +  :         136 :         && ((zcbor_uint32_encode(state, (&(*input).oscore_info_L))))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 5))));
          +  -  -  +  +  
                      - ]
      36                 :             : 
      37                 :          34 :         if (!tmp_result) {
      38                 :             :                 zcbor_trace_file(state);
      39                 :             :                 zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
      40                 :             :         } else {
      41                 :             :                 zcbor_log("%s success\r\n", __func__);
      42                 :             :         }
      43                 :             : 
      44                 :          34 :         return tmp_result;
      45                 :             : }
      46                 :             : 
      47                 :             : 
      48                 :             : 
      49                 :          34 : int cbor_encode_oscore_info(
      50                 :             :                 uint8_t *payload, size_t payload_len,
      51                 :             :                 struct oscore_info *input,
      52                 :             :                 size_t *payload_len_out)
      53                 :             : {
      54                 :             :         zcbor_state_t states[4];
      55                 :             : 
      56                 :          34 :         return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
      57                 :             :                 (zcbor_decoder_t *)encode_oscore_info, sizeof(states) / sizeof(zcbor_state_t), 1);
      58                 :             : }
        

Generated by: LCOV version 2.0-1