1 # -*- coding: iso-8859-1 -*-
4 from hoomd_script
import *
8 # tests for update.rescale_temp
9 class update_rescale_temp_tests (unittest
.TestCase
):
12 init
.create_random(N
=100, phi_p
=0.05);
14 sorter
.set_params(grid
=8)
16 # tests basic creation of the updater
18 update
.rescale_temp(T
=1.0)
21 # test variable periods
22 def test_variable(self
):
23 update
.rescale_temp(T
=1.0, period
=lambda n
: n
*10)
27 def test_enable_disable(self
):
28 upd
= update
.rescale_temp(T
=1.0)
30 self
.assert_(not upd
.enabled
);
32 self
.assert_(not upd
.enabled
);
34 self
.assert_(upd
.enabled
);
36 self
.assert_(upd
.enabled
);
39 def test_set_period(self
):
40 upd
= update
.rescale_temp(T
=1.0)
43 self
.assertEqual(10, upd
.prev_period
);
45 self
.assertEqual(50, upd
.prev_period
);
49 def test_set_params(self
):
50 upd
= update
.rescale_temp(T
=1.0);
51 upd
.set_params(T
=1.2);
57 if __name__
== '__main__':
58 unittest
.main(argv
= ['test.py', '-v'])