MCPcopy Index your code
hub / github.com/BitVM/BitVM / test_commitment_message_id_serialization

Function test_commitment_message_id_serialization

bridge/src/commitments.rs:139–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

137
138 #[test]
139 fn test_commitment_message_id_serialization() {
140 let messages = HashMap::from([
141 (CommitmentMessageId::PegOutTxIdSourceNetwork, "test"),
142 (CommitmentMessageId::PegOutTxIdDestinationNetwork, "test"),
143 (CommitmentMessageId::StartTime, "test"),
144 (CommitmentMessageId::Superblock, "test"),
145 (CommitmentMessageId::SuperblockHash, "test"),
146 (
147 CommitmentMessageId::Groth16IntermediateValues(("F_10_mul_c_1p0c".to_string(), 31)),
148 "test",
149 ),
150 (
151 CommitmentMessageId::Groth16IntermediateValues((
152 "F_18_mul_ca0_a1 * b0_b1".to_string(),
153 29,
154 )),
155 "test",
156 ),
157 ]);
158
159 let json = serialize(&messages);
160 let deserialized_messages = deserialize::<HashMap<CommitmentMessageId, &str>>(&json);
161 assert_eq!(messages, deserialized_messages);
162 }
163}

Callers

nothing calls this directly

Calls 1

serializeFunction · 0.85

Tested by

no test coverage detected