LCOV - code coverage report
Current view: top level - flamenco/runtime/tests - fd_pack_test.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 39 0.0 %
Date: 2024-11-13 11:58:15 Functions: 0 1 0.0 %

          Line data    Source code
       1             : #include "fd_pack_test.h"
       2             : #include "../../../ballet/pack/fd_compute_budget_program.h"
       3             : 
       4             : ulong
       5             : fd_exec_pack_cpb_test_run( fd_exec_instr_test_runner_t * _unused FD_PARAM_UNUSED,
       6             :                            void const *                  input_,
       7             :                            void **                       output_,
       8             :                            void *                        output_buf,
       9           0 :                            ulong                         output_bufsz ){
      10           0 :   fd_exec_test_pack_compute_budget_context_t const * input  = fd_type_pun_const( input_ );
      11           0 :   fd_exec_test_pack_compute_budget_effects_t **      output = fd_type_pun( output_ );
      12             : 
      13           0 :   ulong output_end = (ulong) output_buf + output_bufsz;
      14           0 :   FD_SCRATCH_ALLOC_INIT( l, output_buf );
      15             :   
      16           0 :   fd_exec_test_pack_compute_budget_effects_t * effects =
      17           0 :     FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_exec_test_pack_compute_budget_effects_t),
      18           0 :                                 sizeof (fd_exec_test_pack_compute_budget_effects_t) );
      19           0 :   if( FD_UNLIKELY( _l > output_end ) ) {
      20           0 :     return 0UL;
      21           0 :   }
      22             : 
      23           0 :   fd_compute_budget_program_state_t cbp[1];
      24           0 :   fd_compute_budget_program_init( cbp );
      25           0 : do {
      26             : 
      27           0 :   int ok = 1;
      28           0 :   for( ulong i=0UL; i<input->instr_datas_count; ++i ){
      29           0 :     pb_bytes_array_t * instr_data = input->instr_datas[i];
      30             :     // Reject 
      31           0 :     if( !fd_compute_budget_program_parse( instr_data->bytes, instr_data->size, cbp ) ) {
      32           0 :       ok = 0;
      33           0 :       break;
      34           0 :     };
      35           0 :   }
      36             : 
      37           0 :   if( !ok ) {
      38           0 :     break;
      39           0 :   }
      40           0 :   ulong rewards;
      41           0 :   uint compute_unit_limit;
      42           0 :   fd_compute_budget_program_finalize( cbp,
      43           0 :                                       input->instr_datas_count,
      44           0 :                                       &rewards,
      45           0 :                                       &compute_unit_limit
      46           0 :                                       );
      47           0 :   effects->rewards = rewards;
      48           0 :   effects->compute_unit_limit = compute_unit_limit;
      49           0 : } while(0);
      50             : 
      51           0 :   ulong actual_end = FD_SCRATCH_ALLOC_FINI( l, 1UL );
      52             : 
      53           0 :   *output = effects;
      54           0 :   return actual_end - (ulong) output_buf;
      55             : 
      56           0 : }

Generated by: LCOV version 1.14