Skip to content

Commit dec418c

Browse files
committed
tests: add fast module unit tests
1 parent bbd93b7 commit dec418c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/cpp/test_fast.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import pytest
2+
import numpy as np
3+
4+
from app.fast import system # type: ignore
5+
from app.fast import numpy_add # type: ignore
6+
7+
8+
def test_system():
9+
assert 0 == system('ls -la')
10+
assert 0 != system('sudo -n true')
11+
12+
13+
numpy_add_values = [
14+
(np.array([2, 1, 4], dtype=np.double), np.sum([2, 1, 4])),
15+
(np.array([3, 1, 2], dtype=np.double), np.sum([3, 1, 2])),
16+
(np.array([10, 24, 11], dtype=np.double), np.sum([10, 24, 11])),
17+
(np.array([99, 1, 22], dtype=np.double), np.sum([99, 1, 22]))
18+
]
19+
20+
21+
@pytest.mark.parametrize("array1,expected_result", numpy_add_values)
22+
def test_numpy_add(array1, expected_result):
23+
assert numpy_add(array1) == expected_result

0 commit comments

Comments
 (0)