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_error_output2() { Command::cargo_bin("rrrocket") .unwrap() .args(&[ "-n", "-c", "--dry-run", "-m", "assets/fuzz-string-too-long.replay", ]) .assert() .success() .stderr(predicate::str::contains( "Unable to parse replay assets/fuzz-string-too-long.replay", )) .stderr(predicate::str::contains( "Crc mismatch. Expected 3765941959 but received 1825689991", )); }
rust_cleaned_test_functions.jsonl/88728
{ "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, 4096, 7645, 17, 368, 341, 286, 7348, 486, 66715, 21816, 445, 634, 46790, 1138, 310, 659, 15454, 741, 310, 659, 2116, 2099, 9640, 394, 6523, 77, 756, 394, 6523, 66, 756, 394, 14482, 53210, 22973,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_rcc_default() { use super::PLLP; let mut cfgr = CFGR { hse: None, hclk: None, sysclk: None, pclk1: None, pclk2: None, use_pll: false, use_pll48clk: false, pllm: 2, plln: 50, pllp: PLLP::Div2, pllq: 2, }; cfgr.pll_configure(); assert!(!cfgr.use_pll); let (clocks, _config) = cfgr.calculate_clocks(); assert_eq!(clocks.sysclk().0, 16_000_000); }
rust_cleaned_test_functions.jsonl/63519
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 366 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 638, 9993, 368, 341, 286, 990, 2256, 486, 2916, 12567, 401, 286, 1077, 5206, 24111, 901, 284, 20795, 8626, 341, 310, 305, 325, 25, 2240, 345, 310, 305, 32583, 25, 2240, 345, 310, 5708, 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_divide_by_zero() { let data = vec![ ( ScalarFuncSig::DivideReal, Datum::F64(f64::MAX), Datum::F64(f64::from(0)), ), ( ScalarFuncSig::DivideReal, Datum::F64(f64::MAX), Datum::F64(0.00000), ), ( ScalarFuncSig::DivideDecimal, str2dec("12.3"), str2dec("0.0"), ), ( ScalarFuncSig::DivideDecimal, str2dec("12.3"), str2dec("-0.0"), ), ]; let cases = vec![ (Flag::empty(), SqlMode::empty(), true, true), //warning ( Flag::IN_UPDATE_OR_DELETE_STMT, SqlMode::ERROR_FOR_DIVISION_BY_ZERO | SqlMode::STRICT_ALL_TABLES, false, false, ), //error ( Flag::IN_UPDATE_OR_DELETE_STMT, SqlMode::STRICT_ALL_TABLES, true, false, ), //ok ( Flag::IN_UPDATE_OR_DELETE_STMT | Flag::DIVIDED_BY_ZERO_AS_WARNING, SqlMode::ERROR_FOR_DIVISION_BY_ZERO | SqlMode::STRICT_ALL_TABLES, true, true, ), //warning ]; for (sig, left, right) in data { let lhs = datum_expr(left); let rhs = datum_expr(right); let scalar_func = scalar_func_expr(sig, &[lhs, rhs]); for (flag, sql_mode, is_ok, has_warning) in &cases { let mut cfg = EvalConfig::new(); cfg.set_flag(*flag).set_sql_mode(*sql_mode); let mut ctx = EvalContext::new(::std::sync::Arc::new(cfg)); let op = Expression::build(&mut ctx, scalar_func.clone()).unwrap(); let got = op.eval(&mut ctx, &[]); if *is_ok { assert_eq!(got.unwrap(), Datum::Null); } else { assert!(check_divide_by_zero(got.unwrap_err()).is_ok()); } if *has_warning { assert_eq!( ctx.take_warnings().warnings[0].get_code(), ERR_DIVISION_BY_ZERO ); } else { assert!(ctx.take_warnings().warnings.is_empty()); } } } }
rust_cleaned_test_functions.jsonl/82070
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1629 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16237, 577, 3710, 19359, 368, 341, 286, 1077, 821, 284, 7486, 90515, 310, 2399, 394, 35176, 9626, 47246, 486, 12509, 577, 12768, 345, 394, 68459, 486, 37, 21, 19, 955, 21, 19, 486, 10586, 1326, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_bind_and_run_with_limit() { let mut tmp_socket = TempFile::new().unwrap(); tmp_socket.remove().unwrap(); let path_to_socket = tmp_socket.as_path().to_str().unwrap().to_owned(); let api_thread_path_to_socket = path_to_socket.clone(); let to_vmm_fd = EventFd::new(libc::EFD_NONBLOCK).unwrap(); let (api_request_sender, _from_api) = channel(); let (_to_api, vmm_response_receiver) = channel(); let seccomp_filters = get_filters(SeccompConfig::Advanced).unwrap(); thread::Builder::new() .name("fc_api_test".to_owned()) .spawn(move || { ApiServer::new(api_request_sender, vmm_response_receiver, to_vmm_fd) .bind_and_run( PathBuf::from(api_thread_path_to_socket), ProcessTimeReporter::new(Some(1), Some(1), Some(1)), seccomp_filters.get("api").unwrap(), 50, ) .unwrap(); }) .unwrap(); // Wait for the server to set itself up. thread::sleep(Duration::from_millis(10)); let mut sock = UnixStream::connect(PathBuf::from(path_to_socket)).unwrap(); // Send a GET mmds request. assert!(sock .write_all( b"PUT http://localhost/home HTTP/1.1\r\n\ Content-Length: 50000\r\n\r\naaaaaa" ) .is_ok()); let mut buf: [u8; 265] = [0; 265]; assert!(sock.read(&mut buf[..]).unwrap() > 0); let error_message = b"HTTP/1.1 400 \r\n\ Server: Firecracker API\r\n\ Connection: keep-alive\r\n\ Content-Type: application/json\r\n\ Content-Length: 146\r\n\r\n{ \"error\": \"\ Request payload with size 50000 is larger than \ the limit of 50 allowed by server.\nAll previous \ unanswered requests will be dropped.\" }"; assert_eq!(&buf[..], &error_message[..]); }
rust_cleaned_test_functions.jsonl/78943
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1208 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27461, 8378, 14007, 6615, 14763, 368, 341, 286, 1077, 5206, 4174, 19555, 284, 19944, 1703, 486, 931, 1005, 15454, 543, 286, 4174, 19555, 4850, 1005, 15454, 543, 286, 1077, 1815, 2346, 19555, 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...
2
#[test] fn test_escape() { use bytes::BytesMut; let empty = ""; let escapes = "<=ABPQ"; let escaped = "bcadef"; let short = "foobar"; let long = "foobar".repeat(100); let mix = long.clone() + escapes + short + &long; let mix_escaped = long.clone() + escaped + short + &long; let mix_2 = long.repeat(3) + &escapes.repeat(3) + short + &escapes.repeat(2) + &long; let mix_escaped_2 = long.repeat(3) + &escaped.repeat(3) + short + &escaped.repeat(2) + &long; let mut buf = BytesMut::new(); b_escape(empty.as_bytes(), &mut buf); assert_eq!(buf.len(), 0); b_escape(short.as_bytes(), &mut buf); assert_eq!(buf.as_ref(), short.as_bytes()); let mut buf = BytesMut::new(); b_escape(long.as_bytes(), &mut buf); assert_eq!(buf.as_ref(), long.as_bytes()); let mut buf = BytesMut::new(); b_escape(escapes.as_bytes(), &mut buf); assert_eq!(buf.as_ref(), escaped.as_bytes()); let mut buf = BytesMut::new(); b_escape(mix.as_bytes(), &mut buf); assert_eq!(buf.as_ref(), mix_escaped.as_bytes()); let mut buf = BytesMut::new(); b_escape(mix_2.as_bytes(), &mut buf); assert_eq!(buf.as_ref(), mix_escaped_2.as_bytes()); let mut buf = BytesMut::with_capacity(4); for c in escapes.chars() { b_escape_char(c, &mut buf); } assert_eq!(buf.as_ref(), escaped.as_bytes()); let mut buf = BytesMut::with_capacity(0); b_escape_char('\u{3A3}', &mut buf); assert_eq!(buf.as_ref(), "\u{3A3}".as_bytes()) }
rust_cleaned_test_functions.jsonl/22939
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 819 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21832, 368, 341, 286, 990, 5820, 486, 7078, 51440, 401, 286, 1077, 4287, 284, 5438, 286, 1077, 65109, 284, 4055, 28, 1867, 47, 48, 876, 286, 1077, 27783, 284, 330, 8904, 329, 823, 876, 286, 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...
2
#[test] fn test_to_lines_from() { let mut buffer = setup_buffer("Test\nA\nTest"); buffer.set_mark(Mark::Cursor(0), 6); let mut lines = buffer.lines_from(Mark::Cursor(0)).unwrap(); assert_eq!(lines.next().unwrap(), [b'\n']); assert_eq!(lines.next().unwrap(), [b'T',b'e',b's',b't']); }
rust_cleaned_test_functions.jsonl/94763
{ "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, 2346, 18323, 5673, 368, 341, 286, 1077, 5206, 4147, 284, 6505, 7776, 445, 2271, 1699, 32, 1699, 2271, 797, 286, 4147, 980, 18924, 3189, 838, 486, 14543, 7, 15, 701, 220, 21, 317, 286, 1077, 52...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_spread() { use GradSpread::*; assert_approx_eq!(Reflect.at(0.3), 0.3, 1e-6); assert_approx_eq!(Reflect.at(-0.3), 0.3, 1e-6); assert_approx_eq!(Reflect.at(1.3), 0.7, 1e-6); assert_approx_eq!(Reflect.at(-1.3), 0.7, 1e-6); assert_approx_eq!(Repeat.at(0.3), 0.3); assert_approx_eq!(Repeat.at(-0.3), 0.7); }
rust_cleaned_test_functions.jsonl/97804
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 228 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10123, 878, 368, 341, 286, 990, 21794, 46486, 56162, 286, 2060, 90425, 10714, 10297, 72789, 6847, 7, 15, 13, 18, 701, 220, 15, 13, 18, 11, 220, 16, 68, 12, 21, 317, 286, 2060, 90425, 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_extending_by_multiple_delegates() { use super::IoHandlerExtension; use crate::delegates::IoDelegate; use std::sync::Arc; struct Test; impl Test { fn abc(&self, _p: crate::Params) -> Result<Value, crate::Error> { Ok(5.into()) } } let mut io = IoHandler::new(); let mut del1 = IoDelegate::new(Arc::new(Test)); del1.add_method("rpc_test", Test::abc); let mut del2 = IoDelegate::new(Arc::new(Test)); del2.add_method("rpc_test", Test::abc); fn augment<X: IoHandlerExtension>(x: X, io: &mut IoHandler) { x.augment(io); } augment((del1, del2), &mut io); }
rust_cleaned_test_functions.jsonl/95536
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 270 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9927, 2459, 3710, 45233, 2259, 53379, 368, 341, 197, 41819, 2256, 486, 42799, 3050, 12049, 280, 197, 41819, 17717, 486, 450, 53379, 486, 42799, 9381, 280, 197, 41819, 1460, 486, 12996, 486, 36809, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format() { assert_eq!("!", format!("{}", TypeQualifier::BangSingle)); assert_eq!("#", format!("{}", TypeQualifier::HashDouble)); assert_eq!("$", format!("{}", TypeQualifier::DollarString)); assert_eq!("%", format!("{}", TypeQualifier::PercentInteger)); assert_eq!("&", format!("{}", TypeQualifier::AmpersandLong)); }
rust_cleaned_test_functions.jsonl/56120
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 165 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 368, 341, 286, 2060, 10714, 17223, 18789, 3561, 79878, 3990, 83491, 486, 62819, 10888, 1106, 286, 2060, 10714, 0, 3584, 497, 3561, 79878, 3990, 83491, 486, 6370, 7378, 1106, 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_pool_force_scatter2() { let cpus = cpu_descriptor_from_socket_size(3, 4); let mut pool = ResourcePool::new(&ResourceDescriptor::new(cpus, Vec::new()), &[]); let rq1 = CpuRequest::ForceCompact(4).into(); pool.try_allocate_resources(&rq1, None).unwrap(); let rq1 = CpuRequest::Scatter(5).into(); let al1 = pool.try_allocate_resources(&rq1, None).unwrap(); assert_eq!(al1.cpus.len(), 5); assert_eq!(pool.get_sockets(&al1).len(), 2); }
rust_cleaned_test_functions.jsonl/92232
{ "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, 15709, 40739, 13171, 1650, 17, 368, 341, 286, 1077, 12490, 355, 284, 17319, 33774, 5673, 19555, 2368, 7, 18, 11, 220, 19, 317, 286, 1077, 5206, 7314, 284, 11765, 10551, 486, 931, 2099, 4783, 117...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_nft_state_with_class_success() { let (mut context, tx) = create_test_context(Action::Update(UpdateCase::UpdateStateWithClass), NftError::NoError); let tx = context.complete_tx(tx); // run let cycles = context .verify_tx(&tx, MAX_CYCLES) .expect("pass verification"); println!("consume cycles: {}", cycles); }
rust_cleaned_test_functions.jsonl/33581
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 157 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 1089, 723, 4387, 6615, 4790, 18632, 368, 341, 262, 1077, 320, 6984, 2266, 11, 9854, 8, 4035, 286, 1855, 4452, 8467, 21905, 486, 4289, 7, 4289, 4207, 486, 4289, 1397, 2354, 1957, 701, 451, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_cw_ccw() { let mut dcel = DCEL::new(); let v0 = dcel.insert_vertex(()); let v1 = dcel.insert_vertex(()); let v2 = dcel.insert_vertex(()); let v3 = dcel.insert_vertex(()); let e01 = dcel.connect_two_isolated_vertices(v0, v1, 0); let e12 = dcel.connect_edge_to_isolated_vertex(e01, v2); let e23 = dcel.connect_edge_to_isolated_vertex(e12, v3); let e30 = dcel.create_face(e23, e01); let e02 = dcel.create_face(e30, e23); let e02 = dcel.edge(e02); assert_eq!(e02.cw().fix(), e01); assert_eq!(e02.ccw().fix(), dcel.edges[e30].twin); }
rust_cleaned_test_functions.jsonl/7378
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 354 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 86, 28955, 86, 368, 341, 286, 1077, 5206, 294, 3672, 284, 422, 41664, 486, 931, 543, 286, 1077, 348, 15, 284, 294, 3672, 7030, 26611, 7, 1423, 286, 1077, 348, 16, 284, 294, 3672, 7030, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_error_messages() { assert_eq!( format!( "{}", MetricsError::NeverInitialized(String::from("Bad Metrics Path Provided")) ), "Bad Metrics Path Provided" ); assert_eq!( format!("{}", MetricsError::AlreadyInitialized), "Reinitialization of metrics not allowed." ); assert_eq!( format!( "{}", MetricsError::Write(std::io::Error::new(ErrorKind::Interrupted, "write")) ), "Failed to write metrics. Error: write" ); assert_eq!( format!( "{}", MetricsError::Serde("Failed to serialize the given data structure.".to_string()) ), "Failed to serialize the given data structure." ); }
rust_cleaned_test_functions.jsonl/34306
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 475 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4096, 23428, 368, 341, 286, 2060, 10714, 33673, 310, 3561, 33673, 394, 35503, 756, 394, 54190, 1454, 486, 26155, 22495, 2242, 486, 1499, 445, 17082, 54190, 7933, 53874, 5455, 310, 2837, 310, 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_iter_as_str() { let buf = "a buf"; let mut iter = Id::<RoleMarker>::iter(buf); assert_eq!(buf, iter.as_str()); // Advancing still returns the complete buffer. assert!(iter.next().is_none()); assert_eq!(buf, iter.as_str()); }
rust_cleaned_test_functions.jsonl/99692
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 143 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11723, 11898, 2895, 368, 341, 286, 1077, 6607, 284, 330, 64, 6607, 876, 286, 1077, 5206, 5367, 284, 5223, 27638, 9030, 20613, 6831, 2015, 10731, 317, 286, 2060, 10714, 10297, 5909, 11, 5367, 5357,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_atomic_musical_time() { let musical_time_1 = MusicalTime::new(4578749, 12390); let musical_time_2 = MusicalTime::new(5720495, 45781); let atomic_musical_time = AtomicMusicalTime::new(musical_time_1); assert_eq!(atomic_musical_time.get(), musical_time_1); atomic_musical_time.set(musical_time_2); std::thread::sleep(std::time::Duration::from_millis(1)); assert_eq!(atomic_musical_time.get(), musical_time_2); }
rust_cleaned_test_functions.jsonl/37373
{ "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, 51367, 717, 355, 938, 3009, 368, 341, 286, 1077, 17795, 3009, 62, 16, 284, 56257, 1462, 486, 931, 7, 19, 20, 22, 23, 22, 19, 24, 11, 220, 16, 17, 18, 24, 15, 317, 286, 1077, 17795, 3009, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_original_child_resolution() { let crypto = OpenMlsRustCrypto::default(); for ciphersuite in Config::supported_ciphersuites() { // Number of leaf nodes in the tree const NODES: usize = 10; // Resolution for root left child const LEFT_CHILD_RESOLUTION: &[usize] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; // Arbitrary unmerged leaves for root const ROOT_UNMERGED_LEAVES: &[u32] = &[2, 3, 4]; // Expected child resolution const EXPECTED_CHILD_RESOLUTION: &[usize] = &[0, 1, 2, 3, 5, 7, 9, 10, 11, 12, 13, 14]; let mut nodes = vec![]; let mut key_package_bundles = vec![]; for i in 0..NODES { let credential_bundle = CredentialBundle::new( vec![i as u8], CredentialType::Basic, ciphersuite.signature_scheme(), &crypto, ) .unwrap(); let key_package_bundle = KeyPackageBundle::new(&[ciphersuite.name()], &credential_bundle, &crypto, vec![]) .unwrap(); // We build a leaf node from the key packages let leaf_node = Node { node_type: NodeType::Leaf, key_package: Some(key_package_bundle.key_package().clone()), node: None, }; key_package_bundles.push(key_package_bundle); nodes.push(Some(leaf_node)); if i != NODES - 1 { // We insert blank parent nodes to get a longer resolution list nodes.push(None); } } // Root index let root_index = treemath::root(LeafIndex::from(NODES)); // The first key package bundle is used for the tree holder let key_package_bundle = key_package_bundles.remove(0); let mut tree = RatchetTree::new_from_nodes(&crypto, key_package_bundle, &nodes).unwrap(); // Left child index let left_child_index = treemath::left(root_index).unwrap(); // Populate the expected public key list let expected_public_keys_full = LEFT_CHILD_RESOLUTION .iter() .filter(|index| nodes[**index].is_some()) .map(|index| nodes[*index].as_ref().unwrap().public_hpke_key().unwrap()) .collect::<Vec<&HpkePublicKey>>(); assert_eq!( tree.original_child_resolution(left_child_index), expected_public_keys_full ); // Add unmerged leaves to root node let public_key = crypto .crypto() .derive_hpke_keypair( ciphersuite.hpke_config(), Secret::random(ciphersuite, &crypto, None).as_slice(), ) .public .into(); let new_root_node = Node { node_type: NodeType::Parent, node: Some(ParentNode { parent_hash: vec![].into(), public_key, unmerged_leaves: ROOT_UNMERGED_LEAVES .iter() .map(|index| LeafIndex::from(*index)) .collect(), }), key_package: None, }; tree.nodes[root_index] = new_root_node; // Populate the expected public key list let expected_public_keys_filtered = EXPECTED_CHILD_RESOLUTION .iter() .filter(|index| nodes[**index].is_some()) .map(|index| nodes[*index].as_ref().unwrap().public_hpke_key().unwrap()) .collect::<Vec<&HpkePublicKey>>(); // keys to be returned assert_eq!( tree.original_child_resolution(left_child_index), expected_public_keys_filtered ); } }
rust_cleaned_test_functions.jsonl/82139
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1972 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39556, 17268, 39849, 368, 341, 262, 1077, 19028, 284, 5264, 44, 4730, 49, 590, 58288, 486, 2258, 543, 262, 369, 272, 82077, 9302, 304, 5532, 486, 18216, 666, 82077, 3083, 288, 368, 341, 286, 442...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_por_circuit_poseidon_sub_8_2() { test_por_circuit::<TestTree2<PoseidonHasher, U8, U2>>(3, 1_377); }
rust_cleaned_test_functions.jsonl/88197
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 73 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 76628, 666, 37268, 33201, 90456, 5228, 62, 23, 62, 17, 368, 341, 286, 1273, 76628, 666, 37268, 27638, 2271, 6533, 17, 21604, 960, 90456, 6370, 261, 11, 547, 23, 11, 547, 17, 25526, 18, 11, 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
#[test] fn test_get_runtime_properties_no_children() { let root = Element::from_reader(ONLY_ROOT_AND_CHILD_NODES.as_bytes()).unwrap(); let actual = Unreal4ContextRuntimeProperties::from_xml(&root).expect("default struct"); assert_eq!(Unreal4ContextRuntimeProperties::default(), actual) }
rust_cleaned_test_functions.jsonl/28093
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 110 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 33232, 25158, 6536, 31206, 368, 341, 262, 1077, 3704, 284, 8543, 486, 1499, 22306, 7, 31092, 16197, 21767, 59196, 92948, 5357, 12524, 6011, 15454, 543, 262, 1077, 5042, 284, 79919, 19, 1972, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_compile_or_a() { let compiled = bitwise::compile_or("A".to_string()); assert_eq!(compiled.len(), 1); assert_eq!(compiled[0], 0b000011001); }
rust_cleaned_test_functions.jsonl/100585
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 81 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74170, 8734, 4306, 368, 341, 262, 1077, 19697, 284, 97970, 486, 20433, 8734, 445, 32, 3263, 983, 3904, 5231, 262, 2060, 10714, 10297, 50845, 19406, 1507, 220, 16, 317, 262, 2060, 10714, 10297, 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
#[test] fn test_step_replace_no_between() { let mut x = 4u128; let y = x.replace_zero(); assert_eq!(x, 0); assert_eq!(y, 4); x = 5; let y = x.replace_one(); assert_eq!(x, 1); assert_eq!(y, 5); }
rust_cleaned_test_functions.jsonl/54184
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 123 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11946, 10633, 6536, 48302, 368, 341, 262, 1077, 5206, 856, 284, 220, 19, 84, 16, 17, 23, 280, 262, 1077, 379, 284, 856, 6980, 19359, 543, 262, 2060, 10714, 10297, 87, 11, 220, 15, 317, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_10_elements() { let mut act; // all 0 act = BitVec::from_elem(10, false); assert!((act.eq_vec( &[false, false, false, false, false, false, false, false, false, false]))); assert!(act.none() && !act.all()); // all 1 act = BitVec::from_elem(10, true); assert!((act.eq_vec(&[true, true, true, true, true, true, true, true, true, true]))); assert!(!act.none() && act.all()); // mixed act = BitVec::from_elem(10, false); act.set(0, true); act.set(1, true); act.set(2, true); act.set(3, true); act.set(4, true); assert!((act.eq_vec(&[true, true, true, true, true, false, false, false, false, false]))); assert!(!act.none() && !act.all()); // mixed act = BitVec::from_elem(10, false); act.set(5, true); act.set(6, true); act.set(7, true); act.set(8, true); act.set(9, true); assert!((act.eq_vec(&[false, false, false, false, false, true, true, true, true, true]))); assert!(!act.none() && !act.all()); // mixed act = BitVec::from_elem(10, false); act.set(0, true); act.set(3, true); act.set(6, true); act.set(9, true); assert!((act.eq_vec(&[true, false, false, true, false, false, true, false, false, true]))); assert!(!act.none() && !act.all()); }
rust_cleaned_test_functions.jsonl/62078
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 757 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 16, 15, 22801, 368, 341, 286, 1077, 5206, 1160, 280, 286, 442, 678, 220, 15, 271, 286, 1160, 284, 6495, 10050, 486, 1499, 28179, 7, 16, 15, 11, 895, 317, 286, 2060, 0, 1188, 531, 26662, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_blank_hash() { let iv = get_sha256_iv(); let mut cs = TestConstraintSystem::<Fr>::new(); let mut input_bits: Vec<_> = (0..512).map(|_| Boolean::Constant(false)).collect(); input_bits[0] = Boolean::Constant(true); let out = sha256_compression_function(&mut cs, &input_bits, &iv).unwrap(); let out_bits: Vec<_> = out.into_iter().flat_map(|e| e.into_bits_be()).collect(); assert!(cs.is_satisfied()); assert_eq!(cs.num_constraints(), 0); let expected = hex!("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); let mut out = out_bits.into_iter(); for b in expected.iter() { for i in (0..8).rev() { let c = out.next().unwrap().get_value().unwrap(); assert_eq!(c, (b >> i) & 1u8 == 1u8); } } }
rust_cleaned_test_functions.jsonl/38847
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 446 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 56103, 8950, 368, 341, 286, 1077, 17509, 284, 633, 48836, 17, 20, 21, 51411, 1428, 286, 1077, 5206, 10532, 284, 3393, 17890, 2320, 27638, 22560, 6831, 931, 543, 286, 1077, 5206, 1946, 20034, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_parse_input() { let input = "0,3,6"; let expected = Container { input: vec![0, 3, 6], }; let mut cont = Container::new(); assert_eq!(Ok(()), cont.parse_input(input)); assert_eq!(expected, cont); }
rust_cleaned_test_functions.jsonl/103728
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 145 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 5898, 368, 341, 286, 1077, 1946, 284, 330, 15, 11, 18, 11, 21, 3302, 286, 1077, 3601, 284, 9678, 341, 310, 1946, 25, 7486, 20703, 15, 11, 220, 18, 11, 220, 21, 1259, 286, 3634, 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_hunk_header_style_underline_deprecated_options() { _do_test_hunk_header_style_underline(&[ "--hunk-color", "black", "--hunk-style", "underline", ]); }
rust_cleaned_test_functions.jsonl/70103
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 138 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 3122, 8757, 15117, 58228, 1056, 2259, 19889, 8743, 368, 341, 286, 716, 2982, 4452, 1523, 3122, 8757, 15117, 58228, 1056, 2099, 9640, 310, 14482, 71, 3122, 7889, 756, 310, 330, 11453, 756, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_has_extension() { let mut buf = PathBuf::from("/"); let extensions = vec!["js"]; assert_eq!(has_extension(&buf, &extensions), false); buf.set_file_name("some-file.rs"); assert_eq!(has_extension(&buf, &extensions), false); buf.set_file_name("some-file.js"); assert_eq!(has_extension(&buf, &extensions), true) }
rust_cleaned_test_functions.jsonl/36953
{ "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, 21778, 31035, 368, 341, 286, 1077, 5206, 6607, 284, 7933, 15064, 486, 1499, 58423, 286, 1077, 19721, 284, 7486, 0, 1183, 2519, 31797, 286, 2060, 10714, 10297, 4648, 31035, 2099, 5909, 11, 609, 276...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_update_stage_instance() { let route = Route::UpdateStageInstance { channel_id: CHANNEL_ID, }; assert_eq!( route.to_string(), format!("stage-instances/{channel_id}", channel_id = CHANNEL_ID) ); }
rust_cleaned_test_functions.jsonl/119914
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 150 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 35238, 11904, 368, 341, 286, 1077, 6021, 284, 9572, 486, 4289, 19398, 2523, 341, 310, 5496, 842, 25, 58756, 3450, 345, 286, 2605, 286, 2060, 10714, 33673, 310, 6021, 2389, 3904, 3148, 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
#[test] fn test_request_size_index() { assert_eq!(request_size_index(0x0), 0); assert_eq!(request_size_index(0x3ff), 0); assert_eq!(request_size_index(0x400), 1); assert_eq!(request_size_index(0xfff), 1); assert_eq!(request_size_index(0x1000), 2); assert_eq!(request_size_index(0x3fff), 2); assert_eq!(request_size_index(0x4000), 3); assert_eq!(request_size_index(0xffff), 3); assert_eq!(request_size_index(0x1_0000), 4); assert_eq!(request_size_index(0x1_ffff), 4); assert_eq!(request_size_index(0x2_0000), 5); assert_eq!(request_size_index(0x7_ffff), 5); assert_eq!(request_size_index(0x8_0000), 6); assert_eq!(request_size_index(0xf_ffff), 6); assert_eq!(request_size_index(0x10_0000), 7); assert_eq!(request_size_index(usize::MAX), 7); }
rust_cleaned_test_functions.jsonl/40870
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 442 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7893, 2368, 3560, 368, 341, 286, 2060, 10714, 10297, 2035, 2368, 3560, 7, 15, 87, 15, 701, 220, 15, 317, 286, 2060, 10714, 10297, 2035, 2368, 3560, 7, 15, 87, 18, 542, 701, 220, 15, 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_header_pack_unpack() { let body_value = 305_888; let message_id_value = 40; let header = SrvHeader::new(body_value, message_id_value, true); assert_eq!(header.body_len(), body_value as usize); assert_eq!(header.message_id_len(), message_id_value as usize); assert_eq!(header.is_transaction(), true); }
rust_cleaned_test_functions.jsonl/100366
{ "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, 8757, 32995, 54889, 368, 341, 286, 1077, 2487, 3142, 284, 220, 18, 15, 20, 62, 23, 23, 23, 280, 286, 1077, 1943, 842, 3142, 284, 220, 19, 15, 280, 286, 1077, 4247, 284, 328, 10553, 4047, 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_leader_transfer_timeout() { setup_for_test(); let mut nt = Network::new(vec![None, None, None]); nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]); nt.isolate(3); nt.send(vec![new_message(3, 1, MessageType::MsgTransferLeader, 0)]); assert_eq!(nt.peers[&1].lead_transferee.unwrap(), 3); let heartbeat_timeout = nt.peers[&1].get_heartbeat_timeout(); let election_timeout = nt.peers[&1].get_election_timeout(); for _ in 0..heartbeat_timeout { nt.peers.get_mut(&1).unwrap().tick(); } assert_eq!(nt.peers[&1].lead_transferee.unwrap(), 3); for _ in 0..election_timeout - heartbeat_timeout { nt.peers.get_mut(&1).unwrap().tick(); } check_leader_transfer_state(&nt.peers[&1], StateRole::Leader, 1); }
rust_cleaned_test_functions.jsonl/107169
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 355 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79991, 35403, 20537, 368, 341, 262, 6505, 5478, 4452, 543, 262, 1077, 5206, 31412, 284, 8141, 486, 931, 25592, 20703, 4064, 11, 2240, 11, 2240, 2558, 262, 31412, 5219, 25592, 20703, 931, 6462, 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...
3
#[test] fn test_case_10() { let key = [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; let message = [ 0xe3, 0x35, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0xb9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0x79, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; let expected = [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; poly1305_test_runner(&key, &message, &expected).unwrap(); }
rust_cleaned_test_functions.jsonl/27925
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 567 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19096, 62, 16, 15, 368, 341, 197, 10217, 1376, 284, 2278, 298, 197, 15, 87, 15, 16, 11, 220, 15, 87, 15, 15, 11, 220, 15, 87, 15, 15, 11, 220, 15, 87, 15, 15, 11, 220, 15, 87, 15, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_rasterband_size() { let dataset = Dataset::open(fixture!("tinymarble.png")).unwrap(); let rasterband = dataset.rasterband(1).unwrap(); let size = rasterband.size(); assert_eq!(size, (100, 50)); }
rust_cleaned_test_functions.jsonl/83456
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 1710, 2300, 7053, 2368, 368, 341, 262, 1077, 10337, 284, 39183, 486, 2508, 94886, 17223, 55971, 1600, 277, 891, 3508, 15197, 15454, 543, 262, 1077, 47208, 7053, 284, 10337, 1746, 2300, 7053, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_exact_size_iterator() { let heap = BinaryHeap::from(vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1]); check_exact_size_iterator(heap.len(), heap.iter()); check_exact_size_iterator(heap.len(), heap.clone().into_iter()); check_exact_size_iterator(heap.len(), heap.clone().into_iter_sorted()); check_exact_size_iterator(heap.len(), heap.clone().drain()); check_exact_size_iterator(heap.len(), heap.clone().drain_sorted()); }
rust_cleaned_test_functions.jsonl/62355
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 196 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 71084, 2368, 13491, 368, 341, 262, 1077, 17364, 284, 17718, 27909, 486, 1499, 25592, 20703, 17, 11, 220, 19, 11, 220, 21, 11, 220, 17, 11, 220, 16, 11, 220, 23, 11, 220, 16, 15, 11, 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_handler() { let mem = GuestMemory::new(&[(GuestAddress(0), 0x10000)]).unwrap(); let (mut h, txq, rxq) = default_test_netepollhandler(&mem, TestMutators::default()); let daddr = 0x2000; assert!(daddr as usize > txq.end().0); { assert_eq!(h.rx.bytes_read, 0); // Let's imagine we received some data. h.rx.bytes_read = MAX_BUFFER_SIZE; { // a read only descriptor rxq.avail.ring[0].set(0); rxq.avail.idx.set(1); rxq.dtable[0].set(daddr, 0x1000, 0, 0); assert!(!h.rx_single_frame_no_irq_coalescing()); assert_eq!(rxq.used.idx.get(), 1); // resetting values rxq.used.idx.set(0); h.rx.queue = rxq.create_queue(); h.interrupt_evt.write(1).unwrap(); assert_eq!(h.interrupt_evt.read().unwrap(), 2); } { rxq.dtable[0].flags.set(VIRTQ_DESC_F_WRITE); check_metric_after_block!( &METRICS.net.rx_fails, 1, assert!(!h.rx_single_frame_no_irq_coalescing()) ); assert_eq!(rxq.used.idx.get(), 1); rxq.used.idx.set(0); h.rx.queue = rxq.create_queue(); h.interrupt_evt.write(1).unwrap(); assert_eq!(h.interrupt_evt.read().unwrap(), 2); } // set rx_count back to 0 h.rx.bytes_read = 0; } // Now let's move on to the actual device events. { // testing TX_QUEUE_EVENT txq.avail.idx.set(1); txq.avail.ring[0].set(0); txq.dtable[0].set(daddr, 0x1000, 0, 0); h.tx.queue_evt.write(1).unwrap(); h.handle_event(TX_QUEUE_EVENT, EPOLLIN).unwrap(); // Make sure the data queue advanced. assert_eq!(txq.used.idx.get(), 1); } { // testing RX_TAP_EVENT assert!(!h.rx.deferred_frame); // this should work just fine rxq.avail.idx.set(1); rxq.avail.ring[0].set(0); rxq.dtable[0].set(daddr, 0x1000, VIRTQ_DESC_F_WRITE, 0); h.interrupt_evt.write(1).unwrap(); h.handle_event(RX_TAP_EVENT, EPOLLIN).unwrap(); assert!(h.rx.deferred_frame); assert_eq!(h.interrupt_evt.read().unwrap(), 2); assert_eq!(rxq.used.ring[0].get().len, 1234); // a different execution path. // reset some parts of the queue first h.rx.queue = rxq.create_queue(); rxq.used.idx.set(0); // this should also be successful h.interrupt_evt.write(1).unwrap(); h.handle_event(RX_TAP_EVENT, EPOLLIN).unwrap(); assert!(h.rx.deferred_frame); assert_eq!(h.interrupt_evt.read().unwrap(), 2); // we can fit inside a single descriptor h.rx.bytes_read = MAX_BUFFER_SIZE; h.rx.queue = rxq.create_queue(); rxq.used.idx.set(0); h.interrupt_evt.write(1).unwrap(); check_metric_after_block!( &METRICS.net.rx_fails, 1, h.handle_event(RX_TAP_EVENT, EPOLLIN) ); assert!(h.rx.deferred_frame); assert_eq!(h.interrupt_evt.read().unwrap(), 2); // A mismatch shows the reception was unsuccessful. assert_ne!(rxq.used.ring[0].get().len as usize, h.rx.bytes_read); h.rx.bytes_read = 1234; } { // now also try an RX_QUEUE_EVENT rxq.avail.idx.set(2); rxq.avail.ring[1].set(1); rxq.dtable[1].set(daddr + 0x1000, 0x1000, VIRTQ_DESC_F_WRITE, 0); h.rx.queue_evt.write(1).unwrap(); h.interrupt_evt.write(1).unwrap(); check_metric_after_block!( &METRICS.net.rx_count, 2, h.handle_event(RX_QUEUE_EVENT, EPOLLIN).unwrap() ); assert_eq!(h.interrupt_evt.read().unwrap(), 2); } { let test_mutators = TestMutators { tap_read_fail: true, }; let mem = GuestMemory::new(&[(GuestAddress(0), 0x10000)]).unwrap(); let (mut h, _txq, _rxq) = default_test_netepollhandler(&mem, test_mutators); check_metric_after_block!(&METRICS.net.rx_fails, 1, h.process_rx()); } }
rust_cleaned_test_functions.jsonl/84704
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2871 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10183, 368, 341, 286, 1077, 1833, 284, 26215, 10642, 486, 931, 2099, 9697, 37804, 4286, 7, 15, 701, 220, 15, 87, 16, 15, 15, 15, 15, 7252, 568, 15454, 543, 286, 1077, 320, 6984, 305, 11, 985...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_duplicate_detect_incremental() { let storage = TestStorageBuilder::new(DummyLockManager {}, false) .build() .unwrap(); for &start in &[100, 104, 108, 112] { let end = start + 10; let mut data = vec![]; for i in start..end { let key = format!("{}", i); let value = format!("{}", i); data.push((key.as_bytes().to_vec(), value.as_bytes().to_vec())) } write_data(&storage, data, start - 90); } // We have to do the prewrite manually so that the mem locks don't get released. let snapshot = storage.get_snapshot(); let start = format!("{}", 0); let detector = DuplicateDetector::new(snapshot, start.as_bytes().to_vec(), None, 16, false).unwrap(); let mut expected_kvs = vec![]; for &(i, ts) in &[ (108u64, 14), (108, 18), (109, 14), (109, 18), (110, 14), (110, 18), (111, 14), (111, 18), (112, 14), (112, 18), (112, 22), (113, 14), (113, 18), (113, 22), (114, 18), (114, 22), (115, 18), (115, 22), (116, 18), (116, 22), (117, 18), (117, 22), ] { let key = format!("{}", i); let value = format!("{}", i); expected_kvs.push((key.as_bytes().to_vec(), value.as_bytes().to_vec(), ts)); } expected_kvs.sort_by(|a, b| { if a.0 == b.0 { b.2.cmp(&a.2) } else { a.0.cmp(&b.0) } }); check_duplicate_data(detector, expected_kvs); }
rust_cleaned_test_functions.jsonl/108497
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1100 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 70434, 56457, 51482, 278, 368, 341, 286, 1077, 5819, 284, 3393, 5793, 3297, 486, 931, 5432, 8574, 11989, 2043, 16452, 895, 340, 310, 659, 5834, 741, 310, 659, 15454, 543, 286, 369, 609, 2468, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_decoder_invalid_carriage_return() { // CR in the multibyte mode is invalid but *also* resets the state let mut d = HZEncoding.decoder(); assert_feed_ok!(d, b"~{#A", b"", "\uff21"); assert_feed_err!(d, b"", b"\n", b"", ""); assert_feed_ok!(d, b"#B~{#C", b"", "#B\uff23"); assert_feed_err!(d, b"", b"#\n", b"", ""); assert_feed_ok!(d, b"#D", b"", "#D"); assert_finish_ok!(d, ""); }
rust_cleaned_test_functions.jsonl/48122
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 253 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49843, 31433, 26616, 8775, 12511, 368, 341, 286, 442, 12617, 304, 279, 2745, 579, 78361, 3856, 374, 8318, 714, 353, 18654, 9, 66197, 279, 1584, 198, 286, 1077, 5206, 294, 284, 472, 57, 14690, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_calculate_percentage_change() { assert_eq!(calculate_percentage_change(1 as f32, 2 as f32), "+100%"); assert_eq!(calculate_percentage_change(2 as f32, 1 as f32), "-50%"); assert_eq!(calculate_percentage_change(1 as f32, 1 as f32), "0%"); assert_eq!(calculate_percentage_change(1.2, 2.4), "+100%"); assert_eq!(calculate_percentage_change(2.4, 1.2), "-50%"); assert_eq!(calculate_percentage_change(1.1, 1.1), "0%"); }
rust_cleaned_test_functions.jsonl/66216
{ "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, 24005, 11207, 46044, 15947, 368, 341, 286, 2060, 10714, 10297, 35597, 46044, 15947, 7, 16, 438, 282, 18, 17, 11, 220, 17, 438, 282, 18, 17, 701, 6630, 16, 15, 15, 92243, 286, 2060, 10714, 1029...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_encode_with_one_attribute_success() { let expected = json!({ "address2": { "encoded": "68086943237164982734333428280784300550565381723532936263016368251445461241953", "raw": "101 Wilson Lane" } }); static TEST_CREDENTIAL_DATA: &str = r#"{"address2":["101 Wilson Lane"]}"#; let expected_json = serde_json::to_string_pretty(&expected).unwrap(); let results_json = encode_attributes(TEST_CREDENTIAL_DATA).unwrap(); assert_eq!(expected_json, results_json, "encode_attributes failed to return expected results"); }
rust_cleaned_test_functions.jsonl/104610
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 289 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11224, 6615, 11667, 16791, 18632, 368, 1476, 286, 1077, 3601, 284, 2951, 0, 2262, 688, 330, 4995, 17, 788, 341, 310, 330, 19329, 788, 330, 21, 23, 15, 23, 21, 24, 19, 18, 17, 18, 22, 16, 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_to_seed() { let mnemonic = "actress tongue harbor tray suspect odor load topple vocal avoid ignore apple lunch unknown tissue museum once switch captain place lemon sail outdoor absent creek"; let seed = mnemonic::to_key(mnemonic).unwrap(); let account = Account::from_seed(seed); assert_eq!(mnemonic::to_key(&account.mnemonic()).unwrap(), seed); }
rust_cleaned_test_functions.jsonl/102481
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 140 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 33809, 368, 341, 286, 1077, 86801, 284, 330, 531, 673, 24459, 56411, 34688, 15207, 52997, 2795, 44041, 273, 25407, 5648, 10034, 23268, 15786, 9788, 19847, 23971, 3055, 3398, 23915, 1992, 29464, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_eq_not_identical() { let a = KeyEntry { options: None, key_type: "ssh-rsa".to_owned(), key: "abc".to_owned(), comment: None, }; let b = KeyEntry { options: None, key_type: "ssh-dss".to_owned(), key: "abc".to_owned(), comment: None, }; assert_ne!(a, b); }
rust_cleaned_test_functions.jsonl/31219
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 248 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10714, 7913, 38399, 938, 368, 341, 286, 1077, 264, 284, 5309, 5874, 341, 310, 2606, 25, 2240, 345, 310, 1376, 1819, 25, 330, 25537, 3795, 9081, 3263, 983, 51973, 3148, 310, 1376, 25, 330, 13683,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_response() { let _ = pretty_env_logger::try_init(); let mut raw = BytesMut::from("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); let ctx = ParseContext { cached_headers: &mut None, req_method: &mut Some(crate::Method::GET), h1_parser_config: Default::default(), h1_header_read_timeout: None, h1_header_read_timeout_fut: &mut None, h1_header_read_timeout_running: &mut false, preserve_header_case: false, h09_responses: false, #[cfg(feature = "ffi")] on_informational: &mut None, #[cfg(feature = "ffi")] raw_headers: false, }; let msg = Client::parse(&mut raw, ctx).unwrap().unwrap(); assert_eq!(raw.len(), 0); assert_eq!(msg.head.subject, crate::StatusCode::OK); assert_eq!(msg.head.version, crate::Version::HTTP_11); assert_eq!(msg.head.headers.len(), 1); assert_eq!(msg.head.headers["Content-Length"], "0"); }
rust_cleaned_test_functions.jsonl/7658
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 536 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 9655, 368, 341, 286, 1077, 716, 284, 5020, 15879, 27413, 486, 1539, 6137, 543, 286, 1077, 5206, 7112, 284, 30024, 51440, 486, 1499, 445, 9230, 14, 16, 13, 16, 220, 17, 15, 15, 10402, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_rpc_get_version() { let bob_pubkey = solana_sdk::pubkey::new_rand(); let RpcHandler { io, meta, .. } = start_rpc_handler_with_tx(&bob_pubkey); let req = r#"{"jsonrpc":"2.0","id":1,"method":"getVersion"}"#; let res = io.handle_request_sync(req, meta); let version = solana_version::Version::default(); let expected = json!({ "jsonrpc": "2.0", "result": { "solana-core": version.to_string(), "feature-set": version.feature_set, }, "id": 1 }); let expected: Response = serde_json::from_value(expected).expect("expected response deserialization"); let result: Response = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); assert_eq!(expected, result); }
rust_cleaned_test_functions.jsonl/3049
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 428 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60799, 3062, 9438, 368, 341, 286, 1077, 35192, 34014, 792, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 79961, 3050, 314, 6399, 11, 8823, 11, 5241, 335, 284, 1191, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_paramspec_expression() { let pspec = ParamSpecExpression::new( "expression", "Expression", "Some Expression", glib::ParamFlags::CONSTRUCT_ONLY | glib::ParamFlags::READABLE, ); let expr_pspec = pspec.downcast::<ParamSpecExpression>(); assert!(expr_pspec.is_ok()); }
rust_cleaned_test_functions.jsonl/117909
{ "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, 6745, 992, 28068, 368, 341, 286, 1077, 4726, 992, 284, 6991, 8327, 9595, 486, 931, 1006, 310, 330, 28099, 756, 310, 330, 9595, 756, 310, 330, 8373, 16378, 756, 310, 342, 2740, 486, 2001, 9195, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_fq_hash_to_field_xof_shake128() { use crate::hash_to_field::{hash_to_field, ExpandMsgXof}; use sha3::Shake128; let u = hash_to_field::<Fq, ExpandMsgXof<Shake128>>(b"hello world", b"asdfqwerzxcv", 5); let expect = FqRepr([ 0x24606c02a2832651u64, 0x938bdda212c48cebu64, 0x1efda56062ec419eu64, 0x56875b0494cf23c3u64, 0x949e3a98626b3315u64, 0xc26e7d7774840efu64, ]); assert_eq!(u[0], Fq::from_repr(expect).unwrap()); let expect = FqRepr([ 0x9ad7d8d863f5bfd3u64, 0x1a7fed20387de776u64, 0x6940573ad5f2a648u64, 0x836dc98edb77a5fau64, 0x83a168be2975dc4cu64, 0x6aa86f37d87b8cbu64, ]); assert_eq!(u[1], Fq::from_repr(expect).unwrap()); let expect = FqRepr([ 0x15adbbe5d2882d3eu64, 0xa3c020ddabea153u64, 0xd5a7221a07f9c8bfu64, 0xc8129a2c66578e42u64, 0x4602d1382e5bb3f3u64, 0x131f6d4aad6c289du64, ]); assert_eq!(u[2], Fq::from_repr(expect).unwrap()); let expect = FqRepr([ 0xb474338a39faf63au64, 0xae4f84a983c65a3bu64, 0x79bdddd1f69341u64, 0x837431a260f39db6u64, 0x5648bea8387eacb8u64, 0x10cc1407134a8b52u64, ]); assert_eq!(u[3], Fq::from_repr(expect).unwrap()); let expect = FqRepr([ 0xde0bb37d7fd2c03u64, 0x938b1e576b3bdbf5u64, 0xf26d472ca0462516u64, 0x32e742ce787399au64, 0x3cbe0849357f259u64, 0x182cd9a1a944fce4u64, ]); assert_eq!(u[4], Fq::from_repr(expect).unwrap()); }
rust_cleaned_test_functions.jsonl/2341
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1200 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 80, 8950, 2346, 5013, 3212, 1055, 3712, 726, 16, 17, 23, 368, 341, 286, 990, 17717, 486, 8296, 2346, 5013, 22964, 8296, 2346, 5013, 11, 50141, 6611, 55, 1055, 2440, 286, 990, 15870, 18, 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_tuple() { let mut buf = vec![]; let mut ser = Serializer { write: &mut buf }; let t: (u64, u64, u64) = (1, 2, 3); t.serialize(&mut ser).unwrap(); assert_eq!( buf, [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] ); }
rust_cleaned_test_functions.jsonl/79246
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 250 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21773, 368, 341, 262, 1077, 5206, 6607, 284, 7486, 0, 15078, 262, 1077, 5206, 1420, 284, 58822, 314, 3270, 25, 609, 6984, 6607, 2605, 262, 1077, 259, 25, 320, 84, 21, 19, 11, 575, 21, 19, 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_exact_partial() { let needle = b"AAAAAT"; let haystack = b"ACGACTAGTTATAAAAATTCNACTCCANTTAGCTCCCTACTTTCCGAGAG"; check_test(needle, haystack, 0); }
rust_cleaned_test_functions.jsonl/83257
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 99 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 71084, 52068, 368, 341, 286, 1077, 30309, 284, 293, 1, 25699, 828, 876, 286, 1077, 88447, 284, 293, 1, 1706, 38, 6823, 1890, 14903, 4485, 50107, 828, 7749, 45, 6823, 3706, 2821, 32144, 1162, 370...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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() { assert_eq!( Number::from_parts(123456, 98278734873) + Number::from_parts(929, 2334), Number::from_parts(124385, 98278737207) ); }
rust_cleaned_test_functions.jsonl/71158
{ "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, 2891, 368, 341, 286, 2060, 10714, 33673, 310, 5624, 486, 1499, 33217, 7, 16, 17, 18, 19, 20, 21, 11, 220, 24, 23, 17, 22, 23, 22, 18, 19, 23, 22, 18, 8, 488, 5624, 486, 1499, 33217, 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_drop_panics() { use std::cell::Cell; use std::panic::catch_unwind; use std::panic::AssertUnwindSafe; let flag = &Cell::new(0); struct Bump<'a>(&'a Cell<i32>); // Panic in the first drop impl<'a> Drop for Bump<'a> { fn drop(&mut self) { let n = self.0.get(); self.0.set(n + 1); if n == 0 { panic!("Panic in Bump's drop"); } } } // check if rust is new enough flag.set(0); { let array = vec![Bump(flag), Bump(flag)]; let res = catch_unwind(AssertUnwindSafe(|| { drop(array); })); assert!(res.is_err()); } if flag.get() != 2 { println!("test_drop_panics: skip, this version of Rust doesn't continue in drop_in_place"); return; } flag.set(0); { let mut array = ArrayVec::<[Bump; 128]>::new(); array.push(Bump(flag)); array.push(Bump(flag)); array.push(Bump(flag)); let res = catch_unwind(AssertUnwindSafe(|| { drop(array); })); assert!(res.is_err()); } assert_eq!(flag.get(), 3); flag.set(0); { let mut array = ArrayVec::<[Bump; 16]>::new(); array.push(Bump(flag)); array.push(Bump(flag)); array.push(Bump(flag)); array.push(Bump(flag)); array.push(Bump(flag)); let i = 2; let tail_len = array.len() - i; let res = catch_unwind(AssertUnwindSafe(|| { array.truncate(i); })); assert!(res.is_err()); assert_eq!(flag.get(), tail_len as i32); } }
rust_cleaned_test_functions.jsonl/36765
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 893 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29584, 71099, 1211, 368, 341, 262, 990, 1460, 486, 5873, 486, 3599, 280, 262, 990, 1460, 486, 19079, 486, 7173, 4907, 19154, 280, 262, 990, 1460, 486, 19079, 486, 8534, 1806, 19154, 25663, 401, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_decoder_default() { let result_value: String = read_to_string("tests/schema/result-example.json") .unwrap() .parse() .unwrap(); let _m = mock("GET", "/schemas/ids/7?deleted=true") .with_status(200) .with_header("content-type", "application/vnd.schemaregistry.v1+json") .with_body(&get_json_body(json_result_schema(), 7)) .create(); let sr_settings = SrSettings::new(format!("http://{}", server_address())); let mut decoder = JsonDecoder::new(sr_settings); let result = decoder.decode(Some(&*get_payload(7, result_value.into_bytes()))); let message = match result { Ok(Some(x)) => x, Err(e) => panic!("Error: {:?}, while none expected", e), Ok(v) => panic!("Other value: {:?} than expected Message", v), }; let validation = message.schema.validate(&message.value); assert_eq!(true, validation.is_strictly_valid()); assert_eq!(true, validation.errors.is_empty()); assert_eq!( "string", message .value .as_object() .unwrap() .get("down") .unwrap() .as_str() .unwrap() ); assert_eq!( "STRING", message .value .as_object() .unwrap() .get("up") .unwrap() .as_str() .unwrap() ) }
rust_cleaned_test_functions.jsonl/42268
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 891 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49843, 9993, 368, 341, 286, 1077, 1102, 3142, 25, 923, 284, 1349, 2346, 3904, 445, 23841, 61142, 82907, 43430, 4323, 1138, 310, 659, 15454, 741, 310, 659, 6400, 741, 310, 659, 15454, 543, 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...
2
#[test] fn test_comb_filter_inplace() { let mut output = [0_f32; SIZE]; output .iter_mut() .enumerate() .for_each(|(i, x)| *x = i as f32); let offset = SIZE - N; comb_filter_inplace(&mut output, offset, T0, T1, N, G0, G1, 0, 0, OVERLAP); (0..N).into_iter().for_each(|i| { assert!((1.0 - (output[offset + i] / TEST_VECTOR2[i])).abs() < 0.00001); }); }
rust_cleaned_test_functions.jsonl/120646
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 259 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34454, 8727, 1243, 2007, 368, 341, 286, 1077, 5206, 2550, 284, 508, 15, 761, 18, 17, 26, 25341, 935, 286, 2550, 198, 310, 659, 2015, 29523, 741, 310, 659, 76569, 741, 310, 659, 1958, 32046, 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_clean_old_with_normal_account() { solana_logger::setup(); let accounts = AccountsDB::new(Vec::new()); let pubkey = Pubkey::new_rand(); let account = Account::new(1, 0, &Account::default().owner); //store an account accounts.store(0, &[(&pubkey, &account)]); accounts.store(1, &[(&pubkey, &account)]); // simulate slots are rooted after while accounts.add_root(0); accounts.add_root(1); assert_eq!(accounts.store_count_for_slot(0), 1); assert_eq!(accounts.store_count_for_slot(1), 1); accounts.clean_accounts(); //now old state is cleaned up assert_eq!(accounts.store_count_for_slot(0), 0); assert_eq!(accounts.store_count_for_slot(1), 1); }
rust_cleaned_test_functions.jsonl/33675
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 370 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19573, 21108, 6615, 13973, 13500, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 1428, 286, 1077, 9618, 284, 40655, 3506, 486, 931, 49923, 486, 931, 1423, 286, 1077, 95116, 284, 22611, 792, 486, 93...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_deserialization_from_string() { let s = "{\"file\":\"testdata/testfile-zero.bin\",\"chunks\":[],\"digest\":[-8.252427688355256,null,null]}"; let doc: Document = serde_json::from_slice(s); assert_eq!("testdata/testfile-zero.bin", doc.file); assert!(approx_eq(f64, -8.252427, doc.digest[0], epsilon = 0.0)); }
rust_cleaned_test_functions.jsonl/39895
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 172 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15768, 50563, 5673, 3904, 368, 341, 286, 1077, 274, 284, 54734, 1192, 23488, 92425, 12697, 1192, 36929, 29394, 34333, 84263, 59, 8899, 1125, 2105, 36339, 11693, 7609, 23, 13, 17, 20, 17, 19, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_vote_accounts() { let rpc = RpcHandler::start(); let mut bank = rpc.working_bank(); let RpcHandler { ref io, ref meta, ref mint_keypair, ref leader_vote_keypair, .. } = rpc; assert_eq!(bank.vote_accounts().len(), 1); // Create a vote account with no stake. let alice_vote_keypair = Keypair::new(); let alice_vote_state = VoteState::new( &VoteInit { node_pubkey: mint_keypair.pubkey(), authorized_voter: alice_vote_keypair.pubkey(), authorized_withdrawer: alice_vote_keypair.pubkey(), commission: 0, }, &bank.get_sysvar_cache_for_tests().get_clock().unwrap(), ); rpc.store_vote_account(&alice_vote_keypair.pubkey(), alice_vote_state); assert_eq!(bank.vote_accounts().len(), 2); // Check getVoteAccounts: the bootstrap validator vote account will be delinquent as it has { let req = r#"{"jsonrpc":"2.0","id":1,"method":"getVoteAccounts"}"#; let res = io.handle_request_sync(req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); let vote_account_status: RpcVoteAccountStatus = serde_json::from_value(result["result"].clone()).unwrap(); assert!(vote_account_status.current.is_empty()); assert_eq!(vote_account_status.delinquent.len(), 1); for vote_account_info in vote_account_status.delinquent { assert_ne!(vote_account_info.activated_stake, 0); } } let mut advance_bank = || { bank.freeze(); // Votes let instructions = [ vote_instruction::vote( &leader_vote_keypair.pubkey(), &leader_vote_keypair.pubkey(), Vote { slots: vec![bank.slot()], hash: bank.hash(), timestamp: None, }, ), vote_instruction::vote( &alice_vote_keypair.pubkey(), &alice_vote_keypair.pubkey(), Vote { slots: vec![bank.slot()], hash: bank.hash(), timestamp: None, }, ), ]; bank = rpc.advance_bank_to_confirmed_slot(bank.slot() + 1); let transaction = Transaction::new_signed_with_payer( &instructions, Some(&rpc.mint_keypair.pubkey()), &[&rpc.mint_keypair, leader_vote_keypair, &alice_vote_keypair], bank.last_blockhash(), ); bank.process_transaction(&transaction) .expect("process transaction"); }; // Advance bank to the next epoch for _ in 0..TEST_SLOTS_PER_EPOCH { advance_bank(); } let req = format!( r#"{{"jsonrpc":"2.0","id":1,"method":"getVoteAccounts","params":{}}}"#, json!([CommitmentConfig::processed()]) ); let res = io.handle_request_sync(&req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); let vote_account_status: RpcVoteAccountStatus = serde_json::from_value(result["result"].clone()).unwrap(); // The vote account with no stake should not be present. assert!(vote_account_status.delinquent.is_empty()); // Both accounts should be active and have voting history. assert_eq!(vote_account_status.current.len(), 2); let leader_info = vote_account_status .current .iter() .find(|x| x.vote_pubkey == leader_vote_keypair.pubkey().to_string()) .unwrap(); assert_ne!(leader_info.activated_stake, 0); // Subtract one because the last vote always carries over to the next epoch let expected_credits = TEST_SLOTS_PER_EPOCH - MAX_LOCKOUT_HISTORY as u64 - 1; assert_eq!( leader_info.epoch_credits, vec![ (0, expected_credits, 0), (1, expected_credits + 1, expected_credits) // one vote in current epoch ] ); // Filter request based on the leader: { let req = format!( r#"{{"jsonrpc":"2.0","id":1,"method":"getVoteAccounts","params":{}}}"#, json!([RpcGetVoteAccountsConfig { vote_pubkey: Some(leader_vote_keypair.pubkey().to_string()), commitment: Some(CommitmentConfig::processed()), ..RpcGetVoteAccountsConfig::default() }]) ); let res = io.handle_request_sync(&req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); let vote_account_status: RpcVoteAccountStatus = serde_json::from_value(result["result"].clone()).unwrap(); assert_eq!(vote_account_status.current.len(), 1); assert_eq!(vote_account_status.delinquent.len(), 0); for vote_account_info in vote_account_status.current { assert_eq!( vote_account_info.vote_pubkey, leader_vote_keypair.pubkey().to_string() ); } } // Overflow the epoch credits history and ensure only `MAX_RPC_EPOCH_CREDITS_HISTORY` // results are returned for _ in 0..(TEST_SLOTS_PER_EPOCH * (MAX_RPC_EPOCH_CREDITS_HISTORY) as u64) { advance_bank(); } let req = format!( r#"{{"jsonrpc":"2.0","id":1,"method":"getVoteAccounts","params":{}}}"#, json!([CommitmentConfig::processed()]) ); let res = io.handle_request_sync(&req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); let vote_account_status: RpcVoteAccountStatus = serde_json::from_value(result["result"].clone()).unwrap(); assert!(vote_account_status.delinquent.is_empty()); assert!(!vote_account_status .current .iter() .any(|x| x.epoch_credits.len() != MAX_RPC_EPOCH_CREDITS_HISTORY)); // Advance bank with no voting rpc.advance_bank_to_confirmed_slot(bank.slot() + TEST_SLOTS_PER_EPOCH); // because it's inactive with no stake { let req = format!( r#"{{"jsonrpc":"2.0","id":1,"method":"getVoteAccounts","params":{}}}"#, json!([CommitmentConfig::processed()]) ); let res = io.handle_request_sync(&req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); let vote_account_status: RpcVoteAccountStatus = serde_json::from_value(result["result"].clone()).unwrap(); assert!(vote_account_status.current.is_empty()); assert_eq!(vote_account_status.delinquent.len(), 1); for vote_account_info in vote_account_status.delinquent { assert_eq!( vote_account_info.vote_pubkey, rpc.leader_vote_keypair.pubkey().to_string() ); } } }
rust_cleaned_test_functions.jsonl/6334
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4001 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 54360, 55665, 368, 341, 286, 1077, 35596, 284, 79961, 3050, 486, 2468, 543, 286, 1077, 5206, 6073, 284, 35596, 18282, 287, 35733, 543, 286, 1077, 79961, 3050, 341, 310, 2053, 6399, 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...
7
#[test] fn test_with_struct() { #[derive(Serialize, Deserialize, MartianStruct)] struct ChemistryDef { name: String, barcode_read: String, barcode_length: u8, } #[derive(Serialize, Deserialize, MartianStruct)] struct Config { sample_def: Vec<SampleDef>, reference_path: PathBuf, force_cells: u8, primers: JsonFile, } #[derive(Serialize, Deserialize, MartianStruct)] struct RnaChunk { chemistry_def: ChemistryDef, chunk_id: u8, r1: FastqFile, } #[derive(Serialize, Deserialize, MartianStruct)] struct SampleDef { read_path: PathBuf, } #[derive(Serialize, Deserialize, MartianStruct)] pub struct SI { config: Config, custom_chemistry_def: ChemistryDef, } #[derive(Serialize, Deserialize, MartianStruct)] pub struct SO { chunks: Vec<RnaChunk>, chemistry_def: ChemistryDef, } pub struct SetupChunks; #[make_mro] impl MartianMain for SetupChunks { type StageInputs = SI; type StageOutputs = SO; fn main(&self, _: Self::StageInputs, _: MartianRover) -> Result<Self::StageOutputs, Error> { unimplemented!() } } let expected = include_str!("mro/test_struct.mro"); assert_eq!( make_mro_string( HEADER, &[SetupChunks::stage_mro("my_adapter", "setup_chunks")] ), expected ); }
rust_cleaned_test_functions.jsonl/104057
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 695 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6615, 15126, 368, 341, 262, 11506, 27098, 3759, 9050, 11, 48440, 11, 81028, 9422, 5563, 262, 2036, 41746, 2620, 341, 286, 829, 25, 923, 345, 286, 49407, 6443, 25, 923, 345, 286, 49407, 5118, 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_stake_get_minimum_delegation() { let stake_address = Pubkey::new_unique(); let stake_account = create_default_stake_account(); let instruction_data = serialize(&StakeInstruction::GetMinimumDelegation).unwrap(); let transaction_accounts = vec![(stake_address, stake_account)]; let instruction_accounts = vec![AccountMeta { pubkey: stake_address, is_signer: false, is_writable: false, }]; mock_process_instruction( &id(), Vec::new(), &instruction_data, transaction_accounts, instruction_accounts, None, None, Ok(()), |first_instruction_account, invoke_context| { super::process_instruction(first_instruction_account, invoke_context)?; let expected_minimum_delegation = crate::get_minimum_delegation(&invoke_context.feature_set).to_le_bytes(); let actual_minimum_delegation = invoke_context.transaction_context.get_return_data().1; assert_eq!(expected_minimum_delegation, actual_minimum_delegation); Ok(()) }, ); }
rust_cleaned_test_functions.jsonl/31671
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 629 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1261, 726, 3062, 84855, 2259, 87566, 368, 341, 286, 1077, 18279, 6744, 284, 22611, 792, 486, 931, 21218, 543, 286, 1077, 18279, 13500, 284, 1855, 9993, 1261, 726, 13500, 543, 286, 1077, 7600, 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...
2
#[test] fn test_scan() { let storage = TestStorageBuilder::new(DummyLockManager {}, false) .build() .unwrap(); let (tx, rx) = channel(); storage .sched_txn_command( commands::Prewrite::with_defaults( vec![ Mutation::Put((Key::from_raw(b"a"), b"aa".to_vec())), Mutation::Put((Key::from_raw(b"b"), b"bb".to_vec())), Mutation::Put((Key::from_raw(b"c"), b"cc".to_vec())), ], b"a".to_vec(), 1.into(), ), expect_ok_callback(tx.clone(), 0), ) .unwrap(); rx.recv().unwrap(); // Forward expect_multi_values( vec![None, None, None], block_on(storage.scan( Context::default(), Key::from_raw(b"\x00"), None, 1000, 0, 5.into(), false, false, )) .unwrap(), ); // Backward expect_multi_values( vec![None, None, None], block_on(storage.scan( Context::default(), Key::from_raw(b"\xff"), None, 1000, 0, 5.into(), false, true, )) .unwrap(), ); // Forward with bound expect_multi_values( vec![None, None], block_on(storage.scan( Context::default(), Key::from_raw(b"\x00"), Some(Key::from_raw(b"c")), 1000, 0, 5.into(), false, false, )) .unwrap(), ); // Backward with bound expect_multi_values( vec![None, None], block_on(storage.scan( Context::default(), Key::from_raw(b"\xff"), Some(Key::from_raw(b"b")), 1000, 0, 5.into(), false, true, )) .unwrap(), ); // Forward with limit expect_multi_values( vec![None, None], block_on(storage.scan( Context::default(), Key::from_raw(b"\x00"), None, 2, 0, 5.into(), false, false, )) .unwrap(), ); // Backward with limit expect_multi_values( vec![None, None], block_on(storage.scan( Context::default(), Key::from_raw(b"\xff"), None, 2, 0, 5.into(), false, true, )) .unwrap(), ); storage .sched_txn_command( commands::Commit::new( vec![ Key::from_raw(b"a"), Key::from_raw(b"b"), Key::from_raw(b"c"), ], 1.into(), 2.into(), Context::default(), ), expect_ok_callback(tx, 1), ) .unwrap(); rx.recv().unwrap(); // Forward expect_multi_values( vec![ Some((b"a".to_vec(), b"aa".to_vec())), Some((b"b".to_vec(), b"bb".to_vec())), Some((b"c".to_vec(), b"cc".to_vec())), ], block_on(storage.scan( Context::default(), Key::from_raw(b"\x00"), None, 1000, 0, 5.into(), false, false, )) .unwrap(), ); // Backward expect_multi_values( vec![ Some((b"c".to_vec(), b"cc".to_vec())), Some((b"b".to_vec(), b"bb".to_vec())), Some((b"a".to_vec(), b"aa".to_vec())), ], block_on(storage.scan( Context::default(), Key::from_raw(b"\xff"), None, 1000, 0, 5.into(), false, true, )) .unwrap(), ); // Forward with sample step expect_multi_values( vec![ Some((b"a".to_vec(), b"aa".to_vec())), Some((b"c".to_vec(), b"cc".to_vec())), ], block_on(storage.scan( Context::default(), Key::from_raw(b"\x00"), None, 1000, 2, 5.into(), false, false, )) .unwrap(), ); // Backward with sample step expect_multi_values( vec![ Some((b"c".to_vec(), b"cc".to_vec())), Some((b"a".to_vec(), b"aa".to_vec())), ], block_on(storage.scan( Context::default(), Key::from_raw(b"\xff"), None, 1000, 2, 5.into(), false, true, )) .unwrap(), ); // Forward with sample step and limit expect_multi_values( vec![Some((b"a".to_vec(), b"aa".to_vec()))], block_on(storage.scan( Context::default(), Key::from_raw(b"\x00"), None, 1, 2, 5.into(), false, false, )) .unwrap(), ); // Backward with sample step and limit expect_multi_values( vec![Some((b"c".to_vec(), b"cc".to_vec()))], block_on(storage.scan( Context::default(), Key::from_raw(b"\xff"), None, 1, 2, 5.into(), false, true, )) .unwrap(), ); // Forward with bound expect_multi_values( vec![ Some((b"a".to_vec(), b"aa".to_vec())), Some((b"b".to_vec(), b"bb".to_vec())), ], block_on(storage.scan( Context::default(), Key::from_raw(b"\x00"), Some(Key::from_raw(b"c")), 1000, 0, 5.into(), false, false, )) .unwrap(), ); // Backward with bound expect_multi_values( vec![ Some((b"c".to_vec(), b"cc".to_vec())), Some((b"b".to_vec(), b"bb".to_vec())), ], block_on(storage.scan( Context::default(), Key::from_raw(b"\xff"), Some(Key::from_raw(b"b")), 1000, 0, 5.into(), false, true, )) .unwrap(), ); // Forward with limit expect_multi_values( vec![ Some((b"a".to_vec(), b"aa".to_vec())), Some((b"b".to_vec(), b"bb".to_vec())), ], block_on(storage.scan( Context::default(), Key::from_raw(b"\x00"), None, 2, 0, 5.into(), false, false, )) .unwrap(), ); // Backward with limit expect_multi_values( vec![ Some((b"c".to_vec(), b"cc".to_vec())), Some((b"b".to_vec(), b"bb".to_vec())), ], block_on(storage.scan( Context::default(), Key::from_raw(b"\xff"), None, 2, 0, 5.into(), false, true, )) .unwrap(), ); }
rust_cleaned_test_functions.jsonl/2074
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 5802 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28857, 368, 341, 286, 1077, 5819, 284, 3393, 5793, 3297, 486, 931, 5432, 8574, 11989, 2043, 16452, 895, 340, 310, 659, 5834, 741, 310, 659, 15454, 543, 286, 1077, 320, 3998, 11, 19111, 8, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_invalid_rate() -> Result<(), Box<dyn std::error::Error>> { Command::new(get_os_binary_loc()) .arg("-r") .arg("100-1000") .assert() .failure() .stderr(predicate::str::contains("invalid digit")); Ok(()) }
rust_cleaned_test_functions.jsonl/65684
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 137 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31433, 9246, 368, 1464, 5714, 68843, 8261, 92846, 1460, 486, 841, 486, 1454, 2452, 341, 262, 7348, 486, 931, 5433, 29387, 31761, 13400, 2398, 286, 659, 858, 13645, 81, 1138, 286, 659, 858, 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_single() { struct Foo; impl Debug for Foo { fn fmt(&self, fmt: &mut Formatter) { fmt.debug_list().entry(&true).finish() } } assert_eq!("[true]", debug3::pprint(Foo)); }
rust_cleaned_test_functions.jsonl/124745
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 148 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19487, 368, 341, 286, 2036, 33428, 401, 286, 11605, 11091, 369, 33428, 341, 310, 5168, 8879, 2099, 721, 11, 8879, 25, 609, 6984, 81387, 8, 341, 394, 8879, 7883, 2019, 1005, 4085, 2099, 1866, 568...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_with_bls12() { fn naive_multiexp<G: PrimeCurve>( bases: Arc<Vec<<G as PrimeCurve>::Affine>>, exponents: Arc<Vec<G::Scalar>>, ) -> G { assert_eq!(bases.len(), exponents.len()); let mut acc = G::identity(); for (base, exp) in bases.iter().zip(exponents.iter()) { AddAssign::<&G>::add_assign(&mut acc, &(*base * *exp)); } acc } use bls12_381::{Bls12, Scalar}; use ff::Field; use group::{Curve, Group}; use pairing::Engine; use rand; const SAMPLES: usize = 1 << 14; let mut rng = rand::thread_rng(); let v = Arc::new( (0..SAMPLES) .map(|_| Scalar::random(&mut rng)) .collect::<Vec<_>>(), ); let v_bits = Arc::new(v.iter().map(|e| e.to_le_bits()).collect::<Vec<_>>()); let g = Arc::new( (0..SAMPLES) .map(|_| <Bls12 as Engine>::G1::random(&mut rng).to_affine()) .collect::<Vec<_>>(), ); let naive: <Bls12 as Engine>::G1 = naive_multiexp(g.clone(), v.clone()); let pool = Worker::new(); let fast = multiexp(&pool, (g, 0), FullDensity, v_bits).wait().unwrap(); assert_eq!(naive, fast); }
rust_cleaned_test_functions.jsonl/103866
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 613 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6615, 880, 4730, 16, 17, 368, 341, 262, 5168, 49665, 25133, 4580, 59727, 25, 12518, 31325, 17055, 286, 23092, 25, 19689, 50439, 2442, 38, 438, 12518, 31325, 6831, 25841, 482, 61340, 286, 505, 2700...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_stake_delegate() { let mut clock = Clock { epoch: 1, ..Clock::default() }; let vote_pubkey = solana_sdk::pubkey::new_rand(); let vote_pubkey_2 = solana_sdk::pubkey::new_rand(); let mut vote_state = VoteState::default(); for i in 0..1000 { vote_state.process_slot_vote_unchecked(i); } let mut vote_state_2 = VoteState::default(); for i in 0..1000 { vote_state_2.process_slot_vote_unchecked(i); } let vote_account = RefCell::new(vote_state::create_account( &vote_pubkey, &solana_sdk::pubkey::new_rand(), 0, 100, )); let vote_account_2 = RefCell::new(vote_state::create_account( &vote_pubkey_2, &solana_sdk::pubkey::new_rand(), 0, 100, )); let vote_keyed_account = KeyedAccount::new(&vote_pubkey, false, &vote_account); let vote_keyed_account_2 = KeyedAccount::new(&vote_pubkey_2, false, &vote_account_2); let vote_state_credits = vote_state.credits(); vote_keyed_account .set_state(&VoteStateVersions::new_current(vote_state)) .unwrap(); let vote_state_credits_2 = vote_state_2.credits(); vote_keyed_account_2 .set_state(&VoteStateVersions::new_current(vote_state_2)) .unwrap(); let stake_pubkey = solana_sdk::pubkey::new_rand(); let stake_lamports = 42; let stake_account = AccountSharedData::new_ref_data_with_space( stake_lamports, &StakeState::Initialized(Meta { authorized: Authorized { staker: stake_pubkey, withdrawer: stake_pubkey, }, ..Meta::default() }), std::mem::size_of::<StakeState>(), &id(), ) .expect("stake_account"); // unsigned keyed account let stake_keyed_account = KeyedAccount::new(&stake_pubkey, false, &stake_account); let mut signers = HashSet::default(); assert_eq!( stake_keyed_account.delegate( &vote_keyed_account, &clock, &StakeHistory::default(), &Config::default(), &signers, true, ), Err(InstructionError::MissingRequiredSignature) ); // signed keyed account let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account); signers.insert(stake_pubkey); assert!(stake_keyed_account .delegate( &vote_keyed_account, &clock, &StakeHistory::default(), &Config::default(), &signers, true, ) .is_ok()); let stake = stake_from(&stake_keyed_account.account.borrow()).unwrap(); assert_eq!( stake, Stake { delegation: Delegation { voter_pubkey: vote_pubkey, stake: stake_lamports, activation_epoch: clock.epoch, deactivation_epoch: std::u64::MAX, ..Delegation::default() }, credits_observed: vote_state_credits, } ); clock.epoch += 1; // verify that delegate fails as stake is active and not deactivating assert_eq!( stake_keyed_account.delegate( &vote_keyed_account, &clock, &StakeHistory::default(), &Config::default(), &signers, true ), Err(StakeError::TooSoonToRedelegate.into()) ); // deactivate stake_keyed_account.deactivate(&clock, &signers).unwrap(); // verify that delegate to a different vote account fails // during deactivation assert_eq!( stake_keyed_account.delegate( &vote_keyed_account_2, &clock, &StakeHistory::default(), &Config::default(), &signers, true, ), Err(StakeError::TooSoonToRedelegate.into()) ); // verify that delegate succeeds to same vote account // when stake is deactivating stake_keyed_account .delegate( &vote_keyed_account, &clock, &StakeHistory::default(), &Config::default(), &signers, true, ) .unwrap(); // verify that deactivation has been cleared let stake = stake_from(&stake_keyed_account.account.borrow()).unwrap(); assert_eq!(stake.delegation.deactivation_epoch, std::u64::MAX); // verify that delegate to a different vote account fails // if stake is still active assert_eq!( stake_keyed_account.delegate( &vote_keyed_account_2, &clock, &StakeHistory::default(), &Config::default(), &signers, true, ), Err(StakeError::TooSoonToRedelegate.into()) ); stake_keyed_account.deactivate(&clock, &signers).unwrap(); clock.epoch += 1; assert!(stake_keyed_account .delegate( &vote_keyed_account_2, &clock, &StakeHistory::default(), &Config::default(), &signers, true, ) .is_ok()); // signed but faked vote account let faked_vote_account = vote_account_2.clone(); faked_vote_account .borrow_mut() .set_owner(solana_sdk::pubkey::new_rand()); let faked_vote_keyed_account = KeyedAccount::new(&vote_pubkey_2, false, &faked_vote_account); assert_eq!( stake_keyed_account.delegate( &faked_vote_keyed_account, &clock, &StakeHistory::default(), &Config::default(), &signers, true, ), Err(solana_sdk::instruction::InstructionError::IncorrectProgramId) ); let stake = stake_from(&stake_keyed_account.account.borrow()).unwrap(); assert_eq!( stake, Stake { delegation: Delegation { voter_pubkey: vote_pubkey_2, stake: stake_lamports, activation_epoch: clock.epoch, deactivation_epoch: std::u64::MAX, ..Delegation::default() }, credits_observed: vote_state_credits_2, } ); let stake_state = StakeState::RewardsPool; stake_keyed_account.set_state(&stake_state).unwrap(); assert!(stake_keyed_account .delegate( &vote_keyed_account, &clock, &StakeHistory::default(), &Config::default(), &signers, true, ) .is_err()); }
rust_cleaned_test_functions.jsonl/104269
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4160 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1261, 726, 55312, 368, 341, 286, 1077, 5206, 8866, 284, 26142, 341, 310, 16342, 25, 220, 16, 345, 310, 5241, 26104, 486, 2258, 741, 286, 3634, 286, 1077, 6910, 34014, 792, 284, 2048, 3362, 61783...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_fallback_mod() { let p: NoiseParams = "Noise_XXfallback_25519_AESGCM_SHA256".parse().unwrap(); assert!(p.handshake.modifiers.list[0] == HandshakeModifier::Fallback); }
rust_cleaned_test_functions.jsonl/14548
{ "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, 761, 3420, 7480, 368, 341, 286, 1077, 281, 25, 50523, 4870, 284, 330, 61819, 62, 6148, 73311, 62, 17, 20, 20, 16, 24, 69381, 38, 9985, 38096, 17, 20, 21, 3263, 6400, 1005, 15454, 543, 286, 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
#[test] fn test_envelope_add_item() { let event_id = EventId::new(); let mut envelope = Envelope::from_request(Some(event_id), request_meta()); envelope.add_item(Item::new(ItemType::Attachment)); assert_eq!(envelope.len(), 1); assert!(!envelope.is_empty()); let items: Vec<_> = envelope.items().collect(); assert_eq!(items.len(), 1); assert_eq!(items[0].ty(), ItemType::Attachment); }
rust_cleaned_test_functions.jsonl/103606
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 206 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6205, 18853, 2891, 5634, 368, 341, 286, 1077, 1538, 842, 284, 3665, 764, 486, 931, 543, 286, 1077, 5206, 34398, 284, 2925, 18853, 486, 1499, 7893, 65405, 6235, 842, 701, 1681, 13381, 1423, 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_from_slice() { let doc = DOC.as_bytes(); let desered = from_slice(&doc).expect("Couldn't deserialize Data"); assert_eq!( desered, Data { base: "https://example.com".into(), client_id: "adbc01234".into(), client_secret: "0987dcba".into(), redirect: "urn:ietf:wg:oauth:2.0:oob".into(), token: "fedc5678".into(), } ); }
rust_cleaned_test_functions.jsonl/39218
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 282 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 26488, 368, 341, 286, 1077, 4629, 284, 60355, 5357, 12524, 543, 286, 1077, 939, 12336, 284, 504, 26488, 2099, 5236, 568, 17119, 445, 38987, 944, 35240, 2885, 797, 286, 2060, 10714, 33673, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_split_messages_packet_size() { // Test that if a value is smaller than payload size but too large to be wrapped in a vec // that it is still dropped let mut value = CrdsValue::new_unsigned(CrdsData::SnapshotHashes(SnapshotHash { from: Pubkey::default(), hashes: vec![], wallclock: 0, })); let mut i = 0; while value.size() < PUSH_MESSAGE_MAX_PAYLOAD_SIZE as u64 { value.data = CrdsData::SnapshotHashes(SnapshotHash { from: Pubkey::default(), hashes: vec![(0, Hash::default()); i], wallclock: 0, }); i += 1; } let split: Vec<_> = ClusterInfo::split_gossip_messages(PUSH_MESSAGE_MAX_PAYLOAD_SIZE, vec![value]) .collect(); assert_eq!(split.len(), 0); }
rust_cleaned_test_functions.jsonl/11667
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 455 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17052, 23428, 21078, 2368, 368, 341, 286, 442, 3393, 429, 421, 264, 897, 374, 9155, 1091, 7729, 1379, 714, 2238, 3460, 311, 387, 19472, 304, 264, 7486, 198, 286, 442, 429, 432, 374, 2058, 12226,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_custom_key_type_for_properties() { let result = hierarchy! { root: { Field::Bar => 2u64, baz: { Field::Foo => "baz", } } }; assert_eq!( result, DiagnosticsHierarchy::new( "root", vec![Property::Uint(Field::Bar, 2u64)], vec![DiagnosticsHierarchy::new( "baz", vec![Property::String(Field::Foo, "baz".to_string())], vec![] )], ) ); }
rust_cleaned_test_functions.jsonl/45835
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 426 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15875, 3097, 1819, 5478, 25158, 368, 341, 286, 1077, 1102, 284, 28922, 0, 341, 310, 3704, 25, 341, 394, 8601, 486, 3428, 589, 220, 17, 84, 21, 19, 345, 394, 50247, 25, 341, 503, 8601, 486, 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_get_block_production() { let bob_pubkey = solana_sdk::pubkey::new_rand(); let roots = vec![0, 1, 3, 4, 8]; let RpcHandler { io, meta, block_commitment_cache, leader_pubkey, .. } = start_rpc_handler_with_tx_and_blockstore(&bob_pubkey, roots); block_commitment_cache .write() .unwrap() .set_highest_confirmed_root(8); let req = r#"{"jsonrpc":"2.0","id":1,"method":"getBlockProduction","params":[]}"#; let res = io.handle_request_sync(req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); let block_production: RpcBlockProduction = serde_json::from_value(result["result"]["value"].clone()).unwrap(); assert_eq!( block_production.by_identity.get(&leader_pubkey.to_string()), Some(&(9, 5)) ); assert_eq!( block_production.range, RpcBlockProductionRange { first_slot: 0, last_slot: 8 } ); let req = format!( r#"{{"jsonrpc":"2.0","id":1,"method":"getBlockProduction","params":[{{"identity": "{}"}}]}}"#, leader_pubkey ); let res = io.handle_request_sync(&req, meta.clone()); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); let block_production: RpcBlockProduction = serde_json::from_value(result["result"]["value"].clone()).unwrap(); assert_eq!( block_production.by_identity.get(&leader_pubkey.to_string()), Some(&(9, 5)) ); assert_eq!( block_production.range, RpcBlockProductionRange { first_slot: 0, last_slot: 8 } ); let req = format!( r#"{{"jsonrpc":"2.0","id":1,"method":"getBlockProduction","params":[{{"range": {{"firstSlot": 0, "lastSlot": 4}}, "identity": "{}"}}]}}"#, bob_pubkey ); let res = io.handle_request_sync(&req, meta); let result: Value = serde_json::from_str(&res.expect("actual response")) .expect("actual response deserialization"); let block_production: RpcBlockProduction = serde_json::from_value(result["result"]["value"].clone()).unwrap(); assert_eq!( block_production.by_identity.get(&leader_pubkey.to_string()), None ); assert_eq!( block_production.range, RpcBlockProductionRange { first_slot: 0, last_slot: 4 } ); }
rust_cleaned_test_functions.jsonl/3054
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1452 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 7113, 91980, 368, 341, 286, 1077, 35192, 34014, 792, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 19703, 284, 7486, 20703, 15, 11, 220, 16, 11, 220, 18, 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_coeff_pos() { let mut i = 0; let mut j = 0; for n in 0..100 { assert_eq!(Some(n), coeff_pos(i, j)); if i >= j { j += 1; i = 0; } else { i += 1; } } let too_large = 1 << (0usize.count_zeros() / 2); assert_eq!(None, coeff_pos(0, too_large)); }
rust_cleaned_test_functions.jsonl/49473
{ "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, 31990, 6479, 368, 341, 286, 1077, 5206, 600, 284, 220, 15, 280, 286, 1077, 5206, 502, 284, 220, 15, 280, 286, 369, 308, 304, 220, 15, 496, 16, 15, 15, 341, 310, 2060, 10714, 10297, 8373, 144...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_config_path() { let test_data = PathBuf::from(TEST_BUNDLE_PATH).join(CONFIG_FILE_NAME); assert_eq!(get_config_path(TEST_BUNDLE_PATH), test_data); }
rust_cleaned_test_functions.jsonl/51226
{ "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, 3062, 5332, 2638, 368, 341, 286, 1077, 1273, 1769, 284, 7933, 15064, 486, 1499, 50320, 1668, 71489, 7944, 568, 5987, 38958, 8087, 4708, 317, 286, 2060, 10714, 10297, 455, 5332, 2638, 50320, 1668, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_eval_task_simple() { let mut env = Env::new_with_std(); let src = concat!( "in: ${ std.glob(\"**/*.rs\")}\n", "out: test\n", "command: cargo {{ std.join(self.in, \" \") }}\n" ); println!("{}", src); let src = yaml_rust::YamlLoader::load_from_str(src) .unwrap() .into_iter() .next() .unwrap(); let task = crate::parser::task_from_yaml("hoge", &src).unwrap(); let (tasksource, val) = eval_task(&mut env, &task).unwrap(); let (input, output, command) = tasksource; assert_eq!( input, hashset! { "src/engine.rs".to_owned(), "src/lib.rs".to_owned(), "src/main.rs".to_owned(), "src/util.rs".to_owned(), "src/parser.rs".to_owned() } ); assert_eq!( output, hashset! { "test".to_owned(), } ); assert_eq!( command, Some("cargo src/engine.rs src/lib.rs src/main.rs src/parser.rs src/util.rs".to_owned()) ); assert_eq!( val, Val::Map(hashmap! { "in".to_owned() => Val::List(vec![ Val::String("src/engine.rs".to_owned()), Val::String("src/lib.rs".to_owned()), Val::String("src/main.rs".to_owned()), Val::String("src/parser.rs".to_owned()), Val::String("src/util.rs".to_owned()), ]), "out".to_owned() => Val::List(vec![ Val::String("test".to_owned()), ]), "command".to_owned() => Val::String("cargo src/engine.rs src/lib.rs src/main.rs src/parser.rs src/util.rs".to_owned()) }) ); }
rust_cleaned_test_functions.jsonl/113313
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1165 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 12184, 30015, 368, 341, 286, 1077, 5206, 6105, 284, 37039, 486, 931, 6615, 15656, 543, 286, 1077, 2286, 284, 33720, 33673, 310, 330, 258, 25, 3570, 1460, 44371, 36014, 334, 23540, 5428, 627...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_series_partialeq() { let s1 = Series::new("a", &[1_i32, 2_i32, 3_i32]); let s1_bis = Series::new("b", &[1_i32, 2_i32, 3_i32]); let s1_ter = Series::new("a", &[1.0_f64, 2.0_f64, 3.0_f64]); let s2 = Series::new("", &[Some(1), Some(0)]); let s3 = Series::new("", &[Some(1), None]); let s4 = Series::new("", &[1.0, f64::NAN]); assert_eq!(s1, s1); assert_ne!(s1, s1_bis); assert_ne!(s1, s1_ter); assert_eq!(s2, s2); assert_ne!(s2, s3); assert_ne!(s4, s4); }
rust_cleaned_test_functions.jsonl/22781
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 340 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35015, 10495, 19893, 80, 368, 341, 286, 1077, 274, 16, 284, 11131, 486, 931, 445, 64, 497, 44590, 16, 5318, 18, 17, 11, 220, 17, 5318, 18, 17, 11, 220, 18, 5318, 18, 17, 2558, 286, 1077, 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_hover_macro_generated_struct_fn_doc_comment() { cov_mark::check!(hover_macro_generated_struct_fn_doc_comment); check( r#" macro_rules! bar { () => { struct Bar; impl Bar { /// Do the foo fn foo(&self) {} } } } bar!(); fn foo() { let bar = Bar; bar.fo$0o(); } "#, expect![[r#" *foo* ```rust test::Bar ``` ```rust fn foo(&self) ``` --- Do the foo "#]], ); }
rust_cleaned_test_functions.jsonl/66661
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 416 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53445, 58810, 67313, 15126, 15246, 18869, 17638, 368, 341, 286, 21836, 18924, 486, 2028, 10297, 17583, 58810, 67313, 15126, 15246, 18869, 17638, 626, 286, 1779, 1006, 310, 435, 2, 698, 32606, 21407, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_unified_enabled() { // Allow invalid storage and coprocessor config when yatp is used. let unified = UnifiedReadPoolConfig::default(); assert!(unified.validate().is_ok()); let storage = StorageReadPoolConfig { high_concurrency: 0, ..Default::default() }; assert!(storage.validate().is_err()); let coprocessor = CoprReadPoolConfig { high_concurrency: 0, ..Default::default() }; assert!(coprocessor.validate().is_err()); let cfg = ReadPoolConfig { unify_read_pool: true, unified, storage, coprocessor, }; assert!(cfg.validate().is_ok()); // Yatp config must be valid when yatp is used. let unified = UnifiedReadPoolConfig { min_thread_count: 0, max_thread_count: 0, }; assert!(unified.validate().is_err()); let storage = StorageReadPoolConfig::default(); assert!(storage.validate().is_ok()); let coprocessor = CoprReadPoolConfig::default(); assert!(coprocessor.validate().is_ok()); let cfg = ReadPoolConfig { unify_read_pool: true, unified, storage, coprocessor, }; assert!(cfg.validate().is_err()); }
rust_cleaned_test_functions.jsonl/30860
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 672 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 1870, 18220, 368, 341, 286, 442, 26530, 8318, 5819, 323, 6162, 40848, 269, 2193, 979, 131454, 79, 374, 1483, 624, 286, 1077, 42690, 284, 72434, 4418, 10551, 2648, 486, 2258, 543, 286, 2060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_union_bv1_longer() { let mut bv1: BitVec<usize> = BitVec::new(); let mut bv2: BitVec<usize> = BitVec::new(); bv1.set(8, true); bv2.set(0, true); bv1.union(&bv2); assert!(bv1.get(0)); assert!(bv1.get(8)); }
rust_cleaned_test_functions.jsonl/198
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 177 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51621, 880, 85, 16, 17799, 261, 368, 341, 286, 1077, 5206, 56937, 16, 25, 6495, 10050, 90244, 29, 284, 6495, 10050, 486, 931, 543, 286, 1077, 5206, 56937, 17, 25, 6495, 10050, 90244, 29, 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_arch_sparc() { test_arch_mode_endian_insns( &mut Capstone::new() .sparc() .mode(sparc::ArchMode::Default) .build() .unwrap(), Arch::SPARC, Mode::Default, None, &[], &[ ("cmp", b"\x80\xa0\x40\x02"), ("jmpl", b"\x85\xc2\x60\x08"), ("restore", b"\x85\xe8\x20\x01"), ("restore", b"\x81\xe8\x00\x00"), ("mov", b"\x90\x10\x20\x01"), ("casx", b"\xd5\xf6\x10\x16"), ("sethi", b"\x21\x00\x00\x0a"), ("add", b"\x86\x00\x40\x02"), ("nop", b"\x01\x00\x00\x00"), ("bne", b"\x12\xbf\xff\xff"), ("ba", b"\x10\xbf\xff\xff"), ("add", b"\xa0\x02\x00\x09"), ("fbg", b"\x0d\xbf\xff\xff"), ("st", b"\xd4\x20\x60\x00"), ("ldsb", b"\xd4\x4e\x00\x16"), ("brnz,a,pn", b"\x2a\xc2\x80\x03"), ], ); test_arch_mode_endian_insns( &mut Capstone::new() .sparc() .mode(sparc::ArchMode::V9) .build() .unwrap(), Arch::SPARC, Mode::V9, Some(Endian::Big), &[], &[ ("fcmps", b"\x81\xa8\x0a\x24"), ("fstox", b"\x89\xa0\x10\x20"), ("fqtoi", b"\x89\xa0\x1a\x60"), ("fnegq", b"\x89\xa0\x00\xe0"), ], ); }
rust_cleaned_test_functions.jsonl/127438
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1001 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34330, 643, 1732, 66, 368, 341, 262, 1273, 34330, 7302, 87193, 34386, 4412, 1006, 286, 609, 6984, 8012, 10812, 486, 931, 741, 310, 659, 77884, 66, 741, 310, 659, 8516, 1141, 1732, 66, 486, 18727...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_rng_seeds_are_unique() { assert_ne!(SEED_10_100, SEED_100_1000); assert_ne!(SEED_100_1000, SEED_1000_PLUS); assert_ne!(SEED_1000_PLUS, SEED_10_100); }
rust_cleaned_test_functions.jsonl/17789
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 113 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66849, 3453, 6767, 56855, 21218, 368, 341, 286, 2060, 13925, 10297, 925, 1479, 62, 16, 15, 62, 16, 15, 15, 11, 5052, 1479, 62, 16, 15, 15, 62, 16, 15, 15, 15, 317, 286, 2060, 13925, 10297, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_inject_types() { let b = ast::BaseNode::default(); let pkg = Package { loc: b.location.clone(), package: "main".to_string(), files: vec![File { loc: b.location.clone(), package: None, imports: Vec::new(), body: vec![ Statement::Variable(Box::new(VariableAssgn::new( Identifier { loc: b.location.clone(), name: Symbol::from("f"), }, Expression::Function(Box::new(FunctionExpr { loc: b.location.clone(), typ: MonoType::Var(Tvar(0)), params: vec![ FunctionParameter { loc: b.location.clone(), is_pipe: true, key: Identifier { loc: b.location.clone(), name: Symbol::from("piped"), }, default: None, }, FunctionParameter { loc: b.location.clone(), is_pipe: false, key: Identifier { loc: b.location.clone(), name: Symbol::from("a"), }, default: None, }, ], body: Block::Return(ReturnStmt { loc: b.location.clone(), argument: Expression::Binary(Box::new(BinaryExpr { loc: b.location.clone(), typ: MonoType::Var(Tvar(1)), operator: ast::Operator::AdditionOperator, left: Expression::Identifier(IdentifierExpr { loc: b.location.clone(), typ: MonoType::Var(Tvar(2)), name: Symbol::from("a"), }), right: Expression::Identifier(IdentifierExpr { loc: b.location.clone(), typ: MonoType::Var(Tvar(3)), name: Symbol::from("piped"), }), })), }), vectorized: None, })), b.location.clone(), ))), Statement::Expr(ExprStmt { loc: b.location.clone(), expression: Expression::Call(Box::new(CallExpr { loc: b.location.clone(), typ: MonoType::Var(Tvar(4)), pipe: Some(Expression::Integer(IntegerLit { loc: b.location.clone(), value: 3, })), callee: Expression::Identifier(IdentifierExpr { loc: b.location.clone(), typ: MonoType::Var(Tvar(6)), name: Symbol::from("f"), }), arguments: vec![Property { loc: b.location.clone(), key: Identifier { loc: b.location.clone(), name: Symbol::from("a"), }, value: Expression::Integer(IntegerLit { loc: b.location.clone(), value: 2, }), }], })), }), ], }], }; let sub: Substitution = semantic_map! { Tvar(0) => MonoType::Int, Tvar(1) => MonoType::Int, Tvar(2) => MonoType::Int, Tvar(3) => MonoType::Int, Tvar(4) => MonoType::Int, Tvar(5) => MonoType::Int, Tvar(6) => MonoType::Int, Tvar(7) => MonoType::Int, } .into(); let pkg = inject_pkg_types(pkg, &sub); let mut no_types_checked = 0; walk( &mut |node: Node| { let typ = node.type_of(); if let Some(typ) = typ { assert_eq!(typ, MonoType::Int); no_types_checked += 1; } }, Node::Package(&pkg), ); assert_eq!(no_types_checked, 8); }
rust_cleaned_test_functions.jsonl/100922
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3694 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1243, 583, 9763, 368, 341, 286, 1077, 293, 284, 11763, 486, 3978, 1955, 486, 2258, 543, 286, 1077, 24793, 284, 16906, 341, 310, 1329, 25, 293, 8219, 15997, 3148, 310, 6328, 25, 330, 3817, 3263, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_refracted_color_max_depth() { let mut world = World::default(); let s1 = Sphere::new( Matrix::identity(4), Material::new( Some(Color::new(0.8, 1.0, 0.6)), None, 0.1, 0.7, 0.2, 200.0, 0.0, 1.0, 1.5 ), ); let s2 = Sphere::new( Matrix::scaling(0.5, 0.5, 0.5), Material::default(), ); world.objects = vec![Box::new(s1.clone()), Box::new(s2.clone())]; let ray = Ray { origin: Tuple::point(0.0, 0.0, -5.0), direction: Tuple::vector(0.0, 0.0, 1.0), }; let intersections = s1.intersect(&ray); for int in intersections.iter() { let color = world.refracted_color_at(&int, 10); assert_eq!(color, Color::black()); } }
rust_cleaned_test_functions.jsonl/45912
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 498 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7793, 81, 22167, 6714, 6345, 19061, 368, 341, 286, 1077, 5206, 1879, 284, 4337, 486, 2258, 1428, 286, 1077, 274, 16, 284, 54499, 486, 931, 1006, 310, 11631, 486, 16912, 7, 19, 1326, 310, 10230, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_new_from_slice() { let data_array: DFInt64Array = NewDataArray::new_from_slice(&[1, 2]); let mut iter = data_array.into_iter(); // verify NewDataArray::new_from_slice assert_eq!(Some(Some(&1)), iter.next()); assert_eq!(Some(Some(&2)), iter.next()); assert_eq!(None, iter.next()); }
rust_cleaned_test_functions.jsonl/102162
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 5673, 26488, 368, 341, 262, 1077, 821, 3858, 25, 43376, 1072, 21, 19, 1857, 284, 1532, 1043, 1857, 486, 931, 5673, 26488, 2099, 58, 16, 11, 220, 17, 2558, 262, 1077, 5206, 5367, 284, 821...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_product_targets() { let mut results = get_target_products(Some(&String::from("core.x64"))); assert_eq!( vec![BuildTarget { arch: String::from("x64"), board: String::from("core") }], results ); results = get_target_products(Some(&String::from("core.x64,workstation.arm64"))); assert_eq!( vec![ BuildTarget { arch: String::from("x64"), board: String::from("core") }, BuildTarget { arch: String::from("arm64"), board: String::from("workstation") } ], results ); results = get_target_products(None); assert_eq!(Vec::<BuildTarget>::new(), results); }
rust_cleaned_test_functions.jsonl/28543
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 343 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9840, 41997, 368, 341, 286, 1077, 5206, 3059, 284, 633, 11123, 29622, 65405, 2099, 703, 486, 1499, 445, 2153, 1993, 21, 19, 17621, 286, 2060, 10714, 33673, 310, 7486, 20703, 11066, 6397, 314, 5325...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_binary_representation_compressed_parameter() { let lmots_first = LmotsAlgorithm::LmotsW4; let lmots_second = LmotsAlgorithm::LmotsW8; let lms_first = LmsAlgorithm::LmsH5; let lms_second = LmsAlgorithm::LmsH10; let parameter = [ HssParameter::new(lmots_first, lms_first), HssParameter::new(lmots_second, lms_second), ]; let compressed = CompressedParameterSet::from(&parameter).unwrap(); let arr = compressed.to::<Hasher>().unwrap(); for (i, p) in arr.iter().enumerate() { assert!(p == &parameter[i]) } assert!(compressed == CompressedParameterSet::from_slice(&compressed.0).unwrap()); }
rust_cleaned_test_functions.jsonl/29974
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 346 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31761, 94263, 2965, 14318, 24899, 368, 341, 286, 1077, 40238, 2412, 12978, 284, 444, 76, 2412, 27847, 486, 43, 76, 2412, 54, 19, 280, 286, 1077, 40238, 2412, 29644, 284, 444, 76, 2412, 27847, 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...
2
#[test] fn test_clear_interrupt() { let code = vec![0x58]; let mut nes = Cpu::new(); let mut memory = new_memory(code); nes.I = 0x1; nes.next(&mut memory).unwrap(); assert_eq!(0, nes.I); }
rust_cleaned_test_functions.jsonl/38713
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 135 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21811, 42606, 368, 341, 286, 1077, 2038, 284, 7486, 20703, 15, 87, 20, 23, 935, 286, 1077, 5206, 308, 288, 284, 356, 5584, 486, 931, 543, 286, 1077, 5206, 4938, 284, 501, 19195, 15842, 626, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_version_overlap_in_level() { let v = make_version().0; for &(level, (k1, k2), want) in &[ (0, ("000".as_bytes(), "003".as_bytes()), false), (0, ("aa0".as_bytes(), "abx".as_bytes()), true), (1, ("012".as_bytes(), "013".as_bytes()), false), (1, ("abc".as_bytes(), "def".as_bytes()), true), (2, ("xxx".as_bytes(), "xyz".as_bytes()), false), (2, ("gac".as_bytes(), "gaz".as_bytes()), true), ] { if want { assert!(v.overlap_in_level(level, k1, k2)); } else { assert!(!v.overlap_in_level(level, k1, k2)); } } }
rust_cleaned_test_functions.jsonl/32971
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 403 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9438, 65794, 1243, 8274, 368, 341, 286, 1077, 348, 284, 1281, 9438, 1005, 15, 401, 286, 369, 22796, 3294, 11, 320, 74, 16, 11, 595, 17, 701, 1366, 8, 304, 609, 9640, 310, 320, 15, 11, 3489, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_nesting() { use crate::nesting::{A, B}; let _ = A { a: Some(Box::new(A::default())), repeated_a: Vec::<A>::new(), map_a: BTreeMap::<i32, A>::new(), b: Some(Box::new(B::default())), repeated_b: Vec::<B>::new(), map_b: BTreeMap::<i32, B>::new(), }; }
rust_cleaned_test_functions.jsonl/8851
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 220 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1089, 59855, 368, 341, 286, 990, 17717, 486, 21414, 287, 22964, 32, 11, 425, 2440, 286, 1077, 716, 284, 362, 341, 310, 264, 25, 4329, 67758, 486, 931, 4346, 486, 2258, 73727, 310, 11504, 4306, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_between_unsorted_unsorted() -> Result<(), IndexError> { let mut x: MyVec<usize> = MyVec::new(); for v in vec![7, 1, 9, 11, 2, 3, 1, 5, 7, 11, 1, 6].iter() { let len = x.len(); List::insert(&mut x, len, *v)?; } let mut res = x.delete_between_unsorted(&3, &9); res.sort(); for (idx, v) in vec![3, 5, 6, 7, 7, 9].iter().enumerate() { assert_eq!(*List::get(&res, idx)?, *v); } for (idx, v) in vec![1, 11, 2, 1, 11, 1].iter().enumerate() { assert_eq!(*List::get(&x, idx)?, *v); } let mut res = x.delete_between_unsorted(&0, &11); res.sort(); assert_eq!(res, vec![1, 1, 1, 2, 11, 11]); assert!(x.is_empty()); Ok(()) }
rust_cleaned_test_functions.jsonl/24013
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 370 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11353, 48302, 4907, 28298, 4907, 28298, 368, 1464, 5714, 68843, 60203, 29, 341, 262, 1077, 5206, 856, 25, 3017, 10050, 90244, 29, 284, 3017, 10050, 486, 931, 543, 262, 369, 348, 304, 7486, 20703, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
#[test] fn test_parse_set_lockup() { let mut keys: Vec<Pubkey> = vec![]; for _ in 0..2 { keys.push(solana_sdk::pubkey::new_rand()); } let unix_timestamp = 1_234_567_890; let epoch = 11; let custodian = solana_sdk::pubkey::new_rand(); let lockup = LockupArgs { unix_timestamp: Some(unix_timestamp), epoch: None, custodian: None, }; let instruction = stake_instruction::set_lockup(&keys[1], &lockup, &keys[0]); let message = Message::new(&[instruction], None); assert_eq!( parse_stake(&message.instructions[0], &keys[0..2]).unwrap(), ParsedInstructionEnum { instruction_type: "setLockup".to_string(), info: json!({ "stakeAccount": keys[1].to_string(), "custodian": keys[0].to_string(), "lockup": { "unixTimestamp": unix_timestamp } }), } ); let lockup = LockupArgs { unix_timestamp: Some(unix_timestamp), epoch: Some(epoch), custodian: None, }; let instruction = stake_instruction::set_lockup(&keys[1], &lockup, &keys[0]); let message = Message::new(&[instruction], None); assert_eq!( parse_stake(&message.instructions[0], &keys[0..2]).unwrap(), ParsedInstructionEnum { instruction_type: "setLockup".to_string(), info: json!({ "stakeAccount": keys[1].to_string(), "custodian": keys[0].to_string(), "lockup": { "unixTimestamp": unix_timestamp, "epoch": epoch, } }), } ); let lockup = LockupArgs { unix_timestamp: Some(unix_timestamp), epoch: Some(epoch), custodian: Some(custodian), }; let instruction = stake_instruction::set_lockup(&keys[1], &lockup, &keys[0]); let message = Message::new(&[instruction], None); assert_eq!( parse_stake(&message.instructions[0], &keys[0..2]).unwrap(), ParsedInstructionEnum { instruction_type: "setLockup".to_string(), info: json!({ "stakeAccount": keys[1].to_string(), "custodian": keys[0].to_string(), "lockup": { "unixTimestamp": unix_timestamp, "epoch": epoch, "custodian": custodian.to_string(), } }), } ); assert!(parse_stake(&message.instructions[0], &keys[0..1]).is_err()); }
rust_cleaned_test_functions.jsonl/133041
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1642 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 2602, 9818, 454, 368, 341, 286, 1077, 5206, 6894, 25, 11312, 21604, 392, 792, 29, 284, 7486, 0, 15078, 286, 369, 716, 304, 220, 15, 496, 17, 341, 310, 6894, 2552, 80608, 3362, 61783, 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...
2
#[test] fn test_question_checker() { let path = PathBuf::from(r"./test_questions.txt"); assert_eq!(check_file(path), [1, 2, 2, 5, 5, 5, 6, 7, 6, 8, 8, 4, 4, 5]); }
rust_cleaned_test_functions.jsonl/71241
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 94 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28915, 62715, 368, 341, 262, 1077, 1815, 284, 7933, 15064, 486, 1499, 2601, 95092, 1944, 55048, 3909, 797, 1066, 262, 2060, 10714, 10297, 2028, 2458, 5581, 701, 508, 16, 11, 220, 17, 11, 220, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_all_refs_decl_module_on_self_crate_root() { check( r#" //- /lib.rs use self$0; "#, expect![[r#" Module FileId(0) 0..10 FileId(0) 4..8 "#]], ); }
rust_cleaned_test_functions.jsonl/60651
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 173 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 5705, 60638, 35814, 10750, 4470, 25637, 666, 7698, 12993, 368, 341, 286, 1779, 1006, 310, 435, 2, 698, 61463, 608, 2740, 25638, 198, 810, 656, 3, 15, 280, 57676, 345, 310, 1720, 0, 15505,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_content() { let result = convert_json::<(), Json<Value>>(StatusCode::NO_CONTENT.as_u16(), vec![]); println!("{:?}", result); assert!(matches!( result, Ok(JsonResponse::Success(StatusCode::NO_CONTENT, ())) )); }
rust_cleaned_test_functions.jsonl/83263
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 150 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 7495, 368, 341, 286, 1077, 1102, 284, 5508, 9455, 27638, 1507, 8308, 48325, 25526, 15872, 486, 8996, 25560, 5357, 7300, 16, 21, 1507, 7486, 0, 56703, 286, 13751, 88928, 25, 52652, 1102, 317,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_offset_of() { #[repr(C)] pub struct Student { student_id: u32, weight: u8, age: u8, marks: u32, is_male: bool, } assert_eq!(offset_of!(Student, student_id), 0); assert_eq!(offset_of!(Student, weight), 4); assert_eq!(offset_of!(Student, age), 5); assert_eq!(offset_of!(Student, marks), 8); assert_eq!(offset_of!(Student, is_male), 12); #[repr(C, packed)] pub struct Student_packed { student_id: u32, weight: u8, age: u8, marks: u32, is_male: bool, } assert_eq!(offset_of!(Student_packed, student_id), 0); assert_eq!(offset_of!(Student_packed, weight), 4); assert_eq!(offset_of!(Student_packed, age), 5); assert_eq!(offset_of!(Student_packed, marks), 6); assert_eq!(offset_of!(Student_packed, is_male), 10); }
rust_cleaned_test_functions.jsonl/81004
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 534 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6917, 3575, 368, 341, 286, 11506, 30837, 3025, 5563, 286, 6675, 2036, 11726, 341, 310, 5458, 842, 25, 575, 18, 17, 345, 310, 4680, 25, 575, 23, 345, 310, 4231, 25, 575, 23, 345, 310, 15423, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_left_shift() { let cases = vec![ (Datum::I64(123), Datum::I64(2), Datum::I64(492)), (Datum::I64(-123), Datum::I64(-1), Datum::I64(0)), (Datum::I64(123), Datum::I64(0), Datum::I64(123)), (Datum::Null, Datum::I64(1), Datum::Null), (Datum::I64(123), Datum::Null, Datum::Null), ( Datum::I64(-123), Datum::I64(60), Datum::I64(5764607523034234880), ), ]; let mut ctx = EvalContext::default(); for (lhs, rhs, exp) in cases { let lhs = datum_expr(lhs); let rhs = datum_expr(rhs); let op = Expression::build( &ctx, scalar_func_expr(ScalarFuncSig::LeftShift, &[lhs, rhs]), ).unwrap(); let res = op.eval(&mut ctx, &[]).unwrap(); assert_eq!(res, exp); } }
rust_cleaned_test_functions.jsonl/16158
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 568 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9579, 22230, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 320, 68036, 486, 40, 21, 19, 7, 16, 17, 18, 701, 68459, 486, 40, 21, 19, 7, 17, 701, 68459, 486, 40, 21, 19, 7, 19, 24, 17,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_tcgetattr_pty() { let _m = crate::PTSNAME_MTX.lock(); let pty = openpty(None, None).expect("openpty failed"); assert!(termios::tcgetattr(pty.slave).is_ok()); close(pty.master).expect("closing the master failed"); close(pty.slave).expect("closing the slave failed"); }
rust_cleaned_test_functions.jsonl/103385
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 129 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 63126, 81732, 62, 1595, 368, 341, 1066, 262, 1077, 716, 76, 284, 17717, 486, 73693, 7535, 1245, 22867, 21003, 1428, 262, 1077, 281, 1881, 284, 1787, 1595, 26717, 11, 2240, 568, 17119, 445, 2508, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_resource_block_union_types_are_not_constructable() { let p = Polar::new(); let q = p.new_query(&format!("new {}()", ACTOR_UNION_NAME), false); let msg = match q { Err(error::PolarError { kind: error::ErrorKind::Parse(error::ParseError::ResourceBlock { msg, .. }), .. }) => msg, Err(e) => panic!("{}", e), _ => panic!("succeeded when I should've failed"), }; assert_eq!(msg, "hi"); }
rust_cleaned_test_functions.jsonl/31752
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 270 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17962, 7113, 51621, 9763, 56855, 7913, 64803, 480, 368, 341, 286, 1077, 281, 284, 55896, 486, 931, 543, 286, 1077, 2804, 284, 281, 4618, 5738, 2099, 2243, 17223, 931, 4687, 50514, 21116, 868, 6735...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_field_table() { let mut table = FieldTable::new(); table.insert(FieldName::with_bytes(b"hello").unwrap(), FieldValue::from_u32(0x12345678u32)); table.insert(FieldName::with_bytes(b"world").unwrap(), FieldValue::from_long_string(LongStr::with_bytes(b"hello").unwrap())); let mut ret = BytesMut::with_capacity(128); ret.put_u8(b'F'); ret.put_u32(27u32); for (k, _) in &table { if *k == FieldName::with_bytes(b"hello").unwrap() { ret.put_u8(5u8); ret.put_slice(b"hello"); ret.put_u8(b'i'); ret.put_u32(0x12345678u32); } else { ret.put_u8(5u8); ret.put_slice(b"world"); ret.put_u8(b'S'); ret.put_u32(5u32); ret.put_slice(b"hello"); } } if let (_, FieldValue::FieldTable(t)) = FieldValue::decode(&ret).unwrap() { assert!(matches!(t.get(&FieldName::with_bytes(b"hello").unwrap()).unwrap(), FieldValue::U32(v) if *v == 0x12345678u32)); assert!(matches!(t.get(&FieldName::with_bytes(b"world").unwrap()).unwrap(), FieldValue::LongStr(v) if v.to_string() == String::from("hello"))); } else { panic!("Expected FieldTable value"); } }
rust_cleaned_test_functions.jsonl/7189
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 722 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5013, 5237, 368, 341, 286, 1077, 5206, 1965, 284, 8601, 2556, 486, 931, 543, 286, 1965, 7030, 7, 51241, 486, 4197, 12524, 1883, 1, 14990, 1827, 15454, 1507, 8601, 1130, 486, 1499, 7300, 18, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_add_88_extended() { let x = 2; let y = 3; assert_eq!( 99, add_88!( // Expression x * 4, // Identifier y, // Code Block { println!("The values of x and y are {} and {}", x, y); } ) ); }
rust_cleaned_test_functions.jsonl/105014
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 262 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 62, 23, 23, 61678, 368, 314, 715, 286, 1077, 856, 284, 220, 17, 280, 286, 1077, 379, 284, 220, 18, 280, 286, 2060, 10714, 33673, 310, 220, 24, 24, 345, 310, 912, 62, 23, 23, 33673, 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_process_entries_tick() { let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(1000); let bank = Arc::new(Bank::new(&genesis_config)); // ensure bank can process a tick assert_eq!(bank.tick_height(), 0); let tick = next_entry(&genesis_config.hash(), 1, vec![]); assert_eq!( process_entries(&bank, &mut [tick], true, None, None), Ok(()) ); assert_eq!(bank.tick_height(), 1); }
rust_cleaned_test_functions.jsonl/47532
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 232 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11305, 26092, 43612, 368, 341, 286, 1077, 40788, 2648, 1731, 314, 59366, 5332, 11, 5241, 335, 284, 1855, 16322, 13774, 5332, 7, 16, 15, 15, 15, 317, 286, 1077, 6073, 284, 19689, 486, 931, 5349, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_iterate_string_vec() { let words = vec!["hello", "world"]; let capitalized_words: Vec<String> = capitalize_words(words); assert_eq!(capitalized_words, ["Hello", "World"]); }
rust_cleaned_test_functions.jsonl/4275
{ "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, 11723, 349, 3904, 13251, 368, 341, 286, 1077, 4244, 284, 7486, 0, 1183, 14990, 497, 330, 14615, 6332, 286, 1077, 97321, 18981, 25, 11312, 3464, 29, 284, 52725, 18981, 36289, 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
#[test] fn test_incrementing_int() { let mut int_series = IncrementingSeries { current: 5, increment: 10, }; let mut rng = rand::thread_rng(); assert_eq!(5, int_series.next(&mut rng).into_yielded().unwrap()); assert_eq!(15, int_series.next(&mut rng).into_yielded().unwrap()); assert_eq!(25, int_series.next(&mut rng).into_yielded().unwrap()) }
rust_cleaned_test_functions.jsonl/33872
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 208 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51482, 287, 4042, 368, 341, 286, 1077, 5206, 526, 35015, 284, 52835, 287, 25544, 341, 310, 1482, 25, 220, 20, 345, 310, 16252, 25, 220, 16, 15, 345, 286, 3634, 286, 1077, 5206, 28422, 284, 103...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_negated() { let mut c1 = Clause::new("foo".into()); c1.set_presence(Presence::Prohibited); let mut c2 = Clause::new("bar".into()); c2.set_presence(Presence::Prohibited); let mut query = Query::new(); query.add_clause(c1); query.add_clause(c2); assert!(query.is_negated()); let mut c1 = Clause::new("foo".into()); c1.set_presence(Presence::Prohibited); let mut c2 = Clause::new("bar".into()); c2.set_presence(Presence::Required); query.add_clause(c1); query.add_clause(c2); assert!(!query.is_negated()); let mut c1 = Clause::new("foo".into()); c1.set_presence(Presence::Optional); let mut c2 = Clause::new("bar".into()); c2.set_presence(Presence::Required); query.add_clause(c1); query.add_clause(c2); assert!(!query.is_negated()); }
rust_cleaned_test_functions.jsonl/82063
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 369 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 28209, 657, 368, 341, 262, 1077, 5206, 272, 16, 284, 55797, 486, 931, 445, 7975, 3263, 18122, 1423, 262, 272, 16, 980, 56403, 5304, 416, 763, 486, 1336, 92517, 317, 262, 1077, 5206, 272, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_fail_array_too_big() { let src_data = b"(test) a [1 2 3]"; let mut limits = yass_parser::ParserLimits::unlimited(); limits.max_array_size = 2; let expected_error = yass_parser::ParserError::ArrayTooBig { pos: yass::Pos::new(0, 14) }; assert_eq!(yass_parser::parse(limits, src_data).unwrap_err(), expected_error); }
rust_cleaned_test_functions.jsonl/126511
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 145 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22121, 3858, 2346, 78, 36386, 368, 341, 262, 1077, 2286, 1769, 284, 293, 29209, 1944, 8, 264, 508, 16, 220, 17, 220, 18, 59757, 262, 1077, 5206, 13388, 284, 379, 395, 18517, 486, 6570, 94588, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_scope_start_handles_sub_scopes() { let src = String::from( " fn myfn() { let a = 3; { let b = 4; } print(a); } ", ); let src = core::MaskedSource::new(&src); let raw_src = core::RawSource::new(src.to_string()); let point = raw_src.coords_to_point(&Coordinate::new(7, 10)).unwrap(); let start = scope_start(src.as_src(), point); assert_eq!(start, BytePos(12)); }
rust_cleaned_test_functions.jsonl/576
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 206 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 23199, 4906, 68017, 5228, 13171, 18523, 368, 341, 262, 1077, 2286, 284, 923, 486, 1499, 1006, 286, 6228, 8822, 847, 8822, 368, 341, 262, 1077, 264, 284, 220, 18, 280, 262, 341, 414, 1077, 293, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_action_msgs() { use example_interfaces::action::Fibonacci; let mut goal = Fibonacci::Goal::default(); goal.order = 5; let gn = WrappedNativeMsg::<_>::from(&goal); let goal2 = Fibonacci::Goal::from_native(&gn); println!("goal2 {:?}", goal2); assert_eq!(goal, goal2); let mut res = Fibonacci::Result::default(); res.sequence = vec![1, 2, 3]; let rn = WrappedNativeMsg::<_>::from(&res); let res2 = Fibonacci::Result::from_native(&rn); println!("res2 {:?}", res2); assert_eq!(res, res2); let mut fb = Fibonacci::Feedback::default(); fb.sequence = vec![4, 3, 6]; let fbn = WrappedNativeMsg::<_>::from(&fb); let fb2 = Fibonacci::Feedback::from_native(&fbn); println!("feedback2 {:?}", fb2); assert_eq!(fb, fb2); let fb = WrappedNativeMsg::<Fibonacci::Feedback>::new(); let fb1 = Fibonacci::Feedback::default(); let fb2 = Fibonacci::Feedback::from_native(&fb); assert_eq!(fb1, fb2); }
rust_cleaned_test_functions.jsonl/112961
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 525 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7931, 20777, 368, 341, 286, 990, 3110, 72960, 486, 1311, 486, 37, 579, 39345, 280, 286, 1077, 5206, 5795, 284, 79683, 486, 39992, 486, 2258, 543, 286, 5795, 14041, 284, 220, 20, 280, 286, 1077, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1