MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / test_cast_error_1451

Function test_cast_error_1451

python/tests/kernel/test_kernel_features.py:1874–1893  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1872
1873
1874def test_cast_error_1451():
1875
1876 @cudaq.kernel
1877 def test_kernel(N: int) -> float:
1878 return N / 2
1879
1880 # Test is that this compiles
1881 out = test_kernel(5)
1882 assert out == 2.5
1883
1884 @cudaq.kernel
1885 def test_kernel(N: int):
1886 q = cudaq.qvector(N)
1887 # range fails for non-integer values,
1888 # matching Python behavior
1889 for i in range(0, int(N / 2)):
1890 swap(q[i], q[N - i - 1])
1891
1892 # Test is that this compiles
1893 test_kernel.compile()
1894
1895
1896def test_bad_attr_call_error():

Callers

nothing calls this directly

Calls 2

test_kernelFunction · 0.70
compileMethod · 0.45

Tested by

no test coverage detected