Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
raychu86 committed Dec 2, 2024
1 parent 072d0ce commit d76d1a7
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions synthesizer/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,13 +808,17 @@ function swap:
assert_eq!(function.inputs().len(), 2);
assert_eq!(function.input_types().len(), 2);

// Declare the expected input types.
let expected_input_type_1 = ValueType::ExternalRecord(Locator::from_str("eth.aleo/eth")?);
let expected_input_type_2 = ValueType::ExternalRecord(Locator::from_str("usdc.aleo/usdc")?);

// Ensure the inputs are external records.
assert_eq!(function.input_types()[0], ValueType::ExternalRecord(Locator::from_str("eth.aleo/eth")?));
assert_eq!(function.input_types()[1], ValueType::ExternalRecord(Locator::from_str("usdc.aleo/usdc")?));
assert_eq!(function.input_types()[0], expected_input_type_1);
assert_eq!(function.input_types()[1], expected_input_type_2);

// Ensure the input variants are correct.
assert_eq!(function.input_types()[0].variant(), 4);
assert_eq!(function.input_types()[1].variant(), 4);
assert_eq!(function.input_types()[0].variant(), expected_input_type_1.variant());
assert_eq!(function.input_types()[1].variant(), expected_input_type_2.variant());

// Ensure there are two instructions.
assert_eq!(function.instructions().len(), 2);
Expand All @@ -827,13 +831,17 @@ function swap:
assert_eq!(function.outputs().len(), 2);
assert_eq!(function.output_types().len(), 2);

// Declare the expected output types.
let expected_output_type_1 = ValueType::ExternalRecord(Locator::from_str("eth.aleo/eth")?);
let expected_output_type_2 = ValueType::ExternalRecord(Locator::from_str("usdc.aleo/usdc")?);

// Ensure the outputs are external records.
assert_eq!(function.output_types()[0], ValueType::ExternalRecord(Locator::from_str("eth.aleo/eth")?));
assert_eq!(function.output_types()[1], ValueType::ExternalRecord(Locator::from_str("usdc.aleo/usdc")?));
assert_eq!(function.output_types()[0], expected_output_type_1);
assert_eq!(function.output_types()[1], expected_output_type_2);

// Ensure the output variants are correct.
assert_eq!(function.output_types()[0].variant(), 4);
assert_eq!(function.output_types()[1].variant(), 4);
assert_eq!(function.output_types()[0].variant(), expected_output_type_1.variant());
assert_eq!(function.output_types()[1].variant(), expected_output_type_2.variant());

Ok(())
}
Expand Down

0 comments on commit d76d1a7

Please sign in to comment.