Beispiel #1
0
 public static void AssertRoundTrip(CBORObject o)
 {
     CBORObject o2 = FromBytesTestAB(o.EncodeToBytes());
       if (o2.Type == CBORType.Map && o.Type == CBORType.Map) {
     // Skip because key order may be different
       } else {
     if (!o.ToString().Equals(o2.ToString()))
       Assert.AreEqual(o.ToString(), o2.ToString(), "o2 is not equal to o");
       }
       TestNumber(o);
       AssertEqualsHashCode(o, o2);
 }
Beispiel #2
0
 private static string ObjectMessages(CBORObject o1, CBORObject o2, String s)
 {
     if (o1.Type == CBORType.Number && o2.Type == CBORType.Number) {
     return s + ":\n" + o1.ToString() + " and\n" + o2.ToString() + "\nOR\n" +
       o1.AsExtendedDecimal().ToString() + " and\n" + o2.AsExtendedDecimal().ToString() + "\nOR\n" +
       "AddSubCompare(" + ToByteArrayString(o1) + ",\n" + ToByteArrayString(o2) + ");";
       } else {
     return s + ":\n" + o1.ToString() + " and\n" + o2.ToString() + "\nOR\n" +
       ToByteArrayString(o1) + " and\n" + ToByteArrayString(o2);
       }
 }
Beispiel #3
0
 public static void AssertSer(CBORObject o, String s)
 {
     if (!s.Equals(o.ToString()))
     Assert.AreEqual(s, o.ToString(), "o is not equal to s");
       // Test round-tripping
       CBORObject o2 = FromBytesTestAB(o.EncodeToBytes());
       if (!s.Equals(o2.ToString()))
     Assert.AreEqual(s, o2.ToString(), "o2 is not equal to s");
       TestNumber(o);
       AssertEqualsHashCode(o, o2);
 }