/[storm]/storm/org/nongnu/storm/BlockId.test
ViewVC logotype

Diff of /storm/org/nongnu/storm/BlockId.test

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by benja, Mon Apr 7 19:05:23 2003 UTC revision 1.4 by benja, Mon Apr 7 19:23:56 2003 UTC
# Line 20  Line 20 
20  #  #
21  #  #
22    
23    import java
24  from org.nongnu.storm import BlockId  from org.nongnu.storm import BlockId
25  from jarray import array  from jarray import array
26    
# Line 72  def check(id, data): Line 73  def check(id, data):
73      except BlockId.WrongIdException: return 0      except BlockId.WrongIdException: return 0
74      else: return 1      else: return 1
75    
76    def check2(id, data):
77        s = java.io.ByteArrayInputStream(data)
78        s2 = id.getCheckedInputStream(s)
79        while s2.read() >= 0: pass
80    
81        try: s2.close()
82        except BlockId.WrongIdException: return 0
83        else: return 1
84    
85    
86  def testCheck():  def testCheck():
87      id_1 = BlockId(uri_1)      id_1 = BlockId(uri_1)
88      id_2 = BlockId(uri_2)      id_2 = BlockId(uri_2)
# Line 82  def testCheck(): Line 93  def testCheck():
93            
94      assert check(id_3, data_3)      assert check(id_3, data_3)
95      assert (not check(id_1, data_3)) and (not check(id_2, data_3))      assert (not check(id_1, data_3)) and (not check(id_2, data_3))
96    
97        assert check2(id_2, data_2)
98        assert (not check2(id_1, data_2)) and (not check2(id_3, data_2))
99        
100        assert check2(id_3, data_3)
101        assert (not check2(id_1, data_3)) and (not check2(id_2, data_3))

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26