def test_iostream_and_determinism(self):
    src = '\n      #include <iostream>\n\n      int main()\n      {\n        std::cout << "hello world" << std::endl << 77 << "." << std::endl;\n        return 0;\n      }\n    '
    num = 5
    for i in range(num):
        print(('(iteration %d)' % i))
        time.sleep((random.random() / (10 * num)))
        self.do_run(src, 'hello world\n77.\n')
        if os.path.exists('src.js.previous'):
            self.assertBinaryEqual('src.cpp.o.js', 'src.js.previous')
        shutil.copy2('src.cpp.o.js', 'src.js.previous')
        if (self.get_setting('WASM') and (not self.get_setting('WASM2JS'))):
            if os.path.exists('src.wasm.previous'):
                self.assertBinaryEqual('src.cpp.o.wasm', 'src.wasm.previous')
            shutil.copy2('src.cpp.o.wasm', 'src.wasm.previous')
def test_iostream_and_determinism(self):
    src = '\n      #include <iostream>\n\n      int main()\n      {\n        std::cout << "hello world" << std::endl << 77 << "." << std::endl;\n        return 0;\n      }\n    '
    num = 5
    for i in range(num):
        print(('(iteration %d)' % i))
        time.sleep((random.random() / (10 * num)))
        self.do_run(src, 'hello world\n77.\n')
        if os.path.exists('src.js.previous'):
            self.assertBinaryEqual('src.cpp.o.js', 'src.js.previous')
        shutil.copy2('src.cpp.o.js', 'src.js.previous')
        if (self.get_setting('WASM') and (not self.get_setting('WASM2JS'))):
            if os.path.exists('src.wasm.previous'):
                self.assertBinaryEqual('src.cpp.o.wasm', 'src.wasm.previous')
            shutil.copy2('src.cpp.o.wasm', 'src.wasm.previous')