mirror of https://github.com/m-labs/artiq.git
test_cache: port to NAC3
This commit is contained in:
parent
dc006b1a40
commit
cc3d86ff12
|
@ -1,27 +1,38 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from numpy import int32
|
||||||
|
|
||||||
from artiq.experiment import *
|
from artiq.experiment import *
|
||||||
|
from artiq.coredevice.core import Core
|
||||||
|
from artiq.coredevice.cache import CoreCache
|
||||||
from artiq.coredevice.exceptions import CacheError
|
from artiq.coredevice.exceptions import CacheError
|
||||||
from artiq.test.hardware_testbench import ExperimentCase
|
from artiq.test.hardware_testbench import ExperimentCase
|
||||||
|
|
||||||
|
|
||||||
|
@nac3
|
||||||
class _Cache(EnvExperiment):
|
class _Cache(EnvExperiment):
|
||||||
|
core: KernelInvariant[Core]
|
||||||
|
core_cache: KernelInvariant[CoreCache]
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
self.setattr_device("core")
|
self.setattr_device("core")
|
||||||
self.setattr_device("core_cache")
|
self.setattr_device("core_cache")
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def get(self, key):
|
def get(self, key: str) -> list[int32]:
|
||||||
return self.core_cache.get(key)
|
return self.core_cache.get(key)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def put(self, key, value):
|
def put(self, key: str, value: list[int32]):
|
||||||
self.core_cache.put(key, value)
|
self.core_cache.put(key, value)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def get_put(self, key, value):
|
def get_put(self, key: str, value: list[int32]):
|
||||||
self.get(key)
|
self.get(key)
|
||||||
self.put(key, value)
|
self.put(key, value)
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skip("NAC3TODO https://git.m-labs.hk/M-Labs/nac3/issues/299")
|
||||||
class CacheTest(ExperimentCase):
|
class CacheTest(ExperimentCase):
|
||||||
def test_get_empty(self):
|
def test_get_empty(self):
|
||||||
exp = self.create(_Cache)
|
exp = self.create(_Cache)
|
||||||
|
|
Loading…
Reference in New Issue