Beispiel #1
0
 def testDodgyStart(self):
     for i in range(0, len(self.megaString), 10):
         cat = Concat()
         fp = FIXParser(self.spec, cb = cat.onMsg,
                        on_discard= cat.onDiscard)
         s = self.megaString[i:]
         fp.feed(s)
         check =len(cat.buf) +fp.checksum() + len(cat.discardBuffer)  
         assert check == len(s)
         if i % 100 == 0:
             print "%s -> %s..." % (i, cat.messages)
             print "%s bytes sent. %s accounted for (%s parsed %s inbuffer %s discarded" % (len(s), check, len(cat.buf), fp.checksum(), cat.discardBuffer)
Beispiel #2
0
 def _test_basic(self):
     # Test the first
     fp = FIXParser(self.spec)
     def doit(x):
         c = x.cursor()
         while True:
             d = c.next()
             if not d:
                 break
             #print d
             print "=" * 80
             print d[1]
             fp.feed(d[1])
     print "In"
     print "=" * 80
     doit( self.inDb )
     print "Out"
     print "=" * 80
     doit( self.outDb )
Beispiel #3
0
 def testBigString(self):
     # Feed the whole thing
     cat2 = Concat()
     fp2 = FIXParser(self.spec,cb = cat2.onMsg)
     fp2.feed(self.megaString)
     assert cat2.buf == self.megaString
Beispiel #4
0
 def testBigStringOneByteAtATime(self):
     cat = Concat()
     fp = FIXParser(self.spec, cb = cat.onMsg)
     for x in self.megaString:
         fp.feed(x)
     assert cat.buf == self.megaString