Skip to content

Commit 24824a1

Browse files
committed
use already in place tuple impl
1 parent 73714ca commit 24824a1

File tree

8 files changed

+9
-88
lines changed

8 files changed

+9
-88
lines changed

src/generators/correct/v1.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use crate::v1::transaction::{
1717
DCert, POSIXTime, ScriptContext, ScriptPurpose, TransactionHash, TransactionInfo,
1818
TransactionInput, TransactionOutput, TxInInfo,
1919
};
20-
use crate::v1::tuple::Tuple;
2120
use crate::v2::value::{AssetClass, CurrencySymbol, TokenName, Value};
2221
use num_bigint::BigInt;
2322
use proptest::collection::btree_map;
@@ -305,14 +304,6 @@ pub fn arb_assoc_map<K: std::fmt::Debug, V: std::fmt::Debug>(
305304
vec((arb_k, arb_v), 10).prop_map(AssocMap)
306305
}
307306

308-
/// Strategy to generate a Tuple, given the strategies to generate its two elements
309-
pub fn arb_tuple<T: std::fmt::Debug, U: std::fmt::Debug>(
310-
arb_k: impl Strategy<Value = T>,
311-
arb_v: impl Strategy<Value = U>,
312-
) -> impl Strategy<Value = Tuple<T, U>> {
313-
(arb_k, arb_v).prop_map(|(l, r)| Tuple(l, r))
314-
}
315-
316307
/// Strategy to generate a PaymentPubKeyHash
317308
pub fn arb_payment_pub_key_hash() -> impl Strategy<Value = PaymentPubKeyHash> {
318309
arb_ed25519_pub_key_hash().prop_map(PaymentPubKeyHash)
@@ -352,10 +343,10 @@ pub fn arb_transaction_info() -> impl Strategy<Value = TransactionInfo> {
352343
arb_value(),
353344
arb_value(),
354345
vec(arb_d_cert(), 5),
355-
vec(arb_tuple(arb_staking_credential(), arb_integer()), 5),
346+
vec((arb_staking_credential(), arb_integer()), 5),
356347
arb_plutus_interval_posix_time(),
357348
vec(arb_payment_pub_key_hash(), 5),
358-
vec(arb_tuple(arb_datum_hash(), arb_datum()), 5),
349+
vec((arb_datum_hash(), arb_datum()), 5),
359350
arb_transaction_hash(),
360351
)
361352
.prop_map(

src/v1/assoc_map.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ use serde::{Deserialize, Serialize};
88

99
use crate::plutus_data::{IsPlutusData, PlutusData, PlutusDataError, PlutusType};
1010

11-
use super::tuple::Tuple;
12-
1311
#[derive(Debug, PartialEq, Eq, Clone)]
1412
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1513
pub struct AssocMap<K, V>(pub Vec<(K, V)>);
@@ -39,15 +37,15 @@ impl<K: IsPlutusData, V: IsPlutusData> IsPlutusData for AssocMap<K, V> {
3937
}
4038
}
4139

42-
impl<K, V> From<Vec<Tuple<K, V>>> for AssocMap<K, V> {
43-
fn from(vec: Vec<Tuple<K, V>>) -> Self {
44-
AssocMap(vec.into_iter().map(|Tuple(l, r)| (l, r)).collect())
40+
impl<K, V> From<Vec<(K, V)>> for AssocMap<K, V> {
41+
fn from(vec: Vec<(K, V)>) -> Self {
42+
AssocMap(vec)
4543
}
4644
}
4745

48-
impl<K, V> From<AssocMap<K, V>> for Vec<Tuple<K, V>> {
46+
impl<K, V> From<AssocMap<K, V>> for Vec<(K, V)> {
4947
fn from(m: AssocMap<K, V>) -> Self {
50-
m.0.into_iter().map(|(l, r)| Tuple(l, r)).collect()
48+
m.0
5149
}
5250
}
5351

src/v1/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ pub mod interval;
77
pub mod redeemer;
88
pub mod script;
99
pub mod transaction;
10-
pub mod tuple;
1110
pub mod value;

src/v1/transaction.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use super::{
44
crypto::{LedgerBytes, PaymentPubKeyHash},
55
datum::{Datum, DatumHash},
66
interval::PlutusInterval,
7-
tuple::Tuple,
87
value::{CurrencySymbol, Value},
98
};
109
use crate::plutus_data::{
@@ -357,10 +356,10 @@ pub struct TransactionInfo {
357356
pub fee: Value,
358357
pub mint: Value,
359358
pub d_cert: Vec<DCert>,
360-
pub wdrl: Vec<Tuple<StakingCredential, BigInt>>,
359+
pub wdrl: Vec<(StakingCredential, BigInt)>,
361360
pub valid_range: POSIXTimeRange,
362361
pub signatories: Vec<PaymentPubKeyHash>,
363-
pub datums: Vec<Tuple<DatumHash, Datum>>,
362+
pub datums: Vec<(DatumHash, Datum)>,
364363
pub id: TransactionHash,
365364
}
366365

src/v1/tuple.rs

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/v2/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ pub use crate::v1::crypto;
1111
pub use crate::v1::interval;
1212
pub use crate::v1::redeemer;
1313
pub use crate::v1::script;
14-
pub use crate::v1::tuple;
1514
pub use crate::v1::value;

tests/json.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,6 @@ mod json_roundtrip_tests {
9191
}
9292
}
9393

94-
proptest! {
95-
#[test]
96-
fn test_bigint_tuple(val in arb_tuple(arb_integer(), arb_integer())) {
97-
assert_eq!(val, from_to_json(&val)?);
98-
}
99-
}
100-
10194
proptest! {
10295
#[test]
10396
fn test_d_cert(val in arb_d_cert()) {

tests/plutus_data.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,6 @@ mod plutusdata_roundtrip_tests {
175175
}
176176
}
177177

178-
proptest! {
179-
#[test]
180-
fn test_bigint_tuple(val in arb_tuple(arb_integer(), arb_integer())) {
181-
assert_eq!(val, from_to_plutus_data(&val)?);
182-
}
183-
}
184-
185178
proptest! {
186179
#[test]
187180
fn test_arb_payment_pub_key_hash(val in arb_payment_pub_key_hash()) {

0 commit comments

Comments
 (0)