-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: improve makefile to compile with patterns * test: unit test for fake.ksy * test: generate list of libraries dynamically * feat: only compile current cpp file this is needed if we have multiple libraries in the same folder. see #24 (comment) However when we implement `import` #17 we will probably need to revisit again * test: compare the actual array
- Loading branch information
Showing
4 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
|
||
import numpy as np | ||
|
||
sys.path.append("local") | ||
import awkward_kaitai | ||
|
||
|
||
def test_fake(): | ||
reader = awkward_kaitai.Reader("test_artifacts/libfake.so") | ||
awkward_array = reader.load("example_data/data/fake.raw") | ||
|
||
assert len(awkward_array.fakeA__Zpoints.pointA__Zx[0]) == 3000 | ||
assert awkward_array.fakeA__Zpoints.pointA__Zy[0][0] == 2 | ||
assert awkward_array.fakeA__Zpoints.pointA__Zz.to_numpy().sum() == 66000 | ||
|
||
expected_array = np.array( | ||
[(1, 2, 3), (10, 20, 30), (11, 22, 33)] * 1000, | ||
dtype=[("pointA__Zx", "u4"), ("pointA__Zy", "u4"), ("pointA__Zz", "u4")], | ||
) | ||
|
||
np.testing.assert_array_equal( | ||
awkward_array.fakeA__Zpoints.to_numpy()[0], expected_array | ||
) |