From 85398edc89ce2d4c17e912cf11b1ced60c04cd0e Mon Sep 17 00:00:00 2001 From: lisicky Date: Tue, 10 Sep 2024 20:27:12 +0900 Subject: [PATCH] add test --- rust/src/tests/general.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/rust/src/tests/general.rs b/rust/src/tests/general.rs index 963eeedd..29eb5a11 100644 --- a/rust/src/tests/general.rs +++ b/rust/src/tests/general.rs @@ -851,4 +851,19 @@ fn plutus_map_keys_duplication_test() { assert_eq!(map_from_bytes.total_len(), 3); assert_eq!(map, map_from_bytes) +} + +#[test] +fn too_big_plutus_int_to_json() { + let too_big_int = BigInt::from_str("999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999").unwrap(); + let plutus_data = PlutusData::new_integer(&too_big_int); + let json = plutus_data.to_json(PlutusDatumSchema::DetailedSchema); + #[cfg(feature = "arbitrary-precision-json")] + { + assert!(json.is_ok()); + } + #[cfg(not(feature = "arbitrary-precision-json"))] + { + assert!(json.is_err()); + } } \ No newline at end of file