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 basic creation of the random initializer
15 init
.create_random(N
=100, phi_p
=0.05);
16 self
.assert_(globals.system_definition
);
17 self
.assert_(globals.system
);
19 # tests creation with a few more arguments specified
20 def test_moreargs(self
):
21 init
.create_random(name
="B", min_dist
=0.1, N
=100, phi_p
=0.05);
22 self
.assert_(globals.system_definition
);
23 self
.assert_(globals.system
);
25 # tests creation with a specified box
27 init
.create_random(name
="B", min_dist
=0.1, N
=100, box
=data
.boxdim(L
=100));
28 self
.assert_(globals.system_definition
);
29 self
.assert_(globals.system
);
31 # checks for an error if initialized twice
32 def test_inittwice(self
):
33 init
.create_random(N
=100, phi_p
=0.05);
34 self
.assertRaises(RuntimeError, init
.create_random
, N
=100, phi_p
=0.05);
40 if __name__
== '__main__':
41 unittest
.main(argv
= ['test.py', '-v'])