MCPcopy Create free account
hub / github.com/ProvableHQ/sdk / test_get_inputs

Function test_get_inputs

wasm/src/programs/program.rs:731–833  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

729
730 #[wasm_bindgen_test]
731 fn test_get_inputs() {
732 let credits = Program::from(ProgramNative::credits().unwrap());
733 let inputs = credits.get_function_inputs("transfer_private".to_string()).unwrap();
734
735 let expected = array![
736 object! {
737 "type": "record",
738 "record": "credits",
739 "members": array![
740 object! {
741 "name": "microcredits",
742 "type": "u64",
743 "visibility": "private",
744 },
745 object! {
746 "name": "_nonce",
747 "type": "group",
748 "visibility": "public",
749 },
750 ],
751 "register": "r0",
752 },
753 object! {
754 "type": "address",
755 "visibility": "private",
756 "register": "r1",
757 },
758 object! {
759 "type": "u64",
760 "visibility": "private",
761 "register": "r2",
762 },
763 ];
764
765 assert_eq!(format!("{:?}", inputs), format!("{:?}", expected));
766
767 let token_issue = Program::from_string(TOKEN_ISSUE).unwrap();
768 let inputs = token_issue.get_function_inputs("bump_token_version".to_string()).unwrap();
769
770 let expected = array![
771 object! {
772 "type": "address",
773 "visibility": "private",
774 "register": "r0",
775 },
776 object! {
777 "type": "record",
778 "record": "Token",
779 "members": array![
780 object! {
781 "name": "microcredits",
782 "type": "u64",
783 "visibility": "private",
784 },
785 object! {
786 "name": "amount",
787 "type": "u64",
788 "visibility": "private",

Callers

nothing calls this directly

Calls 2

get_function_inputsMethod · 0.80
to_stringMethod · 0.45

Tested by

no test coverage detected