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_try_from_put_metrics() { let (mut sender, receiver) = UnixStream::pair().unwrap(); let mut connection = HttpConnection::new(receiver); let body = "{ \ \"metrics_path\": \"string\" \ }"; sender .write_all(http_request("PUT", "/metrics", Some(&body)).as_bytes()) .unwrap(); assert!(connection.try_read().is_ok()); let req = connection.pop_parsed_request().unwrap(); assert!(ParsedRequest::try_from_request(&req).is_ok()); }
rust_cleaned_test_functions.jsonl/106583
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 252 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53283, 5673, 15557, 37686, 368, 341, 286, 1077, 320, 6984, 4646, 11, 13964, 8, 284, 46995, 3027, 486, 12670, 1005, 15454, 543, 286, 1077, 5206, 3633, 284, 4823, 4526, 486, 931, 78126, 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...
1
#[test] fn test_template_in_module() { assert_eq!( html! {p : submodule::Test3::new(&42)} .into_string() .unwrap(), "<p><div>42</div></p>" ); }
rust_cleaned_test_functions.jsonl/73249
{ "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, 8693, 1243, 10750, 368, 341, 262, 2060, 10714, 33673, 286, 5272, 0, 314, 79, 549, 95570, 486, 2271, 18, 486, 931, 2099, 19, 17, 10569, 310, 659, 18122, 3904, 741, 310, 659, 15454, 3148, 286, 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
#[test] fn test_join() { assert_eq!(&join_url("app:///", "foo.html").unwrap(), "app:///foo.html"); assert_eq!(&join_url("app://", "foo.html").unwrap(), "app:///foo.html"); assert_eq!(&join_url("~/", "foo.html").unwrap(), "~/foo.html"); assert_eq!( &join_url("app:///", "/foo.html").unwrap(), "app:///foo.html" ); assert_eq!(&join_url("app://", "/foo.html").unwrap(), "app:///foo.html"); assert_eq!( &join_url("https:///example.com/", "foo.html").unwrap(), "https://example.com/foo.html" ); assert_eq!( &join_url("https://example.com/", "foo.html").unwrap(), "https://example.com/foo.html" ); }
rust_cleaned_test_functions.jsonl/32395
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 325 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31017, 368, 341, 262, 2060, 10714, 0, 2099, 5987, 2903, 445, 676, 1110, 28105, 330, 7975, 2564, 1827, 15454, 1507, 330, 676, 60896, 7975, 2564, 797, 262, 2060, 10714, 0, 2099, 5987, 2903, 445, 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_country() { assert_eq!(vsd(230992580).country().unwrap(), "FI"); assert_eq!(vsd(276009860).country().unwrap(), "EE"); assert_eq!(vsd(265803690).country().unwrap(), "SE"); assert_eq!(vsd(273353180).country().unwrap(), "RU"); assert_eq!(vsd(211805060).country().unwrap(), "DE"); assert_eq!(vsd(257037270).country().unwrap(), "NO"); assert_eq!(vsd(227232370).country().unwrap(), "FR"); assert_eq!(vsd(248221000).country().unwrap(), "MT"); assert_eq!(vsd(374190000).country().unwrap(), "PA"); assert_eq!(vsd(412511368).country().unwrap(), "CN"); assert_eq!(vsd(512003200).country().unwrap(), "NZ"); assert_eq!(vsd(995126020).country(), None); assert_eq!(vsd(2300049).country(), None); assert_eq!(vsd(0).country(), None); }
rust_cleaned_test_functions.jsonl/52791
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 410 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28106, 368, 341, 286, 2060, 10714, 10297, 11562, 67, 7, 17, 18, 15, 24, 24, 17, 20, 23, 15, 568, 11141, 1005, 15454, 1507, 330, 19426, 797, 286, 2060, 10714, 10297, 11562, 67, 7, 17, 22, 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
#[test] fn test_combination() { let modulo = Modulo::new(1000, MOD); assert_eq!(modulo.combination(1000, 500), 159835829); }
rust_cleaned_test_functions.jsonl/113611
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 72 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34454, 2554, 368, 341, 286, 1077, 59864, 284, 5650, 8763, 486, 931, 7, 16, 15, 15, 15, 11, 18669, 317, 286, 2060, 10714, 10297, 87966, 905, 65, 2554, 7, 16, 15, 15, 15, 11, 220, 20, 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
#[test] fn test_standard_geometric() { let mut rng = crate::test::rng(654321); let distr = StandardGeometric; let expected_mean = 1.0; let expected_variance = 2.0; let mut results = [0.0; 1000]; for i in results.iter_mut() { *i = distr.sample(&mut rng) as f64; } let mean = results.iter().sum::<f64>() / results.len() as f64; assert!((mean as f64 - expected_mean).abs() < expected_mean / 50.0); let variance = results.iter().map(|x| (x - mean) * (x - mean)).sum::<f64>() / results.len() as f64; assert!((variance - expected_variance).abs() < expected_variance / 10.0); }
rust_cleaned_test_functions.jsonl/9275
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 326 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48688, 32933, 23375, 368, 341, 286, 1077, 5206, 28422, 284, 17717, 486, 1944, 486, 69890, 7, 21, 20, 19, 18, 17, 16, 626, 286, 1077, 7905, 284, 11766, 9499, 23375, 280, 286, 1077, 3601, 16933, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_transitions_with_at_least_four_elements() { let model = "0\n\ 3\n\ a 0 1 8"; match DFAReader::new_from_string(model) { Err(DFAReaderError::IllformedTransition(line)) => assert!(line == 3), _ => assert!(false, "IllformedTransition expected."), } }
rust_cleaned_test_functions.jsonl/47831
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 192 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7965, 5930, 6615, 3752, 88716, 56142, 22801, 368, 341, 286, 1077, 1614, 4035, 310, 330, 15, 1699, 5661, 1797, 220, 18, 1699, 5661, 1797, 264, 220, 15, 220, 16, 220, 23, 876, 286, 2432, 93631, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_encode_empty_array() { let mut buf = Vec::new(); let empty: Vec<Value> = Vec::new(); encode( &Value::Array(empty), &Schema::parse_str(r#"{"type": "array", "items": "int"}"#).unwrap(), &mut buf, ); assert_eq!(vec![0u8], buf); }
rust_cleaned_test_functions.jsonl/12306
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 180 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11224, 15124, 3858, 368, 341, 286, 1077, 5206, 6607, 284, 11312, 486, 931, 543, 286, 1077, 4287, 25, 11312, 48325, 29, 284, 11312, 486, 931, 543, 286, 16164, 1006, 310, 609, 1130, 486, 1857, 242...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_pretty_format_time_32_millisecond() { let expected = vec![ "+--------------+", "| f |", "+--------------+", "| 03:05:11.111 |", "| |", "+--------------+", ]; check_datetime!(Time32MillisecondArray, 11111111, expected); }
rust_cleaned_test_functions.jsonl/5248
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 210 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 21322, 8955, 3009, 62, 18, 17, 717, 65358, 368, 341, 286, 1077, 3601, 284, 7486, 90515, 310, 6630, 42091, 10, 756, 310, 25203, 282, 310, 760, 756, 310, 6630, 42091, 10, 756, 310, 25203, 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_mul() { let mut a : felem_as_words = [11671922859260663127, 11050707557586042878, 284884720401305268, 17749945728364010941, 8613774818643959860, 145621051382923523]; let mut b : felem_as_words = [9794203289623549276, 7309342082925068282, 1139538881605221074, 15659550692327388916, 16008355200866287827, 582484205531694093]; let mut out : felem_as_words = [0, 0, 0, 0, 0, 0]; bls12_mul(&mut out, &mut b, &mut a); assert_eq!(out, [8505329371266088957, 17002214543764226050, 6865905132761471162, 8632934651105793861, 6631298214892334189, 1582556514881692819]); }
rust_cleaned_test_functions.jsonl/91330
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 283 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24944, 368, 341, 262, 1077, 5206, 264, 549, 1152, 3433, 11898, 18981, 284, 508, 16, 16, 21, 22, 16, 24, 17, 17, 23, 20, 24, 17, 21, 15, 21, 21, 18, 16, 17, 22, 11, 220, 16, 16, 15, 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_list_fds_zombie() { let mut test_subprocess = start_c_program("./nothing"); let process = ps_utils::get_target("nothing").unwrap().unwrap(); assert!( process.list_fds().is_none(), "Expected list_fds to return None for a zombie process" ); let _ = test_subprocess.kill(); }
rust_cleaned_test_functions.jsonl/18850
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 168 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2019, 90438, 6415, 23342, 368, 341, 286, 1077, 5206, 1273, 5228, 4630, 284, 1191, 666, 25096, 13988, 41212, 797, 286, 1077, 1882, 284, 4726, 17309, 486, 455, 11123, 445, 41212, 1827, 15454, 1005, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_two_octet_frame_size_command() { let buf = [ 0b00000000, // DLCI of 0 is OK. 0b11110000, // SupportedRequest. 0b00001000, // Priority = 8. 0b00000000, // Ignored. 0b10000100, // Max Frame Size Octet 1 = 132. 0b00000001, // Max Frame Size Octet 2 = 256. 0b00011100, // Ignored. 0b00001100, ]; let expected = ParameterNegotiationParams { dlci: DLCI::try_from(0).unwrap(), credit_based_flow_handshake: CreditBasedFlowHandshake::SupportedRequest, priority: 8, max_frame_size: 388, initial_credits: 4, }; assert_eq!(ParameterNegotiationParams::decode(&buf[..]).unwrap(), expected); }
rust_cleaned_test_functions.jsonl/69347
{ "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, 21039, 23241, 70135, 295, 8929, 2368, 10811, 368, 341, 286, 1077, 6607, 284, 2278, 310, 220, 15, 65, 15, 15, 15, 15, 15, 15, 15, 15, 11, 442, 42919, 40, 315, 220, 15, 374, 10402, 624, 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_mut() { let mut val = Sticky::new(true); *val.get_mut() = false; assert_eq!(val.to_string(), "false"); assert_eq!(val.get(), &false); }
rust_cleaned_test_functions.jsonl/13456
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 82 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29523, 368, 341, 262, 1077, 5206, 1044, 284, 92643, 486, 931, 3715, 317, 262, 353, 831, 670, 29523, 368, 284, 895, 280, 262, 2060, 10714, 10297, 831, 2389, 3904, 1507, 330, 3849, 797, 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
#[test] fn test_no_debug_failure() { let (mut runtime, state_snapshot, _) = setup( false, json!({ "target": "esnext", "module": "esnext", "lib": ["deno.ns", "deno.window"], "noEmit": true, }), &[( "file:///a.ts", r#"const url = new URL("b.js", import."#, 1, LanguageId::TypeScript, )], ); let specifier = resolve_url("file:///a.ts").expect("could not resolve url"); let result = request( &mut runtime, state_snapshot, RequestMethod::GetDiagnostics(vec![specifier]), ); assert!(result.is_ok()); let response = result.unwrap(); assert_eq!( response, json!({ "file:///a.ts": [ { "start": { "line": 0, "character": 35, }, "end": { "line": 0, "character": 35 }, "fileName": "file:///a.ts", "messageText": "Identifier expected.", "sourceLine": "const url = new URL(\"b.js\", import.", "category": 1, "code": 1003, } ] }) ); }
rust_cleaned_test_functions.jsonl/23626
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 660 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 15446, 43618, 368, 341, 262, 1077, 320, 6984, 15592, 11, 1584, 53265, 11, 27439, 284, 6505, 1006, 414, 895, 345, 414, 2951, 0, 2262, 286, 330, 5657, 788, 330, 288, 3600, 756, 286, 330, 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...
1
#[test] fn test_delete_packet_acknowledgement_ok() { let port_id = PortId::from_str("transfer").unwrap(); let channel_id = ChannelId::from_str("channel-0").unwrap(); let sequence = Sequence::from(0); let ack = vec![1, 2, 3]; let mut context: Context<Test> = Context::new(); new_test_ext().execute_with(|| { assert_eq!( context .store_packet_acknowledgement( (port_id.clone(), channel_id.clone(), sequence.clone()), ack.clone() ) .is_ok(), true ); assert_eq!( context .delete_packet_acknowledgement(( port_id.clone(), channel_id.clone(), sequence.clone() )) .is_ok(), true ); let result = context .get_packet_acknowledgement(&(port_id, channel_id, sequence)) .unwrap_err() .to_string(); assert_eq!(result, ICS04Error::packet_acknowledgement_not_found(sequence).to_string()); }) }
rust_cleaned_test_functions.jsonl/60067
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 388 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11353, 21078, 48447, 50022, 29564, 19817, 368, 341, 10217, 2635, 842, 284, 5776, 764, 486, 1499, 2895, 445, 24188, 1827, 15454, 543, 10217, 5496, 842, 284, 13434, 764, 486, 1499, 2895, 445, 10119, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_account_shared_data_serialize() { let key = Pubkey::new_unique(); let (_account1, mut account2) = make_two_accounts(&key); account2.serialize_data(&"hello world").unwrap(); }
rust_cleaned_test_functions.jsonl/48202
{ "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, 13500, 20405, 1769, 88686, 368, 341, 286, 1077, 1376, 284, 22611, 792, 486, 931, 21218, 543, 286, 1077, 5453, 4608, 16, 11, 5206, 2692, 17, 8, 284, 1281, 23241, 55665, 2099, 792, 317, 286, 2692,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_json_2() { let old_json = "[]"; let to_be_added_json = r#"{"a":3}"#; let final_json = r#"[{"a":3}]"#; assert_eq!(update_json(old_json, to_be_added_json), final_json); }
rust_cleaned_test_functions.jsonl/17532
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 126 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 9455, 62, 17, 368, 341, 286, 1077, 2310, 9455, 284, 330, 1294, 876, 286, 1077, 311, 21263, 37653, 9455, 284, 435, 55543, 4913, 64, 788, 18, 9863, 2, 280, 286, 1077, 1590, 9455, 284, 435,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_filter_normal_code() { let s = r#" fn main() { println!("hello, world"); } "#; assert_eq!(s, filter_normal_code(s)); let s_with_comment = r#" fn main() { // hello, world println!("hello, world"); } "#; assert_eq!(s, filter_normal_code(s_with_comment)); }
rust_cleaned_test_functions.jsonl/44606
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 160 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8727, 13973, 4136, 368, 341, 286, 1077, 274, 284, 435, 2, 698, 8822, 1887, 368, 341, 262, 13751, 17223, 14990, 11, 1879, 797, 532, 57676, 280, 286, 2060, 10714, 10297, 82, 11, 4051, 13973, 4136,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_from_base64() { let s = "KkctSmFOZFJnVWtYcDJzNXY4eS9CP0UoSCtNYlBlU2g="; assert!(Digest32::from_base64(s).is_ok()); }
rust_cleaned_test_functions.jsonl/5707
{ "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, 5673, 7651, 21, 19, 368, 341, 286, 1077, 274, 284, 330, 42, 74, 302, 10673, 3788, 90814, 41, 77, 53, 54, 83, 56, 66, 53272, 89, 45, 16356, 19, 68, 50, 24, 7123, 15, 52, 78, 3540, 83, 230...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_rev_iterator() { let data: Vec<_> = RandomCandles::new().take(600).collect(); for length in 1..255 { let mut w = Window::new(length, data[0]); data.iter().enumerate().for_each(|(i, &c)| { w.push(c); if i >= length as usize { let iterated: Vec<_> = w.iter_rev().collect(); let original_slice = { let from = i.saturating_sub((length - 1) as usize); let to = i; &data[from..=to] }; assert_eq!(iterated.as_slice(), original_slice); } }); assert_eq!( w.iter().size_hint(), (length as usize, Some(length as usize)) ); assert_eq!(w.iter().count(), length as usize); } }
rust_cleaned_test_functions.jsonl/125190
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 322 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 38082, 13491, 368, 341, 197, 10217, 821, 25, 11312, 32399, 29, 284, 10612, 34, 20125, 486, 931, 1005, 22769, 7, 21, 15, 15, 568, 17384, 1428, 197, 2023, 3084, 304, 220, 16, 496, 17, 20, 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...
3
#[test] fn test_get_nth_fibonacci_number() { #[cfg_attr(rustfmt, rustfmt_skip)] static SEQUENCE: &'static [u64] = &[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169]; for test_case in SEQUENCE.iter().enumerate() { assert!( get_nth_fibonacci_number(test_case.0 as u64) .to_u64() .unwrap() == *test_case.1, "fib({}) == {}", test_case.0, test_case.1 ); } }
rust_cleaned_test_functions.jsonl/6692
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 410 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 78342, 761, 579, 39345, 5500, 368, 341, 262, 11506, 14072, 10422, 2601, 590, 12501, 11, 23071, 12501, 44830, 5563, 262, 1099, 5052, 50842, 25, 30136, 1978, 508, 84, 21, 19, 60, 4035, 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...
2
#[test] fn test_parse_tail() { let re = ResourceDef::new("/user/-{id}*"); let mut path = Path::new("/user/-profile"); assert!(re.match_path(&mut path)); assert_eq!(path.get("id").unwrap(), "profile"); let mut path = Path::new("/user/-2345"); assert!(re.match_path(&mut path)); assert_eq!(path.get("id").unwrap(), "2345"); let mut path = Path::new("/user/-2345/"); assert!(re.match_path(&mut path)); assert_eq!(path.get("id").unwrap(), "2345/"); let mut path = Path::new("/user/-2345/sdg"); assert!(re.match_path(&mut path)); assert_eq!(path.get("id").unwrap(), "2345/sdg"); }
rust_cleaned_test_functions.jsonl/87893
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 326 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 35471, 368, 341, 286, 1077, 312, 284, 11765, 2620, 486, 931, 4283, 872, 23650, 90, 307, 92814, 3071, 286, 1077, 5206, 1815, 284, 7933, 486, 931, 4283, 872, 23650, 5365, 797, 286, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_displayed() { for default in [ DefaultPolicy::Deny, DefaultPolicy::Allow { authenticated_only: true, cluster_only: false, }, DefaultPolicy::Allow { authenticated_only: false, cluster_only: false, }, DefaultPolicy::Allow { authenticated_only: false, cluster_only: true, }, DefaultPolicy::Allow { authenticated_only: false, cluster_only: true, }, ] { assert_eq!( default.to_string().parse::<DefaultPolicy>().unwrap(), default, "failed to parse displayed {:?}", default ); } }
rust_cleaned_test_functions.jsonl/12833
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 492 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 14825, 291, 368, 341, 286, 369, 1638, 304, 2278, 310, 7899, 13825, 486, 23619, 88, 345, 310, 7899, 13825, 486, 18605, 341, 394, 37260, 18410, 25, 830, 345, 394, 10652, 18410, 25, 895, 345...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_check_leader() { let sandbox = timestamping_sandbox(); let sandbox_state = SandboxState::new(); // option: with transaction let tx = gen_timestamping_tx(); sandbox.recv(&tx); let n_rounds_without_request_peers = { let mut rounds = 0; let mut time_left = sandbox.cfg().peers_timeout; while time_left > 0 { time_left = time_left.saturating_sub( sandbox.first_round_timeout() + rounds * sandbox.round_timeout_increase(), ); rounds += 1; } Round(rounds as u32) }; let mut was_leader = false; for round in Round::first().iter_to(n_rounds_without_request_peers) { sandbox.assert_state(Height(1), round); add_round_with_transactions(&sandbox, &sandbox_state, &[tx.object_hash()]); sandbox.assert_state(Height(1), round.next()); was_leader = was_leader || sandbox.is_leader(); } assert!(was_leader); add_round_with_transactions(&sandbox, &sandbox_state, &[tx.object_hash()]); // Status timeout is equal to peers timeout in sandbox' ConsensusConfig. sandbox.broadcast(&sandbox.create_status( sandbox.public_key(ValidatorId(0)), Height(1), sandbox.last_block().object_hash(), 1, sandbox.secret_key(ValidatorId(0)), )); sandbox.send_peers_request(); }
rust_cleaned_test_functions.jsonl/83606
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 594 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 79991, 368, 341, 262, 1077, 42754, 284, 11441, 287, 643, 31536, 543, 262, 1077, 42754, 4387, 284, 96860, 1397, 486, 931, 1428, 262, 442, 2999, 25, 448, 7745, 198, 262, 1077, 9854, 284, 408...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_stop_sending_other_error_with_events() { let (mut client, mut server, request_stream_id) = connect_and_send_request(false); // send response - 200 Content-Length: 3 // with content: 'abc'. server_send_response_and_exchange_packet( &mut client, &mut server, request_stream_id, HTTP_RESPONSE_2, false, ); // Send a stop sending. assert_eq!( Ok(()), server .conn .stream_stop_sending(request_stream_id, Error::HttpRequestCancelled.code()) ); let out = server.conn.process(None, now()); client.process(out.dgram(), now()); let mut stop_sending = false; let mut header_ready = false; while let Some(e) = client.next_event() { match e { Http3ClientEvent::StopSending { stream_id, error } => { assert_eq!(stream_id, request_stream_id); assert_eq!(error, Error::HttpRequestCancelled.code()); stop_sending = true; } Http3ClientEvent::Reset { .. } => { panic!("We should not get StopSending."); } Http3ClientEvent::HeaderReady { .. } | Http3ClientEvent::DataReadable { .. } => { header_ready = true; } _ => {} } } assert!(stop_sending); assert!(header_ready); let mut buf = [0_u8; 100]; let (amount, fin) = client .read_response_data(now(), request_stream_id, &mut buf) .unwrap(); assert!(!fin); assert_eq!(amount, EXPECTED_RESPONSE_DATA_2_FRAME_1.len()); assert_eq!(&buf[..amount], EXPECTED_RESPONSE_DATA_2_FRAME_1); client.close(now(), 0, ""); }
rust_cleaned_test_functions.jsonl/101906
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1047 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19039, 643, 2459, 30456, 4096, 6615, 19691, 368, 341, 1789, 286, 1077, 320, 6984, 2943, 11, 5206, 3538, 11, 1681, 12673, 842, 8, 284, 4564, 8378, 13565, 7893, 3576, 626, 286, 442, 3624, 2033, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_derive_sha1_with_none() { let ikm = hex::decode("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c").unwrap(); let salt = None; let info = hex::decode("").unwrap(); let hkdf = Hkdf::<Sha1>::extract(salt, &ikm[..]); let mut okm = vec![0u8; 42]; assert!(hkdf.expand(&info[..], &mut okm).is_ok()); assert_eq!(hex::encode(hkdf.prk), "2adccada18779e7c2077ad2eb19d3f3e731385dd"); assert_eq!(hex::encode(okm), "2c91117204d745f3500d636a62f64f0a\ b3bae548aa53d423b0d1f27ebba6f5e5\ 673a081d70cce7acfc48"); }
rust_cleaned_test_functions.jsonl/127018
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 401 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35345, 533, 48836, 16, 6615, 31488, 368, 341, 262, 1077, 13361, 76, 284, 12371, 486, 18196, 445, 15, 66, 15, 66, 15, 66, 15, 66, 15, 66, 15, 66, 15, 66, 15, 66, 15, 66, 15, 66, 15, 66, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_analyze_index_expression() { let b = ast::BaseNode::default(); let pkg = ast::Package { base: b.clone(), path: "path".to_string(), package: "main".to_string(), files: vec![ast::File { base: b.clone(), name: "foo.flux".to_string(), package: None, imports: Vec::new(), body: vec![ast::Statement::Expr(ast::ExprStmt { base: b.clone(), expression: ast::Expression::Index(Box::new(ast::IndexExpr { base: b.clone(), array: ast::Expression::Identifier(ast::Identifier { base: b.clone(), name: "a".to_string(), }), index: ast::Expression::Integer(ast::IntegerLit { base: b.clone(), value: 3, }), })), })], }], }; let want = Package { loc: b.location.clone(), package: "main".to_string(), files: vec![File { loc: b.location.clone(), package: None, imports: Vec::new(), body: vec![Statement::Expr(ExprStmt { loc: b.location.clone(), expression: Expression::Index(Box::new(IndexExpr { loc: b.location.clone(), typ: type_info(), array: Expression::Identifier(IdentifierExpr { loc: b.location.clone(), typ: type_info(), name: "a".to_string(), }), index: Expression::Integer(IntegerLit { loc: b.location.clone(), typ: type_info(), value: 3, }), })), })], }], }; let got = test_analyze(pkg).unwrap(); assert_eq!(want, got); }
rust_cleaned_test_functions.jsonl/61569
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1420 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12008, 55856, 3560, 28068, 368, 341, 286, 1077, 293, 284, 11763, 486, 3978, 1955, 486, 2258, 543, 286, 1077, 24793, 284, 11763, 486, 13100, 341, 310, 2331, 25, 293, 15997, 3148, 310, 1815, 25, 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...
1
#[test] fn test_roundtrip() { use rand::Rng; let mut rng = rand::thread_rng(); let size = 64; let num_terrains = 8; let mut layers = LevelLayers::new((size, size), num_terrains); for _ in 0..size { for _ in 0..size / 2 { let delta = rng.gen_range(0..16) << DELTA_SHIFT1; let h0 = rng.gen(); let h1 = rng.gen(); let t0 = rng.gen_range(0..num_terrains); let t1 = rng.gen_range(0..num_terrains); layers.delta.push(delta); layers.delta.push(delta); layers.het0.push(h0); if delta != 0 { layers.het0.push(h0); layers.het1.push(h1); layers.het1.push(h1); layers.mat0.push(t0 | (t0 << 4)); layers.mat1.push(t1 | (t1 << 4)); } else { layers.het0.push(h1); layers.het1.push(h0); layers.het1.push(h1); layers.mat0.push(t0 | (t1 << 4)); layers.mat1.push(t0 | (t1 << 4)); } } } let ldata = layers.clone().export(); let mut layers2 = LevelLayers::new((size, size), num_terrains); layers2.import(&ldata); assert!(layers == layers2); }
rust_cleaned_test_functions.jsonl/76731
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 731 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29896, 32981, 368, 341, 262, 990, 10382, 486, 49, 968, 280, 262, 1077, 5206, 28422, 284, 10382, 486, 4528, 66849, 543, 262, 1077, 1379, 284, 220, 21, 19, 280, 262, 1077, 1629, 62, 68669, 1735, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_minqueue() { let vec = vec![0x23, 0x47, 0xFA, 0x7D, 0x59, 0xFF, 0xA1, 0x84]; }
rust_cleaned_test_functions.jsonl/17106
{ "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, 7260, 4584, 368, 341, 286, 1077, 7486, 284, 7486, 20703, 15, 87, 17, 18, 11, 220, 15, 87, 19, 22, 11, 220, 15, 72068, 11, 220, 15, 87, 22, 35, 11, 220, 15, 87, 20, 24, 11, 220, 15, 926...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_find_descriptor_number() { assert_eq!(find_descriptor_number("Report reference"), Some(DESCRIPTOR_NUMBERS[8])); assert_eq!(find_descriptor_number("fake descriptor name"), None); assert_eq!( find_descriptor_number("00002908-0000-1000-8000-00805F9B34FB"), Some(DESCRIPTOR_NUMBERS[8]) ); assert_eq!(find_descriptor_number("2908"), Some(DESCRIPTOR_NUMBERS[8])); assert_eq!(find_descriptor_number("zzzz"), None); }
rust_cleaned_test_functions.jsonl/46714
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 239 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 33774, 5500, 368, 341, 286, 2060, 10714, 10297, 3903, 33774, 5500, 445, 10361, 5785, 3975, 4329, 82208, 50920, 9631, 44116, 58, 23, 14382, 286, 2060, 10714, 10297, 3903, 33774, 5500, 445, 305...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_sha1_to_hex() { let data: &[u8; 20] = b"0123456789ABCDEFGHIJ"; assert_eq!(sha1_to_hex(data), encode_upper(data)); }
rust_cleaned_test_functions.jsonl/110922
{ "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, 48836, 16, 2346, 32655, 368, 341, 286, 1077, 821, 25, 44590, 84, 23, 26, 220, 17, 15, 60, 284, 293, 1, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 71286, 41, 876, 286, 2060, 10714, 10297, 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
#[test] fn test_parse_bulkstring_nil() { // actual there is no string data. // \r\n - a final CRLF. let mut raw_data = Vec::from("$-10\r\n\r\n"); let expected_value_len = raw_data.len(); raw_data.append(&mut "trash".as_bytes().to_vec()); let ParseResult { value, value_src_len } = parse_resp_value(raw_data.as_slice()).unwrap().unwrap(); assert_eq!(RespInternalValue::Nil, value); assert_eq!(expected_value_len, value_src_len); // receive an incomplete message assert!(parse_resp_value(Vec::from("$-10\r").as_mut_slice()).unwrap().is_none(), "expected Ok(None)"); // receive an incomplete message assert!(parse_resp_value(Vec::from("$-10\r\n$").as_mut_slice()).unwrap().is_none(), "expected Ok(None)"); // receive incorrect message without CRLF assert!(parse_resp_value(Vec::from("$-10\r\n%$").as_mut_slice()).is_err(), "expected Err"); }
rust_cleaned_test_functions.jsonl/85369
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 452 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 71392, 917, 36175, 368, 341, 16885, 286, 442, 5042, 1052, 374, 902, 914, 821, 624, 286, 442, 1124, 81, 1699, 481, 264, 1590, 356, 80658, 624, 286, 1077, 5206, 7112, 1769, 284, 11312, 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_recursive_wildcards() { let pat = Pattern::new("some/**/needle.txt").unwrap(); assert!(pat.matches("some/needle.txt")); assert!(pat.matches("some/one/needle.txt")); assert!(pat.matches("some/one/two/needle.txt")); assert!(pat.matches("some/other/needle.txt")); assert!(!pat.matches("some/other/notthis.txt")); // Should accept anything let pat = Pattern::new("**").unwrap(); assert!(pat.is_recursive); assert!(pat.matches("abcde")); assert!(pat.matches("")); assert!(pat.matches(".asdf")); assert!(pat.matches("/x/.asdf")); // collapse consecutive wildcards let pat = Pattern::new("some/**/**/needle.txt").unwrap(); assert!(pat.matches("some/needle.txt")); assert!(pat.matches("some/one/needle.txt")); assert!(pat.matches("some/one/two/needle.txt")); assert!(pat.matches("some/other/needle.txt")); assert!(!pat.matches("some/other/notthis.txt")); // ** can begin the pattern let pat = Pattern::new("**/test").unwrap(); assert!(pat.matches("one/two/test")); assert!(pat.matches("one/test")); assert!(pat.matches("test")); // /** can begin the pattern let pat = Pattern::new("/**/test").unwrap(); assert!(pat.matches("/one/two/test")); assert!(pat.matches("/one/test")); assert!(pat.matches("/test")); assert!(!pat.matches("/one/notthis")); assert!(!pat.matches("/notthis")); // Only start sub-patterns on start of path segment. let pat = Pattern::new("**/.*").unwrap(); assert!(pat.matches(".abc")); assert!(pat.matches("abc/.abc")); assert!(!pat.matches("ab.c")); assert!(!pat.matches("abc/ab.c")); }
rust_cleaned_test_functions.jsonl/40572
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 872 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66242, 1670, 695, 25024, 368, 341, 286, 1077, 3272, 284, 18834, 486, 931, 445, 14689, 3663, 14, 59519, 3909, 1827, 15454, 543, 286, 2060, 10297, 4676, 36480, 445, 14689, 14, 59519, 3909, 4010, 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_verification_strategies() { let invoice = r#" bindleVersion = "1.0.0" [bindle] name = "arecebo" version = "1.2.3" [[parcel]] [parcel.label] sha256 = "aaabbbcccdddeeefff" name = "telescope.gif" mediaType = "image/gif" size = 123_456 [[parcel]] [parcel.label] sha256 = "111aaabbbcccdddeee" name = "telescope.txt" mediaType = "text/plain" size = 123_456 "#; let invoice: crate::Invoice = toml::from_str(invoice).expect("a nice clean parse"); let key_creator = SecretKeyEntry::new("Test Creator".to_owned(), vec![SignatureRole::Creator]); let key_approver = SecretKeyEntry::new("Test Approver".to_owned(), vec![SignatureRole::Approver]); let key_host = SecretKeyEntry::new("Test Host".to_owned(), vec![SignatureRole::Host]); let key_proxy = SecretKeyEntry::new("Test Proxy".to_owned(), vec![SignatureRole::Proxy]); let keyring_keys = vec![ key_approver.clone().try_into().expect("convert to pubkey"), key_host.clone().try_into().expect("convert to pubkey"), key_creator.clone().try_into().expect("convert to pubkey"), key_proxy.clone().try_into().expect("convert to pubkey"), ]; let keyring = KeyRing::new(keyring_keys); // Only signed by host { let mut inv = invoice.clone(); inv.sign(SignatureRole::Host, &key_host) .expect("signed as host"); // This should fail VerificationStrategy::CreativeIntegrity .verify(inv.clone(), &keyring) .expect_err("inv should not pass: Requires creator"); VerificationStrategy::AuthoritativeIntegrity .verify(inv.clone(), &keyring) .expect_err("inv should not pass: Requires creator or approver"); VerificationStrategy::GreedyVerification .verify(inv.clone(), &keyring) .expect_err("inv should not pass: Requires creator and all valid"); VerificationStrategy::MultipleAttestationGreedy(vec![SignatureRole::Host]) .verify(inv.clone(), &keyring) .expect("inv should pass: Only requires host"); VerificationStrategy::MultipleAttestationGreedy(vec![ SignatureRole::Host, SignatureRole::Proxy, ]) .verify(inv.clone(), &keyring) .expect_err("inv should not pass: Requires proxy"); VerificationStrategy::ExhaustiveVerification .verify(inv, &keyring) .expect("inv should not pass: Requires that all signatures must be verified"); } // Signed by creator and host { let mut inv = invoice.clone(); inv.sign(SignatureRole::Host, &key_host) .expect("signed as host"); inv.sign(SignatureRole::Creator, &key_creator) .expect("signed as creator"); // This should fail VerificationStrategy::CreativeIntegrity .verify(inv.clone(), &keyring) .expect("inv should pass: Signed by creator"); VerificationStrategy::AuthoritativeIntegrity .verify(inv.clone(), &keyring) .expect("inv should pass: Signed by creator"); VerificationStrategy::GreedyVerification .verify(inv.clone(), &keyring) .expect("inv should pass: Requires creator and all valid"); VerificationStrategy::MultipleAttestationGreedy(vec![SignatureRole::Host]) .verify(inv.clone(), &keyring) .expect("inv should pass: Only requires host"); VerificationStrategy::MultipleAttestationGreedy(vec![ SignatureRole::Host, SignatureRole::Proxy, ]) .verify(inv.clone(), &keyring) .expect_err("inv should not pass: Requires proxy"); VerificationStrategy::ExhaustiveVerification .verify(inv, &keyring) .expect("inv should not pass: Requires that all signatures must be verified"); } // Signed by approver and host { let mut inv = invoice.clone(); inv.sign(SignatureRole::Host, &key_host) .expect("signed as host"); inv.sign(SignatureRole::Approver, &key_approver) .expect("signed as approver"); // This should fail VerificationStrategy::CreativeIntegrity .verify(inv.clone(), &keyring) .expect_err("inv should not pass: not signed by creator"); VerificationStrategy::AuthoritativeIntegrity .verify(inv.clone(), &keyring) .expect("inv should pass: Signed by approver"); VerificationStrategy::GreedyVerification .verify(inv.clone(), &keyring) .expect_err("inv should not pass: Requires creator and all valid"); VerificationStrategy::MultipleAttestationGreedy(vec![SignatureRole::Host]) .verify(inv.clone(), &keyring) .expect("inv should pass: Only requires host"); VerificationStrategy::MultipleAttestationGreedy(vec![ SignatureRole::Host, SignatureRole::Proxy, ]) .verify(inv.clone(), &keyring) .expect_err("inv should not pass: Requires proxy"); VerificationStrategy::ExhaustiveVerification .verify(inv, &keyring) .expect("inv should not pass: Requires that all signatures must be verified"); } { let mut inv = invoice.clone(); inv.sign(SignatureRole::Host, &key_host) .expect("signed as host"); inv.sign(SignatureRole::Creator, &key_creator) .expect("signed as creator"); inv.sign(SignatureRole::Proxy, &key_proxy) .expect("signed as proxy"); // This should fail VerificationStrategy::CreativeIntegrity .verify(inv.clone(), &keyring) .expect("inv should pass: signed by creator"); VerificationStrategy::AuthoritativeIntegrity .verify(inv.clone(), &keyring) .expect("inv should pass: Signed by creator"); VerificationStrategy::GreedyVerification .verify(inv.clone(), &keyring) .expect("inv should pass: Requires creator and all valid"); VerificationStrategy::MultipleAttestationGreedy(vec![SignatureRole::Host]) .verify(inv.clone(), &keyring) .expect("inv should pass: Only requires host"); VerificationStrategy::MultipleAttestationGreedy(vec![ SignatureRole::Host, SignatureRole::Proxy, ]) .verify(inv.clone(), &keyring) .expect("inv should pass: Requires proxy"); VerificationStrategy::ExhaustiveVerification .verify(inv, &keyring) .expect("inv should pass: Requires that all signatures must be verified"); } println!("Signed by creator, host, and unknown key"); { let mut inv = invoice; inv.sign(SignatureRole::Host, &key_host) .expect("signed as host"); inv.sign(SignatureRole::Creator, &key_creator) .expect("signed as creator"); // Mock an unknown key and don't add it to keyring let key_anon = SecretKeyEntry::new("Unknown key".to_owned(), vec![SignatureRole::Approver]); inv.sign(SignatureRole::Approver, &key_anon) .expect("signed with unknown key"); // This should fail VerificationStrategy::CreativeIntegrity .verify(inv.clone(), &keyring) .expect("inv should pass: signed by creator"); VerificationStrategy::AuthoritativeIntegrity .verify(inv.clone(), &keyring) .expect("inv should pass: Signed by creator"); VerificationStrategy::GreedyVerification .verify(inv.clone(), &keyring) .expect_err( "inv should not pass: Requires creator and all known, anon is not known", ); VerificationStrategy::MultipleAttestation(vec![SignatureRole::Host]) .verify(inv.clone(), &keyring) .expect("inv should pass: Only requires host"); VerificationStrategy::MultipleAttestationGreedy(vec![ SignatureRole::Host, SignatureRole::Approver, ]) .verify(inv.clone(), &keyring) .expect_err("inv should not pass: Requires approver to be known"); VerificationStrategy::ExhaustiveVerification .verify(inv, &keyring) .expect_err("inv should not pass: Requires that all signatures must be verified"); } }
rust_cleaned_test_functions.jsonl/125392
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4417 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84245, 2895, 69388, 368, 341, 286, 1077, 24615, 284, 435, 2, 698, 286, 10719, 273, 5637, 284, 330, 16, 13, 15, 13, 15, 1837, 286, 508, 7666, 273, 921, 286, 829, 284, 330, 546, 346, 749, 698,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_regression() { check!(4.7223665e21); check!(8388608.0); check!(16777216.0); check!(33554436.0); check!(67131496.0); check!(1.9310392e-38); check!(-2.47e-43); check!(1.993244e-38); check!(4103.9004); check!(5339999700.0); check!(6.0898e-39); check!(0.0010310042); check!(2.882326e17); check!(7.038531e-26); check!(9.223404e17); check!(67108870.0); check!(1e-44); check!(2.816025e14); check!(9.223372e18); check!(1.5846086e29); check!(1.1811161e19); check!(5.368709e18); check!(4.6143166e18); check!(0.007812537); check!(1e-45); check!(1.18697725e20); check!(1.00014165e-36); check!(200.0); check!(33554432.0); }
rust_cleaned_test_functions.jsonl/58240
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 434 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 91144, 368, 341, 262, 1779, 10297, 19, 13, 22, 17, 17, 18, 21, 21, 20, 68, 17, 16, 317, 262, 1779, 10297, 23, 18, 23, 23, 21, 15, 23, 13, 15, 317, 262, 1779, 10297, 16, 21, 22, 22, 22,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ipv4_only_toml_startup() { named_test_harness("ipv4_only.toml", |_, tcp_port, _, _| { let mut io_loop = Runtime::new().unwrap(); let addr: SocketAddr = SocketAddr::new( Ipv4Addr::new(127, 0, 0, 1).into(), tcp_port.expect("no tcp_port"), ); let (stream, sender) = TcpClientStream::<AsyncIoTokioAsStd<TokioTcpStream>>::new(addr); let client = AsyncClient::new(Box::new(stream), sender, None); let (mut client, bg) = io_loop.block_on(client).expect("client failed to connect"); trust_dns_proto::spawn_bg(&io_loop, bg); // ipv4 should succeed query_a(&mut io_loop, &mut client); let addr: SocketAddr = SocketAddr::new( Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1).into(), tcp_port.expect("no tcp_port"), ); let (stream, sender) = TcpClientStream::<AsyncIoTokioAsStd<TokioTcpStream>>::new(addr); let client = AsyncClient::new(Box::new(stream), sender, None); assert!(io_loop.block_on(client).is_err()); // ipv6 should fail }) }
rust_cleaned_test_functions.jsonl/88396
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 573 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49378, 19, 18410, 528, 316, 75, 80858, 368, 341, 262, 6941, 4452, 1523, 23518, 445, 42676, 19, 18410, 73494, 75, 497, 760, 6878, 28051, 8716, 11, 8358, 85137, 341, 286, 1077, 5206, 6399, 17198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_path_expr() { check_assist( inline_local_variable, r" fn foo() { let d = 10; let a$0 = d; let b = a * 10; let c = a as usize; }", r" fn foo() { let d = 10; let b = d * 10; let c = d as usize; }", ); }
rust_cleaned_test_functions.jsonl/3238
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 183 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2638, 21915, 368, 341, 286, 1779, 12083, 380, 1006, 310, 7381, 13564, 14635, 345, 310, 435, 698, 8822, 15229, 368, 341, 262, 1077, 294, 284, 220, 16, 15, 280, 262, 1077, 264, 3, 15, 284, 294, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_auth_header_by_key() { let response = auth_header_by_key(String::from("username"), AuthHeader { authorization: String::from("my bearer token"), roles: vec![String::from("admin")], subject: String::from("1234-1234-1234-1234"), token: String::from("my bearer token"), username: String::from("myUsername") }); assert!( response.is_some() ); assert_eq!( response.unwrap().0, String::from("myUsername") ); }
rust_cleaned_test_functions.jsonl/53100
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 284 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14014, 8757, 3710, 3097, 368, 341, 286, 1077, 2033, 284, 4166, 8757, 3710, 3097, 2242, 486, 1499, 445, 5113, 3975, 7366, 4047, 341, 310, 23715, 25, 923, 486, 1499, 445, 2408, 69771, 3950, 4461, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_duplicated_metrics_in_one_request() { let mut runner = Runner::new(); // Attempt to start logging CPU Load twice. The request should fail as the logging request // contains duplicated metric type. let mut query = runner.proxy.start_logging( "test", &mut vec![ &mut Metric::CpuLoad(CpuLoad { interval_ms: 100 }), &mut Metric::CpuLoad(CpuLoad { interval_ms: 100 }), ] .into_iter(), 200, false, false, ); assert_matches!( runner.executor.run_until_stalled(&mut query), Poll::Ready(Ok(Err(fmetrics::MetricsLoggerError::DuplicatedMetric))) ); }
rust_cleaned_test_functions.jsonl/66698
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 382 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 814, 98984, 37686, 1243, 11667, 7893, 368, 341, 286, 1077, 5206, 22259, 284, 44946, 486, 931, 1428, 286, 442, 43517, 311, 1191, 8392, 13940, 8893, 10917, 13, 576, 1681, 1265, 3690, 438, 279, 8392,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_index_key_codec() { let tests = vec![ Datum::U64(1), Datum::Bytes(b"123".to_vec()), Datum::I64(-1), Datum::Dur(Duration::parse(&mut EvalContext::default(), "12:34:56.666", 2).unwrap()), ]; let mut duration_col = ColumnInfo::default(); duration_col .as_mut_accessor() .set_tp(FieldTypeTp::Duration) .set_decimal(2); let types = vec![ FieldTypeTp::LongLong.into(), FieldTypeTp::VarChar.into(), FieldTypeTp::LongLong.into(), duration_col, ]; let mut ctx = EvalContext::default(); let buf = datum::encode_key(&mut ctx, &tests).unwrap(); let encoded = encode_index_seek_key(1, 2, &buf); assert_eq!(tests, decode_index_key(&mut ctx, &encoded, &types).unwrap()); }
rust_cleaned_test_functions.jsonl/4804
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 465 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3560, 3097, 51084, 368, 341, 286, 1077, 7032, 284, 7486, 90515, 310, 68459, 486, 52, 21, 19, 7, 16, 1326, 310, 68459, 486, 7078, 1883, 1, 16, 17, 18, 3263, 983, 13251, 14702, 310, 68459, 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_extract_config_data_ignores_services_defined_by_non_config_meta_contents() { // Create a single package that IS the config data package but let mock_reader: Box<dyn PackageReader> = Box::new(MockPackageReader::new()); let mut contents = HashMap::new(); contents.insert(String::from("not/valid/config"), String::from("test_merkle")); let pkg = create_test_package_with_contents(String::from(CONFIG_DATA_PKG_URL), contents); let served = vec![pkg]; let collector = PackageDataCollector::default(); let result = collector.extract_config_data(&mock_reader, &served).unwrap(); assert_eq!(0, result.services.len()); assert_eq!(0, result.apps.len()) }
rust_cleaned_test_functions.jsonl/19455
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 302 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39123, 5332, 1769, 62, 622, 4589, 39846, 52870, 3710, 21637, 5332, 13381, 16682, 368, 341, 286, 442, 4230, 264, 3175, 6328, 429, 3424, 279, 2193, 821, 6328, 714, 8945, 286, 1077, 7860, 22306, 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_zip_next_back_side_effects_exhausted() { let mut a = Vec::new(); let mut b = Vec::new(); let mut iter = [1, 2, 3, 4, 5, 6] .iter() .cloned() .map(|n| { a.push(n); n * 10 }) .zip([2, 3, 4].iter().cloned().map(|n| { b.push(n * 100); n * 1000 })); iter.next(); iter.next(); iter.next(); iter.next(); assert_eq!(iter.next_back(), None); assert_eq!(a, vec![1, 2, 3, 4, 6, 5]); assert_eq!(b, vec![200, 300, 400]); }
rust_cleaned_test_functions.jsonl/8962
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 324 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42131, 11257, 3895, 30862, 83171, 2702, 15074, 291, 368, 341, 262, 1077, 5206, 264, 284, 11312, 486, 931, 543, 262, 1077, 5206, 293, 284, 11312, 486, 931, 543, 262, 1077, 5206, 5367, 284, 508, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_min_max() { let b = Box3D::from_points(&[point3(50.0, 25.0, 12.5), point3(100.0, 160.0, 200.0)]); assert!(b.min.x == 50.0); assert!(b.min.y == 25.0); assert!(b.min.z == 12.5); assert!(b.max.x == 100.0); assert!(b.max.y == 160.0); assert!(b.max.z == 200.0); }
rust_cleaned_test_functions.jsonl/7480
{ "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, 7260, 6345, 368, 341, 286, 1077, 293, 284, 8261, 18, 35, 486, 1499, 12928, 2099, 58, 2768, 18, 7, 20, 15, 13, 15, 11, 220, 17, 20, 13, 15, 11, 220, 16, 17, 13, 20, 701, 1459, 18, 7, 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_dcx_d_low() { let mut state = State8080::empty_state(); state.memory = vec![0x1b]; state.d = 0x00; state.e = 0x01; emulate_8080_op(&mut state); assert_eq!(state.d, 0x00); assert_eq!(state.e, 0x00); }
rust_cleaned_test_functions.jsonl/7755
{ "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, 814, 25844, 814, 23767, 368, 341, 286, 1077, 5206, 1584, 284, 3234, 23, 15, 23, 15, 486, 3194, 4387, 543, 286, 1584, 36611, 284, 7486, 20703, 15, 87, 16, 65, 935, 286, 1584, 950, 284, 220, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_doc_freq() { let docs = SegmentPostings::create_from_docs(&[0, 2, 10]); assert_eq!(docs.doc_freq(), 3); let delete_bitset = DeleteBitSet::for_test(&[2], 12); assert_eq!(docs.doc_freq_given_deletes(&delete_bitset), 2); let all_deleted = DeleteBitSet::for_test(&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], 12); assert_eq!(docs.doc_freq_given_deletes(&all_deleted), 0); }
rust_cleaned_test_functions.jsonl/33895
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 216 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18869, 21790, 368, 341, 286, 1077, 26340, 284, 37103, 4133, 819, 486, 3182, 5673, 49692, 2099, 58, 15, 11, 220, 17, 11, 220, 16, 15, 2558, 286, 2060, 10714, 10297, 14120, 23671, 21790, 1507, 220...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_lockup_is_expired() { let custodian = solana_sdk::pubkey::new_rand(); let lockup = Lockup { epoch: 1, unix_timestamp: 1, custodian, }; // neither time assert!(lockup.is_in_force( &Clock { epoch: 0, unix_timestamp: 0, ..Clock::default() }, None )); // not timestamp assert!(lockup.is_in_force( &Clock { epoch: 2, unix_timestamp: 0, ..Clock::default() }, None )); // not epoch assert!(lockup.is_in_force( &Clock { epoch: 0, unix_timestamp: 2, ..Clock::default() }, None )); assert!(!lockup.is_in_force( &Clock { epoch: 1, unix_timestamp: 1, ..Clock::default() }, None )); assert!(!lockup.is_in_force( &Clock { epoch: 0, unix_timestamp: 0, ..Clock::default() }, Some(&custodian), )); }
rust_cleaned_test_functions.jsonl/87031
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 862 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9818, 454, 6892, 80221, 368, 341, 286, 1077, 16564, 63849, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 5296, 454, 284, 15701, 454, 341, 310, 16342, 25, 220, 16, 345,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_counter() { struct Service { counter: usize, } impl Service { fn init() -> Self { Service { counter: 0 } } #[candid_method] fn inc(&mut self) { self.counter += 1; } #[candid_method(query)] fn read(&self) -> usize { self.counter } } candid::export_service!(); let expected = "service : { inc : () -> (); read : () -> (nat64) query }"; assert_eq!(expected, __export_service()); }
rust_cleaned_test_functions.jsonl/103097
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 266 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15730, 368, 341, 262, 2036, 5362, 341, 286, 5546, 25, 22301, 345, 262, 456, 262, 11605, 5362, 341, 286, 5168, 2930, 368, 1464, 10115, 341, 310, 5362, 314, 5546, 25, 220, 15, 456, 286, 456, 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_add_two_numbers() { let mut n1 = ListNode::new(9); n1.append(9); n1.append(9); n1.append(9); n1.append(9); n1.append(9); n1.append(9); let l1 = Some(Box::new(n1)); let mut n2 = ListNode::new(9); n2.append(9); n2.append(9); n2.append(9); let l2 = Some(Box::new(n2)); let result = Solution::add_two_numbers(l1, l2); let mut nums = vec![]; let mut node = result.unwrap(); loop { nums.push(node.val); if node.next.is_none() { break; } node = node.next.unwrap(); } assert_eq!(nums, vec![8, 9, 9, 9, 0, 0, 0, 1]); }
rust_cleaned_test_functions.jsonl/6797
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 453 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 23241, 32964, 368, 341, 286, 1077, 5206, 308, 16, 284, 20501, 486, 931, 7, 24, 317, 286, 308, 16, 2057, 7, 24, 317, 286, 308, 16, 2057, 7, 24, 317, 286, 308, 16, 2057, 7, 24, 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_app_try_into_app() { let app = App { client_name: "foo-test".to_string(), redirect_uris: "http://example.com".to_string(), scopes: Scopes::all(), website: None, }; let expected = app.clone(); let result = app.try_into().expect("Couldn't make App into App"); assert_eq!(expected, result); }
rust_cleaned_test_functions.jsonl/51209
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 199 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8191, 53283, 45514, 8191, 368, 341, 286, 1077, 906, 284, 1845, 341, 310, 2943, 1269, 25, 330, 7975, 16839, 3263, 983, 3904, 3148, 310, 6423, 64879, 285, 25, 330, 1254, 1110, 8687, 905, 3263, 983...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_generic_message_json_msg_should_be_parsed_as_generic() -> Result<(), String> { let message = json!({ "@id": "some id", "@type": "some type", "content": "some content" }).to_string(); let result = Connection::parse_generic_message(&message, ""); match result { A2AMessage::Generic(value) => { assert_eq!(value.to_string(), message); Ok(()) } other => Err(format!("Result is not Generic, but: {:?}", other)) } }
rust_cleaned_test_functions.jsonl/103831
{ "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, 21039, 41232, 6462, 9455, 6483, 43378, 21263, 75788, 11898, 41232, 368, 1464, 5714, 68843, 923, 29, 341, 286, 1077, 1943, 284, 2951, 0, 2262, 310, 8428, 307, 788, 330, 14689, 877, 756, 310, 8428, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_find_older_frozen_slots() { let cache = AccountsCache::default(); assert!(cache.find_older_frozen_slots(0).is_empty()); let inserted_slot = 0; cache.store( inserted_slot, &Pubkey::new_unique(), AccountSharedData::new(1, 0, &Pubkey::default()), Some(&Hash::default()), ); // one cached slot assert!(cache.find_older_frozen_slots(1).is_empty()); // frozen slots assert!(cache.find_older_frozen_slots(0).is_empty()); cache.slot_cache(inserted_slot).unwrap().mark_slot_frozen(); assert_eq!(cache.find_older_frozen_slots(0), vec![inserted_slot]); }
rust_cleaned_test_functions.jsonl/28541
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 377 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 62, 2018, 761, 42240, 54161, 368, 341, 286, 1077, 6500, 284, 40655, 8233, 486, 2258, 543, 1789, 286, 2060, 10297, 9360, 2658, 62, 2018, 761, 42240, 54161, 7, 15, 568, 285, 15124, 1423, 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_extract_var_path_simple() { check_assist( extract_variable, " fn main() { let o = $0Some(true)$0; } ", " fn main() { let $0var_name = Some(true); let o = var_name; } ", ); }
rust_cleaned_test_functions.jsonl/132837
{ "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, 39123, 4612, 2638, 30015, 368, 341, 286, 1779, 12083, 380, 1006, 310, 8649, 14635, 345, 310, 6228, 8822, 1887, 368, 341, 262, 1077, 297, 284, 400, 15, 8373, 3715, 15087, 15, 280, 532, 756, 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_csp_msdn() { let json = r#"{ "csp-report": { "document-uri": "https://example.com/foo/bar", "referrer": "https://www.google.com/", "violated-directive": "default-src self", "original-policy": "default-src self; report-uri /csp-hotline.php", "blocked-uri": "http://evilhackerscripts.com" } }"#; let mut event = Event::default(); Csp::apply_to_event(json.as_bytes(), &mut event).unwrap(); assert_annotated_snapshot!(Annotated::new(event), @r###" { "culprit": "default-src self", "logentry": { "formatted": "Blocked 'default-src' from 'evilhackerscripts.com'" }, "request": { "url": "https://example.com/foo/bar", "headers": [ [ "Referer", "https://www.google.com/" ] ] }, "tags": [ [ "effective-directive", "default-src" ], [ "blocked-uri", "http://evilhackerscripts.com" ] ], "csp": { "effective_directive": "default-src", "blocked_uri": "http://evilhackerscripts.com", "document_uri": "https://example.com/foo/bar", "original_policy": "default-src self; report-uri /csp-hotline.php", "referrer": "https://www.google.com/", "violated_directive": "default-src self" } } "###); }
rust_cleaned_test_functions.jsonl/4018
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 943 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 2154, 717, 13446, 77, 368, 341, 286, 1077, 2951, 284, 435, 55543, 515, 310, 330, 66, 2154, 47411, 788, 341, 394, 330, 6062, 87232, 788, 330, 2428, 1110, 8687, 905, 60555, 49513, 756, 394, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_star_network_large_pull() { solana_logger::setup(); let mut network = star_network_create(2000); network_simulator_pull_only(&mut network); }
rust_cleaned_test_functions.jsonl/1103
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 69 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31681, 20966, 45228, 65693, 368, 341, 262, 2048, 3362, 27413, 486, 15188, 543, 262, 1077, 5206, 3922, 284, 6774, 20966, 8657, 7, 17, 15, 15, 15, 317, 262, 3922, 18314, 10511, 65693, 18410, 2099, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_valid_cant_fry() { let floors: Vec<BTreeSet<ScienceThing>> = vec![ [ gen("thulium"), chip("strontium") ].iter().cloned().collect(), ]; assert_eq!(false, is_valid(&floors)); }
rust_cleaned_test_functions.jsonl/55908
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 96 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 8337, 666, 517, 761, 884, 368, 341, 10217, 25945, 25, 11312, 32519, 6533, 1649, 27, 35400, 52940, 2452, 284, 7486, 90515, 197, 197, 9640, 298, 82281, 445, 339, 360, 2356, 3975, 16392, 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_duration_as_decimal() { test_none_with_ctx_and_extra(cast_any_as_decimal::<Duration>); let mut ctx = EvalContext::default(); // TODO: add more test case let cs: Vec<(Duration, bool, bool, Decimal)> = vec![ ( Duration::parse(&mut ctx, "17:51:04.78", 2).unwrap(), false, false, Decimal::from_f64(175104.78).unwrap(), ), ( Duration::parse(&mut ctx, "-17:51:04.78", 2).unwrap(), false, false, Decimal::from_f64(-175104.78).unwrap(), ), ( Duration::parse(&mut ctx, "17:51:04.78", 0).unwrap(), false, false, Decimal::from(175105), ), ( Duration::parse(&mut ctx, "-17:51:04.78", 0).unwrap(), false, false, Decimal::from(-175105), ), ]; test_as_decimal_helper( cs, cast_closure_with_metadata!(cast_any_as_decimal::<Duration>), |x| x.to_string(), "cast_duration_as_int", ) }
rust_cleaned_test_functions.jsonl/1987
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 773 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25454, 11898, 74429, 368, 341, 286, 1273, 31488, 6615, 15147, 8378, 31858, 1337, 559, 37248, 11898, 74429, 27638, 12945, 42013, 286, 1077, 5206, 5635, 284, 58239, 1972, 486, 2258, 543, 286, 442, 534...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_show_element_expand_visible_parent() { let items = vec![ Path::new("a/b"), ]; //0 a/ //1 b let mut tree = FileTreeItems::new(&items, &BTreeSet::new()).unwrap(); tree.collapse(0, true); assert_eq!( get_visibles(&tree), vec![ true, false, ] ); let res = tree.show_element(1).unwrap(); assert_eq!(res, 1); assert!(tree.tree_items[0].kind().is_path()); assert!(!tree.tree_items[0].kind().is_path_collapsed()); assert_eq!( get_visibles(&tree), vec![ true, true, ] ); }
rust_cleaned_test_functions.jsonl/129800
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 288 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15267, 7894, 67875, 34371, 15960, 368, 341, 197, 10217, 3589, 284, 7486, 90515, 298, 69640, 486, 931, 445, 64, 3470, 3975, 715, 197, 197, 4821, 197, 197, 322, 15, 264, 5894, 197, 197, 322, 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_new_with_no_fee() { for compute_units in [0, 1, MICRO_LAMPORTS_PER_LAMPORT, u64::MAX] { assert_eq!( FeeDetails::new(FeeType::ComputeUnitPrice(0), compute_units), FeeDetails::default(), ); assert_eq!( FeeDetails::new(FeeType::Deprecated(0), compute_units), FeeDetails::default(), ); } }
rust_cleaned_test_functions.jsonl/28260
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 246 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 6615, 6536, 34305, 368, 341, 286, 369, 12564, 28345, 304, 508, 15, 11, 220, 16, 11, 86165, 2351, 1402, 5095, 50, 10617, 2351, 1402, 5095, 11, 575, 21, 19, 486, 10586, 60, 341, 310, 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...
2
#[test] fn test_tokenizer_1() { test_tokenizer( "(* 12 -15)", vec![ TokenValue::Char('('), TokenValue::Ident("*".to_string()), TokenValue::Int(12), TokenValue::Int(-15), TokenValue::Char(')'), ], ); }
rust_cleaned_test_functions.jsonl/59080
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 213 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6458, 3135, 62, 16, 368, 341, 286, 1273, 6458, 3135, 1006, 310, 330, 4071, 220, 16, 17, 481, 16, 20, 15752, 310, 7486, 90515, 394, 9660, 1130, 486, 4768, 89856, 1326, 394, 9660, 1130, 486, 283...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_lea() { assert_emit!(0x48, 0x8d, 0x04, 0xc5, 0, 0, 0, 0; lea(RAX, Mem::Offset(RAX, 8, 0))); assert_emit!(0x48, 0x8d, 0x04, 0xc5, 0x10, 0, 0, 0; lea(RAX, Mem::Offset(RAX, 8, 16))); assert_emit!(0x4c, 0x8d, 0x0c, 0xc5, 0x10, 0, 0, 0; lea(R9, Mem::Offset(RAX, 8, 16))); assert_emit!(0x4a, 0x8d, 0x04, 0xcd, 0x10, 0, 0, 0; lea(RAX, Mem::Offset(R9, 8, 16))); }
rust_cleaned_test_functions.jsonl/85510
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 380 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11751, 64, 368, 341, 1789, 286, 2060, 69082, 10297, 15, 87, 19, 23, 11, 220, 15, 87, 23, 67, 11, 220, 15, 87, 15, 19, 11, 220, 15, 8148, 20, 11, 220, 15, 11, 220, 15, 11, 220, 15, 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, 1, 1, 1, 1, 1...
1
#[test] fn test_account_checked_sub_tocks_underflow() { let key = Pubkey::new_unique(); let (mut account1, _account2) = make_two_accounts(&key); account1.checked_sub_tocks(u64::MAX).unwrap(); }
rust_cleaned_test_functions.jsonl/56005
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 104 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13500, 56456, 5228, 528, 25183, 58228, 4965, 368, 341, 286, 1077, 1376, 284, 22611, 792, 486, 931, 21218, 543, 286, 1077, 320, 6984, 2692, 16, 11, 716, 4608, 17, 8, 284, 1281, 23241, 55665, 2099...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_leaf_hash() { { let address = HashValue::random(); let blob = AccountStateBlob::from(vec![0x02]); let value_hash = blob.hash(); let hash = hash_leaf(address, value_hash); let leaf_node = Node::new_leaf(address, blob); assert_eq!(leaf_node.hash(), hash); } }
rust_cleaned_test_functions.jsonl/56487
{ "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, 38909, 8950, 368, 341, 262, 341, 286, 1077, 2621, 284, 6531, 1130, 486, 11463, 543, 286, 1077, 23404, 284, 8615, 1397, 37985, 486, 1499, 25592, 20703, 15, 87, 15, 17, 2558, 286, 1077, 897, 8950,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_closing_tag_mismatch_err() { // no closing tag let xml = "<img>"; let mut opts = ReadOptions::default(); opts.require_decl = false; let doc = Document::parse_str_with_opts(xml, opts.clone()); assert!(matches!(doc.unwrap_err(), Error::MalformedXML(_))); // closing tag mismatch let xml = "<a><img>Te</a>xt</img>"; let doc = Document::parse_str_with_opts(xml, opts.clone()); assert!(matches!(doc.unwrap_err(), Error::MalformedXML(_))); // no opening tag let xml = "</abc>"; let doc = Document::parse_str_with_opts(xml, opts.clone()); assert!(matches!(doc.unwrap_err(), Error::MalformedXML(_))); }
rust_cleaned_test_functions.jsonl/74416
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 279 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 17831, 9372, 717, 24976, 9266, 368, 341, 262, 442, 902, 15316, 4772, 198, 262, 1077, 8396, 284, 4055, 1892, 6734, 262, 1077, 5206, 12185, 284, 4457, 3798, 486, 2258, 543, 262, 12185, 23712, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_deserde_init() { let json = r#" {"buffer_id": 42, "views": ["view-id-4"], "rev": 1, "buf_size": 20, "nb_lines": 5, "path": "some_path", "syntax": "toml", "config": {"some_key": 420}}"#; let val: PluginBufferInfo = match serde_json::from_str(json) { Ok(val) => val, Err(err) => panic!("{:?}", err), }; assert_eq!(val.rev, 1); assert_eq!(val.path, Some("some_path".to_owned())); assert_eq!(val.syntax, "toml".into()); }
rust_cleaned_test_functions.jsonl/35884
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 362 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15768, 86805, 6137, 368, 341, 286, 1077, 2951, 284, 435, 2, 698, 310, 5212, 7573, 842, 788, 220, 19, 17, 345, 1797, 330, 5072, 788, 4383, 1050, 12897, 12, 19, 8097, 1797, 330, 7282, 788, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_bilinearity() { let mut rng = test_rng(); let a: G1Projective = rng.gen(); let b: G2Projective = rng.gen(); let s: Fr = rng.gen(); let sa = a.mul(s.into_repr()); let sb = b.mul(s.into_repr()); let ans1 = CP6_782::pairing(sa, b); let ans2 = CP6_782::pairing(a, sb); let ans3 = CP6_782::pairing(a, b).pow(s.into_repr()); assert_eq!(ans1, ans2); assert_eq!(ans2, ans3); assert_ne!(ans1, Fq6::one()); assert_ne!(ans2, Fq6::one()); assert_ne!(ans3, Fq6::one()); assert_eq!(ans1.pow(Fr::characteristic()), Fq6::one()); assert_eq!(ans2.pow(Fr::characteristic()), Fq6::one()); assert_eq!(ans3.pow(Fr::characteristic()), Fq6::one()); }
rust_cleaned_test_functions.jsonl/15280
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 359 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 26560, 10748, 368, 341, 262, 1077, 5206, 28422, 284, 1273, 66849, 543, 262, 1077, 264, 25, 479, 16, 7849, 533, 284, 28422, 22822, 543, 262, 1077, 293, 25, 479, 17, 7849, 533, 284, 28422, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_gen_ascii_str() { let mut r = thread_rng(); assert_eq!(r.gen_ascii_chars().take(0).count(), 0); assert_eq!(r.gen_ascii_chars().take(10).count(), 10); assert_eq!(r.gen_ascii_chars().take(16).count(), 16); }
rust_cleaned_test_functions.jsonl/76076
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 141 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16322, 50238, 2895, 368, 341, 286, 1077, 5206, 435, 284, 4516, 66849, 543, 286, 2060, 10714, 10297, 81, 22822, 50238, 37418, 1005, 22769, 7, 15, 568, 1830, 1507, 220, 15, 317, 286, 2060, 10714, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_child() { let parsed: Expression = from_str("abcd.efgh").unwrap(); let expected = Child(Box::new(Identifier("abcd".into())), "efgh".into()); assert_eq!(parsed, expected); let parsed: Expression = from_str("abcd.efgh.ijkl").unwrap(); let expected = Child( Box::new(Child(Box::new(Identifier("abcd".into())), "efgh".into())), "ijkl".into(), ); assert_eq!(parsed, expected); }
rust_cleaned_test_functions.jsonl/127053
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 225 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17268, 368, 341, 286, 1077, 15676, 25, 16378, 284, 504, 2895, 445, 68644, 95856, 866, 1827, 15454, 543, 286, 1077, 3601, 284, 9391, 67758, 486, 931, 7, 8714, 445, 68644, 3263, 18122, 96501, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_state_packing() { let max_validators = 10_000; let size = get_instance_packed_len(&ValidatorList::new(max_validators)).unwrap(); // Not initialized let stake_list = ValidatorList { account_type: AccountType::Uninitialized, max_validators: 0, validators: vec![], }; let mut byte_vec = vec![0u8; size]; let mut bytes = byte_vec.as_mut_slice(); stake_list.serialize(&mut bytes).unwrap(); let stake_list_unpacked = try_from_slice_unchecked::<ValidatorList>(&byte_vec).unwrap(); assert_eq!(stake_list_unpacked, stake_list); // Empty let stake_list = ValidatorList { account_type: AccountType::ValidatorList, max_validators: 0, validators: vec![], }; let mut byte_vec = vec![0u8; size]; let mut bytes = byte_vec.as_mut_slice(); stake_list.serialize(&mut bytes).unwrap(); let stake_list_unpacked = try_from_slice_unchecked::<ValidatorList>(&byte_vec).unwrap(); assert_eq!(stake_list_unpacked, stake_list); // With several accounts let stake_list = ValidatorList { account_type: AccountType::ValidatorList, max_validators, validators: vec![ ValidatorStakeInfo { status: StakeStatus::Active, vote_account_address: Pubkey::new_from_array([1; 32]), stake_lamports: 123456789, last_update_epoch: 987654321, }, ValidatorStakeInfo { status: StakeStatus::DeactivatingTransient, vote_account_address: Pubkey::new_from_array([2; 32]), stake_lamports: 998877665544, last_update_epoch: 11223445566, }, ValidatorStakeInfo { status: StakeStatus::ReadyForRemoval, vote_account_address: Pubkey::new_from_array([3; 32]), stake_lamports: 0, last_update_epoch: 999999999999999, }, ], }; let mut byte_vec = vec![0u8; size]; let mut bytes = byte_vec.as_mut_slice(); stake_list.serialize(&mut bytes).unwrap(); let stake_list_unpacked = try_from_slice_unchecked::<ValidatorList>(&byte_vec).unwrap(); assert_eq!(stake_list_unpacked, stake_list); }
rust_cleaned_test_functions.jsonl/5724
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1277 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4387, 620, 8985, 368, 341, 286, 1077, 1932, 8337, 2973, 284, 220, 16, 15, 62, 15, 15, 15, 280, 286, 1077, 1379, 284, 633, 11904, 620, 11191, 6043, 2099, 14256, 852, 486, 931, 8739, 8337, 2973,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_delete_default() { let b = Delete::new().add_run(Run::new()).build(); assert_eq!( str::from_utf8(&b).unwrap(), r#"<w:del w:id="123" w:author="unnamed" w:date="1970-01-01T00:00:00Z"><w:r><w:rPr /></w:r></w:del>"# ); }
rust_cleaned_test_functions.jsonl/27932
{ "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, 11353, 9993, 368, 341, 286, 1077, 293, 284, 10428, 486, 931, 1005, 718, 14007, 2785, 359, 486, 931, 6011, 5834, 543, 286, 2060, 10714, 33673, 310, 607, 486, 1499, 39453, 23, 2099, 65, 568, 15454...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_wrap_return_type_handles_generic_functions() { check_fix( r#" //- /main.rs crate:main deps:core use core::result::Result::{self, Ok, Err}; fn div<T>(x: T) -> Result<T, i32> { if x == 0 { return Err(7); } <|>x } //- /core/lib.rs crate:core pub mod result { pub enum Result<T, E> { Ok(T), Err(E) } } "#, r#" use core::result::Result::{self, Ok, Err}; fn div<T>(x: T) -> Result<T, i32> { if x == 0 { return Err(7); } Ok(x) } "#, ); }
rust_cleaned_test_functions.jsonl/11418
{ "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, 38550, 12511, 1819, 68017, 41232, 31708, 368, 341, 286, 1779, 36060, 1006, 310, 435, 2, 698, 61463, 608, 3817, 25638, 17717, 25, 3817, 48178, 25, 2153, 198, 810, 6200, 486, 1382, 486, 2077, 22964,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_new() { // Test that `new_ip_socket` works with various edge cases. // IPv4 let mut ctx = DummyEventDispatcherBuilder::from_config(DUMMY_CONFIG_V4) .build::<DummyEventDispatcher>(); // A template socket that we can use to more concisely define sockets in // various test cases. let template = IpSock { defn: IpSockDefinition { remote_ip: DUMMY_CONFIG_V4.remote_ip, local_ip: DUMMY_CONFIG_V4.local_ip, proto: Ipv4Proto::Icmp, hop_limit: crate::ip::DEFAULT_TTL.get(), unroutable_behavior: UnroutableBehavior::Close, per_proto_data: (), }, cached: Ok(CachedInfo { builder: Ipv4PacketBuilder::new( DUMMY_CONFIG_V4.local_ip, DUMMY_CONFIG_V4.remote_ip, crate::ip::DEFAULT_TTL.get(), Ipv4Proto::Icmp, ), device: DeviceId::new_ethernet(0), next_hop: DUMMY_CONFIG_V4.remote_ip, }), }; // All optional fields are `None`. assert_eq!( IpSocketContext::<Ipv4>::new_ip_socket( &mut ctx, None, DUMMY_CONFIG_V4.remote_ip, Ipv4Proto::Icmp, UnroutableBehavior::Close, None, ), Ok(template.clone()) ); // TTL is specified. let mut builder = Ipv4SocketBuilder::default(); let _: &mut Ipv4SocketBuilder = builder.ttl(NonZeroU8::new(1).unwrap()); assert_eq!( IpSocketContext::<Ipv4>::new_ip_socket( &mut ctx, None, DUMMY_CONFIG_V4.remote_ip, Ipv4Proto::Icmp, UnroutableBehavior::Close, Some(builder), ), { let mut x = template.clone(); x.defn.hop_limit = 1; x.cached.as_mut().unwrap().builder = Ipv4PacketBuilder::new( DUMMY_CONFIG_V4.local_ip, DUMMY_CONFIG_V4.remote_ip, 1, Ipv4Proto::Icmp, ); Ok(x) } ); assert_eq!( IpSocketContext::<Ipv4>::new_ip_socket( &mut ctx, Some(DUMMY_CONFIG_V4.local_ip), DUMMY_CONFIG_V4.remote_ip, Ipv4Proto::Icmp, UnroutableBehavior::Close, None, ), Ok(template.clone()) ); assert_eq!( IpSocketContext::<Ipv4>::new_ip_socket( &mut ctx, Some(DUMMY_CONFIG_V4.remote_ip), DUMMY_CONFIG_V4.remote_ip, Ipv4Proto::Icmp, UnroutableBehavior::Close, None, ), Err(IpSockUnroutableError::LocalAddrNotAssigned.into()) ); // Loopback sockets are not yet supported. assert_eq!( IpSocketContext::<Ipv4>::new_ip_socket( &mut ctx, None, Ipv4::LOOPBACK_ADDRESS, Ipv4Proto::Icmp, UnroutableBehavior::Close, None, ), Err(IpSockUnroutableError::NoRouteToRemoteAddr.into()) ); // IPv6 let mut ctx = DummyEventDispatcherBuilder::from_config(DUMMY_CONFIG_V6) .build::<DummyEventDispatcher>(); // use a clone to assert on the sequence of flow labels it will produce. let mut rng = ctx.dispatcher.rng().clone(); // A template socket that we can use to more concisely define sockets in // various test cases. let template = IpSock { defn: IpSockDefinition { remote_ip: DUMMY_CONFIG_V6.remote_ip, local_ip: DUMMY_CONFIG_V6.local_ip, proto: Ipv6Proto::Icmpv6, hop_limit: crate::ip::DEFAULT_TTL.get(), unroutable_behavior: UnroutableBehavior::Close, per_proto_data: Ipv6SocketData { flow_label: 0 }, }, cached: Ok(CachedInfo { builder: Ipv6PacketBuilder::new( DUMMY_CONFIG_V6.local_ip, DUMMY_CONFIG_V6.remote_ip, crate::ip::DEFAULT_TTL.get(), Ipv6Proto::Icmpv6, ), device: DeviceId::new_ethernet(0), next_hop: DUMMY_CONFIG_V6.remote_ip, }), }; let with_flow_label = |mut template: IpSock<Ipv6, DeviceId>, flow_label| -> IpSock<Ipv6, DeviceId> { template.defn.per_proto_data = Ipv6SocketData { flow_label }; template.cached.as_mut().unwrap().builder.flowlabel(flow_label); template }; // All optional fields are `None`. assert_eq!( IpSocketContext::<Ipv6>::new_ip_socket( &mut ctx, None, DUMMY_CONFIG_V6.remote_ip, Ipv6Proto::Icmpv6, UnroutableBehavior::Close, None, ), Ok(with_flow_label(template.clone(), gen_ipv6_flowlabel(&mut rng))) ); // Hop Limit is specified. const SPECIFIED_HOP_LIMIT: u8 = 1; let mut builder = Ipv6SocketBuilder::default(); let _: &mut Ipv6SocketBuilder = builder.hop_limit(SPECIFIED_HOP_LIMIT); assert_eq!( IpSocketContext::<Ipv6>::new_ip_socket( &mut ctx, None, DUMMY_CONFIG_V6.remote_ip, Ipv6Proto::Icmpv6, UnroutableBehavior::Close, Some(builder), ), { let mut template_with_hop_limit = template.clone(); template_with_hop_limit.defn.hop_limit = SPECIFIED_HOP_LIMIT; let builder = Ipv6PacketBuilder::new( DUMMY_CONFIG_V6.local_ip, DUMMY_CONFIG_V6.remote_ip, SPECIFIED_HOP_LIMIT, Ipv6Proto::Icmpv6, ); template_with_hop_limit.cached.as_mut().unwrap().builder = builder; Ok(with_flow_label(template_with_hop_limit, gen_ipv6_flowlabel(&mut rng))) } ); assert_eq!( IpSocketContext::<Ipv6>::new_ip_socket( &mut ctx, Some(DUMMY_CONFIG_V6.local_ip), DUMMY_CONFIG_V6.remote_ip, Ipv6Proto::Icmpv6, UnroutableBehavior::Close, None, ), Ok(with_flow_label(template, gen_ipv6_flowlabel(&mut rng))) ); assert_eq!( IpSocketContext::<Ipv6>::new_ip_socket( &mut ctx, Some(DUMMY_CONFIG_V6.remote_ip), DUMMY_CONFIG_V6.remote_ip, Ipv6Proto::Icmpv6, UnroutableBehavior::Close, None, ), Err(IpSockUnroutableError::LocalAddrNotAssigned.into()) ); // Loopback sockets are not yet supported. assert_eq!( IpSocketContext::<Ipv6>::new_ip_socket( &mut ctx, None, Ipv6::LOOPBACK_ADDRESS, Ipv6Proto::Icmpv6, UnroutableBehavior::Close, None, ), Err(IpSockUnroutableError::NoRouteToRemoteAddr.into()) ); }
rust_cleaned_test_functions.jsonl/74559
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4788 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 368, 341, 286, 442, 3393, 429, 1565, 931, 10385, 19555, 63, 4278, 448, 5257, 6821, 5048, 382, 286, 442, 31560, 19, 271, 286, 1077, 5206, 5635, 284, 50567, 1556, 21839, 3297, 486, 1499, 533...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_auto_namespace_map() { let arena = bumpalo::Bump::new(); let dp_opts = Opts::default().decl_opts(&arena); assert_eq!(dp_opts.auto_namespace_map.len(), 15); }
rust_cleaned_test_functions.jsonl/103747
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 103 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27740, 41571, 5376, 368, 341, 286, 1077, 24902, 284, 27575, 12529, 486, 33, 1510, 486, 931, 543, 286, 1077, 11329, 32354, 284, 506, 12754, 486, 2258, 1005, 10005, 32354, 2099, 30527, 317, 286, 206...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_decode_mov_w() { assert_eq!( decode_32(0xf04f38ff), Instruction::MOV_imm { params: RegImmCarryParams { rd: Reg::R8, imm32: Imm32Carry::Carry { imm32_c0: (0xffffffff, false), imm32_c1: (0xffffffff, true), }, setflags: SetFlags::False, }, thumb32: true, } ); }
rust_cleaned_test_functions.jsonl/64802
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 298 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15227, 55798, 1670, 368, 341, 1066, 262, 2060, 10714, 33673, 286, 16895, 62, 18, 17, 7, 15, 5848, 15, 19, 69, 18, 23, 542, 1326, 286, 29051, 486, 66022, 71370, 341, 310, 3628, 25, 3184, 50739,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_escape_minecraft() { assert_eq!( escape_minecraft("This\ncontains\nsome\nnewlines").collect::<String>(), "This\\ncontains\\nsome\\nnewlines" ); assert_eq!( escape_minecraft("Now \\ some \\ backslashes").collect::<String>(), "Now \\\\ some \\\\ backslashes" ); }
rust_cleaned_test_functions.jsonl/106550
{ "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, 21832, 717, 12086, 368, 341, 286, 2060, 10714, 33673, 310, 12449, 717, 12086, 445, 1986, 1699, 13372, 1699, 14689, 1699, 931, 7969, 1827, 17384, 27638, 703, 65766, 310, 330, 1986, 3422, 77, 13372, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_reader_io_errors_le() { use bitstream_io::{BitRead, BitReader, LittleEndian}; use std::io::ErrorKind; let actual_data: [u8; 1] = [0xB1]; /*individual bits*/ let mut r = BitReader::endian(Cursor::new(&actual_data), LittleEndian); assert!(r.read_bit().is_ok()); assert!(r.read_bit().is_ok()); assert!(r.read_bit().is_ok()); assert!(r.read_bit().is_ok()); assert!(r.read_bit().is_ok()); assert!(r.read_bit().is_ok()); assert!(r.read_bit().is_ok()); assert!(r.read_bit().is_ok()); assert_eq!(r.read_bit().unwrap_err().kind(), ErrorKind::UnexpectedEof); /*skipping bits*/ let mut r = BitReader::endian(Cursor::new(&actual_data), LittleEndian); assert!(r.read::<u32>(7).is_ok()); assert_eq!(r.skip(5).unwrap_err().kind(), ErrorKind::UnexpectedEof); /*signed values*/ let mut r = BitReader::endian(Cursor::new(&actual_data), LittleEndian); assert!(r.read_signed::<i32>(2).is_ok()); assert!(r.read_signed::<i32>(3).is_ok()); assert_eq!( r.read_signed::<i32>(5).unwrap_err().kind(), ErrorKind::UnexpectedEof ); /*unary 0 values*/ let mut r = BitReader::endian(Cursor::new(&actual_data), LittleEndian); assert!(r.read_unary0().is_ok()); assert!(r.read_unary0().is_ok()); assert!(r.read_unary0().is_ok()); assert!(r.read_unary0().is_ok()); assert_eq!( r.read_unary0().unwrap_err().kind(), ErrorKind::UnexpectedEof ); /*unary 1 values*/ let mut r = BitReader::endian(Cursor::new(&actual_data), LittleEndian); assert!(r.read_unary1().is_ok()); assert!(r.read_unary1().is_ok()); assert!(r.read_unary1().is_ok()); assert!(r.read_unary1().is_ok()); assert_eq!( r.read_unary1().unwrap_err().kind(), ErrorKind::UnexpectedEof ); let mut r = BitReader::endian(Cursor::new(&actual_data), LittleEndian); let mut sub_data = [0; 2]; assert_eq!( r.read_bytes(&mut sub_data).unwrap_err().kind(), ErrorKind::UnexpectedEof ); let mut r = BitReader::endian(Cursor::new(&actual_data), LittleEndian); let mut sub_data = [0; 2]; assert!(r.read::<u32>(4).is_ok()); assert_eq!( r.read_bytes(&mut sub_data).unwrap_err().kind(), ErrorKind::UnexpectedEof ); }
rust_cleaned_test_functions.jsonl/65123
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1060 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22306, 16939, 20196, 11751, 368, 341, 262, 990, 2699, 4027, 16939, 22964, 8344, 4418, 11, 6495, 5062, 11, 14671, 43231, 2440, 262, 990, 1460, 486, 815, 486, 1454, 10629, 401, 262, 1077, 5042, 1769...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ipv4_mapped() { let test_cases = vec![ (Some(hex("00000000000000000001000001020304")), Some(0)), (Some(hex("00000000000000000000000001020304")), Some(0)), (Some(hex("10101010")), Some(0)), (Some(hex("00000000000000000000ffff01020304")), Some(1)), (Some(hex("00010203040506")), Some(0)), (None, Some(0)), ]; for (input, expect_output) in test_cases { let output = RpnFnScalarEvaluator::new() .push_param(input) .evaluate::<Int>(ScalarFuncSig::IsIPv4Mapped) .unwrap(); assert_eq!(output, expect_output); } }
rust_cleaned_test_functions.jsonl/59417
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 375 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 49378, 19, 91933, 368, 341, 286, 1077, 1273, 41427, 284, 7486, 90515, 310, 320, 8373, 44660, 445, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 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...
2
#[test] fn test_add_same_n_frac_digits() { let x = Decimal::new_raw(1234567890, 3); let y = x + x; assert_eq!(y.coefficient(), 2 * x.coefficient()); assert_eq!(y.n_frac_digits(), x.n_frac_digits()); let z = x + Decimal::NEG_ONE; assert_eq!(z.coefficient(), x.coefficient() - 1000); assert_eq!(z.n_frac_digits(), x.n_frac_digits()); }
rust_cleaned_test_functions.jsonl/29254
{ "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, 2891, 33574, 1089, 70358, 41432, 368, 341, 286, 1077, 856, 284, 26728, 486, 931, 16067, 7, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 11, 220, 18, 317, 286, 1077, 379, 284, 856, 488, 856, 280...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_double_ended_zip() { let xs = [1, 2, 3, 4, 5, 6]; let ys = [1, 2, 3, 7]; let a = xs.iter().map(|&x| x); let b = ys.iter().map(|&x| x); let mut it = a.zip(b); assert_eq!(it.next(), Some((1, 1))); assert_eq!(it.next(), Some((2, 2))); assert_eq!(it.next_back(), Some((4, 7))); assert_eq!(it.next_back(), Some((3, 3))); assert_eq!(it.next(), None); }
rust_cleaned_test_functions.jsonl/1023
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 257 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24598, 62, 2883, 42131, 368, 341, 286, 1077, 11943, 284, 508, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 220, 21, 935, 286, 1077, 31810, 284, 508, 16, 11, 220, 17, 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...
1
#[test] fn test_program_bpf_error_handling() { solana_logger::setup(); let mut programs = Vec::new(); #[cfg(feature = "bpf_c")] { programs.extend_from_slice(&[("error_handling")]); } #[cfg(feature = "bpf_rust")] { programs.extend_from_slice(&[("solana_bpf_rust_error_handling")]); } for program in programs.iter() { println!("Test program: {:?}", program); let GenesisConfigInfo { genesis_config, mint_keypair, .. } = create_genesis_config(50); let mut bank = Bank::new_for_tests(&genesis_config); let (name, id, entrypoint) = solana_bpf_loader_program!(); bank.add_builtin(&name, &id, entrypoint); let bank_client = BankClient::new(bank); let program_id = load_bpf_program(&bank_client, &bpf_loader::id(), &mint_keypair, program); let account_metas = vec![AccountMeta::new(mint_keypair.pubkey(), true)]; let instruction = Instruction::new_with_bytes(program_id, &[1], account_metas.clone()); let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction); assert!(result.is_ok()); let instruction = Instruction::new_with_bytes(program_id, &[2], account_metas.clone()); let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction); assert_eq!( result.unwrap_err().unwrap(), TransactionError::InstructionError(0, InstructionError::InvalidAccountData) ); let instruction = Instruction::new_with_bytes(program_id, &[3], account_metas.clone()); let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction); assert_eq!( result.unwrap_err().unwrap(), TransactionError::InstructionError(0, InstructionError::Custom(0)) ); let instruction = Instruction::new_with_bytes(program_id, &[4], account_metas.clone()); let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction); assert_eq!( result.unwrap_err().unwrap(), TransactionError::InstructionError(0, InstructionError::Custom(42)) ); let instruction = Instruction::new_with_bytes(program_id, &[5], account_metas.clone()); let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction); let result = result.unwrap_err().unwrap(); if TransactionError::InstructionError(0, InstructionError::InvalidInstructionData) != result { assert_eq!( result, TransactionError::InstructionError(0, InstructionError::InvalidError) ); } let instruction = Instruction::new_with_bytes(program_id, &[6], account_metas.clone()); let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction); let result = result.unwrap_err().unwrap(); if TransactionError::InstructionError(0, InstructionError::InvalidInstructionData) != result { assert_eq!( result, TransactionError::InstructionError(0, InstructionError::InvalidError) ); } let instruction = Instruction::new_with_bytes(program_id, &[7], account_metas.clone()); let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction); let result = result.unwrap_err().unwrap(); if TransactionError::InstructionError(0, InstructionError::InvalidInstructionData) != result { assert_eq!( result, TransactionError::InstructionError(0, InstructionError::AccountBorrowFailed) ); } let instruction = Instruction::new_with_bytes(program_id, &[8], account_metas.clone()); let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction); assert_eq!( result.unwrap_err().unwrap(), TransactionError::InstructionError(0, InstructionError::InvalidInstructionData) ); let instruction = Instruction::new_with_bytes(program_id, &[9], account_metas.clone()); let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction); assert_eq!( result.unwrap_err().unwrap(), TransactionError::InstructionError(0, InstructionError::MaxSeedLengthExceeded) ); } }
rust_cleaned_test_functions.jsonl/5739
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1865 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25096, 880, 15897, 4096, 75642, 368, 341, 262, 2048, 3362, 27413, 486, 15188, 1428, 262, 1077, 5206, 7468, 284, 11312, 486, 931, 543, 262, 11506, 14072, 27062, 284, 330, 65, 15897, 666, 5422, 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...
5
#[test] fn test_csv() { use std::collections::BTreeMap; let exporter = CsvExporter::default(); // NOTE: results are fabricated let results = vec![ BenchmarkResult::new( String::from("FOO=one BAR=two command | 1"), 1.0, 2.0, 1.0, 3.0, 4.0, 5.0, 6.0, vec![7.0, 8.0, 9.0], { let mut params = BTreeMap::new(); params.insert("foo".into(), "one".into()); params.insert("bar".into(), "two".into()); params }, ), BenchmarkResult::new( String::from("FOO=one BAR=seven command | 2"), 11.0, 12.0, 11.0, 13.0, 14.0, 15.0, 16.5, vec![17.0, 18.0, 19.0], { let mut params = BTreeMap::new(); params.insert("foo".into(), "one".into()); params.insert("bar".into(), "seven".into()); params }, ), ]; let exps: String = String::from( "command,mean,stddev,median,user,system,min,max,parameter_bar,parameter_foo\n\ FOO=one BAR=two command | 1,1,2,1,3,4,5,6,two,one\n\ FOO=one BAR=seven command | 2,11,12,11,13,14,15,16.5,seven,one\n\ ", ); let gens = String::from_utf8(exporter.serialize(&results, Some(Unit::Second)).unwrap()).unwrap(); assert_eq!(exps, gens); }
rust_cleaned_test_functions.jsonl/114587
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 912 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14020, 368, 341, 262, 990, 1460, 486, 51137, 486, 33, 6533, 2227, 280, 262, 1077, 57378, 284, 91671, 88025, 486, 2258, 1428, 262, 442, 16743, 25, 3059, 525, 69454, 198, 262, 1077, 3059, 284, 748...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_bytesator_last() { let s = "ศไทย中华Việt Nam"; let b = s.bytes(); assert_eq!(b.last().unwrap(), 109) }
rust_cleaned_test_functions.jsonl/17638
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 77 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12524, 850, 12195, 368, 341, 262, 1077, 274, 284, 330, 123863, 125451, 100849, 35544, 124382, 29974, 3302, 262, 1077, 293, 284, 274, 42697, 543, 262, 2060, 10714, 10297, 65, 9110, 1005, 15454, 1507,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_invert() { let v = Vector3::new(1.0f64, 2.0, 3.0); let t = Decomposed { scale: 1.5f64, rot: Quaternion::new(0.5f64, 0.5, 0.5, 0.5), disp: Vector3::new(6.0f64, -7.0, 8.0), }; let ti = t .inverse_transform() .expect("Expected successful inversion"); let vt = t.transform_vector(v); assert_ulps_eq!(&v, &ti.transform_vector(vt)); }
rust_cleaned_test_functions.jsonl/86459
{ "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, 1243, 1621, 368, 341, 262, 1077, 348, 284, 4196, 18, 486, 931, 7, 16, 13, 15, 69, 21, 19, 11, 220, 17, 13, 15, 11, 220, 18, 13, 15, 317, 262, 1077, 259, 284, 96378, 3865, 341, 286, 5452,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_rfc_8285_one_byte_two_extension_of_two_bytes() -> Result<()> { // | 0xBE | 0xDE | length=1 | let raw_pkt = Bytes::from_static(&[ 0x90, 0xe0, 0x69, 0x8f, 0xd9, 0xc2, 0x93, 0xda, 0x1c, 0x64, 0x27, 0x82, 0xBE, 0xDE, 0x00, 0x01, 0x10, 0xAA, 0x20, 0xBB, // Payload 0x98, 0x36, 0xbe, 0x88, 0x9e, ]); let buf = &mut raw_pkt.clone(); let p = Packet::unmarshal(buf)?; let ext1 = p.header.get_extension(1); let ext1_expect = Bytes::from_static(&[0xAA]); if let Some(ext1) = ext1 { assert_eq!(ext1, ext1_expect); } else { assert!(false, "ext1 is none"); } let ext2 = p.header.get_extension(2); let ext2_expect = Bytes::from_static(&[0xBB]); if let Some(ext2) = ext2 { assert_eq!(ext2, ext2_expect); } else { assert!(false, "ext2 is none"); } // Test Marshal let p = Packet { header: Header { marker: true, extension: true, extension_profile: 0xBEDE, extensions: vec![ Extension { id: 1, payload: Bytes::from_static(&[0xAA]), }, Extension { id: 2, payload: Bytes::from_static(&[0xBB]), }, ], version: 2, payload_type: 96, sequence_number: 27023, timestamp: 3653407706, ssrc: 476325762, csrc: vec![], ..Default::default() }, payload: raw_pkt.slice(20..), }; let dst = p.marshal()?; assert_eq!(dst, raw_pkt); Ok(()) }
rust_cleaned_test_functions.jsonl/128730
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1038 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 8316, 62, 23, 17, 23, 20, 11667, 19737, 23241, 31035, 3575, 23241, 12524, 368, 1464, 5714, 71698, 341, 41693, 262, 442, 760, 981, 220, 15, 85449, 262, 760, 262, 220, 15, 78979, 981, 760, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_parse_conv_impl_with_type_params() { let _ = env_logger::try_init(); let mut conv_map = parse( SourceId::none(), r#" #[allow(dead_code)] #[swig_code = "let {to_var}: {to_var_type} = <{to_var_type}>::swig_from({from_var}, env);"] trait SwigFrom<T> { fn swig_from(T, env: *mut JNIEnv) -> Self; } #[allow(dead_code)] #[swig_code = "let {to_var}: {to_var_type} = {from_var}.swig_deref();"] trait SwigDeref { type Target: ?Sized; fn swig_deref(&self) -> &Self::Target; } impl<T: SwigForeignClass> SwigFrom<T> for jobject { fn swig_from(x: T, env: *mut JNIEnv) -> Self { object_to_jobject(x, <T>::jni_class_name(), env) } } impl<T> SwigDeref for Arc<Mutex<T>> { type Target = Mutex<T>; fn swig_deref(&self) -> &Mutex<T> { &self } } impl<'a, T> SwigFrom<&'a Mutex<T>> for MutexGuard<'a, T> { fn swig_from(m: &'a Mutex<T>, _: *mut JNIEnv) -> MutexGuard<'a, T> { m.lock().unwrap() } } impl<'a, T> SwigDeref for MutexGuard<'a, T> { type Target = T; fn swig_deref(&self) -> &T { &self } } "#, 64, FxHashMap::default(), ) .unwrap(); conv_map.find_or_alloc_rust_type_that_implements( &parse_type! { Foo }, &["SwigForeignClass"], SourceId::none(), ); let arc_mutex_foo = conv_map.find_or_alloc_rust_type(&parse_type! { Arc<Mutex<Foo>> }, SourceId::none()); let foo_ref = conv_map.find_or_alloc_rust_type(&parse_type! { &Foo }, SourceId::none()); let (_, code) = conv_map .convert_rust_types( arc_mutex_foo.to_idx(), foo_ref.to_idx(), "a0", "a1", "jlong", invalid_src_id_span(), ) .unwrap(); assert_eq!( r#" let a1: & Mutex < Foo > = a0.swig_deref(); let a1: MutexGuard < Foo > = <MutexGuard < Foo >>::swig_from(a1, env); let a1: & Foo = a1.swig_deref(); "# .to_string(), code ); }
rust_cleaned_test_functions.jsonl/18736
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1201 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 22716, 21007, 6615, 1819, 6745, 368, 341, 286, 1077, 716, 284, 6105, 27413, 486, 1539, 6137, 1428, 286, 1077, 5206, 5686, 5376, 284, 4715, 1006, 310, 8748, 764, 486, 6697, 3148, 310, 435, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_drop_table() { let config = Config::new(&r#" max_memory_pool_page_num = 2 table_meta_dir = "test_file/table_meta/" table_file_dir = "test_file/table_file""#.to_string()); let manager = TableManager::make_ref(&config); let table = Table{ name : "msg".to_string(), attr_list : vec![Attr{ name : "id".to_string(), attr_type : AttrType::Int, primary : true, nullable : false, }], }; manager.borrow_mut().add_table(table); let mut plan = gen_plan_helper!("drop table msg", &manager); assert_pattern!(manager.borrow().get_table("msg"), Some(..)); plan.open(); assert_pattern!(plan.get_next(), None); assert_pattern!(manager.borrow().get_table("msg"), None); }
rust_cleaned_test_functions.jsonl/67282
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 411 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29584, 5237, 368, 972, 262, 1077, 2193, 284, 5532, 486, 931, 2099, 81, 2, 5031, 286, 1932, 19195, 15709, 6129, 4273, 284, 220, 17, 319, 286, 1965, 13381, 4334, 284, 330, 1944, 2458, 45326, 13381...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_basic_pool_add() { let mut dummy_chain = DummyChainImpl::new(); let head_header = block::BlockHeader { height: 1, ..block::BlockHeader::default() }; dummy_chain.store_head_header(&head_header); let parent_transaction = test_transaction(vec![5, 6, 7], vec![11, 3]); // We want this transaction to be rooted in the blockchain. let new_output = DummyOutputSet::empty() .with_output(test_output(5)) .with_output(test_output(6)) .with_output(test_output(7)) .with_output(test_output(8)); let child_transaction = test_transaction(vec![11, 3], vec![12]); dummy_chain.update_output_set(new_output); // is placed inside a RwLock. let pool = RwLock::new(test_setup(&Arc::new(dummy_chain))); // Take the write lock and add a pool entry { let mut write_pool = pool.write().unwrap(); assert_eq!(write_pool.total_size(), 0); let result = write_pool.add_to_memory_pool(test_source(), parent_transaction, false); if result.is_err() { panic!("got an error adding parent tx: {:?}", result.err().unwrap()); } let child_result = write_pool.add_to_memory_pool(test_source(), child_transaction, false); if child_result.is_err() { panic!( "got an error adding child tx: {:?}", child_result.err().unwrap() ); } } // Now take the read lock and use a few exposed methods to check consistency { let read_pool = pool.read().unwrap(); assert_eq!(read_pool.total_size(), 2); expect_output_parent!(read_pool, Parent::PoolTransaction{tx_ref: _}, 12); expect_output_parent!(read_pool, Parent::AlreadySpent{other_tx: _}, 11, 5); expect_output_parent!(read_pool, Parent::BlockTransaction, 8); expect_output_parent!(read_pool, Parent::Unknown, 20); } }
rust_cleaned_test_functions.jsonl/17036
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 709 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34729, 15709, 2891, 368, 341, 197, 10217, 5206, 17292, 30583, 284, 50567, 18837, 9673, 486, 931, 543, 197, 10217, 1968, 8757, 284, 2504, 486, 4713, 4047, 341, 298, 30500, 25, 220, 16, 345, 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...
3
#[test] fn test_inspect_log_allows_mutex_guard_temporary() { let (_inspector, node) = inspector_and_list_node(); let node = Mutex::new(node); inspect_log!(node.lock(), k1: "v1"); }
rust_cleaned_test_functions.jsonl/90893
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 111 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34386, 987, 5224, 5705, 4241, 14204, 36796, 11771, 7592, 368, 341, 1789, 286, 1077, 5453, 1330, 18997, 11, 2436, 8, 284, 44725, 8378, 2019, 5084, 543, 286, 1077, 2436, 284, 66215, 486, 931, 6958, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_qvariant_qstring() { let ts = "TestString123".to_owned(); let qs = QString::from(ts.clone()); let qv = QVariant::from(qs); let qs2 = QString::try_from(qv).unwrap(); let ts2: String = qs2.into(); assert_eq!(ts, ts2); }
rust_cleaned_test_functions.jsonl/89749
{ "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, 8976, 15969, 8976, 917, 368, 341, 286, 1077, 10591, 284, 330, 2271, 703, 16, 17, 18, 3263, 983, 51973, 543, 286, 1077, 32421, 284, 7879, 486, 1499, 35864, 15997, 1423, 286, 1077, 2804, 85, 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_zero_commmit() { let zero_commit = Confidential::zero_pedersen_commitment(); let mut handmade_bytes = vec![0x08u8]; handmade_bytes.extend(&[0x0u8; 32]); let handmade_commit = secp256k1zkp::pedersen::Commitment::strict_decode( &handmade_bytes[..], ) .unwrap(); assert_eq!(handmade_commit, zero_commit); }
rust_cleaned_test_functions.jsonl/25385
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 218 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19359, 25149, 1763, 368, 341, 286, 1077, 7168, 36346, 284, 73365, 486, 14154, 93104, 87989, 36346, 478, 1428, 286, 1077, 5206, 51686, 12524, 284, 7486, 20703, 15, 87, 15, 23, 84, 23, 935, 286, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_enum_string_value() { let raw_schema = r#" { "type": "record", "name": "test", "fields": [ {"name": "a", "type": "long", "default": 42}, {"name": "b", "type": "string"}, { "name": "c", "type": { "type": "enum", "name": "suit", "symbols": ["diamonds", "spades", "clubs", "hearts"] }, "default": "spades" } ] } "#; let schema = Schema::parse_str(raw_schema).unwrap(); let mut writer = Writer::with_codec(&schema, Vec::new(), Codec::Null); let mut record = Record::new(writer.schema()).unwrap(); record.put("a", 27i64); record.put("b", "foo"); record.put("c", "clubs"); writer.append(record).unwrap(); let input = writer.into_inner().unwrap(); let mut reader = Reader::with_schema(&schema, &input[..]).unwrap(); assert_eq!( reader.next().unwrap().unwrap(), Value::Record(vec![ ("a".to_string(), Value::Long(27)), ("b".to_string(), Value::String("foo".to_string())), ("c".to_string(), Value::Enum(2, "clubs".to_string())), ]) ); assert!(reader.next().is_none()); }
rust_cleaned_test_functions.jsonl/77301
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 901 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31054, 3904, 3142, 368, 341, 286, 1077, 7112, 25371, 284, 435, 2, 698, 310, 341, 394, 330, 1313, 788, 330, 8548, 756, 394, 330, 606, 788, 330, 1944, 756, 394, 330, 9007, 788, 2278, 503, 5212, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_verkey_is_b58_and_valid_length() { let verkey = "EkVTa7SCJ5SntpYyX7CSb2pcBhiVGT9kWSagA8a9T69A"; match validate_verkey(&verkey) { Err(x) => panic!("Should be valid verkey"), Ok(x) => assert_eq!(x, verkey) } }
rust_cleaned_test_functions.jsonl/86089
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 162 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26042, 792, 6892, 880, 20, 23, 8378, 8337, 5118, 368, 341, 286, 1077, 2739, 792, 284, 330, 41917, 20457, 64, 22, 3540, 41, 20, 50, 89340, 56, 88, 55, 22, 6412, 65, 17, 3992, 33, 6023, 53, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_rope_from_nvim_cells() { let cells = vec![ nvim_bridge::Cell { text: String::from("1"), hl_id: 1, repeat: 3, double_width: false, }, nvim_bridge::Cell { text: String::from("2"), hl_id: 2, repeat: 3, double_width: false, }, ]; let rope = Rope::from_nvim_cells(&cells); assert_eq!(rope.text(), "111222"); let leafs = rope.leafs(); assert_eq!(leafs.len(), 3); assert_eq!(leafs[1].hl_id, 1); assert_eq!(leafs[2].hl_id, 2); let rope = rope.combine_leafs(); let leafs = rope.leafs(); assert_eq!(leafs.len(), 2); assert_eq!(leafs[0].hl_id, 1); assert_eq!(leafs[1].hl_id, 2); }
rust_cleaned_test_functions.jsonl/14021
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 530 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26608, 375, 5673, 1089, 41194, 37796, 368, 341, 286, 1077, 7761, 284, 7486, 90515, 310, 31440, 318, 54944, 486, 3599, 341, 394, 1467, 25, 923, 486, 1499, 445, 16, 4461, 394, 49586, 842, 25, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_change_spend_policy_default() { let change_spend_policy = ChangeSpendPolicy::default(); let filtered = get_test_utxos() .into_iter() .filter(|u| change_spend_policy.is_satisfied_by(u)) .count(); assert_eq!(filtered, 2); }
rust_cleaned_test_functions.jsonl/5558
{ "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, 15947, 643, 3740, 22773, 9993, 368, 341, 286, 1077, 2297, 643, 3740, 22773, 284, 10388, 50, 3740, 13825, 486, 2258, 543, 286, 1077, 18293, 284, 633, 4452, 60363, 87, 436, 741, 310, 659, 18122, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_frame_decoder() { use crate::frame_decoder; use std::fs; let mut content = fs::File::open("./decodecorpus_files/z000088.zst").unwrap(); struct NullWriter(()); impl std::io::Write for NullWriter { fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> { Ok(buf.len()) } fn flush(&mut self) -> Result<(), std::io::Error> { Ok(()) } } let mut _null_target = NullWriter(()); let mut frame_dec = frame_decoder::FrameDecoder::new(); frame_dec.reset(&mut content).unwrap(); frame_dec .decode_blocks(&mut content, frame_decoder::BlockDecodingStrategy::All) .unwrap(); }
rust_cleaned_test_functions.jsonl/37445
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 316 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8929, 49843, 368, 341, 262, 990, 17717, 486, 6763, 49843, 280, 262, 990, 1460, 486, 3848, 401, 262, 1077, 5206, 2213, 284, 8619, 486, 1703, 486, 2508, 13988, 18196, 6005, 17820, 10931, 31082, 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_mut_splitator_rev() { let mut xs = [1,2,0,3,4,0,0,5,6,0]; for slice in xs.mut_split(|x| *x == 0).rev().take(4) { slice.reverse(); } assert!(xs == [1,2,0,4,3,0,0,6,5,0]); }
rust_cleaned_test_functions.jsonl/75640
{ "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, 29523, 17052, 850, 38082, 368, 341, 286, 1077, 5206, 11943, 284, 508, 16, 11, 17, 11, 15, 11, 18, 11, 19, 11, 15, 11, 15, 11, 20, 11, 21, 11, 15, 935, 286, 369, 15983, 304, 11943, 744, 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_sum_times() { let five_bucks: Expression = Money::dollar(5).into(); let ten_francs: Expression = Money::franc(10).into(); let mut bank = Bank::new(); bank.add_rate(Franc.into(), Dollar.into(), 2); let sum: Expression = (&Sum::new(five_bucks, ten_francs) * 2).into(); let result = bank.reduce(sum, Dollar.into()); assert_eq!(Money::dollar(20), result); }
rust_cleaned_test_functions.jsonl/115310
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 189 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10160, 22353, 368, 341, 286, 1077, 4236, 880, 15582, 25, 16378, 284, 17633, 486, 67, 21295, 7, 20, 568, 18122, 543, 286, 1077, 5779, 41537, 1129, 82, 25, 16378, 284, 17633, 486, 1626, 1129, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_put_var_uint() { let tests: &[(Vec<u8>, u64, usize)] = &[ (vec![0x01, 0x00], 0, 2), (vec![0x01, 0x09], 9, 2), (vec![0x02, 0x01, 0x02], 0x0102, 3), (vec![0x03, 0x01, 0x02, 0x03], 0x010203, 4), (vec![0x04, 0x01, 0x02, 0x03, 0x04], 0x01020304, 5), (vec![0x05, 0x01, 0x02, 0x03, 0x04, 0x05], 0x0102030405, 6), ( vec![0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06], 0x010203040506, 7, ), ( vec![0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07], 0x01020304050607, 8, ), ( vec![0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08], 0x0102030405060708, 9, ), ]; for (buffer, value, _offset) in tests { let mut writer = Vec::new(); writer.put_var_uint(*value); assert_eq!(writer, *buffer); } }
rust_cleaned_test_functions.jsonl/14914
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 740 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15557, 4612, 15807, 368, 341, 286, 1077, 7032, 25, 609, 9697, 10050, 34837, 23, 8066, 575, 21, 19, 11, 22301, 7252, 284, 609, 9640, 310, 320, 4083, 20703, 15, 87, 15, 16, 11, 220, 15, 87, 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...
2
#[test] fn test_collect() { let empty = ""; let s: String = empty.chars().collect(); assert_eq!(empty, s); let data = "ประเทศไทย中"; let s: String = data.chars().collect(); assert_eq!(data, s); }
rust_cleaned_test_functions.jsonl/17584
{ "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, 68140, 368, 341, 262, 1077, 4287, 284, 5438, 262, 1077, 274, 25, 923, 284, 4287, 85062, 1005, 17384, 543, 262, 2060, 10714, 10297, 3194, 11, 274, 317, 262, 1077, 821, 284, 330, 130391, 15946, 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
#[test] fn test_normalize_magnitude() { let v = Tuple::vector(1.0, 2.0, 3.0); let normalized = v.normalize(); assert_eq!(true, compare_floats(normalized.magnitude(), 1.0f32)); }
rust_cleaned_test_functions.jsonl/113524
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 104 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 80807, 717, 34715, 368, 341, 286, 1077, 348, 284, 24622, 486, 3215, 7, 16, 13, 15, 11, 220, 17, 13, 15, 11, 220, 18, 13, 15, 317, 286, 1077, 29410, 284, 348, 44657, 543, 286, 2060, 10714, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_push_key_maps() { // selected let textbox: TextBox<TestBackend> = TextBox::new(true); key_maps_test_case( &textbox, KeyEvent::new(KeyCode::Left, KeyModifiers::NONE), "Move cursor", ); key_maps_test_case( &textbox, KeyEvent::new(KeyCode::Right, KeyModifiers::NONE), "Move cursor", ); key_maps_test_case( &textbox, KeyEvent::new(KeyCode::Backspace, KeyModifiers::NONE), "Delete char", ); // not selected let textbox: TextBox<TestBackend> = TextBox::new(false); let mut maps: BTreeMap<KeyEventWrapper, String> = BTreeMap::new(); textbox.push_key_maps(&mut maps); assert!(maps.is_empty()) }
rust_cleaned_test_functions.jsonl/20812
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 427 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14218, 3097, 46512, 368, 341, 286, 442, 4091, 198, 286, 1077, 73999, 25, 29694, 71273, 29699, 29, 284, 29694, 486, 931, 3715, 317, 286, 1376, 46512, 4452, 19096, 1006, 310, 609, 77375, 345, 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