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_hmac() {
let output = hmac(b"This is a test of HMAC", b"EOSIO");
assert_eq!(
output,
[
0x93, 0xcc, 0xbc, 0x10, 0xc9, 0x80, 0x9b, 0xf8, 0xab, 0xe2, 0x80, 0x61, 0x78, 0x13,
0xe8, 0x1a, 0x71, 0x28, 0xd8, 0xad, 0xb2, 0x15, 0x79, 0xc4, 0x3f, 0x8d, 0x8b, 0x12,
0x73, 0xba, 0x20, 0x47
]
);
} | rust_cleaned_test_functions.jsonl/52026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
11948,
368,
341,
286,
1077,
2550,
284,
83356,
1883,
21520,
374,
264,
1273,
315,
95927,
497,
293,
1,
55940,
3810,
797,
286,
2060,
10714,
33673,
310,
2550,
345,
310,
2278,
394,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_code_block() {
// simple code block
let code_block = "let x=3;";
let expected = "let x = 3;";
assert!(test_format_inner(format_code_block, code_block, expected));
let code_block =
"let (nested_shape, extend) = if !parent_rewrite_contains_newline && is_continuable(&parent) {
(
chain_indent(context, shape.add_offset(parent_rewrite.len())),
context.config.indent_style() == IndentStyle::Visual || is_small_parent,
)
} else if is_block_expr(context, &parent, &parent_rewrite) {
match context.config.indent_style() {
// Try to put the first child on the same line with parent's last line
IndentStyle::Block => (parent_shape.block_indent(context.config.tab_spaces()), true),
// The parent is a block, so align the rest of the chain with the closing
// brace.
IndentStyle::Visual => (parent_shape, false),
}
} else {
(
chain_indent(context, shape.add_offset(parent_rewrite.len())),
false,
)
};
";
let expected =
"let (nested_shape, extend) = if !parent_rewrite_contains_newline && is_continuable(&parent) {
(
chain_indent(context, shape.add_offset(parent_rewrite.len())),
context.config.indent_style() == IndentStyle::Visual || is_small_parent,
)
} else if is_block_expr(context, &parent, &parent_rewrite) {
match context.config.indent_style() {
// Try to put the first child on the same line with parent's last line
IndentStyle::Block => (parent_shape.block_indent(context.config.tab_spaces()), true),
// The parent is a block, so align the rest of the chain with the closing
// brace.
IndentStyle::Visual => (parent_shape, false),
}
} else {
(
chain_indent(context, shape.add_offset(parent_rewrite.len())),
false,
)
};";
assert!(test_format_inner(format_code_block, code_block, expected));
} | rust_cleaned_test_functions.jsonl/6865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 721
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
4136,
7113,
368,
341,
286,
442,
4285,
2038,
2504,
198,
286,
1077,
2038,
7113,
284,
330,
1149,
856,
28,
18,
39678,
286,
1077,
3601,
284,
330,
1149,
856,
284,
220,
18,
39678,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cross() {
//行列式叉乘
assert_eq!(
Vec3::cross(Vec3::new(1.0, 2.0, 3.0), Vec3::new(2.0, 3.0, 4.0)),
Vec3::new(8.0 - 9.0, 6.0 - 4.0, 3.0 - 4.0)
);
} | rust_cleaned_test_functions.jsonl/77352 | {
"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,
35284,
368,
341,
286,
442,
111169,
28330,
102940,
100252,
198,
286,
2060,
10714,
33673,
310,
11312,
18,
486,
28842,
49923,
18,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_f64() {
let value = Value::Float(3.14);
let deserializer = ValueDeserializer::new(&value);
let result: f64 = f64::deserialize(deserializer).unwrap();
assert_eq!(result, 3.14);
} | rust_cleaned_test_functions.jsonl/67378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
761,
21,
19,
368,
341,
286,
1077,
897,
284,
5162,
486,
5442,
7,
18,
13,
16,
19,
317,
286,
1077,
939,
41939,
284,
5162,
80097,
486,
931,
2099,
957,
317,
286,
1077,
1102,
25,
282,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_offending_argument() {
let type_info = dlt::TypeInfo {
kind: dlt::TypeInfoKind::Signed(dlt::TypeLength::BitLength64, true),
coding: dlt::StringCoding::UTF8,
has_variable_info: true,
has_trace_info: false,
};
let argument = dlt::Argument {
type_info,
name: Some("a".to_string()),
unit: Some("a".to_string()),
fixed_point: Some(dlt::FixedPoint {
quantization: 1.0,
offset: dlt::FixedPointValue::I64(1),
}),
value: dlt::Value::I64(-1_246_093_129_526_187_791),
};
let mut argument_bytes = argument.as_bytes::<BigEndian>();
argument_bytes.extend(b"----");
let res: IResult<&[u8], dlt::Argument> = dlt_argument::<BigEndian>(&argument_bytes);
let expected: IResult<&[u8], dlt::Argument> = Ok((b"----", argument));
assert_eq!(expected, res);
} | rust_cleaned_test_functions.jsonl/73184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
13651,
2459,
9025,
368,
341,
286,
1077,
943,
3109,
284,
294,
4832,
486,
45588,
341,
310,
3093,
25,
294,
4832,
486,
45588,
10629,
486,
49312,
1500,
4832,
486,
929,
4373,
486,
8344,
4373,
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_rent_debits() {
let mut rent_debits = RentDebits::default();
// No entry for 0 rewards
rent_debits.insert(&Pubkey::new_unique(), 0, 0);
assert_eq!(rent_debits.0.len(), 0);
// Some that actually work
rent_debits.insert(&Pubkey::new_unique(), 1, 0);
assert_eq!(rent_debits.0.len(), 1);
rent_debits.insert(&Pubkey::new_unique(), i64::MAX as u64, 0);
assert_eq!(rent_debits.0.len(), 2);
} | rust_cleaned_test_functions.jsonl/28996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
2259,
11516,
368,
341,
286,
1077,
5206,
8016,
2259,
11516,
284,
29737,
1912,
11516,
486,
2258,
1428,
286,
442,
2308,
4343,
369,
220,
15,
21160,
198,
286,
8016,
2259,
11516,
7030,
2099,
2916... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_large_memory() {
test_block!(tb, "", {
let mut clear = ClearDiskConfig::new();
let guest = Guest::new(&mut clear);
let mut child = Command::new("target/debug/cloud-hypervisor")
.args(&["--cpus", "1"])
.args(&["--memory", "size=5120M"])
.args(&["--kernel", guest.fw_path.as_str()])
.args(&[
"--disk",
guest
.disk_config
.disk(DiskType::OperatingSystem)
.unwrap()
.as_str(),
guest
.disk_config
.disk(DiskType::CloudInit)
.unwrap()
.as_str(),
])
.args(&["--net", guest.default_net_string().as_str()])
.spawn()
.unwrap();
thread::sleep(std::time::Duration::new(20, 0));
aver!(tb, guest.get_total_memory().unwrap_or_default() > 5_063_000);
guest.ssh_command("sudo reboot")?;
thread::sleep(std::time::Duration::new(10, 0));
let _ = child.kill();
let _ = child.wait();
Ok(())
});
} | rust_cleaned_test_functions.jsonl/55939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45228,
19195,
368,
341,
286,
1273,
7113,
10297,
18387,
11,
7342,
341,
310,
1077,
5206,
2797,
284,
12023,
47583,
2648,
486,
931,
543,
310,
1077,
8640,
284,
26215,
486,
931,
2099,
6984,
2797,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rle_decoder_set_data_range() {
// Buffer containing both repetition and definition levels
let buffer = ByteBufferPtr::new(vec![5, 198, 2, 5, 42, 168, 10, 0, 2, 3, 36, 73]);
let max_rep_level = 1;
let mut decoder = LevelDecoder::v2(max_rep_level);
assert_eq!(decoder.set_data_range(10, &buffer, 0, 3), 3);
let mut result = vec![0; 10];
let num_decoded = decoder.get(&mut result).expect("get() should be OK");
assert_eq!(num_decoded, 10);
assert_eq!(result, vec![0, 1, 1, 0, 0, 0, 1, 1, 0, 1]);
let max_def_level = 2;
let mut decoder = LevelDecoder::v2(max_def_level);
assert_eq!(decoder.set_data_range(10, &buffer, 3, 5), 5);
let mut result = vec![0; 10];
let num_decoded = decoder.get(&mut result).expect("get() should be OK");
assert_eq!(num_decoded, 10);
assert_eq!(result, vec![2, 2, 2, 0, 0, 2, 2, 2, 2, 2]);
} | rust_cleaned_test_functions.jsonl/76399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
273,
49843,
2602,
1769,
9698,
368,
341,
262,
442,
10312,
8482,
2176,
53415,
323,
7271,
5866,
198,
262,
1077,
4147,
284,
50299,
5348,
486,
931,
25592,
20703,
20,
11,
220,
16,
24,
23,
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_match_with_multi() {
let res = expression(Span::new(r"match (X) {y -> z;a -> n}"));
assert!(res.is_ok());
assert!(matches!(res.unwrap().1, Expr::Match(e, _v) if *e == Expr::Ref("X")));
} | rust_cleaned_test_functions.jsonl/32931 | {
"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,
10708,
6615,
25133,
368,
341,
262,
1077,
592,
284,
7493,
3759,
848,
486,
931,
2601,
1,
6347,
320,
55,
8,
314,
88,
1464,
1147,
48222,
1464,
308,
92,
14929,
262,
2060,
10297,
416,
2079,
19817,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unqualified_address_invalid_qualifier() {
let address = gen_random_base58_address();
let invalid_address = format!("pat:sov:{}", address);
let error = unqualified_address_from_address(&invalid_address).unwrap_err();
assert_eq!(ErrorCode::CommonInvalidStructure, error);
} | rust_cleaned_test_functions.jsonl/72546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
36335,
6744,
31433,
64391,
3049,
368,
341,
286,
1077,
2621,
284,
4081,
22644,
7651,
20,
23,
6744,
543,
286,
1077,
8318,
6744,
284,
3561,
17223,
4676,
25,
84293,
25,
42351,
2621,
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_grp2gid() {
if cfg!(target_os = "linux") || cfg!(target_os = "android") || cfg!(target_os = "windows") {
assert_eq!(0, grp2gid("root").unwrap());
} else {
assert_eq!(0, grp2gid("wheel").unwrap());
}
assert!(grp2gid("88_888_888").is_err());
assert!(grp2gid("agroupthatdoesntexist").is_err());
} | rust_cleaned_test_functions.jsonl/26602 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59448,
17,
34849,
368,
341,
286,
421,
13286,
10297,
5657,
29387,
284,
330,
14210,
899,
1369,
13286,
10297,
5657,
29387,
284,
330,
5954,
899,
1369,
13286,
10297,
5657,
29387,
284,
330,
27077,
899,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_accept_encoding_header_is_not_changed_if_set() {
let server = server! {
request: b"\
GET /accept-encoding HTTP/1.1\r\n\
accept-encoding: identity\r\n\
user-agent: $USERAGENT\r\n\
accept: */*\r\n\
host: $HOST\r\n\
\r\n\
",
response: b"\
HTTP/1.1 200 OK\r\n\
Server: test-accept-encoding\r\n\
Content-Length: 0\r\n\
\r\n\
"
};
let client = reqwest::Client::new();
let res = client.get(&format!("http://{}/accept-encoding", server.addr()))
.header(reqwest::header::ACCEPT_ENCODING, reqwest::header::HeaderValue::from_static("identity"))
.send()
.unwrap();
assert_eq!(res.status(), reqwest::StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/101449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35728,
37613,
8757,
6892,
7913,
25213,
11119,
2602,
368,
341,
262,
1077,
3538,
284,
3538,
0,
341,
286,
1681,
25,
293,
83383,
310,
7890,
608,
10330,
12,
17159,
10130,
14,
16,
13,
16,
12016,
1699,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legal_moves_banmen_with_kaku_leave_opponent_area_gote() {
const POSITIONS:[(u32,u32); 2] = [
(2,2),(6,2)
];
let answer:Vec<Vec<((u32,u32),(u32,u32,bool),Option<ObtainKind>)>> = vec![
vec![((2,2),(1,1,true),None),((2,2),(1,1,false),None),
((2,2),(0,0,true),None),((2,2),(0,0,false),None),
((2,2),(3,1,true),None),((2,2),(3,1,false),None),
((2,2),(4,0,true),None),((2,2),(4,0,false),None),
((2,2),(1,3,true),None),((2,2),(1,3,false),None),
((2,2),(0,4,true),None),((2,2),(0,4,false),None),
((2,2),(3,3,true),None),((2,2),(3,3,false),None),
((2,2),(4,4,true),None),((2,2),(4,4,false),None),
((2,2),(5,5,true),None),((2,2),(5,5,false),None),
((2,2),(6,6,true),None),((2,2),(6,6,false),None),
((2,2),(7,7,true),None),((2,2),(7,7,false),None),
((2,2),(8,8,true),None),((2,2),(8,8,false),None),
],
vec![((6,2),(5,1,true),None),((6,2),(5,1,false),None),
((6,2),(4,0,true),None),((6,2),(4,0,false),None),
((6,2),(7,1,true),None),((6,2),(7,1,false),None),
((6,2),(8,0,true),None),((6,2),(8,0,false),None),
((6,2),(5,3,true),None),((6,2),(5,3,false),None),
((6,2),(4,4,true),None),((6,2),(4,4,false),None),
((6,2),(3,5,true),None),((6,2),(3,5,false),None),
((6,2),(2,6,true),None),((6,2),(2,6,false),None),
((6,2),(1,7,true),None),((6,2),(1,7,false),None),
((6,2),(0,8,true),None),((6,2),(0,8,false),None),
((6,2),(7,3,true),None),((6,2),(7,3,false),None),
((6,2),(8,4,true),None),((6,2),(8,4,false),None),
]
];
let blank_banmen = Banmen([[Blank; 9]; 9]);
for (p,answer) in POSITIONS.iter().zip(&answer) {
let answer = answer.into_iter().map(|&m| {
match m {
((sx,sy),(dx,dy,n),o) => {
LegalMove::from(((8-sx,8-sy),(8-dx,8-dy,n),o))
}
}
}).collect::<Vec<LegalMove>>();
let mut banmen = blank_banmen.clone();
banmen.0[8-p.1 as usize][8-p.0 as usize] = GKaku;
assert_eq!(
answer,
Rule::legal_moves_from_banmen(Teban::Gote,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
)
}
} | rust_cleaned_test_functions.jsonl/81122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
4698,
23557,
62666,
10287,
1146,
15030,
1889,
1272,
368,
972,
4777,
26494,
67761,
7259,
7,
84,
18,
17,
36883,
18,
17,
1215,
220,
17,
60,
284,
23637,
197,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_message_descriptor() {
let msg = Foo {
null: ::prost_types::NullValue::NullValue.into(),
timestamp: Some(::prost_types::Timestamp {
seconds: 99,
nanos: 42,
}),
double: None,
float: None,
int64: None,
uint64: None,
int32: None,
uint32: None,
bool: None,
string: None,
bytes: None,
};
assert_eq!(msg.message_name(), "Foo");
assert_eq!(msg.package_name(), "well_known_types");
assert_eq!(msg.type_url(), "type.googleapis.com/well_known_types.Foo");
} | rust_cleaned_test_functions.jsonl/28034 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
33774,
368,
341,
262,
1077,
3750,
284,
33428,
341,
286,
845,
25,
3504,
776,
267,
9763,
486,
3280,
1130,
486,
3280,
1130,
39860,
3148,
286,
11441,
25,
4329,
38732,
776,
267,
9763,
486,
2081... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_round() {
let x: f64 = 2.0 * 270.0;
assert_eq!(crate::round_down_power_of_2(x as u32), 512);
assert_eq!(crate::round_down_power_of_2(538), 512);
assert_eq!(crate::round_down_power_of_2(16), 16);
assert_eq!(crate::round_down_power_of_2(1), 1);
assert_eq!(crate::round_down_power_of_2(0), 0);
} | rust_cleaned_test_functions.jsonl/24665 | {
"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,
29896,
368,
341,
286,
1077,
856,
25,
282,
21,
19,
284,
220,
17,
13,
15,
353,
220,
17,
22,
15,
13,
15,
280,
286,
2060,
10714,
10297,
61711,
486,
1049,
13998,
20421,
3575,
62,
17,
2075,
438,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_suffix() {
let alloc = bumpalo::Bump::new();
let id = prop::PropType(ffi::Str::new_str(&alloc, "Some"));
let id = prop::PropType::add_suffix(&alloc, &id, "Property");
assert_eq!("SomeProperty", id.to_raw_string());
} | rust_cleaned_test_functions.jsonl/55620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
37151,
368,
341,
286,
1077,
5574,
284,
27575,
12529,
486,
33,
1510,
486,
931,
543,
286,
1077,
877,
284,
2004,
486,
2008,
929,
7,
53799,
486,
2580,
486,
931,
2895,
2099,
4742,
11,
330,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_traditional_only_label() {
let input = "abcdefghijklmnopqrstuvwxyz"; // spell-checker:disable-line
new_ucmd!()
.arg("-An")
.arg("--traditional")
.arg("-a")
.arg("-c")
.arg("-")
.arg("10")
.arg("0x10")
.run_piped_stdin(input.as_bytes())
.no_stderr()
.success()
.stdout_is(unindent(
r"
(0000020) i j k l m n o p q r s t u v w x
i j k l m n o p q r s t u v w x
(0000040) y z
y z
(0000042)
",
));
} | rust_cleaned_test_functions.jsonl/48832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
329,
3005,
18410,
6106,
368,
341,
262,
1077,
1946,
284,
330,
67512,
5123,
442,
12845,
15934,
261,
42066,
8447,
198,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
2082,
1138,
286,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_advance_loc_overflow() {
let cie = make_test_cie();
let mut ctx = UnwindContext::new();
ctx.row_mut().start_address = u64::MAX;
let mut expected = ctx.clone();
expected.row_mut().end_address = 42 * cie.code_alignment_factor - 1;
let instructions = [(Ok(true), CallFrameInstruction::AdvanceLoc { delta: 42 })];
assert_eval(ctx, expected, cie, None, instructions);
} | rust_cleaned_test_functions.jsonl/9346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
98093,
13400,
79073,
368,
341,
286,
1077,
272,
645,
284,
1281,
4452,
666,
645,
543,
286,
1077,
5206,
5635,
284,
1230,
19154,
1972,
486,
931,
543,
286,
5635,
11547,
29523,
1005,
2468,
6744,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_partial() {
// Valid
assert_eq!(
read_partial!(b"hello", |r| { r.consume(b"hello") }).unwrap(),
((), input!(b""))
);
assert_eq!(
read_partial!(b"hello", |r| { r.take(5) }).unwrap(),
(input!(b"hello"), input!(b""))
);
assert_eq!(
read_partial!(b"hello", |r| { r.consume(b"hell") }).unwrap(),
((), input!(b"o"))
);
// Invalid
assert_eq!(
read_partial!(b"hello", |r| { r.take(10) })
.unwrap_err()
.to_retry_requirement(),
RetryRequirement::new(5)
);
} | rust_cleaned_test_functions.jsonl/15437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
52068,
368,
341,
262,
442,
7818,
198,
262,
2060,
10714,
33673,
286,
1349,
52068,
10297,
65,
1,
14990,
497,
760,
81,
91,
314,
435,
79424,
1883,
1,
14990,
899,
8533,
15454,
3148,
286,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_close_frame() {
let reason = (CloseCode::Normal, "data");
let frame = Frame::close(Some(reason.into()), false);
let mut v = vec![136u8, 6u8, 3u8, 232u8];
v.extend(b"data");
assert_eq!(frame.0, v.into());
} | rust_cleaned_test_functions.jsonl/55896 | {
"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,
12704,
8929,
368,
341,
286,
1077,
2874,
284,
320,
7925,
2078,
486,
12206,
11,
330,
691,
797,
286,
1077,
4034,
284,
16321,
486,
5552,
65405,
61870,
39860,
11858,
895,
626,
286,
1077,
5206,
348,
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_rwlock_unsized() {
let rw: &RwLock<[i32]> = &RwLock::new([1, 2, 3]);
{
let b = &mut *rw.write().unwrap();
b[0] = 4;
b[2] = 5;
}
let comp: &[i32] = &[4, 2, 5];
assert_eq!(&*rw.read().unwrap(), comp);
} | rust_cleaned_test_functions.jsonl/5884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98850,
4907,
82,
1506,
368,
341,
286,
1077,
25991,
25,
609,
49,
86,
11989,
66746,
72,
18,
17,
25669,
284,
609,
49,
86,
11989,
486,
931,
2561,
16,
11,
220,
17,
11,
220,
18,
2558,
286,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_port() {
let mut r = Reader::new();
r.state = State::Len;
let data = vec![0u8, 0, 0, 3, 9, 0x1A, 0xE1];
test_message(data, Message::Port(6881));
} | rust_cleaned_test_functions.jsonl/46453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
8716,
368,
341,
286,
1077,
5206,
435,
284,
25166,
486,
931,
543,
286,
435,
3467,
284,
3234,
486,
11271,
280,
286,
1077,
821,
284,
7486,
20703,
15,
84,
23,
11,
220,
15,
11,
220,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_four_of_a_kind_beats_full_house() {
test(
&vec!["4S 5H 4D 5D 4H", "3S 3H 2S 3D 3C"],
&vec!["3S 3H 2S 3D 3C"],
)
} | rust_cleaned_test_functions.jsonl/121281 | {
"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,
56142,
3575,
4306,
33162,
21263,
1862,
16372,
64270,
368,
341,
262,
1273,
1006,
286,
609,
4083,
0,
1183,
19,
50,
220,
20,
39,
220,
19,
35,
220,
20,
35,
220,
19,
39,
497,
330,
18,
50,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_best_completed_slot_peer() {
let cs = ClusterSlots::default();
let mut contact_infos = vec![ContactInfo::default(); 2];
for ci in contact_infos.iter_mut() {
ci.id = analog_sdk::pubkey::new_rand();
}
let slot = 9;
// return nothing
assert!(cs
.compute_weights_exclude_nonfrozen(slot, &contact_infos)
.is_empty());
// Give second validator max stake
let validator_stakes: HashMap<_, _> = vec![(
*Arc::new(contact_infos[1].id),
NodeVoteAccounts {
total_stake: std::u64::MAX / 2,
vote_accounts: vec![Pubkey::default()],
},
)]
.into_iter()
.collect();
*cs.validator_stakes.write().unwrap() = Arc::new(validator_stakes);
// max stake
cs.insert_node_id(slot, contact_infos[0].id);
assert_eq!(
cs.compute_weights_exclude_nonfrozen(slot, &contact_infos),
vec![(1, 0)]
);
} | rust_cleaned_test_functions.jsonl/53452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 579
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33101,
49068,
27563,
45159,
368,
341,
286,
1077,
10532,
284,
35380,
51647,
486,
2258,
543,
286,
1077,
5206,
3645,
47779,
284,
7486,
20703,
8732,
1731,
486,
2258,
2129,
220,
17,
935,
286,
369,
1182... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bitfields_fifth() {
let mut date: bindings::bitfields::Fifth = unsafe { mem::zeroed() };
assert!(unsafe { date.assert(0, 0, 0, 0, 0) });
date.byte = 255;
date.set_nWeekDay(6); // saturdays are the best
date.set_nMonthDay(20);
date.set_nMonth(11);
date.set_nYear(95);
assert!(unsafe { date.assert(6, 20, 11, 95, 255) });
} | rust_cleaned_test_functions.jsonl/28002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
9007,
761,
57610,
368,
341,
262,
1077,
5206,
2400,
25,
35700,
486,
4489,
9007,
486,
37,
57610,
284,
19860,
314,
1833,
486,
14154,
291,
368,
3634,
262,
2060,
10297,
38157,
314,
2400,
3713,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keycodes() {
let s = fs::read("examples/keycodes.json").unwrap();
let data: KeyCodes = serde_json::from_slice(&s).unwrap();
assert_eq!(data[&17], KeySymbol("LeftAlt".to_owned()));
} | rust_cleaned_test_functions.jsonl/15047 | {
"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,
3097,
25814,
368,
341,
286,
1077,
274,
284,
8619,
486,
878,
445,
51668,
68864,
25814,
4323,
1827,
15454,
543,
286,
1077,
821,
25,
5309,
20871,
284,
61570,
9455,
486,
1499,
26488,
2099,
82,
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_rng_32_true_values() {
let seed = &[1, 23, 456, 7890, 12345];
let mut ra: IsaacRng = SeedableRng::from_seed(seed);
// Regression test that isaac is actually using the above vector
let v = Vec::from_fn(10, |_| ra.next_u32());
assert_eq!(v,
vec!(2558573138, 873787463, 263499565, 2103644246, 3595684709,
4203127393, 264982119, 2765226902, 2737944514, 3900253796));
let seed = &[12345, 67890, 54321, 9876];
let mut rb: IsaacRng = SeedableRng::from_seed(seed);
// skip forward to the 10000th number
for _ in range(0, 10000) { rb.next_u32(); }
let v = Vec::from_fn(10, |_| rb.next_u32());
assert_eq!(v,
vec!(3676831399, 3183332890, 2834741178, 3854698763, 2717568474,
1576568959, 3507990155, 179069555, 141456972, 2478885421));
} | rust_cleaned_test_functions.jsonl/85142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 488
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66849,
62,
18,
17,
16082,
9146,
368,
341,
286,
1077,
10320,
284,
44590,
16,
11,
220,
17,
18,
11,
220,
19,
20,
21,
11,
220,
22,
23,
24,
15,
11,
220,
16,
17,
18,
19,
20,
935,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_equals() {
env_logger::init();
dotenv::dotenv().unwrap();
let file = std::env::current_dir().unwrap().join("src");
let envs: HashMap<_, _> = std::env::vars().collect();
let output = Command::new("cargo")
.envs(envs)
.arg("expand")
.arg("generated_some_struct")
.output()
.unwrap();
if output.stdout.is_empty() {
panic!("{:#?}", output);
}
let rs = "generated_some_struct.rs";
let temp_dir = file.join("temp");
let _ = remove_dir_all(&temp_dir);
create_dir(&temp_dir).unwrap();
let mut f = File::create(temp_dir.join(rs)).unwrap();
f.write(&output.stdout).unwrap();
let mut source_str = String::new();
File::open(file.join("gen").join(rs))
.unwrap()
.read_to_string(&mut source_str)
.unwrap();
let mut target_str = String::new();
File::open(temp_dir.join(rs))
.unwrap()
.read_to_string(&mut target_str)
.unwrap();
// Remove weird auto indenting when a file is in the module system
let replaced = |s: &str| {
s.replace("\n", "")
.replace("\t", "")
.replace(" ", "")
.trim()
// Needed because else still newlines are shown
.split_whitespace()
.into_iter()
.collect::<Vec<_>>()
.join("")
};
let target_replaced = replaced(&target_str);
let replaced = replaced(&source_str);
if replaced == target_replaced {
} else {
panic!(
"Not equal, target: \n{}\n, replaced: \n{}",
target_replaced, replaced
);
}
} | rust_cleaned_test_functions.jsonl/127925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1006
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61664,
368,
341,
286,
6105,
27413,
486,
2327,
543,
286,
91286,
486,
50893,
1005,
15454,
1428,
286,
1077,
1034,
284,
1460,
486,
3160,
486,
3231,
4334,
1005,
15454,
1005,
5987,
445,
3548,
797,
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... | 3 |
#[test]
fn test_output_types_tracking_hash_different_construction_order() {
let mut v1 = Options::default();
let mut v2 = Options::default();
v1.output_types = OutputTypes::new(&[
(OutputType::Exe, Some(PathBuf::from("./some/thing"))),
(OutputType::Bitcode, Some(PathBuf::from("./some/thing.bc"))),
]);
v2.output_types = OutputTypes::new(&[
(OutputType::Bitcode, Some(PathBuf::from("./some/thing.bc"))),
(OutputType::Exe, Some(PathBuf::from("./some/thing"))),
]);
assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
} | rust_cleaned_test_functions.jsonl/16048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
9763,
66105,
8950,
82741,
3382,
3024,
7869,
368,
341,
262,
1077,
5206,
348,
16,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
348,
17,
284,
14566,
486,
2258,
1428,
262,
348,
16,
13413,
9763... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vcx_credential_serialize() {
settings::set_defaults();
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE,"true");
let handle = credential::credential_create_with_offer("test_vcx_credential_serialize",::utils::constants::CREDENTIAL_OFFER_JSON).unwrap();
assert_eq!(vcx_credential_serialize(0,
handle,
Some(serialize_cb)), error::SUCCESS.code_num);
thread::sleep(Duration::from_millis(200));
} | rust_cleaned_test_functions.jsonl/7545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
666,
30320,
88686,
368,
341,
286,
5003,
486,
746,
42290,
543,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
1335,
1866,
797,
286,
1077,
3705,
284,
40207,
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_contains() {
let rect = Rectangle::new((5.0, 10.0), (20.0, 30.0));
// Contains point in its origin
let p = Point::new(5.0, 10.0);
assert!(rect.contains(p), "{:?}", p);
// Contains point in its bottom right corner
let p = Point::new(25.0, 40.0);
assert!(rect.contains(p), "{:?}", p);
// Contains normal point
let p = Point::new(15.0, 15.0);
assert!(rect.contains(p), "{:?}", p);
// Doesn't contain point with x out of rect
let p = Point::new(30.0, 15.0);
assert!(!rect.contains(p), "{:?}", p);
// Doesn't contain point with y out of rect
let p = Point::new(15.0, 50.0);
assert!(!rect.contains(p), "{:?}", p);
// Doesn't contain point with both x and y out of rect
let p = Point::new(30.0, 40.0);
assert!(!rect.contains(p), "{:?}", p);
} | rust_cleaned_test_functions.jsonl/44165 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
368,
341,
286,
1077,
7608,
284,
19280,
486,
931,
1188,
20,
13,
15,
11,
220,
16,
15,
13,
15,
701,
320,
17,
15,
13,
15,
11,
220,
18,
15,
13,
15,
3237,
286,
442,
30811,
1459,
304,
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_build() {
let b = VMerge::new(VMergeType::Continue).build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:vMerge w:val="continue" />"#
);
} | rust_cleaned_test_functions.jsonl/5257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
368,
341,
286,
1077,
293,
284,
17792,
10080,
486,
931,
7,
11187,
10080,
929,
486,
23526,
568,
5834,
543,
286,
2060,
10714,
33673,
310,
607,
486,
1499,
39453,
23,
2099,
65,
568,
15454,
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 |
#[test]
fn test_seek() -> Result<(), Box<dyn std::error::Error>> {
#[rustfmt::skip]
let data = [
// block 0
0x1f, 0x8b, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x06, 0x00, 0x42, 0x43,
0x02, 0x00, 0x22, 0x00, 0xcb, 0xcb, 0xcf, 0x4f, 0xc9, 0x49, 0x2d, 0x06, 0x00, 0xa1,
0x58, 0x2a, 0x80, 0x07, 0x00, 0x00, 0x00,
// EOF block
0x1f, 0x8b, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x06, 0x00, 0x42, 0x43,
0x02, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
let eof = VirtualPosition::try_from((63, 0))?;
let mut reader = Reader::new(Cursor::new(&data));
let mut buf = Vec::new();
reader.read_to_end(&mut buf)?;
assert_eq!(reader.virtual_position(), eof);
reader.seek(VirtualPosition::try_from((0, 3))?)?;
buf.clear();
reader.read_to_end(&mut buf)?;
assert_eq!(buf, b"dles");
assert_eq!(reader.virtual_position(), eof);
Ok(())
} | rust_cleaned_test_functions.jsonl/46141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 639
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
286,
11506,
35788,
12501,
486,
20599,
921,
286,
1077,
821,
284,
2278,
310,
442,
2504,
220,
15,
198,
310,
220,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_methods() {
use std::default::Default;
common::setup();
#[derive(PolarClass, Clone)]
struct Foo {
#[polar(attribute)]
a: String,
}
#[derive(PolarClass, Debug, Clone)]
struct Bar {
#[polar(attribute)]
b: String,
}
impl Default for Bar {
fn default() -> Self {
Self {
b: "default".to_owned(),
}
}
}
impl Bar {
pub fn bar(&self) -> Bar {
self.clone()
}
pub fn foo(&self) -> Foo {
Foo { a: self.b.clone() }
}
}
let mut test = OsoTest::new();
test.oso.register_class(Foo::get_polar_class()).unwrap();
#[allow(clippy::redundant_closure)]
test.oso
.register_class(
Bar::get_polar_class_builder()
.set_constructor(|| Bar::default())
.add_method("foo", |bar: &Bar| bar.foo())
.add_method("bar", |bar: &Bar| bar.bar())
.add_method("clone", Clone::clone)
.build(),
)
.unwrap();
// Test chaining
test.qvar_one(r#"new Bar().bar().foo().a = x"#, "x", "default".to_string());
// Test trait method.
test.qvar_one(r#"new Bar().clone().b = x"#, "x", "default".to_string());
} | rust_cleaned_test_functions.jsonl/30388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 695
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36084,
368,
341,
262,
990,
1460,
486,
2258,
486,
3675,
401,
262,
4185,
486,
15188,
1428,
262,
11506,
27098,
5304,
7417,
1957,
11,
27913,
5563,
262,
2036,
33428,
341,
286,
11506,
79,
7417,
45407,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aes256ctr() {
let name = &Algorithm::Aes256Ctr;
let k = Bytes::from(vec![0; Cipher::key_length_by_name(name)]);
let iv = Bytes::from(vec![0; Cipher::block_size_by_name(name)]);
let src = BytesMut::from("Hello, world!");
let mut result = src.clone();
Cipher::new_for_encrypt(name, &k, &iv)
.unwrap()
.update(&mut result)
.unwrap();
Cipher::new_for_decrypt(name, &k, &iv)
.unwrap()
.update(&mut result)
.unwrap();
assert_eq!(&src, &result);
} | rust_cleaned_test_functions.jsonl/55459 | {
"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,
90958,
17,
20,
21,
10597,
368,
341,
286,
1077,
829,
284,
609,
27847,
486,
32,
288,
17,
20,
21,
77227,
401,
286,
1077,
595,
284,
30024,
486,
1499,
25592,
20703,
15,
26,
63288,
486,
792,
5118,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_divisible_returns_bool_if_divisible() {
let (x, y) = (5, 3);
let res = is_divisible(&x,&y);
assert_eq!(false, res);
let (x, y) = (12, 6);
let res = is_divisible(&x,&y);
assert_eq!(true, res);
} | rust_cleaned_test_functions.jsonl/103468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
16237,
23066,
58900,
22159,
11119,
16237,
23066,
368,
341,
286,
1077,
320,
87,
11,
379,
8,
284,
320,
20,
11,
220,
18,
317,
286,
1077,
592,
284,
374,
16237,
23066,
2099,
87,
11875,
88,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_concurrency_all() -> anyhow::Result<()> {
let formation = "all=10";
let pf = create_procfile();
pf.set_concurrency(formation);
assert_eq!(pf.data.get("app").unwrap().concurrency.get(), 10);
assert_eq!(pf.data.get("web").unwrap().concurrency.get(), 10);
Ok(())
} | rust_cleaned_test_functions.jsonl/98629 | {
"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,
2602,
3382,
15973,
5705,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
18003,
284,
330,
541,
28,
16,
15,
876,
286,
1077,
27418,
284,
1855,
24436,
1192,
1428,
286,
27418,
980,
3382,
15973,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sizewith (){
let bytes = [0u8; 64];
let data: Data3 = bytes.gread_with(&mut 0, LE).unwrap();
println!("data: {:?}", &data);
} | rust_cleaned_test_functions.jsonl/51395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
449,
97809,
40653,
262,
1077,
5820,
284,
508,
15,
84,
23,
26,
220,
21,
19,
935,
262,
1077,
821,
25,
2885,
18,
284,
5820,
1302,
878,
6615,
2099,
6984,
220,
15,
11,
11148,
568,
15454,
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 |
#[test]
fn test_avro_3452_parsing_name_with_leading_dot_without_namespace() {
init();
let name: Name = serde_json::from_str(r#"{"name": ".a"}"#).unwrap();
assert_eq!(&name.name, "a");
assert_eq!(name.namespace, None);
assert_eq!("a", name.fullname(None));
} | rust_cleaned_test_functions.jsonl/69037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26173,
299,
62,
18,
19,
20,
17,
620,
28598,
1269,
6615,
11751,
2228,
30941,
39904,
41571,
368,
341,
262,
2930,
543,
262,
1077,
829,
25,
3988,
284,
61570,
9455,
486,
1499,
2895,
2601,
55543,
4913... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_param(){
assert_eq!(param(&b"product=eq.134"[..]), IResult::Done(&b""[..],
Param::Condition(Condition{
left: Operand::Column("product".to_string()),
equality: Equality::EQ,
right: Operand::Number(134f64)
}
)));
assert_eq!(param(&b"product=134"[..]), IResult::Done(&b""[..],
Param::Equation(Equation{
left: Operand::Column("product".to_string()),
right: Operand::Number(134f64)
}
)));
} | rust_cleaned_test_functions.jsonl/114304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
3032,
262,
2060,
10714,
10297,
903,
2099,
65,
1,
3031,
28,
11006,
13,
16,
18,
19,
36864,
496,
9719,
358,
2077,
486,
17453,
2099,
65,
3014,
95874,
1125,
715,
286,
6991,
486,
10547,
7,
105... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_range() {
use super::find_range;
assert_eq!((false, 0), find_range(&vec![]));
assert_eq!((false, 1), find_range(&vec![1]));
assert_eq!((true, 2), find_range(&vec![1, 2]));
assert_eq!((true, 3), find_range(&vec![1, 2, 3]));
assert_eq!((true, 3), find_range(&vec![1, 2, 3, 5]));
} | rust_cleaned_test_functions.jsonl/15614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
9698,
368,
341,
286,
990,
2256,
486,
3903,
9698,
401,
286,
2060,
10714,
0,
1188,
3849,
11,
220,
15,
701,
1477,
9698,
2099,
4083,
0,
1294,
1106,
286,
2060,
10714,
0,
1188,
3849,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_trace() {
let _trace: Trace = serde_json::from_str(EXAMPLE_TRACE_CALL).unwrap();
let _trace: Trace = serde_json::from_str(EXAMPLE_TRACE_CREATE).unwrap();
let _trace: Trace = serde_json::from_str(EXAMPLE_TRACE_SUICIDE).unwrap();
let _trace: Trace = serde_json::from_str(EXAMPLE_TRACE_REWARD).unwrap();
} | rust_cleaned_test_functions.jsonl/132891 | {
"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,
15768,
9050,
23575,
368,
341,
286,
1077,
716,
15067,
25,
27163,
284,
61570,
9455,
486,
1499,
2895,
25409,
18918,
24238,
14935,
568,
15454,
543,
286,
1077,
716,
15067,
25,
27163,
284,
61570,
9455,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_body_br_streaming() {
let mut srv = TestServer::new(move || {
h1::H1Service::new(App::new().wrap(Compress::new(ContentEncoding::Br)).service(
web::resource("/").route(web::to(move || {
Response::Ok()
.streaming(once(Ok::<_, Error>(Bytes::from_static(STR.as_ref()))))
})),
))
});
let mut response = srv
.block_on(
srv.get("/")
.header(ACCEPT_ENCODING, "br")
.no_decompress()
.send(),
)
.unwrap();
assert!(response.status().is_success());
// read response
let bytes = srv.block_on(response.body()).unwrap();
// decode br
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
e.write_all(bytes.as_ref()).unwrap();
let dec = e.finish().unwrap();
assert_eq!(Bytes::from(dec), Bytes::from_static(STR.as_ref()));
} | rust_cleaned_test_functions.jsonl/48225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 473
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14114,
17682,
12673,
287,
368,
341,
262,
1077,
5206,
43578,
284,
3393,
5475,
486,
931,
34081,
1369,
341,
286,
305,
16,
486,
39,
16,
1860,
486,
931,
23231,
486,
931,
1005,
10097,
7,
1092,
1873,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_errors(){
init!("false");
let invalid_handle = 478620;
assert_eq!(to_string(invalid_handle).err(), Some(IssuerCredError::CommonError(error::INVALID_OBJ_HANDLE.code_num)));
assert_eq!(release(invalid_handle).err(), Some(IssuerCredError::InvalidHandle()));
} | rust_cleaned_test_functions.jsonl/104603 | {
"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,
20196,
3032,
286,
2930,
17223,
3849,
797,
286,
1077,
8318,
10630,
284,
220,
19,
22,
23,
21,
17,
15,
280,
286,
2060,
10714,
10297,
983,
3904,
5900,
1891,
10630,
568,
615,
1507,
4329,
8972,
778,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trim_and_return_sign() {
let test_cases = [
("-2", -1, "2"),
("3", 1, "3"),
("+5", 1, "5"),
("-", -1, ""),
("-YEAR", -1, "YEAR"),
("YEAR", 1, "YEAR"),
];
for test in test_cases.iter() {
let mut s = tokenize_time_str(test.0).unwrap();
assert_eq!(trim_and_return_sign(&mut s), test.1);
assert_eq!(s.front(), tokenize_time_str(test.2).unwrap().front());
}
} | rust_cleaned_test_functions.jsonl/100321 | {
"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,
70025,
8378,
12511,
11172,
368,
341,
286,
1077,
1273,
41427,
284,
2278,
310,
98670,
17,
497,
481,
16,
11,
330,
17,
4461,
310,
3489,
18,
497,
220,
16,
11,
330,
18,
4461,
310,
3489,
10,
20,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_approx_eq() {
assert!(1.0f32.approx_eq(&1f32));
assert!(0.9999999f32.approx_eq(&1f32));
assert!(1.000001f32.approx_eq_eps(&1f32, &1.0e-5));
assert!(1.0000001f32.approx_eq_eps(&1f32, &1.0e-6));
assert!(!1.0000001f32.approx_eq_eps(&1f32, &1.0e-7));
} | rust_cleaned_test_functions.jsonl/33116 | {
"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,
90425,
10714,
368,
341,
286,
2060,
10297,
16,
13,
15,
69,
18,
17,
1601,
54789,
10714,
2099,
16,
69,
18,
17,
1106,
286,
2060,
10297,
15,
13,
24,
24,
24,
24,
24,
24,
24,
69,
18,
17,
1601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_abort() {
let memory_mapping =
MemoryMapping::new::<UserError>(vec![MemoryRegion::default()], &DEFAULT_CONFIG)
.unwrap();
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
SyscallAbort::call(
&mut SyscallAbort {},
0,
0,
0,
0,
0,
&memory_mapping,
&mut result,
);
result.unwrap();
} | rust_cleaned_test_functions.jsonl/16350 | {
"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,
20344,
6659,
70907,
368,
341,
286,
1077,
4938,
26930,
4035,
310,
13850,
6807,
486,
931,
27638,
1474,
1454,
2235,
4083,
20703,
10642,
14091,
486,
2258,
79558,
609,
17285,
12568,
340,
394,
659,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sub_assign() {
let a = Polynomial::new(coefficients![1f32, 3.0, 3.0, 0.0]);
let b = Polynomial::new(coefficients![1f32, 0.0, 1.0]);
let expected = coefficients![1f32, 2.0, 3.0, -1.0];
// Polynomial -= Polynomial
let mut c = a.clone();
c -= b.clone();
assert_eq!(c.order(), 3);
assert_eq!(c.coeffs(), expected);
let mut c = a.clone();
c -= &b;
assert_eq!(c.order(), 3);
assert_eq!(c.coeffs(), expected);
// Removal of leading zeros
let b = Polynomial::new(coefficients![1f32, 3.0, 3.0, -1.0]);
let mut c = a.clone();
c -= b;
assert_eq!(c.order(), 0);
assert_eq!(c.coeffs(), coefficients![1f32]);
} | rust_cleaned_test_functions.jsonl/106880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
20688,
368,
972,
197,
10217,
264,
284,
75153,
486,
931,
67018,
28142,
20703,
16,
69,
18,
17,
11,
220,
18,
13,
15,
11,
220,
18,
13,
15,
11,
220,
15,
13,
15,
12006,
197,
10217,
293,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator() {
let r1 = IRect::new(10, 10, 12, 14);
let r2 = IRect::new(100, 100, 120, 140);
let mut r = Region::new();
r.set_rects(&[r1, r2]);
let rects: Vec<IRect> = Iterator::new(&r).collect();
assert_eq!(rects.len(), 2);
assert_eq!(rects[0], r1);
assert_eq!(rects[1], r2);
} | rust_cleaned_test_functions.jsonl/41997 | {
"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,
13491,
368,
341,
262,
1077,
435,
16,
284,
358,
4415,
486,
931,
7,
16,
15,
11,
220,
16,
15,
11,
220,
16,
17,
11,
220,
16,
19,
317,
262,
1077,
435,
17,
284,
358,
4415,
486,
931,
7,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vertex2world() {
let layout = Layout::new(Vector::new(13, 2), Vertex::new(2, 0), 10, 10);
let v = Vertex::new(6, 7);
let p = layout.vertex2world(v);
assert_eq!(Point::new(53, 72), p);
} | rust_cleaned_test_functions.jsonl/95167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26611,
17,
14615,
368,
341,
286,
1077,
6789,
284,
13821,
486,
931,
20258,
486,
931,
7,
16,
18,
11,
220,
17,
701,
23225,
486,
931,
7,
17,
11,
220,
15,
701,
220,
16,
15,
11,
220,
16,
15,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_typetoname() {
lazy_static::initialize(&TYPETONAME);
assert_eq!(TYPETONAME.len(), 7);
let ns = TYPETONAME.get("user");
assert!(ns.is_some());
let ns = TYPETONAME.get("ipc");
assert!(ns.is_some());
let ns = TYPETONAME.get("pid");
assert!(ns.is_some());
let ns = TYPETONAME.get("network");
assert!(ns.is_some());
let ns = TYPETONAME.get("mount");
assert!(ns.is_some());
let ns = TYPETONAME.get("uts");
assert!(ns.is_some());
let ns = TYPETONAME.get("cgroup");
assert!(ns.is_some());
} | rust_cleaned_test_functions.jsonl/16615 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42111,
34694,
373,
368,
341,
286,
15678,
25360,
486,
21641,
2099,
51,
9954,
1348,
711,
2729,
317,
286,
2060,
10714,
10297,
51,
9954,
1348,
711,
2729,
19406,
1507,
220,
22,
626,
286,
1077,
12268,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call_reg() {
test_interpreter_and_jit_asm!(
"
mov64 r0, 0x0
mov64 r8, 0x1
lsh64 r8, 0x20
or64 r8, 0x30
callx 0x8
exit
mov64 r0, 0x2A
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 42 } },
8
);
} | rust_cleaned_test_functions.jsonl/59038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
4920,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
21,
19,
435,
15,
11,
220,
15,
87,
15,
198,
286,
1974,
21,
19,
435,
23,
11,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_histogram_vec_local() {
let vec = HistogramVec::new(
HistogramOpts::new("test_histogram_vec_local", "test histogram vec help"),
&["l1", "l2"],
).unwrap();
let mut local_vec = vec.local();
vec.remove_label_values(&["v1", "v2"]).unwrap_err();
local_vec.remove_label_values(&["v1", "v2"]).unwrap_err();
let check = |count, sum| {
let ms = vec.collect()[0].take_metric();
let proto_histogram = ms[0].get_histogram();
assert_eq!(proto_histogram.get_sample_count(), count);
assert!((proto_histogram.get_sample_sum() - sum) < EPSILON);
};
{
// Flush LocalHistogram
let h = local_vec.with_label_values(&["v1", "v2"]);
h.observe(1.0);
h.flush();
check(1, 1.0);
}
{
// Flush LocalHistogramVec
local_vec.with_label_values(&["v1", "v2"]).observe(4.0);
local_vec.flush();
check(2, 5.0);
}
{
local_vec.remove_label_values(&["v1", "v2"]).unwrap();
// Flush on drop
local_vec.with_label_values(&["v1", "v2"]).observe(2.0);
drop(local_vec);
check(1, 2.0);
}
} | rust_cleaned_test_functions.jsonl/4648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68564,
13251,
13564,
368,
341,
286,
1077,
7486,
284,
82138,
10050,
486,
931,
1006,
310,
82138,
43451,
486,
931,
445,
1944,
68564,
13251,
13564,
497,
330,
1944,
30281,
7486,
1492,
4461,
310,
609,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arrays() {
test_array(b"\x80", 0, |_| {}, false);
test_array(b"\x9f\xff", 0, |_| {}, true);
test_array(
b"\x83\x01\x02\x03",
3,
|val| {
assert_pos_number(val.get(0).unwrap(), 1);
assert_pos_number(val.get(1).unwrap(), 2);
assert_pos_number(val.get(2).unwrap(), 3);
},
false,
);
test_array(
b"\x83\x01\x82\x02\x03\x82\x04\x05",
3,
|val| {
assert_pos_number(val.get(0).unwrap(), 1);
match val.get(1).unwrap() {
Value::Array(vec) => {
assert_eq!(2, vec.len());
assert_pos_number(vec.get(0).unwrap(), 2);
}
_ => panic!("expected array"),
}
},
false,
);
test_array(b"\x98\x19\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x18\x18\x19", 25, |val| {
match val[0] {
Value::U64(val) => assert_eq!(val, 1),
_ => panic!("expected u64")
}
match val[24] {
Value::U64(val) => assert_eq!(val, 25),
_ => panic!("expected u64")
}
}, false);
test_array(
b"\x82\x61\x61\xa1\x61\x62\x61\x63",
2,
|val| {
let value = val.get(0).unwrap();
assert_text(value, "a");
let value = val.get(1).unwrap();
match value {
Value::Map(elements) => {
assert_eq!(1, elements.len());
let (key, value) = elements.get(0).unwrap();
assert_text(key, "b");
assert_text(value, "c");
}
_ => panic!("expected map"),
}
},
false,
);
let assertion_1_4_5 = |val: &Vec<Value>| {
let value = val.get(0).unwrap();
assert_pos_number(value, 1);
let value = val.get(2).unwrap();
match value {
Value::Array(elements) => {
assert_eq!(2, elements.len());
let value = elements.get(0).unwrap();
assert_pos_number(value, 4);
let value = elements.get(1).unwrap();
assert_pos_number(value, 5);
}
_ => panic!("expected array"),
}
};
test_array(
b"\x9f\x01\x82\x02\x03\x9f\x04\x05\xff\xff",
3,
assertion_1_4_5,
true,
);
test_array(
b"\x83\x01\x82\x02\x03\x9f\x04\x05\xff",
3,
assertion_1_4_5,
true,
);
test_array(
b"\x83\x01\x9f\x02\x03\xff\x82\x04\x05",
3,
assertion_1_4_5,
true,
);
test_array(b"\x9f\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x18\x18\x19\xff", 25, |val| {
assert_pos_number(val.get(0).unwrap(), 1);
assert_pos_number(val.get(24).unwrap(), 25);
}, true);
test_array(
b"\x82\x61\x61\xbf\x61\x62\x61\x63\xff",
2,
|val| {
let value = val.get(0).unwrap();
assert_text(value, "a");
let value = val.get(1).unwrap();
match value {
Value::Map(elements) => {
let (k, v) = elements.get(0).unwrap();
assert_text(k, "b");
assert_text(v, "c");
}
_ => panic!("expected map"),
}
},
true,
);
} | rust_cleaned_test_functions.jsonl/62590 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68983,
368,
341,
262,
1273,
3858,
1883,
11934,
87,
23,
15,
497,
220,
15,
11,
66091,
16452,
895,
317,
262,
1273,
3858,
1883,
11934,
87,
24,
69,
86977,
497,
220,
15,
11,
66091,
16452,
830,
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... | 7 |
#[test]
fn test_find_font() {
Font::find("dejavu sans", None).unwrap().print_debug();
Font::find("dejavu sans", Some("oblique")).unwrap().print_debug();
} | rust_cleaned_test_functions.jsonl/81064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
17451,
368,
341,
262,
9562,
486,
3903,
445,
450,
61459,
84,
15510,
497,
2240,
568,
15454,
1005,
1350,
15446,
543,
262,
9562,
486,
3903,
445,
450,
61459,
84,
15510,
497,
4329,
445,
674,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_encode_integer() {
assert_eq!(encode_integer(10, 5), [10]);
assert_eq!(encode_integer(1337, 5), [31, 154, 10]);
assert_eq!(encode_integer(127, 7), [127, 0]);
assert_eq!(encode_integer(255, 8), [255, 0]);
assert_eq!(encode_integer(254, 8), [254]);
assert_eq!(encode_integer(1, 8), [1]);
assert_eq!(encode_integer(0, 8), [0]);
assert_eq!(encode_integer(255, 7), [127, 128, 1]);
} | rust_cleaned_test_functions.jsonl/121972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
31725,
368,
341,
286,
2060,
10714,
10297,
6180,
31725,
7,
16,
15,
11,
220,
20,
701,
508,
16,
15,
2558,
286,
2060,
10714,
10297,
6180,
31725,
7,
16,
18,
18,
22,
11,
220,
20,
701,
508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_d_vs_ratio() {
use backend::serial::u32::field::FieldElement2625;
let a = -&FieldElement2625([121665,0,0,0,0,0,0,0,0,0]);
let b = FieldElement2625([121666,0,0,0,0,0,0,0,0,0]);
let d = &a * &b.invert();
let d2 = &d + &d;
assert_eq!(d, constants::EDWARDS_D);
assert_eq!(d2, constants::EDWARDS_D2);
} | rust_cleaned_test_functions.jsonl/126091 | {
"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,
814,
42434,
19917,
368,
341,
286,
990,
19163,
486,
10182,
486,
84,
18,
17,
486,
2566,
486,
1877,
1691,
17,
21,
17,
20,
280,
286,
1077,
264,
284,
481,
5,
1877,
1691,
17,
21,
17,
20,
2561,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cookie_samesite_lax_string_is_added() {
let cookie = CookieOptions {
cookie_name: "".to_string(),
cookie_value: None,
max_age: None,
domain: None,
path: None,
secure: false,
http_only: false,
same_site: Some(SameSiteCookieOption::Lax),
};
assert_eq!(cookie.to_string(), "=; SameSite=Lax");
} | rust_cleaned_test_functions.jsonl/101603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38663,
643,
971,
632,
907,
706,
3904,
6892,
37653,
368,
341,
286,
1077,
12544,
284,
24356,
3798,
341,
310,
12544,
1269,
25,
44907,
983,
3904,
3148,
310,
12544,
3142,
25,
2240,
345,
310,
1932,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stream_orderer_bytes_ready() {
let mut rx_ord = RxStreamOrderer::new();
let mut buf = vec![0u8; 100];
rx_ord.inbound_frame(0, vec![1; 6]).unwrap();
assert_eq!(rx_ord.bytes_ready(), 6);
assert_eq!(rx_ord.buffered(), 6);
assert_eq!(rx_ord.retired(), 0);
// read some so there's an offset into the first frame
rx_ord.read(&mut buf[..2]).unwrap();
assert_eq!(rx_ord.bytes_ready(), 4);
assert_eq!(rx_ord.buffered(), 4);
assert_eq!(rx_ord.retired(), 2);
// an overlapping frame
rx_ord.inbound_frame(5, vec![2; 6]).unwrap();
assert_eq!(rx_ord.bytes_ready(), 9);
assert_eq!(rx_ord.buffered(), 9);
assert_eq!(rx_ord.retired(), 2);
// a noncontig frame
rx_ord.inbound_frame(20, vec![3; 6]).unwrap();
assert_eq!(rx_ord.bytes_ready(), 9);
assert_eq!(rx_ord.buffered(), 15);
assert_eq!(rx_ord.retired(), 2);
// an old frame
rx_ord.inbound_frame(0, vec![4; 2]).unwrap();
assert_eq!(rx_ord.bytes_ready(), 9);
assert_eq!(rx_ord.buffered(), 15);
assert_eq!(rx_ord.retired(), 2);
} | rust_cleaned_test_functions.jsonl/22972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 609
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
7869,
261,
12524,
35456,
368,
341,
286,
1077,
5206,
19111,
67324,
284,
35376,
3027,
4431,
261,
486,
931,
1428,
286,
1077,
5206,
6607,
284,
7486,
20703,
15,
84,
23,
26,
220,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gelf_decoder() {
let msg = r#"{"version":"1.1", "host": "example.org","short_message": "A short message that helps you identify what is going on", "full_message": "Backtrace here\n\nmore stuff", "timestamp": 1385053862.3072, "level": 1, "_user_id": 9001, "_some_info": "foo", "_some_env_var": "bar"}"#;
let res = GelfDecoder.decode(msg).unwrap();
assert!(res.ts == 1_385_053_862.307_2);
assert!(res.hostname == "example.org");
assert!(res.msg.unwrap() == "A short message that helps you identify what is going on");
assert!(res.full_msg.unwrap() == "Backtrace here\n\nmore stuff");
assert!(res.severity.unwrap() == 1);
let sd = res.sd.unwrap();
let pairs = sd.pairs;
assert!(pairs
.iter()
.cloned()
.any(|(k, v)| if let SDValue::U64(v) = v {
k == "_user_id" && v == 9001
} else {
false
}));
assert!(pairs
.iter()
.cloned()
.any(|(k, v)| if let SDValue::String(v) = v {
k == "_some_info" && v == "foo"
} else {
false
}));
assert!(pairs
.iter()
.cloned()
.any(|(k, v)| if let SDValue::String(v) = v {
k == "_some_env_var" && v == "bar"
} else {
false
}));
} | rust_cleaned_test_functions.jsonl/7190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
490,
49843,
368,
341,
286,
1077,
3750,
284,
435,
55543,
4913,
4366,
3252,
16,
13,
16,
497,
330,
3790,
788,
330,
8687,
2659,
2198,
8676,
6462,
788,
330,
32,
2805,
1943,
429,
8609,
498,
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... | 7 |
#[test]
fn test_sort_rules() {
// Test sort rule by mocking ExternalIsSubSpecializer and ExternalIsa.
let bar_rule = GenericRule::new(
sym!("bar"),
vec![
Arc::new(rule!("bar", ["_"; instance!("b"), "_"; instance!("a"), value!(3)])),
Arc::new(rule!("bar", ["_"; instance!("a"), "_"; instance!("a"), value!(1)])),
Arc::new(rule!("bar", ["_"; instance!("a"), "_"; instance!("b"), value!(2)])),
Arc::new(rule!("bar", ["_"; instance!("b"), "_"; instance!("b"), value!(4)])),
],
);
let mut kb = KnowledgeBase::new();
kb.add_generic_rule(bar_rule);
let external_instance = Value::ExternalInstance(ExternalInstance {
instance_id: 1,
constructor: None,
repr: None,
});
let mut vm = PolarVirtualMachine::new_test(
Arc::new(RwLock::new(kb)),
false,
vec![query!(call!(
"bar",
[external_instance.clone(), external_instance, sym!("z")]
))],
);
let mut results = Vec::new();
loop {
match vm.run(None).unwrap() {
QueryEvent::Done { .. } => break,
QueryEvent::Result { bindings, .. } => results.push(bindings),
QueryEvent::ExternalIsSubSpecializer {
call_id,
left_class_tag,
right_class_tag,
..
} => {
// For this test we sort classes lexically.
vm.external_question_result(call_id, left_class_tag < right_class_tag)
.unwrap()
}
QueryEvent::MakeExternal { .. } => (),
QueryEvent::ExternalOp {
operator: Operator::Eq,
call_id,
..
} => vm.external_question_result(call_id, true).unwrap(),
QueryEvent::ExternalIsa { call_id, .. } => {
vm.external_question_result(call_id, true).unwrap()
}
_ => panic!("Unexpected event"),
}
}
assert_eq!(results.len(), 4);
assert_eq!(
results,
vec![
hashmap! {sym!("z") => term!(1)},
hashmap! {sym!("z") => term!(2)},
hashmap! {sym!("z") => term!(3)},
hashmap! {sym!("z") => term!(4)},
]
);
} | rust_cleaned_test_functions.jsonl/18518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
21407,
368,
341,
286,
442,
3393,
3378,
5912,
553,
66483,
30936,
3872,
3136,
20366,
3135,
323,
30936,
3872,
64,
624,
286,
1077,
3619,
21124,
284,
21281,
11337,
486,
931,
1006,
310,
7886,
172... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inflate() {
let b = Box3D::from_points(&[point3(-20.0, -20.0, -20.0), point3(20.0, 20.0, 20.0)]);
let b = b.inflate(10.0, 5.0, 2.0);
assert!(b.size().width == 60.0);
assert!(b.size().height == 50.0);
assert!(b.size().depth == 44.0);
assert!(b.center() == Point3D::zero());
} | rust_cleaned_test_functions.jsonl/7495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
16716,
368,
341,
286,
1077,
293,
284,
8261,
18,
35,
486,
1499,
12928,
2099,
58,
2768,
18,
4080,
17,
15,
13,
15,
11,
481,
17,
15,
13,
15,
11,
481,
17,
15,
13,
15,
701,
1459,
18,
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_routing_all_regions() {
let route = RouteBuilder::new().platform(Platform::Pc).build();
assert_eq!(route.path(), api!("/leaderboard/pc/all"));
} | rust_cleaned_test_functions.jsonl/55384 | {
"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,
97710,
5705,
58035,
368,
341,
286,
1077,
6021,
284,
9572,
3297,
486,
931,
1005,
15734,
7,
17296,
486,
47,
66,
568,
5834,
1428,
286,
2060,
10714,
10297,
8966,
3875,
1507,
6330,
0,
4283,
37391,
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 |
#[test]
fn test_build_config() {
let config: ClusterConfig =
ClusterConfig::builder(semver::Version::parse("0.7.0-alpha.1").unwrap())
.build()
.expect("should succeed with required config options");
assert_eq!(
config.platform_version,
semver::Version::parse("0.7.0-alpha.1").unwrap()
)
} | rust_cleaned_test_functions.jsonl/17928 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
5332,
368,
341,
286,
1077,
2193,
25,
35380,
2648,
4035,
310,
35380,
2648,
486,
17850,
83058,
423,
486,
5637,
486,
6400,
445,
15,
13,
22,
13,
15,
64538,
13,
16,
1827,
15454,
2398,
394,
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_recovery() {
let slot = 1;
let (data_shreds, coding_shreds, leader_schedule_cache) =
setup_erasure_shreds(slot, 0, 100, 1.0);
let blocktree_path = get_tmp_ledger_path!();
{
let blocktree = Blocktree::open(&blocktree_path).unwrap();
blocktree
.insert_shreds(coding_shreds, Some(&leader_schedule_cache), false)
.unwrap();
let shred_bufs: Vec<_> = data_shreds
.iter()
.map(|shred| shred.payload.clone())
.collect();
// Check all the data shreds were recovered
for (s, buf) in data_shreds.iter().zip(shred_bufs) {
assert_eq!(
blocktree
.get_data_shred(s.slot(), s.index() as u64)
.unwrap()
.unwrap(),
buf
);
}
verify_index_integrity(&blocktree, slot);
}
Blocktree::destroy(&blocktree_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/116912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91475,
368,
341,
286,
1077,
9446,
284,
220,
16,
280,
286,
1077,
320,
691,
3712,
53369,
11,
10822,
3712,
53369,
11,
7653,
34530,
11529,
8,
4035,
310,
6505,
80604,
3970,
3712,
53369,
43724,
11,
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... | 2 |
#[test]
fn test_ancestor_iterator() {
let blockstore_path = get_tmp_ledger_path!();
let blockstore = Blockstore::open(&blockstore_path).unwrap();
blockstore.set_roots(std::iter::once(&0)).unwrap();
let ticks_per_slot = 5;
/*
Build a blockstore in the ledger with the following fork structure:
slot 0
|
slot 1
/ \
slot 2 |
/ |
slot 3 |
|
slot 4
*/
let last_entry_hash = Hash::default();
let fork_point = 1;
let mut fork_hash = Hash::default();
for slot in 0..=3 {
let parent = {
if slot == 0 {
0
} else {
slot - 1
}
};
let last_entry_hash = fill_blockstore_slot_with_ticks(
&blockstore,
ticks_per_slot,
slot,
parent,
last_entry_hash,
);
if slot == fork_point {
fork_hash = last_entry_hash;
}
}
let _ =
fill_blockstore_slot_with_ticks(&blockstore, ticks_per_slot, 4, fork_point, fork_hash);
// Test correctness
assert!(AncestorIterator::new(0, &blockstore).next().is_none());
assert_eq!(
AncestorIterator::new(4, &blockstore).collect::<Vec<Slot>>(),
vec![1, 0]
);
assert_eq!(
AncestorIterator::new(3, &blockstore).collect::<Vec<Slot>>(),
vec![2, 1, 0]
);
} | rust_cleaned_test_functions.jsonl/44653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1010
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
66878,
13491,
368,
341,
286,
1077,
2504,
4314,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
2099,
4574,
4314,
2638,
568,
15454,
543,
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... | 4 |
#[test]
fn test_compress_fail() {
new_ucmd!()
.args(&[
"ext_sort.txt",
"-n",
"--compress-program",
"nonexistent-program",
"-S",
"10",
])
.fails()
.stderr_only("sort: couldn't execute compress program: errno 2");
} | rust_cleaned_test_functions.jsonl/131627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87845,
22121,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
9640,
310,
330,
427,
18435,
3909,
756,
310,
6523,
77,
756,
310,
14482,
38360,
66020,
756,
310,
330,
6280,
64085,
6602... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_struct() -> Result<()> {
#[derive(Debug, PartialEq, Deserialize)]
struct S {
spam: Vec<String>,
}
let input = "d4:spaml1:a1:bee";
let s: S = from_slice(input.as_bytes())?;
let expected = S {
spam: vec!["a".into(), "b".into()],
};
assert_eq!(s, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/120779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
15126,
368,
1464,
5714,
71698,
341,
286,
11506,
27098,
42618,
11,
55039,
11,
48440,
5563,
286,
2036,
328,
341,
310,
25328,
25,
11312,
3464,
12520,
286,
555,
286,
1077,
1946,
284,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_query_https() {
use rustls::{ClientConfig, ProtocolVersion, RootCertStore};
use trust_dns_https::HttpsClientStreamBuilder;
let mut io_loop = Runtime::new().unwrap();
let addr: SocketAddr = ("1.1.1.1", 443).to_socket_addrs().unwrap().next().unwrap();
// using the mozilla default root store
let mut root_store = RootCertStore::empty();
root_store.add_server_trust_anchors(&self::webpki_roots::TLS_SERVER_ROOTS);
let versions = vec![ProtocolVersion::TLSv1_2];
let mut client_config = ClientConfig::new();
client_config.root_store = root_store;
client_config.versions = versions;
let https_builder = HttpsClientStreamBuilder::with_client_config(client_config);
let (bg, mut client) =
ClientFuture::connect(https_builder.build(addr, "cloudflare-dns.com".to_string()));
io_loop.spawn(bg);
// TODO: timeouts on these requests so that the test doesn't hang
io_loop.block_on(test_query(&mut client)).unwrap();
io_loop.block_on(test_query(&mut client)).unwrap();
} | rust_cleaned_test_functions.jsonl/33934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
26817,
368,
341,
262,
990,
23071,
4730,
22964,
2959,
2648,
11,
24572,
5637,
11,
18854,
36934,
6093,
2440,
262,
990,
6950,
71125,
26817,
486,
92869,
2959,
3027,
3297,
401,
262,
1077,
5206,
63... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_single_byte() {
assert!(!BIG5.is_single_byte());
assert!(!EUC_JP.is_single_byte());
assert!(!EUC_KR.is_single_byte());
assert!(!GB18030.is_single_byte());
assert!(!GBK.is_single_byte());
assert!(!REPLACEMENT.is_single_byte());
assert!(!SHIFT_JIS.is_single_byte());
assert!(!UTF_8.is_single_byte());
assert!(!UTF_16BE.is_single_byte());
assert!(!UTF_16LE.is_single_byte());
assert!(!ISO_2022_JP.is_single_byte());
assert!(IBM866.is_single_byte());
assert!(ISO_8859_2.is_single_byte());
assert!(ISO_8859_3.is_single_byte());
assert!(ISO_8859_4.is_single_byte());
assert!(ISO_8859_5.is_single_byte());
assert!(ISO_8859_6.is_single_byte());
assert!(ISO_8859_7.is_single_byte());
assert!(ISO_8859_8.is_single_byte());
assert!(ISO_8859_10.is_single_byte());
assert!(ISO_8859_13.is_single_byte());
assert!(ISO_8859_14.is_single_byte());
assert!(ISO_8859_15.is_single_byte());
assert!(ISO_8859_16.is_single_byte());
assert!(ISO_8859_8_I.is_single_byte());
assert!(KOI8_R.is_single_byte());
assert!(KOI8_U.is_single_byte());
assert!(MACINTOSH.is_single_byte());
assert!(WINDOWS_874.is_single_byte());
assert!(WINDOWS_1250.is_single_byte());
assert!(WINDOWS_1251.is_single_byte());
assert!(WINDOWS_1252.is_single_byte());
assert!(WINDOWS_1253.is_single_byte());
assert!(WINDOWS_1254.is_single_byte());
assert!(WINDOWS_1255.is_single_byte());
assert!(WINDOWS_1256.is_single_byte());
assert!(WINDOWS_1257.is_single_byte());
assert!(WINDOWS_1258.is_single_byte());
assert!(X_MAC_CYRILLIC.is_single_byte());
assert!(X_USER_DEFINED.is_single_byte());
} | rust_cleaned_test_functions.jsonl/90285 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 951
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
19487,
19737,
368,
341,
286,
2060,
0,
3471,
67017,
20,
2079,
19487,
19737,
1423,
286,
2060,
0,
3471,
36,
5459,
10598,
47,
2079,
19487,
19737,
1423,
286,
2060,
0,
3471,
36,
5459,
10102,
49,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_val() {
assert_line!(read_val, "trr-int 100", FbVal::TrrInt(100), print);
assert_line!(read_val, "ack sli", FbVal::Ack(FbAckParam::Sli(None)), print);
assert_line!(read_val, "ack sli 5432", FbVal::Ack(FbAckParam::Sli(Some("5432".into()))), print);
assert_line!(read_val, "nack rpsi", FbVal::Nack(FbNackParam::Rpsi), print);
assert_line!(read_val, "goog-remb", FbVal:: RtcpFbId{id: "goog-remb".into(), param: None}, print);
assert_line!(read_val, "ccm", FbVal:: RtcpFbId{id: "ccm".into(), param: None}, print);
assert_line!(read_val, "ccm fir", FbVal:: RtcpFbId{id: "ccm".into(), param: Some(FbParam::Single("fir".into()))}, print);
assert_line!(read_val, "fb foo bar", FbVal:: RtcpFbId{id: "fb".into(), param: Some(FbParam::Pair("foo".into(), "bar".into()))}, print);
} | rust_cleaned_test_functions.jsonl/50390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
6189,
368,
341,
262,
2060,
6528,
10297,
878,
6189,
11,
330,
376,
81,
20052,
220,
16,
15,
15,
497,
434,
65,
2208,
486,
51,
634,
1072,
7,
16,
15,
15,
701,
1173,
317,
262,
2060,
6528,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_name_and_age() {
let p: Person = Person::from(",");
assert_eq!(p.name, "John");
assert_eq!(p.age, 30);
} | rust_cleaned_test_functions.jsonl/1616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
1269,
8378,
32053,
368,
341,
286,
1077,
281,
25,
7357,
284,
7357,
486,
1499,
46649,
286,
2060,
10714,
10297,
79,
2644,
11,
330,
13079,
797,
286,
2060,
10714,
10297,
79,
30810,
11,
220,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_inversion() {
let a = Fp([
0x43b4_3a50_78ac_2076,
0x1ce0_7630_46f8_962b,
0x724a_5276_486d_735c,
0x6f05_c2a6_282d_48fd,
0x2095_bd5b_b4ca_9331,
0x03b3_5b38_94b0_f7da,
]);
let b = Fp([
0x69ec_d704_0952_148f,
0x985c_cc20_2219_0f55,
0xe19b_ba36_a9ad_2f41,
0x19bb_16c9_5219_dbd8,
0x14dc_acfd_fb47_8693,
0x115f_f58a_fff9_a8e1,
]);
assert_eq!(a.invert().unwrap(), b);
assert!(bool::from(Fp::zero().invert().is_none()));
} | rust_cleaned_test_functions.jsonl/23236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
4366,
368,
341,
262,
1077,
264,
284,
434,
79,
8956,
286,
220,
15,
87,
19,
18,
65,
19,
62,
18,
64,
20,
15,
62,
22,
23,
580,
62,
17,
15,
22,
21,
345,
286,
220,
15,
87,
16,
346,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_heartbeat_ignore_participant() {
let mut protocol = Protocol::new(get_default_fl_settings());
let client_id = ClientId::new();
let resp = protocol.heartbeat(client_id, ClientState::Ignored);
assert_eq!(HeartBeatResponse::StandBy, resp);
assert_eq!(
protocol.next_event().unwrap(),
Event::ResetHeartBeat(client_id)
);
assert!(protocol.next_event().is_none());
} | rust_cleaned_test_functions.jsonl/97775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
72471,
58493,
10495,
21757,
368,
341,
286,
1077,
5206,
11507,
284,
24572,
486,
931,
5433,
9993,
5081,
10853,
1423,
286,
1077,
2943,
842,
284,
8423,
764,
486,
931,
1428,
286,
1077,
9039,
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_preprocess() {
let (display, exec) = preprocess(
r#"
# import "array"
#
#
< array.from(rows:[{_value:"a"}])
> |> map(fn: (r) => ({r with _value: "b"}))
"#,
)
.unwrap();
let want_display = expect![[r#"
```flux
array.from(rows: [{_value: "a"}])
|> map(fn: (r) => ({r with _value: "b"}))
```"#]];
want_display.assert_eq(display.as_str());
let want_exec = expect![[r#"
import "array"
array.from(rows: [{_value: "a"}])
|> yield(name: "input")
|> map(fn: (r) => ({r with _value: "b"}))
|> yield(name: "output")"#]];
want_exec.assert_eq(exec.as_str());
} | rust_cleaned_test_functions.jsonl/30694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
4630,
368,
341,
286,
1077,
320,
5493,
11,
3883,
8,
284,
53465,
1006,
310,
435,
2,
698,
2,
1159,
330,
1653,
698,
4956,
4956,
27,
1334,
6387,
31911,
7259,
87657,
957,
2974,
64,
9207,
2546... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_from_scid() {
assert_eq!(block_from_scid(&0x000000_000000_0000), 0);
assert_eq!(block_from_scid(&0x000001_000000_0000), 1);
assert_eq!(block_from_scid(&0x000001_ffffff_ffff), 1);
assert_eq!(block_from_scid(&0x800000_ffffff_ffff), 0x800000);
assert_eq!(block_from_scid(&0xffffff_ffffff_ffff), 0xffffff);
} | rust_cleaned_test_functions.jsonl/5992 | {
"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,
7113,
5673,
13171,
307,
368,
341,
197,
6948,
10714,
10297,
4574,
5673,
13171,
307,
2099,
15,
87,
15,
15,
15,
15,
15,
15,
62,
15,
15,
15,
15,
15,
15,
62,
15,
15,
15,
15,
701,
220,
15,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul_carry_assign_binary()
{
let mut d = BinaryDigit(0u8);
let carry = d.mul_carry_assign(BinaryDigit(0x47), BinaryDigit(0xff));
assert_eq!(d, BinaryDigit(0xff));
assert_eq!(carry, BinaryDigit(0));
let mut d = BinaryDigit(0x13u8);
let carry = d.mul_carry_assign(BinaryDigit(0), BinaryDigit(0xff));
assert_eq!(d, BinaryDigit(0xff));
assert_eq!(carry, BinaryDigit(0));
let mut d = BinaryDigit(0x13u8);
let carry = d.mul_carry_assign(BinaryDigit(0x47), BinaryDigit(0xff));
assert_eq!(d, BinaryDigit(0x44));
assert_eq!(carry, BinaryDigit(0x06));
let mut d = BinaryDigit(0xffu8);
let carry = d.mul_carry_assign(BinaryDigit(0xff), BinaryDigit(0xff));
assert_eq!(d, BinaryDigit(0));
assert_eq!(carry, BinaryDigit(0xff));
let mut d = BinaryDigit(0u16);
let carry = d.mul_carry_assign(BinaryDigit(0x472a), BinaryDigit(0xffff));
assert_eq!(d, BinaryDigit(0xffff));
assert_eq!(carry, BinaryDigit(0));
let mut d = BinaryDigit(0x13f2u16);
let carry = d.mul_carry_assign(BinaryDigit(0), BinaryDigit(0xffff));
assert_eq!(d, BinaryDigit(0xffff));
assert_eq!(carry, BinaryDigit(0));
let mut d = BinaryDigit(0x13f2u16);
let carry = d.mul_carry_assign(BinaryDigit(0x472a), BinaryDigit(0xffff));
assert_eq!(d, BinaryDigit(0x63b3));
assert_eq!(carry, BinaryDigit(0x058c));
let mut d = BinaryDigit(0xffffu16);
let carry = d.mul_carry_assign(BinaryDigit(0xffff), BinaryDigit(0xffff));
assert_eq!(d, BinaryDigit(0));
assert_eq!(carry, BinaryDigit(0xffff));
let mut d = BinaryDigit(0u32);
let carry = d.mul_carry_assign(BinaryDigit(0x472a16ff), BinaryDigit(0xffffffff));
assert_eq!(d, BinaryDigit(0xffffffff));
assert_eq!(carry, BinaryDigit(0));
let mut d = BinaryDigit(0x13f2aa87u32);
let carry = d.mul_carry_assign(BinaryDigit(0), BinaryDigit(0xffffffff));
assert_eq!(d, BinaryDigit(0xffffffff));
assert_eq!(carry, BinaryDigit(0));
let mut d = BinaryDigit(0x13f2aa87u32);
let carry = d.mul_carry_assign(BinaryDigit(0x472a16ff), BinaryDigit(0xffffffff));
assert_eq!(d, BinaryDigit(0x24857678));
assert_eq!(carry, BinaryDigit(0x058b94e7));
let mut d = BinaryDigit(0xffffffffu32);
let carry = d.mul_carry_assign(BinaryDigit(0xffffffff), BinaryDigit(0xffffffff));
assert_eq!(d, BinaryDigit(0));
assert_eq!(carry, BinaryDigit(0xffffffff));
} | rust_cleaned_test_functions.jsonl/26397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
666,
11433,
20688,
31761,
741,
262,
341,
286,
1077,
5206,
294,
284,
17718,
36420,
7,
15,
84,
23,
317,
286,
1077,
6777,
284,
294,
53141,
666,
11433,
20688,
77833,
36420,
7,
15,
87,
19,
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_some() {
assert_eq!(eval("Some(())"), Value::Option(Some(Box::new(Value::Unit))));
assert_eq!(
eval("Some ( () )"),
Value::Option(Some(Box::new(Value::Unit)))
);
} | rust_cleaned_test_functions.jsonl/32624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61855,
368,
341,
286,
2060,
10714,
10297,
14170,
445,
8373,
7,
2140,
3975,
5162,
486,
5341,
65405,
67758,
486,
931,
25346,
486,
4562,
38776,
286,
2060,
10714,
33673,
310,
5603,
445,
8373,
220,
320... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_sqs_create_queue() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sqs-create-queue.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SqsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = CreateQueueRequest::default();
let result = client.create_queue(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/49934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
643,
26358,
8657,
10841,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
82,
26358,
39679,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_gt_scalar() {
cmp_i64_scalar!(
gt_scalar,
vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
8,
vec![false, false, false, true, true, false, false, false, true, true]
);
} | rust_cleaned_test_functions.jsonl/36027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
37479,
41652,
368,
341,
286,
26089,
5318,
21,
19,
41652,
33673,
310,
25161,
41652,
345,
310,
7486,
20703,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
11,
220,
16,
15,
11,
220,
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_reset() {
let mut block_tree = create_block_tree();
block_tree.reset(id(100));
assert!(block_tree.id_to_block.is_empty());
assert!(block_tree.heads.is_empty());
assert_eq!(block_tree.last_committed_id, id(100));
} | rust_cleaned_test_functions.jsonl/87740 | {
"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,
18983,
368,
341,
262,
1077,
5206,
2504,
11663,
284,
1855,
7113,
11663,
543,
262,
2504,
11663,
13857,
3724,
7,
16,
15,
15,
1106,
262,
2060,
10297,
4574,
11663,
1764,
2346,
7113,
2079,
15124,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_meta() {
check(
r#"
macro_rules! m {
($m:meta) => ( #[$m] fn bar() {} )
}
m! { cfg(target_os = "windows") }
m! { hello::world }
"#,
expect![[r##"
macro_rules! m {
($m:meta) => ( #[$m] fn bar() {} )
}
#[cfg(target_os = "windows")] fn bar() {}
#[hello::world] fn bar() {}
"##]],
);
} | rust_cleaned_test_functions.jsonl/85234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13381,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
341,
262,
1711,
76,
25,
5490,
8,
589,
320,
671,
3442,
76,
60,
5168,
3619,
368,
4687,
1727,
532,
76,
0,
314,
13286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binding() {
expect_printed("let a = b", "let a = b;\n");
expect_printed("let {} = b", "let {} = b;\n");
expect_printed("let { a } = b", "let { a } = b;\n");
expect_printed("let { a = c } = b", "let { a = c } = b;\n");
expect_printed("let { a, b } = c", "let { a,\nb } = c;\n");
expect_printed("let { ...a } = b", "let { ...a } = b;\n");
expect_printed(
"let { a: { b: [...a] } } = b",
"let { a: { b: [...a] } } = b;\n",
);
expect_printed(
"let { undefined: { null: { 3000: a } } } = b",
"let { undefined: { null: { 3000: a } } } = b;\n",
);
expect_printed("let [] = b", "let [] = b;\n");
expect_printed("let [a] = b", "let [a] = b;\n");
expect_printed("let [...[...[a]]] = b", "let [...[...[a]]] = b;\n");
expect_printed("let { a, b, c } = b", "let { a,\nb,\nc } = b;\n");
} | rust_cleaned_test_functions.jsonl/93414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 432
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60815,
368,
341,
262,
1720,
10064,
291,
445,
1149,
264,
284,
293,
497,
330,
1149,
264,
284,
293,
17882,
77,
797,
262,
1720,
10064,
291,
445,
1149,
4687,
284,
293,
497,
330,
1149,
4687,
284,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_word_that_results_in_fewest_remaining_possible_words() {
let game = Wordle::with(English);
let word = WordThatResultsInFewestRemainingSolutions.pick(&game);
// Worst:
// - 701.8 jazzy
// - 723.5 fluff
// - 728.0 fizzy
// - 734.7 jiffy
// - 735.8 civic
// - 777.8 puppy
// - 781.7 mamma
// - 815.4 vivid
// - 820.7 mummy
// - 855.7 fuzzy
// Best:
// - 71.57 slate
// - 71.29 stare
// - 71.10 snare
// - 70.22 later
// - 70.13 saner
// - 69.99 alter
// - 66.02 arose
// - 63.78 irate
// - 63.73 arise
// - 61.00 raise
assert_eq!(word.unwrap().to_string(), "raise");
} | rust_cleaned_test_functions.jsonl/57278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13533,
70197,
13576,
1243,
761,
365,
477,
59244,
71244,
18981,
368,
341,
262,
1077,
1809,
284,
9322,
273,
486,
4197,
7,
22574,
626,
262,
1077,
3409,
284,
9322,
4792,
9801,
641,
71104,
477,
54745,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_weighted_always_fire() {
let trigger = PeriodicTrigger::new(20);
for _ in 0..10 {
assert!(trigger.weighted_event(20));
}
} | rust_cleaned_test_functions.jsonl/63854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15876,
291,
8418,
2284,
45772,
368,
341,
262,
1077,
8183,
284,
25492,
292,
17939,
486,
931,
7,
17,
15,
626,
262,
369,
716,
304,
220,
15,
496,
16,
15,
341,
286,
2060,
10297,
18468,
25152,
291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reverse_path_no_close() {
let mut builder = Path::builder();
builder.move_to(point(0.0, 0.0));
builder.line_to(point(1.0, 0.0));
builder.line_to(point(1.0, 1.0));
let p1 = builder.build();
let mut builder = Path::builder();
reverse_path(p1.as_slice(), &mut builder);
let p2 = builder.build();
let mut it = p2.iter();
assert_eq!(it.next(), Some(PathEvent::MoveTo(point(1.0, 1.0))));
assert_eq!(it.next(), Some(PathEvent::Line(LineSegment { from: point(1.0, 1.0), to: point(1.0, 0.0) })));
assert_eq!(it.next(), Some(PathEvent::Line(LineSegment { from: point(1.0, 0.0), to: point(0.0, 0.0) })));
assert_eq!(it.next(), None);
} | rust_cleaned_test_functions.jsonl/19890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43277,
2638,
6536,
12704,
368,
341,
262,
1077,
5206,
7363,
284,
7933,
486,
17850,
543,
262,
7363,
13635,
2346,
20235,
7,
15,
13,
15,
11,
220,
15,
13,
15,
1106,
262,
7363,
10932,
2346,
20235,
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_paragraph() {
let art = r#"
This is some sort of a paragraph
with long words such as supercalifragilisticexpialiducios
and pneumonoultramicrospocisilicovulcanoconiosis
"#;
let cell_buffer = CellBuffer::from(art);
let mut spans: Vec<Span> = cell_buffer.group_adjacents();
assert_eq!(spans.len(), 1);
let span1 = spans.remove(0);
let groups = span1.get_contacts(&Settings::default());
for (i, group) in groups.iter().enumerate() {
println!("group{}\n{}", i, group);
}
assert_eq!(15, groups.len());
assert_eq!(
groups[0],
Contacts::new(CellText::new(Cell::new(0, 0), "This".to_string()).into())
);
assert_eq!(
groups[5],
Contacts::new(CellText::new(Cell::new(21, 0), "a".to_string()).into())
);
assert_eq!(
groups[14],
Contacts::new(
CellText::new(
Cell::new(4, 2),
"pneumonoultramicrospocisilicovulcanoconiosis".to_string()
)
.into()
)
);
} | rust_cleaned_test_functions.jsonl/16305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 650
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96713,
368,
341,
286,
1077,
1947,
284,
435,
2,
698,
286,
1096,
374,
1045,
3378,
315,
264,
14311,
198,
286,
448,
1293,
4244,
1741,
438,
2256,
5416,
333,
4101,
321,
4532,
4580,
530,
307,
1754,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_manually_not_send_actor()
{
let mut exec = LocalPool::default();
let exec2 = exec.clone();
let program = async move
{
// of spawn_local.
let actor = SumNoSend(5);
let mb = Inbox::new( Some( "SumNoSend".into() ) );
let mut addr = Addr::new( mb.sender() );
exec2.spawn_local( mb.start_fut_local( actor ) ).expect( "spawn actor mailbox" );
addr.send( Add( 10 ) ).await.expect( "Send failed" );
let result = addr.call( Show{} ).await.expect( "Call failed" );
assert_eq!( 15, result );
};
exec.spawn_local( program ).expect( "spawn program" );
exec.run();
} | rust_cleaned_test_functions.jsonl/4307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17062,
1832,
7913,
13565,
54818,
741,
515,
10217,
5206,
3883,
220,
284,
8774,
10551,
486,
2258,
543,
10217,
3883,
17,
284,
3883,
15997,
1428,
10217,
2025,
284,
3312,
3271,
198,
197,
515,
2394,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_item() {
parse_macro(
r#"
macro_rules! foo {
($ i:item) => (
$ i
)
}
"#,
)
.assert_expand_items("foo! {mod c {}}", "mod c {}");
} | rust_cleaned_test_functions.jsonl/28738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
5634,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
600,
78852,
8,
589,
2399,
394,
400,
600,
198,
310,
1727,
286,
456,
57676,
345,
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_build_url_create() {
let url_builder = ElasticsearchUrlBuilder::new("http://server".to_string(), "INDEX_NAME".to_string());
assert_that(&url_builder.create("die id".to_string()))
.is_equal_to("http://server/INDEX_NAME/_doc/die+id/_create?refresh=true".to_string());
} | rust_cleaned_test_functions.jsonl/35092 | {
"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,
20801,
2903,
8657,
368,
341,
220,
1077,
2515,
28532,
284,
58887,
2864,
3297,
486,
931,
445,
1254,
1110,
4030,
3263,
983,
3904,
1507,
330,
44331,
4708,
3263,
983,
3904,
5231,
220,
2060,
70197,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pair() {
for rank in Rank::ALL.iter().copied() {
for (suit1, suit2) in Suit::ALL.iter().copied().tuple_combinations() {
let card1 = Card { rank, suit: suit1 };
let card2 = Card { rank, suit: suit2 };
let kicker_ranks = Rank::ALL.iter().copied().filter(|x| *x != rank).take(3);
let kickers = kicker_ranks
.zip(repeat(Hearts))
.map(|(rank, suit)| Card { rank, suit });
let result = hand(kickers.chain(vec![card1, card2]).collect());
assert_eq!(result.hand_type, Pair);
}
}
} | rust_cleaned_test_functions.jsonl/3084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14445,
368,
341,
286,
369,
7077,
304,
19298,
486,
3919,
19471,
1005,
37728,
1122,
368,
341,
310,
369,
320,
72040,
16,
11,
7781,
17,
8,
304,
32611,
486,
3919,
19471,
1005,
37728,
1122,
1005,
2459... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_unbounded() {
let (tx, rx) = super::unbounded::<u64>();
tx.try_send(1).unwrap();
tx.send(2).unwrap();
assert_eq!(rx.try_recv(), Ok(1));
assert_eq!(rx.recv(), Ok(2));
assert_eq!(rx.try_recv(), Err(TryRecvError::Empty));
let timer = Instant::now();
assert_eq!(
rx.recv_timeout(Duration::from_millis(100)),
Err(RecvTimeoutError::Timeout)
);
assert!((i64::from(timer.elapsed().subsec_nanos()) - 100_000_000).abs() < 1_000_000);
drop(rx);
assert_eq!(tx.send(2), Err(SendError(2)));
assert_eq!(tx.try_send(2), Err(TrySendError::Disconnected(2)));
let (tx, rx) = super::unbounded::<u64>();
drop(tx);
assert_eq!(rx.recv(), Err(RecvError));
assert_eq!(rx.try_recv(), Err(TryRecvError::Disconnected));
assert_eq!(
rx.recv_timeout(Duration::from_millis(100)),
Err(RecvTimeoutError::Disconnected)
);
let (tx, rx) = super::unbounded::<u64>();
thread::spawn(move || {
thread::sleep(Duration::from_millis(100));
tx.send(10).unwrap();
});
let timer = Instant::now();
assert_eq!(rx.recv(), Ok(10));
assert!((i64::from(timer.elapsed().subsec_nanos()) - 100_000_000).abs() < 1_000_000);
} | rust_cleaned_test_functions.jsonl/43345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 707
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
65686,
368,
341,
286,
1077,
320,
3998,
11,
19111,
8,
284,
2256,
486,
359,
65686,
27638,
84,
21,
19,
3913,
286,
9854,
48779,
13565,
7,
16,
568,
15454,
543,
286,
9854,
5219,
7,
17,
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... | 2 |
#[test]
fn test_scope() {
let app = App::new()
.scope("/app", |scope| {
scope.resource("/path1", |r| r.f(|_| HttpResponse::Ok()))
})
.finish();
let req = TestRequest::with_uri("/app/path1").request();
let resp = app.run(req);
assert_eq!(resp.as_msg().status(), StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/22438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23199,
368,
341,
286,
1077,
906,
284,
1845,
486,
931,
741,
310,
659,
4186,
4283,
676,
497,
760,
4186,
91,
341,
394,
6891,
24013,
4283,
2343,
16,
497,
760,
81,
91,
435,
833,
22428,
35395,
17580... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_angle_x_inverse_rotate_vector1() {
let rotation = Rotation3::from_angle_x(Degrees(90_f64));
let vector = Vector3::unit_z();
let expected = Vector3::unit_y();
let result = rotation.inverse_rotate_vector(&vector);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/70503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
21727,
3212,
63333,
60834,
12247,
16,
368,
341,
286,
1077,
12695,
284,
47528,
18,
486,
1499,
21727,
3212,
5432,
791,
7858,
7,
24,
15,
761,
21,
19,
1106,
286,
1077,
4621,
284,
4196,
18,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_0023_example_2() {
let lists = vec![];
let result = linked![];
assert_eq!(Solution::merge_k_lists(lists), result);
} | rust_cleaned_test_functions.jsonl/69634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
17,
18,
39304,
62,
17,
368,
341,
286,
1077,
11469,
284,
7486,
0,
15078,
286,
1077,
1102,
284,
10592,
0,
40901,
286,
2060,
10714,
10297,
36842,
486,
19052,
4698,
37288,
7307,
82,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_simulate_pocket_pair() {
let hands = ["AdAh", "2c2s"]
.iter()
.map(|s| Hand::new_from_str(s).unwrap())
.collect();
let mut g = MonteCarloGame::new_with_hands(hands).unwrap();
let result = g.simulate().unwrap();
assert!(result.1 >= Rank::OnePair(0));
} | rust_cleaned_test_functions.jsonl/33187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18314,
6334,
620,
4537,
14445,
368,
341,
286,
1077,
6078,
284,
4383,
2589,
24765,
497,
330,
17,
66,
17,
82,
7026,
310,
659,
2015,
741,
310,
659,
2186,
22428,
82,
91,
8536,
486,
931,
5673,
2895... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_swap_remove_noncopyable() {
// Tests that we don't accidentally run destructors twice.
let mut v = vec![::unstable::sync::Exclusive::new(()),
::unstable::sync::Exclusive::new(()),
::unstable::sync::Exclusive::new(())];
let mut _e = v.swap_remove(0);
assert_eq!(v.len(), 2);
_e = v.swap_remove(1);
assert_eq!(v.len(), 1);
_e = v.swap_remove(0);
assert_eq!(v.len(), 0);
} | rust_cleaned_test_functions.jsonl/75601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40991,
18193,
21637,
8560,
480,
368,
341,
286,
442,
20150,
429,
582,
1513,
944,
32384,
1598,
20780,
1087,
10917,
624,
286,
1077,
5206,
348,
284,
7486,
20703,
486,
359,
27992,
486,
12996,
486,
7040... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hover_enum_has_impl_action() {
check_actions(
r"enum foo<|>() { A, B }",
expect![[r#"
[
Implementaion(
FilePosition {
file_id: FileId(
0,
),
offset: 5,
},
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
31054,
21778,
21007,
7931,
368,
341,
286,
1779,
25368,
1006,
310,
435,
1,
9018,
15229,
27,
91,
13555,
314,
362,
11,
425,
335,
756,
310,
1720,
0,
15505,
81,
2,
698,
394,
2278,
503,
31075... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basics() {
let mut req = Client::new()
.put("/")
.version(Version::HTTP_2)
.set(header::Date(SystemTime::now().into()))
.content_type("plain/text")
.if_true(true, |req| req.header(header::SERVER, "awc"))
.if_true(false, |req| req.header(header::EXPECT, "awc"))
.if_some(Some("server"), |val, req| {
req.header(header::USER_AGENT, val)
})
.if_some(Option::<&str>::None, |_, req| {
req.header(header::ALLOW, "1")
})
.content_length(100);
assert!(req.headers().contains_key(header::CONTENT_TYPE));
assert!(req.headers().contains_key(header::DATE));
assert!(req.headers().contains_key(header::SERVER));
assert!(req.headers().contains_key(header::USER_AGENT));
assert!(!req.headers().contains_key(header::ALLOW));
assert!(!req.headers().contains_key(header::EXPECT));
assert_eq!(req.head.version, Version::HTTP_2);
let _ = req.headers_mut();
let _ = req.send_body("");
} | rust_cleaned_test_functions.jsonl/38608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
67981,
368,
341,
286,
1077,
5206,
4232,
284,
8423,
486,
931,
741,
310,
659,
628,
61710,
310,
659,
4366,
7,
5637,
486,
9230,
62,
17,
340,
310,
659,
746,
25534,
486,
1916,
10407,
1462,
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_batch_get_command() {
let tag = "tag_batch_get_command";
let (test_suite, mut store, _) = setup_test_suite();
fail::cfg_callback("point_getter_get", || cpu_load(Duration::from_millis(100))).unwrap();
defer!(fail::remove("point_getter_get"));
let jh = test_suite
.rt
.spawn(require_cpu_time_not_zero(&test_suite, tag));
let table = ProductTable::new();
let insert = prepare_insert(&mut store, &table);
insert.execute();
store.commit();
let storage = store.get_storage();
let kvs = store.export();
let mut ctx = Context::default();
ctx.set_resource_group_tag(tag.as_bytes().to_vec());
let keys = kvs.iter().map(|(k, _)| k.as_slice()).collect::<Vec<_>>();
let res = storage.batch_get_command(ctx, &keys, u64::MAX).unwrap();
let expected_values = kvs.iter().map(|(_, v)| v);
let returned_values = res.iter().map(|kv| kv.as_ref().unwrap());
for (expected, returned) in expected_values.zip(returned_values) {
assert_eq!(expected, returned);
}
assert!(block_on(jh).unwrap());
} | rust_cleaned_test_functions.jsonl/110943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
3062,
10811,
368,
341,
262,
1077,
4772,
284,
330,
4578,
14534,
3062,
10811,
3302,
262,
1077,
320,
1944,
57239,
11,
5206,
3553,
11,
27439,
284,
6505,
4452,
57239,
543,
262,
3690,
486,
14072,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.