Example #1
0
 def test_parse_structs_2(self):
     """parse_structs Unit test 2: One struct"""
     input2 = '''
              typedef struct event_atomic {
                     uint32_t        event_id;
              } event_atomic_t;
              '''
     output2 = [{'name': 'event_atomic_t',
                 'arguments': [{'type': 'uint32_t', 'name': 'event_id'}]}]
     self.assertEqual(parse_structs(prepare_for_parsing(input2)), output2)
Example #2
0
 def test_parse_structs_1(self):
     """parse_structs Unit test 1: No structs"""
     input1 = '''
              void  VectorAddition_writeLMem{
                     int64_t 		 param_address,
                     int64_t   param_nbytes,
                     const int32_t *instream_cpu_to_lmem};
              '''
     output1 = []
     self.assertEqual(parse_structs(prepare_for_parsing(input1)), output1)
Example #3
0
 def test_parse_structs_4(self):
     """parse_structs Unit test 4: Array argument"""
     input2 = '''
              struct event_atomic {
                     uint32_t        event_id[10];
              };
              '''
     output2 = [{'name': 'struct event_atomic',
                 'arguments': [{'type': 'uint32_t',
                                'name': 'event_id',
                                'array': '10'}]}]
     self.assertEqual(parse_structs(prepare_for_parsing(input2)), output2)