text
stringlengths
93
16.4k
id
stringlengths
20
40
metadata
dict
input_ids
listlengths
45
2.05k
attention_mask
listlengths
45
2.05k
complexity
int64
1
9
#[test] fn test_rpc_get_multiple_accounts() { let bob_pubkey = solana_sdk::pubkey::new_rand(); let RpcHandler { io, meta, bank, .. } = start_rpc_handler_with_tx(&bob_pubkey); let address = Pubkey::new(&[9; 32]); let data = vec![1, 2, 3, 4, 5]; let mut account = AccountSharedData::new(42, 5, &Pubkey::default()); account.data = data.clone(); bank.store_account(&address, &account); let non_existent_address = Pubkey::new(&[8; 32]); let req = format!( r#"{{"jsonrpc":"2.0","id":1,"method":"getMultipleAccounts","params":[["{}", "{}", "{}"]]}}"#, bob_pubkey, non_existent_address, address, ); let res = io.handle_request_sync(&req, meta.clone()); let expected = json!({ "jsonrpc": "2.0", "result": { "context":{"slot":0}, "value":[{ "owner": "11111111111111111111111111111111", "lamports": 20, "lamportsStr": "20", "data": ["", "base64"], "executable": false, "rentEpoch": 0 }, null, { "owner": "11111111111111111111111111111111", "lamports": 42, "lamportsStr": "42", "data": [base64::encode(&data), "base64"], "executable": false, "rentEpoch": 0 }], }, "id": 1, }); let expected: Response = serde_json::from_value(expected).expect("expected response deserialization"); let result: Response = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); assert_eq!(expected, result); // Test config settings still work with multiple accounts let req = format!( r#"{{ "jsonrpc":"2.0","id":1,"method":"getMultipleAccounts","params":[ ["{}", "{}", "{}"], {{"encoding":"base58"}} ] }}"#, bob_pubkey, non_existent_address, address, ); let res = io.handle_request_sync(&req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); assert_eq!(result["result"]["value"].as_array().unwrap().len(), 3); assert_eq!( result["result"]["value"][2]["data"], json!([bs58::encode(&data).into_string(), "base58"]), ); let req = format!( r#"{{ "jsonrpc":"2.0","id":1,"method":"getMultipleAccounts","params":[ ["{}", "{}", "{}"], {{"encoding":"base64", "dataSlice": {{"length": 2, "offset": 1}}}} ] }}"#, bob_pubkey, non_existent_address, address, ); let res = io.handle_request_sync(&req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); assert_eq!(result["result"]["value"].as_array().unwrap().len(), 3); assert_eq!( result["result"]["value"][2]["data"], json!([base64::encode(&data[1..3]), "base64"]), ); let req = format!( r#"{{ "jsonrpc":"2.0","id":1,"method":"getMultipleAccounts","params":[ ["{}", "{}", "{}"], {{"encoding":"binary", "dataSlice": {{"length": 2, "offset": 1}}}} ] }}"#, bob_pubkey, non_existent_address, address, ); let res = io.handle_request_sync(&req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); assert_eq!(result["result"]["value"].as_array().unwrap().len(), 3); assert_eq!( result["result"]["value"][2]["data"], bs58::encode(&data[1..3]).into_string(), ); let req = format!( r#"{{ "jsonrpc":"2.0","id":1,"method":"getMultipleAccounts","params":[ ["{}", "{}", "{}"], {{"encoding":"jsonParsed", "dataSlice": {{"length": 2, "offset": 1}}}} ] }}"#, bob_pubkey, non_existent_address, address, ); let res = io.handle_request_sync(&req, meta); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); result["error"].as_object().unwrap(); }
rust_cleaned_test_functions.jsonl/3032
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2498 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60799, 3062, 45233, 55665, 368, 341, 286, 1077, 35192, 34014, 792, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 79961, 3050, 314, 6399, 11, 8823, 11, 6073, 11, 5241, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_summary_line_format() { let dt: DateTime<Utc> = Utc.timestamp(1, 0); let formatted = mdbook_summary_line_for_time(dt); assert_eq!( formatted, "- [Thursday, Jan 01, 1970](./1970/1970-01/1970-01-01.md)" ); }
rust_cleaned_test_functions.jsonl/66794
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 151 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27251, 6528, 8955, 368, 341, 286, 1077, 7594, 25, 6520, 36397, 10413, 29, 284, 547, 10413, 22511, 7, 16, 11, 220, 15, 317, 286, 1077, 23126, 284, 10688, 2190, 27251, 6528, 5478, 3009, 24697, 317...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pitch_yaw_roll_pos_hp() { check_euler(Euler { x: Rad(0f32), y: Rad(HPI), z: Rad(1f32), }); }
rust_cleaned_test_functions.jsonl/38253
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 116 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51959, 80183, 57578, 6479, 48478, 368, 341, 286, 1779, 2204, 8479, 10722, 8479, 341, 310, 856, 25, 20605, 7, 15, 69, 18, 17, 1326, 310, 379, 25, 20605, 10896, 1893, 1326, 310, 1147, 25, 20605, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_0057_example_3() { let intervals = vec![]; let new_interval = vec![5, 7]; let result = vec![vec![5, 7]]; assert_eq!(Solution::insert(intervals, new_interval), result); }
rust_cleaned_test_functions.jsonl/57633
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 112 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 15, 15, 20, 22, 39304, 62, 18, 368, 341, 286, 1077, 26992, 284, 7486, 0, 15078, 286, 1077, 501, 20541, 284, 7486, 20703, 20, 11, 220, 22, 935, 286, 1077, 1102, 284, 7486, 20703, 4083, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dot() { let a = [1., 2., 3.]; let b = [1., 2., 3.]; assert_eq!(dot(&a, &b).unwrap(), 14.0); }
rust_cleaned_test_functions.jsonl/60749
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 87 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30941, 368, 341, 286, 1077, 264, 284, 508, 16, 2572, 220, 17, 2572, 220, 18, 13, 935, 286, 1077, 293, 284, 508, 16, 2572, 220, 17, 2572, 220, 18, 13, 935, 286, 2060, 10714, 10297, 16119, 209...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_numeric() { context!(ctx, dev); execute_str!(ctx, b"*NUM? 42" => result, response { assert_eq!(result, Ok(())); assert_eq!(response, b"42.0,0\n"); }); execute_str!(ctx, b"*NUM? MAX" => result, response { assert_eq!(result, Ok(())); assert_eq!(response, b"100.0,1\n"); }); execute_str!(ctx, b"*NUM? MIN" => result, response { assert_eq!(result, Ok(())); assert_eq!(response, b"-100.0,2\n"); }); execute_str!(ctx, b"*NUM? DEF" => result, response { assert_eq!(result, Ok(())); assert_eq!(response, b"0.0,3\n"); }); execute_str!(ctx, b"*NUM? UP" => result, response { assert_eq!(result, Ok(())); assert_eq!(response, b"1.0,4\n"); }); execute_str!(ctx, b"*NUM? DOWN" => result, response { assert_eq!(result, Ok(())); assert_eq!(response, b"-1.0,5\n"); }); }
rust_cleaned_test_functions.jsonl/82168
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 463 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29418, 368, 341, 262, 2266, 10297, 3773, 11, 3483, 317, 262, 9026, 2895, 10297, 3773, 11, 293, 61593, 17488, 30, 220, 19, 17, 1, 589, 1102, 11, 2033, 341, 286, 2060, 10714, 10297, 1382, 11, 76...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_literals() { let mut ctx = Context::new(); let string = { let gc = GCLock::new(&mut ctx); NodeRc::from_node( &gc, builder::StringLiteral::build_template( &gc, template::StringLiteral { metadata: Default::default(), value: juno::ast::NodeString { str: vec!['A' as u16, 0x1234u16, '\t' as u16], }, }, ), ) }; assert_eq!( do_gen(&mut ctx, &string, gen_js::Pretty::Yes).trim(), r#""A\u1234\t""#, ); test_roundtrip("1"); test_roundtrip("\"abc\""); test_roundtrip(r#" "\ud800" "#); test_roundtrip(r#" "\ud83d\udcd5" "#); test_roundtrip(r#" "\u060b" "#); test_roundtrip("true"); test_roundtrip("false"); test_roundtrip("null"); test_roundtrip("undefined"); test_roundtrip("/abc/"); test_roundtrip("/abc/gi"); test_roundtrip("/abc/gi"); test_roundtrip(r#"/ab\/cd/gi"#); test_roundtrip("/😹/"); test_roundtrip(r#" `abc` "#); test_roundtrip(r#" `abc\ndef` "#); test_roundtrip( r#" `abc def` "#, ); test_roundtrip(r#" `abc \ud800 def` "#); test_roundtrip(r#" `abc \ud800 def` "#); test_roundtrip(r#" `\ud83d\udcd5` "#); test_roundtrip(r#" `escape backtick: \` should work` "#); test_roundtrip(r#" `😹` "#); }
rust_cleaned_test_functions.jsonl/102587
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 784 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49643, 368, 341, 262, 1077, 5206, 5635, 284, 9608, 486, 931, 543, 262, 1077, 914, 284, 341, 286, 1077, 22122, 284, 479, 3140, 1176, 486, 931, 2099, 6984, 5635, 317, 286, 6018, 49, 66, 486, 149...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_my_queue() { let mut my_queue: MyQueue<i32> = MyQueue::new(); for i in 0..10 { my_queue.add(i); } for i in 0..10 { assert_eq!(my_queue.remove().unwrap(), i); } }
rust_cleaned_test_functions.jsonl/57837
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 146 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35686, 10841, 368, 341, 286, 1077, 5206, 847, 10841, 25, 3017, 7554, 21897, 18, 17, 29, 284, 3017, 7554, 486, 931, 543, 286, 369, 600, 304, 220, 15, 496, 16, 15, 341, 310, 847, 10841, 1364, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_from_uri_full_path() { let derivation_path = DerivationPath::from_absolute_path_str("m/44'/999'/1'").unwrap(); // test://path?full-path=m/44/999/1 let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("full-path=m/44/999/1")) .unwrap(); let uri = builder.build().unwrap(); assert_eq!( DerivationPath::from_uri(&uri, false).unwrap(), Some(derivation_path.clone()) ); // test://path?full-path=m/44'/999'/1' let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("full-path=m/44'/999'/1'")) .unwrap(); let uri = builder.build().unwrap(); assert_eq!( DerivationPath::from_uri(&uri, false).unwrap(), Some(derivation_path.clone()) ); // test://path?full-path=m/44\'/999\'/1\' let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("full-path=m/44\'/999\'/1\'")) .unwrap(); let uri = builder.build().unwrap(); assert_eq!( DerivationPath::from_uri(&uri, false).unwrap(), Some(derivation_path) ); // test://path?full-path=m let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("full-path=m")) .unwrap(); let uri = builder.build().unwrap(); assert_eq!( DerivationPath::from_uri(&uri, false).unwrap(), Some(DerivationPath(DerivationPathInner::from_str("m").unwrap())) ); let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("full-path=m/44/999/1")) .unwrap(); let uri = builder.build().unwrap(); assert!(matches!( DerivationPath::from_uri(&uri, true), Err(DerivationPathError::InvalidDerivationPath(_)) )); let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("key=0/0&full-path=m/44/999/1")) .unwrap(); let uri = builder.build().unwrap(); assert!(matches!( DerivationPath::from_uri(&uri, false), Err(DerivationPathError::InvalidDerivationPath(_)) )); let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("full-path=m/44/999/1&bad-key=0/0")) .unwrap(); let uri = builder.build().unwrap(); assert!(matches!( DerivationPath::from_uri(&uri, false), Err(DerivationPathError::InvalidDerivationPath(_)) )); // test://path?full-path=bad-value let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("full-path=bad-value")) .unwrap(); let uri = builder.build().unwrap(); assert!(matches!( DerivationPath::from_uri(&uri, false), Err(DerivationPathError::InvalidDerivationPath(_)) )); // test://path?full-path= let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("full-path=")) .unwrap(); let uri = builder.build().unwrap(); assert!(matches!( DerivationPath::from_uri(&uri, false), Err(DerivationPathError::InvalidDerivationPath(_)) )); // test://path?full-path let mut builder = URIReferenceBuilder::new(); builder .try_scheme(Some("test")) .unwrap() .try_authority(Some("path")) .unwrap() .try_path("") .unwrap() .try_query(Some("full-path")) .unwrap(); let uri = builder.build().unwrap(); assert!(matches!( DerivationPath::from_uri(&uri, false), Err(DerivationPathError::InvalidDerivationPath(_)) )); }
rust_cleaned_test_functions.jsonl/132680
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3013 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 15572, 16372, 2638, 368, 341, 286, 1077, 95254, 2638, 284, 12741, 39127, 1820, 486, 1499, 50874, 2638, 2895, 445, 76, 14, 19, 19, 20177, 24, 24, 24, 20177, 16, 6, 1827, 15454, 1428, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_generate() { let mut rng = thread_rng(); for _ in 1..1000 { let length = rng.gen_range(1, 20); let ns = luhn::generate(length); assert_eq!(ns.len(), length as usize); assert_eq!(luhn::checksum(&ns) % 10, 0); } }
rust_cleaned_test_functions.jsonl/91070
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 171 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48851, 368, 341, 286, 1077, 5206, 28422, 284, 4516, 66849, 543, 286, 369, 716, 304, 220, 16, 496, 16, 15, 15, 15, 341, 310, 1077, 3084, 284, 28422, 22822, 9698, 7, 16, 11, 220, 17, 15, 317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_build_dir_rel() { let mut collection = CollectionBuilder::default(); collection.source = Some(path::PathBuf::from("/")); collection.title = Some("title".to_owned()); collection.dir = Some("rel".to_owned()); let collection = collection.build().unwrap(); assert_eq!(collection.pages.subtree(), path::Path::new("/rel")); }
rust_cleaned_test_functions.jsonl/116418
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 156 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20801, 4334, 13557, 368, 341, 286, 1077, 5206, 4426, 284, 11101, 3297, 486, 2258, 543, 286, 4426, 14698, 284, 4329, 5581, 486, 1820, 15064, 486, 1499, 4283, 4010, 286, 4426, 6067, 284, 4329, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_constant() -> Result<()> { let module = crate::ir::module::IRModule::parse( "", r#" #[version = "0.0.5"] def @main() -> float32 { 0.01639530062675476f } "#, ) .unwrap(); let main = module .lookup(module.get_global_var("main").unwrap()) .unwrap(); let func = main.downcast::<crate::ir::relay::Function>().unwrap(); let constant = func .body .clone() .downcast::<crate::ir::relay::Constant>() .unwrap(); let tuple_type = constant .clone() .upcast::<Expr>() .checked_type .clone() .downcast::<crate::ir::ty::TensorType>() .unwrap(); // Test type assert_eq!(tuple_type.shape.len(), 0,); assert_eq!(tuple_type.dtype, "float32".parse().unwrap(),); // Check that actual data matches up with type assert_eq!(constant.data.dtype(), "float32".parse().unwrap(),); assert_eq!(constant.data.len(), 1); assert_eq!(constant.data.size(), 4); assert_eq!(constant.data.shape(), &[]); Ok(()) }
rust_cleaned_test_functions.jsonl/110962
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 634 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 34967, 368, 1464, 5714, 71698, 341, 286, 1077, 4688, 284, 17717, 486, 404, 486, 4352, 486, 2801, 3332, 486, 6400, 1006, 310, 8324, 310, 435, 2, 698, 13353, 4366, 284, 330, 15, 13, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_nth_from_latest() { let dir = tempdir().unwrap(); let paths = create_files(dir.path(), 3).unwrap(); let repo = LogRepository::new(dir.path()); assert_eq!(repo.nth_from_latest(0).unwrap().unwrap(), paths[0]); assert_eq!(repo.nth_from_latest(1).unwrap().unwrap(), paths[1]); assert_eq!(repo.nth_from_latest(2).unwrap().unwrap(), paths[2]); assert!(repo.nth_from_latest(3).unwrap().is_none()); assert!(repo.nth_from_latest(4).unwrap().is_none()); }
rust_cleaned_test_functions.jsonl/101112
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 254 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 78342, 5673, 64880, 368, 341, 286, 1077, 5419, 284, 2730, 3741, 1005, 15454, 543, 286, 1077, 12716, 284, 1855, 10931, 14161, 3875, 1507, 220, 18, 568, 15454, 543, 286, 1077, 15867, 284, 2835, 4624...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_arithmetic_overflow_int() { let tests = vec![ ( ScalarFuncSig::PlusInt, Datum::I64(i64::MAX), Datum::I64(i64::MAX), ), ( ScalarFuncSig::PlusInt, Datum::I64(i64::MIN), Datum::I64(i64::MIN), ), (ScalarFuncSig::PlusInt, Datum::I64(-2), Datum::U64(1)), (ScalarFuncSig::PlusInt, Datum::U64(1), Datum::I64(-2)), ( ScalarFuncSig::MinusInt, Datum::I64(i64::MIN), Datum::I64(i64::MAX), ), ( ScalarFuncSig::MinusInt, Datum::I64(i64::MAX), Datum::I64(i64::MIN), ), (ScalarFuncSig::MinusInt, Datum::I64(-1), Datum::U64(2)), (ScalarFuncSig::MinusInt, Datum::U64(1), Datum::I64(2)), ( ScalarFuncSig::MultiplyInt, Datum::I64(i64::MIN), Datum::I64(i64::MAX), ), ( ScalarFuncSig::MultiplyInt, Datum::U64(u64::MAX), Datum::I64(i64::MAX), ), ( ScalarFuncSig::MultiplyInt, Datum::I64(i64::MIN), Datum::U64(1), ), ( ScalarFuncSig::IntDivideInt, Datum::I64(i64::MIN), Datum::I64(-1), ), (ScalarFuncSig::IntDivideInt, Datum::I64(-1), Datum::U64(1)), (ScalarFuncSig::IntDivideInt, Datum::I64(-2), Datum::U64(1)), (ScalarFuncSig::IntDivideInt, Datum::U64(1), Datum::I64(-1)), (ScalarFuncSig::IntDivideInt, Datum::U64(2), Datum::I64(-1)), ( ScalarFuncSig::IntDivideDecimal, Datum::Dec(Decimal::from(i64::MIN)), Datum::Dec(Decimal::from(-1)), ), ( ScalarFuncSig::IntDivideDecimal, Datum::Dec(Decimal::from(i64::MAX)), str2dec("0.1"), ), ]; let mut ctx = EvalContext::default(); for tt in tests { let lhs = datum_expr(tt.1); let rhs = datum_expr(tt.2); let lus = lhs .get_field_type() .as_accessor() .flag() .contains(FieldTypeFlag::UNSIGNED); let rus = rhs .get_field_type() .as_accessor() .flag() .contains(FieldTypeFlag::UNSIGNED); let unsigned = lus | rus; let mut op = Expression::build(&mut ctx, scalar_func_expr(tt.0, &[lhs, rhs])).unwrap(); if unsigned { op.mut_field_type() .as_mut_accessor() .set_flag(FieldTypeFlag::UNSIGNED); } let got = op.eval(&mut ctx, &[]).unwrap_err(); assert!(check_overflow(got).is_ok()); } }
rust_cleaned_test_functions.jsonl/82067
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2023 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25842, 25922, 79073, 4042, 368, 341, 286, 1077, 7032, 284, 7486, 90515, 310, 2399, 394, 35176, 9626, 47246, 486, 21807, 1072, 345, 394, 68459, 486, 40, 21, 19, 1956, 21, 19, 486, 10586, 1326, 39...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_1() { assert_eq!( parse_column_extra(&mut Parser::new("DEFAULT_GENERATED")), ColumnExtra { auto_increment: false, on_update_current_timestamp: false, generated: false, default_generated: true, } ); }
rust_cleaned_test_functions.jsonl/73828
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 196 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 16, 368, 341, 286, 2060, 10714, 33673, 310, 4715, 8744, 31858, 2099, 6984, 21102, 486, 931, 445, 17285, 18693, 9005, 30154, 310, 9332, 11612, 341, 394, 3233, 51482, 25, 895, 345, 394, 389, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_generation_with_single_char() { let seed = generate_key::<sr25519::Pair>("ab", Default::default()).unwrap(); assert!( sr25519::Pair::from_seed_slice(&hex::decode(&seed[2..]).unwrap()) .unwrap() .public() .to_ss58check() .contains("ab") ); }
rust_cleaned_test_functions.jsonl/47849
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 135 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 64191, 6615, 19487, 9232, 368, 341, 197, 10217, 10320, 284, 6923, 3097, 27638, 15094, 17, 20, 20, 16, 24, 486, 12443, 13211, 370, 497, 7899, 486, 2258, 6011, 15454, 543, 197, 6948, 33673, 298, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ascii_vec() { let test = &[40u8, 32u8, 59u8]; let b: &[_] = v2ascii!([40, 32, 59]); assert_eq!(test.to_ascii(), b); assert_eq!("( ;".to_ascii(), b); let v = vec![40u8, 32u8, 59u8]; assert_eq!(v.as_slice().to_ascii(), b); assert_eq!("( ;".to_string().as_slice().to_ascii(), b); assert_eq!("abCDef&?#".to_ascii().to_lowercase().into_string(), "abcdef&?#".to_string()); assert_eq!("abCDef&?#".to_ascii().to_uppercase().into_string(), "ABCDEF&?#".to_string()); assert_eq!("".to_ascii().to_lowercase().into_string(), "".to_string()); assert_eq!("YMCA".to_ascii().to_lowercase().into_string(), "ymca".to_string()); let mixed = "abcDEFxyz:.;".to_ascii(); assert_eq!(mixed.to_uppercase().into_string(), "ABCDEFXYZ:.;".to_string()); assert!("aBcDeF&?#".to_ascii().eq_ignore_case("AbCdEf&?#".to_ascii())); assert!("".is_ascii()); assert!("a".is_ascii()); assert!(!"\u2009".is_ascii()); }
rust_cleaned_test_functions.jsonl/21825
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 550 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 50238, 13251, 368, 341, 286, 1077, 1273, 284, 44590, 19, 15, 84, 23, 11, 220, 18, 17, 84, 23, 11, 220, 20, 24, 84, 23, 935, 286, 1077, 293, 25, 609, 13496, 60, 284, 348, 17, 23324, 0, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_commit_hook() -> Result<()> { let db = Connection::open_in_memory()?; static CALLED: AtomicBool = AtomicBool::new(false); db.commit_hook(Some(|| { CALLED.store(true, Ordering::Relaxed); false })); db.execute_batch("BEGIN; CREATE TABLE foo (t TEXT); COMMIT;")?; assert!(CALLED.load(Ordering::Relaxed)); Ok(()) }
rust_cleaned_test_functions.jsonl/132858
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 207 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36346, 32005, 368, 1464, 5714, 71698, 341, 286, 1077, 2927, 284, 11032, 486, 2508, 1243, 19195, 368, 69493, 286, 1099, 32907, 13639, 25, 30316, 11233, 284, 30316, 11233, 486, 931, 3576, 317, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_inode_headers() { let mut header = PointersOffsetsHeader::default(); for index in 0..32 { header.set(index, RelativeOffsetLength::OneByte); assert_eq!(header.get(index), RelativeOffsetLength::OneByte); header.clear(index); header.set(index, RelativeOffsetLength::TwoBytes); assert_eq!(header.get(index), RelativeOffsetLength::TwoBytes); header.clear(index); header.set(index, RelativeOffsetLength::FourBytes); assert_eq!(header.get(index), RelativeOffsetLength::FourBytes); header.clear(index); header.set(index, RelativeOffsetLength::EightBytes); assert_eq!(header.get(index), RelativeOffsetLength::EightBytes); } }
rust_cleaned_test_functions.jsonl/80243
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 343 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 46748, 26719, 368, 341, 286, 1077, 5206, 4247, 284, 5126, 388, 81095, 4047, 486, 2258, 1428, 286, 369, 1922, 304, 220, 15, 496, 18, 17, 341, 310, 4247, 980, 7195, 11, 39402, 6446, 4373, 486, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_activation_condition() { let spec = "input a: Int32\ninput b: Int32\noutput x @(a || b) := 1"; let type_table = type_check(spec); // node ids can be verified using `rtlola-analyze spec.lola ast` // input `a` has NodeId = 1 let a_id = NodeId::new(1); // input `b` has NodeId = 3 let b_id = NodeId::new(3); // output `x` has NodeId = 14 let x_id = NodeId::new(14); assert_eq!(type_table.get_value_type(x_id), &ValueTy::Int(IntTy::I64)); assert_eq!( type_table.get_stream_type(x_id), &StreamTy::Event(Activation::Disjunction(vec![Activation::Stream(a_id), Activation::Stream(b_id)])) ); }
rust_cleaned_test_functions.jsonl/110718
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 357 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 52404, 27656, 368, 341, 286, 1077, 1398, 284, 330, 1355, 264, 25, 1333, 18, 17, 1699, 1355, 293, 25, 1333, 18, 17, 1699, 3006, 856, 42181, 64, 1369, 293, 8, 1669, 220, 16, 876, 286, 1077, 94...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_if() { let code = String::from(" if false { var x: int = 0; x += 2; } "); let parser = Parser::new(code.clone()); let mut lexer = Token::lexer(code.as_str()); let stmt_res = parser.parse_if(&mut lexer); assert!(stmt_res.is_ok()); println!("{:?}", stmt_res.unwrap()); }
rust_cleaned_test_functions.jsonl/43216
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 185 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 11119, 368, 341, 262, 1077, 2038, 284, 923, 486, 1499, 70576, 286, 421, 895, 341, 310, 762, 856, 25, 526, 284, 220, 15, 280, 310, 856, 1421, 220, 17, 280, 286, 456, 262, 39887, 262, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_single_row_insert_default_values() { let query = Insert::single_into("users"); let (sql, params) = Postgres::build(query).unwrap(); assert_eq!("INSERT INTO \"users\" DEFAULT VALUES", sql); assert_eq!(default_params(vec![]), params); }
rust_cleaned_test_functions.jsonl/6441
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 123 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19487, 8530, 17678, 9993, 9146, 368, 341, 286, 1077, 3239, 284, 17101, 486, 15338, 45514, 445, 4218, 797, 286, 1077, 320, 3544, 11, 3628, 8, 284, 3877, 17818, 486, 5834, 10741, 568, 15454, 1428, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_normalize_col() { for (value, expected) in &[ ("", ""), ("abc", "abc"), ("abc (123)", "abc"), ("2/6/2000", "c_2_6_2000"), ("COMBO#", "combo"), ] { assert_eq!(&&normalize_col(value), expected); } }
rust_cleaned_test_functions.jsonl/55330
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 191 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 80807, 10211, 368, 341, 286, 369, 320, 957, 11, 3601, 8, 304, 609, 9640, 310, 3489, 497, 72712, 310, 3489, 13683, 497, 330, 13683, 4461, 310, 3489, 13683, 320, 16, 17, 18, 11583, 330, 13683, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_app_with_three_single_required_arguments() { let app_definition = AppDefBuilder::new("food_delivery".to_string()) .add_argument( ArgumentDef::new_single_value("main".to_string()) .required(true) .build() .unwrap() .into() ) .add_argument( ArgumentDef::new_single_value("drink".to_string()) .required(true) .build() .unwrap() .into() ) .add_argument( ArgumentDef::new_single_value("side".to_string()) .required(true) .build() .unwrap() .into() ) .build() .unwrap(); let app = app_definition.parse_args(&[]); assert_eq!(app.is_ok(), false); let app = app_definition.parse_args(&["pizza"]); assert_eq!(app.is_ok(), false); let app = app_definition.parse_args(&["pizza", "orange juice"]); assert_eq!(app.is_ok(), false); let app = app_definition.parse_args(&["pizza", "orange juice", "coleslaw"]).unwrap(); assert_eq!(app.single_value_arguments.get("main"), Some(&"pizza".to_string())); assert_eq!(app.single_value_arguments.get("drink"), Some(&"orange juice".to_string())); assert_eq!(app.single_value_arguments.get("side"), Some(&"coleslaw".to_string())); let app = app_definition.parse_args(&["pizza", "orange juice", "coleslaw", "salt"]); assert_eq!(app.is_ok(), false); }
rust_cleaned_test_functions.jsonl/90601
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 818 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8191, 6615, 50016, 19487, 18743, 43433, 368, 341, 262, 1077, 906, 31698, 284, 1845, 2620, 3297, 486, 931, 445, 13915, 50562, 3263, 983, 3904, 2398, 286, 659, 718, 9025, 1006, 394, 13818, 2620, 486...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_chunks_exact_zip() { let v1: &[i32] = &[0, 1, 2, 3, 4]; let v2: &[i32] = &[6, 7, 8, 9, 10]; let res = v1 .chunks_exact(2) .zip(v2.chunks_exact(2)) .map(|(a, b)| a.iter().sum::<i32>() + b.iter().sum::<i32>()) .collect::<Vec<_>>(); assert_eq!(res, vec![14, 22]); }
rust_cleaned_test_functions.jsonl/9635
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 201 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 65470, 71084, 42131, 368, 341, 262, 1077, 348, 16, 25, 44590, 72, 18, 17, 60, 284, 44590, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 935, 262, 1077, 348, 17, 25, 44590, 72, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_through() { let mut scope = Scope::new(""); let scope = scope.through(vec![String::from("one"), String::from("two")]); assert_eq!(scope.pipes, vec!["one", "two"]); }
rust_cleaned_test_functions.jsonl/98971
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 97 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 87399, 368, 341, 286, 1077, 5206, 6891, 284, 34920, 486, 931, 13056, 286, 1077, 6891, 284, 6891, 13677, 1432, 25592, 20703, 703, 486, 1499, 445, 603, 3975, 923, 486, 1499, 445, 19789, 899, 10149, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_triangle() { // Triangle counter clock-wise. let tri_1 = [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0]]; // Triangle clock-wise. let tri_2 = [[0.0, 0.0], [1.0, 1.0], [1.0, 0.0]]; let (x, y) = (0.5, 0.25); assert!(inside_triangle(tri_1, [x, y])); assert!(inside_triangle(tri_2, [x, y])); assert_eq!(triangle_face(tri_1), false); assert!(triangle_face(tri_2)); }
rust_cleaned_test_functions.jsonl/85586
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 254 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 70575, 368, 341, 286, 442, 38031, 5546, 8866, 44439, 624, 286, 1077, 2406, 62, 16, 284, 4318, 15, 13, 15, 11, 220, 15, 13, 15, 1125, 508, 16, 13, 15, 11, 220, 15, 13, 15, 1125, 508, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_type_required_boolean() { let schemaReplicant = SchemaReplicant::default(); let causetq = r#"[:find ?x :where [?x _ ?e] [(type ?e :edb.type/boolean)]]"#; let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq); assert_eq!(allegrosql, "SELECT DISTINCT `Causets00`.e AS `?x` \ FROM `causets` AS `Causets00` \ WHERE (`Causets00`.value_type_tag = 1)"); assert_eq!(args, vec![]); }
rust_cleaned_test_functions.jsonl/90703
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 235 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1819, 18743, 46642, 368, 341, 262, 1077, 10802, 18327, 35237, 284, 12539, 18327, 35237, 486, 2258, 1428, 262, 1077, 2162, 18187, 80, 284, 435, 55543, 3447, 3903, 937, 87, 549, 2870, 508, 30, 87, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_subfield_code() { assert_eq!(parse_subfield_code(b"0").unwrap().1, '0'); assert_eq!(parse_subfield_code(b"a").unwrap().1, 'a'); assert_eq!(parse_subfield_code(b"Z").unwrap().1, 'Z'); assert_eq!(parse_subfield_code(b"!").is_err(), true); }
rust_cleaned_test_functions.jsonl/101490
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 153 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 5228, 2566, 4136, 368, 341, 286, 2060, 10714, 10297, 6400, 5228, 2566, 4136, 1883, 1, 15, 1827, 15454, 1005, 16, 11, 364, 15, 1157, 286, 2060, 10714, 10297, 6400, 5228, 2566, 4136, 1883, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_verify_ref() { use crate::bytes::complete::take; let mut parser1 = verify(take(3u8), |s: &[u8]| s == &b"abc"[..]); assert_eq!(parser1(&b"abcd"[..]), Ok((&b"d"[..], &b"abc"[..]))); assert_eq!( parser1(&b"defg"[..]), Err(Err::Error((&b"defg"[..], ErrorKind::Verify))) ); fn parser2(i: &[u8]) -> IResult<&[u8], u32> { verify(crate::number::streaming::be_u32, |val: &u32| *val < 3)(i) } }
rust_cleaned_test_functions.jsonl/120443
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 233 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35638, 7793, 368, 341, 262, 990, 17717, 486, 9651, 486, 14737, 486, 22769, 401, 262, 1077, 5206, 6729, 16, 284, 10146, 1155, 726, 7, 18, 84, 23, 701, 760, 82, 25, 44590, 84, 23, 29685, 274, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_small_buffer() -> anyhow::Result<()> { let root = Box::new(Echo::<Msg>::new(false)); let mut console = test_console(root); let msg_count = MINIMUM_EMIT + 5; console.emit(vec![vec!["line 1"].try_into()?; msg_count]); let msg = Msg(vec![vec!["line"].try_into()?; msg_count]); let state = crate::state![&msg]; let mut buffer = Vec::new(); // even though the canvas is larger than the tty console.render_general( &mut buffer, &state, DrawMode::Normal, Dimensions::new(100, 2), )?; // we should still drain a minimum of 5 messages. assert_eq!(console.to_emit.len(), msg_count - MINIMUM_EMIT); Ok(()) }
rust_cleaned_test_functions.jsonl/122135
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 374 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31966, 7776, 368, 1464, 88964, 486, 2077, 71698, 341, 286, 1077, 3704, 284, 8261, 486, 931, 10722, 958, 27638, 6611, 6831, 931, 3576, 1106, 286, 1077, 5206, 2339, 284, 1273, 51724, 9206, 317, 286,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_add_i32_i64() { binary_cast_test( DataType::Int32, DataType::Int64, "CAST(#0 AS Int64) Plus #1", ); binary_cast_test( DataType::Int64, DataType::Int32, "#0 Plus CAST(#1 AS Int64)", ); }
rust_cleaned_test_functions.jsonl/16557
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 195 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 5318, 18, 17, 5318, 21, 19, 368, 341, 286, 7868, 5303, 4452, 1006, 310, 33172, 486, 1072, 18, 17, 345, 310, 33172, 486, 1072, 21, 19, 345, 310, 330, 34163, 32735, 15, 5752, 1333, 21, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_predicate() { let mut reader = Reader::init("not equals true"); assert_eq!( predicate(&mut reader).unwrap(), Predicate { not: true, space0: Whitespace { value: String::from(" "), source_info: SourceInfo::init(1, 4, 1, 5), }, predicate_func: PredicateFunc { source_info: SourceInfo::init(1, 5, 1, 16), value: PredicateFuncValue::Equal { space0: Whitespace { value: String::from(" "), source_info: SourceInfo::init(1, 11, 1, 12), }, value: PredicateValue::Bool(true), operator: false }, }, } ); }
rust_cleaned_test_functions.jsonl/51178
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 566 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 97474, 368, 341, 286, 1077, 5206, 6604, 284, 25166, 486, 2327, 445, 1921, 16819, 830, 797, 286, 2060, 10714, 33673, 310, 24283, 2099, 6984, 6604, 568, 15454, 3148, 310, 49827, 341, 394, 537, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_preboot_config_boot_src() { let req = VmmAction::ConfigureBootSource(BootSourceConfig::default()); check_preboot_request(req, |result, vm_res| { assert_eq!(result, Ok(VmmData::Empty)); assert!(vm_res.boot_cfg_set) }); let req = VmmAction::ConfigureBootSource(BootSourceConfig::default()); check_preboot_request_err( req, VmmActionError::BootSource(BootSourceConfigError::InvalidKernelCommandLine( String::new(), )), ); }
rust_cleaned_test_functions.jsonl/44526
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 272 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10442, 4619, 5332, 52062, 16274, 368, 341, 286, 1077, 4232, 284, 647, 3821, 2512, 486, 28560, 17919, 3608, 7, 17919, 3608, 2648, 486, 2258, 1423, 286, 1779, 10442, 4619, 7893, 6881, 11, 760, 1382,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_2() { let inp = "dc-end HN-start start-kj dc-start dc-HN LN-dc HN-end kj-sa kj-HN kj-dc"; let parsed = input_generator(inp); assert_eq!(solve_part1(&parsed), 19); }
rust_cleaned_test_functions.jsonl/115635
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 124 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 17, 368, 341, 286, 1077, 32344, 284, 330, 7628, 13068, 198, 43165, 18935, 198, 2468, 12646, 73, 198, 7628, 18935, 198, 7628, 11278, 45, 198, 50216, 1737, 66, 198, 43165, 13068, 198, 92697, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_temporal_array_date64_hour() { let a: PrimitiveArray<Date64Type> = vec![Some(1514764800000), None, Some(1550636625000)].into(); let b = hour(&a).unwrap(); assert_eq!(0, b.value(0)); assert!(!b.is_valid(1)); assert_eq!(4, b.value(2)); }
rust_cleaned_test_functions.jsonl/128625
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 165 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11771, 9819, 3858, 4164, 21, 19, 32292, 368, 341, 286, 1077, 264, 25, 51460, 1857, 98879, 21, 19, 929, 29, 4035, 310, 7486, 20703, 8373, 7, 16, 20, 16, 19, 22, 21, 19, 23, 15, 15, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_str_with_nanosecond_timestamp() { let input = r#"{ "time" : "2021-04-30T17:03:14.123456789+02:00", "temperature" : 25 }"#; let output = ThinEdgeJson::from_str(input).unwrap(); assert_eq!( output.timestamp, Some( FixedOffset::east(2 * 3600) .ymd(2021, 4, 30) .and_hms_nano(17, 3, 14, 123456789) ) ); }
rust_cleaned_test_functions.jsonl/117068
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 303 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2895, 6615, 73936, 960, 1297, 23073, 368, 341, 286, 1077, 1946, 284, 435, 55543, 515, 310, 330, 1678, 1, 549, 330, 17, 15, 17, 16, 12, 15, 19, 12, 18, 15, 51, 16, 22, 25, 15, 18, 25, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_async_class() { // TODO: test the other fields let data = "stopped"; let result = OutputClass::Stopped; assert_eq!(async_class(data).unwrap(), ("", result)); let data = "whatever"; let result = OutputClass::Unknown; assert_eq!(async_class(data).unwrap(), ("", result)) }
rust_cleaned_test_functions.jsonl/74243
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 157 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28346, 4790, 368, 341, 286, 442, 5343, 25, 1273, 279, 1008, 5043, 198, 286, 1077, 821, 284, 330, 89863, 876, 286, 1077, 1102, 284, 9258, 1957, 486, 59803, 280, 286, 2060, 10714, 10297, 7692, 479...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_read_write_padded() { let len = 1016; // Use a multiple of 254. let data = vec![255u8; len]; let mut padded = Vec::new(); let mut reader = crate::pad_reader::PadReader::new(io::Cursor::new(&data)); reader.read_to_end(&mut padded).unwrap(); assert_eq!( padded.len(), FR32_PADDING_MAP.transform_byte_offset(len, true) ); let mut unpadded = Vec::new(); let unpadded_written = write_unpadded(&padded, &mut unpadded, 0, len).unwrap(); assert_eq!(unpadded_written, len); assert_eq!(data, unpadded); assert_eq!(padded.into_boxed_slice(), bit_vec_padding(data)); }
rust_cleaned_test_functions.jsonl/125282
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 329 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 9165, 620, 16828, 368, 341, 286, 1077, 2422, 284, 220, 16, 15, 16, 21, 26, 442, 5443, 264, 5248, 315, 220, 17, 20, 19, 624, 286, 1077, 821, 284, 7486, 20703, 17, 20, 20, 84, 23, 26, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_intfastfield_null_amplitude() -> crate::Result<()> { let path = Path::new("test"); let directory: RAMDirectory = RAMDirectory::create(); { let write: WritePtr = directory.open_write(Path::new("test")).unwrap(); let mut serializer = FastFieldSerializer::from_write(write).unwrap(); let mut fast_field_writers = FastFieldsWriter::from_schema(&SCHEMA); for _ in 0..10_000 { fast_field_writers.add_document(&doc!(*FIELD=>100_000u64)); } fast_field_writers .serialize(&mut serializer, &HashMap::new()) .unwrap(); serializer.close().unwrap(); } let file = directory.open_read(&path).unwrap(); assert_eq!(file.len(), 34 as usize); { let fast_fields_composite = CompositeFile::open(&file).unwrap(); let data = fast_fields_composite.open_read(*FIELD).unwrap(); let fast_field_reader = FastFieldReader::<u64>::open(data)?; for doc in 0..10_000 { assert_eq!(fast_field_reader.get(doc), 100_000u64); } } Ok(()) }
rust_cleaned_test_functions.jsonl/5518
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 588 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4042, 9349, 2566, 15162, 22880, 30050, 368, 1464, 17717, 486, 2077, 71698, 341, 286, 1077, 1815, 284, 7933, 486, 931, 445, 1944, 797, 286, 1077, 6220, 25, 22038, 9310, 284, 22038, 9310, 486, 3182,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_xor() { let mut data = Vec::from("Hello World".as_bytes()); let key = EncryptionKey::new("0xdeadbeef", XOR_KEY_LEN).unwrap(); xor(data.as_mut_slice(), &key); xor(data.as_mut_slice(), &key); assert_eq!(data, b"Hello World"); }
rust_cleaned_test_functions.jsonl/38146
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 144 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 76462, 368, 341, 286, 1077, 5206, 821, 284, 11312, 486, 1499, 445, 9707, 4337, 3263, 300, 12524, 1423, 286, 1077, 1376, 284, 62055, 1592, 486, 931, 445, 15, 87, 33754, 1371, 823, 497, 69887, 660...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_comparisons() -> TestResult { let p = polar(); p.load_str("lt(x, y) if x < y;")?; qnull(&p, "lt(1,1)"); qeval(&p, "lt(1,2)"); qnull(&p, "lt(2,1)"); qnull(&p, "lt(+1,-1)"); qeval(&p, "lt(-1,+1)"); qnull(&p, "lt(-1,-1)"); qeval(&p, "lt(-2,-1)"); qeval(&p, "lt(1019,1e19)"); qnull(&p, "lt(1e19,1019)"); qnull(&p, "lt(9007199254740992,9007199254740992)"); // identical qnull(&p, "lt(9007199254740992,9007199254740992.0)"); // equal qnull(&p, "lt(9007199254740992,9007199254740993.0)"); // indistinguishable qeval(&p, "lt(9007199254740992,9007199254740994.0)"); // distinguishable qeval(&p, "lt(\"aa\",\"ab\")"); qnull(&p, "lt(\"aa\",\"aa\")"); p.clear_rules(); p.load_str("leq(x, y) if x <= y;")?; qeval(&p, "leq(1,1)"); qeval(&p, "leq(1,2)"); qnull(&p, "leq(2,1)"); qnull(&p, "leq(+1,-1)"); qeval(&p, "leq(-1,+1)"); qeval(&p, "leq(-1,-1)"); qeval(&p, "leq(-2,-1)"); qeval(&p, "leq(\"aa\",\"aa\")"); qeval(&p, "leq(\"aa\",\"ab\")"); qnull(&p, "leq(\"ab\",\"aa\")"); p.clear_rules(); p.load_str("gt(x, y) if x > y;")?; qnull(&p, "gt(1,1)"); qnull(&p, "gt(1,2)"); qeval(&p, "gt(2,1)"); qeval(&p, "gt(+1,-1)"); qnull(&p, "gt(-1,+1)"); qnull(&p, "gt(-1,-1)"); qeval(&p, "gt(-1,-2)"); qeval(&p, "gt(\"ab\",\"aa\")"); qnull(&p, "gt(\"aa\",\"aa\")"); p.clear_rules(); p.load_str("geq(x, y) if x >= y;")?; qeval(&p, "geq(1,1)"); qnull(&p, "geq(1,2)"); qeval(&p, "geq(2,1)"); qeval(&p, "geq(2,1)"); qeval(&p, "geq(+1,-1)"); qnull(&p, "geq(-1,+1)"); qeval(&p, "geq(-1,-1)"); qeval(&p, "geq(-1,-1.0)"); qeval(&p, "geq(\"ab\",\"aa\")"); qeval(&p, "geq(\"aa\",\"aa\")"); p.clear_rules(); p.load_str("eq(x, y) if x == y;")?; qeval(&p, "eq(1,1)"); qnull(&p, "eq(1,2)"); qnull(&p, "eq(2,1)"); qnull(&p, "eq(-1,+1)"); qeval(&p, "eq(-1,-1)"); qeval(&p, "eq(-1,-1.0)"); qnull(&p, "eq(1019,1e19)"); qnull(&p, "eq(1e19,1019)"); qeval(&p, "eq(9007199254740992,9007199254740992)"); // identical qeval(&p, "eq(9007199254740992,9007199254740992.0)"); // equal qeval(&p, "eq(9007199254740992,9007199254740993.0)"); // indistinguishable qnull(&p, "eq(9007199254740992,9007199254740994.0)"); // distinguishable qeval(&p, "eq(\"aa\", \"aa\")"); qnull(&p, "eq(\"ab\", \"aa\")"); qeval(&p, "eq(bob, bob)"); p.clear_rules(); p.load_str("neq(x, y) if x != y;")?; qnull(&p, "neq(1,1)"); qeval(&p, "neq(1,2)"); qeval(&p, "neq(2,1)"); qeval(&p, "neq(-1,+1)"); qnull(&p, "neq(-1,-1)"); qnull(&p, "neq(-1,-1.0)"); qnull(&p, "neq(\"aa\", \"aa\")"); qeval(&p, "neq(\"ab\", \"aa\")"); qeval(&p, "1.0 == 1"); qeval(&p, "0.99 < 1"); qeval(&p, "1.0 <= 1"); qeval(&p, "1 == 1"); qeval(&p, "0.0 == 0"); qeval(&p, "x == y and x = 1 and y = 1"); qnull(&p, "x == y and x = 1 and y = 2"); Ok(()) }
rust_cleaned_test_functions.jsonl/68121
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1750 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2965, 1732, 19379, 368, 1464, 3393, 2077, 341, 262, 1077, 281, 284, 24660, 1428, 1066, 262, 281, 5104, 2895, 445, 4832, 2075, 11, 379, 8, 421, 856, 366, 379, 26, 899, 37445, 262, 2804, 2921, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
#[test] fn test_parse_swift_version_without_org_name() { let input = "Swift version 5.3-dev (LLVM ..., Swift ...)"; assert_eq!(parse_swift_version(input), Some(String::from("v5.3-dev"))); }
rust_cleaned_test_functions.jsonl/36705
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 98 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 32581, 2085, 9438, 39904, 35583, 1269, 368, 341, 286, 1077, 1946, 284, 330, 55336, 2319, 220, 20, 13, 18, 25758, 320, 4086, 11187, 60353, 23670, 2503, 24023, 286, 2060, 10714, 10297, 6400, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_hex_literal1() { let s = to_chars("hex\"DEADBEEF\""); let cur = &mut 0; expect_next_token(&s, cur, to_hex_literal("hex\"DEADBEEF\"")); }
rust_cleaned_test_functions.jsonl/21059
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32655, 34100, 16, 368, 341, 286, 1077, 274, 284, 311, 37418, 445, 17308, 2105, 1150, 94373, 7099, 37, 88385, 286, 1077, 2847, 284, 609, 6984, 220, 15, 280, 286, 1720, 11257, 6458, 2099, 82, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_update_push_request_reblog() { let mut req = UpdatePushRequest::new("some-id"); req.reblog(true); assert_eq!( req, UpdatePushRequest { id: "some-id".to_string(), follow: None, favourite: None, reblog: Some(true), mention: None, } ); }
rust_cleaned_test_functions.jsonl/116582
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 241 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 14218, 7893, 1288, 11659, 368, 341, 286, 1077, 5206, 4232, 284, 5549, 16644, 1900, 486, 931, 445, 14689, 12897, 797, 286, 4232, 1327, 11659, 3715, 317, 286, 2060, 10714, 33673, 310, 4232, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_numbers() { let tests = vec![ ("[1]", KrasValue::Num(OrdF64(1.0, "1".to_string()))), ("[123]", KrasValue::Num(OrdF64(123.0, "123".to_string()))), ("[0.123]", KrasValue::Num(OrdF64(0.123, "0.123".to_string()))), ("[0x1]", KrasValue::Num(OrdF64(1.0, "0x1".to_string()))), ("[0xdeadbeef]", KrasValue::Num(OrdF64(3735928559.0, "0xdeadbeef".to_string()))), ("[0x7f1bcd0b0d40]", KrasValue::Num(OrdF64(139757380898112.0, "0x7f1bcd0b0d40".to_string()))), ]; for (input, expected) in tests { check_single_value_with(&input, &expected, |a, b| { if let KrasValue::Num(OrdF64(fa, sa)) = a { let radix = if sa.len() >= 2 && sa.chars().skip(2).next().unwrap() == 'x' { 16 } else { 10 }; if radix == 16 { assert_eq!(u64::from_str_radix(&sa, radix).unwrap() as f64, *fa); } if let KrasValue::Num(OrdF64(fb, sb)) = b { return fa == fb && sa == sb } } assert!(false, "invalid types: {:?} {:?}", a, b); false }); } }
rust_cleaned_test_functions.jsonl/30667
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 869 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32964, 368, 341, 286, 1077, 7032, 284, 7486, 90515, 310, 3489, 58, 16, 19076, 730, 12784, 1130, 486, 4651, 7, 24621, 37, 21, 19, 7, 16, 13, 15, 11, 330, 16, 3263, 983, 3904, 10131, 1326, 310...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
#[test] fn test_part1() { assert_eq!( ProgramMachine::new(vec![1002, 4, 3, 4, 33], vec![]).run(), vec!() ); }
rust_cleaned_test_functions.jsonl/109134
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 97 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10495, 16, 368, 341, 286, 2060, 10714, 33673, 310, 6687, 21605, 486, 931, 25592, 20703, 16, 15, 15, 17, 11, 220, 19, 11, 220, 18, 11, 220, 19, 11, 220, 18, 18, 1125, 7486, 0, 1294, 568, 61...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_arp_table_dynamic_after_static_should_not_set_timer() { // entry for the same address will not cause a timer to be scheduled. let mut ctx = DummyContext::default(); insert_static_neighbor(&mut ctx, (), TEST_REMOTE_IPV4, TEST_REMOTE_MAC); assert_eq!(ctx.timers().len(), 0); insert_dynamic(&mut ctx, (), TEST_REMOTE_IPV4, TEST_REMOTE_MAC); assert_eq!(ctx.timers().len(), 0); }
rust_cleaned_test_functions.jsonl/17008
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 205 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 7876, 5237, 45992, 19844, 25360, 43378, 7913, 2602, 16255, 368, 341, 1789, 286, 442, 4343, 369, 279, 1852, 2621, 686, 537, 5240, 264, 9021, 311, 387, 13537, 624, 286, 1077, 5206, 5635, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_deck_calculate_score() { let deck = Deck::from_input("3 2 10 6 8 5 9 4 7 1"); assert_eq!(deck.calculate_score(), 306); }
rust_cleaned_test_functions.jsonl/25650
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 68 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 83860, 24005, 11207, 10405, 368, 341, 262, 1077, 9530, 284, 28416, 486, 1499, 5898, 445, 18, 220, 17, 220, 16, 15, 220, 21, 220, 23, 220, 20, 220, 24, 220, 19, 220, 22, 220, 16, 797, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_sekien_16k_chunks_streaming() { let filepath = "test/fixtures/SekienAkashita.jpg"; let read_result = fs::read(filepath); assert!(read_result.is_ok()); let contents = read_result.unwrap(); let chunk_offsets = [0, 22366, 30648, 46951, 65647, 98415]; let chunk_sizes = [22366, 8282, 16303, 18696, 32768, 11051]; // The size of the buffer that we will be using for streaming the // content. It should be greater than or equal to the upper bound on the // chunk size. const BUF_SIZE: usize = 32768; // Get the size of the file to detect when we have reached the last // block of data to be processed by the chunker. let attr = fs::metadata(filepath).unwrap(); let file_size = attr.len(); let mut file_pos = 0; let mut chunk_index = 0; // We expect to encounter the chunks in the following groups based on // the buffer size we selected. for group_size in &[2, 1, 1, 1, 1] { let upper_bound = file_pos + BUF_SIZE; let (eof, slice) = if upper_bound >= file_size as usize { (true, &contents[file_pos..]) } else { (false, &contents[file_pos..upper_bound]) }; let chunker = FastCDC::with_eof(slice, 8192, 16384, 32768, eof); let results: Vec<Chunk> = chunker.collect(); assert_eq!(results.len(), *group_size); for idx in 0..*group_size { assert_eq!(results[idx].offset + file_pos, chunk_offsets[chunk_index]); assert_eq!(results[idx].length, chunk_sizes[chunk_index]); chunk_index += 1; } // advance the file pointer after using it for comparing offsets for result in results { file_pos += result.length; } } // assert that we processed every byte of the file assert_eq!(file_pos as u64, file_size); }
rust_cleaned_test_functions.jsonl/32059
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 958 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3453, 74, 3591, 62, 16, 21, 74, 65470, 12673, 287, 368, 341, 286, 1077, 26054, 284, 330, 1944, 94275, 11374, 1225, 3591, 55802, 988, 6255, 4819, 876, 286, 1077, 1349, 5287, 284, 8619, 486, 878, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_as_str() { assert_eq!(TokenFiltersType::Stem.as_ref(), "TokenFilterStem"); assert_eq!(TokenFiltersType::ExtTokenFiltersType("AddedFilter".to_owned()).as_ref(), "AddedFilter"); }
rust_cleaned_test_functions.jsonl/59426
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 114 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11898, 2895, 368, 341, 286, 2060, 10714, 10297, 3323, 28351, 929, 486, 623, 336, 5357, 7793, 1507, 330, 3323, 5632, 623, 336, 797, 286, 2060, 10714, 10297, 3323, 28351, 929, 486, 6756, 3323, 28351...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_exec_str() { let lua = Lua::new(); assert_eq!(lua.exec_str(" a = 25 "), ::status::LuaOk); assert_eq!(lua.get_global("a"), Some(25)); }
rust_cleaned_test_functions.jsonl/13031
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 119 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18430, 2895, 741, 262, 341, 286, 1077, 20357, 284, 37662, 486, 931, 543, 286, 2060, 10714, 10297, 27623, 15776, 2895, 70576, 310, 264, 284, 220, 17, 20, 198, 286, 59312, 3504, 2829, 486, 58020, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_to_jst() { let dt_10_04 = Utc.timestamp(1570114800, 0); //2019-10-04T00:00:00+09:00 assert_eq!(dt_10_04.as_jst().day(), 04); let dt_10_03 = Utc.timestamp(1570114799, 0); //2019-10-03T23:59:59+09:00 assert_eq!(dt_10_03.as_jst().day(), 03); let tomorrow = dt_10_03 + Duration::days(1); assert!((tomorrow).is_same_day_in_jst(&dt_10_04)); }
rust_cleaned_test_functions.jsonl/11276
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 226 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 5374, 267, 368, 341, 286, 1077, 7594, 62, 16, 15, 62, 15, 19, 284, 547, 10413, 22511, 7, 16, 20, 22, 15, 16, 16, 19, 23, 15, 15, 11, 220, 15, 1215, 442, 17, 15, 16, 24, 12, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_request_pdu_len() { assert_eq!(Request::ReadCoils(0x12, 5).pdu_len(), 5); assert_eq!(Request::WriteSingleRegister(0x12, 0x33).pdu_len(), 5); let buf = &mut [0, 0]; assert_eq!( Request::WriteMultipleCoils(0, Coils::from_bools(&[true, false], buf).unwrap()) .pdu_len(), 7 ); // TODO: extend test }
rust_cleaned_test_functions.jsonl/7213
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 221 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7893, 95249, 6043, 368, 341, 286, 2060, 10714, 10297, 1900, 486, 4418, 7339, 8669, 7, 15, 87, 16, 17, 11, 220, 20, 568, 79, 1054, 6043, 1507, 220, 20, 317, 286, 2060, 10714, 10297, 1900, 486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_check_update_vote_state_empty() { let empty_slot_hashes = build_slot_hashes(vec![]); let empty_vote_state = build_vote_state(vec![], &empty_slot_hashes); let mut vote_state_update = VoteStateUpdate::from(vec![]); assert_eq!( empty_vote_state.check_update_vote_state_slots_are_valid( &mut vote_state_update, &empty_slot_hashes ), Err(VoteError::EmptySlots), ); let mut vote_state_update = VoteStateUpdate::from(vec![(0, 1)]); assert_eq!( empty_vote_state.check_update_vote_state_slots_are_valid( &mut vote_state_update, &empty_slot_hashes ), Err(VoteError::SlotsMismatch), ); }
rust_cleaned_test_functions.jsonl/6131
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 439 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 8882, 54360, 4387, 15124, 368, 341, 286, 1077, 4287, 27563, 91616, 284, 1936, 27563, 91616, 25592, 0, 56703, 286, 1077, 4287, 54360, 4387, 284, 1936, 54360, 4387, 25592, 0, 12995, 609, 3194, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_variance() { use std::collections::btree_map::{Iter, IntoIter, Range, Keys, Values}; fn map_key<'new>(v: BTreeMap<&'static str, ()>) -> BTreeMap<&'new str, ()> { v } fn map_val<'new>(v: BTreeMap<(), &'static str>) -> BTreeMap<(), &'new str> { v } fn iter_key<'a, 'new>(v: Iter<'a, &'static str, ()>) -> Iter<'a, &'new str, ()> { v } fn iter_val<'a, 'new>(v: Iter<'a, (), &'static str>) -> Iter<'a, (), &'new str> { v } fn into_iter_key<'new>(v: IntoIter<&'static str, ()>) -> IntoIter<&'new str, ()> { v } fn into_iter_val<'new>(v: IntoIter<(), &'static str>) -> IntoIter<(), &'new str> { v } fn range_key<'a, 'new>(v: Range<'a, &'static str, ()>) -> Range<'a, &'new str, ()> { v } fn range_val<'a, 'new>(v: Range<'a, (), &'static str>) -> Range<'a, (), &'new str> { v } fn keys<'a, 'new>(v: Keys<'a, &'static str, ()>) -> Keys<'a, &'new str, ()> { v } fn vals<'a, 'new>(v: Values<'a, (), &'static str>) -> Values<'a, (), &'new str> { v } }
rust_cleaned_test_functions.jsonl/49400
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 584 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 77450, 368, 341, 262, 990, 1460, 486, 51137, 486, 65, 9344, 5376, 22964, 8537, 11, 31645, 8537, 11, 16437, 11, 24133, 11, 24979, 2315, 262, 5168, 2415, 3097, 18291, 931, 2235, 85, 25, 425, 6533,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_skip_bytes() { let test_bytes: Vec<u8> = hex::decode(TEST_HEX).expect(""); let mut binary_parser = BinaryParser::from(test_bytes.as_ref()); assert!(binary_parser.skip_bytes(4).is_ok()); assert_eq!(binary_parser, test_bytes[4..]); }
rust_cleaned_test_functions.jsonl/20412
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 134 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44830, 12524, 368, 341, 286, 1077, 1273, 12524, 25, 11312, 34837, 23, 29, 284, 12371, 486, 18196, 50320, 86502, 568, 17119, 13056, 286, 1077, 5206, 7868, 18517, 284, 17718, 6570, 486, 1499, 8623, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_naive_date_time_param() -> Result<()> { let db = checked_memory_handle()?; let result: Result<bool> = db.query_row("SELECT 1 WHERE ? BETWEEN datetime('now', '-1 minute') AND datetime('now', '+1 minute')", [Utc::now().naive_utc()], |r| r.get(0)); assert!(result.is_ok()); Ok(()) }
rust_cleaned_test_functions.jsonl/88689
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 154 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58631, 533, 4164, 3009, 4090, 368, 1464, 5714, 71698, 341, 286, 1077, 2927, 284, 10067, 19195, 10630, 94136, 286, 1077, 1102, 25, 5714, 17028, 29, 284, 2927, 4786, 8530, 445, 4858, 220, 16, 5288, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_deserialize_handle() { let (s1, _s2) = zx::Socket::create(zx::SocketOpts::STREAM).unwrap(); let request = TestInterfaceRequest::from_args( 7, /* opcode */ vec![Arg::Handle(s1.into_handle())], ) .unwrap(); assert_match!(request, TestInterfaceRequest::Handle{arg} => assert!(!arg.is_invalid())); }
rust_cleaned_test_functions.jsonl/55808
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 184 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15768, 9050, 10630, 368, 341, 286, 1077, 320, 82, 16, 11, 716, 82, 17, 8, 284, 71322, 486, 10286, 486, 3182, 13174, 87, 486, 10286, 43451, 486, 54326, 568, 15454, 543, 286, 1077, 1681, 284, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_crds_entry() { let mut rng = rand::thread_rng(); let mut crds = Crds::default(); let keypairs: Vec<_> = std::iter::repeat_with(Keypair::new).take(32).collect(); let mut entries = HashMap::new(); for _ in 0..256 { let keypair = keypairs.choose(&mut rng).unwrap(); let value = CrdsValue::new_rand(&mut rng, Some(keypair)); let key = value.label(); if let Ok(()) = crds.insert(value.clone(), new_rand_timestamp(&mut rng)) { entries.insert(key, value); } } assert!(crds.len() > 64); assert_eq!(crds.len(), entries.len()); for entry in entries.values() { let key = entry.label(); assert_eq!(crds.get::<&CrdsValue>(&key), Some(entry)); assert_eq!(crds.get::<&CrdsData>(&key), Some(&entry.data)); assert_eq!(crds.get::<&VersionedCrdsValue>(&key).unwrap().value, *entry); let key = entry.pubkey(); match &entry.data { CrdsData::ContactInfo(node) => { assert_eq!(crds.get::<&ContactInfo>(key), Some(node)) } CrdsData::LowestSlot(_, slot) => { assert_eq!(crds.get::<&LowestSlot>(key), Some(slot)) } CrdsData::Version(version) => assert_eq!(crds.get::<&Version>(key), Some(version)), CrdsData::LegacyVersion(version) => { assert_eq!(crds.get::<&LegacyVersion>(key), Some(version)) } CrdsData::SnapshotHashes(hash) => { assert_eq!(crds.get::<&SnapshotHashes>(key), Some(hash)) } _ => (), } } }
rust_cleaned_test_functions.jsonl/92044
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 975 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 32331, 5356, 9078, 368, 341, 286, 1077, 5206, 28422, 284, 10382, 486, 4528, 66849, 543, 286, 1077, 5206, 1560, 5356, 284, 4553, 5356, 486, 2258, 543, 286, 1077, 1376, 77256, 25, 11312, 32399...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_tx_already_processed() { let (genesis_config, mint_keypair) = create_genesis_config(2); let bank = Bank::new(&genesis_config); let key1 = Keypair::new(); let mut tx = system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_config.hash()); // First process `tx` so that the status cache is updated assert_eq!(bank.process_transaction(&tx), Ok(())); // Ensure that signature check works assert_eq!( bank.process_transaction(&tx), Err(TransactionError::AlreadyProcessed) ); // Change transaction signature to simulate processing a transaction with a different signature // for the same message. tx.signatures[0] = Signature::default(); // Ensure that message hash check works assert_eq!( bank.process_transaction(&tx), Err(TransactionError::AlreadyProcessed) ); }
rust_cleaned_test_functions.jsonl/2577
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 405 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17805, 80772, 63916, 368, 341, 286, 1077, 320, 77894, 5332, 11, 28337, 3097, 12670, 8, 284, 1855, 16322, 13774, 5332, 7, 17, 317, 286, 1077, 6073, 284, 8547, 486, 931, 2099, 77894, 5332, 626, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_fail_5() { let input = vec![Token::LParen, Token::Integer(1), Token::Plus, Token::Integer(2)]; assert!(parse(&input).is_err()); }
rust_cleaned_test_functions.jsonl/55675
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 90 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 22121, 62, 20, 368, 341, 1789, 286, 1077, 1946, 284, 7486, 20703, 3323, 486, 12567, 9151, 11, 9660, 486, 3486, 7, 16, 701, 9660, 486, 21807, 11, 9660, 486, 3486, 7, 17, 12587, 286, 2060...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_types() { let a = assert::Assert::new(); a.is_true( r#" def f(i: int.type) -> bool.type: return i == 3 f(8) == False"#, ); a.fail("def f(i: made_up):\n pass", "Variable"); a.fail("def f(i: fail('bad')):\n pass", "bad"); // Type errors should be caught in arguments a.fails( "def f(i: bool.type):\n pass\nf(1)", &["type annotation", "`1`", "`int`", "`bool`", "`i`"], ); // Type errors should be caught when the user forgets quotes around a valid type a.fail("def f(v: bool):\n pass\n", r#"Perhaps you meant `"bool"`"#); a.fails( r#"Foo = record(value=int.type) def f(v: bool.type) -> Foo: return Foo(value=1)"#, &[r#"record(value=field("int"))"#, "Foo"], ); a.fails( r#"Bar = enum("bar") def f(v: Bar): pass"#, &[r#"enum("bar")"#, "Bar"], ); // Type errors should be caught in return positions a.fails( "def f() -> bool.type:\n return 1\nf()", &["type annotation", "`1`", "`bool`", "`int`", "return"], ); // And for functions without return a.fails( "def f() -> bool.type:\n pass\nf()", &["type annotation", "`None`", "`bool`", "return"], ); // And for functions that return None implicitly or explicitly a.fails( "def f() -> None:\n return True\nf()", &["type annotation", "`None`", "`bool`", "return"], ); a.pass("def f() -> None:\n pass\nf()"); // The following are all valid types a.all_true( r#" is_type(1, int.type) is_type(True, bool.type) is_type(True, "") is_type(None, None) is_type(assert_type, "function") is_type([], [int.type]) is_type([], [""]) is_type([1, 2, 3], [int.type]) is_type(None, [None, int.type]) is_type('test', [int.type, str.type]) is_type(('test', None), (str.type, None)) is_type({'1': 'test', '2': False, '3': 3}, {'1': str.type, '2': bool.type}) is_type({"test": 1, "more": 2}, {str.type: int.type}) is_type({1: 1, 2: 2}, {int.type: int.type}) not is_type(1, None) not is_type((1, 1), str.type) not is_type({'1': 'test', '3': 'test'}, {'2': bool.type, '3': str.type}) not is_type({'1': 'test', '3': 'test'}, {'1': bool.type, '3': str.type}) not is_type('test', [int.type, bool.type]) not is_type([1,2,None], [int.type]) not is_type({"test": 1, 8: 2}, {str.type: int.type}) not is_type({"test": 1, "more": None}, {str.type: int.type}) is_type(1, "") is_type([1,2,"test"], ["_a"]) "#, ); // Checking types fails for invalid types a.fail("is_type(None, is_type)", "not a valid type"); a.fail("is_type(None, [])", "not a valid type"); a.fail("is_type({}, {1: 'string', 2: 'bool'})", "not a valid type"); }
rust_cleaned_test_functions.jsonl/91803
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1437 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9763, 368, 341, 286, 1077, 264, 284, 2060, 486, 8534, 486, 931, 543, 286, 264, 2079, 16082, 1006, 310, 435, 2, 698, 750, 282, 1956, 25, 526, 4852, 8, 1464, 1807, 4852, 510, 262, 470, 600, 62...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_overflows() { use uint; assert!((uint::max_value > 0u)); assert!((uint::min_value <= 0u)); assert!((uint::min_value + uint::max_value + 1u == 0u)); }
rust_cleaned_test_functions.jsonl/35454
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 84 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15431, 38140, 368, 341, 262, 990, 2622, 280, 262, 2060, 0, 1188, 2496, 486, 2810, 3142, 861, 220, 15, 84, 1106, 262, 2060, 0, 1188, 2496, 486, 1065, 3142, 2651, 220, 15, 84, 1106, 262, 2060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_multiple_signers() { let _pool = ConstPool::new(); let text = r" /// signers: 0x1, 0x2 script { use 0x2::Record; fun test_multiple_signers(s1: &signer, s2: &signer) { let r1 = Record::create(10); Record::save(s1, r1); let r2 = Record::create(20); Record::save(s2, r2); } } "; let effects = execute_script( MoveFile::with_content(script_path(), text), vec![stdlib_mod("signer.move"), modules_mod("record.move")], "dfinance", "0x3", vec![], ) .unwrap() .last() .unwrap() .effects(); let account1_change = &effects.resources()[0]; assert_eq!(account1_change.address, "0x1"); assert_eq!( account1_change.changes, vec![( "Added".to_string(), ResourceChange("0x2::Record::T".to_string(), Some("[U8(10)]".to_string())) )] ); let account2_change = &effects.resources()[1]; assert_eq!(account2_change.address, "0x2"); assert_eq!( account2_change.changes, vec![( "Added".to_string(), ResourceChange("0x2::Record::T".to_string(), Some("[U8(20)]".to_string())) )] ); }
rust_cleaned_test_functions.jsonl/43923
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 651 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45233, 11172, 388, 368, 341, 262, 1077, 716, 10285, 284, 24522, 10551, 486, 931, 1428, 262, 1077, 1467, 284, 435, 698, 262, 1048, 1841, 388, 25, 220, 15, 87, 16, 11, 220, 15, 87, 17, 198, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_from_impl_already_exists() { cov_mark::check!(test_add_from_impl_already_exists); check_assist_not_applicable( generate_from_impl_for_enum, r#" //- minicore: from enum A { $0One(u32), } impl From<u32> for A { fn from(v: u32) -> Self { Self::One(v) } } "#, ); }
rust_cleaned_test_functions.jsonl/4573
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 197 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 5673, 21007, 80772, 9766, 368, 341, 286, 21836, 18924, 486, 2028, 10297, 1944, 2891, 5673, 21007, 80772, 9766, 317, 286, 1779, 12083, 380, 7913, 8191, 46114, 1006, 310, 6923, 5673, 21007, 5478...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format_document_unchanged() { if skip_slow_tests() { return; } let server = project( r#" //- /Cargo.toml [package] name = "foo" version = "0.0.0" //- /src/lib.rs fn main() {} "#, ) .wait_until_workspace_is_loaded(); server.request::<Formatting>( DocumentFormattingParams { text_document: server.doc_id("src/lib.rs"), options: FormattingOptions { tab_size: 4, insert_spaces: false, insert_final_newline: None, trim_final_newlines: None, trim_trailing_whitespace: None, properties: HashMap::new(), }, work_done_progress_params: WorkDoneProgressParams::default(), }, json!(null), ); }
rust_cleaned_test_functions.jsonl/92572
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 425 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 26231, 62, 3185, 3726, 368, 341, 262, 421, 10706, 82447, 32509, 368, 341, 286, 470, 280, 262, 555, 262, 1077, 3538, 284, 2390, 1006, 286, 435, 2, 698, 61463, 608, 98228, 73494, 75, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_filter_small() { let vs = vec![1,2,3,4,5]; assert_eq!(filter(&vs, &even_predicate), vec![2,4]); }
rust_cleaned_test_functions.jsonl/21612
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 70 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8727, 31966, 368, 972, 262, 1077, 6165, 284, 7486, 20703, 16, 11, 17, 11, 18, 11, 19, 11, 20, 5960, 262, 2060, 10714, 10297, 5315, 2099, 11562, 11, 609, 16788, 97474, 701, 7486, 20703, 17, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_print_parsing() { let code = r#" block 0 { print(r0); exit(200); }"#; let expected_block = Instr::Print(Printable::Val(Val::Reg(0)), Box::new(Instr::Exit(Val::Imm(200)) )); assert_code_eq_block(code, expected_block); }
rust_cleaned_test_functions.jsonl/93581
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 222 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10064, 620, 28598, 368, 341, 286, 1077, 2038, 4035, 310, 435, 2, 698, 310, 2504, 220, 15, 341, 394, 1173, 2601, 15, 317, 394, 4869, 7, 17, 15, 15, 317, 310, 335, 57676, 280, 286, 1077, 3601,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_single_neuron_proposal_new() { let mut nns = check_proposal_status_after_voting_and_after_expiration_new( vec![Neuron { dissolve_state: NOTDISSOLVING_MIN_DISSOLVE_DELAY_TO_VOTE, cached_neuron_stake_e8s: 1, ..Neuron::default() }], "P", ProposalStatus::Executed, ProposalStatus::Executed, ); assert_changes!( nns, Changed::Changed(vec![ NNSStateChange::Now(U64Change(999111000, 999111017)), NNSStateChange::GovernanceProto(vec![ GovernanceChange::Neurons(vec![MapChange::Changed( 0, vec![NeuronChange::RecentBallots(vec![VecChange::Added( 0, vec![ BallotInfoChange::ProposalId(OptionChange::Different( None, Some(ProposalId { id: 1 }), )), BallotInfoChange::Vote(I32Change(0, 1)), ], )])], )]), GovernanceChange::Proposals(vec![MapChange::Added( 1, vec![ ProposalDataChange::Id(OptionChange::Different( None, Some(ProposalId { id: 1 }), )), ProposalDataChange::Proposer(OptionChange::Different( None, Some(NeuronId { id: 0 }), )), ProposalDataChange::Proposal(OptionChange::Different( None, Some(vec![ ProposalChange::Title(OptionChange::Different( None, Some("A Reasonable Title".to_string()) )), ProposalChange::Summary(StringChange( "".to_string(), "the unique proposal".to_string(), )), ProposalChange::Action(OptionChange::Different( None, Some(ActionDesc::ManageNetworkEconomics(NetworkEconomics { ..Default::default() })), )), ]), )), ProposalDataChange::ProposalTimestampSeconds(U64Change(0, 999111000)), ProposalDataChange::Ballots(vec![MapChange::Added( 0, Ballot { vote: Vote::Yes as i32, voting_power: 1, }, )]), ProposalDataChange::LatestTally(OptionChange::Different( None, Some(Tally { timestamp_seconds: 999111000, yes: 1, no: 0, total: 1, }), )), ProposalDataChange::DecidedTimestampSeconds(U64Change(0, 999111000)), ProposalDataChange::ExecutedTimestampSeconds(U64Change(0, 999111000)), ProposalDataChange::WaitForQuietState(OptionChange::Different( None, Some(WaitForQuietStateDesc { current_deadline_timestamp_seconds: 999111017, }), )), ], )]), GovernanceChange::Metrics(OptionChange::Different( None, Some(vec![ GovernanceCachedMetricsChange::TimestampSeconds(U64Change(0, 999111016)), GovernanceCachedMetricsChange::NotDissolvingNeuronsCount(U64Change(0, 1)), GovernanceCachedMetricsChange::NotDissolvingNeuronsE8SBuckets(vec![ MapChange::Added(0, 1.0), ]), GovernanceCachedMetricsChange::NotDissolvingNeuronsCountBuckets(vec![ MapChange::Added(0, 1), ]), GovernanceCachedMetricsChange::GarbageCollectableNeuronsCount(U64Change( 0, 1 )), GovernanceCachedMetricsChange::TotalStakedE8S(U64Change(0, 1)), ]), )), ]), ]) ); }
rust_cleaned_test_functions.jsonl/42880
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3314 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19487, 13925, 36090, 21663, 32556, 5921, 368, 341, 262, 1077, 5206, 308, 4412, 284, 1779, 21663, 32556, 4773, 19844, 2273, 11519, 8378, 19844, 2702, 28479, 5921, 1006, 286, 7486, 20703, 8813, 36090, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_database() { let database = parse_database(&XML_DATABASE.as_bytes().to_vec()); assert_matches!(database, Ok(_)); assert_eq!(database.unwrap().entries.len(), 4); }
rust_cleaned_test_functions.jsonl/90798
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 84 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 27341, 368, 341, 262, 1077, 4625, 284, 4715, 27341, 2099, 10609, 45510, 5357, 12524, 1005, 983, 13251, 1423, 262, 2060, 38344, 10297, 12216, 11, 7622, 2490, 1106, 262, 2060, 10714, 10297, 122...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_rent_eager_pubkey_range_maximum() { let max = !0; let range = Bank::pubkey_range_from_partition((0, 0, max)); assert_eq!( range, Pubkey::new_from_array([0x00; 32]) ..=Pubkey::new_from_array([ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]) ); let range = Bank::pubkey_range_from_partition((0, 1, max)); assert_eq!( range, Pubkey::new_from_array([ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) ..=Pubkey::new_from_array([ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]) ); let range = Bank::pubkey_range_from_partition((max - 3, max - 2, max)); assert_eq!( range, Pubkey::new_from_array([ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) ..=Pubkey::new_from_array([ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]) ); let range = Bank::pubkey_range_from_partition((max - 2, max - 1, max)); assert_eq!( range, Pubkey::new_from_array([ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) ..=Pubkey::new_from_array([ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]) ); fn should_cause_overflow(partition_count: u64) -> bool { // does not have a remainder. // so the test actually tests for overflow (u64::max_value() - partition_count + 1) % partition_count == 0 } let max_exact = 64; // Make sure `max_exact` divides evenly when calculating `calculate_partition_width` assert!(should_cause_overflow(max_exact)); // Make sure `max_inexact` doesn't divide evenly when calculating `calculate_partition_width` let max_inexact = 10; assert!(!should_cause_overflow(max_inexact)); for max in &[max_exact, max_inexact] { let range = Bank::pubkey_range_from_partition((max - 1, max - 1, *max)); assert_eq!( range, Pubkey::new_from_array([ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]) ..=Pubkey::new_from_array([ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]) ); } }
rust_cleaned_test_functions.jsonl/2544
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2586 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 83127, 2204, 1409, 34014, 792, 9698, 93581, 368, 341, 286, 1077, 1932, 284, 753, 15, 401, 286, 1077, 2088, 284, 8547, 486, 9585, 792, 9698, 5673, 43840, 1188, 15, 11, 220, 15, 11, 1932, 1106, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_progress_committed_index() { let l = default_logger(); let mut nt = Network::new(vec![None, None, None], &l); // set node 1 as Leader nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]); assert_eq!(nt.peers[&1].state, StateRole::Leader); assert_raft_log("#1: ", &nt.peers[&1].raft_log, (1, 0, 1)); assert_raft_log("#2: ", &nt.peers[&2].raft_log, (1, 0, 1)); assert_raft_log("#3: ", &nt.peers[&3].raft_log, (1, 0, 1)); assert_eq!( ( nt.peers[&1].prs().get(1).unwrap().committed_index, nt.peers[&1].prs().get(2).unwrap().committed_index, nt.peers[&1].prs().get(3).unwrap().committed_index ), (1, 1, 1) ); // #1 test append entries // append entries between 1 and 2 let mut test_entries = Entry::default(); test_entries.data = b"testdata".to_vec(); let m = new_message_with_entries(1, 1, MessageType::MsgPropose, vec![test_entries]); nt.cut(1, 3); nt.send(vec![m.clone(), m]); nt.recover(); assert_raft_log("#1: ", &nt.peers[&1].raft_log, (3, 0, 3)); assert_raft_log("#2: ", &nt.peers[&2].raft_log, (3, 0, 3)); assert_raft_log("#3: ", &nt.peers[&3].raft_log, (1, 0, 1)); assert_eq!( ( nt.peers[&1].prs().get(1).unwrap().committed_index, nt.peers[&1].prs().get(2).unwrap().committed_index, nt.peers[&1].prs().get(3).unwrap().committed_index ), (3, 3, 1) ); // #2 test heartbeat let heartbeat = new_message(1, 1, MessageType::MsgBeat, 0); nt.send(vec![heartbeat]); assert_raft_log("#1: ", &nt.peers[&1].raft_log, (3, 0, 3)); assert_raft_log("#2: ", &nt.peers[&2].raft_log, (3, 0, 3)); assert_raft_log("#3: ", &nt.peers[&3].raft_log, (3, 0, 3)); assert_eq!( ( nt.peers[&1].prs().get(1).unwrap().committed_index, nt.peers[&1].prs().get(2).unwrap().committed_index, nt.peers[&1].prs().get(3).unwrap().committed_index ), (3, 3, 3) ); // set node 2 as Leader nt.send(vec![new_message(2, 2, MessageType::MsgHup, 0)]); assert_eq!(nt.peers[&2].state, StateRole::Leader); assert_raft_log("#1: ", &nt.peers[&1].raft_log, (4, 0, 4)); assert_raft_log("#2: ", &nt.peers[&2].raft_log, (4, 0, 4)); assert_raft_log("#3: ", &nt.peers[&3].raft_log, (4, 0, 4)); assert_eq!( ( nt.peers[&2].prs().get(1).unwrap().committed_index, nt.peers[&2].prs().get(2).unwrap().committed_index, nt.peers[&2].prs().get(3).unwrap().committed_index ), (4, 4, 4) ); nt.isolate(2); nt.send(vec![new_message(2, 2, MessageType::MsgPropose, 2)]); nt.recover(); nt.dispatch(vec![new_message(2, 2, MessageType::MsgPropose, 1)]) .expect(""); // msg_type: MsgAppend to: 3 from: 2 term: 2 log_term: 2 index: 6 entries {term: 2 index: 7 data: "somedata"} commit: 4] let msg_append = nt.read_messages(); nt.dispatch(msg_append).expect(""); // msg_type: MsgAppendResponse to: 2 from: 3 term: 2 index: 6 commit: 4 reject: true reject_hint: 4] let msg_append_response = nt.read_messages(); nt.dispatch(msg_append_response).expect(""); // msg_type: MsgAppend to: 1 from: 2 term: 2 log_term: 2 index: 4 entries {term: 2 index: 5 data: "somedata"} entries {term: 2 index: 6 data: "somedata"} entries {term: 2 index: 7 data: "somedata"} commit: 4] let msg_append = nt.read_messages(); // committed index remain the same assert_eq!( ( nt.peers[&2].prs().get(1).unwrap().committed_index, nt.peers[&2].prs().get(2).unwrap().committed_index, nt.peers[&2].prs().get(3).unwrap().committed_index ), (4, 4, 4) ); // resend append nt.send(msg_append); // log is up-to-date assert_eq!( ( nt.peers[&2].prs().get(1).unwrap().committed_index, nt.peers[&2].prs().get(2).unwrap().committed_index, nt.peers[&2].prs().get(3).unwrap().committed_index ), (7, 7, 7) ); // set node 1 as Leader again nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]); assert_eq!(nt.peers[&1].state, StateRole::Leader); assert_raft_log("#1: ", &nt.peers[&1].raft_log, (8, 0, 8)); assert_raft_log("#2: ", &nt.peers[&2].raft_log, (8, 0, 8)); assert_raft_log("#3: ", &nt.peers[&3].raft_log, (8, 0, 8)); // update to 8 assert_eq!( ( nt.peers[&1].prs().get(1).unwrap().committed_index, nt.peers[&1].prs().get(2).unwrap().committed_index, nt.peers[&1].prs().get(3).unwrap().committed_index ), (8, 8, 8) ); nt.dispatch(vec![ new_message(1, 1, MessageType::MsgPropose, 1), new_message(1, 1, MessageType::MsgPropose, 1), ]) .expect(""); let msg_append = nt.read_messages(); nt.dispatch(msg_append).expect(""); let msg_append_response = nt.read_messages(); nt.dispatch(msg_append_response).expect(""); let msg_append = nt.read_messages(); nt.dispatch(msg_append).expect(""); let mut msg_append_response = nt.read_messages(); // m1: msg_type: MsgAppendResponse to: 1 from: 3 term: 3 index: 10 commit: 10 // m2: msg_type: MsgAppendResponse to: 1 from: 2 term: 3 index: 10 commit: 10 let m1 = msg_append_response.remove(1); let m2 = msg_append_response.remove(2); nt.send(vec![m1, m2]); assert_eq!( ( nt.peers[&1].prs().get(1).unwrap().committed_index, nt.peers[&1].prs().get(2).unwrap().committed_index, nt.peers[&1].prs().get(3).unwrap().committed_index ), (10, 10, 10) ); // committed index remain 10 // msg_type: MsgAppendResponse to: 1 from: 3 term: 3 index: 10 commit: 9 nt.send(msg_append_response); assert_eq!( ( nt.peers[&1].prs().get(1).unwrap().committed_index, nt.peers[&1].prs().get(2).unwrap().committed_index, nt.peers[&1].prs().get(3).unwrap().committed_index ), (10, 10, 10) ); }
rust_cleaned_test_functions.jsonl/19080
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3141 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27200, 2965, 5483, 3560, 368, 341, 262, 1077, 326, 284, 1638, 27413, 543, 262, 1077, 5206, 31412, 284, 8141, 486, 931, 25592, 20703, 4064, 11, 2240, 11, 2240, 1125, 609, 75, 626, 262, 442, 738, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_type_parameters_single_with_trailing_comma() { check( "<T: A,>", type_parameters, TypeParameterListSyntax { open: TokenSyntax::from("<"), elements: vec![TypeParameterElementSyntax { element: TypeParam { name: TokenSyntax::from("T"), type_constraint: Some(TypeConstraintSyntax { sep: TokenSyntax::from(":"), constraint: TypeName::Simple(SimpleTypeName { name: TokenSyntax::from("A"), type_args: None, }) .with_leading_trivia(Trivia::from(TriviaPiece::Spaces(1))), }), }, trailing_comma: Some(TokenSyntax::from(",")), }], close: TokenSyntax::from(">"), }, ); }
rust_cleaned_test_functions.jsonl/129310
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 634 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1819, 18263, 19487, 6615, 3547, 14277, 2965, 1728, 368, 341, 286, 1779, 1006, 310, 4055, 51, 25, 362, 11, 35452, 310, 943, 18263, 345, 310, 3990, 4971, 852, 33890, 341, 394, 1787, 25, 9660, 3389...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_backup_raw_meta() { let suite = TestSuite::new(3, 144 * 1024 * 1024); let key_count: u64 = 60; let cf = String::from(CF_DEFAULT); for i in 0..key_count { let (k, v) = suite.gen_raw_kv(i); suite.must_raw_put(k.clone().into_bytes(), v.clone().into_bytes(), cf.clone()); } let (admin_checksum, admin_total_kvs, admin_total_bytes) = suite.raw_kv_checksum("a".to_owned(), "z".to_owned(), CF_DEFAULT); // Push down backup request. let tmp = Builder::new().tempdir().unwrap(); let storage_path = make_unique_dir(tmp.path()); let rx = suite.backup_raw( vec![], // start vec![], // end cf, &storage_path, ); let resps1 = block_on(rx.collect::<Vec<_>>()); // Only leader can handle backup. assert_eq!(resps1.len(), 1); let files: Vec<_> = resps1[0].files.clone().into_iter().collect(); assert!(!files.is_empty()); let mut checksum = 0; let mut total_kvs = 0; let mut total_bytes = 0; let mut total_size = 0; for f in files { checksum ^= f.get_crc64xor(); total_kvs += f.get_total_kvs(); total_bytes += f.get_total_bytes(); total_size += f.get_size(); } assert_eq!(total_kvs, key_count + 1); assert_eq!(total_kvs, admin_total_kvs); assert_eq!(total_bytes, admin_total_bytes); assert_eq!(checksum, admin_checksum); assert_eq!(total_size, 1611); suite.stop(); }
rust_cleaned_test_functions.jsonl/92423
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 686 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44710, 16067, 13381, 368, 341, 262, 1077, 16182, 284, 3393, 28000, 486, 931, 7, 18, 11, 220, 16, 19, 19, 353, 220, 16, 15, 17, 19, 353, 220, 16, 15, 17, 19, 317, 262, 1077, 1376, 3180, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_range_mut() { let mut tester: VecDeque<usize> = VecDeque::with_capacity(7); let cap = tester.capacity(); for len in 0..=cap { for tail in 0..=cap { for start in 0..=len { for end in start..=len { tester.tail = tail; tester.head = tail; for i in 0..len { tester.push_back(i); } let head_was = tester.head; let tail_was = tester.tail; // Check that we iterate over the correct values let range: VecDeque<_> = tester.range_mut(start..end).map(|v| *v).collect(); let expected: VecDeque<_> = (start..end).collect(); assert_eq!(range, expected); // We shouldn't have changed the capacity or made the // head or tail out of bounds assert_eq!(tester.capacity(), cap); assert_eq!(tester.tail, tail_was); assert_eq!(tester.head, head_was); } } } } }
rust_cleaned_test_functions.jsonl/80657
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 674 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9698, 29523, 368, 341, 262, 1077, 5206, 37111, 25, 11312, 73891, 90244, 29, 284, 11312, 73891, 486, 4197, 35603, 7, 22, 626, 262, 1077, 2062, 284, 37111, 59168, 543, 262, 369, 2422, 304, 220, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_parse_label_declaration() { let result = label_declaration(CompleteStr("test:")); assert_eq!(result.is_ok(), true); let (_, token) = result.unwrap(); assert_eq!(token, Token::LabelDeclaration { name: "test".to_string() }); let result = label_declaration(CompleteStr("test")); assert_eq!(result.is_ok(), false); }
rust_cleaned_test_functions.jsonl/77500
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 164 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 6106, 77926, 368, 341, 286, 1077, 1102, 284, 2383, 77926, 7, 12548, 2580, 445, 1944, 25, 4010, 286, 2060, 10714, 10297, 1382, 2079, 19817, 1507, 830, 317, 286, 1077, 39464, 3950, 8, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_decimals() { assert!( (lamports_to_sol(42) - crate::amount_to_ui_amount(42, DECIMALS)).abs() < f64::EPSILON ); assert_eq!( sol_to_lamports(42.), crate::ui_amount_to_amount(42., DECIMALS) ); }
rust_cleaned_test_functions.jsonl/41759
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 164 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13783, 24163, 368, 341, 286, 2060, 33673, 310, 320, 23771, 3394, 2346, 53668, 7, 19, 17, 8, 481, 17717, 486, 6045, 2346, 22412, 13471, 7, 19, 17, 11, 42817, 37577, 50, 4579, 3435, 368, 366, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_slice_partition_dedup_partialeq() { #[derive(Debug)] struct Foo(i32, i32); impl PartialEq for Foo { fn eq(&self, other: &Foo) -> bool { self.0 == other.0 } } let mut slice = [Foo(0, 1), Foo(0, 5), Foo(1, 7), Foo(1, 9)]; let (dedup, duplicates) = slice.partition_dedup(); assert_eq!(dedup, [Foo(0, 1), Foo(1, 7)]); assert_eq!(duplicates, [Foo(0, 5), Foo(1, 9)]); }
rust_cleaned_test_functions.jsonl/9705
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 229 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26488, 43840, 814, 291, 454, 10495, 19893, 80, 368, 341, 262, 11506, 27098, 42618, 5563, 262, 2036, 33428, 1956, 18, 17, 11, 600, 18, 17, 626, 262, 11605, 55039, 369, 33428, 341, 286, 5168, 8939...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_getattr_did_you_mean_custom() { assert::fail( "struct(grey=1).gray", "Object of type `struct` has no attribute `gray`, did you mean `grey`?", ); }
rust_cleaned_test_functions.jsonl/92441
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 86 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 2991, 814, 307, 70456, 16933, 15875, 368, 341, 262, 2060, 486, 18403, 1006, 286, 330, 1235, 3268, 8073, 28, 16, 568, 11650, 756, 286, 330, 1190, 315, 943, 1565, 1235, 63, 702, 902, 7035, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_canonicalize_existing() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.arg("-e") .arg(".") .run() .stdout_is(at.root_dir_resolved() + "\n"); }
rust_cleaned_test_functions.jsonl/37401
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 106 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27421, 22391, 551, 62630, 368, 341, 262, 1077, 320, 266, 11, 5206, 575, 8710, 8, 284, 518, 8378, 68887, 2277, 0, 543, 262, 575, 8710, 21186, 13645, 68, 1138, 286, 659, 858, 5680, 1138, 286, 65...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_purge_old_full_snapshot_archives_in_the_loop() { let snapshot_archives_dir = tempfile::TempDir::new().unwrap(); let maximum_snapshots_to_retain = 5; let starting_slot: Slot = 42; for slot in (starting_slot..).take(100) { let full_snapshot_archive_file_name = format!("snapshot-{}-{}.tar", slot, Hash::default()); let full_snapshot_archive_path = snapshot_archives_dir .as_ref() .join(full_snapshot_archive_file_name); File::create(full_snapshot_archive_path).unwrap(); // don't purge-and-check until enough snapshot archives have been created if slot < starting_slot + maximum_snapshots_to_retain as Slot { continue; } if slot % (maximum_snapshots_to_retain as Slot * 2) != 0 { continue; } purge_old_snapshot_archives( &snapshot_archives_dir, maximum_snapshots_to_retain, usize::MAX, ); let mut full_snapshot_archives = get_full_snapshot_archives(&snapshot_archives_dir); full_snapshot_archives.sort_unstable(); assert_eq!( full_snapshot_archives.len(), maximum_snapshots_to_retain + 1 ); assert_eq!( full_snapshot_archives.first().unwrap().slot(), starting_slot ); assert_eq!(full_snapshot_archives.last().unwrap().slot(), slot); for (i, full_snapshot_archive) in full_snapshot_archives.iter().skip(1).rev().enumerate() { assert_eq!(full_snapshot_archive.slot(), slot - i as Slot); } } }
rust_cleaned_test_functions.jsonl/67611
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 945 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 39823, 21108, 16372, 53265, 34330, 1886, 1243, 16068, 17198, 368, 341, 286, 1077, 16295, 34330, 1886, 4334, 284, 54819, 486, 12151, 6184, 486, 931, 1005, 15454, 543, 286, 1077, 7192, 74175, 276...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_get_all_one_edit_neighbors() { let mut neighbors: HashSet<u64> = HashSet::new(); get_all_one_edit_neighbors(7, 3, &mut neighbors).unwrap(); let mut output: Vec<u64> = neighbors.into_iter().collect(); output.sort_unstable(); output.dedup(); assert_eq!( output, vec![1, 3, 4, 5, 6, 9, 11, 12, 13, 14, 15, 23, 28, 29, 30, 31, 39, 55] ); }
rust_cleaned_test_functions.jsonl/118242
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 228 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 5705, 11667, 13156, 55925, 368, 341, 286, 1077, 5206, 18709, 25, 18931, 34837, 21, 19, 29, 284, 18931, 486, 931, 543, 286, 633, 5705, 11667, 13156, 55925, 7, 22, 11, 220, 18, 11, 609, 69...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_0174_example_2() { let dungeon = vec![vec![0]]; let result = 1; assert_eq!(Solution::calculate_minimum_hp(dungeon), result); }
rust_cleaned_test_functions.jsonl/101382
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 89 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 15, 16, 22, 19, 39304, 62, 17, 368, 341, 286, 1077, 42439, 284, 7486, 20703, 4083, 20703, 15, 13204, 286, 1077, 1102, 284, 220, 16, 401, 286, 2060, 10714, 10297, 36842, 486, 35597, 84855, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_overwrite_false_positives() { let includes = Includes { regex: RegexSet::new(&[r"http://www.w3.org/1999/xhtml"]).unwrap(), }; let filter = Filter { includes: Some(includes), ..Filter::default() }; assert!(!filter.is_excluded(&website("http://www.w3.org/1999/xhtml"))); }
rust_cleaned_test_functions.jsonl/65564
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 185 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15431, 4934, 36015, 6479, 50354, 368, 341, 286, 1077, 5646, 284, 25954, 341, 310, 20180, 25, 26146, 1649, 486, 931, 2099, 58, 81, 76932, 1110, 2136, 1418, 18, 2659, 14, 16, 24, 24, 24, 34132, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_maybe_first_index() { let tests = vec![ // no snapshot (Some(new_entry(5, 1)), 5, None, false, 0), (None, 0, None, false, 0), // has snapshot (Some(new_entry(5, 1)), 5, Some(new_snapshot(4, 1)), true, 5), (None, 5, Some(new_snapshot(4, 1)), true, 5), ]; for (entries, offset, snapshot, wok, windex) in tests { let u = Unstable { entries: entries.map_or(vec![], |entry| vec![entry]), offset, snapshot, logger: crate::default_logger(), }; let index = u.maybe_first_index(); match index { None => assert!(!wok), Some(index) => assert_eq!(index, windex), } } }
rust_cleaned_test_functions.jsonl/80451
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 484 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 49791, 12978, 3560, 368, 341, 1789, 286, 1077, 7032, 284, 7486, 90515, 310, 442, 902, 16295, 198, 310, 320, 8373, 1755, 9078, 7, 20, 11, 220, 16, 5731, 220, 20, 11, 2240, 11, 895, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_create_already_in_use() { // Attempt to create system account in account already owned by another program let new_program_owner = Pubkey::new(&[9; 32]); let from = Pubkey::new_rand(); let mut from_account = Account::new(100, 0, &system_program::id()); let original_program_owner = Pubkey::new(&[5; 32]); let owned_key = Pubkey::new_rand(); let mut owned_account = Account::new(0, 0, &original_program_owner); let unchanged_account = owned_account.clone(); let result = create_account( &mut KeyedAccount::new(&from, true, &mut from_account), &mut KeyedAccount::new(&owned_key, true, &mut owned_account), 50, 2, &new_program_owner, ); assert_eq!(result, Err(SystemError::AccountAlreadyInUse.into())); let from_lamports = from_account.lamports; assert_eq!(from_lamports, 100); assert_eq!(owned_account, unchanged_account); let mut owned_account = Account::new(10, 0, &Pubkey::default()); let unchanged_account = owned_account.clone(); let result = create_account( &mut KeyedAccount::new(&from, true, &mut from_account), &mut KeyedAccount::new(&owned_key, true, &mut owned_account), 50, 2, &new_program_owner, ); assert_eq!(result, Err(SystemError::AccountAlreadyInUse.into())); let from_lamports = from_account.lamports; assert_eq!(from_lamports, 100); assert_eq!(owned_account, unchanged_account); }
rust_cleaned_test_functions.jsonl/24256
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 708 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 80772, 1243, 15951, 368, 341, 286, 442, 43517, 311, 1855, 1849, 2692, 304, 2692, 2669, 12938, 553, 2441, 2025, 198, 286, 1077, 501, 25096, 29027, 284, 22611, 792, 486, 931, 2099, 58, 24, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_print_hello() { let input = r#"print("hello")"#.to_string(); let mut tokenizer = Tokenizer::new(); assert_eq!( tokenizer.tokenize(input).unwrap(), vec!["print", "(", "\"hello\"", ")"] ) }
rust_cleaned_test_functions.jsonl/90383
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 139 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10064, 96724, 368, 341, 286, 1077, 1946, 284, 435, 55543, 1350, 445, 14990, 899, 57676, 13, 983, 3904, 1428, 286, 1077, 5206, 45958, 284, 9660, 3135, 486, 931, 1428, 286, 2060, 10714, 33673, 310, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add() { let fv = FV::new(16, &BigInt::from(12289)); let sk = fv.generate_key(); let mut v = vec![0; fv.n]; let mut w = vec![2; fv.n]; let mut vplusw = vec![2; fv.n]; // encrypt v let mut ctv = fv.encrypt_sk(&v, &sk); let ctw = fv.encrypt_sk(&w, &sk); // ct_v + ct_w. fv.add_inplace(&mut ctv, &ctw); let pt_after_add = fv.decrypt(&ctv, &sk); assert_eq!(pt_after_add, vplusw); }
rust_cleaned_test_functions.jsonl/103702
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 292 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 368, 341, 286, 1077, 61654, 284, 434, 53, 486, 931, 7, 16, 21, 11, 609, 87474, 486, 1499, 7, 16, 17, 17, 23, 24, 3237, 286, 1077, 1901, 284, 61654, 22019, 3097, 1428, 286, 1077, 5206, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_issuer_handle_problem_report_message_from_offer_sent_state() { let _setup = TestModeSetup::init(); let mut issuer_sm = _issuer_sm(); issuer_sm = issuer_sm.handle_message(CredentialIssuanceMessage::CredentialInit(mock_connection())).unwrap(); issuer_sm = issuer_sm.handle_message(CredentialIssuanceMessage::ProblemReport(_problem_report())).unwrap(); assert_match!(IssuerState::Finished(_), issuer_sm.state); assert_eq!(Status::Failed(ProblemReport::default()).code(), issuer_sm.credential_status()); }
rust_cleaned_test_functions.jsonl/20328
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 249 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 66817, 10630, 60139, 14813, 6462, 5673, 67814, 24115, 4387, 368, 341, 310, 1077, 716, 15188, 284, 3393, 3636, 21821, 486, 2327, 1428, 310, 1077, 5206, 54835, 15874, 284, 716, 66817, 15874, 543, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_vhost_user_message_u64() { let val = VhostUserU64::default(); let val1 = VhostUserU64::new(0); let a = val.value; let b = val1.value; assert_eq!(a, b); let a = VhostUserU64::new(1).value; assert_eq!(a, 1); }
rust_cleaned_test_functions.jsonl/118672
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 159 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2273, 3790, 3317, 6462, 7300, 21, 19, 368, 341, 286, 1077, 1044, 284, 647, 3790, 1474, 52, 21, 19, 486, 2258, 543, 286, 1077, 1044, 16, 284, 647, 3790, 1474, 52, 21, 19, 486, 931, 7, 15, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_day() { assert_eq!(day("days"), Ok(("", "days"))); assert_eq!(day("day"), Ok(("", "day"))); assert_eq!(day("d"), Ok(("", "d"))); }
rust_cleaned_test_functions.jsonl/71139
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 113 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16763, 368, 341, 310, 2060, 10714, 10297, 1292, 445, 13778, 3975, 7622, 7, 19814, 330, 13778, 17621, 310, 2060, 10714, 10297, 1292, 445, 1292, 3975, 7622, 7, 19814, 330, 1292, 17621, 310, 2060, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_illegal_property_actions() -> Result<(), Error> { let mut info = Data::new(); // Parent must exist assert!(info .apply( &create_numeric_property!(parent: 42, id: 1, name: "answer", value: Number::IntT(42)) ) .is_err()); // Can't reuse property IDs info = Data::new(); info.apply(&create_numeric_property!(parent: ROOT_ID, id: 1, name: "answer", value: Number::IntT(42)))?; assert!(info .apply(&create_numeric_property!(parent: ROOT_ID, id: 1, name: "another_answer", value: Number::IntT(7))) .is_err()); // Can't delete nonexistent property info = Data::new(); assert!(info.apply(&delete_property!(id: 1)).is_err()); info = Data::new(); info.apply(&create_numeric_property!(parent: ROOT_ID, id: 3, name: "value", value: Number::IntT(42)))?; info.apply(&create_array_property!(parent: ROOT_ID, id: 4, name: "array", slots: 2, type: NumberType::Int))?; info.apply(&create_linear_histogram!(parent: ROOT_ID, id: 5, name: "lin", floor: 5, step_size: 2, buckets: 2, type: IntT))?; info.apply(&create_exponential_histogram!(parent: ROOT_ID, id: 6, name: "exp", floor: 5, initial_step: 2, step_multiplier: 2, buckets: 2, type: IntT))?; assert!(info.apply(&set_number!(id: 3, value: Number::IntT(5))).is_ok()); assert!(info.apply(&array_set!(id: 4, index: 0, value: Number::IntT(5))).is_ok()); assert!(info.apply(&insert!(id: 5, value: Number::IntT(2))).is_ok()); assert!(info.apply(&insert!(id: 6, value: Number::IntT(2))).is_ok()); assert!(info.apply(&insert_multiple!(id: 5, value: Number::IntT(2), count: 3)).is_ok()); assert!(info.apply(&insert_multiple!(id: 6, value: Number::IntT(2), count: 3)).is_ok()); assert!(info.apply(&set_number!(id: 4, value: Number::IntT(5))).is_err()); assert!(info.apply(&set_number!(id: 5, value: Number::IntT(5))).is_err()); assert!(info.apply(&set_number!(id: 6, value: Number::IntT(5))).is_err()); assert!(info.apply(&array_set!(id: 3, index: 0, value: Number::IntT(5))).is_err()); assert!(info.apply(&array_set!(id: 5, index: 0, value: Number::IntT(5))).is_err()); assert!(info.apply(&array_set!(id: 6, index: 0, value: Number::IntT(5))).is_err()); assert!(info.apply(&insert!(id: 3, value: Number::IntT(2))).is_err()); assert!(info.apply(&insert!(id: 4, value: Number::IntT(2))).is_err()); assert!(info.apply(&insert_multiple!(id: 3, value: Number::IntT(2), count: 3)).is_err()); assert!(info.apply(&insert_multiple!(id: 4, value: Number::IntT(2), count: 3)).is_err()); Ok(()) }
rust_cleaned_test_functions.jsonl/10364
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1455 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26743, 6428, 16638, 25368, 368, 1464, 5714, 68843, 4600, 29, 341, 286, 1077, 5206, 3546, 284, 2885, 486, 931, 543, 286, 442, 17022, 1969, 3000, 198, 286, 2060, 10297, 2733, 198, 310, 659, 10280, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_halt_at_slot_starting_snapshot_root() { let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(123); let forks = tr(0) / tr(1); let ledger_path = get_tmp_ledger_path!(); let blockstore = Blockstore::open(&ledger_path).unwrap(); blockstore.add_tree( forks, false, true, genesis_config.ticks_per_slot, genesis_config.hash(), ); blockstore.set_roots(&[0, 1]).unwrap(); // Specify halting at slot 0 let opts = ProcessOptions { poh_verify: true, dev_halt_at_slot: Some(0), ..ProcessOptions::default() }; let evm_state_path = TempDir::new().unwrap(); let evm_genesis_path = ledger_path.join(solana_sdk::genesis_config::EVM_GENESIS); genesis_config .generate_evm_state(&ledger_path, None) .unwrap(); let (bank_forks, _leader_schedule) = process_blockstore( &genesis_config, &blockstore, evm_state_path.path(), evm_genesis_path, Vec::new(), opts, None, ) .unwrap(); // if there is a greater root at slot 1. assert!(bank_forks.get(0).is_some()); }
rust_cleaned_test_functions.jsonl/47543
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 712 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 3145, 3752, 27563, 4906, 287, 53265, 12993, 368, 341, 286, 1077, 40788, 2648, 1731, 314, 59366, 5332, 11, 5241, 335, 284, 1855, 16322, 13774, 5332, 7, 16, 17, 18, 626, 1789, 286, 1077, 735...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_is_mate_put_sente() { let kinds:Vec<MochigomaKind> = vec![ MochigomaKind::Fu, MochigomaKind::Kyou, MochigomaKind::Kei, MochigomaKind::Gin, MochigomaKind::Kin, MochigomaKind::Kaku, MochigomaKind::Hisha, ]; let mvs:Vec<Vec<(u32,u32)>> = vec![ vec![(4,5)], vec![(4,8)], vec![(3,6),(5,6)], vec![(3,3),(3,5),(4,5),(5,3),(5,5)], vec![(3,4),(3,5),(4,3),(4,5),(5,4),(5,5)], vec![(2,2),(6,2),(6,6),(2,6)], vec![(4,1),(1,4),(7,4),(4,7)], ]; let blank_banmen = Banmen([[Blank; 9]; 9]); for (k,mvs) in kinds.iter().zip(&mvs) { for m in mvs { let mut banmen = blank_banmen.clone(); banmen.0[3][4] = GOu; let mut state = State::new(banmen); let mut mc = MochigomaCollections::Empty; let mv = Move::To(KomaSrcPosition(9-4,3+1),KomaDstToPosition(9-4,4+1,false)); match Rule::apply_move_none_check(&state,Teban::Sente,&mc,mv.to_applied_move()) { (next,nmc,_) => { state = next; mc = nmc; } } let mv = Move::Put(*k,KomaDstPutPosition(9-m.0,m.1+1)); match Rule::apply_move_none_check(&state,Teban::Sente,&mc,mv.to_applied_move()) { (next,_,_) => { state = next; } } assert!(Rule::is_mate(Teban::Sente,&state),"assertion failed, move = {:?}, {:?}",mv,state.get_banmen()); } } }
rust_cleaned_test_functions.jsonl/72946
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 784 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 717, 349, 15557, 643, 6817, 368, 972, 10217, 12829, 25, 10050, 33274, 4953, 343, 7786, 10629, 29, 284, 7486, 20703, 319, 197, 9209, 4953, 343, 7786, 10629, 486, 76745, 1871, 197, 9209, 4953,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_missing_required_rule_type() -> TestResult { let p = polar(); let repo_instance = ExternalInstance { instance_id: 1, constructor: None, repr: None, class_repr: None, }; let repo_term = term!(Value::ExternalInstance(repo_instance.clone())); let repo_name = sym!("Repository"); p.register_constant(repo_name.clone(), repo_term)?; p.register_mro(repo_name, vec![repo_instance.instance_id])?; let issue_instance = ExternalInstance { instance_id: 2, constructor: None, repr: None, class_repr: None, }; let issue_term = term!(Value::ExternalInstance(issue_instance.clone())); let issue_name = sym!("Issue"); p.register_constant(issue_name.clone(), issue_term)?; p.register_mro(issue_name, vec![issue_instance.instance_id])?; let user_instance = ExternalInstance { instance_id: 3, constructor: None, repr: None, class_repr: None, }; let user_term = term!(Value::ExternalInstance(user_instance.clone())); let user_name = sym!("User"); p.register_constant(user_name.clone(), user_term)?; p.register_mro(user_name, vec![user_instance.instance_id])?; let policy = r#" actor User {} resource Repository { relations = {owner: User}; } resource Issue { roles = ["write"]; relations = {repo: Repository}; "write" if "owner" on "repo"; } allow(actor, action, resource) if has_permission(actor, action, resource); "#; qvalidation!( p, policy, MissingRequiredRule { .. }, "Missing implementation for required rule has_relation(" ); Ok(()) }
rust_cleaned_test_functions.jsonl/68167
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 693 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 40447, 18743, 21124, 1819, 368, 1464, 3393, 2077, 341, 262, 1077, 281, 284, 24660, 1428, 262, 1077, 15867, 11904, 284, 30936, 2523, 341, 286, 2867, 842, 25, 220, 16, 345, 286, 4692, 25, 2240, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
#[test] fn test_alloc_zero() { with_file_alloc(|file_alloc| { let core_data = RwLock::new(ShardAllocControlData::new()); let core_data_ref = unsafe { core_data.initialize().unwrap() }; let alloc = unsafe { ShardAlloc::new(core_data_ref, file_alloc, CHUNK_SIZE, false) }; let layout = std::alloc::Layout::from_size_align(0, 1).unwrap(); let _ = alloc.allocate(layout).unwrap(); }) }
rust_cleaned_test_functions.jsonl/133812
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 217 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14802, 19359, 368, 341, 286, 448, 2458, 14802, 22428, 1192, 14802, 91, 341, 310, 1077, 6200, 1769, 284, 55294, 11989, 486, 931, 7, 2016, 567, 25154, 3273, 1043, 486, 931, 1423, 310, 1077, 6200, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format() { test_case!("Hello, World"); test_case!("Hello, {name}", name = "John Doe"); test_case!("Hello, {1} {0}", "John", "Doe"); test_case!("Hello, {} {0} {}", "John", "Doe"); let out: String = rune!( pub fn main() { format!("Hello, {}" + " {0} {}", "John", "Doe") } ); assert_eq!(format!("Hello, {} {0} {}", "John", "Doe"), out); }
rust_cleaned_test_functions.jsonl/2744
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 203 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 368, 341, 262, 1273, 19096, 17223, 9707, 11, 4337, 797, 262, 1273, 19096, 17223, 9707, 11, 314, 606, 9545, 829, 284, 330, 13079, 49628, 797, 262, 1273, 19096, 17223, 9707, 11, 314, 16, 92,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_database() { let expected_entry = Entry { components: vec![(Binding::Tight, Component::Normal("First".to_string()))], value: b"1".to_vec(), }; let tests = [ (&b"First: 1\n\n\n"[..], vec![expected_entry.clone()]), (b"First: 1\n!Foo", vec![expected_entry.clone()]), (b"!First: 1\nbar\n\n\n", Vec::new()), (b"!bar\nFirst: 1\nbaz", vec![expected_entry.clone()]), (b"First :\\\n \\\n\\\n1\n", vec![expected_entry]), ( b"First: \\\n 1\\\n2\n", vec![Entry { components: vec![(Binding::Tight, Component::Normal("First".to_string()))], value: b"12".to_vec(), }], ), ]; let mut success = true; for (data, expected) in tests.iter() { let mut result = Vec::new(); parse_database(data, &mut result, |_, _| unreachable!()); if &result != expected { eprintln!("While testing {:?}", data); eprintln!("Expected: {:?}", expected); eprintln!("Got: {:?}", result); eprintln!(); success = false; } } if !success { panic!() } }
rust_cleaned_test_functions.jsonl/113433
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 765 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 27341, 368, 341, 286, 1077, 3601, 9078, 284, 15788, 341, 310, 6813, 25, 7486, 0, 9697, 15059, 486, 51, 491, 11, 5578, 486, 12206, 445, 5338, 3263, 983, 3904, 10131, 1259, 310, 897, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_reset() { let mut mfi = MoneyFlowIndex::new(3).unwrap(); let bar1 = Bar::new().high(2).low(1).close(1.5).volume(1000.0); let bar2 = Bar::new().high(5).low(3).close(4).volume(2000.0); let bar3 = Bar::new().high(9).low(7).close(8).volume(3000.0); let bar4 = Bar::new().high(5).low(3).close(4).volume(4000.0); let bar5 = Bar::new().high(5).low(3).close(4).volume(5000.0); let bar6 = Bar::new().high(2).low(1).close(1.5).volume(6000.0); assert_eq!(mfi.next(&bar1), 50.0); assert_eq!(mfi.next(&bar2), 100.0); assert_eq!(mfi.next(&bar3), 100.0); assert_eq!(round(mfi.next(&bar4)), 66.667); assert_eq!(round(mfi.next(&bar5)), 73.333); assert_eq!(round(mfi.next(&bar6)), 44.444); mfi.reset(); assert_eq!(mfi.next(&bar1), 50.0); assert_eq!(mfi.next(&bar2), 100.0); assert_eq!(mfi.next(&bar3), 100.0); assert_eq!(round(mfi.next(&bar4)), 66.667); assert_eq!(round(mfi.next(&bar5)), 73.333); assert_eq!(round(mfi.next(&bar6)), 44.444); }
rust_cleaned_test_functions.jsonl/73625
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 579 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18983, 368, 341, 286, 1077, 5206, 296, 9983, 284, 17633, 18878, 1552, 486, 931, 7, 18, 568, 15454, 1428, 286, 1077, 3619, 16, 284, 4716, 486, 931, 1005, 11892, 7, 17, 568, 10303, 7, 16, 568, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1