1 # -*- coding: iso-8859-1 -*-
4 from hoomd_script
import *
8 # unit tests for init.create_random
9 class init_create_random_tests (unittest
.TestCase
):
13 # tests that mode settings work properly
15 option
.set_mode('gpu');
16 self
.assert_(globals.options
.mode
== 'gpu');
18 option
.set_mode('cpu');
19 self
.assert_(globals.options
.mode
== 'cpu');
21 option
.set_mode(None);
22 self
.assert_(globals.options
.mode
is None);
24 self
.assertRaises(RuntimeError, option
.set_mode
, 'foo');
28 self
.assert_(globals.options
.gpu
== 1);
29 self
.assert_(globals.options
.mode
== 'gpu');
32 self
.assert_(globals.options
.gpu
is None);
34 self
.assertRaises(RuntimeError, option
.set_gpu
, 'foo');
36 def test_gpu_error_checking(self
):
37 option
.set_gpu_error_checking(False);
38 self
.assert_(globals.options
.gpu_error_checking
== False);
40 option
.set_gpu_error_checking(True);
41 self
.assert_(globals.options
.gpu_error_checking
== True);
43 def test_min_cpu(self
):
44 option
.set_min_cpu(False);
45 self
.assert_(globals.options
.min_cpu
== False);
47 option
.set_min_cpu(True);
48 self
.assert_(globals.options
.min_cpu
== True);
50 def test_ignore_display(self
):
51 option
.set_ignore_display(False);
52 self
.assert_(globals.options
.ignore_display
== False);
54 option
.set_ignore_display(True);
55 self
.assert_(globals.options
.ignore_display
== True);
57 def test_notice_level(self
):
58 option
.set_notice_level(1);
59 self
.assert_(globals.options
.notice_level
== 1);
61 option
.set_notice_level(10);
62 self
.assert_(globals.options
.notice_level
== 10);
64 self
.assertRaises(RuntimeError, option
.set_notice_level
, 'foo');
70 if __name__
== '__main__':
71 unittest
.main(argv
= ['test.py', '-v'])