MCPcopy Create free account
hub / github.com/Lightprotocol/light-protocol-v1 / read_test_data

Function read_test_data

program/tests/test_utils/mod.rs:226–249  ·  view source on GitHub ↗
(file_name: std::string::String)

Source from the content-addressed store, hash-verified

224 }
225
226 pub fn read_test_data(file_name: std::string::String) -> Vec<u8> {
227 let mut path = std::string::String::from("./tests/test_data/");
228 path.push_str(&file_name);
229 println!("reading file: {:?}", path);
230 let ix_data_file = fs::read_to_string(path).expect("Something went wrong reading the file");
231 let ix_data_json: Value = serde_json::from_str(&ix_data_file).unwrap();
232 let mut ix_data = Vec::new();
233 for i in ix_data_json["bytes"][0].as_str().unwrap().split(',') {
234 let j = (*i).parse::<u8>();
235 match j {
236 Ok(x) => (ix_data.push(x)),
237 Err(_e) => (),
238 }
239 }
240 println!("Appending merkle tree bytes and merkle tree index");
241 // for i in 0..32 {
242 // ix_data.push(MERKLE_TREE_ACC_BYTES_ARRAY[0].0[i]);
243 // }
244 // //pushing merkle tree index
245 // ix_data.push(0);
246
247 println!("{:?}", ix_data);
248 ix_data
249 }
250
251 fn add_token_account_with_address(
252 program_test: &mut ProgramTest,

Calls

no outgoing calls

Tested by

no test coverage detected