Added tests for bitwise operations on ByteSeq
@@ -28,3 +28,34 @@ fn test_seq_poly() {
// assert_eq!(zq[0..y.len()], y[0..y.len()]);
// assert_eq!(zq.iter().skip(y.len()).fold(0, |acc, x| acc+x), 0);
}
+
+#[test]
+fn test_seq_not() {
+ let seq = ByteSeq::from_hex("ae125f62bd263edcc9");
+ let expected = ByteSeq::from_hex("51eda09d42d9c12336");
+ assert_eq!(expected, !seq);
+}
+
+#[test]
+fn test_seq_or() {
+ let seq1 = ByteSeq::from_hex("ae125f62bd263edcc9");
+ let seq2 = ByteSeq::from_hex("51eda09d42d9c12336");
+ let expected = ByteSeq::from_hex("ffffffffffffffffff");
+ assert_eq!(expected, seq1 | seq2);
+}
+
+#[test]
+fn test_seq_xor() {
+ let seq1 = ByteSeq::from_hex("296519d609eb2ab27a");
+ let seq2 = ByteSeq::from_hex("5a37737caae626c756");
+ let expected = ByteSeq::from_hex("73526aaaa30d0c752c");
+ assert_eq!(expected, seq1 ^ seq2);
+}
+
+#[test]
+fn test_seq_and() {
+ let seq1 = ByteSeq::from_hex("ae125f62bd263edcc9");
+ let seq2 = ByteSeq::from_hex("51eda09d42d9c12336");
+ let expected = ByteSeq::from_hex("000000000000000000");
+ assert_eq!(expected, seq1 & seq2);
+}
