Exemple #1
0
def gen_section_4_typedef():
    # Generate source contents
    GenUtils.gen_comment_block(gen_source_file, "4. Typedefs: Enumerations, Structures, Pointers, Others") 
    GenUtils.gen_break_line(gen_source_file)
    # Generate header contents
    GenUtils.gen_comment_block(gen_header_file, "4. Typedefs: Enumerations, Structures, Pointers, Others") 
    GenUtils.gen_break_line(gen_header_file)
Exemple #2
0
def gen_section_3_function_macro():
    # Generate source contents
    GenUtils.gen_comment_block(gen_source_file, "3. Function-like Macros") 
    GenUtils.gen_break_line(gen_source_file)
    # Generate header contents
    GenUtils.gen_comment_block(gen_header_file, "3. Function-like Macros") 
    GenUtils.gen_break_line(gen_header_file)
Exemple #3
0
def gen_section_2_object_macro():
    # Generate sourcr contents
    GenUtils.gen_comment_block(gen_source_file, "2. Object-like Macros") 
    GenUtils.gen_break_line(gen_source_file)
    # Generate header contents
    GenUtils.gen_comment_block(gen_header_file, "2. Object-like Macros") 
    GenUtils.gen_break_line(gen_header_file)
Exemple #4
0
def gen_section_1_include_file(file_type):
    
    if "SourceFile" == file_type:
        GenUtils.gen_comment_block(gen_source_file, "1. Included Files") 
        GenUtils.source_file("#include \"" + Config.generated_header_file_name + "\"")
        GenUtils.gen_break_line(gen_source_file)
    if "HeaderFile" == file_type:
        GenUtils.gen_comment_block(gen_header_file, "1. Included Files") 
        GenUtils.header_file("#include <stdlib.h>")
        GenUtils.header_file("#include \"unity.h\"")
        GenUtils.header_file("#include \"ut_base.h\"")
        GenUtils.header_file("#include \"" + Config.tested_header_file + "\"")
        GenUtils.gen_break_line(gen_header_file)
Exemple #5
0
def gen_section_5_variable(file_type):
    if "SourceFile" == file_type:
        GenUtils.gen_comment_block(gen_source_file, "5. Global, Static and Extern Variables")
        no_test_ccase = len(XlsProcessing.test_suite.test_cases)
        GenUtils.gen_comment_line(gen_source_file, "List of all test cases")
        with GenUtils.source_file.block("void (*TestcaseList_array[" + str(no_test_ccase) + \
        "])(void) = ", ";"):
            counter = 1
            for test_case in XlsProcessing.test_suite.test_cases:
                if counter < no_test_ccase:
                    GenUtils.source_file(test_case.testcase_name + ",")           
                else:
                    GenUtils.source_file(test_case.testcase_name)
                counter += 1
        GenUtils.gen_break_line(gen_source_file)
    if "HeaderFile" == file_type:
        GenUtils.gen_comment_block(gen_header_file, "5. Global, Static and Extern Variables")
        GenUtils.gen_break_line(gen_header_file)
Exemple #6
0
def gen_section_6_function_definition(file_type):
    if "SourceFile" == file_type:
        GenUtils.gen_comment_block(gen_source_file, "6. Function Definitions")
        # Generate blocks of testcases
        for test_case in XlsProcessing.test_suite.test_cases:
            testcase_prototype = "void " + test_case.testcase_name + "(void)"
            with GenUtils.source_file.block(testcase_prototype):
                init_output_var(test_case)    
                init_param(test_case)
                call_funct_preconditon(test_case)
                call_test_method(test_case)    
                compare(test_case)      
            GenUtils.gen_break_line(gen_source_file)
    if "HeaderFile" == file_type:
        GenUtils.gen_comment_block(gen_header_file, "6. Function Prototypes")
        gen_externC_beginning()
        for test_case in XlsProcessing.test_suite.test_cases:
            GenUtils.header_file("void " + test_case.testcase_name + "(void);")
        GenUtils.gen_break_line(gen_header_file)
        gen_externC_ending()