Ejemplo n.º 1
0
def gen_ending_header():
    # Generate source contents
    GenUtils.source_file("#endif /* defined (UNIT_TESTING) && defined (" + Config.test_HAL_enable_macro + ") */")
    GenUtils.gen_break_line(gen_source_file)
    GenUtils.source_file("/** End of File ***************************************************************/")
    GenUtils.gen_break_line(gen_source_file)
    # Generate header contents
    GenUtils.header_file("#endif /* " + Config.header_including_guard + " */")
    GenUtils.gen_break_line(gen_header_file)
    GenUtils.header_file("/** End of File ***************************************************************/")
    GenUtils.gen_break_line(gen_header_file)
Ejemplo n.º 2
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()
Ejemplo n.º 3
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)
Ejemplo n.º 4
0
def gen_section_0_header_comment_block(fileType):
    if "SourceFile" == fileType:
        GenUtils.source_file("/** @file ut_gpio_hal.c") 
        GenUtils.source_file(" *  @brief Function implementation for unit test of " + Config.test_target + ".")
        GenUtils.source_file(" *")
        GenUtils.source_file(" *  This file is generated from scripts. This is the source file for ")
        GenUtils.source_file(" *  the unit test definition of " + Config.test_target + ".")
        GenUtils.source_file(" *")
        GenUtils.source_file(" *  @author 	Tran Nhat Duat (duattn)")
        GenUtils.source_file(" *  @version 	V1.0")
        GenUtils.source_file(" */")
        GenUtils.gen_break_line(gen_source_file)
        GenUtils.source_file("#if defined (UNIT_TESTING) && defined (" + Config.test_HAL_enable_macro + ")")
        GenUtils.gen_break_line(gen_source_file)
    if "HeaderFile" == fileType:
        GenUtils.header_file("/** @file ut_gpio_hal.h")
        GenUtils.header_file(" *  @brief Function prototypes for unit test of " + Config.test_target + ".")
        GenUtils.header_file(" *")
        GenUtils.header_file(" *  This file is generated from scripts. This is the header file for ")
        GenUtils.header_file(" *  the unit test definition of " + Config.test_target + ".")
        GenUtils.header_file(" *")
        GenUtils.header_file(" *  @author 	Tran Nhat Duat (duattn)")
        GenUtils.header_file(" *  @version 	V1.0")
        GenUtils.header_file(" */")
        GenUtils.gen_break_line(gen_header_file)
        GenUtils.header_file("#ifndef " + Config.header_including_guard)
        GenUtils.header_file("#define " + Config.header_including_guard)
        GenUtils.gen_break_line(gen_header_file)
Ejemplo n.º 5
0
def gen_externC_ending():
    GenUtils.header_file("#ifdef __cplusplus")
    GenUtils.header_file("} // extern \"C\"")
    GenUtils.header_file("#endif")
    GenUtils.gen_break_line(gen_header_file)
Ejemplo n.º 6
0
def gen_externC_beginning():
    GenUtils.header_file("#ifdef __cplusplus")
    GenUtils.header_file("extern \"C\"{")
    GenUtils.header_file("#endif")
    GenUtils.gen_break_line(gen_header_file)