viff

changeset 844:4e84893a1725

Test case for apps/share-open.py.
author Martin Geisler <mg@daimi.au.dk>
date Mon, 21 Jul 2008 23:46:32 +0200
parents e0ba3202ebd2
children 8bf14cf5dd0a
files viff/test/test_apps.py
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/viff/test/test_apps.py	Mon Jul 21 23:36:31 2008 +0200
     1.2 +++ b/viff/test/test_apps.py	Mon Jul 21 23:46:32 2008 +0200
     1.3 @@ -26,6 +26,8 @@
     1.4  from twisted.internet.utils import getProcessOutput
     1.5  from twisted.internet.defer import Deferred, gatherResults
     1.6  
     1.7 +from viff.field import GF256
     1.8 +
     1.9  def execute(executable, *args):
    1.10      """Execute *executable* when the reactor is started."""
    1.11      d = Deferred()
    1.12 @@ -80,3 +82,20 @@
    1.13          result = gatherResults([m1, m2, m3])
    1.14          result.addCallback(check_outputs)
    1.15          return result
    1.16 +
    1.17 +    def test_share_open(self):
    1.18 +        """Test apps/share-open.py."""
    1.19 +        
    1.20 +        def check_outputs(outputs):
    1.21 +            for o in outputs:
    1.22 +                self.assertIn("opened a: %s" % GF256(17), o)
    1.23 +                self.assertIn("opened b: %s" % GF256(40), o)
    1.24 +                self.assertIn("opened c: %s" % GF256(235), o)
    1.25 +
    1.26 +        p1 = execute('share-open.py', 'player-1.ini', '17')
    1.27 +        p2 = execute('share-open.py', 'player-2.ini', '40')
    1.28 +        p3 = execute('share-open.py', 'player-3.ini', '235')
    1.29 +        
    1.30 +        result = gatherResults([p1, p2, p3])
    1.31 +        result.addCallback(check_outputs)
    1.32 +        return result