Module EngineTest
[hide private]
[frames] | no frames]

Source Code for Module EngineTest

 1  ##################################################################### 
 2  # -*- coding: iso-8859-1 -*-                                        # 
 3  #                                                                   # 
 4  # Frets on Fire                                                     # 
 5  # Copyright (C) 2006 Sami Kyöstilä                                  # 
 6  #                                                                   # 
 7  # This program is free software; you can redistribute it and/or     # 
 8  # modify it under the terms of the GNU General Public License       # 
 9  # as published by the Free Software Foundation; either version 2    # 
10  # of the License, or (at your option) any later version.            # 
11  #                                                                   # 
12  # This program is distributed in the hope that it will be useful,   # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of    # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     # 
15  # GNU General Public License for more details.                      # 
16  #                                                                   # 
17  # You should have received a copy of the GNU General Public License # 
18  # along with this program; if not, write to the Free Software       # 
19  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,        # 
20  # MA  02110-1301, USA.                                              # 
21  ##################################################################### 
22   
23  import unittest 
24  from Engine import Engine 
25  from Player import Player 
26  from World import World 
27  import Network 
28   
29  """ 
30  class EngineTest(unittest.TestCase): 
31    def testStartup(self): 
32      e1 = Engine() 
33      e2 = Engine() 
34       
35      e1.startServer() 
36      e2.connect("localhost") 
37   
38      while not e2.isConnected(): 
39        e1.run() 
40        e2.run() 
41   
42      while not e2.world: 
43        e1.run() 
44        e2.run() 
45   
46      e1.world.createPlayer("mario") 
47   
48      while not len(e2.world.players): 
49        e1.run() 
50        e2.run() 
51   
52      assert len(e1.world.players) == 1 
53      assert len(e2.world.players) == 1 
54   
55      assert e2.world.players[0].name == "mario" 
56   
57      assert e1.manager 
58      assert e2.manager 
59   
60      assert e1.world 
61      assert e2.world 
62   
63      e1.stopServer() 
64       
65      e1.quit() 
66      e2.quit() 
67  """ 
68   
69  if __name__ == "__main__": 
70    unittest.main() 
71