5452340879a6193a0ce9ac581dd87fe27a30bd9f
[novacoin.git] / bitcointools / testBCDataStream.py
1 #
2 # Unit tests for BCDataStream class
3 #
4
5 import unittest
6
7 import BCDataStream
8
9 class Tests(unittest.TestCase):
10   def setUp(self):
11     self.ds = BCDataStream.BCDataStream()
12
13   def testString(self):
14     t = {
15       "\x07setting" : "setting",
16       "\xfd\x00\x07setting" : "setting",
17       "\xfe\x00\x00\x00\x07setting" : "setting",
18       }
19     for (input, output) in t.iteritems():
20       self.ds.clear()
21       self.ds.write(input)
22       got = self.ds.read_string()
23       self.assertEqual(output, got)
24
25 if __name__ == "__main__":
26   unittest.main()