From 12d6f1d963fe78460eefceef52f43fc1d6c784aa Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 6 Apr 2016 23:46:19 +0000 Subject: [PATCH] Commit missing parts of bb064c67a. --- artiq/test/coredevice/test_portability.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/artiq/test/coredevice/test_portability.py b/artiq/test/coredevice/test_portability.py index 43546edb8..20269d635 100644 --- a/artiq/test/coredevice/test_portability.py +++ b/artiq/test/coredevice/test_portability.py @@ -37,6 +37,19 @@ class _Primes(EnvExperiment): self._add_output(x) +class _Math(EnvExperiment): + """Test kernel math""" + + def build(self): + self.setattr_device("core") + self.x = 3.1 + self.x_sqrt = 0.0 + + @kernel + def run(self): + self.x_sqrt = self.x**0.5 + + class _Misc(EnvExperiment): def build(self): self.setattr_device("core") @@ -194,6 +207,11 @@ class HostVsDeviceCase(ExperimentCase): _run_on_host(_Primes, maximum=100, output_list=l_host) self.assertEqual(l_device, l_host) + def test_math(self): + math_device = self.execute(_Math) + math_host = _run_on_host(_Math) + self.assertEqual(math_device.x_sqrt, math_host.x_sqrt) + def test_misc(self): for f in self.execute, _run_on_host: uut = f(_Misc)