File: test_helpers.py

package info (click to toggle)
python-pot 0.9.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,884 kB
  • sloc: python: 56,498; cpp: 2,310; makefile: 265; sh: 19
file content (25 lines) | stat: -rw-r--r-- 663 bytes parent folder | download
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
"""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()