Пример #1
0
class TestCompiler(unittest.TestCase):
    def setUp(self):
        self.filename_c = 'foobar.c'
        self.filename_cpp = 'foobar.cpp'

    @patch('universal.compiler.compiler.Gcc.compile')
    def test_c_compiler_selected_for_c_file(self, mock_gcc_compile):
        self.compiler = Compiler(self.filename_c)

        self.compiler.compile()

        mock_gcc_compile.assert_called_once_with()

    @patch('universal.compiler.compiler.Gcc.run')
    def test_c_compiler_used_to_run_executable_for_c_file(self, mock_gcc_run):
        self.compiler = Compiler(self.filename_c)

        self.compiler.run()

        mock_gcc_run.assert_called_once_with()

    @patch('universal.compiler.compiler.Gpp.compile')
    def test_cpp_compiler_selected_for_cpp_file(self, mock_gpp_compile):
        self.compiler = Compiler(self.filename_cpp)
        self.compiler.compile()

        mock_gpp_compile.assert_called_once_with()

    @patch('universal.compiler.compiler.Gpp.run')
    def test_cpp_compiler_used_to_run_executable_for_cpp_file(self, mock_gpp_run):
        self.compiler = Compiler(self.filename_cpp)
        self.compiler.run()

        mock_gpp_run.assert_called_once_with()
Пример #2
0
class TestCompiler(unittest.TestCase):
    def setUp(self):
        self.filename_c = 'foobar.c'
        self.filename_cpp = 'foobar.cpp'

    @patch('universal.compiler.compiler.Gcc.compile')
    def test_c_compiler_selected_for_c_file(self, mock_gcc_compile):
        self.compiler = Compiler(self.filename_c)

        self.compiler.compile()

        mock_gcc_compile.assert_called_once_with()

    @patch('universal.compiler.compiler.Gcc.run')
    def test_c_compiler_used_to_run_executable_for_c_file(self, mock_gcc_run):
        self.compiler = Compiler(self.filename_c)

        self.compiler.run()

        mock_gcc_run.assert_called_once_with()

    @patch('universal.compiler.compiler.Gpp.compile')
    def test_cpp_compiler_selected_for_cpp_file(self, mock_gpp_compile):
        self.compiler = Compiler(self.filename_cpp)
        self.compiler.compile()

        mock_gpp_compile.assert_called_once_with()

    @patch('universal.compiler.compiler.Gpp.run')
    def test_cpp_compiler_used_to_run_executable_for_cpp_file(
            self, mock_gpp_run):
        self.compiler = Compiler(self.filename_cpp)
        self.compiler.run()

        mock_gpp_run.assert_called_once_with()
Пример #3
0
    def test_cpp_compiler_used_to_run_executable_for_cpp_file(self, mock_gpp_run):
        self.compiler = Compiler(self.filename_cpp)
        self.compiler.run()

        mock_gpp_run.assert_called_once_with()
Пример #4
0
    def test_cpp_compiler_selected_for_cpp_file(self, mock_gpp_compile):
        self.compiler = Compiler(self.filename_cpp)
        self.compiler.compile()

        mock_gpp_compile.assert_called_once_with()
Пример #5
0
    def test_cpp_compiler_used_to_run_executable_for_cpp_file(
            self, mock_gpp_run):
        self.compiler = Compiler(self.filename_cpp)
        self.compiler.run()

        mock_gpp_run.assert_called_once_with()
Пример #6
0
    def test_cpp_compiler_selected_for_cpp_file(self, mock_gpp_compile):
        self.compiler = Compiler(self.filename_cpp)
        self.compiler.compile()

        mock_gpp_compile.assert_called_once_with()