def test_dlmalloc(self):
    self.banned_js_engines = [NODE_JS]
    self.set_setting('INITIAL_MEMORY', ((128 * 1024) * 1024))
    src = open(path_from_root('tests', 'dlmalloc_test.c')).read()
    self.do_run(src, '*1,0*', ['200', '1'])
    self.do_run(None, '*400,0*', ['400', '400'], no_build=True)
    if (self.emcc_args == []):
        try_delete('src.cpp.o.js')
        run_process([EMCC, path_from_root('tests', 'dlmalloc_test.c'), '-s', 'INITIAL_MEMORY=128MB', '-o', 'src.cpp.o.js'], stdout=PIPE, stderr=self.stderr_redirect)
        self.do_run(None, '*1,0*', ['200', '1'], no_build=True)
        self.do_run(None, '*400,0*', ['400', '400'], no_build=True)
        src = open(path_from_root('tests', 'new.cpp')).read()
        for (new, delete) in [('malloc(100)', 'free'), ('new char[100]', 'delete[]'), ('new Structy', 'delete'), ('new int', 'delete'), ('new Structy[10]', 'delete[]')]:
            self.do_run(src.replace('{{{ NEW }}}', new).replace('{{{ DELETE }}}', delete), '*1,0*')
def test_dlmalloc(self):
    self.banned_js_engines = [NODE_JS]
    self.set_setting('INITIAL_MEMORY', ((128 * 1024) * 1024))
    src = open(path_from_root('tests', 'dlmalloc_test.c')).read()
    self.do_run(src, '*1,0*', ['200', '1'])
    self.do_run(None, '*400,0*', ['400', '400'], no_build=True)
    if (self.emcc_args == []):
        try_delete('src.cpp.o.js')
        run_process([EMCC, path_from_root('tests', 'dlmalloc_test.c'), '-s', 'INITIAL_MEMORY=128MB', '-o', 'src.cpp.o.js'], stdout=PIPE, stderr=self.stderr_redirect)
        self.do_run(None, '*1,0*', ['200', '1'], no_build=True)
        self.do_run(None, '*400,0*', ['400', '400'], no_build=True)
        src = open(path_from_root('tests', 'new.cpp')).read()
        for (new, delete) in [('malloc(100)', 'free'), ('new char[100]', 'delete[]'), ('new Structy', 'delete'), ('new int', 'delete'), ('new Structy[10]', 'delete[]')]:
            self.do_run(src.replace('{{{ NEW }}}', new).replace('{{{ DELETE }}}', delete), '*1,0*')