Exemple #1
0
 def test_gcc(self):
     runner = RunnerMock()
     runner.output = "#define __GNUC__ 7\n" \
                     "#define __GNUC_MINOR__ 3\n" \
                     "#define __GNUC_PATCHLEVEL__ 0\n"
     compiler_id = detect_compiler_id("gcc", runner=runner)
     self.assertEqual(CompilerId(GCC, 7, 3, 0), compiler_id)
Exemple #2
0
 def test_qcc(self):
     runner = RunnerMock()
     runner.output = "#define __QNX__ 1\n" \
                     "#define __GNUC__ 4\n" \
                     "#define __GNUC_MINOR__ 2\n" \
                     "#define __GNUC_PATCHLEVEL__ 4\n"
     compiler_id = detect_compiler_id("qcc", runner=runner)
     self.assertEqual(CompilerId(QCC, 4, 2, 4), compiler_id)
Exemple #3
0
 def test_intel(self):
     runner = RunnerMock()
     # Intel C++ may define __GNUC__ and _MSC_VER for compatibility
     runner.output = "#define _MSC_VER 1922\n" \
                     "#define __GNUC__ 4\n" \
                     "#define __GNUC_MINOR__ 1\n" \
                     "#define __GNUC_PATCHLEVEL__ 1\n" \
                     "#define __INTEL_COMPILER 1900\n" \
                     "#define __INTEL_COMPILER_UPDATE 3\n"
     compiler_id = detect_compiler_id("clang", runner=runner)
     self.assertEqual(CompilerId(INTEL, 19, 0, 3), compiler_id)
Exemple #4
0
 def test_apple_clang(self):
     runner = RunnerMock()
     runner.output = "#define __GNUC__ 4\n" \
                     "#define __GNUC_MINOR__ 1\n" \
                     "#define __GNUC_PATCHLEVEL__ 1\n" \
                     "#define __clang__ 1\n"\
                     "#define __clang_major__ 10\n" \
                     "#define __clang_minor__ 0\n" \
                     "#define __clang_patchlevel__ 1\n" \
                     "#define __apple_build_version__ 10010046\n"
     compiler_id = detect_compiler_id("clang", runner=runner)
     self.assertEqual(CompilerId(APPLE_CLANG, 10, 0, 1), compiler_id)
Exemple #5
0
 def test_clang(self):
     runner = RunnerMock()
     # clang defines __GNUC__ and may define _MSC_VER as well (on Windows)
     runner.output = "#define _MSC_VER 1922\n" \
                     "#define __GNUC__ 4\n" \
                     "#define __GNUC_MINOR__ 1\n" \
                     "#define __GNUC_PATCHLEVEL__ 1\n" \
                     "#define __clang__ 1\n"\
                     "#define __clang_major__ 9\n" \
                     "#define __clang_minor__ 0\n" \
                     "#define __clang_patchlevel__ 1\n"
     compiler_id = detect_compiler_id("clang", runner=runner)
     self.assertEqual(CompilerId(CLANG, 9, 0, 1), compiler_id)
Exemple #6
0
 def test_suncc(self):
     runner = RunnerMock()
     runner.output = "#define __SUNPRO_CC 0x450\n"
     compiler_id = detect_compiler_id("suncc", runner=runner)
     self.assertEqual(CompilerId(SUNCC, 4, 5, 0), compiler_id)
Exemple #7
0
 def test_msvc(self, line, major, minor, patch):
     runner = RunnerMock()
     runner.output = line
     compiler_id = detect_compiler_id("cl", runner=runner)
     self.assertEqual(CompilerId(MSVC, major, minor, patch), compiler_id)