def testValueOfOneReturnsOne(self): value = ultrak498.bcd_to_int(chr(0x10)) self.assertEqual(value, 1)
def testMultiByteStringRaisesException(self): with self.assertRaises(ValueError): ultrak498.bcd_to_int("ab")
def testValueOf50Returns50(self): value = ultrak498.bcd_to_int(chr(0x05)) self.assertEqual(value, 50)
def testValueOf98Returns98(self): value = ultrak498.bcd_to_int(chr(0x89)) self.assertEqual(value, 98)
def testValueOfElevenReturnsEleven(self): value = ultrak498.bcd_to_int(chr(0x11)) self.assertEqual(value, 11)
def testValueOfTwentyReturnsTwenty(self): value = ultrak498.bcd_to_int(chr(0x02)) self.assertEqual(value, 20)
def testValueOf42Returns42(self): value = ultrak498.bcd_to_int(chr(0x24)) self.assertEqual(value, 42)
def testValueOfFifteenReturnsFifteen(self): value = ultrak498.bcd_to_int(chr(0x51)) self.assertEqual(value, 15)
def testValueOfTenReturnsTen(self): value = ultrak498.bcd_to_int(chr(0x01)) self.assertEqual(value, 10)
def testValueOfNineReturnsNine(self): value = ultrak498.bcd_to_int(chr(0x90)) self.assertEqual(value, 9)
def testValueOf75Returns75(self): value = ultrak498.bcd_to_int(chr(0x57)) self.assertEqual(value, 75)
def testValueOf99Returns99(self): value = ultrak498.bcd_to_int(chr(0x99)) self.assertEqual(value, 99)
def testTensPlaceGreaterThanNineRaisesException(self): with self.assertRaises(ValueError): ultrak498.bcd_to_int(chr(0x0A))
def testValueOfZeroReturnsZero(self): value = ultrak498.bcd_to_int(chr(0x00)) self.assertEqual(value, 0)