Commit missing parts of bb064c67a.

This commit is contained in:
whitequark 2016-04-06 23:46:19 +00:00
parent bb064c67a9
commit 12d6f1d963
1 changed files with 18 additions and 0 deletions

View File

@ -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)