コード例 #1
0
 def test_parse_functions_2(self):
     """parse_functions Unit test 2: One function"""
     input2 = '''
              void  VectorAddition_writeLMem(
                     int64_t 		 param_address,
                     int64_t   param_nbytes,
                     const int32_t *instream_cpu_to_lmem);
              '''
     output2 = [{
         'type':
         'void',
         'name':
         'VectorAddition_writeLMem',
         'arguments': [{
             'type': 'int64_t',
             'name': 'param_address'
         }, {
             'type': 'int64_t',
             'name': 'param_nbytes'
         }, {
             'type': 'const int32_t*',
             'name': 'instream_cpu_to_lmem'
         }]
     }]
     self.assertEqual(parse_functions(prepare_for_parsing(input2)), output2)
コード例 #2
0
ファイル: test_parse.py プロジェクト: maxeler/maxskins
 def test_parse_functions_4(self):
     """parse_functions Unit test 4: Array arguments"""
     input3 = 'int a(int b[5]);'
     output3 = [{'type': 'int', 'name': 'a', 'arguments': [{'type': 'int',
                                                            'name': 'b',
                                                            'array': '5'}]}]
     self.assertEqual(parse_functions(prepare_for_parsing(input3)), output3)
コード例 #3
0
 def test_parse_functions_1(self):
     """parse_functions Unit test 1: No functions"""
     input1 = '''
              void  VectorAddition_writeLMem{
                     int64_t 		 param_address,
                     int64_t   param_nbytes,
                     const int32_t *instream_cpu_to_lmem};
              '''
     output1 = []
     self.assertEqual(parse_functions(prepare_for_parsing(input1)), output1)
コード例 #4
0
ファイル: test_parse.py プロジェクト: maxeler/maxskins
 def test_parse_functions_1(self):
     """parse_functions Unit test 1: No functions"""
     input1 = '''
              void  VectorAddition_writeLMem{
                     int64_t 		 param_address,
                     int64_t   param_nbytes,
                     const int32_t *instream_cpu_to_lmem};
              '''
     output1 = []
     self.assertEqual(parse_functions(prepare_for_parsing(input1)), output1)
コード例 #5
0
 def test_parse_functions_4(self):
     """parse_functions Unit test 4: Array arguments"""
     input3 = 'int a(int b[5]);'
     output3 = [{
         'type': 'int',
         'name': 'a',
         'arguments': [{
             'type': 'int',
             'name': 'b',
             'array': '5'
         }]
     }]
     self.assertEqual(parse_functions(prepare_for_parsing(input3)), output3)
コード例 #6
0
ファイル: test_parse.py プロジェクト: maxeler/maxskins
 def test_parse_functions_2(self):
     """parse_functions Unit test 2: One function"""
     input2 = '''
              void  VectorAddition_writeLMem(
                     int64_t 		 param_address,
                     int64_t   param_nbytes,
                     const int32_t *instream_cpu_to_lmem);
              '''
     output2 = [{'type': 'void',
                 'name': 'VectorAddition_writeLMem',
                 'arguments': [{'type': 'int64_t',
                                'name': 'param_address'},
                               {'type': 'int64_t',
                                'name': 'param_nbytes'},
                               {'type': 'const int32_t*',
                                'name': 'instream_cpu_to_lmem'}]}]
     self.assertEqual(parse_functions(prepare_for_parsing(input2)), output2)
コード例 #7
0
ファイル: test_parse.py プロジェクト: maxeler/maxskins
    def test_parse_functions_3(self):
        """parse_functions Unit test 3: Several functions"""
        input3 = '''
                 void  VectorAddition_writeLMem(
                        int64_t 		 param_address,
                        int64_t   param_nbytes,
                        const int32_t *instream_cpu_to_lmem);

                 int a();
                 
                 double* b();
                 '''
        output3 = [{'type': 'void',
                    'name': 'VectorAddition_writeLMem',
                    'arguments': [{'type': 'int64_t',
                                   'name': 'param_address'},
                                  {'type': 'int64_t',
                                   'name': 'param_nbytes'},
                                  {'type': 'const int32_t*',
                                   'name': 'instream_cpu_to_lmem'}]},
                   {'type': 'int', 'name': 'a', 'arguments': []},
                   {'type': 'double*', 'name': 'b', 'arguments': []}]
        self.assertEqual(parse_functions(prepare_for_parsing(input3)), output3)
コード例 #8
0
    def test_parse_functions_3(self):
        """parse_functions Unit test 3: Several functions"""
        input3 = '''
                 void  VectorAddition_writeLMem(
                        int64_t 		 param_address,
                        int64_t   param_nbytes,
                        const int32_t *instream_cpu_to_lmem);

                 int a();
                 
                 double* b();
                 '''
        output3 = [{
            'type':
            'void',
            'name':
            'VectorAddition_writeLMem',
            'arguments': [{
                'type': 'int64_t',
                'name': 'param_address'
            }, {
                'type': 'int64_t',
                'name': 'param_nbytes'
            }, {
                'type': 'const int32_t*',
                'name': 'instream_cpu_to_lmem'
            }]
        }, {
            'type': 'int',
            'name': 'a',
            'arguments': []
        }, {
            'type': 'double*',
            'name': 'b',
            'arguments': []
        }]
        self.assertEqual(parse_functions(prepare_for_parsing(input3)), output3)