mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-03-13 03:57:43 +01:00
Adding offset to RegisterAddress (#1413)
All checks were successful
Build and Deploy on local RHEL9 / build (push) Successful in 2m3s
Build on RHEL9 docker image / build (push) Successful in 3m58s
Build and Deploy on local RHEL8 / build (push) Successful in 5m0s
Build on RHEL8 docker image / build (push) Successful in 5m7s
Run Simulator Tests on local RHEL9 / build (push) Successful in 14m40s
Run Simulator Tests on local RHEL8 / build (push) Successful in 17m4s
All checks were successful
Build and Deploy on local RHEL9 / build (push) Successful in 2m3s
Build on RHEL9 docker image / build (push) Successful in 3m58s
Build and Deploy on local RHEL8 / build (push) Successful in 5m0s
Build on RHEL8 docker image / build (push) Successful in 5m7s
Run Simulator Tests on local RHEL9 / build (push) Successful in 14m40s
Run Simulator Tests on local RHEL8 / build (push) Successful in 17m4s
* implemented + and += for RegisterAddres and tests plus test cleanup
This commit is contained in:
@@ -26,7 +26,10 @@ void init_bit(py::module &m) {
|
||||
.def("__str__", &RegisterAddress::str)
|
||||
.def("value", &RegisterAddress::value)
|
||||
.def(py::self == py::self)
|
||||
.def(py::self != py::self);
|
||||
.def(py::self != py::self)
|
||||
.def("__add__",&RegisterAddress::operator+)
|
||||
.def("__radd__",&RegisterAddress::operator+)
|
||||
.def("__iadd__",&RegisterAddress::operator+=, py::return_value_policy::reference_internal);
|
||||
|
||||
py::class_<BitAddress>(m, "BitAddress")
|
||||
.def(py::init())
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from slsdet.bits import clearbit, clearbit_arr, setbit, setbit_arr
|
||||
from slsdet import RegisterAddress
|
||||
import numpy as np
|
||||
|
||||
|
||||
@@ -47,4 +48,13 @@ def test_setbit_arr():
|
||||
def test_clearbit_arr():
|
||||
arr = np.array((5, 5, 5), dtype=np.int8)
|
||||
clearbit_arr(0, arr)
|
||||
assert all(arr == (4, 4, 4))
|
||||
assert all(arr == (4, 4, 4))
|
||||
|
||||
def test_RegisterAddress_addition():
|
||||
r = RegisterAddress(0x10)
|
||||
r2 = r + 0x5
|
||||
assert r2.value() == 0x15
|
||||
r3 = 0x5 + r
|
||||
assert r3.value() == 0x15
|
||||
r += 0x5
|
||||
assert r.value() == 0x15
|
||||
Reference in New Issue
Block a user