/[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.2 by benja, Mon Apr 7 18:47:39 2003 UTC revision 1.3 by benja, Mon Apr 7 19:05:23 2003 UTC
# Line 45  def testConstructor(): Line 45  def testConstructor():
45      assert id.getURI() == lower_1      assert id.getURI() == lower_1
46      assert id.getContentType() == "application/rdf+xml"      assert id.getContentType() == "application/rdf+xml"
47    
48      id2 = BlockId(id.getSha1(), id.getTigerTree(),      id2 = BlockId(id.getContentType(),
49                    id.getContentType())                    id.getSha1(), id.getTigerTree())
50    
51      assert id2.getURI() == lower_1      assert id2.getURI() == lower_1
52      assert id == id2      assert id == id2
# Line 58  def testConstructor(): Line 58  def testConstructor():
58      assert id != id3      assert id != id3
59      assert id.hashCode() != id3.hashCode()      assert id.hashCode() != id3.hashCode()
60    
61    def testGetIdForData():
62        id_1 = BlockId(uri_1)
63        id_2 = BlockId(uri_2)
64        id_3 = BlockId(uri_3)
65        get = BlockId.getIdForData
66    
67        assert id_2 == get('application/Octet-Stream', data_2) != id_3
68        assert id_3 == get('text/plain', data_3) != id_2
69    
70    def check(id, data):
71        try: id.check(data)
72        except BlockId.WrongIdException: return 0
73        else: return 1
74    
75    def testCheck():
76        id_1 = BlockId(uri_1)
77        id_2 = BlockId(uri_2)
78        id_3 = BlockId(uri_3)
79    
80        assert check(id_2, data_2)
81        assert (not check(id_1, data_2)) and (not check(id_3, data_2))
82            
83            assert check(id_3, data_3)
84        assert (not check(id_1, data_3)) and (not check(id_2, data_3))

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

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