summaryrefslogtreecommitdiff
path: root/test/test_helpers.py
blob: cc4c90eaf80fdf73ec4b26e5ec0e2bdedbc07c92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Tests for helpers functions """

# Author: Remi Flamary <remi.flamary@polytechnique.edu>
#
# License: MIT License

import os
import sys

sys.path.append(os.path.join("ot", "helpers"))

from openmp_helpers import get_openmp_flag, check_openmp_support  # noqa
from pre_build_helpers import _get_compiler, compile_test_program  # noqa


def test_helpers():

    compiler = _get_compiler()

    get_openmp_flag(compiler)

    s = '#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\tprintf("Hello world!\\n");\n\treturn 0;\n}'
    output, _ = compile_test_program(s)
    assert len(output) == 1 and output[0] == "Hello world!"

    check_openmp_support()