예제 #1
0
  def testArrayCopyFrom(self):
    param1 = test_param.ArrayConfigParams(self.yaml_array_data_dict)
    param2 = test_param.ArrayConfigParams()
    param2.CopyFrom(param1)

    param2.udata[0] = 0x00
    param2.udata[1] = 0x00
    param2.udata[2] = 0x00
    param2.udata[3] = 0x00

    data1 = binascii.hexlify(param1.Pack())
    data2 = binascii.hexlify(param2.Pack())

    self.assertNotEqual(data1, data2)
예제 #2
0
 def testArrayToDict(self):
   param = test_param.ArrayConfigParams(self.yaml_array_data_dict)
   new_dict = param.ToDict()
   pickle1 = pickle.dumps(self.yaml_array_data_dict)
   pickle2 = pickle.dumps(new_dict)
   self.assertEqual(pickle1, pickle2)
예제 #3
0
 def testArraySetField(self):
   param = test_param.ArrayConfigParams()
   param.SetField('data', self.yaml_array_data_dict['data'])
   param.SetField('udata', self.yaml_array_data_dict['udata'])
   data = param.Pack()
   self.assertEqual(binascii.hexlify(data), self.yaml_array_data_hex)
예제 #4
0
 def testArrayFromDict(self):
   param = test_param.ArrayConfigParams(self.yaml_array_data_dict)
   data = param.Pack()
   self.assertEqual(binascii.hexlify(data), self.yaml_array_data_hex)
예제 #5
0
 def testArrayPackUnpack(self):
   param = yaml.safe_load(self.yaml_array_data)
   data = param.Pack()
   param2 = test_param.ArrayConfigParams()
   param2.Unpack(data)
   self.assertEqual(param.ToDict(), param2.ToDict())