예제 #1
0
def test_generate_file():
    entity_name = "struct Entity"
    tempFile = tempfile.gettempdir() + "some.c"
    replacements = cgenerator.get_replacements(entity_name, True)
    cgenerator.generate_file(cgenerator.templates_storage() + "clist.c.tmp", tempFile, replacements)
    print tempFile
    with open(tempFile, "r") as infile:
        content = infile.read()
    assert content.find("Entity") != -1
    assert content.find("struct clist_Entity*") != -1
    assert content.find("clist_Entity_") != -1
    assert content.find('#include "clist_Entity.h"') != -1
    assert content.find('#include "entity_Entity.h"') != -1
예제 #2
0
def test_templates_storage():
    assert cgenerator.templates_storage() == os.path.realpath(os.path.dirname(cgenerator.__file__)) + "/templates/"