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_pathbuf_string_conversion() {
let input_path_string = "/home/test/.kube/config";
let legal_path = PathBuf::from(input_path_string);
let legal_path_string = CreatingConfig::pathbuf_to_string("testfield", legal_path).unwrap();
assert_eq!(input_path_string, legal_path_string);
} | rust_cleaned_test_functions.jsonl/32150 | {
"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,
2638,
5909,
3904,
64132,
368,
341,
286,
1077,
1946,
2638,
3904,
284,
3521,
5117,
12697,
11930,
97717,
14730,
876,
286,
1077,
5777,
2638,
284,
7933,
15064,
486,
1499,
5384,
2638,
3904,
317,
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... | 1 |
#[test]
fn test_solve() {
let input = vec![1721, 979, 366, 299, 675, 1456];
assert_eq!(solve(&input), Some(241861950));
} | rust_cleaned_test_functions.jsonl/108750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 62
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86246,
368,
341,
10217,
1946,
284,
7486,
20703,
16,
22,
17,
16,
11,
220,
24,
22,
24,
11,
220,
18,
21,
21,
11,
220,
17,
24,
24,
11,
220,
21,
22,
20,
11,
220,
16,
19,
20,
21,
935,
6948,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_fail_thematic_break_into_paragraph() {
assert_eq!(
parse("# boop\n\n-d--\n\n## boop 2\n\n",).unwrap(),
Mdx {
ast: vec![
MdxAst::ATXHeading(ast::ATXHeading {
level: 1,
value: "boop"
}),
MdxAst::Paragraph(ast::Paragraph { words: "-d--" }),
MdxAst::ATXHeading(ast::ATXHeading {
level: 2,
value: "boop 2"
})
]
}
);
} | rust_cleaned_test_functions.jsonl/58230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
22121,
5854,
12240,
39494,
45514,
96713,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
3584,
708,
453,
1699,
1699,
1737,
313,
59,
77,
1699,
565,
708,
453,
220,
17,
1699,
1699,
497,
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... | 1 |
#[test]
fn test_add_iface() {
let mut exec = fasync::TestExecutor::new().expect("Failed to create an executor");
// Boilerplate for adding a new interface.
let iface_map = Arc::new(IfaceMap::new());
let iface_counter = Arc::new(IfaceCounter::new());
let (inspect_tree, _persistence_stream) = test_helper::fake_inspect_tree();
let (sender, _receiver) = mpsc::channel(1);
let cobalt_sender = CobaltSender::new(sender);
let (cobalt_1dot1_proxy, _) =
create_proxy::<fidl_fuchsia_metrics::MetricEventLoggerMarker>()
.expect("failed to create Cobalt 1.1 proxy");
let (dev_monitor_proxy, _) =
create_proxy::<fidl_fuchsia_wlan_device_service::DeviceMonitorMarker>()
.expect("failed to create DeviceMonitor proxy");
let cfg = ServiceCfg { wep_supported: false, wpa1_supported: false };
// Construct the request.
let (mlme_channel, mlme_receiver) =
create_endpoints().expect("failed to create fake MLME proxy");
let mut mlme_stream = mlme_receiver.into_stream().expect("failed to create MLME stream");
let req =
fidl_svc::AddIfaceRequest { phy_id: 123, assigned_iface_id: 456, iface: mlme_channel };
let fut = add_iface(
req,
&cfg,
&iface_map,
&iface_counter,
&inspect_tree,
&cobalt_sender,
cobalt_1dot1_proxy,
dev_monitor_proxy,
);
pin_mut!(fut);
assert_variant!(exec.run_until_stalled(&mut fut), Poll::Pending);
// The future should have requested the PHY's information.
assert_variant!(
exec.run_until_stalled(&mut mlme_stream.next()),
Poll::Ready(Some(Ok(fidl_mlme::MlmeRequest::QueryDeviceInfo { responder }))) => {
let mut device_info = fake_device_info();
responder.send(&mut device_info).expect("failed to send MLME response");
});
// The future should complete successfully.
assert_variant!(exec.run_until_stalled(&mut fut), Poll::Ready(result) => {
assert!(result.result.is_ok());
assert_eq!(result.status, zx::sys::ZX_OK);
assert_eq!(result.iface_id, Some(fidl_svc::AddIfaceResponse { iface_id: 0 }));
});
} | rust_cleaned_test_functions.jsonl/46968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
67666,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
9408,
311,
1855,
458,
31558,
3071,
286,
442,
45665,
1750,
369,
7842,
264,
501,
3749,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_symlink_type_dir() {
let tmp_dir = tempdir().expect("failed to create temp dir");
// Create directory
let dir_path = tmp_dir.path().join("dir.d");
std::fs::create_dir(&dir_path).expect("failed to create dir");
// Create symlink
let symlink_path = tmp_dir.path().join("target.d");
symlink(&dir_path, &symlink_path).expect("failed to create symlink");
let meta = symlink_path
.symlink_metadata()
.expect("failed to get metas");
let colors = Colors::new(ThemeOption::NoLscolors);
let file_type = FileType::new(&meta, Some(&meta), &Permissions::from(&meta));
assert_eq!(
"l".to_string().with(Color::AnsiValue(44)),
file_type.render(&colors)
);
} | rust_cleaned_test_functions.jsonl/60421 | {
"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,
58530,
44243,
1819,
4334,
368,
341,
286,
1077,
4174,
4334,
284,
2730,
3741,
1005,
17119,
445,
16091,
311,
1855,
2730,
5419,
3071,
286,
442,
4230,
6220,
198,
286,
1077,
5419,
2638,
284,
4174,
4334,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_op_gte() {
let mut c = Compiler::new();
c.add(Instruction::LoadConst(Value::from(1)));
c.add(Instruction::LoadConst(Value::from(2)));
c.add(Instruction::Gte);
c.add(Instruction::Emit);
let mut output = String::new();
simple_eval(&c.finish().0, (), &mut output).unwrap();
assert_eq!(output, "false");
let mut c = Compiler::new();
c.add(Instruction::LoadConst(Value::from(1)));
c.add(Instruction::LoadConst(Value::from(1)));
c.add(Instruction::Gte);
c.add(Instruction::Emit);
let mut output = String::new();
simple_eval(&c.finish().0, (), &mut output).unwrap();
assert_eq!(output, "true");
} | rust_cleaned_test_functions.jsonl/72131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
1889,
665,
368,
341,
262,
1077,
5206,
272,
284,
45631,
486,
931,
543,
262,
272,
1364,
7,
16664,
486,
5879,
19167,
25346,
486,
1499,
7,
16,
4945,
262,
272,
1364,
7,
16664,
486,
5879,
191... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_en_passant() {
let movegen = MoveGenerator::new();
let mut builder = PositionBuilder::new();
builder
.place(Square::C4, Piece::BlackPawn, Color::Black)
.place(Square::B4, Piece::WhitePawn, Color::White)
.place(Square::G5, Piece::WhitePawn, Color::White)
.place(Square::H5, Piece::BlackPawn, Color::Black);
let pos = builder
.clone()
.side_to_move(Color::Black)
.en_passant_target(Some(Square::B3))
.build();
assert_eq!(
Ok(Move {
kind: MoveKind::EnPassantCapture,
from: Square::C4,
to: Square::B3,
}),
movegen.parse_move(&pos, "c4b3"),
);
let pos = builder
.clone()
.side_to_move(Color::White)
.en_passant_target(Some(Square::H6))
.build();
assert_eq!(
Ok(Move {
kind: MoveKind::EnPassantCapture,
from: Square::G5,
to: Square::H6,
}),
movegen.parse_move(&pos, "g5h6"),
);
} | rust_cleaned_test_functions.jsonl/134622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6205,
15464,
517,
368,
341,
262,
1077,
3271,
4370,
284,
14561,
12561,
486,
931,
543,
262,
1077,
5206,
7363,
284,
12380,
3297,
486,
931,
543,
262,
7363,
198,
414,
659,
2007,
3759,
5151,
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... | 1 |
#[test]
fn test_fn_signature_two_args_empty() {
let info = call_info(
r#"fn foo(x: u32, y: u32) -> u32 {x + y}
fn bar() { foo(<|>); }"#,
);
assert_eq!(info.parameters(), ["x: u32", "y: u32"]);
assert_eq!(info.active_parameter, Some(0));
} | rust_cleaned_test_functions.jsonl/55348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
39859,
23241,
8384,
15124,
368,
341,
286,
1077,
3546,
284,
1618,
3109,
1006,
310,
435,
55543,
8822,
15229,
2075,
25,
575,
18,
17,
11,
379,
25,
575,
18,
17,
8,
1464,
575,
18,
17,
314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_try_split() {
let mut a: Vec<Element> = [
(0u32, 4u32),
(7, 4),
(4, 3),
(7, 4),
(8, 4),
(0, 4),
(13, 4),
(1, 2),
(1, 2),
]
.iter()
.map(|(value, depth)| Element {
value: *value,
depth: *depth,
})
.collect();
let should_split = try_split(&mut a);
assert!(should_split);
assert_eq!(a, parse_line("[[[[0,7],4],[[7,8],[0,[6,7]]]],[1,1]]"));
} | rust_cleaned_test_functions.jsonl/124064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
17052,
368,
341,
286,
1077,
5206,
264,
25,
11312,
72365,
29,
284,
2278,
310,
320,
15,
84,
18,
17,
11,
220,
19,
84,
18,
17,
1326,
310,
320,
22,
11,
220,
19,
1326,
310,
320,
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_zip321_parse_empty_message() {
let fragment = "message=";
let result = zcashparam(&TEST_NETWORK)(fragment).unwrap().1.param;
assert_eq!(result, Param::Message("".to_string()));
} | rust_cleaned_test_functions.jsonl/81781 | {
"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,
42131,
18,
17,
16,
21039,
15124,
6462,
368,
341,
286,
1077,
12289,
284,
330,
1994,
428,
401,
286,
1077,
1102,
284,
1147,
41271,
903,
2099,
10033,
48119,
2376,
42202,
568,
15454,
1005,
16,
6634,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_session_description_json() {
let tests = vec![
(
RTCSessionDescription {
sdp_type: RTCSdpType::Offer,
sdp: "sdp".to_owned(),
parsed: None,
},
r#"{"type":"offer","sdp":"sdp"}"#,
),
(
RTCSessionDescription {
sdp_type: RTCSdpType::Pranswer,
sdp: "sdp".to_owned(),
parsed: None,
},
r#"{"type":"pranswer","sdp":"sdp"}"#,
),
(
RTCSessionDescription {
sdp_type: RTCSdpType::Answer,
sdp: "sdp".to_owned(),
parsed: None,
},
r#"{"type":"answer","sdp":"sdp"}"#,
),
(
RTCSessionDescription {
sdp_type: RTCSdpType::Rollback,
sdp: "sdp".to_owned(),
parsed: None,
},
r#"{"type":"rollback","sdp":"sdp"}"#,
),
(
RTCSessionDescription {
sdp_type: RTCSdpType::Unspecified,
sdp: "sdp".to_owned(),
parsed: None,
},
r#"{"type":"Unspecified","sdp":"sdp"}"#,
),
];
for (desc, expected_string) in tests {
let result = serde_json::to_string(&desc);
assert!(result.is_ok(), "testCase: marshal err: {:?}", result);
let desc_data = result.unwrap();
assert_eq!(desc_data, expected_string, "string is not expected");
let result = serde_json::from_str::<RTCSessionDescription>(&desc_data);
assert!(result.is_ok(), "testCase: unmarshal err: {:?}", result);
if let Ok(sd) = result {
assert!(sd.sdp == desc.sdp && sd.sdp_type == desc.sdp_type);
}
}
} | rust_cleaned_test_functions.jsonl/124416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12316,
11448,
9455,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
2399,
394,
35047,
5283,
5009,
341,
503,
274,
9796,
1819,
25,
10635,
6412,
9796,
929,
486,
39462,
345,
503,
274,
9796,
25,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_move_to_winapi() {
let (saved_x, saved_y) = position().unwrap();
move_to(saved_x + 1, saved_y + 1).unwrap();
assert_eq!(position().unwrap(), (saved_x + 1, saved_y + 1));
move_to(saved_x, saved_y).unwrap();
assert_eq!(position().unwrap(), (saved_x, saved_y));
} | rust_cleaned_test_functions.jsonl/15637 | {
"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,
17134,
2346,
25672,
2068,
368,
341,
286,
1077,
320,
32702,
3212,
11,
6781,
4178,
8,
284,
2309,
1005,
15454,
1428,
286,
3271,
2346,
14217,
3212,
488,
220,
16,
11,
6781,
4178,
488,
220,
16,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_start_training_selected_participant_training_complete() {
let mut protocol = Protocol::new(get_default_fl_settings());
protocol.is_training_complete = true;
let resp = protocol.start_training(ClientState::Selected);
assert_eq!(StartTrainingResponse::Reject, resp);
assert!(protocol.next_event().is_none());
} | rust_cleaned_test_functions.jsonl/97781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
32891,
23755,
10495,
21757,
32891,
27675,
368,
341,
286,
1077,
5206,
11507,
284,
24572,
486,
931,
5433,
9993,
5081,
10853,
1423,
286,
11507,
2079,
32891,
27675,
284,
830,
401,
286,
1077,
9039,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_folder_dup() {
let items = string_vec_to_status(&[
"a/file.txt",
"a/file2.txt",
]);
let res = FileTreeItems::new(&items, &BTreeSet::new())
.unwrap()
.items
.iter()
.map(|i| i.info.full_path.clone())
.collect::<Vec<_>>();
assert_eq!(
res,
vec![
String::from("a"),
items[0].path.clone(),
items[1].path.clone()
]
);
} | rust_cleaned_test_functions.jsonl/56874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15268,
51932,
368,
341,
286,
1077,
3589,
284,
914,
13251,
2346,
4773,
2099,
9640,
310,
330,
64,
23903,
3909,
497,
2303,
310,
330,
64,
23903,
17,
3909,
497,
715,
286,
22712,
286,
1077,
592,
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_binary_representation_rfc_private_key() {
let parameters = [
HssParameter::construct_default_parameters(),
HssParameter::construct_default_parameters(),
];
let mut seed = Seed::default();
OsRng.fill_bytes(&mut seed);
let key = ReferenceImplPrivateKey::generate(¶meters, &seed).unwrap();
let binary_representation = key.to_binary_representation();
let deserialized = ReferenceImplPrivateKey::<Hasher>::from_binary_representation(
binary_representation.as_slice(),
)
.unwrap();
assert!(key == deserialized);
} | rust_cleaned_test_functions.jsonl/29975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
94263,
1710,
8316,
26249,
3097,
368,
341,
286,
1077,
5029,
284,
2278,
310,
472,
778,
4971,
486,
7596,
9993,
18263,
3148,
310,
472,
778,
4971,
486,
7596,
9993,
18263,
3148,
286,
15424,
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_ElfMut_from_dynamic_hdr() {
let mut buf = ELF32_DYNAMIC_ELF_HDR.clone();
let elf: Result<ElfMut<'_, LittleEndian, Elf32>, ElfError> =
ElfMut::try_from(&mut buf[0..]);
assert!(elf.is_ok());
} | rust_cleaned_test_functions.jsonl/119500 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2089,
11008,
51440,
5673,
45992,
28238,
368,
341,
262,
1077,
5206,
6607,
284,
72568,
18,
17,
57356,
2089,
22609,
55765,
15997,
543,
262,
1077,
40745,
25,
5714,
27,
75832,
51440,
18291,
6878,
14671,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_resource_blocks_missing_has_permission_warning() {
let mut kb = KnowledgeBase::new();
kb.resource_blocks
.resources
.insert(term!(sym!("Organization")));
assert!(check_resource_blocks_missing_has_permission(&kb).is_some());
} | rust_cleaned_test_functions.jsonl/102136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
17962,
25201,
40447,
21778,
37971,
38395,
368,
341,
286,
1077,
5206,
38653,
284,
31925,
3978,
486,
931,
543,
286,
38653,
24013,
25201,
198,
310,
659,
12745,
198,
310,
659,
4208,
44654,
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 |
#[test]
fn test_merge_normal_to_sparse() {
let mut hll: HyperLogLogPlus<u64, PassThroughHasherBuilder> =
HyperLogLogPlus::new(16, PassThroughHasherBuilder {}).unwrap();
let mut other: HyperLogLogPlus<u64, PassThroughHasherBuilder> =
HyperLogLogPlus::new(16, PassThroughHasherBuilder {}).unwrap();
other.sparse_to_normal();
other.add(&0x00010fffffffffff);
other.add(&0x00020fffffffffff);
other.add(&0x00030fffffffffff);
other.add(&0x00040fffffffffff);
other.add(&0x00050fffffffffff);
other.add(&0x00050fffffffffff);
assert_eq!(other.count().trunc() as u64, 5);
let res = hll.merge(&other);
assert_eq!(res, Ok(()));
assert_eq!(hll.count().trunc() as u64, 5);
assert!(!hll.is_sparse() && !other.is_sparse());
} | rust_cleaned_test_functions.jsonl/8355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
13973,
2346,
71123,
368,
341,
286,
1077,
5206,
305,
654,
25,
32732,
2201,
2201,
21807,
34837,
21,
19,
11,
9970,
23857,
6370,
261,
3297,
29,
4035,
310,
32732,
2201,
2201,
21807,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_colouring() -> Result<(), Error> {
let test_input = "f=[1| 0 , 3 | 2] x o\n\n";
let (_, (parsed_colours, max_colour)) = parse_colouring(5, test_input)?;
assert_eq!(4, max_colour);
assert_eq!(vec![2, 1, 3, 2, DEFAULT_COLOR], parsed_colours);
Ok(())
} | rust_cleaned_test_functions.jsonl/46229 | {
"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,
21039,
56260,
287,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1273,
5898,
284,
330,
69,
5818,
16,
91,
220,
220,
15,
220,
1154,
220,
220,
18,
760,
220,
17,
60,
856,
297,
1699,
1699,
87... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_eq_scalar() {
test_generic_scalar::<i32, _>(
vec!["arrow", "parquet", "datafusion", "flight"],
"arrow",
eq_scalar,
vec![true, false, false, false],
)
} | rust_cleaned_test_functions.jsonl/64918 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
41652,
368,
341,
286,
1273,
41232,
41652,
27638,
72,
18,
17,
11,
716,
17055,
310,
7486,
0,
1183,
6044,
497,
330,
1732,
23300,
497,
330,
691,
54565,
497,
330,
38390,
8097,
310,
330,
6044,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_local_state_storage() -> Result<()> {
init_for_e2e_testing();
let (mock_chain_service, _handle) = MockChainClient::new();
let client = Arc::new(mock_chain_service.clone());
let account_address = AccountAddress::random();
faucet_sync(mock_chain_service, account_address, 1_000_000)?;
debug!("faucet finish");
let storage = LocalStateStorage::new(account_address, client)?;
let state_view = storage.new_state_view(None)?;
let account_resource = state_view.get(&AccessPath::new_for_account(account_address))?;
debug_assert!(account_resource.is_some());
debug!("test finish");
Ok(())
} | rust_cleaned_test_functions.jsonl/111154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
4387,
23310,
368,
1464,
5714,
71698,
341,
262,
2930,
5478,
2204,
17,
68,
70962,
543,
262,
1077,
320,
16712,
30583,
12267,
11,
716,
8192,
8,
284,
14563,
18837,
2959,
486,
931,
543,
262,
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... | 5 |
#[test]
fn test_from_vec_int() {
let s: Series<i64, usize> = Series::from(vec![1, 2, 3]);
let exp: Series<i64, usize> = Series::new(vec![1, 2, 3], vec![0, 1, 2]);
assert_eq!(s, exp);
} | rust_cleaned_test_functions.jsonl/77388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
13251,
4042,
368,
341,
286,
1077,
274,
25,
11131,
21897,
21,
19,
11,
22301,
29,
284,
11131,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
2558,
286,
1077,
1343,
25,
11131,
21897... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_role() {
let mut cmd1 = Command::cargo_bin("factomd").unwrap();
let mut cmd2 = Command::cargo_bin("factomd").unwrap();
let mut cmd3 = Command::cargo_bin("factomd").unwrap();
let mut cmd4 = Command::cargo_bin("factomd").unwrap();
cmd1.arg("--role").arg("FULL").assert().success();
cmd2.arg("--role").arg("AUTHORITY").assert().success();
cmd3.arg("--role").arg("LIGHT").assert().success();
cmd4.arg("--role").arg("OTHER").assert().failure();
} | rust_cleaned_test_functions.jsonl/86577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19792,
368,
341,
262,
1077,
5206,
5439,
16,
284,
7348,
486,
66715,
21816,
445,
33110,
316,
67,
1827,
15454,
543,
262,
1077,
5206,
5439,
17,
284,
7348,
486,
66715,
21816,
445,
33110,
316,
67,
182... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_merge_multivalued_int_fields() {
let mut schema_builder = schema::SchemaBuilder::default();
let int_options = IntOptions::default()
.set_fast(Cardinality::MultiValues)
.set_indexed();
let int_field = schema_builder.add_u64_field("intvals", int_options);
let index = Index::create_in_ram(schema_builder.build());
{
let mut index_writer = index.writer_with_num_threads(1, 40_000_000).unwrap();
let index_doc = |index_writer: &mut IndexWriter, int_vals: &[u64]| {
let mut doc = Document::default();
for &val in int_vals {
doc.add_u64(int_field, val);
}
index_writer.add_document(doc);
};
index_doc(&mut index_writer, &[1, 2]);
index_doc(&mut index_writer, &[1, 2, 3]);
index_doc(&mut index_writer, &[4, 5]);
index_doc(&mut index_writer, &[1, 2]);
index_doc(&mut index_writer, &[1, 5]);
index_doc(&mut index_writer, &[3]);
index_doc(&mut index_writer, &[17]);
index_writer.commit().expect("committed");
index_doc(&mut index_writer, &[20]);
index_writer.commit().expect("committed");
index_doc(&mut index_writer, &[28, 27]);
index_doc(&mut index_writer, &[1_000]);
index_writer.commit().expect("committed");
}
index.load_searchers().unwrap();
let searcher = index.searcher();
let mut vals: Vec<u64> = Vec::new();
{
let segment = searcher.segment_reader(0u32);
let ff_reader = segment.multi_fast_field_reader(int_field).unwrap();
ff_reader.get_vals(0, &mut vals);
assert_eq!(&vals, &[1, 2]);
ff_reader.get_vals(1, &mut vals);
assert_eq!(&vals, &[1, 2, 3]);
ff_reader.get_vals(2, &mut vals);
assert_eq!(&vals, &[4, 5]);
ff_reader.get_vals(3, &mut vals);
assert_eq!(&vals, &[1, 2]);
ff_reader.get_vals(4, &mut vals);
assert_eq!(&vals, &[1, 5]);
ff_reader.get_vals(5, &mut vals);
assert_eq!(&vals, &[3]);
ff_reader.get_vals(6, &mut vals);
assert_eq!(&vals, &[17]);
}
{
let segment = searcher.segment_reader(1u32);
let ff_reader = segment.multi_fast_field_reader(int_field).unwrap();
ff_reader.get_vals(0, &mut vals);
assert_eq!(&vals, &[20]);
}
{
let segment = searcher.segment_reader(2u32);
let ff_reader = segment.multi_fast_field_reader(int_field).unwrap();
ff_reader.get_vals(0, &mut vals);
assert_eq!(&vals, &[28, 27]);
ff_reader.get_vals(1, &mut vals);
assert_eq!(&vals, &[1_000]);
}
// Merging the segments
{
let segment_ids = index
.searchable_segment_ids()
.expect("Searchable segments failed.");
let mut index_writer = index.writer_with_num_threads(1, 40_000_000).unwrap();
index_writer
.merge(&segment_ids)
.expect("Failed to initiate merge")
.wait()
.expect("Merging failed");
index_writer.wait_merging_threads().unwrap();
}
index.load_searchers().unwrap();
{
let searcher = index.searcher();
let segment = searcher.segment_reader(0u32);
let ff_reader = segment.multi_fast_field_reader(int_field).unwrap();
ff_reader.get_vals(0, &mut vals);
assert_eq!(&vals, &[1, 2]);
ff_reader.get_vals(1, &mut vals);
assert_eq!(&vals, &[1, 2, 3]);
ff_reader.get_vals(2, &mut vals);
assert_eq!(&vals, &[4, 5]);
ff_reader.get_vals(3, &mut vals);
assert_eq!(&vals, &[1, 2]);
ff_reader.get_vals(4, &mut vals);
assert_eq!(&vals, &[1, 5]);
ff_reader.get_vals(5, &mut vals);
assert_eq!(&vals, &[3]);
ff_reader.get_vals(6, &mut vals);
assert_eq!(&vals, &[17]);
ff_reader.get_vals(7, &mut vals);
assert_eq!(&vals, &[20]);
ff_reader.get_vals(8, &mut vals);
assert_eq!(&vals, &[28, 27]);
ff_reader.get_vals(9, &mut vals);
assert_eq!(&vals, &[1_000]);
}
} | rust_cleaned_test_functions.jsonl/72014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
26290,
3936,
3260,
4042,
12132,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
10802,
486,
8632,
3297,
486,
2258,
543,
286,
1077,
526,
8743,
284,
1333,
3798,
486,
2258,
741,
310,
659,
746,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_github_cert() {
Context::new(
"github",
"github.com",
&[
include_bytes!("testdata/cert-github.0.der"),
include_bytes!("testdata/cert-github.1.der"),
],
)
.bench(100)
} | rust_cleaned_test_functions.jsonl/801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
3827,
37097,
368,
341,
262,
9608,
486,
931,
1006,
286,
330,
5204,
756,
286,
330,
5204,
905,
756,
286,
609,
9640,
310,
2924,
12524,
17223,
92425,
2899,
529,
2371,
3827,
13,
15,
75819,
4461,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_analyze_function() {
let b = ast::BaseNode::default();
let pkg = ast::Package {
base: b.clone(),
path: "path".to_string(),
package: "main".to_string(),
files: vec![ast::File {
base: b.clone(),
name: "foo.flux".to_string(),
package: None,
imports: Vec::new(),
body: vec![
ast::Statement::Variable(ast::VariableAssgn {
base: b.clone(),
id: ast::Identifier {
base: b.clone(),
name: "f".to_string(),
},
init: ast::Expression::Function(Box::new(ast::FunctionExpr {
base: b.clone(),
params: vec![
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "a".to_string(),
}),
value: None,
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "b".to_string(),
}),
value: None,
},
],
body: ast::FunctionBody::Expr(ast::Expression::Binary(Box::new(
ast::BinaryExpr {
base: b.clone(),
operator: ast::Operator::AdditionOperator,
left: ast::Expression::Identifier(ast::Identifier {
base: b.clone(),
name: "a".to_string(),
}),
right: ast::Expression::Identifier(ast::Identifier {
base: b.clone(),
name: "b".to_string(),
}),
},
))),
})),
}),
ast::Statement::Expr(ast::ExprStmt {
base: b.clone(),
expression: ast::Expression::Call(Box::new(ast::CallExpr {
base: b.clone(),
callee: ast::Expression::Identifier(ast::Identifier {
base: b.clone(),
name: "f".to_string(),
}),
arguments: vec![ast::Expression::Object(Box::new(ast::ObjectExpr {
base: b.clone(),
with: None,
properties: vec![
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "a".to_string(),
}),
value: Some(ast::Expression::Integer(ast::IntegerLit {
base: b.clone(),
value: 2,
})),
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "b".to_string(),
}),
value: Some(ast::Expression::Integer(ast::IntegerLit {
base: b.clone(),
value: 3,
})),
},
],
}))],
})),
}),
],
}],
};
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![
Statement::Variable(VariableAssgn {
loc: b.location.clone(),
id: Identifier {
loc: b.location.clone(),
name: "f".to_string(),
},
init: Expression::Function(Box::new(FunctionExpr {
loc: b.location.clone(),
typ: type_info(),
params: vec![
FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: "a".to_string(),
},
default: None,
},
FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: "b".to_string(),
},
default: None,
},
],
body: Block {
loc: b.location.clone(),
body: vec![Statement::Return(ReturnStmt {
loc: b.location.clone(),
argument: Expression::Binary(Box::new(BinaryExpr {
loc: b.location.clone(),
typ: type_info(),
operator: ast::Operator::AdditionOperator,
left: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "a".to_string(),
}),
right: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "b".to_string(),
}),
})),
})],
},
})),
}),
Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Call(Box::new(CallExpr {
loc: b.location.clone(),
typ: type_info(),
pipe: None,
callee: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "f".to_string(),
}),
arguments: vec![
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "a".to_string(),
},
value: Expression::Integer(IntegerLit {
loc: b.location.clone(),
typ: type_info(),
value: 2,
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "b".to_string(),
},
value: Expression::Integer(IntegerLit {
loc: b.location.clone(),
typ: type_info(),
value: 3,
}),
},
],
})),
}),
],
}],
};
let got = test_analyze(pkg).unwrap();
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/61562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 7413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12008,
55856,
9174,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
11763,
486,
13100,
341,
310,
2331,
25,
293,
15997,
3148,
310,
1815,
25,
330,
234... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rect_points() {
assert_eq!(
Rect::new(10, 20, 100, 200),
rect_points(PixelsXY { x: 10, y: 20 }, PixelsXY { x: 110, y: 220 })
);
assert_eq!(
Rect::new(10, 20, 100, 200),
rect_points(PixelsXY { x: 110, y: 20 }, PixelsXY { x: 10, y: 220 })
);
assert_eq!(
Rect::new(10, 20, 100, 200),
rect_points(PixelsXY { x: 10, y: 220 }, PixelsXY { x: 110, y: 20 })
);
assert_eq!(
Rect::new(10, 20, 100, 200),
rect_points(PixelsXY { x: 110, y: 220 }, PixelsXY { x: 10, y: 20 })
);
assert_eq!(
Rect::new(-31000, -32000, 31005, 32010),
rect_points(PixelsXY { x: 5, y: -32000 }, PixelsXY { x: -31000, y: 10 })
);
assert_eq!(
Rect::new(10, 5, 30990, 31995),
rect_points(PixelsXY { x: 31000, y: 5 }, PixelsXY { x: 10, y: 32000 })
);
assert_eq!(
Rect::new(-31000, -32000, 62000, 64000),
rect_points(PixelsXY { x: -31000, y: -32000 }, PixelsXY { x: 31000, y: 32000 })
);
assert_eq!(
Rect::new(-31000, -32000, 62000, 64000),
rect_points(PixelsXY { x: 31000, y: 32000 }, PixelsXY { x: -31000, y: -32000 })
);
} | rust_cleaned_test_functions.jsonl/15259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 748
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16979,
12928,
368,
341,
286,
2060,
10714,
33673,
310,
11920,
486,
931,
7,
16,
15,
11,
220,
17,
15,
11,
220,
16,
15,
15,
11,
220,
17,
15,
15,
1326,
310,
7608,
12928,
5304,
10274,
16356,
314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_syscall_parameter_on_stack() {
test_interpreter_and_jit_asm!(
"
mov64 r1, r10
add64 r1, -0x100
mov64 r2, 0x1
syscall BpfSyscallString
mov64 r0, 0x0
exit",
[],
(
b"BpfSyscallString" => syscalls::BpfSyscallString::call; syscalls::BpfSyscallString {},
),
{ |_vm, res: Result| { res.unwrap() == 0 } },
6
);
} | rust_cleaned_test_functions.jsonl/59037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20344,
6659,
24899,
4470,
15528,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
21,
19,
435,
16,
11,
435,
16,
15,
198,
286,
912,
21,
19,
435,
16,
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_check_program_subscribe_for_missing_optimistically_confirmed_slot() {
// Testing if we can get the pubsub notification if a slot does not
// receive OptimisticallyConfirmed but its descendant slot get the confirmed
// notification.
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(100);
let bank = Bank::new_for_tests(&genesis_config);
bank.lazy_rent_collection.store(true, Relaxed);
let blockhash = bank.last_blockhash();
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let bank0 = bank_forks.read().unwrap().get(0).unwrap().clone();
let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
bank_forks.write().unwrap().insert(bank1);
let bank1 = bank_forks.read().unwrap().get(1).unwrap().clone();
// add account for alice and process the transaction at bank1
let alice = Keypair::new();
let tx = system_transaction::create_account(
&mint_keypair,
&alice,
blockhash,
1,
16,
&stake::program::id(),
);
bank1.process_transaction(&tx).unwrap();
let bank2 = Bank::new_from_parent(&bank1, &Pubkey::default(), 2);
bank_forks.write().unwrap().insert(bank2);
// add account for bob and process the transaction at bank2
let bob = Keypair::new();
let tx = system_transaction::create_account(
&mint_keypair,
&bob,
blockhash,
2,
16,
&stake::program::id(),
);
let bank2 = bank_forks.read().unwrap().get(2).unwrap().clone();
bank2.process_transaction(&tx).unwrap();
let bank3 = Bank::new_from_parent(&bank2, &Pubkey::default(), 3);
bank_forks.write().unwrap().insert(bank3);
// add account for joe and process the transaction at bank3
let joe = Keypair::new();
let tx = system_transaction::create_account(
&mint_keypair,
&joe,
blockhash,
3,
16,
&stake::program::id(),
);
let bank3 = bank_forks.read().unwrap().get(3).unwrap().clone();
bank3.process_transaction(&tx).unwrap();
// now add programSubscribe at the "confirmed" commitment level
let exit = Arc::new(AtomicBool::new(false));
let optimistically_confirmed_bank =
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks);
let mut pending_optimistically_confirmed_banks = HashSet::new();
let subscriptions = Arc::new(RpcSubscriptions::new_for_tests(
&exit,
bank_forks.clone(),
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_slots(
1, 1,
))),
optimistically_confirmed_bank.clone(),
));
let (rpc, mut receiver) = rpc_pubsub_service::test_connection(&subscriptions);
let sub_id = rpc
.program_subscribe(
stake::program::id().to_string(),
Some(RpcProgramAccountsConfig {
account_config: RpcAccountInfoConfig {
commitment: Some(CommitmentConfig::confirmed()),
..RpcAccountInfoConfig::default()
},
..RpcProgramAccountsConfig::default()
}),
)
.unwrap();
subscriptions
.control
.assert_subscribed(&SubscriptionParams::Program(ProgramSubscriptionParams {
pubkey: stake::program::id(),
filters: Vec::new(),
encoding: UiAccountEncoding::Binary,
data_slice: None,
commitment: CommitmentConfig::confirmed(),
with_context: false,
}));
let mut highest_confirmed_slot: Slot = 0;
let mut last_notified_confirmed_slot: Slot = 0;
// to see transaction for alice and bob to be notified in order.
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::OptimisticallyConfirmed(3),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
// a closure to reduce code duplications in building expected responses:
let build_expected_resp = |slot: Slot, lamports: u64, pubkey: &str, subscription: i32| {
json!({
"jsonrpc": "2.0",
"method": "programNotification",
"params": {
"result": {
"context": { "slot": slot },
"value": {
"account": {
"data": "1111111111111111",
"executable": false,
"lamports": lamports,
"owner": "Stake11111111111111111111111111111111111111",
"rentEpoch": 0,
},
"pubkey": pubkey,
},
},
"subscription": subscription,
}
})
};
let response = receiver.recv();
let expected = build_expected_resp(1, 1, &alice.pubkey().to_string(), 0);
assert_eq!(
expected,
serde_json::from_str::<serde_json::Value>(&response).unwrap(),
);
let response = receiver.recv();
let expected = build_expected_resp(2, 2, &bob.pubkey().to_string(), 0);
assert_eq!(
expected,
serde_json::from_str::<serde_json::Value>(&response).unwrap(),
);
bank3.freeze();
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::Frozen(bank3),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
let response = receiver.recv();
let expected = build_expected_resp(3, 3, &joe.pubkey().to_string(), 0);
assert_eq!(
expected,
serde_json::from_str::<serde_json::Value>(&response).unwrap(),
);
rpc.program_unsubscribe(sub_id).unwrap();
} | rust_cleaned_test_functions.jsonl/14337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
25096,
88935,
5478,
40447,
15032,
318,
37110,
16059,
8434,
27563,
368,
341,
286,
442,
26768,
421,
582,
646,
633,
279,
6675,
1966,
11540,
421,
264,
9446,
1558,
537,
198,
286,
442,
5258,
30097... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_show_stories() -> Result<(), Box<dyn Error>> {
setup();
let client = JsonClient::new();
let ids = client.show_stories()?;
log::debug!("ids = {:?}", ids);
Ok(())
} | rust_cleaned_test_functions.jsonl/106545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15267,
1261,
2433,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
6505,
1428,
286,
1077,
2943,
284,
8308,
2959,
486,
931,
543,
286,
1077,
14151,
284,
2943,
5460,
1261,
2433,
94136,
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
] | 2 |
#[test]
fn test_from_static_custom_long_uppercase() {
HeaderName::from_static(
"Longer-Than-63--ThisHeaderIsLongerThanSixtyThreeCharactersAndThusHandledDifferent",
);
} | rust_cleaned_test_functions.jsonl/3414 | {
"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,
5673,
25360,
15875,
17799,
34445,
5638,
368,
341,
286,
12104,
675,
486,
1499,
25360,
1006,
310,
330,
6583,
261,
12,
26067,
12,
21,
18,
313,
1986,
4047,
3872,
6583,
261,
26067,
41460,
1881,
19641,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_row() {
assert_eq!(row(""), Row::Blank);
assert_eq!(row("# comment"), Row::Comment("comment"));
assert_eq!(
row("f1,f2,DIRECT"),
Row::Record(Record {
domain: "f1",
account_id: "f2",
relation: Relation::Direct,
authority_id: None,
})
);
assert_eq!(
row("name=value"),
Row::Variable(Variable {
name: "name",
value: "value",
})
);
assert_eq!(row("unknown"), Row::Unknown("unknown"));
} | rust_cleaned_test_functions.jsonl/95250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
368,
341,
262,
2060,
10714,
10297,
651,
86076,
10801,
486,
22770,
317,
262,
2060,
10714,
10297,
651,
3584,
3980,
3975,
10801,
486,
10677,
445,
6182,
4010,
262,
2060,
10714,
33673,
286,
2802,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parsing_invalid_validator_value_type() {
match read_single_check("checks/tests/test11.json") {
Some(_) => assert!(false),
None => assert!(true),
}
} | rust_cleaned_test_functions.jsonl/80338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
31433,
64959,
3142,
1819,
368,
341,
286,
2432,
1349,
19487,
7200,
445,
49383,
62468,
12697,
16,
16,
4323,
899,
341,
310,
4329,
48139,
589,
2060,
10297,
3849,
1326,
310,
2240,
589,
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
] | 2 |
#[test]
fn test_myers_long_overflow() {
let pattern = b"AAGACGAGAAAAGAAAGTCTAAAGGACTTTTGTGGCAAGACCATCCCTGTTCCCAACCCGACCCCTGGACCTCCCGCCCCGGGCACTCCCGACCCCCCGACCCCCCGACTCCTGGACCAGGAGACTGA";
let text = b"GGCAAGGGGGACTGTAGATGGGTGAAAAGAGCAGTCAGGGACCAGGTCCTCAGCCCCCCAGCCCCCCAGCCCTCCAGGTCCCCAGCCCTCCAGGTCCCCAGCCCAACCCTTGTCCTTACCAGAACGTTGTTTTCAGGAAGTCTGAAAGACAAGAGCAGAAAGTCAGTCCCATGGAATTTTCGCTTCCCACAG".to_vec();
let myers: Myers<u64> = Myers::new(pattern.iter().cloned());
let hits: Vec<_> = myers.find_all_end(text, usize::max_value() - 64).collect();
dbg!(hits);
} | rust_cleaned_test_functions.jsonl/21452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35686,
388,
17799,
79073,
368,
341,
286,
1077,
5383,
284,
293,
29133,
1890,
1706,
38,
1890,
50107,
1890,
6029,
1890,
51,
1162,
6029,
1890,
38,
6823,
14903,
51,
25388,
22254,
5049,
1890,
1706,
2819... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_attempts_for_endpoint_query_parameters_validation() {
let q: ListAttemptsForEndpointQueryParameters =
serde_json::from_value(json!({ "channel": INVALID_CHANNEL })).unwrap();
assert!(q.validate().is_err());
let q: ListAttemptsForEndpointQueryParameters =
serde_json::from_value(json!({ "channel": VALID_CHANNEL })).unwrap();
q.validate().unwrap();
} | rust_cleaned_test_functions.jsonl/64494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
79490,
5478,
36699,
5738,
18263,
19416,
368,
341,
286,
1077,
2804,
25,
1759,
81517,
2461,
27380,
2859,
9706,
4035,
310,
61570,
9455,
486,
1499,
3142,
9304,
0,
2306,
330,
10119,
788,
32269,
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_file_reader_iter_projection_err() {
let schema = "
message spark_schema {
REQUIRED INT32 key;
REQUIRED BOOLEAN value;
}
";
let proj = parse_message_type(&schema).ok();
let path = get_test_path("nested_maps.snappy.parquet");
let reader = SerializedFileReader::try_from(path.as_path()).unwrap();
let res = RowIter::from_file_into(Box::new(reader)).project(proj);
assert!(res.is_err());
assert_eq!(
res.err().unwrap(),
general_err!("Root schema does not contain projection")
);
} | rust_cleaned_test_functions.jsonl/69597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
22306,
11723,
72738,
9266,
368,
341,
286,
1077,
10802,
284,
6228,
414,
1943,
15186,
25371,
341,
286,
66577,
9221,
18,
17,
1376,
280,
286,
66577,
59393,
897,
280,
414,
456,
262,
7620,
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_sum_two_singles() {
assert_eq!(sum_two_singles(1.111111, 1.111111), 2.222222);
} | rust_cleaned_test_functions.jsonl/123618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
23241,
643,
49603,
368,
972,
286,
2060,
10714,
10297,
1242,
23241,
643,
49603,
7,
16,
13,
16,
16,
16,
16,
16,
16,
11,
220,
16,
13,
16,
16,
16,
16,
16,
16,
701,
220,
17,
13,
17,
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 |
#[test]
fn test_reserve() {
let mut map = TypedHandleMap::<u32>::with_capacity(10);
let cap0 = map.capacity();
map.reserve(cap0 + 10);
assert!(map.capacity() >= cap0 + 10);
} | rust_cleaned_test_functions.jsonl/15924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
89591,
368,
341,
286,
1077,
5206,
2415,
284,
50554,
6999,
2227,
27638,
84,
18,
17,
6831,
4197,
35603,
7,
16,
15,
317,
286,
1077,
2062,
15,
284,
2415,
59168,
543,
286,
2415,
48520,
51386,
15,
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 |
#[test]
fn test_rchunks_next() {
let v = [0, 1, 2, 3, 4, 5];
let mut c = v.rchunks(2);
assert_eq!(c.next().unwrap(), &[4, 5]);
assert_eq!(c.next().unwrap(), &[2, 3]);
assert_eq!(c.next().unwrap(), &[0, 1]);
assert_eq!(c.next(), None);
let v = [0, 1, 2, 3, 4, 5, 6, 7];
let mut c = v.rchunks(3);
assert_eq!(c.next().unwrap(), &[5, 6, 7]);
assert_eq!(c.next().unwrap(), &[2, 3, 4]);
assert_eq!(c.next().unwrap(), &[0, 1]);
assert_eq!(c.next(), None);
} | rust_cleaned_test_functions.jsonl/9663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
84263,
11257,
368,
341,
262,
1077,
348,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
272,
284,
348,
1746,
84263,
7,
17,
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_sha_file_existing() {
let mut wiki = Wiki::new();
let input_dir = "tests/example_md/real_md";
assert!(wiki.read_from_directory(input_dir).is_ok());
assert!(wiki.read_content_from_current_paths(input_dir, "html2").is_ok());
let sha_file = Path::new("html2").join(".files.sha");
assert!(sha_file.exists());
assert!(wiki.read_content_from_current_paths(input_dir, "html2").is_ok());
} | rust_cleaned_test_functions.jsonl/117359 | {
"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,
48836,
2458,
62630,
368,
341,
262,
1077,
5206,
28609,
284,
29228,
486,
931,
543,
262,
1077,
1946,
4334,
284,
330,
23841,
65182,
32994,
14,
7951,
32994,
876,
262,
2060,
10297,
29707,
4125,
5673,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_deactivate_device() {
let mut d = TestDevices::default();
let core_a = MockDeviceId(1);
let a = d.add_active_device(core_a, 10).unwrap();
let b = d.add_device(20);
assert_eq!(d.deactivate_device(b).unwrap_err(), ToggleError::NoChange);
assert_eq!(d.deactivate_device(1000).unwrap_err(), ToggleError::NotFound);
let (core, info) = d.deactivate_device(a).unwrap();
assert_eq!(core, core_a);
assert_eq!(info.info, 10);
assert!(info.core_id.is_none());
// both a and b should be inactive now:
assert!(d.active_devices.is_empty());
assert!(d.id_map.is_empty());
} | rust_cleaned_test_functions.jsonl/19848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
16856,
9204,
368,
341,
286,
1077,
5206,
294,
284,
3393,
40835,
486,
2258,
543,
286,
1077,
6200,
4306,
284,
14563,
6985,
764,
7,
16,
317,
286,
1077,
264,
284,
294,
1364,
12930,
9204,
47867,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_enum() {
let value: Animal = super::decode("\"Dog\"").unwrap();
assert_eq!(value, Dog);
let s = "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}";
let value: Animal = super::decode(s).unwrap();
assert_eq!(value, Frog("Henry".into_string(), 349));
} | rust_cleaned_test_functions.jsonl/6556 | {
"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,
15227,
31054,
368,
341,
286,
1077,
897,
25,
21292,
284,
2256,
486,
18196,
38915,
48940,
2105,
1827,
15454,
543,
286,
2060,
10714,
10297,
957,
11,
14254,
626,
286,
1077,
274,
284,
54734,
15969,
234... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_to_opstamp_mapping_none() {
let doc_to_opstamp_mapping = DocToOpstampMapping::None;
assert!(doc_to_opstamp_mapping.is_deleted(1u32, 0u64));
assert!(doc_to_opstamp_mapping.is_deleted(1u32, 2u64));
} | rust_cleaned_test_functions.jsonl/53519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
2346,
10287,
49113,
26930,
31488,
368,
341,
286,
1077,
4629,
2346,
10287,
49113,
26930,
284,
21709,
1249,
7125,
49113,
6807,
486,
4064,
280,
286,
2060,
10297,
5236,
2346,
10287,
49113,
26930,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_boolean_and() {
let variants = [
OperandType::True,
OperandType::False,
OperandType::AllocatedTrue,
OperandType::AllocatedFalse,
OperandType::NegatedAllocatedTrue,
OperandType::NegatedAllocatedFalse
];
for first_operand in variants.iter().cloned() {
for second_operand in variants.iter().cloned() {
let mut cs = TrivialAssembly::<Bn256, PlonkCsWidth4WithNextStepParams, Width4MainGateWithDNext>::new();
let a;
let b;
{
let mut dyn_construct = |operand, name| {
match operand {
OperandType::True => Boolean::constant(true),
OperandType::False => Boolean::constant(false),
OperandType::AllocatedTrue => Boolean::from(AllocatedBit::alloc(&mut cs, Some(true)).unwrap()),
OperandType::AllocatedFalse => Boolean::from(AllocatedBit::alloc(&mut cs, Some(false)).unwrap()),
OperandType::NegatedAllocatedTrue => Boolean::from(AllocatedBit::alloc(&mut cs, Some(true)).unwrap()).not(),
OperandType::NegatedAllocatedFalse => Boolean::from(AllocatedBit::alloc(&mut cs, Some(false)).unwrap()).not(),
}
};
a = dyn_construct(first_operand, "a");
b = dyn_construct(second_operand, "b");
}
let c = Boolean::and(&mut cs, &a, &b).unwrap();
assert!(cs.is_satisfied());
match (first_operand, second_operand, c) {
(OperandType::True, OperandType::True, Boolean::Constant(true)) => {},
(OperandType::True, OperandType::False, Boolean::Constant(false)) => {},
(OperandType::True, OperandType::AllocatedTrue, Boolean::Is(_)) => {},
(OperandType::True, OperandType::AllocatedFalse, Boolean::Is(_)) => {},
(OperandType::True, OperandType::NegatedAllocatedTrue, Boolean::Not(_)) => {},
(OperandType::True, OperandType::NegatedAllocatedFalse, Boolean::Not(_)) => {},
(OperandType::False, OperandType::True, Boolean::Constant(false)) => {},
(OperandType::False, OperandType::False, Boolean::Constant(false)) => {},
(OperandType::False, OperandType::AllocatedTrue, Boolean::Constant(false)) => {},
(OperandType::False, OperandType::AllocatedFalse, Boolean::Constant(false)) => {},
(OperandType::False, OperandType::NegatedAllocatedTrue, Boolean::Constant(false)) => {},
(OperandType::False, OperandType::NegatedAllocatedFalse, Boolean::Constant(false)) => {},
(OperandType::AllocatedTrue, OperandType::True, Boolean::Is(_)) => {},
(OperandType::AllocatedTrue, OperandType::False, Boolean::Constant(false)) => {},
(OperandType::AllocatedTrue, OperandType::AllocatedTrue, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(true));
},
(OperandType::AllocatedTrue, OperandType::AllocatedFalse, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::AllocatedTrue, OperandType::NegatedAllocatedTrue, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::AllocatedTrue, OperandType::NegatedAllocatedFalse, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(true));
},
(OperandType::AllocatedFalse, OperandType::True, Boolean::Is(_)) => {},
(OperandType::AllocatedFalse, OperandType::False, Boolean::Constant(false)) => {},
(OperandType::AllocatedFalse, OperandType::AllocatedTrue, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::AllocatedFalse, OperandType::AllocatedFalse, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::AllocatedFalse, OperandType::NegatedAllocatedTrue, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::AllocatedFalse, OperandType::NegatedAllocatedFalse, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::NegatedAllocatedTrue, OperandType::True, Boolean::Not(_)) => {},
(OperandType::NegatedAllocatedTrue, OperandType::False, Boolean::Constant(false)) => {},
(OperandType::NegatedAllocatedTrue, OperandType::AllocatedTrue, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::NegatedAllocatedTrue, OperandType::AllocatedFalse, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::NegatedAllocatedTrue, OperandType::NegatedAllocatedTrue, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::NegatedAllocatedTrue, OperandType::NegatedAllocatedFalse, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::NegatedAllocatedFalse, OperandType::True, Boolean::Not(_)) => {},
(OperandType::NegatedAllocatedFalse, OperandType::False, Boolean::Constant(false)) => {},
(OperandType::NegatedAllocatedFalse, OperandType::AllocatedTrue, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(true));
},
(OperandType::NegatedAllocatedFalse, OperandType::AllocatedFalse, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::NegatedAllocatedFalse, OperandType::NegatedAllocatedTrue, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(false));
},
(OperandType::NegatedAllocatedFalse, OperandType::NegatedAllocatedFalse, Boolean::Is(ref v)) => {
assert_eq!(v.value, Some(true));
},
_ => {
panic!("unexpected behavior at {:?} AND {:?}", first_operand, second_operand);
}
}
}
}
} | rust_cleaned_test_functions.jsonl/10418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3644
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
8378,
368,
341,
286,
1077,
26012,
284,
2278,
310,
61085,
929,
486,
2514,
345,
310,
61085,
929,
486,
4049,
345,
310,
61085,
929,
486,
25154,
657,
2514,
345,
310,
61085,
929,
486,
25154,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_parse_module_jsx_import_source() {
let specifier = ModuleSpecifier::parse("file:///a/test01.tsx").unwrap();
let result = parse_module(
&specifier,
None,
Arc::new(
r#"
/** @jsxImportSource https://example.com/preact */
export function A() {
return <div>Hello Deno</div>;
}
"#
.to_string(),
),
None,
None,
);
assert!(result.is_ok());
let actual = result.unwrap();
assert_eq!(actual.dependencies.len(), 1);
let dep = actual
.dependencies
.get("https://example.com/preact/jsx-runtime")
.unwrap();
assert!(dep.maybe_code.is_some());
let code_dep = dep.maybe_code.clone().unwrap();
assert!(code_dep.is_ok());
let (dep_specifier, _) = code_dep.unwrap();
assert_eq!(
dep_specifier,
ModuleSpecifier::parse("https://example.com/preact/jsx-runtime").unwrap()
);
assert!(dep.maybe_type.is_none());
assert_eq!(actual.specifier, specifier);
assert_eq!(actual.media_type, MediaType::Tsx);
} | rust_cleaned_test_functions.jsonl/94373 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10750,
26250,
87,
18434,
10347,
368,
341,
262,
1077,
97616,
284,
13711,
87297,
486,
6400,
445,
1192,
60896,
64,
12697,
15,
16,
21288,
87,
1827,
15454,
543,
262,
1077,
1102,
284,
4715,
10750... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serialize_deserialize_regexp() {
let _guard = LOCK.run_concurrently();
let src = Bson::RegularExpression(Regex {
pattern: "1".to_owned(),
options: "2".to_owned(),
});
let dst = vec![14, 0, 0, 0, 11, 107, 101, 121, 0, 49, 0, 50, 0, 0];
let doc = doc! { "key": src };
let mut buf = Vec::new();
doc.to_writer(&mut buf).unwrap();
assert_eq!(buf, dst);
let deserialized = Document::from_reader(&mut Cursor::new(buf)).unwrap();
assert_eq!(deserialized, doc);
} | rust_cleaned_test_functions.jsonl/49144 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
15768,
9050,
4920,
4580,
368,
341,
262,
1077,
716,
26098,
284,
49463,
7634,
3382,
58202,
543,
262,
1077,
2286,
284,
425,
930,
486,
90402,
7,
32464,
341,
286,
5383,
25,
330,
16,
3263,
983,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_custom_pattern() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("maxtract")?;
cmd.arg(common::get_uri()).arg("--regex").arg("child_\\d+");
let expected = "file:///home/josh/CLionProjects/maxtract/tests/pages/child_00.html
├─ child_00
├─ child_10
file:///home/josh/CLionProjects/maxtract/tests/pages/child_01.html
├─ child_01
file:///home/josh/CLionProjects/maxtract/tests/pages/child_10.html
├─ child_10
file:///home/josh/CLionProjects/maxtract/tests/pages/index.html
├─ child_00
├─ child_01\n";
cmd.assert()
.success()
.stdout(predicate::str::similar(expected));
Ok(())
} | rust_cleaned_test_functions.jsonl/67453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15875,
21260,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
5206,
5439,
284,
7348,
486,
66715,
21816,
445,
2810,
2144,
899,
69493,
262,
5439,
21186,
57802,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_build_upload_policy_with_normal_storage() -> Result<(), Box<dyn Error>> {
let policy = UploadPolicyBuilder::new_policy_for_bucket("test_bucket", &Config::default())
.normal_storage()
.build();
assert_eq!(policy.is_normal_storage_used(), true);
assert_eq!(policy.is_infrequent_storage_used(), false);
let v: Value = serde_json::from_str(policy.as_json().as_str())?;
assert_eq!(v["fileType"], json!(null));
Ok(())
} | rust_cleaned_test_functions.jsonl/2354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
21691,
22773,
6615,
13973,
23310,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
4842,
284,
24996,
13825,
3297,
486,
931,
22773,
5478,
38749,
445,
1944,
38749,
497,
609,
264... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_oldest_ancestor() {
// smt0 - smt00 - smt000 - smt0000 - smt00000
// |\ smt001 - smt0010 - smt00100
// | smt0011 - smt00110
// | smt00111
// smt002
let smt0 = SparseMerkleTree::new(LEAF.hash());
let smt00 = update(&smt0);
let smt000 = update(&smt00);
let smt0000 = update(&smt000);
let smt00000 = update(&smt0000);
let smt001 = update(&smt00);
let smt0010 = update(&smt001);
let smt00100 = update(&smt0010);
let smt0011 = update(&smt001);
let smt00110 = update(&smt0011);
let smt00111 = update(&smt0011);
let smt002 = update(&smt00);
assert_eq_pointee(&smt0.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt00.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt000.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt0000.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt00000.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt001.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt0010.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt00100.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt0011.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt00110.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt00111.get_oldest_ancestor(), &smt0);
assert_eq_pointee(&smt002.get_oldest_ancestor(), &smt0);
drop(smt0);
assert_eq_pointee(&smt00.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt000.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt0000.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt00000.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt001.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt0010.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt00100.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt0011.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt00110.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt00111.get_oldest_ancestor(), &smt00);
assert_eq_pointee(&smt002.get_oldest_ancestor(), &smt00);
drop(smt00);
assert_eq_pointee(&smt000.get_oldest_ancestor(), &smt000);
assert_eq_pointee(&smt0000.get_oldest_ancestor(), &smt000);
assert_eq_pointee(&smt00000.get_oldest_ancestor(), &smt000);
assert_eq_pointee(&smt001.get_oldest_ancestor(), &smt001);
assert_eq_pointee(&smt0010.get_oldest_ancestor(), &smt001);
assert_eq_pointee(&smt00100.get_oldest_ancestor(), &smt001);
assert_eq_pointee(&smt0011.get_oldest_ancestor(), &smt001);
assert_eq_pointee(&smt00110.get_oldest_ancestor(), &smt001);
assert_eq_pointee(&smt00111.get_oldest_ancestor(), &smt001);
assert_eq_pointee(&smt002.get_oldest_ancestor(), &smt002);
drop(smt001);
assert_eq_pointee(&smt000.get_oldest_ancestor(), &smt000);
assert_eq_pointee(&smt0000.get_oldest_ancestor(), &smt000);
assert_eq_pointee(&smt00000.get_oldest_ancestor(), &smt000);
assert_eq_pointee(&smt0010.get_oldest_ancestor(), &smt0010);
assert_eq_pointee(&smt00100.get_oldest_ancestor(), &smt0010);
assert_eq_pointee(&smt0011.get_oldest_ancestor(), &smt0011);
assert_eq_pointee(&smt00110.get_oldest_ancestor(), &smt0011);
assert_eq_pointee(&smt00111.get_oldest_ancestor(), &smt0011);
assert_eq_pointee(&smt002.get_oldest_ancestor(), &smt002);
drop(smt000);
assert_eq_pointee(&smt0000.get_oldest_ancestor(), &smt0000);
assert_eq_pointee(&smt00000.get_oldest_ancestor(), &smt0000);
drop(smt0000);
assert_eq_pointee(&smt00000.get_oldest_ancestor(), &smt00000);
drop(smt0010);
assert_eq_pointee(&smt00100.get_oldest_ancestor(), &smt00100);
drop(smt0011);
assert_eq_pointee(&smt00110.get_oldest_ancestor(), &smt00110);
assert_eq_pointee(&smt00111.get_oldest_ancestor(), &smt00111);
} | rust_cleaned_test_functions.jsonl/63261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1886
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
62,
337,
4979,
62,
66878,
368,
341,
262,
442,
1525,
83,
15,
481,
1525,
83,
15,
15,
481,
1525,
83,
15,
15,
15,
481,
1525,
83,
15,
15,
15,
15,
481,
1525,
83,
15,
15,
15,
15,
15,
72... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_device() {
let ua_parser = UserAgentParser::from_path("uap-core/regexes.yaml").unwrap();
let yaml = fs::read_to_string("uap-core/tests/test_device.yaml").unwrap();
let yamls = YamlLoader::load_from_str(&yaml).unwrap();
let yaml = &yamls[0];
let test_cases = yaml
.as_hash()
.unwrap()
.get(&Yaml::String("test_cases".to_string()))
.unwrap()
.as_vec()
.unwrap();
let yaml_user_agent_string = Yaml::String("user_agent_string".to_string());
let yaml_family = Yaml::String("family".to_string());
let yaml_brand = Yaml::String("brand".to_string());
let yaml_model = Yaml::String("model".to_string());
for test_case in test_cases {
let test_case = test_case.as_hash().unwrap();
let user_agent = test_case.get(&yaml_user_agent_string).unwrap().as_str().unwrap();
let name = test_case.get(&yaml_family).unwrap().as_str().map(Cow::from);
let brand = test_case.get(&yaml_brand).unwrap().as_str().map(Cow::from);
let model = test_case.get(&yaml_model).unwrap().as_str().map(Cow::from);
let device = ua_parser.parse_device(user_agent);
assert_eq!(name, device.name);
assert_eq!(brand, device.brand);
assert_eq!(model, device.model);
}
} | rust_cleaned_test_functions.jsonl/111012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 581
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9204,
368,
341,
262,
1077,
45559,
18517,
284,
2657,
16810,
6570,
486,
1499,
2638,
445,
84,
391,
23460,
14,
26387,
288,
33406,
1827,
15454,
1428,
262,
1077,
32246,
284,
8619,
486,
878,
2346,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_encode_decode_tsig() {
test_encode_decode(TSIG::new(
TsigAlgorithm::HmacSha256,
0,
300,
vec![0, 1, 2, 3],
0,
0,
vec![4, 5, 6, 7],
));
test_encode_decode(TSIG::new(
TsigAlgorithm::HmacSha384,
123456789,
60,
vec![9, 8, 7, 6, 5, 4],
1,
2,
vec![],
));
test_encode_decode(TSIG::new(
TsigAlgorithm::Unknown(Name::from_ascii("unkown_algorithm").unwrap()),
123456789,
60,
vec![],
1,
2,
vec![0, 1, 2, 3, 4, 5, 6],
));
} | rust_cleaned_test_functions.jsonl/60097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 510
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
15227,
528,
21339,
368,
341,
286,
1273,
11224,
15227,
4140,
50631,
486,
931,
1006,
310,
350,
21339,
27847,
486,
39,
11948,
62316,
17,
20,
21,
345,
310,
220,
15,
345,
310,
220,
18,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_constraint_two_ident() {
let mut p = Parser::new(r#"A: Addable + Subtractable"#);
let parsed = p.parse_constraints();
let loc = Locator::new(&p.source[..]);
assert_eq!(
parsed,
vec![TypeConstraint {
base: BaseNode {
location: loc.get(1, 1, 1, 26),
..BaseNode::default()
},
tvar: Identifier {
base: BaseNode {
location: loc.get(1, 1, 1, 2),
..BaseNode::default()
},
name: "A".to_string(),
},
kinds: vec![
Identifier {
base: BaseNode {
location: loc.get(1, 4, 1, 11),
..BaseNode::default()
},
name: "Addable".to_string(),
},
Identifier {
base: BaseNode {
location: loc.get(1, 14, 1, 26),
..BaseNode::default()
},
name: "Subtractable".to_string(),
}
]
}],
)
} | rust_cleaned_test_functions.jsonl/67834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 766
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
46973,
23241,
38399,
368,
341,
262,
1077,
5206,
281,
284,
21102,
486,
931,
2601,
55543,
32,
25,
2691,
480,
488,
93210,
480,
57676,
317,
262,
1077,
15676,
284,
281,
4632,
60267,
543,
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_yaw_only() {
let (yaw, pitch) = yaw_and_pitch_from_vector(&Vector3::new(1.0, 0.0, 0.0));
assert_relative_eq!(yaw, f32::pi() / 2.0);
assert_relative_eq!(pitch, 0.0);
let (yaw, pitch) = yaw_and_pitch_from_vector(&Vector3::new(-1.0, 0.0, 0.0));
assert_relative_eq!(yaw, -f32::pi() / 2.0);
assert_relative_eq!(pitch, 0.0);
} | rust_cleaned_test_functions.jsonl/106182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80183,
18410,
368,
341,
286,
1077,
320,
98586,
11,
9649,
8,
284,
45672,
8378,
51959,
5673,
12247,
2099,
3781,
18,
486,
931,
7,
16,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
1106,
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_affine_group() {
let mut rng = test_rng();
let a: EdwardsAffine = rng.gen();
let b: EdwardsAffine = rng.gen();
for _i in 0..100 {
group_test::<EdwardsAffine>(a, b);
}
} | rust_cleaned_test_functions.jsonl/10054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
482,
6288,
368,
341,
262,
1077,
5206,
28422,
284,
1273,
66849,
543,
262,
1077,
264,
25,
36763,
25841,
482,
284,
28422,
22822,
543,
262,
1077,
293,
25,
36763,
25841,
482,
284,
28422,
22822,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_ok_packet() {
const DATA: &[u8] = b"\x00\x00\x00\x02@\x00\x00";
let p = OkPacket::decode(DATA.into()).unwrap();
assert_eq!(p.affected_rows, 0);
assert_eq!(p.last_insert_id, 0);
assert_eq!(p.warnings, 0);
assert!(p.status.contains(Status::SERVER_STATUS_AUTOCOMMIT));
assert!(p.status.contains(Status::SERVER_SESSION_STATE_CHANGED));
} | rust_cleaned_test_functions.jsonl/99058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
19817,
21078,
368,
341,
262,
733,
14112,
25,
44590,
84,
23,
60,
284,
293,
11934,
87,
15,
15,
3462,
15,
15,
3462,
15,
15,
3462,
15,
17,
66339,
87,
15,
15,
3462,
15,
15,
3302,
262,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pubkey_from_slice_bad_context() {
let s = Secp256k1::without_caps();
let sk = SecretKey::new(&mut thread_rng());
assert_eq!(PublicKey::from_secret_key(&s, &sk), Err(IncapableContext));
let s = Secp256k1::with_caps(ContextFlag::VerifyOnly);
assert_eq!(PublicKey::from_secret_key(&s, &sk), Err(IncapableContext));
let s = Secp256k1::with_caps(ContextFlag::SignOnly);
assert!(PublicKey::from_secret_key(&s, &sk).is_ok());
let s = Secp256k1::with_caps(ContextFlag::Full);
assert!(PublicKey::from_secret_key(&s, &sk).is_ok());
} | rust_cleaned_test_functions.jsonl/41394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
792,
5673,
26488,
34199,
8467,
368,
341,
286,
1077,
274,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
28996,
52955,
543,
286,
1077,
1901,
284,
8599,
1592,
486,
931,
2099,
6984,
4516,
66849,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fold_useless_do_1() {
test("do { foo() } while(false);", "foo()");
test("do { foo() } while(void 0);", "foo()");
test("do { foo() } while(undefined);", "foo()");
test("do { foo() } while(true);", "for(;;) foo();");
test("do { var a = 0; } while(false);", "var a=0");
} | rust_cleaned_test_functions.jsonl/378 | {
"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,
61187,
15951,
1717,
26309,
62,
16,
368,
341,
262,
1273,
445,
2982,
314,
15229,
368,
335,
1393,
3576,
1215,
497,
330,
7975,
45961,
262,
1273,
445,
2982,
314,
15229,
368,
335,
1393,
4333,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_crc32() {
if is_x86_feature_detected!("sse4.2") {
unsafe {
let result = crc32_hash(b"hello", 123);
assert_eq!(result, 2927487359);
let result = crc32_hash(b"helloworld", 123);
assert_eq!(result, 314229527);
let result = crc32_hash(b"helloworldparquet", 123);
assert_eq!(result, 667078870);
}
}
} | rust_cleaned_test_functions.jsonl/3347 | {
"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,
59084,
18,
17,
368,
341,
286,
421,
374,
3212,
23,
21,
17069,
98876,
17223,
64513,
19,
13,
17,
899,
341,
310,
19860,
341,
394,
1077,
1102,
284,
37180,
18,
17,
8950,
1883,
1,
14990,
497,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_pull_request_opened() {
let mut test = new_test();
test.handler.event = "pull_request".into();
test.handler.action = "opened".into();
test.handler.data.pull_request = some_pr();
test.handler.data.sender = User::new("the-pr-owner");
test.github.mock_get_pull_request_commits(
"some-user",
"some-repo",
32,
Ok(some_commits()),
);
let attach = vec![
SlackAttachmentBuilder::new("")
.title("Pull Request #32: \"The PR\"")
.title_link("http://the-pr")
.build(),
];
let msg = "Pull Request opened by the.pr.owner";
test.slack.expect(vec![
slack::req(
"the-reviews-channel",
&format!("{} {}", msg, REPO_MSG),
attach.clone()
),
]);
let resp = test.handler.handle_event().unwrap();
assert_eq!((StatusCode::OK, "pr".into()), resp);
} | rust_cleaned_test_functions.jsonl/89638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65693,
7893,
11311,
291,
368,
341,
262,
1077,
5206,
1273,
284,
501,
4452,
543,
262,
1273,
31171,
5773,
284,
330,
23441,
7893,
3263,
18122,
543,
262,
1273,
31171,
12395,
284,
330,
56128,
3263,
1812... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_skipmap_iterator() {
let skm = make_skipmap();
let mut i = 0;
for (k, v) in LdbIteratorIter::wrap(&mut skm.iter()) {
assert!(!k.is_empty());
assert!(!v.is_empty());
i += 1;
}
assert_eq!(i, 26);
} | rust_cleaned_test_functions.jsonl/89157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
2186,
13491,
368,
341,
286,
1077,
1901,
76,
284,
1281,
44830,
2186,
543,
286,
1077,
5206,
600,
284,
220,
15,
401,
286,
369,
320,
74,
11,
348,
8,
304,
444,
1999,
11951,
8537,
486,
10097,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_calculate_code_for_row_and_column() {
assert_eq!(FIRST_CODE, calculate_code_for_row_and_column(1, 1));
assert_eq!(31_916_031, calculate_code_for_row_and_column(2, 1));
assert_eq!(18_749_137, calculate_code_for_row_and_column(1, 2));
assert_eq!(16_080_970, calculate_code_for_row_and_column(3, 1));
assert_eq!(21_629_792, calculate_code_for_row_and_column(2, 2));
assert_eq!(17_289_845, calculate_code_for_row_and_column(1, 3));
} | rust_cleaned_test_functions.jsonl/64658 | {
"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,
24005,
11207,
4136,
5478,
8530,
8378,
8744,
368,
341,
286,
2060,
10714,
10297,
67792,
10020,
11,
11047,
4136,
5478,
8530,
8378,
8744,
7,
16,
11,
220,
16,
1106,
286,
2060,
10714,
10297,
18,
16,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exchange_code_with_400_status_code() {
let body = r#"{"error":"invalid_request","error_description":"Expired code."}"#;
let client = new_client();
let token = client
.exchange_code(AuthorizationCode::new("ccc".to_string()))
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
(AUTHORIZATION, "Basic YWFhOmJiYg=="),
],
"grant_type=authorization_code&code=ccc",
None,
HttpResponse {
status_code: StatusCode::BAD_REQUEST,
headers: vec![(
CONTENT_TYPE,
HeaderValue::from_str("application/json").unwrap(),
)]
.into_iter()
.collect(),
body: body.to_string().into_bytes(),
},
));
assert!(token.is_err());
match token.err().unwrap() {
RequestTokenError::ServerResponse(error_response) => {
assert_eq!(
BasicErrorResponseType::InvalidRequest,
*error_response.error()
);
assert_eq!(
Some(&"Expired code.".to_string()),
error_response.error_description()
);
assert_eq!(None, error_response.error_uri());
}
other => panic!("Unexpected error: {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/18607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
4136,
6615,
62,
19,
15,
15,
4773,
4136,
368,
341,
262,
1077,
2487,
284,
435,
55543,
4913,
841,
3252,
11808,
7893,
2198,
841,
11448,
3252,
54349,
2038,
1189,
9863,
2,
280,
262,
1077,
2943,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_find_succeeding() {
let mut output = String::new();
let method = StringMethod {
method: "find",
variable: "$FOO",
pattern: "\"O\"",
selection: Select::All,
};
method.handle(&mut output, &VariableExpander);
assert_eq!(output, "1");
} | rust_cleaned_test_functions.jsonl/85296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
643,
29264,
287,
368,
341,
286,
1077,
5206,
2550,
284,
923,
486,
931,
543,
286,
1077,
1714,
284,
923,
3523,
341,
310,
1714,
25,
262,
330,
3903,
756,
310,
3890,
25,
220,
5201,
3788,
46,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_remove_comments_empty_multiline() {
let example: Vec<char> = "/**//* */test".to_string().chars().collect();
let result = remove_comments(&example);
let without_comments = chars_to_string(&result.without_comments);
assert_eq!(" test", without_comments);
assert_eq!(1, result.comments.len());
assert_eq!(1, result.comments[0].position);
assert_eq!(" ", chars_to_string(&result.comments[0].text));
} | rust_cleaned_test_functions.jsonl/126904 | {
"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,
18193,
30359,
15124,
26290,
26560,
368,
341,
286,
1077,
3110,
25,
11312,
21919,
29,
284,
3521,
334,
21417,
639,
1944,
3263,
983,
3904,
1005,
19255,
1005,
17384,
543,
286,
1077,
1102,
284,
4057,
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... | 1 |
#[test]
fn test_1() {
#[derive(DeepSizeOf)]
struct Example<'a>(&'a u32, &'a u32);
let number = &42;
let example = Example(number, number);
let size = example.deep_size_of();
// Data past references is not counted
assert_eq!(size, 2 * size_of::<usize>());
} | rust_cleaned_test_functions.jsonl/9196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
368,
341,
286,
11506,
27098,
7,
33464,
1695,
2124,
5563,
286,
2036,
13383,
18291,
64,
44784,
6,
64,
575,
18,
17,
11,
30136,
64,
575,
18,
17,
626,
286,
1077,
1372,
284,
609,
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_request() {
use helix::*;
let req = GetEmoteSetsRequest::builder()
.emote_set_id(vec!["301590448".into()])
.build();
// From twitch docs
let data = br#"
{
"data": [
{
"id": "304456832",
"name": "twitchdevPitchfork",
"images": {
"url_1x": "https://static-cdn.jtvnw.net/emoticons/v2/304456832/static/light/1.0",
"url_2x": "https://static-cdn.jtvnw.net/emoticons/v2/304456832/static/light/2.0",
"url_4x": "https://static-cdn.jtvnw.net/emoticons/v2/304456832/static/light/3.0"
},
"emote_type": "subscriptions",
"emote_set_id": "301590448",
"owner_id": "141981764",
"format": [
"static"
],
"scale": [
"1.0",
"2.0",
"3.0"
],
"theme_mode": [
"light",
"dark"
]
}
],
"template": "https://static-cdn.jtvnw.net/emoticons/v2/{{id}}/{{format}}/{{theme_mode}}/{{scale}}"
}
"#
.to_vec();
let http_response = http::Response::builder().body(data).unwrap();
let uri = req.get_uri().unwrap();
assert_eq!(
uri.to_string(),
"https://api.twitch.tv/helix/chat/emotes/set?emote_set_id=301590448"
);
dbg!(GetEmoteSetsRequest::parse_response(Some(req), &uri, http_response).unwrap());
} | rust_cleaned_test_functions.jsonl/55332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 803
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
262,
990,
11338,
941,
56162,
262,
1077,
4232,
284,
2126,
2269,
1272,
30175,
1900,
486,
17850,
741,
286,
659,
336,
1272,
2602,
842,
25592,
0,
1183,
18,
15,
16,
20,
24,
15,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simple_func() {
let isa = lookup(triple!("x86_64"))
.expect("expect x86 ISA")
.as_builder()
.finish(Flags::new(builder()));
let mut context = Context::for_function(create_function(
CallConv::SystemV,
Some(StackSlotData::new(StackSlotKind::ExplicitSlot, 64)),
));
context.func.collect_frame_layout_info();
context.compile(&*isa).expect("expected compilation");
let mut sink = SimpleUnwindSink(Vec::new(), 0, Vec::new());
emit_fde(&context.func, &*isa, &mut sink);
assert_eq!(
sink.0,
vec![
20, 0, 0, 0, // CIE len
0, 0, 0, 0, // CIE marker
1, // version
0, // augmentation string
1, // code aligment = 1
120, // data alignment = -8
16, // RA = r16
0x0c, 0x07, 0x08,
0x90, 0x01,
0, 0, 0, 0, 0, 0, // padding
36, 0, 0, 0, // FDE len
28, 0, 0, 0, // CIE offset
0, 0, 0, 0, 0, 0, 0, 0, // addr reloc
16, 0, 0, 0, 0, 0, 0, 0, // function length
0x42, // DW_CFA_advance_loc 2
0x0e, 0x10, // DW_CFA_def_cfa_offset 16
0x86, 0x02,
0x43, // DW_CFA_advance_loc 3
0x0d, 0x06, // DW_CFA_def_cfa_register
0x4a, // DW_CFA_advance_loc 10
0x0c, 0x07, 0x08,
0, 0, 0, 0, // padding
0, 0, 0, 0, // End of FDEs
]
);
assert_eq!(sink.1, 24);
assert_eq!(sink.2.len(), 1);
} | rust_cleaned_test_functions.jsonl/103557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1068
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
9596,
368,
341,
286,
1077,
51335,
284,
18615,
7624,
3778,
17223,
87,
23,
21,
62,
21,
19,
5455,
310,
659,
17119,
445,
17119,
856,
23,
21,
84290,
1138,
310,
659,
300,
28532,
741,
310,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inet_aton() {
let cases = vec![
(Datum::Bytes(b"0.0.0.0".to_vec()), Datum::I64(0)),
(
Datum::Bytes(b"255.255.255.255".to_vec()),
Datum::I64(4294967295),
),
(Datum::Bytes(b"127.0.0.1".to_vec()), Datum::I64(2130706433)),
(
Datum::Bytes(b"113.14.22.3".to_vec()),
Datum::I64(1896748547),
),
(Datum::Bytes(b"1".to_vec()), Datum::I64(1)),
(Datum::Bytes(b"0.1.2".to_vec()), Datum::I64(65538)),
(Datum::Bytes(b"0.1.2.3.4".to_vec()), Datum::Null),
(Datum::Bytes(b"0.1.2..3".to_vec()), Datum::Null),
(Datum::Bytes(b".0.1.2.3".to_vec()), Datum::Null),
(Datum::Bytes(b"0.1.2.3.".to_vec()), Datum::Null),
(Datum::Bytes(b"1.-2.3.4".to_vec()), Datum::Null),
(Datum::Bytes(b"".to_vec()), Datum::Null),
(Datum::Bytes(b"0.0.0.256".to_vec()), Datum::Null),
(Datum::Bytes(b"127.0.0,1".to_vec()), Datum::Null),
(Datum::Null, Datum::Null),
];
let mut ctx = EvalContext::default();
for (input, exp) in cases {
let input = datum_expr(input);
let op = scalar_func_expr(ScalarFuncSig::InetAton, &[input]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/75116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 892
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
295,
3752,
263,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
68036,
486,
7078,
1883,
1,
15,
13,
15,
13,
15,
13,
15,
3263,
983,
13251,
11858,
68459,
486,
40,
21,
19,
7,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_filter_normal_code() {
let s = r#"
fn main() {
println!("hello, world");
}
"#;
assert_eq!(s, filter_normal_code(s));
let s_with_line_comment = r#"
fn main() {
// hello, world
println!("hello, world");
}
"#;
assert_eq!(s, filter_normal_code(s_with_line_comment));
let s_with_block_comment = r#"
fn main() {
/* hello, world */
println!("hello, world");
}
"#;
assert_eq!(s, filter_normal_code(s_with_block_comment));
let s_with_multi_line_comment = r#"
fn main() {
/* hello,
* world
*/
println!("hello, world");
}
"#;
assert_eq!(s, filter_normal_code(s_with_multi_line_comment));
} | rust_cleaned_test_functions.jsonl/65549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
13973,
4136,
368,
341,
286,
1077,
274,
284,
435,
2,
698,
8822,
1887,
368,
341,
262,
13751,
17223,
14990,
11,
1879,
797,
532,
57676,
280,
286,
2060,
10714,
10297,
82,
11,
4051,
13973,
4136,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_once_reset() {
let mut spawner = Spawner::once(5.0.into(), true);
spawner.tick(1.0);
spawner.reset();
let count = spawner.tick(1.0);
assert_eq!(count, 5);
} | rust_cleaned_test_functions.jsonl/83393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7630,
18983,
368,
341,
286,
1077,
5206,
978,
67193,
284,
3089,
67193,
486,
13184,
7,
20,
13,
15,
39860,
1507,
830,
317,
286,
978,
67193,
40323,
7,
16,
13,
15,
317,
286,
978,
67193,
13857,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_duplicate_thermal_state_update() {
// expected thermal state
let thermal_load = ThermalLoad(25);
let trip_points = vec![ThermalLoad(50)];
let expected_thermal_state = 0;
let mut exec = fasync::Executor::new().unwrap();
let node = setup_test_node();
// Setup the actor stream with trip_points: [50]
let mut stream = exec
.run_singlethreaded(subscribe_actor(
node.clone(),
fthermal::ActorType::Unspecified,
trip_points,
))
.unwrap();
// There should already be a "state 0" state change event waiting for us
assert_eq!(exec.run_singlethreaded(get_actor_state(&mut stream)), expected_thermal_state);
// Tell the ThermalLimiter that thermal load changed to 25
exec.run_singlethreaded(set_thermal_load(&node, thermal_load));
// change events waiting
assert!(exec.run_until_stalled(&mut stream.next()).is_pending());
} | rust_cleaned_test_functions.jsonl/76810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
70434,
62,
68118,
4387,
8882,
368,
341,
1789,
286,
442,
3601,
28387,
1584,
198,
286,
1077,
28387,
12411,
284,
65626,
5879,
7,
17,
20,
317,
286,
1077,
8411,
12928,
284,
7486,
20703,
1001,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_remove_nested_other() {
use crate::protocol::User;
let mut event = Annotated::new(Event {
user: Annotated::from(User {
other: {
let mut other = Object::new();
other.insert("foo".to_string(), Value::U64(42).into());
other.insert("bar".to_string(), Value::U64(42).into());
other
},
..Default::default()
}),
..Default::default()
});
process_value(
&mut event,
&mut RemoveOtherProcessor,
ProcessingState::root(),
)
.unwrap();
assert!(get_value!(event.user!).other.is_empty());
} | rust_cleaned_test_functions.jsonl/14152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
66279,
30456,
368,
341,
262,
990,
17717,
486,
17014,
486,
1474,
401,
262,
1077,
5206,
1538,
284,
1527,
87029,
486,
931,
30469,
341,
286,
1196,
25,
1527,
87029,
486,
1499,
13087,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_utc_time() {
let mut local_options = LocalOptions::default();
let timestamp = 636253000631621;
local_options.clock = Clock::UTC;
local_options.time_format = "%H:%M:%S %d/%m/%Y".to_string();
let timestamp_utc_formatted = local_options.format_time(timestamp);
let timestamp_utc_struct = chrono::NaiveDateTime::parse_from_str(
×tamp_utc_formatted,
&local_options.time_format,
)
.unwrap();
assert_eq!(
timestamp_utc_struct.format(&local_options.time_format).to_string(),
timestamp_utc_formatted
);
let zero_utc_formatted = local_options.format_time(0);
assert_ne!(zero_utc_formatted, timestamp_utc_formatted);
} | rust_cleaned_test_functions.jsonl/113589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
84259,
3009,
368,
341,
286,
1077,
5206,
2205,
8743,
284,
8774,
3798,
486,
2258,
543,
286,
1077,
11441,
284,
220,
21,
18,
21,
17,
20,
18,
15,
15,
15,
21,
18,
16,
21,
17,
16,
280,
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_origin_point() {
assert!((Point::origin().norm() - 1.).abs() <= EPSILON);
// The point chosen below is about 66km from the north pole towards the East
// origin as far away as possible from the longitudinal edges of large
// Cells. (The line of longitude through the chosen point is always 1/3
// or 2/3 of the way across any Cell with longitudinal edges that it
let p = Point::from_coords(-0.01, 0.01 * st_to_uv(2. / 3.), 1.);
assert!(p.approx_eq(&Point::origin()));
// Check that the origin is not too close to either pole.
const EARTH_RADIUS_KM: f64 = 6371.01;
assert!(Point::origin().0.z.acos() * EARTH_RADIUS_KM > 50.);
} | rust_cleaned_test_functions.jsonl/70553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34043,
6085,
368,
341,
286,
2060,
0,
1188,
2609,
486,
8611,
1005,
20011,
368,
481,
220,
16,
35334,
3435,
368,
2651,
40607,
55016,
626,
286,
442,
576,
1459,
11882,
3685,
374,
911,
220,
21,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type_16() {
let ast = check_parse("type rec = {i64 f};");
check_name(ast.get(0),"rec");
assert_eq!(ast.get(1),&Node::IntType(true,64));
check_name(ast.get(2),"f");
assert_eq!(ast.get(3),&Node::RecordType(vec![(Type(1),Name(2))]));
} | rust_cleaned_test_functions.jsonl/96546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
62,
16,
21,
368,
341,
262,
1077,
11763,
284,
1779,
21039,
445,
1313,
1395,
284,
314,
72,
21,
19,
282,
11061,
797,
262,
1779,
1269,
52574,
670,
7,
15,
35393,
2758,
797,
262,
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_domain_parse_empty_message() {
const PACKET: [u8; 1] = [0];
let mut bv = BufferViewWrapper(&PACKET[..]);
assert_eq!(Domain::parse(&mut bv, None).unwrap_err(), ParseError::UnexpectedZeroCharacter);
} | rust_cleaned_test_functions.jsonl/34446 | {
"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,
20111,
21039,
15124,
6462,
368,
341,
286,
733,
73205,
25,
508,
84,
23,
26,
220,
16,
60,
284,
508,
15,
935,
286,
1077,
5206,
56937,
284,
10312,
851,
11542,
2099,
17279,
1348,
95874,
2558,
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_extension_successful_with_complete_json_response() {
use colorful_extension::*;
let mock = mock("POST", "/token")
.match_header("Accept", "application/json")
.match_body("grant_type=authorization_code&code=ccc&client_id=aaa&client_secret=bbb")
.with_header("content-type", "application/json")
.with_body(
"{\"access_token\": \"12/34\", \"token_type\": \"red\", \"scope\": \"read write\", \
\"expires_in\": 3600, \"refresh_token\": \"foobar\", \"shape\": \"round\", \
\"height\": 12}",
)
.create();
let client = ColorfulClient::new(
ClientId::new("aaa".to_string()),
Some(ClientSecret::new("bbb".to_string())),
AuthUrl::new(Url::parse("http://example.com/auth").unwrap()),
Some(TokenUrl::new(
Url::parse(&(SERVER_URL.to_string() + "/token")).unwrap(),
)),
).set_auth_type(oauth2::AuthType::RequestBody);
let token = client
.exchange_code(AuthorizationCode::new("ccc".to_string()))
.unwrap();
mock.assert();
assert_eq!("12/34", token.access_token().secret());
assert_eq!(ColorfulTokenType::Red, *token.token_type());
assert_eq!(
Some(&vec![
Scope::new("read".to_string()),
Scope::new("write".to_string()),
]),
token.scopes()
);
assert_eq!(3600, token.expires_in().unwrap().as_secs());
assert_eq!("foobar", token.refresh_token().clone().unwrap().secret());
assert_eq!(Some(&"round".to_string()), token.extra_fields().shape());
assert_eq!(12, token.extra_fields().height());
// Ensure that serialization produces an equivalent JSON value.
let serialized_json = serde_json::to_string(&token).unwrap();
assert_eq!(
"{\"access_token\":\"12/34\",\"token_type\":\"red\",\"expires_in\":3600,\
\"refresh_token\":\"foobar\",\"scope\":\"read write\",\"shape\":\"round\",\"height\":12}"
.to_string(),
serialized_json
);
let deserialized_token = ColorfulTokenResponse::from_json(&serialized_json).unwrap();
assert_eq!(token, deserialized_token);
} | rust_cleaned_test_functions.jsonl/12782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 931
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31035,
92951,
6615,
27675,
9455,
9655,
368,
341,
262,
990,
33866,
31035,
79304,
262,
1077,
7860,
284,
7860,
445,
2946,
497,
3521,
5839,
1138,
286,
659,
6347,
8757,
445,
16646,
497,
330,
5132,
8931... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mod_int() {
let tests = vec![
(Some(13), Some(11), Some(2)),
(Some(-13), Some(11), Some(-2)),
(Some(13), Some(-11), Some(2)),
(Some(-13), Some(-11), Some(-2)),
(Some(33), Some(11), Some(0)),
(Some(33), Some(-11), Some(0)),
(Some(-33), Some(-11), Some(0)),
(Some(-11), None, None),
(None, Some(-11), None),
(Some(11), Some(0), None),
(Some(-11), Some(0), None),
(Some(i64::MAX), Some(i64::MIN), Some(i64::MAX)),
(Some(i64::MIN), Some(i64::MAX), Some(-1)),
];
for (lhs, rhs, expected) in tests {
let output = RpnFnScalarEvaluator::new()
.push_param(lhs)
.push_param(rhs)
.evaluate(ScalarFuncSig::ModInt)
.unwrap();
assert_eq!(output, expected, "lhs={:?}, rhs={:?}", lhs, rhs);
}
} | rust_cleaned_test_functions.jsonl/78966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 573
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
4042,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
8373,
7,
16,
18,
701,
4329,
7,
16,
16,
701,
4329,
7,
17,
6965,
310,
320,
8373,
4080,
16,
18,
701,
4329,
7,
16,
16,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_long_format() {
let login = "root";
let pw: Passwd = Passwd::locate(login).unwrap();
let user_info = pw.user_info.unwrap_or_default();
let user_dir = pw.user_dir.unwrap_or_default();
let user_shell = pw.user_shell.unwrap_or_default();
let real_name = user_info.replace('&', &pw.name.capitalize());
let ts = TestScenario::new(util_name!());
ts.ucmd().arg("-l").arg(login).succeeds().stdout_is(format!(
"Login name: {:<28}In real life: {}\nDirectory: {:<29}Shell: {}\n\n",
login, real_name, user_dir, user_shell
));
ts.ucmd()
.arg("-lb")
.arg(login)
.succeeds()
.stdout_is(format!(
"Login name: {:<28}In real life: {1}\n\n",
login, real_name
));
} | rust_cleaned_test_functions.jsonl/85401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
8955,
368,
341,
262,
1077,
5858,
284,
330,
2888,
876,
262,
1077,
26581,
25,
9970,
6377,
284,
9970,
6377,
486,
22401,
31587,
568,
15454,
543,
262,
1077,
1196,
3109,
284,
26581,
3324,
3109,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_not_d() {
let compiled = bitwise::compile_not("D".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b01111011);
} | rust_cleaned_test_functions.jsonl/100595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
7913,
814,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
7913,
445,
35,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
262,
2060,
10714,
10297,
5084... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_prove_pk_prop() {
let secret = DlogProverInput::random();
let pk = secret.public_image();
let tree = ErgoTree::try_from(Expr::Const(pk.into())).unwrap();
let message = vec![0u8; 100];
let prover = TestProver {
secrets: vec![PrivateInput::DlogProverInput(secret)],
};
let res = prover.prove(
&tree,
&Env::empty(),
Rc::new(force_any_val::<Context>()),
message.as_slice(),
&HintsBag::empty(),
);
assert!(res.is_ok());
assert_ne!(res.unwrap().proof, ProofBytes::Empty);
} | rust_cleaned_test_functions.jsonl/3883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2540,
586,
33321,
21663,
368,
341,
286,
1077,
6234,
284,
422,
839,
1336,
423,
2505,
486,
11463,
543,
286,
1077,
22458,
284,
6234,
37899,
4954,
543,
286,
1077,
4916,
284,
73202,
78,
6533,
486,
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_make_absolute_slash_path() {
crate::history::clear();
crate::history::append("gemini://typed-hole.org");
let url = "/foo";
let expected_url = Url::parse("gemini://typed-hole.org/foo").unwrap();
let absolute_url = Gemini {
source: String::from(url),
}
.to_absolute_url()
.unwrap();
assert_eq!(expected_url, absolute_url);
} | rust_cleaned_test_functions.jsonl/49239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
50874,
11886,
988,
2638,
368,
341,
262,
17717,
486,
18844,
486,
7422,
1428,
262,
17717,
486,
18844,
486,
5090,
445,
34103,
6591,
1110,
44181,
86593,
2659,
797,
262,
1077,
2515,
284,
3521,
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_deserialize_signature() {
let s = r#""hvA+XXFEkHk80pLMeIYjNkWy5Ds2ZckSrvj00NvbyFJQe3H9LuJNnu8JLZ/ffIzChs3HmhwPldO0MSmyJAYpCA""#;
let _: Signature = serde_json::from_str(s).unwrap();
} | rust_cleaned_test_functions.jsonl/31930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
39859,
368,
341,
286,
1077,
274,
284,
435,
2,
3014,
81979,
32,
10,
6148,
11419,
74,
39,
74,
23,
15,
79,
43,
7823,
40,
56,
73,
45,
74,
66907,
20,
66950,
17,
57,
377,
50,
10553,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_gc_purged_fork() {
let key = Keypair::new();
let mut index = AccountsIndex::<bool>::default();
let mut gc = Vec::new();
index.insert(0, &key.pubkey(), true, &mut gc);
assert!(gc.is_empty());
index.insert(1, &key.pubkey(), false, &mut gc);
index.insert(2, &key.pubkey(), true, &mut gc);
index.insert(3, &key.pubkey(), true, &mut gc);
index.add_root(0);
index.add_root(1);
index.add_root(3);
index.insert(4, &key.pubkey(), true, &mut gc);
assert_eq!(gc, vec![(0, true), (1, false), (2, true)]);
let ancestors = vec![].into_iter().collect();
assert_eq!(index.get(&key.pubkey(), &ancestors), Some((&true, 3)));
} | rust_cleaned_test_functions.jsonl/44249 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
49423,
620,
324,
3556,
761,
669,
368,
341,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
5206,
1922,
284,
40655,
1552,
27638,
2641,
6831,
2258,
543,
286,
1077,
5206,
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_divide() {
let x = Complex::new(3.0, 4.0);
let y = Complex::new(5.0, 6.0);
let z: Complex = x.divide(&y);
assert_that(39.0 / 61.0, is(close_to(z.get_real(), 1.0e-5)));
assert_that(2.0 / 61.0, is(close_to(z.get_imaginary(), 1.0e-5)));
} | rust_cleaned_test_functions.jsonl/43839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
577,
368,
341,
286,
1077,
856,
284,
22096,
486,
931,
7,
18,
13,
15,
11,
220,
19,
13,
15,
317,
286,
1077,
379,
284,
22096,
486,
931,
7,
20,
13,
15,
11,
220,
21,
13,
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_from_dna_string() {
let dna = "ACGTACGT";
let dna_string = DnaString::from_dna_string(dna);
let values: Vec<u8> = dna_string.iter().collect();
assert_eq!(dna_string.len, 8);
assert_eq!(values, [0, 1, 2, 3, 0, 1, 2, 3]);
let dna_cp = dna_string.to_string();
assert_eq!(dna, dna_cp);
} | rust_cleaned_test_functions.jsonl/95212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
814,
3376,
3904,
368,
341,
286,
1077,
75334,
284,
330,
1706,
25388,
1706,
25388,
876,
286,
1077,
75334,
3904,
284,
422,
3376,
703,
486,
1499,
814,
3376,
3904,
1500,
3376,
317,
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_rotation_look_at_rh_x_axis() {
let direction: Vector3<f64> = Vector3::unit_x();
let up: Vector3<f64> = Vector3::unit_y();
let angle = Degrees(90_f64);
let expected = Rotation3::from_angle_y(angle);
let result = Rotation3::look_at_rh(&direction, &up);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/70529 | {
"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,
44813,
24271,
3752,
1710,
71,
3212,
23567,
368,
341,
286,
1077,
5106,
25,
4196,
18,
63895,
21,
19,
29,
284,
4196,
18,
486,
3843,
3212,
543,
286,
1077,
705,
25,
4196,
18,
63895,
21,
19,
29,
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_subprotocols() {
let sub_proto = test_utils::custom_subprotocol();
let super_proto = test_utils::custom_protocol();
assert!(sub_proto.conforms_to(super_proto));
#[cfg(feature = "malloc")]
assert_eq!(sub_proto.adopted_protocols()[0], super_proto);
} | rust_cleaned_test_functions.jsonl/7129 | {
"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,
5228,
85412,
368,
341,
286,
1077,
1186,
37689,
284,
1273,
17309,
486,
9163,
5228,
17014,
543,
286,
1077,
2256,
37689,
284,
1273,
17309,
486,
9163,
34880,
543,
286,
2060,
10297,
1966,
37689,
2862,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_supplies_buy_misc_insufficient() {
let mut supplies = Supplies::new();
let reason = supplies.buy_misc(1000).unwrap_err().reason;
assert_eq!(BuyErrorType::InsufficientFunds, reason);
assert_eq!(700, supplies.money);
assert_eq!(0, supplies.misc);
} | rust_cleaned_test_functions.jsonl/28670 | {
"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,
23723,
7202,
46348,
69350,
34386,
26683,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
1077,
2874,
284,
16720,
63871,
69350,
7,
16,
15,
15,
15,
568,
15454,
9266,
1005,
19895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iterator_reverse() {
let data = vec![5, 9, 3];
let iterout = vec![3, 5, 9];
let pq = BinaryHeap::from(data);
let v: Vec<_> = pq.iter().rev().cloned().collect();
assert_eq!(v, iterout);
} | rust_cleaned_test_functions.jsonl/83199 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
43277,
368,
341,
262,
1077,
821,
284,
7486,
20703,
20,
11,
220,
24,
11,
220,
18,
935,
262,
1077,
5367,
411,
284,
7486,
20703,
18,
11,
220,
20,
11,
220,
24,
935,
262,
1077,
39639,
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_select_from_values() {
use crate::values;
let expected_sql = "SELECT `vals`.* FROM (VALUES (?,?),(?,?)) AS `vals`";
let values = Table::from(values!((1, 2), (3, 4))).alias("vals");
let query = Select::from_table(values);
let (sql, params) = Sqlite::build(query).unwrap();
assert_eq!(expected_sql, sql);
assert_eq!(
vec![
Value::integer(1),
Value::integer(2),
Value::integer(3),
Value::integer(4),
],
params
);
} | rust_cleaned_test_functions.jsonl/52900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
5673,
9146,
368,
341,
286,
990,
17717,
486,
3661,
401,
286,
1077,
3601,
18063,
284,
330,
4858,
1565,
25596,
63,
4908,
4295,
320,
46089,
63985,
30,
23547,
12622,
30,
593,
5752,
1565,
25596,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_part1_example1() {
let input = r#"
COM)B
B)C
C)D
D)E
E)F
B)G
G)H
D)I
E)J
J)K
K)L
"#;
assert_eq!(part1(&to_lines(input)), 42);
} | rust_cleaned_test_functions.jsonl/90091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
16,
39304,
16,
368,
341,
286,
1077,
1946,
284,
435,
2,
698,
8696,
8,
33,
198,
33,
8,
34,
198,
34,
8,
35,
198,
35,
8,
36,
198,
36,
8,
37,
198,
33,
8,
38,
198,
38,
8,
39,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case2() {
assert_eq!(
Solution::reorder_log_files(vec_string![
"dig1 8 1 5 1",
"let1 art can",
"dig2 3 6",
"let2 own kit dig",
"let3 art zero"
]),
vec_string![
"let1 art can",
"let3 art zero",
"let2 own kit dig",
"dig1 8 1 5 1",
"dig2 3 6"
]
);
} | rust_cleaned_test_functions.jsonl/101191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
17,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
265,
1358,
5224,
10931,
25592,
3904,
90515,
394,
330,
44861,
16,
220,
23,
220,
16,
220,
20,
220,
16,
756,
394,
330,
1149,
16,
194... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index() {
let mut map: TreeMap<int, int> = TreeMap::new();
map.insert(1, 2);
map.insert(2, 1);
map.insert(3, 4);
assert_eq!(map[2], 1);
} | rust_cleaned_test_functions.jsonl/88299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
368,
341,
286,
1077,
5206,
2415,
25,
76883,
4159,
11,
526,
29,
284,
76883,
486,
931,
1428,
286,
2415,
7030,
7,
16,
11,
220,
17,
317,
286,
2415,
7030,
7,
17,
11,
220,
16,
317,
286,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_compact1() {
let cpus = cpu_descriptor_from_socket_size(4, 6);
let mut pool = ResourcePool::new(&ResourceDescriptor::new(cpus, Vec::new()), &[]);
let rq1 = CpuRequest::Compact(4).into();
let al1 = pool.try_allocate_resources(&rq1, None).unwrap();
assert_eq!(pool.get_sockets(&al1).len(), 1);
let al2 = pool.try_allocate_resources(&rq1, None).unwrap();
assert_eq!(pool.get_sockets(&al2).len(), 1);
assert_ne!(pool.get_sockets(&al1), pool.get_sockets(&al2));
let rq2 = CpuRequest::Compact(3).into();
let al3 = pool.try_allocate_resources(&rq2, None).unwrap();
assert_eq!(pool.get_sockets(&al3).len(), 1);
let al4 = pool.try_allocate_resources(&rq2, None).unwrap();
assert_eq!(pool.get_sockets(&al4).len(), 1);
assert_eq!(pool.get_sockets(&al3), pool.get_sockets(&al4));
let rq3 = CpuRequest::Compact(6).into();
let al = pool.try_allocate_resources(&rq3, None).unwrap();
assert_eq!(pool.get_sockets(&al).len(), 1);
pool.release_allocation(al);
let rq3 = CpuRequest::Compact(7).into();
let al = pool.try_allocate_resources(&rq3, None).unwrap();
assert_eq!(pool.get_sockets(&al).len(), 2);
pool.release_allocation(al);
let rq3 = CpuRequest::Compact(8).into();
let al = pool.try_allocate_resources(&rq3, None).unwrap();
assert_eq!(pool.get_sockets(&al).len(), 2);
pool.release_allocation(al);
let rq3 = CpuRequest::Compact(9).into();
let al = pool.try_allocate_resources(&rq3, None).unwrap();
assert_eq!(pool.get_sockets(&al).len(), 3);
pool.release_allocation(al);
} | rust_cleaned_test_functions.jsonl/92225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 815
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15709,
18177,
531,
16,
368,
341,
286,
1077,
12490,
355,
284,
17319,
33774,
5673,
19555,
2368,
7,
19,
11,
220,
21,
317,
286,
1077,
5206,
7314,
284,
11765,
10551,
486,
931,
2099,
4783,
11709,
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_options_builder() {
let mut tu_options = TUOptionsBuilder::new();
assert_eq!(tu_options.build(), CXTranslationUnit_None);
tu_options.detailed_preprocessor_record();
assert_eq!(
tu_options.build(),
CXTranslationUnit_DetailedPreprocessingRecord
);
tu_options.incomplete();
assert_eq!(
tu_options.build(),
CXTranslationUnit_DetailedPreprocessingRecord | CXTranslationUnit_Incomplete
);
tu_options.precompiled_preamble();
assert_eq!(
tu_options.build(),
CXTranslationUnit_DetailedPreprocessingRecord
| CXTranslationUnit_Incomplete
| CXTranslationUnit_PrecompiledPreamble
);
tu_options
.cache_completion_results()
.for_serialization()
.chained_phc()
.skip_function_bodies()
.include_brief_comments_in_code_completion();
assert_eq!(
tu_options.build(),
CXTranslationUnit_DetailedPreprocessingRecord
| CXTranslationUnit_Incomplete
| CXTranslationUnit_PrecompiledPreamble
| CXTranslationUnit_CacheCompletionResults
| CXTranslationUnit_ForSerialization
| CXTranslationUnit_CXXChainedPCH
| CXTranslationUnit_SkipFunctionBodies
| CXTranslationUnit_IncludeBriefCommentsInCodeCompletion
);
} | rust_cleaned_test_functions.jsonl/111703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 733
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8743,
28532,
368,
341,
286,
1077,
5206,
9765,
8743,
284,
69414,
3798,
3297,
486,
931,
543,
286,
2060,
10714,
10297,
24494,
8743,
13239,
1507,
48483,
24412,
4562,
52523,
317,
286,
9765,
8743,
950,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_boolean_array_builder() {
// Test building a boolean array with ArrayData builder and offset
let buf = Buffer::from([27_u8]);
let buf2 = buf.clone();
let data = ArrayData::builder(DataType::Boolean)
.len(5)
.offset(2)
.add_buffer(buf)
.build();
let arr = BooleanArray::from(data);
assert_eq!(buf2, arr.values());
assert_eq!(5, arr.len());
assert_eq!(2, arr.offset());
assert_eq!(0, arr.null_count());
for i in 0..3 {
assert_eq!(i != 0, arr.value(i), "failed at {}", i);
}
} | rust_cleaned_test_functions.jsonl/11603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
3858,
28532,
368,
341,
286,
442,
3393,
4752,
264,
2710,
1334,
448,
2910,
1043,
7363,
323,
4347,
8945,
286,
1077,
6607,
284,
10312,
486,
1499,
2561,
17,
22,
7300,
23,
2558,
286,
1077,
6607... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_grapheme_cursor_chunk_start_require_precontext() {
let s = "\r\n";
let mut c = GraphemeCursor::new(1, s.len(), true);
assert_eq!(c.is_boundary(&s[1..], 1), Err(GraphemeIncomplete::PreContext(1)));
c.provide_context(&s[..1], 0);
assert_eq!(c.is_boundary(&s[1..], 1), Ok(false));
} | rust_cleaned_test_functions.jsonl/121017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14738,
3894,
28601,
30539,
4906,
13793,
10442,
2147,
368,
341,
262,
1077,
274,
284,
2917,
81,
1699,
876,
262,
1077,
5206,
272,
284,
12165,
3894,
14543,
486,
931,
7,
16,
11,
274,
19406,
1507,
830... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fp2_basics() {
assert_eq!(Fp2::new(Fp::zero(), Fp::zero()), Fp2::zero());
assert_eq!(Fp2::new(Fp::one(), Fp::zero()), Fp2::one());
assert!(Fp2::zero().is_zero());
assert!(!Fp2::one().is_zero());
assert!(!Fp2::new(Fp::zero(), Fp::one(),).is_zero());
} | rust_cleaned_test_functions.jsonl/84756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34160,
17,
880,
67981,
368,
341,
286,
2060,
10714,
10297,
37,
79,
17,
486,
931,
7832,
79,
486,
14154,
1507,
434,
79,
486,
14154,
11858,
434,
79,
17,
486,
14154,
1423,
286,
2060,
10714,
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_to_vec() {
let xs: Box<_> = Box::new([1, 2, 3]);
let ys = xs.to_vec();
assert_eq!(ys, [1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/80830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
13251,
368,
341,
262,
1077,
11943,
25,
8261,
32399,
29,
284,
8261,
486,
931,
2561,
16,
11,
220,
17,
11,
220,
18,
2558,
262,
1077,
31810,
284,
11943,
2389,
13251,
543,
262,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.