예제 #1
0
def test_ClangPreprocess_user_directives():
    """Test inlining of user-defined preprocessor directives."""
    assert opencl.ClangPreprocess("""
#define MY_TYPE int
kernel void A(global MY_TYPE* a) {}
#ifdef SOME_CONDITIONAL_THING
kernel void B() {}
#endif
""") == """
예제 #2
0
def test_ClangPreprocess_undefined_macro():
  """Test that code with undefined macro is unchanged."""
  assert (
    opencl.ClangPreprocess(
      """
kernel void A(global FLOAT_T* a) {}
"""
    )
    == """
kernel void A(global FLOAT_T* a) {}
"""
  )
예제 #3
0
def test_ClangPreprocess_small_program():
  """Test that a small program without preprocessor directives is unchanged."""
  assert (
    opencl.ClangPreprocess(
      """
kernel void A(global int*a ) {}
"""
    )
    == """
kernel void A(global int*a ) {}
"""
  )