From d92b25eaf9884099c075a0f74a52c0225b799dae Mon Sep 17 00:00:00 2001
From: dignifiedquire <me@dignifiedquire.com>
Date: Wed, 13 Nov 2024 20:51:59 +0100
Subject: [PATCH] add test

---
 src/algorithms/pkcs1v15.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/algorithms/pkcs1v15.rs b/src/algorithms/pkcs1v15.rs
index 13afb57..e813de1 100644
--- a/src/algorithms/pkcs1v15.rs
+++ b/src/algorithms/pkcs1v15.rs
@@ -195,4 +195,13 @@ mod tests {
             }
         }
     }
+
+    #[test]
+    fn test_encrypt_tiny_no_crash() {
+        let mut rng = ChaCha8Rng::from_seed([42; 32]);
+        let k = 8;
+        let message = vec![1u8; 4];
+        let res = pkcs1v15_encrypt_pad(&mut rng, &message, k);
+        assert_eq!(res, Err(Error::MessageTooLong));
+    }
 }