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_target() {
let cmd = CommandKeyword::Run;
// Should succeed
assert_eq!(target("", cmd.clone()), Ok(("", Target::Selected)));
assert_eq!(target(" ", cmd.clone()), Ok(("", Target::Selected)));
assert_eq!(target("*", cmd.clone()), Ok(("", Target::All)));
assert_eq!(target(" * ", cmd.clone()), Ok((" ", Target::All)));
// Should return an error
assert_eq!(
target("a *", cmd.clone()),
Err(Error::custom(ErrorKind::UnexpectedArgument(CommandKeyword::Run)))
)
} | rust_cleaned_test_functions.jsonl/317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11123,
368,
341,
286,
1077,
5439,
284,
7348,
34481,
486,
6727,
401,
286,
442,
12260,
11996,
198,
286,
2060,
10714,
10297,
5657,
19814,
5439,
15997,
11858,
7622,
7,
19814,
13483,
486,
6316,
4945,
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_default_output() {
build_test_dir(1_000).unwrap();
let mut path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
path.push("target/debug/psbattletools");
for subcommand in ["stats", "winrates", "statistics"] {
let output = Command::new(&path)
.arg(subcommand)
.arg(&*TEST_ROOT_DIR)
.output()
.expect("Failed to execute command");
assert!(output.status.success(), "command failed");
let output_str = std::str::from_utf8(&output.stdout).unwrap();
assert_eq!(
output_str.to_string().strip_suffix('\n').unwrap(),
*DESIRED_TABLE_OUTPUT
);
}
} | rust_cleaned_test_functions.jsonl/71687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
7645,
368,
341,
262,
1936,
4452,
4334,
7,
16,
62,
15,
15,
15,
568,
15454,
543,
262,
1077,
5206,
1815,
284,
7933,
15064,
486,
1499,
5194,
486,
3160,
486,
947,
445,
34,
7581,
46,
25143,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simple_sexpr() {
let tree = InputNeighborhood {
paths: vec![
path![Step::IfExpr, Step::Trace(0), Step::LtExpr, Step::Trace(0), Step::Value(Value::Int(420))],
path![Step::IfExpr, Step::Trace(0), Step::LtExpr, Step::Trace(1), Step::Value(Value::Int(130))],
path![Step::IfExpr, Step::Trace(1), Step::Value(0, "a")],
path![Step::IfExpr, Step::Trace(2), Step::Value(1, "b")],
]
};
tree.validate();
} | rust_cleaned_test_functions.jsonl/129752 | {
"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,
30015,
82113,
649,
368,
341,
262,
1077,
4916,
284,
5571,
8813,
46185,
341,
286,
12716,
25,
7486,
90515,
310,
1815,
20703,
8304,
486,
2679,
16041,
11,
14822,
486,
6550,
7,
15,
701,
14822,
486,
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_ink_flip() {
let mut storage = Contract::new_storage();
let code_hash = storage
.upload_code(
ALICE.clone(),
include_bytes!("./fixtures/flip/flip.wasm").to_vec(),
)
.unwrap();
let contract = Contract::new_with_selector(
&mut storage,
ALICE.clone(),
code_hash,
hex!("9bae9d5e"), // init_value
true,
vec![],
vec![],
0,
0,
)
.unwrap()
.0;
let result: bool = contract
.call_with_selector(
&mut storage,
ALICE.clone(),
hex!("2f865bd9"), // get
(),
false,
0,
0,
)
.unwrap()
.0;
assert_eq!(result, true); // Should equal to the init value
let _: () = contract
.call_with_selector(
&mut storage,
ALICE.clone(),
hex!("633aa551"), // flip
(),
false,
0,
0,
)
.unwrap()
.0;
let result: bool = contract
.call_with_selector(
&mut storage,
ALICE.clone(),
hex!("2f865bd9"), // get
(),
false,
0,
0,
)
.unwrap()
.0;
assert_eq!(result, false); // Should be flipped
let result: (u32, u128) = contract
.call_with_selector(
&mut storage,
ALICE.clone(),
hex!("f7dff04c"), // echo
(42u32, 24u128),
false,
0,
0,
)
.unwrap()
.0;
assert_eq!(result, (42, 24));
} | rust_cleaned_test_functions.jsonl/122566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1027
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
766,
56012,
368,
341,
262,
1077,
5206,
5819,
284,
19185,
486,
931,
23310,
543,
262,
1077,
2038,
8950,
284,
5819,
198,
286,
659,
6120,
4136,
1006,
310,
8753,
5487,
15997,
3148,
310,
2924,
125... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_option_types() {
test_file! {
#[diplomat::bridge]
mod ffi {
#[diplomat::opaque]
struct MyOpaqueStruct(UnknownType);
struct MyStruct {
a: Option<Box<MyOpaqueStruct>>,
}
}
}
} | rust_cleaned_test_functions.jsonl/61352 | {
"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,
9672,
9763,
368,
341,
286,
1273,
2458,
0,
341,
310,
11506,
8579,
500,
80768,
486,
13709,
921,
310,
1463,
76956,
341,
394,
11506,
8579,
500,
80768,
486,
95480,
921,
394,
2036,
3017,
69398,
9422,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_existing_files_lru_mtime() {
let f = TestFixture::new();
// Create files explicitly in the past.
set_mtime_back(f.create_file("file1", 10), 5);
set_mtime_back(f.create_file("file2", 10), 10);
let mut c = LruDiskCache::new(f.tmp(), 25).unwrap();
assert_eq!(c.size(), 20);
c.insert_bytes("file3", &[0; 10]).unwrap();
assert_eq!(c.size(), 20);
// The oldest file on disk should have been removed.
assert!(!c.contains_key("file2"));
assert!(c.contains_key("file1"));
} | rust_cleaned_test_functions.jsonl/6718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62630,
10931,
907,
2672,
93674,
368,
341,
286,
1077,
282,
284,
3393,
18930,
486,
931,
543,
286,
442,
4230,
3542,
20975,
304,
279,
3267,
624,
286,
738,
93674,
3895,
955,
2520,
2458,
445,
1192,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_account_changes_deduct_lamports_and_reassign_account() {
let alice_program_id = Pubkey::new_rand();
let bob_program_id = Pubkey::new_rand();
let pre = PreAccount::new(
&Account::new_data(42, &[42], &alice_program_id).unwrap(),
true,
&alice_program_id,
);
let post = Account::new_data(1, &[0], &bob_program_id).unwrap();
// positive test of this capability
assert_eq!(
pre.verify(&alice_program_id, &post),
Ok(()),
"alice should be able to deduct lamports and give the account to bob if the data is zeroed",
);
} | rust_cleaned_test_functions.jsonl/98719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
13500,
47526,
814,
80500,
907,
309,
3394,
8378,
1288,
6983,
13500,
368,
341,
286,
1077,
70433,
25096,
842,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
35192,
25096,
842,
284,
22611,
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_process_bogus_instruction() {
// Attempt to assign with no accounts
let instruction = SystemInstruction::Assign {
owner: Pubkey::new_unique(),
};
let data = serialize(&instruction).unwrap();
process_instruction(
&data,
Vec::new(),
Vec::new(),
Err(InstructionError::NotEnoughAccountKeys),
super::process_instruction,
);
// Attempt to transfer with no destination
let from = Pubkey::new_unique();
let from_account = AccountSharedData::new(100, 0, &system_program::id());
let instruction = SystemInstruction::Transfer { lamports: 0 };
let data = serialize(&instruction).unwrap();
process_instruction(
&data,
vec![(from, from_account)],
vec![AccountMeta {
pubkey: from,
is_signer: true,
is_writable: false,
}],
Err(InstructionError::NotEnoughAccountKeys),
super::process_instruction,
);
} | rust_cleaned_test_functions.jsonl/95882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
880,
538,
355,
54923,
368,
341,
286,
442,
43517,
311,
9793,
448,
902,
9618,
198,
286,
1077,
7600,
284,
739,
16664,
486,
28933,
341,
310,
6372,
25,
22611,
792,
486,
931,
21218,
3148,
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_is_channel_data() -> Result<()> {
let tests = vec![
("small", vec![1, 2, 3, 4], false),
("zeroes", vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], false),
];
for (name, buf, r) in tests {
let v = ChannelData::is_channel_data(&buf);
assert_eq!(v, r, "unexpected: ({}) {} != {}", name, r, v);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/76715 | {
"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,
6892,
14571,
1769,
368,
1464,
5714,
71698,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
3489,
9004,
497,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
1125,
895,
1326,
286,
3489,
141... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_to_level_filter() {
assert_eq!(LevelFilter::Error, Level::Error.to_level_filter());
assert_eq!(LevelFilter::Trace, Level::Trace.to_level_filter());
} | rust_cleaned_test_functions.jsonl/71734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
8274,
8727,
368,
341,
286,
2060,
10714,
10297,
4449,
5632,
486,
1454,
11,
9395,
486,
1454,
2389,
8274,
8727,
1423,
286,
2060,
10714,
10297,
4449,
5632,
486,
6550,
11,
9395,
486,
6550,
2389,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_z() {
let angle: Radians<f64> = Radians::full_turn_div_4();
let unit_x = Vector3::unit_x();
let unit_y = Vector3::unit_y();
let matrix = Matrix4x4::from_affine_angle_z(angle);
let expected = unit_y.extend(0.0);
let result = matrix * unit_x.extend(0.0);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/129126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
21727,
6415,
368,
341,
286,
1077,
9210,
25,
431,
20736,
63895,
21,
19,
29,
284,
431,
20736,
486,
8878,
37274,
16237,
62,
19,
543,
286,
1077,
4982,
3212,
284,
4196,
18,
486,
3843,
3212,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_substring_binary_3_args() {
let tests = vec![
("Quadratically", 5, 6, "ratica"),
("Sakila", -5, 3, "aki"),
("Sakila", 2, 0, ""),
("Sakila", 2, -1, ""),
("Sakila", 2, 100, "akila"),
("Sakila", 100, 5, ""),
("Sakila", -100, 5, ""),
("中文a测a试", 4, 3, "文"),
("中文a测a试", 4, 4, "文a"),
("中文a测a试", -3, 3, "试"),
("\x61\x76\x5e\x38\x2f\x35", 2, 2, "\x76\x5e"),
("\x61\x76\x5e\x38\x2f\x35", 4, 100, "\x38\x2f\x35"),
("\x61\x76\x5e\x38\x2f\x35", -1, 2, "\x35"),
("\x61\x76\x5e\x38\x2f\x35", -2, 2, "\x2f\x35"),
("", 1, 1, ""),
("", -1, 1, ""),
];
for (s, pos, len, exp) in tests {
let s = Datum::Bytes(s.as_bytes().to_vec());
let pos = Datum::I64(pos);
let len = Datum::I64(len);
let got = eval_func(ScalarFuncSig::SubstringBinary3Args, &[s, pos, len]).unwrap();
assert_eq!(got, Datum::Bytes(exp.as_bytes().to_vec()));
}
// multibytes & unsigned position test
let corner_case_tests = vec![
("中文a测试", Datum::I64(-2), Datum::I64(2), vec![175, 149]),
(
"Sakila",
Datum::U64(u64::max_value()),
Datum::I64(2),
b"".to_vec(),
),
(
"Sakila",
Datum::I64(2),
Datum::U64(u64::max_value()),
b"akila".to_vec(),
),
];
for (s, pos, len, exp) in corner_case_tests {
let s = Datum::Bytes(s.as_bytes().to_vec());
let got = eval_func(ScalarFuncSig::SubstringBinary3Args, &[s, pos, len]).unwrap();
assert_eq!(got, Datum::Bytes(exp));
}
} | rust_cleaned_test_functions.jsonl/9119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
917,
31761,
62,
18,
8384,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
3489,
2183,
14666,
7022,
497,
220,
20,
11,
220,
21,
11,
330,
81,
53297,
4461,
310,
3489,
50,
585,
10524,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_str_item_heap() {
let string = String::from("Test String for test");
UnicodeBuffer::new().add_str_item(&string, &string[5..10]);
} | rust_cleaned_test_functions.jsonl/63448 | {
"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,
2895,
5634,
33059,
368,
341,
286,
1077,
914,
284,
923,
486,
1499,
445,
2271,
923,
369,
1273,
797,
286,
35897,
4095,
486,
931,
1005,
718,
2895,
5634,
2099,
917,
11,
609,
917,
58,
20,
496,
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 |
#[test]
fn test_signed() {
let mut fb = FooBar(0);
assert_eq!(0, fb.signed_two_bits());
assert_eq!(0, fb.signed_eight_bits());
assert_eq!(0, fb.signed_eight_bits_unaligned());
fb.set_signed_two_bits(-2);
assert_eq!(0b10, fb.0);
assert_eq!(-2, fb.signed_two_bits());
assert_eq!(2, fb.signed_eight_bits());
assert_eq!(1, fb.signed_eight_bits_unaligned());
fb.set_signed_two_bits(-1);
assert_eq!(0b11, fb.0);
assert_eq!(-1, fb.signed_two_bits());
assert_eq!(3, fb.signed_eight_bits());
assert_eq!(1, fb.signed_eight_bits_unaligned());
fb.set_signed_two_bits(0);
assert_eq!(0, fb.0);
assert_eq!(0, fb.signed_two_bits());
assert_eq!(0, fb.signed_eight_bits());
assert_eq!(0, fb.signed_eight_bits_unaligned());
fb.set_signed_two_bits(1);
assert_eq!(1, fb.0);
assert_eq!(1, fb.signed_two_bits());
assert_eq!(1, fb.signed_eight_bits());
assert_eq!(0, fb.signed_eight_bits_unaligned());
fb.set_signed_eight_bits(0);
assert_eq!(0, fb.0);
assert_eq!(0, fb.signed_two_bits());
assert_eq!(0, fb.signed_eight_bits());
assert_eq!(0, fb.signed_eight_bits_unaligned());
fb.set_signed_eight_bits(-1);
assert_eq!(0xFF, fb.0);
assert_eq!(-1, fb.signed_two_bits());
assert_eq!(-1, fb.signed_eight_bits());
assert_eq!(127, fb.signed_eight_bits_unaligned());
fb.set_signed_eight_bits(-128);
assert_eq!(0x80, fb.0);
assert_eq!(0, fb.signed_two_bits());
assert_eq!(-128, fb.signed_eight_bits());
assert_eq!(64, fb.signed_eight_bits_unaligned());
fb.set_signed_eight_bits(127);
assert_eq!(0x7F, fb.0);
assert_eq!(-1, fb.signed_two_bits());
assert_eq!(127, fb.signed_eight_bits());
assert_eq!(63, fb.signed_eight_bits_unaligned());
fb.set_signed_eight_bits_unaligned(0);
assert_eq!(1, fb.0);
assert_eq!(1, fb.signed_two_bits());
assert_eq!(1, fb.signed_eight_bits());
assert_eq!(0, fb.signed_eight_bits_unaligned());
fb.set_signed_eight_bits(0);
fb.set_signed_eight_bits_unaligned(-1);
assert_eq!(0x1FE, fb.0);
assert_eq!(-2, fb.signed_two_bits());
assert_eq!(-2, fb.signed_eight_bits());
assert_eq!(-1, fb.signed_eight_bits_unaligned());
fb.set_signed_eight_bits_unaligned(-128);
assert_eq!(0x100, fb.0);
assert_eq!(0, fb.signed_two_bits());
assert_eq!(0, fb.signed_eight_bits());
assert_eq!(-128, fb.signed_eight_bits_unaligned());
fb.set_signed_eight_bits_unaligned(127);
assert_eq!(0xFE, fb.0);
assert_eq!(-2, fb.signed_two_bits());
assert_eq!(-2, fb.signed_eight_bits());
assert_eq!(127, fb.signed_eight_bits_unaligned());
} | rust_cleaned_test_functions.jsonl/2269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55617,
368,
341,
262,
1077,
5206,
25469,
284,
33428,
3428,
7,
15,
626,
262,
2060,
10714,
10297,
15,
11,
25469,
514,
1542,
23241,
20034,
1423,
262,
2060,
10714,
10297,
15,
11,
25469,
514,
1542,
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_set_merge_policy() {
let schema_builder = schema::Schema::builder();
let index = Index::create_in_ram(schema_builder.build());
let index_writer = index.writer(3_000_000).unwrap();
assert_eq!(
format!("{:?}", index_writer.get_merge_policy()),
"LogMergePolicy { min_merge_size: 8, min_layer_size: 10000, \
level_log_size: 0.75 }"
);
let merge_policy = Box::new(NoMergePolicy::default());
index_writer.set_merge_policy(merge_policy);
assert_eq!(
format!("{:?}", index_writer.get_merge_policy()),
"NoMergePolicy"
);
} | rust_cleaned_test_functions.jsonl/58884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
20888,
22773,
368,
341,
286,
1077,
10802,
28532,
284,
10802,
486,
8632,
486,
17850,
543,
286,
1077,
1922,
284,
8008,
486,
3182,
1243,
62124,
42735,
28532,
13239,
1423,
286,
1077,
1922,
28908,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cp_custom_backup_suffix_via_env() {
let (at, mut ucmd) = at_and_ucmd!();
let suffix = "super-suffix-of-the-century";
ucmd.arg("-b")
.env("SIMPLE_BACKUP_SUFFIX", suffix)
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HOW_ARE_YOU_SOURCE)
.succeeds()
.no_stderr();
assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n");
assert_eq!(
at.read(&*format!("{}{}", TEST_HOW_ARE_YOU_SOURCE, suffix)),
"How are you?\n"
);
} | rust_cleaned_test_functions.jsonl/21251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
15875,
44710,
37151,
80710,
15879,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
20525,
284,
330,
9522,
1331,
13554,
8668,
10603,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gnu_compatibility() {
let args = options("-n 1 -c 1 -n 5 -c kiB -vqvqv").unwrap(); // spell-checker:disable-line
assert!(args.mode == Modes::Bytes(1024));
assert!(args.verbose);
assert_eq!(options("-5").unwrap().mode, Modes::Lines(5));
assert_eq!(options("-2b").unwrap().mode, Modes::Bytes(1024));
assert_eq!(options("-5 -c 1").unwrap().mode, Modes::Bytes(1));
} | rust_cleaned_test_functions.jsonl/72114 | {
"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,
1889,
8933,
2965,
53053,
368,
341,
286,
1077,
2827,
284,
2606,
13645,
77,
220,
16,
481,
66,
220,
16,
481,
77,
220,
20,
481,
66,
19953,
33,
481,
85,
69578,
69578,
1827,
15454,
2129,
442,
12845,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checked_in_vectors_up_to_date() {
// newlines when files are checked out.
let json = read_test_vectors_file().replace("\r\n", "\n");
if generate_json() != json {
panic!("Checked-in test_vectors.json is not up to date. Regenerate with `cargo run --bin generate > ./test_vectors.json`.");
}
} | rust_cleaned_test_functions.jsonl/95318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
1243,
49158,
8237,
2346,
4164,
368,
972,
1789,
286,
442,
501,
7969,
979,
3542,
525,
10067,
700,
3224,
286,
1077,
2951,
284,
1349,
4452,
49158,
2458,
1005,
8156,
4921,
81,
1699,
497,
2917,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mvcc_txn_rollback_err() {
test_mvcc_txn_rollback_err_imp(b"k", b"v");
let long_value = gen_value(b'v', SHORT_VALUE_MAX_LEN + 1);
test_mvcc_txn_rollback_err_imp(b"k2", &long_value);
} | rust_cleaned_test_functions.jsonl/23331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
638,
92299,
62,
33559,
9266,
368,
341,
286,
1273,
73187,
638,
92299,
62,
33559,
9266,
36788,
1883,
62911,
497,
293,
1,
85,
3071,
286,
1077,
1293,
3142,
284,
4081,
3142,
1883,
6,
85,
516,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unwrap_or() {
let x: Option<int> = Some(1);
assert_eq!(x.unwrap_or(2), 1);
let x: Option<int> = None;
assert_eq!(x.unwrap_or(2), 2);
} | rust_cleaned_test_functions.jsonl/101724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
10097,
8734,
368,
341,
262,
1077,
856,
25,
6959,
4159,
29,
284,
4329,
7,
16,
317,
262,
2060,
10714,
10297,
87,
55395,
8734,
7,
17,
701,
220,
16,
626,
262,
1077,
856,
25,
6959,
4159,
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 |
#[test]
fn test_struct_tuple() {
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct TubStr(usize, String, f32);
the_same(TubStr(5, "hello".to_string(), 3.2));
} | rust_cleaned_test_functions.jsonl/6260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
21773,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
55039,
11,
11091,
5563,
262,
2036,
39540,
2580,
7,
51878,
11,
923,
11,
282,
18,
17,
626,
262,
279,
33574,
4140,
392,
2580,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hash_no_bytes_dropped_64() {
let val = 0xdeadbeef_deadbeef_u64;
assert!(hash(&val) != hash(&zero_byte(val, 0)));
assert!(hash(&val) != hash(&zero_byte(val, 1)));
assert!(hash(&val) != hash(&zero_byte(val, 2)));
assert!(hash(&val) != hash(&zero_byte(val, 3)));
assert!(hash(&val) != hash(&zero_byte(val, 4)));
assert!(hash(&val) != hash(&zero_byte(val, 5)));
assert!(hash(&val) != hash(&zero_byte(val, 6)));
assert!(hash(&val) != hash(&zero_byte(val, 7)));
fn zero_byte(val: u64, byte: usize) -> u64 {
assert!(byte < 8);
val & !(0xff << (byte * 8))
}
} | rust_cleaned_test_functions.jsonl/35429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
6536,
12524,
814,
41716,
62,
21,
19,
368,
341,
286,
1077,
1044,
284,
220,
15,
87,
33754,
1371,
823,
53427,
1371,
823,
7300,
21,
19,
401,
286,
2060,
10297,
8296,
2099,
831,
8,
961,
5175,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rle_basics() {
let cases = vec![
(
bitvec![LittleEndian; 0; 8],
bitvec![LittleEndian;
0, 0, 0, 1, 0, 0, 0, 0,
0
],
),
(
bitvec![LittleEndian; 0, 0, 0, 0, 1, 0, 0, 0],
bitvec![LittleEndian;
0, 0, 1, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0
],
),
];
for case in cases.into_iter() {
assert_eq!(rle(&case.0), case.1);
}
} | rust_cleaned_test_functions.jsonl/16488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
273,
880,
67981,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
2699,
4083,
20703,
38103,
43231,
26,
220,
15,
26,
220,
23,
1259,
394,
2699,
4083,
20703,
38103,
43231,
280,
66... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_serde() {
let start = AsdfStruct::new(2, 3);
let string = serde_json::to_string(&start).unwrap();
assert_eq!(string, r#"{"zxcv":2,"qwer":3}"#);
let end: AsdfStruct<i32> = serde_json::from_str(&string).unwrap();
assert_eq!(start, end);
} | rust_cleaned_test_functions.jsonl/79922 | {
"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,
75861,
450,
368,
341,
262,
1077,
1191,
284,
1634,
2940,
9422,
486,
931,
7,
17,
11,
220,
18,
626,
262,
1077,
914,
284,
61570,
9455,
486,
983,
3904,
2099,
2468,
568,
15454,
543,
262,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_utf16() {
let v = &mut [0xD834, 0xDD1E, 0x006d, 0x0075, 0x0073, 0x0069, 0x0063];
let s = <String as StringExt>::from_utf16(v);
assert_eq!(s.unwrap(), "𝄞music");
} | rust_cleaned_test_functions.jsonl/125200 | {
"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,
5673,
39453,
16,
21,
368,
341,
286,
1077,
348,
284,
609,
6984,
508,
15,
15764,
23,
18,
19,
11,
220,
15,
82331,
16,
36,
11,
220,
15,
87,
15,
15,
21,
67,
11,
220,
15,
87,
15,
15,
22,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compare_chunk_diff() {
let (a1, a2) = create_two_chunked();
assert_eq!(
a1.equal(&a2).into_iter().collect::<Vec<_>>(),
repeat(Some(true)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a2.equal(&a1).into_iter().collect::<Vec<_>>(),
repeat(Some(true)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a1.not_equal(&a2).into_iter().collect::<Vec<_>>(),
repeat(Some(false)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a2.not_equal(&a1).into_iter().collect::<Vec<_>>(),
repeat(Some(false)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a1.gt(&a2).into_iter().collect::<Vec<_>>(),
repeat(Some(false)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a2.gt(&a1).into_iter().collect::<Vec<_>>(),
repeat(Some(false)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a1.gt_eq(&a2).into_iter().collect::<Vec<_>>(),
repeat(Some(true)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a2.gt_eq(&a1).into_iter().collect::<Vec<_>>(),
repeat(Some(true)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a1.lt_eq(&a2).into_iter().collect::<Vec<_>>(),
repeat(Some(true)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a2.lt_eq(&a1).into_iter().collect::<Vec<_>>(),
repeat(Some(true)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a1.lt(&a2).into_iter().collect::<Vec<_>>(),
repeat(Some(false)).take(6).collect::<Vec<_>>()
);
assert_eq!(
a2.lt(&a1).into_iter().collect::<Vec<_>>(),
repeat(Some(false)).take(6).collect::<Vec<_>>()
);
} | rust_cleaned_test_functions.jsonl/96367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1097
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32235,
30539,
15850,
368,
341,
286,
1077,
320,
64,
16,
11,
264,
17,
8,
284,
1855,
23241,
30539,
291,
1428,
286,
2060,
10714,
33673,
310,
264,
16,
9102,
2099,
64,
17,
568,
18122,
11723,
1005,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_interpolate() {
assert_relative_eq!(Deg(60.0).interpolate(&Deg(120.0), 0.5), Deg(90.0));
assert_relative_eq!(Deg(50.0).interpolate(&Rad(consts::PI), 0.75),
Deg(147.5), epsilon=1e-6);
assert_relative_eq!(Turns(0.50).interpolate(&Deg(30.0), 0.25),
Turns(0.39583333333), epsilon=1e-6);
assert_relative_eq!(Deg(100.0).interpolate(&Deg(310.0), 0.5).normalize(), Deg(25.0));
assert_relative_eq!(Deg(100.0).interpolate_forward(&Deg(310.0), 0.5).normalize(),
Deg(205.0));
} | rust_cleaned_test_functions.jsonl/58807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15318,
45429,
368,
341,
286,
2060,
29286,
10714,
10297,
45657,
7,
21,
15,
13,
15,
568,
2245,
45429,
2099,
45657,
7,
16,
17,
15,
13,
15,
701,
220,
15,
13,
20,
701,
57237,
7,
24,
15,
13,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_lt_nulls() {
let a = Int32Array::from(vec![None, None, Some(1)]);
let b = Int32Array::from(vec![None, Some(1), None]);
let c = lt(&a, &b).unwrap();
assert_eq!(false, c.value(0));
assert_eq!(true, c.value(1));
assert_eq!(false, c.value(2));
} | rust_cleaned_test_functions.jsonl/3127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
39164,
15162,
82,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
4064,
11,
2240,
11,
4329,
7,
16,
41958,
286,
1077,
293,
284,
1333,
18,
17,
1857,
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_trivial_alignment() {
let includes: [PathBuf; 0] = [];
let defines: [(String, String); 0] = [];
let (comp, _) = compile(
None,
&Path::new(""),
"
#version 450
struct MyStruct {
vec4 vs[2];
};
layout(binding=0) uniform UBO {
MyStruct s;
};
void main() {}
",
ShaderKind::Vertex,
&includes,
&defines,
None,
None,
)
.unwrap();
let doc = parse::parse_spirv(comp.as_binary()).unwrap();
structs::write_structs(&doc, &TypesMeta::default());
} | rust_cleaned_test_functions.jsonl/23743 | {
"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,
3547,
26658,
51006,
368,
341,
286,
1077,
5646,
25,
508,
1820,
15064,
26,
220,
15,
60,
284,
5907,
286,
1077,
18653,
25,
17826,
703,
11,
923,
1215,
220,
15,
60,
284,
5907,
286,
1077,
320,
5689,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trusted_len() {
let data = vec![true; 65];
let bitmap = MutableBitmap::from_trusted_len_iter(data.into_iter());
let bitmap: Bitmap = bitmap.into();
assert_eq!(bitmap.len(), 65);
assert_eq!(bitmap.as_slice()[8], 0b00000001);
} | rust_cleaned_test_functions.jsonl/64513 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
27145,
6043,
368,
341,
286,
1077,
821,
284,
7486,
20703,
1866,
26,
220,
21,
20,
935,
286,
1077,
19746,
284,
31143,
16773,
486,
1499,
3547,
27145,
6043,
11723,
2592,
39860,
11723,
1423,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_balance_from_coldkey_account_ok() {
new_test_ext().execute_with(|| {
let coldkey_account_id = 434324; // Random
let ammount = 10000; // Arbitrary
Subtensor::add_balance_to_coldkey_account(&coldkey_account_id, ammount);
assert_eq!(Subtensor::get_coldkey_balance(&coldkey_account_id), ammount);
// Should be able to withdraw without hassle
let result = Subtensor::remove_balance_from_coldkey_account(&coldkey_account_id, ammount);
assert_eq!(result, true);
});
} | rust_cleaned_test_functions.jsonl/17171 | {
"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,
18193,
29396,
5673,
666,
813,
792,
13500,
19817,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
9255,
792,
13500,
842,
284,
220,
19,
18,
19,
18,
17,
19,
26,
442,
10612,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_edges_undirected() {
let g: UnMatrix<char, bool> = UnMatrix::from_edges(&[
(0, 5),
(0, 2),
(0, 3),
(0, 1),
(1, 3),
(2, 3),
(2, 4),
(4, 0),
(6, 6),
]);
assert_eq!(g.edges(node_index(0)).count(), 5);
assert_eq!(g.edges(node_index(1)).count(), 2);
assert_eq!(g.edges(node_index(2)).count(), 3);
assert_eq!(g.edges(node_index(3)).count(), 3);
assert_eq!(g.edges(node_index(4)).count(), 2);
assert_eq!(g.edges(node_index(5)).count(), 1);
assert_eq!(g.edges(node_index(6)).count(), 1);
} | rust_cleaned_test_functions.jsonl/81970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28026,
62,
1241,
74612,
368,
341,
286,
1077,
342,
25,
1230,
6689,
21919,
11,
1807,
29,
284,
1230,
6689,
486,
1499,
28026,
2099,
9640,
310,
320,
15,
11,
220,
20,
1326,
310,
320,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_detection_of_rejected_wpa1_or_wpa2_credentials() {
let result =
ConnectResult::Failed(ConnectFailure::EstablishRsnaFailure(EstablishRsnaFailure {
auth_method: Some(auth::MethodName::Psk),
reason: EstablishRsnaFailureReason::KeyFrameExchangeTimeout,
}));
assert_eq!(
fidl_sme::ConnectResultCode::CredentialRejected,
convert_connect_result(&result)
);
} | rust_cleaned_test_functions.jsonl/112128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57505,
3575,
1288,
28303,
1670,
6595,
16,
8734,
1670,
6595,
17,
47396,
368,
341,
286,
1077,
1102,
4035,
310,
13015,
2077,
486,
9408,
7,
14611,
17507,
486,
68220,
42327,
3376,
17507,
10722,
267,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arc_get_mut() {
let mut x = Arc::new(3);
*get_mut(&mut x).unwrap() = 4;
assert_eq!(*x, 4);
let y = x.clone();
assert!(get_mut(&mut x).is_none());
drop(y);
assert!(get_mut(&mut x).is_some());
let _w = x.downgrade();
assert!(get_mut(&mut x).is_none());
} | rust_cleaned_test_functions.jsonl/19207 | {
"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,
62914,
3062,
29523,
368,
341,
286,
1077,
5206,
856,
284,
19689,
486,
931,
7,
18,
317,
286,
353,
455,
29523,
2099,
6984,
856,
568,
15454,
368,
284,
220,
19,
280,
286,
2060,
10714,
0,
4071,
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_nlerp_start() {
let q = Quaternion::from([0.5f64.sqrt(), 0.0, 0.5f64.sqrt(), 0.0]);
let r = Quaternion::from([0.5, 0.5, 0.5, 0.5]);
assert_ulps_eq!(q, q.nlerp(r, 0.0));
} | rust_cleaned_test_functions.jsonl/15347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
1536,
79,
4906,
368,
341,
286,
1077,
2804,
284,
24801,
486,
1499,
2561,
15,
13,
20,
69,
21,
19,
18049,
1507,
220,
15,
13,
15,
11,
220,
15,
13,
20,
69,
21,
19,
18049,
1507,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error() {
let region_id = 1;
let mut region = Region::default();
region.set_id(region_id);
region.mut_peers().push(Default::default());
region.mut_region_epoch().set_version(2);
region.mut_region_epoch().set_conf_ver(2);
let region_epoch = region.get_region_epoch().clone();
let (sink, rx) = batch::unbounded(1);
let rx = BatchReceiver::new(rx, 1, Vec::new, VecCollector);
let request_id = 123;
let mut downstream =
Downstream::new(String::new(), region_epoch, request_id, ConnID::new());
downstream.set_sink(sink);
let mut Sentinel = Sentinel::new(region_id);
Sentinel.subscribe(downstream);
let enabled = Sentinel.enabled();
assert!(enabled.load(Ordering::SeqCst));
let mut resolver = Resolver::new(region_id);
resolver.init();
for downstream in Sentinel.on_region_ready(resolver, region) {
Sentinel.subscribe(downstream);
}
let rx_wrap = Cell::new(Some(rx));
let receive_error = || {
let (events, rx) = match rx_wrap.replace(None).unwrap().into_future().wait() {
Ok((events, rx)) => (events, rx),
Err(e) => panic!("unexpected recv error: {:?}", e.0),
};
rx_wrap.set(Some(rx));
let mut events = events.unwrap();
assert_eq!(events.len(), 1);
for e in &events {
assert_eq!(e.1.get_request_id(), request_id);
}
let (_, change_data_event) = &mut events[0];
let event = change_data_event.event.take().unwrap();
match event {
Event_oneof_event::Error(err) => err,
_ => panic!("unknown event"),
}
};
let mut err_header = ErrorHeader::default();
err_header.set_not_leader(Default::default());
Sentinel.stop(Error::Request(err_header));
let err = receive_error();
assert!(err.has_not_leader());
// Enable is disabled by any error.
assert!(!enabled.load(Ordering::SeqCst));
let mut err_header = ErrorHeader::default();
err_header.set_region_not_found(Default::default());
Sentinel.stop(Error::Request(err_header));
let err = receive_error();
assert!(err.has_region_not_found());
let mut err_header = ErrorHeader::default();
err_header.set_epoch_not_match(Default::default());
Sentinel.stop(Error::Request(err_header));
let err = receive_error();
assert!(err.has_epoch_not_match());
// Split
let mut region = Region::default();
region.set_id(1);
let mut request = AdminRequest::default();
request.set_cmd_type(AdminCmdType::Split);
let mut response = AdminResponse::default();
response.mut_split().set_left(region.clone());
let err = Sentinel.sink_admin(request, response).err().unwrap();
Sentinel.stop(err);
let mut err = receive_error();
assert!(err.has_epoch_not_match());
err.take_epoch_not_match()
.current_regions
.into_iter()
.find(|r| r.get_id() == 1)
.unwrap();
let mut request = AdminRequest::default();
request.set_cmd_type(AdminCmdType::BatchSplit);
let mut response = AdminResponse::default();
response.mut_splits().set_regions(vec![region].into());
let err = Sentinel.sink_admin(request, response).err().unwrap();
Sentinel.stop(err);
let mut err = receive_error();
assert!(err.has_epoch_not_match());
err.take_epoch_not_match()
.current_regions
.into_iter()
.find(|r| r.get_id() == 1)
.unwrap();
// Merge
let mut request = AdminRequest::default();
request.set_cmd_type(AdminCmdType::PrepareMerge);
let response = AdminResponse::default();
let err = Sentinel.sink_admin(request, response).err().unwrap();
Sentinel.stop(err);
let mut err = receive_error();
assert!(err.has_epoch_not_match());
assert!(err.take_epoch_not_match().current_regions.is_empty());
let mut request = AdminRequest::default();
request.set_cmd_type(AdminCmdType::CommitMerge);
let response = AdminResponse::default();
let err = Sentinel.sink_admin(request, response).err().unwrap();
Sentinel.stop(err);
let mut err = receive_error();
assert!(err.has_epoch_not_match());
assert!(err.take_epoch_not_match().current_regions.is_empty());
let mut request = AdminRequest::default();
request.set_cmd_type(AdminCmdType::RollbackMerge);
let response = AdminResponse::default();
let err = Sentinel.sink_admin(request, response).err().unwrap();
Sentinel.stop(err);
let mut err = receive_error();
assert!(err.has_epoch_not_match());
assert!(err.take_epoch_not_match().current_regions.is_empty());
} | rust_cleaned_test_functions.jsonl/116107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
368,
341,
286,
1077,
5537,
842,
284,
220,
16,
280,
286,
1077,
5206,
5537,
284,
17152,
486,
2258,
543,
286,
5537,
980,
842,
48059,
842,
317,
286,
5537,
744,
332,
36367,
388,
1005,
9077,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_PoK_sig_with_unequal_messages_and_verkey_elements() {
let count_msgs = 5;
let params = Params::new("test".as_bytes());
let (vk, sk) = keygen(count_msgs, ¶ms);
let msgs = FieldElementVector::random(count_msgs);
let sig = Signature::new(msgs.as_slice(), &sk, ¶ms).unwrap();
let bigger_msgs = FieldElementVector::random(count_msgs + 1);
assert!(PoKOfSignature::init(
&sig,
&vk,
¶ms,
bigger_msgs.as_slice(),
None,
HashSet::new(),
)
.is_err());
} | rust_cleaned_test_functions.jsonl/62469 | {
"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,
1088,
78,
42,
29252,
6615,
62,
2886,
1751,
23428,
8378,
26042,
792,
22801,
368,
341,
286,
1077,
1760,
20777,
284,
220,
20,
280,
286,
1077,
3628,
284,
34352,
486,
931,
445,
1944,
3263,
300,
12524... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_schema() {
let schema = Schema::parse_str(r#"{"type": "array", "items": "string"}"#).unwrap().schema;
assert_eq!(Schema::Array(Box::new(Schema::String)), schema);
} | rust_cleaned_test_functions.jsonl/24773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
25371,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
2601,
55543,
4913,
1313,
788,
330,
1653,
497,
330,
3615,
788,
330,
917,
9207,
57676,
568,
15454,
1005,
17349,
280,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_chars_decoding() {
for c in (0..0x110000).filter_map(::std::char::from_u32) {
let bytes = c.encode_utf8();
let s = ::std::str::from_utf8(bytes.as_slice()).unwrap();
if Some(c) != s.chars().next() {
panic!("character {:x}={} does not decode correctly", c as u32, c);
}
}
} | rust_cleaned_test_functions.jsonl/68531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37418,
13783,
3700,
368,
341,
262,
369,
272,
304,
320,
15,
496,
15,
87,
16,
16,
15,
15,
15,
15,
568,
5315,
5376,
38732,
1834,
486,
1762,
486,
1499,
7300,
18,
17,
8,
341,
286,
1077,
5820,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_put_get_del() {
let dir = tempfile::tempdir().unwrap();
let rocksfs = RocksFs::new(dir.path()).unwrap();
for i in 0..10 {
rocksfs.put(&format!("foo{i}"), [i; 128]).unwrap();
}
assert_eq!(rocksfs.number_of_keys().unwrap(), 10);
for i in 0..10 {
assert_eq!(&rocksfs.get(&format!("foo{i}")).unwrap()[..], [i; 128]);
}
for i in 0..5 {
rocksfs.del(&format!("foo{}", i)).unwrap();
}
assert_eq!(rocksfs.number_of_keys().unwrap(), 5);
for i in 0..10 {
if i < 5 {
assert!(rocksfs.get(&format!("foo{i}")).is_err());
} else {
assert_eq!(&rocksfs.get(&format!("foo{i}")).unwrap()[..], [i; 128]);
}
}
} | rust_cleaned_test_functions.jsonl/3266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 458
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
3062,
18029,
368,
341,
286,
1077,
5419,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
23035,
3848,
284,
68031,
48300,
486,
931,
14161,
3875,
6011,
15454,
1428,
286,
369,
600,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_option_too_much_dance() {
let mut y = Some(marker::NoCopy);
let _y2 = y.take().unwrap();
let _y3 = y.take().unwrap();
} | rust_cleaned_test_functions.jsonl/101717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
2346,
78,
717,
1387,
814,
681,
368,
341,
262,
1077,
5206,
379,
284,
4329,
55008,
486,
2753,
12106,
317,
262,
1077,
716,
88,
17,
284,
379,
40161,
1005,
15454,
543,
262,
1077,
716,
88,
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,
1,
1,
1
] | 1 |
#[test]
fn test_is_supported() {
assert!(is_supported(Path::new("tests/subdir/foo_test.ts")));
assert!(is_supported(Path::new("tests/subdir/foo_test.tsx")));
assert!(is_supported(Path::new("tests/subdir/foo_test.js")));
assert!(is_supported(Path::new("tests/subdir/foo_test.jsx")));
assert!(is_supported(Path::new("bar/foo.test.ts")));
assert!(is_supported(Path::new("bar/foo.test.tsx")));
assert!(is_supported(Path::new("bar/foo.test.js")));
assert!(is_supported(Path::new("bar/foo.test.jsx")));
assert!(is_supported(Path::new("foo/bar/test.js")));
assert!(is_supported(Path::new("foo/bar/test.jsx")));
assert!(is_supported(Path::new("foo/bar/test.ts")));
assert!(is_supported(Path::new("foo/bar/test.tsx")));
assert!(!is_supported(Path::new("README.md")));
assert!(!is_supported(Path::new("lib/typescript.d.ts")));
assert!(!is_supported(Path::new("notatest.js")));
assert!(!is_supported(Path::new("NotAtest.ts")));
} | rust_cleaned_test_functions.jsonl/119176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
57885,
368,
341,
262,
2060,
10297,
285,
57885,
33030,
486,
931,
445,
23841,
37885,
3741,
60555,
4452,
21288,
17621,
262,
2060,
10297,
285,
57885,
33030,
486,
931,
445,
23841,
37885,
3741,
6055... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u8() {
let data: &[u8] = &[0xab];
let result: u8 = from_bytes(data, PodType::TVM).unwrap();
assert_eq!(result, 0xab);
} | rust_cleaned_test_functions.jsonl/57361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
23,
368,
341,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
44590,
15,
52616,
935,
286,
1077,
1102,
25,
575,
23,
284,
504,
12524,
2592,
11,
16821,
929,
486,
51,
11187,
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 |
#[test]
fn test_checksum() {
for buf in IPV4_HEADERS {
// compute the checksum as normal
let mut c = Checksum::new();
c.add_bytes(&buf);
assert_eq!(c.checksum(), 0);
// compute the checksum one byte at a time to make sure our
// trailing_byte logic works
let mut c = Checksum::new();
for byte in *buf {
c.add_bytes(&[*byte]);
}
assert_eq!(c.checksum(), 0);
// Make sure that it works even if we overflow u32. Performing this
// loop 2 * 2^16 times is guaranteed to cause such an overflow
// loop iteration to the next.
let mut c = Checksum::new();
c.add_bytes(&[0xFF, 0xFF]);
let mut prev_sum = c.sum;
let mut overflowed = false;
for _ in 0..((2 * (1 << 16)) - 1) {
c.add_bytes(&[0xFF, 0xFF]);
if c.sum < prev_sum {
overflowed = true;
}
prev_sum = c.sum;
}
assert!(overflowed);
assert_eq!(c.checksum(), 0);
}
} | rust_cleaned_test_functions.jsonl/15731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 821
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64038,
368,
341,
310,
369,
6607,
304,
91498,
19,
79428,
341,
394,
442,
12564,
279,
32529,
438,
4622,
198,
394,
1077,
5206,
272,
284,
4248,
1242,
486,
931,
543,
394,
272,
1364,
12524,
2099,
5909,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_iterate_string_vec() {
let words = vec!["hello", "world"];
let capitalized_words: Vec<String> = words.iter().map( |word| capitalize_first(word)).collect();
assert_eq!(capitalized_words, ["Hello", "World"]);
} | rust_cleaned_test_functions.jsonl/66219 | {
"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,
11723,
349,
3904,
13251,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
14615,
6332,
286,
1077,
97321,
18981,
25,
11312,
3464,
29,
284,
4244,
19471,
1005,
2186,
7,
760,
1158,
91... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_affine_shear_y_does_not_change_last_coordinate() {
let shear_y_with_x = 3;
let shear_y_with_z = 11;
let matrix = Matrix4x4::from_affine_shear_y(shear_y_with_x, shear_y_with_z);
let unit_w = Vector4::unit_w();
let expected = unit_w;
let result = matrix * unit_w;
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129113 | {
"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,
5673,
48914,
482,
643,
86060,
4178,
96374,
7913,
15947,
12195,
68649,
368,
341,
286,
1077,
64244,
4178,
6615,
3212,
284,
220,
18,
280,
286,
1077,
64244,
4178,
6615,
6415,
284,
220,
16,
16,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bech32() {
let address = AccountAddress::try_from(
&Vec::from_hex("269bdde7f42c25476707821eb44d5ce3c6c9e50a774f43ddebc5494a42870aa6")
.expect("You must provide a valid Hex format")[..],
)
.expect("Address is not a valid hex format");
let bech32 = Bech32::try_from(address).unwrap();
assert_eq!(
bech32.to_string(),
"lb1y6damel59sj5wec8sg0tgn2uu0rvneg2wa858h0tc4y55s58p2nqjyd2lr".to_string()
);
let bech32_address = AccountAddress::try_from(bech32)
.expect("The provided input string is not a valid bech32 format");
assert_eq!(
address.as_ref().to_vec(),
bech32_address.as_ref().to_vec(),
"The two addresses do not match",
);
} | rust_cleaned_test_functions.jsonl/73223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
4737,
18,
17,
368,
341,
262,
1077,
2621,
284,
8615,
4286,
486,
1539,
5673,
1006,
286,
609,
10050,
486,
1499,
32655,
445,
17,
21,
24,
8940,
450,
22,
69,
19,
17,
66,
17,
20,
19,
22,
21,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delitem() {
let gil = Python::acquire_gil();
let py = gil.python();
let d = [("ByteSequence", py.get_type::<ByteSequence>())].into_py_dict(py);
let run = |code| py.run(code, None, Some(d)).unwrap();
let err = |code| py.run(code, None, Some(d)).unwrap_err();
run("s = ByteSequence([1, 2, 3]); del s[0]; assert list(s) == [2, 3]");
run("s = ByteSequence([1, 2, 3]); del s[1]; assert list(s) == [1, 3]");
run("s = ByteSequence([1, 2, 3]); del s[-1]; assert list(s) == [1, 2]");
run("s = ByteSequence([1, 2, 3]); del s[-2]; assert list(s) == [1, 3]");
err("s = ByteSequence([1, 2, 3]); del s[-4]; print(list(s))");
err("s = ByteSequence([1, 2, 3]); del s[4]");
} | rust_cleaned_test_functions.jsonl/64047 | {
"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,
18029,
1203,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
1428,
262,
1077,
294,
284,
84019,
7153,
14076,
497,
4510,
670,
1819,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assignment_to_const() {
err(
"const one: int = 1;
fun f() { one = 2; }",
pos(2, 27),
Msg::AssignmentToConst,
);
} | rust_cleaned_test_functions.jsonl/106634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51891,
2346,
13610,
368,
341,
286,
1848,
1006,
310,
330,
1024,
825,
25,
526,
284,
220,
16,
280,
310,
2464,
282,
368,
314,
825,
284,
220,
17,
26,
335,
756,
310,
1133,
7,
17,
11,
220,
17,
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 |
#[test]
fn test_args_qout() {
let mut args = Args::new();
assert_eq!(false, args.qout());
args.set_qout(true);
assert_eq!(true, args.qout());
} | rust_cleaned_test_functions.jsonl/118628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
8976,
411,
368,
341,
286,
1077,
5206,
2827,
284,
17693,
486,
931,
543,
286,
2060,
10714,
10297,
3849,
11,
2827,
11354,
411,
5231,
286,
2827,
980,
8976,
411,
3715,
317,
286,
2060,
10714,
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 |
#[test]
fn test_aes_new() {
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
assert_ne!(
AeKey::new(&keypair1, &Pubkey::default()).unwrap().0,
AeKey::new(&keypair2, &Pubkey::default()).unwrap().0,
);
let null_signer = NullSigner::new(&Pubkey::default());
assert!(AeKey::new(&null_signer, &Pubkey::default()).is_err());
} | rust_cleaned_test_functions.jsonl/132686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90958,
5921,
368,
341,
286,
1077,
1376,
12670,
16,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
1376,
12670,
17,
284,
6569,
1082,
1310,
486,
931,
1428,
286,
2060,
13925,
33673,
310,
89795,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handles_unexpected_char() {
let mut scanner = Scanner::new("<?php \u{009C}");
assert_eq!(true, scanner.scan().is_err())
} | rust_cleaned_test_functions.jsonl/52957 | {
"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,
68017,
4907,
7325,
9232,
368,
341,
286,
1077,
5206,
20775,
284,
17170,
486,
931,
98276,
1208,
1124,
84,
90,
15,
15,
24,
34,
64139,
286,
2060,
10714,
10297,
1866,
11,
20775,
47949,
1005,
285,
926... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_split() {
let tests: Vec<(_, _, &[&str])> =
vec![("a/b/cde", "/", &["a", "b", "cde"]), ("hello, world", ", ", &["hello", "world"])];
for (input, pat, expected) in tests {
let mut args = HashMap::new();
args.insert("pat".to_string(), to_value(pat).unwrap());
let result = split(to_value(input).unwrap(), args).unwrap();
let result = result.as_array().unwrap();
assert_eq!(result.len(), expected.len());
for (result, expected) in result.iter().zip(expected.iter()) {
assert_eq!(result, expected);
}
}
} | rust_cleaned_test_functions.jsonl/49425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
368,
341,
286,
1077,
7032,
25,
11312,
27,
41117,
8358,
44590,
5,
495,
2467,
29,
4035,
310,
7486,
20703,
445,
64,
3470,
2899,
450,
497,
64657,
609,
1183,
64,
497,
330,
65,
497,
330,
66,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_token_eq() {
let a = Token::new(TokenType::Identifier, String::from("lexeme"), Pos(0, 0));
let b = Token::new(TokenType::Identifier, String::from("lexeme"), Pos(10, 10));
let c = Token::new(
TokenType::Identifier,
String::from("another_lexeme"),
Pos(0, 0),
);
let d = Token::new(TokenType::String, String::from("lexeme"), Pos(0, 0));
assert_eq!(a, b);
assert_ne!(a, c);
assert_ne!(a, d);
} | rust_cleaned_test_functions.jsonl/34892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
10714,
368,
341,
286,
1077,
264,
284,
9660,
486,
931,
91211,
486,
8714,
11,
923,
486,
1499,
445,
2571,
3894,
3975,
18876,
7,
15,
11,
220,
15,
1106,
286,
1077,
293,
284,
9660,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_str() {
let gil = Python::acquire_gil();
let py = gil.python();
let s = "Hello Python";
let py_string = s.to_object(py);
let s2: &str = FromPyObject::extract(py_string.as_ref(py).into()).unwrap();
assert_eq!(s, s2);
} | rust_cleaned_test_functions.jsonl/89506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
2895,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
274,
284,
330,
9707,
13027,
876,
286,
1077,
4510,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_gauge() {
let client = new_nop_client("client.test");
let expected = Gauge::new("client.test.", "gauge.key", 5);
assert_eq!(expected, client.gauge("gauge.key", 5).unwrap());
} | rust_cleaned_test_functions.jsonl/47003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
1889,
19392,
368,
341,
262,
1077,
2943,
284,
501,
1089,
453,
8179,
445,
2972,
5958,
797,
262,
1077,
3601,
284,
72060,
486,
931,
445,
2972,
5958,
10465,
330,
70,
19392,
4735,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_err_div_by_zero_reg() {
test_interpreter_and_jit_asm!(
"
mov32 r0, 1
mov32 r1, 0
div32 r0, r1
exit",
[],
(),
{ |_vm, res: Result| matches!(res.unwrap_err(), EbpfError::DivideByZero(pc) if pc == 31) },
3
);
} | rust_cleaned_test_functions.jsonl/58963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9266,
16237,
3710,
19359,
4920,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
18,
17,
435,
15,
11,
220,
16,
198,
286,
1974,
18,
17,
435,
16,
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... | 2 |
#[test]
fn test_child_slots_of_same_parent() {
let ReplayBlockstoreComponents {
blockstore,
validator_node_to_vote_keys,
vote_simulator,
leader_schedule_cache,
rpc_subscriptions,
..
} = replay_blockstore_components(None, 1, None::<GenerateVotes>);
let VoteSimulator {
mut progress,
bank_forks,
..
} = vote_simulator;
// Insert a non-root bank so that the propagation logic will update this
// bank
let bank1 = Bank::new_from_parent(
bank_forks.read().unwrap().get(0).unwrap(),
&leader_schedule_cache.slot_leader_at(1, None).unwrap(),
1,
);
progress.insert(
1,
ForkProgress::new_from_bank(
&bank1,
bank1.collector_id(),
validator_node_to_vote_keys
.get(bank1.collector_id())
.unwrap(),
Some(0),
0,
0,
),
);
assert!(progress.get_propagated_stats(1).unwrap().is_leader_slot);
bank1.freeze();
bank_forks.write().unwrap().insert(bank1);
// chaining to slot 1
let (shreds, _) = make_slot_entries(NUM_CONSECUTIVE_LEADER_SLOTS, 1, 8);
blockstore.insert_shreds(shreds, None, false).unwrap();
assert!(bank_forks
.read()
.unwrap()
.get(NUM_CONSECUTIVE_LEADER_SLOTS)
.is_none());
let mut replay_timing = ReplayTiming::default();
ReplayStage::generate_new_bank_forks(
&blockstore,
&bank_forks,
&leader_schedule_cache,
&rpc_subscriptions,
&mut progress,
&mut replay_timing,
);
assert!(bank_forks
.read()
.unwrap()
.get(NUM_CONSECUTIVE_LEADER_SLOTS)
.is_some());
// chaining to slot 1
let (shreds, _) = make_slot_entries(2 * NUM_CONSECUTIVE_LEADER_SLOTS, 1, 8);
blockstore.insert_shreds(shreds, None, false).unwrap();
assert!(bank_forks
.read()
.unwrap()
.get(2 * NUM_CONSECUTIVE_LEADER_SLOTS)
.is_none());
ReplayStage::generate_new_bank_forks(
&blockstore,
&bank_forks,
&leader_schedule_cache,
&rpc_subscriptions,
&mut progress,
&mut replay_timing,
);
assert!(bank_forks
.read()
.unwrap()
.get(NUM_CONSECUTIVE_LEADER_SLOTS)
.is_some());
assert!(bank_forks
.read()
.unwrap()
.get(2 * NUM_CONSECUTIVE_LEADER_SLOTS)
.is_some());
// we should see 3 validators in bank 1's propagated_validator set.
let expected_leader_slots = vec![
1,
NUM_CONSECUTIVE_LEADER_SLOTS,
2 * NUM_CONSECUTIVE_LEADER_SLOTS,
];
for slot in expected_leader_slots {
let leader = leader_schedule_cache.slot_leader_at(slot, None).unwrap();
let vote_key = validator_node_to_vote_keys.get(&leader).unwrap();
assert!(progress
.get_propagated_stats(1)
.unwrap()
.propagated_validators
.contains(vote_key));
}
} | rust_cleaned_test_functions.jsonl/25801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2011
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17268,
54161,
3575,
33574,
15960,
368,
341,
286,
1077,
59061,
4713,
4314,
10443,
341,
310,
2504,
4314,
345,
310,
22935,
5084,
2346,
54360,
12631,
345,
310,
6910,
18314,
10511,
345,
310,
7653,
34530,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_scout_in_workspace() -> Result<(), crate::error::Error> {
let diff = vec![
Section {
file_name: get_absolute_file_path("member1/bar.rs")?,
line_start: 0,
line_end: 10,
},
Section {
file_name: get_absolute_file_path("member2/bar.rs")?,
line_start: 0,
line_end: 10,
},
];
let linter = TestLinter::new();
let vcs = TestVCS::new(diff);
let config = TestConfig::new(vec![
"member1".to_string(),
"member2".to_string(),
"member3".to_string(),
]);
// We should run the linter on member1 and member2
let expected_times_called = 2;
let actual_times_called = Rc::clone(&linter.lints_times_called);
let scout = Scout::new(vcs, config, linter);
// We don't check for the lints result here.
// It is already tested in the linter tests
// and in intersection tests
let _ = scout.run()?;
assert_eq!(expected_times_called, *actual_times_called.borrow());
Ok(())
} | rust_cleaned_test_functions.jsonl/28047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 610
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6104,
1243,
75560,
368,
1464,
5714,
68843,
17717,
486,
841,
486,
1454,
29,
341,
286,
1077,
3638,
284,
7486,
90515,
310,
11113,
341,
394,
1034,
1269,
25,
633,
50874,
2458,
2638,
445,
9597,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_is_str_latin1_success() {
let len = if cfg!(miri) { 64 } else { 256 }; // Miri is too slow
let mut src: Vec<u16> = Vec::with_capacity(len);
src.resize(len, 0);
for i in 0..src.len() {
src[i] = i as u16;
}
for i in 0..src.len() {
let s = String::from_utf16(&src[i..]).unwrap();
assert!(is_str_latin1(&s[..]));
assert_eq!(check_str_for_latin1_and_bidi(&s[..]), Latin1Bidi::Latin1);
}
} | rust_cleaned_test_functions.jsonl/27302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
2895,
907,
14768,
16,
18632,
368,
341,
286,
1077,
2422,
284,
421,
13286,
10297,
19936,
72,
8,
314,
220,
21,
19,
335,
770,
314,
220,
17,
20,
21,
20066,
442,
14268,
72,
374,
2238,
6301,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_connect_without_peer_should_fail() {
Runtime::new().unwrap().block_on(async {
let config =
UdpConnectionConfig::default().with_connect_timeout(Duration::from_millis(50));
let mut connection = UdpConnection::new(config);
let result = connection
.connect(UdpConnectParams {
ip: "127.0.0.1".parse().unwrap(),
suggested_port: 1234,
master_side: true,
})
.await;
assert_eq!(result.is_err(), true);
assert_eq!(connection.is_new(), true);
assert_eq!(connection.is_bound(), false);
assert_eq!(connection.is_connected(), false);
assert_eq!(connection.is_disconnected(), false);
});
} | rust_cleaned_test_functions.jsonl/54774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
39904,
45159,
43378,
22121,
368,
341,
286,
10954,
486,
931,
1005,
15454,
1005,
4574,
4470,
18285,
341,
310,
1077,
2193,
4035,
394,
547,
9796,
4526,
2648,
486,
2258,
1005,
4197,
15720,
20537,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verbose_version_parse() {
check_verbose_parse! {
"rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)\n\
binary: rustc\n\
commit-hash: a59de37e99060162a2674e3ff45409ac73595c0e\n\
commit-date: 2015-05-13\n\
build-date: 2015-05-14\n\
host: x86_64-unknown-linux-gnu\n\
release: 1.0.0" => "1.0.0", Some("2015-05-13"),
"rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)\n\
commit-hash: a59de37e99060162a2674e3ff45409ac73595c0e\n\
commit-date: 2015-05-13\n\
build-date: 2015-05-14\n\
host: x86_64-unknown-linux-gnu\n\
release: 1.0.0" => "1.0.0", Some("2015-05-13"),
"rustc 1.50.0 (cb75ad5db 2021-02-10)\n\
binary: rustc\n\
commit-hash: cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\n\
commit-date: 2021-02-10\n\
host: x86_64-unknown-linux-gnu\n\
release: 1.50.0" => "1.50.0", Some("2021-02-10"),
"rustc 1.52.0-nightly (234781afe 2021-03-07)\n\
binary: rustc\n\
commit-hash: 234781afe33d3f339b002f85f948046d8476cfc9\n\
commit-date: 2021-03-07\n\
host: x86_64-unknown-linux-gnu\n\
release: 1.52.0-nightly\n\
LLVM version: 12.0.0" => "1.52.0-nightly", Some("2021-03-07"),
"rustc 1.41.1\n\
binary: rustc\n\
commit-hash: unknown\n\
commit-date: unknown\n\
host: x86_64-unknown-linux-gnu\n\
release: 1.41.1\n\
LLVM version: 7.0" => "1.41.1", None,
"rustc 1.49.0\n\
binary: rustc\n\
commit-hash: unknown\n\
commit-date: unknown\n\
host: x86_64-unknown-linux-gnu\n\
release: 1.49.0" => "1.49.0", None,
"rustc 1.50.0 (Fedora 1.50.0-1.fc33)\n\
binary: rustc\n\
commit-hash: unknown\n\
commit-date: unknown\n\
host: x86_64-unknown-linux-gnu\n\
release: 1.50.0" => "1.50.0", None,
};
} | rust_cleaned_test_functions.jsonl/79905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67921,
9438,
21039,
368,
341,
286,
1779,
67921,
21039,
0,
341,
310,
330,
35788,
66,
220,
16,
13,
15,
13,
15,
320,
64,
20,
24,
450,
18,
22,
68,
24,
220,
17,
15,
16,
20,
12,
15,
20,
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_message_from_too_short_buffer_returns_none() {
let buf = vec![0u8, 0u8, 0u8];
let got = Message::from_buffer(&buf);
assert_eq!(got, None);
} | rust_cleaned_test_functions.jsonl/93673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
5673,
2346,
78,
16673,
7776,
58900,
31488,
368,
341,
286,
1077,
6607,
284,
7486,
20703,
15,
84,
23,
11,
220,
15,
84,
23,
11,
220,
15,
84,
23,
4821,
286,
1077,
2684,
284,
4856,
486,
149... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_columns_1() {
assert_eq!(
Column::iter()
.map(|col| col.to_string())
.collect::<Vec<_>>(),
vec![
"id".to_owned(),
"owner".to_owned(),
"name".to_owned(),
"description".to_owned(),
]
);
assert_eq!(Column::Table.to_string().as_str(), "model");
assert_eq!(Column::Id.to_string().as_str(), "id");
assert_eq!(Column::Owner.to_string().as_str(), "owner");
assert_eq!(Column::Name.to_string().as_str(), "name");
assert_eq!(Column::Description.to_string().as_str(), "description");
} | rust_cleaned_test_functions.jsonl/57034 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 377
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22590,
62,
16,
368,
341,
286,
2060,
10714,
33673,
310,
9332,
486,
2015,
741,
394,
659,
2186,
22428,
2074,
91,
1375,
2389,
3904,
2398,
394,
659,
17384,
27638,
10050,
32399,
2452,
3148,
310,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_type2() {
use ProofKindShorthands::*;
use PropShorthands::*;
let mut idgen = IdGen::new();
let id1 = idgen.fresh();
let pf = Proof {
prop: Atom(id1),
kind: Var(Idx(0)),
};
pf.check_type();
} | rust_cleaned_test_functions.jsonl/125419 | {
"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,
7200,
1819,
17,
368,
341,
286,
990,
36991,
10629,
2016,
2364,
2844,
56162,
286,
990,
3911,
2016,
2364,
2844,
79304,
286,
1077,
5206,
877,
4370,
284,
5223,
9967,
486,
931,
543,
286,
1077,
877,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser_rules() {
assert!(parse_rule("faded blue bags contain no other bags.").is_ok());
assert!(parse_rule("bright white bags contain 1 shiny gold bag.").is_ok());
assert!(parse_rule("light red bags contain 1 bright white bag, 2 muted yellow bags.").is_ok());
} | rust_cleaned_test_functions.jsonl/98557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
21407,
368,
341,
286,
2060,
10297,
6400,
21124,
445,
69,
14255,
6303,
17899,
6644,
902,
1008,
17899,
98401,
285,
19817,
1423,
286,
2060,
10297,
6400,
21124,
445,
72116,
4158,
17899,
6644,
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_row_convert_float() {
// FLOAT value does not depend on logical type
let descr = make_column_descr![PhysicalType::FLOAT, LogicalType::NONE];
let row = Field::convert_float(&descr, 2.31);
assert_eq!(row, Field::Float(2.31));
} | rust_cleaned_test_functions.jsonl/43799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
34910,
17586,
368,
341,
262,
442,
50116,
897,
1558,
537,
6761,
389,
19819,
943,
198,
262,
1077,
56217,
284,
1281,
8744,
64622,
20703,
39253,
929,
486,
50915,
11,
62069,
929,
486,
45425,
935,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_string() -> crate::Result<()> {
let buffer: Vec<u8> = {
let mut term_dictionary_builder = TermDictionaryBuilder::create(vec![]).unwrap();
term_dictionary_builder
.insert(&[], &make_term_info(1 as u64))
.unwrap();
term_dictionary_builder
.insert(&[1u8], &make_term_info(2 as u64))
.unwrap();
term_dictionary_builder.finish().unwrap()
};
let file = FileSlice::from(buffer);
let term_dictionary: TermDictionary = TermDictionary::open(file)?;
let mut stream = term_dictionary.stream();
assert!(stream.advance());
assert!(stream.key().is_empty());
assert!(stream.advance());
assert_eq!(stream.key(), &[1u8]);
assert!(!stream.advance());
Ok(())
} | rust_cleaned_test_functions.jsonl/101250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
3904,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
1077,
4147,
25,
11312,
34837,
23,
29,
284,
341,
310,
1077,
5206,
4647,
42605,
28532,
284,
17519,
8517,
3297,
486,
3182,
25592,
0,
1294,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty_body() {
let multipart = Multipart::with_body(mock_stream(&[]), BOUNDARY);
pin_mut!(multipart);
ready_assert_ok_eq!(|cx| multipart.as_mut().poll_has_next_field(cx), false);
} | rust_cleaned_test_functions.jsonl/118932 | {
"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,
15124,
14114,
368,
341,
286,
1077,
68058,
284,
386,
18204,
486,
4197,
14114,
30389,
12673,
2099,
1294,
701,
425,
13579,
8642,
317,
286,
8983,
29523,
10297,
29542,
317,
286,
5527,
16553,
19817,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fs_fsentry_realfile_none() {
let t_now: SystemTime = SystemTime::now();
let entry: FsEntry = FsEntry::File(FsFile {
name: String::from("bar.txt"),
abs_path: PathBuf::from("/bar.txt"),
last_change_time: t_now,
last_access_time: t_now,
creation_time: t_now,
size: 8192,
readonly: false,
ftype: Some(String::from("txt")),
symlink: None, // UNIX only
user: Some(0), // UNIX only
group: Some(0), // UNIX only
unix_pex: Some((6, 4, 4)), // UNIX only
});
assert_eq!(
entry.get_realfile().get_abs_path(),
PathBuf::from("/bar.txt")
);
let entry: FsEntry = FsEntry::Directory(FsDirectory {
name: String::from("foo"),
abs_path: PathBuf::from("/foo"),
last_change_time: t_now,
last_access_time: t_now,
creation_time: t_now,
readonly: false,
symlink: None, // UNIX only
user: Some(0), // UNIX only
group: Some(0), // UNIX only
unix_pex: Some((7, 5, 5)), // UNIX only
});
assert_eq!(entry.get_realfile().get_abs_path(), PathBuf::from("/foo"));
} | rust_cleaned_test_functions.jsonl/38165 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 810
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34470,
34470,
4085,
15266,
1192,
31488,
368,
341,
286,
1077,
259,
20813,
25,
739,
1462,
284,
739,
1462,
486,
3328,
543,
1789,
286,
1077,
4343,
25,
84619,
5874,
284,
84619,
5874,
486,
1703,
7832,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_jupyter_notebook() {
let needle = b"TACGTCAGC";
let haystack = b"AACCCTATGTCATGCCTTGGA";
check_test(needle, haystack, 2);
} | rust_cleaned_test_functions.jsonl/83255 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
5374,
72852,
27207,
2190,
368,
341,
286,
1077,
30309,
284,
293,
95029,
1706,
38,
7749,
1890,
34,
876,
286,
1077,
88447,
284,
293,
29133,
29442,
1162,
828,
38,
7749,
828,
22863,
1162,
76787,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bytes_available() {
let fs = FileSystem::default();
let mut file = fs
.new_open_options()
.write(true)
.create_new(true)
.open(path!("/foo.txt"))
.expect("failed to create a new file");
assert_eq!(file.bytes_available(), Ok(0), "zero bytes available");
assert_eq!(file.set_len(7), Ok(()), "resizing the file");
assert_eq!(file.bytes_available(), Ok(7), "seven bytes available");
} | rust_cleaned_test_functions.jsonl/52780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
26962,
368,
341,
286,
1077,
8619,
284,
53461,
486,
2258,
1428,
286,
1077,
5206,
1034,
284,
8619,
198,
310,
659,
931,
11311,
8743,
741,
310,
659,
4934,
3715,
340,
310,
659,
3182,
5921,
371... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_mac_retail2_padtype1() {
let res = generate_mac(&MacAlgo::RetailMac, &PaddingType::Type1,
&Vec::from(hex!("0102030405060708010203040506070801020304050607080000")), &Vec::from(hex!("e0f4543f3e2a2c5ffc7e5e5a222e3e4d")));
match res {
Ok(m) => {
println!("mac = {}", hex::encode(m.as_slice()));
assert_eq!(hex::encode(m), "149f99288681d292");
}
Err(e) => {
assert!(false, e.msg)
}
}
} | rust_cleaned_test_functions.jsonl/23727 | {
"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,
16322,
22802,
1288,
14586,
17,
30290,
1313,
16,
368,
341,
286,
1077,
592,
284,
6923,
22802,
2099,
19552,
2101,
3346,
486,
76906,
19552,
11,
609,
21616,
929,
486,
929,
16,
345,
7561,
609,
10050,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_round_key() {
let input_data = ["00112233445566778899aabbccddeeff",
"5f72641557f5bc92f7be3b291db9f91a",
"bd2a395d2b6ac438d192443e615da195",
"810dce0cc9db8172b3678c1e88a1b5bd",
"b2822d81abe6fb275faf103a078c0033",
"aeb65ba974e0f822d73f567bdb64c877",
"b951c33c02e9bd29ae25cdb1efa08cc7",
"ebb19e1c3ee7c9e87d7535e9ed6b9144",
"5174c8669da98435a8b3e62ca974a5ea",
"0f77ee31d2ccadc05430a83f4ef96ac3",
"bd86f0ea748fc4f4630f11c1e9331233",
"af8690415d6e1dd387e5fbedd5c89013",
"7427fae4d8a695269ce83d315be0392b",
"2c21a820306f154ab712c75eee0da04f",
"aa5ece06ee6e3c56dde68bac2621bebf"];
let expect = ["00102030405060708090a0b0c0d0e0f0",
"4f63760643e0aa85efa7213201a4e705",
"1859fbc28a1c00a078ed8aadc42f6109",
"975c66c1cb9f3fa8a93a28df8ee10f63",
"1c05f271a417e04ff921c5c104701554",
"c357aae11b45b7b0a2c7bd28a8dc99fa",
"7f074143cb4e243ec10c815d8375d54c",
"d653a4696ca0bc0f5acaab5db96c5e7d",
"5aa858395fd28d7d05e1a38868f3b9c5",
"4a824851c57e7e47643de50c2af3e8c9",
"c14907f6ca3b3aa070e9aa313b52b5ec",
"5f9c6abfbac634aa50409fa766677653",
"516604954353950314fb86e401922521",
"627bceb9999d5aaac945ecf423f56da5",
"8ea2b7ca516745bfeafc49904b496089"];
let round_key_str = ["000102030405060708090a0b0c0d0e0f",
"101112131415161718191a1b1c1d1e1f",
"a573c29fa176c498a97fce93a572c09c",
"1651a8cd0244beda1a5da4c10640bade",
"ae87dff00ff11b68a68ed5fb03fc1567",
"6de1f1486fa54f9275f8eb5373b8518d",
"c656827fc9a799176f294cec6cd5598b",
"3de23a75524775e727bf9eb45407cf39",
"0bdc905fc27b0948ad5245a4c1871c2f",
"45f5a66017b2d387300d4d33640a820a",
"7ccff71cbeb4fe5413e6bbf0d261a7df",
"f01afafee7a82979d7a5644ab3afe640",
"2541fe719bf500258813bbd55a721c0a",
"4e5a6699a9f24fe07e572baacdf8cdea",
"24fc79ccbf0979e9371ac23c6d68de36"];
let round = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
let mut round_key_u32 : [u32; aes_common::BLOCK_SIZE * ( ROUND_NUM + 1 )] = [0; aes_common::BLOCK_SIZE * ( ROUND_NUM + 1 )];
for i in 0..round_key_str.len() {
let rnd_key_u8 = hex::decode( round_key_str[i] ).expect( "Failed decoding text to u8" );
for j in 0..4 {
round_key_u32[i * aes_common::WORD_IN_BYTES_NUM + j] = ( rnd_key_u8[j * aes_common::WORD_IN_BYTES_NUM] as u32 ) << 24 |
( rnd_key_u8[j * aes_common::WORD_IN_BYTES_NUM + 1] as u32 ) << 16 |
( rnd_key_u8[j * aes_common::WORD_IN_BYTES_NUM + 2] as u32 ) << 8 |
( rnd_key_u8[j * aes_common::WORD_IN_BYTES_NUM + 3] as u32 );
}
}
for i in 0..expect.len() {
let actual_result = aes_common::state_to_text(
add_round_key( aes_common::text_to_state( input_data[i].to_string() ), round_key_u32, round[i] ) );
assert_eq!( actual_result, expect[i] );
}
} | rust_cleaned_test_functions.jsonl/96041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
29896,
3097,
368,
1476,
1066,
262,
1077,
1946,
1769,
284,
4383,
15,
15,
16,
16,
17,
17,
18,
18,
19,
19,
20,
20,
21,
21,
22,
22,
23,
23,
24,
24,
64,
12523,
638,
88089,
6445,
756,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_read_message() {
struct Test {
s: &'static [u8],
expected: &'static [u8],
expect_error: bool,
}
let tests = vec![
Test {
s: b"",
expected: b"",
expect_error: true,
},
Test {
s: b"\n",
expected: b"\n",
expect_error: true,
},
Test {
s: b"\n> ",
expected: b"",
expect_error: false,
},
Test {
s: b"a\n> ",
expected: b"a",
expect_error: false,
},
Test {
s: b"a\n> \n> ",
expected: b"a",
expect_error: false,
},
Test {
s: b"\na\n> ",
expected: b"a",
expect_error: false,
},
];
let mut buf: Vec<u8> = Vec::new();
for (i, test) in tests.iter().enumerate() {
let result = read_message(&mut bytes::Bytes::from_static(test.s).reader(), &mut buf);
assert_eq!(result.is_err(), test.expect_error);
assert_eq!(buf.as_slice(), test.expected, "{}", i);
}
} | rust_cleaned_test_functions.jsonl/35140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 854
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
6462,
368,
341,
286,
2036,
3393,
341,
310,
274,
25,
30136,
1978,
508,
84,
23,
1259,
310,
3601,
25,
30136,
1978,
508,
84,
23,
1259,
310,
1720,
4096,
25,
1807,
345,
286,
555,
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_vec_list_pop_front() {
let mut list = VecList::new();
assert_eq!(list.pop_front(), None);
list.push_front(0);
assert_eq!(list.pop_front(), Some(0));
} | rust_cleaned_test_functions.jsonl/11545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
17061,
22926,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
2060,
10714,
10297,
1607,
8288,
22926,
1507,
2240,
626,
286,
1140,
2552,
22926,
7,
15,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mutable_write_overflow() {
let mut buf = MutableBuffer::new(1);
assert_eq!(64, buf.capacity());
for _ in 0..10 {
buf.write(&[0, 0, 0, 0, 0, 0, 0, 0]).unwrap();
}
} | rust_cleaned_test_functions.jsonl/20574 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
5922,
9165,
79073,
368,
341,
286,
1077,
5206,
6607,
284,
31143,
4095,
486,
931,
7,
16,
317,
286,
2060,
10714,
10297,
21,
19,
11,
6607,
59168,
1423,
286,
369,
716,
304,
220,
15,
496,
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... | 2 |
#[test]
fn test_position_read() {
let v: Vec<u32> = (0..1000).collect();
let (stream, skip) = create_stream_buffer(&v[..]);
assert_eq!(skip.len(), 12);
assert_eq!(stream.len(), 1168);
let mut position_reader = PositionReader::new(stream, skip, 0u64);
for &n in &[1, 10, 127, 128, 130, 312] {
let mut v = vec![0u32; n];
position_reader.read(&mut v[..n]);
for i in 0..n {
assert_eq!(v[i], i as u32);
}
}
} | rust_cleaned_test_functions.jsonl/106039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9661,
6443,
368,
341,
286,
1077,
348,
25,
11312,
34837,
18,
17,
29,
284,
320,
15,
496,
16,
15,
15,
15,
568,
17384,
543,
286,
1077,
320,
4027,
11,
10706,
8,
284,
1855,
12673,
7776,
2099,
85,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_range_step() {
assert!(super::range_step(0, 20, 5).eq([0, 5, 10, 15].iter().cloned()));
assert!(super::range_step(20, 0, -5).eq([20, 15, 10, 5].iter().cloned()));
assert!(super::range_step(20, 0, -6).eq([20, 14, 8, 2].iter().cloned()));
assert!(super::range_step(200u8, 255, 50).eq([200u8, 250].iter().cloned()));
assert!(super::range_step(200, -5, 1).eq(iter::empty()));
assert!(super::range_step(200, 200, 1).eq(iter::empty()));
} | rust_cleaned_test_functions.jsonl/37396 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
11946,
368,
341,
286,
2060,
10297,
9522,
486,
9669,
11946,
7,
15,
11,
220,
17,
15,
11,
220,
20,
568,
11006,
2561,
15,
11,
220,
20,
11,
220,
16,
15,
11,
220,
16,
20,
936,
2015,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_request() {
let expected_request = Request {
request_line: RequestLine {
http_version: Version::Http10,
method: Method::Get,
uri: Uri::new("http://localhost/home"),
},
body: None,
headers: Headers::default(),
};
let request_bytes = b"GET http://localhost/home HTTP/1.0\r\n \
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT";
let request = Request::try_from(request_bytes).unwrap();
assert!(request == expected_request);
assert_eq!(request.uri(), &Uri::new("http://localhost/home"));
assert_eq!(request.http_version(), Version::Http10);
let request_bytes = b"GET";
assert_eq!(
Request::try_from(request_bytes).unwrap_err(),
RequestError::InvalidRequest
);
} | rust_cleaned_test_functions.jsonl/86631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 463
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
7893,
368,
341,
286,
1077,
3601,
7893,
284,
6145,
341,
310,
1681,
6528,
25,
6145,
2460,
341,
394,
1758,
9438,
25,
6079,
486,
2905,
16,
15,
345,
394,
1714,
25,
6730,
486,
1949,
345,
394,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_round_up_to_page_size() {
assert_eq!(round_up_to_page_size(0, 4096), 0);
assert_eq!(round_up_to_page_size(1, 4096), 4096);
assert_eq!(round_up_to_page_size(4096, 4096), 4096);
assert_eq!(round_up_to_page_size(4097, 4096), 8192);
} | rust_cleaned_test_functions.jsonl/19650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
8237,
2346,
6129,
2368,
368,
341,
286,
2060,
10714,
10297,
1049,
8237,
2346,
6129,
2368,
7,
15,
11,
220,
19,
15,
24,
21,
701,
220,
15,
317,
286,
2060,
10714,
10297,
1049,
8237,
2346,
61... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sram() {
let mut builder = RomBuilder::new();
assert_eq!(builder.build_rom().sram(), false);
builder.set_sram();
assert_eq!(builder.build_rom().sram(), true);
} | rust_cleaned_test_functions.jsonl/104407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
2396,
368,
972,
286,
1077,
5206,
7363,
284,
11774,
3297,
486,
931,
1647,
286,
2060,
10714,
10297,
17850,
13239,
81383,
1005,
82,
2396,
1507,
895,
3079,
286,
7363,
980,
643,
2396,
1647,
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 |
#[test]
fn test_parse_context_custom() {
let input = r#"cd "WebStorm" {
file "*.xml";
exec "ls files"
}"#
.chars()
.collect::<Vec<_>>();
let r = context_custom().parse(&input);
assert_eq!(
r,
Ok(Action::Context(
Folder::Custom("WebStorm".into()),
vec![
Action::File("*.xml".into(), None),
Action::Execute("ls files".into(), None)
]
))
)
} | rust_cleaned_test_functions.jsonl/49998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8467,
15875,
368,
341,
286,
1077,
1946,
284,
435,
55543,
4385,
330,
5981,
34291,
1,
314,
715,
310,
1034,
59128,
6455,
5123,
715,
310,
3883,
330,
4730,
3542,
1,
715,
286,
335,
1,
4956,
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_ptrace_interrupt() {
use nix::sys::ptrace;
use nix::sys::signal::Signal;
use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus};
use nix::unistd::fork;
use nix::unistd::ForkResult::*;
use std::thread::sleep;
use std::time::Duration;
require_capability!("test_ptrace_interrupt", CAP_SYS_PTRACE);
let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test");
match unsafe{fork()}.expect("Error: Fork Failed") {
Child => {
loop {
sleep(Duration::from_millis(1000));
}
},
Parent { child } => {
ptrace::seize(child, ptrace::Options::PTRACE_O_TRACESYSGOOD).unwrap();
ptrace::interrupt(child).unwrap();
assert_eq!(waitpid(child, None), Ok(WaitStatus::PtraceEvent(child, Signal::SIGTRAP, 128)));
ptrace::syscall(child, None).unwrap();
assert_eq!(waitpid(child, None), Ok(WaitStatus::PtraceSyscall(child)));
ptrace::detach(child, Some(Signal::SIGKILL)).unwrap();
match waitpid(child, None) {
Ok(WaitStatus::Signaled(pid, Signal::SIGKILL, _)) if pid == child => {
let _ = waitpid(child, Some(WaitPidFlag::WNOHANG));
while ptrace::cont(child, Some(Signal::SIGKILL)).is_ok() {
let _ = waitpid(child, Some(WaitPidFlag::WNOHANG));
}
}
_ => panic!("The process should have been killed"),
}
},
}
} | rust_cleaned_test_functions.jsonl/33739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 777
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4348,
578,
42606,
368,
341,
262,
990,
308,
941,
486,
7791,
486,
3505,
578,
280,
262,
990,
308,
941,
486,
7791,
486,
26622,
486,
26810,
280,
262,
990,
308,
941,
486,
7791,
486,
11489,
22964,
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... | 5 |
#[test]
fn test_array_chunks_mut_nth_back() {
let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5];
let mut c = v.array_chunks_mut::<2>();
assert_eq!(c.nth_back(1).unwrap(), &[2, 3]);
assert_eq!(c.next().unwrap(), &[0, 1]);
assert_eq!(c.next(), None);
let v2: &mut [i32] = &mut [0, 1, 2, 3, 4];
let mut c2 = v2.array_chunks_mut::<3>();
assert_eq!(c2.nth_back(0).unwrap(), &[0, 1, 2]);
assert_eq!(c2.next(), None);
assert_eq!(c2.next_back(), None);
let v3: &mut [i32] = &mut [0, 1, 2, 3, 4];
let mut c3 = v3.array_chunks_mut::<10>();
assert_eq!(c3.nth_back(0), None);
} | rust_cleaned_test_functions.jsonl/9652 | {
"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,
3858,
65470,
29523,
78342,
3895,
368,
341,
262,
1077,
348,
25,
609,
6984,
508,
72,
18,
17,
60,
284,
609,
6984,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_striptags() {
let tests = vec![
(r"<b>Joel</b> <button>is</button> a <span>slug</span>", "Joel is a slug"),
(r#"<p>just a small \n <a href="x"> example</a> link</p>\n<p>to a webpage</p><!-- <p>and some commented stuff</p> -->"#,
r#"just a small \n example link\nto a webpage"#),
(r"<p>See: 'é is an apostrophe followed by e acute</p>", r"See: 'é is an apostrophe followed by e acute"),
(r"<adf>a", "a"),
(r"</adf>a", "a"),
(r"<asdf><asdf>e", "e"),
(r"hi, <f x", "hi, <f x"),
("234<235, right?", "234<235, right?"),
("a4<a5 right?", "a4<a5 right?"),
("b7>b2!", "b7>b2!"),
("</fe", "</fe"),
("<x>b<y>", "b"),
(r#"a<p a >b</p>c"#, "abc"),
(r#"d<a:b c:d>e</p>f"#, "def"),
(r#"<strong>foo</strong><a href="http://example.com">bar</a>"#, "foobar"),
];
for (input, expected) in tests {
let result = striptags(to_value(input).unwrap(), HashMap::new());
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(expected).unwrap());
}
} | rust_cleaned_test_functions.jsonl/49424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 708
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
461,
417,
2032,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
81,
22476,
65,
29,
22493,
301,
522,
65,
29,
366,
2159,
29,
285,
522,
2159,
29,
264,
366,
1480,
29,
15125,
522,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_handle_truncate() {
let data = vec![
(1, Some("name:0"), 2),
(2, Some("name:4"), 3),
(4, Some("name:3"), 1),
(5, Some("name:1"), 4),
];
let product = ProductTable::new();
let (_, endpoint) = init_with_data(&product, &data);
let cols = product.table.get_table_columns();
let cases = vec![
{
// count > "2x"
let mut col = Expr::new();
col.set_tp(ExprType::ColumnRef);
let count_offset = offset_for_column(&cols, product.count.id);
col.mut_val().encode_i64(count_offset).unwrap();
// "2x" will be truncated.
let mut value = Expr::new();
value.set_tp(ExprType::String);
value.set_val(String::from("2x").into_bytes());
let mut right = Expr::new();
right.set_tp(ExprType::ScalarFunc);
right.set_sig(ScalarFuncSig::CastStringAsInt);
right.mut_children().push(value);
let mut cond = Expr::new();
cond.set_tp(ExprType::ScalarFunc);
cond.set_sig(ScalarFuncSig::LTInt);
cond.mut_children().push(col);
cond.mut_children().push(right);
cond
},
{
// id
let mut col_id = Expr::new();
col_id.set_tp(ExprType::ColumnRef);
let id_offset = offset_for_column(&cols, product.id.id);
col_id.mut_val().encode_i64(id_offset).unwrap();
// "3x" will be truncated.
let mut value = Expr::new();
value.set_tp(ExprType::String);
value.set_val(String::from("3x").into_bytes());
let mut int_3 = Expr::new();
int_3.set_tp(ExprType::ScalarFunc);
int_3.set_sig(ScalarFuncSig::CastStringAsInt);
int_3.mut_children().push(value);
// count
let mut col_count = Expr::new();
col_count.set_tp(ExprType::ColumnRef);
let count_offset = offset_for_column(&cols, product.count.id);
col_count.mut_val().encode_i64(count_offset).unwrap();
// "3x" + count
let mut plus = Expr::new();
plus.set_tp(ExprType::ScalarFunc);
plus.set_sig(ScalarFuncSig::PlusInt);
plus.mut_children().push(int_3);
plus.mut_children().push(col_count);
// id = "3x" + count
let mut cond = Expr::new();
cond.set_tp(ExprType::ScalarFunc);
cond.set_sig(ScalarFuncSig::EQInt);
cond.mut_children().push(col_id);
cond.mut_children().push(plus);
cond
},
];
for cond in cases {
// Ignore truncate error.
let req = DAGSelect::from(&product.table)
.where_expr(cond.clone())
.build_with(Context::new(), &[FLAG_IGNORE_TRUNCATE]);
let resp = handle_select(&endpoint, req);
assert!(!resp.has_error());
assert!(resp.get_warnings().is_empty());
// truncate as warning
let req = DAGSelect::from(&product.table)
.where_expr(cond.clone())
.build_with(Context::new(), &[FLAG_TRUNCATE_AS_WARNING]);
let mut resp = handle_select(&endpoint, req);
assert!(!resp.has_error());
assert!(!resp.get_warnings().is_empty());
// check data
let mut spliter = DAGChunkSpliter::new(resp.take_chunks().into_vec(), 3);
let row = spliter.next().unwrap();
let (id, name, cnt) = data[2];
let name_datum = name.map(|s| s.as_bytes()).into();
let expected_encoded =
datum::encode_value(&[Datum::I64(id), name_datum, cnt.into()]).unwrap();
let result_encoded = datum::encode_value(&row).unwrap();
assert_eq!(&*result_encoded, &*expected_encoded);
assert_eq!(spliter.next().is_none(), true);
// Do NOT ignore truncate error.
let req = DAGSelect::from(&product.table)
.where_expr(cond.clone())
.build();
let mut resp = handle_select(&endpoint, req);
assert!(resp.has_error());
assert!(resp.get_warnings().is_empty());
}
} | rust_cleaned_test_functions.jsonl/34869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
3547,
26900,
368,
341,
262,
1077,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
19,
3975,
220,
18,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_nth() {
let mut args = HashMap::new();
args.insert("n".to_string(), to_value(1).unwrap());
let result = nth(&to_value(&vec![1, 2, 3, 4]).unwrap(), &args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(&2).unwrap());
} | rust_cleaned_test_functions.jsonl/62040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78342,
368,
341,
286,
1077,
5206,
2827,
284,
10528,
486,
931,
543,
286,
2827,
7030,
445,
77,
3263,
983,
3904,
1507,
311,
3142,
7,
16,
568,
15454,
1423,
286,
1077,
1102,
284,
55129,
2099,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_operation_names() {
#[post("/", data = "<request>")]
fn post_graphql_assert_operation_name_handler(
context: State<Database>,
request: super::GraphQLRequest,
schema: State<Schema>,
) -> super::GraphQLResponse {
assert_eq!(request.operation_names(), vec![Some("TestQuery")]);
request.execute(&schema, &context)
}
let rocket = make_rocket_without_routes()
.mount("/", routes![post_graphql_assert_operation_name_handler]);
let client = Client::new(rocket).expect("valid rocket");
let req = client
.post("/")
.header(ContentType::JSON)
.body(r#"{"query": "query TestQuery {hero{name}}", "operationName": "TestQuery"}"#);
let resp = make_test_response(&req);
assert_eq!(resp.status_code, 200);
} | rust_cleaned_test_functions.jsonl/100772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32565,
9187,
368,
341,
286,
11506,
2203,
35460,
821,
284,
4055,
2035,
29,
5422,
286,
5168,
1736,
14738,
1470,
16553,
32565,
1269,
10183,
1006,
310,
2266,
25,
3234,
27,
5988,
12520,
310,
1681,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_select_all_fields_by_asterisk_limit_100() {
let query_plan = convert_select_to_query_plan(
"SELECT * FROM KibanaSampleDataEcommerce LIMIT 100".to_string(),
DatabaseProtocol::MySQL,
);
assert_eq!(
query_plan
.as_logical_plan()
.find_cube_scan()
.request
.dimensions,
Some(vec![
"KibanaSampleDataEcommerce.order_date".to_string(),
"KibanaSampleDataEcommerce.customer_gender".to_string(),
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
"KibanaSampleDataEcommerce.has_subscription".to_string(),
])
)
} | rust_cleaned_test_functions.jsonl/59245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
5705,
12132,
3710,
62,
2300,
3187,
14763,
62,
16,
15,
15,
368,
341,
286,
1077,
3239,
26564,
284,
5508,
13051,
2346,
5738,
26564,
1006,
310,
330,
4858,
353,
4295,
730,
579,
3362,
17571,
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_lmdb_builder() {
let store = LMDBBuilder::new()
.set_path(env::temp_dir())
.set_env_config(LMDBConfig::default())
.set_max_number_of_databases(10)
.add_database("db1", db::CREATE)
.add_database("db2", db::CREATE)
.build()
.unwrap();
assert_eq!(store.databases.len(), 2);
} | rust_cleaned_test_functions.jsonl/19366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
78127,
28532,
368,
341,
286,
1077,
3553,
284,
46414,
3506,
3297,
486,
931,
741,
310,
659,
746,
2638,
16978,
486,
3888,
4334,
2398,
310,
659,
746,
15879,
5332,
4957,
56429,
2648,
486,
2258,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concat_str() {
let a = Series::new("a", &["foo", "bar"]);
let b = Series::new("b", &["spam", "ham"]);
let a = concat_str(&[a, b], "_").unwrap();
assert_eq!(Vec::from(&a), &[Some("foo_spam"), Some("bar_ham")]);
} | rust_cleaned_test_functions.jsonl/95788 | {
"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,
57478,
2895,
368,
341,
286,
1077,
264,
284,
11131,
486,
931,
445,
64,
497,
609,
1183,
7975,
497,
330,
2257,
15049,
286,
1077,
293,
284,
11131,
486,
931,
445,
65,
497,
609,
1183,
75545,
497,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part2() {
assert_eq!(part2("[1,2,3]"), 6);
assert_eq!(part2(r#"[1,{"c":"red","b":2},3]"#), 4);
assert_eq!(part2(r#"{"d":"red","e":[1,2,3,4],"f":5}"#), 0);
assert_eq!(part2(r#"[1,"red",5]"#), 6);
} | rust_cleaned_test_functions.jsonl/115543 | {
"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,
10495,
17,
368,
341,
286,
2060,
10714,
10297,
4480,
17,
10937,
16,
11,
17,
11,
18,
60,
3975,
220,
21,
317,
286,
2060,
10714,
10297,
4480,
17,
2601,
2,
36864,
16,
54729,
66,
3252,
1151,
2198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_tokenizer() {
let table_create = TableCreateCommand::new("Test".to_string())
.default_tokenizer(TokenizerType::BigramSplitSymbolAlpha);
let mut arg: HashMap<String, String> = HashMap::new();
arg.insert("default_tokenizer".to_string(),
"TokenBigramSplitSymbolAlpha".to_string());
let expected = TableCreateCommand {
command: TableCreate,
name: "Test".to_string(),
arguments: arg,
};
assert_eq!(expected, table_create);
} | rust_cleaned_test_functions.jsonl/74222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
6458,
3135,
368,
341,
286,
1077,
1965,
8657,
284,
6633,
4021,
4062,
486,
931,
445,
2271,
3263,
983,
3904,
2398,
310,
659,
2258,
6458,
3135,
7,
37434,
929,
486,
15636,
2396,
20193,
15090,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_destruct() {
#[derive(Debug, Template)]
#[template_inline = "x: {{ x }}, y: {{ self.y }}"]
struct MyTemplate {
x: i32,
y: i32,
}
assert_render!(MyTemplate { x: 12, y: 3 }, "x: 12, y: 3");
} | rust_cleaned_test_functions.jsonl/110464 | {
"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,
2259,
1235,
368,
341,
262,
11506,
27098,
42618,
11,
14355,
5563,
262,
11506,
4214,
41871,
284,
330,
87,
25,
5867,
856,
335,
2137,
379,
25,
5867,
656,
2384,
3869,
7026,
262,
2036,
3017,
7275,
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_is_coinbase () {
use network::constants::Network;
use blockdata::constants;
let genesis = constants::genesis_block(Network::Bitcoin);
assert! (genesis.txdata[0].is_coin_base());
let tx_bytes = Vec::from_hex("0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000").unwrap();
let tx: Transaction = deserialize(&tx_bytes).unwrap();
assert!(!tx.is_coin_base());
} | rust_cleaned_test_functions.jsonl/326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
75718,
3152,
1719,
341,
286,
990,
3922,
486,
15763,
486,
12320,
280,
286,
990,
2504,
691,
486,
15763,
401,
286,
1077,
59366,
284,
18021,
486,
77894,
7113,
77623,
486,
48287,
317,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trigger_right_hook() {
let mut host = CoprocessorHost::default();
let ob = TestCoprocessor::default();
host.registry
.register_admin_observer(1, BoxAdminObserver::new(ob.clone()));
host.registry
.register_query_observer(1, BoxQueryObserver::new(ob.clone()));
host.registry
.register_apply_snapshot_observer(1, BoxApplySnapshotObserver::new(ob.clone()));
host.registry
.register_role_observer(1, BoxRoleObserver::new(ob.clone()));
host.registry
.register_region_change_observer(1, BoxRegionChangeObserver::new(ob.clone()));
let region = Region::default();
let mut admin_req = RaftCmdRequest::default();
admin_req.set_admin_request(AdminRequest::default());
host.pre_propose(®ion, &mut admin_req).unwrap();
assert_all!(&[&ob.called], &[1]);
host.pre_apply(®ion, &admin_req);
assert_all!(&[&ob.called], &[3]);
let mut admin_resp = RaftCmdResponse::default();
admin_resp.set_admin_response(AdminResponse::default());
host.post_apply(®ion, &mut admin_resp);
assert_all!(&[&ob.called], &[6]);
let mut query_req = RaftCmdRequest::default();
query_req.set_requests(vec![Request::default()].into());
host.pre_propose(®ion, &mut query_req).unwrap();
assert_all!(&[&ob.called], &[10]);
host.pre_apply(®ion, &query_req);
assert_all!(&[&ob.called], &[15]);
host.post_apply(®ion, &mut RaftCmdResponse::default());
assert_all!(&[&ob.called], &[21]);
host.on_role_change(®ion, StateRole::Leader);
assert_all!(&[&ob.called], &[28]);
host.on_region_changed(®ion, RegionChangeEvent::Create, StateRole::Follower);
assert_all!(&[&ob.called], &[36]);
host.pre_apply_plain_kvs_from_snapshot(®ion, "default", &[]);
assert_all!(&[&ob.called], &[45]);
host.pre_apply_sst_from_snapshot(®ion, "default", "");
assert_all!(&[&ob.called], &[55]);
} | rust_cleaned_test_functions.jsonl/23685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 939
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32925,
10539,
32005,
368,
341,
286,
1077,
5206,
3468,
284,
24946,
40848,
269,
9296,
486,
2258,
543,
286,
1077,
1508,
284,
3393,
56277,
40848,
269,
486,
2258,
543,
286,
3468,
55568,
198,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aggregate() -> Result<()> {
let query =
"select sum(number) FROM numbers(1000) group by number % 10 order by sum(number) limit 5;";
let ctx = crate::tests::try_create_context()?;
let plan = crate::tests::parse_query(query, &ctx)?;
let mut optimizer = TopNPushDownOptimizer::create(ctx);
let plan_node = optimizer.optimize(&plan)?;
let expect = "\
Limit: 5\
\n Projection: sum(number):UInt64\
\n Sort: sum(number):UInt64\
\n AggregatorFinal: groupBy=[[(number % 10)]], aggr=[[sum(number)]]\
\n AggregatorPartial: groupBy=[[(number % 10)]], aggr=[[sum(number)]]\
\n Expression: (number % 10):UInt8, number:UInt64 (Before GroupBy)\
\n ReadDataSource: scan partitions: [8], scan schema: [number:UInt64], statistics: [read_rows: 1000, read_bytes: 8000]";
let actual = format!("{:?}", plan_node);
assert_eq!(expect, actual);
Ok(())
} | rust_cleaned_test_functions.jsonl/52998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
14240,
368,
1464,
5714,
71698,
341,
262,
1077,
3239,
4035,
286,
330,
1742,
2629,
17918,
8,
4295,
5109,
7,
16,
15,
15,
15,
8,
1874,
553,
1372,
1018,
220,
16,
15,
1973,
553,
2629,
17918,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_shared_ownership() {
let button = Button::new();
{
let dialog = Dialog::new();
dialog.append(&button as &Control).unwrap();
}
button.handle();
button.set_title("Hello");
} | rust_cleaned_test_functions.jsonl/27069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20405,
62,
78147,
368,
341,
262,
1077,
3137,
284,
6601,
486,
931,
543,
262,
341,
286,
1077,
7254,
284,
13393,
486,
931,
543,
286,
7254,
2057,
2099,
2159,
438,
609,
3273,
568,
15454,
543,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_basics() {
let mut context = VMContextBuilder::new();
testing_env!(context.build());
let mut contract = Contract::new(owner(), String::from("TBD"), String::from("TBD"), 24);
testing_env!(context
.attached_deposit(125 * env::storage_byte_cost())
.build());
contract.mint(accounts(0), 1_000_000.into());
assert_eq!(contract.ft_balance_of(accounts(0)), 1_000_000.into());
testing_env!(context
.attached_deposit(125 * env::storage_byte_cost())
.build());
contract.storage_deposit(Some(accounts(1)), None);
testing_env!(context
.attached_deposit(1)
.predecessor_account_id(accounts(0))
.build());
contract.ft_transfer(accounts(1), 1_000.into(), None);
assert_eq!(contract.ft_balance_of(accounts(1)), 1_000.into());
contract.burn(accounts(1), 500.into());
assert_eq!(contract.ft_balance_of(accounts(1)), 500.into());
} | rust_cleaned_test_functions.jsonl/118565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
67981,
368,
341,
286,
1077,
5206,
2266,
284,
17792,
1972,
3297,
486,
931,
543,
286,
7497,
15879,
10297,
2147,
13239,
1423,
286,
1077,
5206,
5116,
284,
19185,
486,
931,
39805,
1507,
923,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.