| 1 |
"""Tests for helpers functions""" |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
import os |
| 8 |
import sys |
| 9 |
|
| 10 |
sys.path.append(os.path.join("ot", "helpers")) |
| 11 |
|
| 12 |
from openmp_helpers import get_openmp_flag, check_openmp_support |
| 13 |
from pre_build_helpers import _get_compiler, compile_test_program |
| 14 |
|
| 15 |
|
| 16 |
def test_helpers(): |
| 17 |
compiler = _get_compiler() |
| 18 |
|
| 19 |
get_openmp_flag(compiler) |
| 20 |
|
| 21 |
s = '#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\tprintf("Hello world!\\n");\n\treturn 0;\n}' |
| 22 |
output, _ = compile_test_program(s) |
| 23 |
assert len(output) == 1 and output[0] == "Hello world!" |
| 24 |
|
| 25 |
check_openmp_support() |