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_unpack_tarball() {
let file = get_test_tar();
let mut archive = Archive::new(file.as_slice());
let mut lines = Vec::new();
let tmp_dir = tempfile::TempDir::new().unwrap();
unpack_tarball_impl(
&mut archive,
Path::new("myArchive.tar"),
tmp_dir.path(),
|s| lines.push(s.to_string()),
)
.unwrap();
let unpack_dir = tmp_dir.path().join("myArchive");
assert_eq!(
lines,
vec![format!("unpacked to {}", unpack_dir.display())]
);
assert_eq!(
get_dir_contents(&unpack_dir).unwrap(),
vec![
unpack_dir.join("Cargo.lock"),
unpack_dir.join("Cargo.toml"),
unpack_dir.join("LICENSE"),
]
);
} | rust_cleaned_test_functions.jsonl/66598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54889,
66608,
3959,
368,
341,
286,
1077,
1034,
284,
633,
4452,
66608,
543,
286,
1077,
5206,
18132,
284,
29702,
486,
931,
4866,
5357,
26488,
5231,
286,
1077,
5206,
5128,
284,
11312,
486,
931,
1428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_non_existence() {
let db = MockTreeStore::default();
let tree = JellyfishMerkleTree::new(&db);
// ```text
// internal 2
// internal
// Total: 7 nodes
let key1 = HashValue::new([0x00u8; HashValue::LENGTH]);
let value1 = gen_value();
let key2 = update_nibble(&key1, 0, 15);
let value2 = gen_value();
let key3 = update_nibble(&key1, 2, 3);
let value3 = gen_value();
let (roots, batch) = tree
.batch_put_value_sets_test(
vec![vec![(key1, &value1), (key2, &value2), (key3, &value3)]],
None,
0, /* version */
)
.unwrap();
db.write_tree_update_batch(batch).unwrap();
assert_eq!(tree.get(key1, 0).unwrap().unwrap(), value1.0);
assert_eq!(tree.get(key2, 0).unwrap().unwrap(), value2.0);
assert_eq!(tree.get(key3, 0).unwrap().unwrap(), value3.0);
// get # of nodes
assert_eq!(db.num_nodes(), 6);
// test non-existing nodes.
// 1. Non-existing node at root node
{
let non_existing_key = update_nibble(&key1, 0, 1);
let (value, proof) = tree.get_with_proof(non_existing_key, 0).unwrap();
assert_eq!(value, None);
assert!(proof
.verify_by_hash(roots[0], non_existing_key, None)
.is_ok());
}
// 2. Non-existing node at non-root internal node
{
let non_existing_key = update_nibble(&key1, 1, 15);
let (value, proof) = tree.get_with_proof(non_existing_key, 0).unwrap();
assert_eq!(value, None);
assert!(proof
.verify_by_hash(roots[0], non_existing_key, None)
.is_ok());
}
// 3. Non-existing node at leaf node
{
let non_existing_key = update_nibble(&key1, 2, 4);
let (value, proof) = tree.get_with_proof(non_existing_key, 0).unwrap();
assert_eq!(value, None);
assert!(proof
.verify_by_hash(roots[0], non_existing_key, None)
.is_ok());
}
} | rust_cleaned_test_functions.jsonl/9456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1010
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
35906,
763,
368,
341,
262,
1077,
2927,
284,
14563,
6533,
6093,
486,
2258,
543,
262,
1077,
4916,
284,
73139,
18170,
44,
16754,
273,
6533,
486,
931,
2099,
1999,
317,
262,
442,
54275,
1318,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let a = BigUint::new(vec!());
let b = BigUint::new(vec!(0));
let c = BigUint::new(vec!(1));
let d = BigUint::new(vec!(1,0,0,0,0,0));
let e = BigUint::new(vec!(0,0,0,0,0,1));
assert!(::hash(&a) == ::hash(&b));
assert!(::hash(&b) != ::hash(&c));
assert!(::hash(&c) == ::hash(&d));
assert!(::hash(&d) != ::hash(&e));
} | rust_cleaned_test_functions.jsonl/90115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
368,
341,
286,
1077,
264,
284,
6164,
21570,
486,
931,
25592,
0,
1423,
286,
1077,
293,
284,
6164,
21570,
486,
931,
25592,
10297,
15,
1106,
286,
1077,
272,
284,
6164,
21570,
486,
931,
25592,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_transaction_fee() {
{
// Zero fees gets rejected
let (tx, _ledger) = create_test_tx_with_amount(INITIALIZE_LEDGER_AMOUNT, 0);
assert_eq!(
validate_transaction_fee(&tx),
Err(TransactionValidationError::TxFeeError)
);
}
{
// Off by one fee gets rejected
let fee = BASE_FEE - 1;
let (tx, _ledger) = create_test_tx_with_amount(INITIALIZE_LEDGER_AMOUNT - fee, fee);
assert_eq!(
validate_transaction_fee(&tx),
Err(TransactionValidationError::TxFeeError)
);
}
{
// Exact fee amount is okay
let (tx, _ledger) =
create_test_tx_with_amount(INITIALIZE_LEDGER_AMOUNT - BASE_FEE, BASE_FEE);
assert_eq!(validate_transaction_fee(&tx), Ok(()));
}
{
// Overpaying fees is okay
let fee = BASE_FEE + 1;
let (tx, _ledger) = create_test_tx_with_amount(INITIALIZE_LEDGER_AMOUNT - fee, fee);
assert_eq!(validate_transaction_fee(&tx), Ok(()));
}
} | rust_cleaned_test_functions.jsonl/33280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 649
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
28884,
34305,
368,
341,
286,
341,
310,
442,
18306,
12436,
5221,
17551,
198,
310,
1077,
320,
3998,
11,
716,
50704,
8,
284,
1855,
4452,
17805,
6615,
13471,
23515,
952,
6208,
3282,
37604,
8738... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_column_convert_mut() {
let mut a: Matrix<i64> = matrix![1, 2, 3, 4;
5, 6, 7, 8;
9, 10, 11, 12];
let row = a.col_mut(1);
let v: Vector<i64> = row.into();
assert_eq!(v, vector![2, 6, 10]);
let mut a: Matrix<i64> = matrix![1, 2, 3, 4;
5, 6, 7, 8;
9, 10, 11, 12];
let row = a.col_mut(2);
let v = Vector::from(row);
assert_eq!(v, vector![3, 7, 11]);
} | rust_cleaned_test_functions.jsonl/43653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
34910,
29523,
368,
341,
286,
1077,
5206,
264,
25,
11631,
21897,
21,
19,
29,
284,
6172,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
280,
12841,
220,
20,
11,
220,
21,
11,
220,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_grammar() {
let g = wrap_grammar_with_start(examples::make_simple()).unwrap();
let nullables = calculate_nullables(&g).unwrap();
assert!(nullables.get_nullable_set().is_empty());
} | rust_cleaned_test_functions.jsonl/27890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
62,
41094,
368,
341,
262,
1077,
342,
284,
15061,
62,
41094,
6615,
4906,
5463,
4023,
486,
6927,
30015,
6011,
15454,
543,
262,
1077,
845,
4788,
284,
11047,
15162,
4788,
2099,
70,
568,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_temporary_nodes_are_used_to_calculate_hashes_first() {
let mut rng = CustomRng;
let mut tree = MerkleTree::new(create(3), POOL_PARAMS.clone());
let hash0: Hash<_> = rng.gen();
let hash1: Hash<_> = rng.gen();
// add hash for index 0
tree.add_hash(0, hash0.clone(), true);
// add hash for index 1
tree.add_hash(1, hash1.clone(), false);
let parent_hash = tree.get(1, 0);
let expected_parent_hash = poseidon([hash0, hash1].as_ref(), POOL_PARAMS.compress());
assert_eq!(parent_hash, expected_parent_hash);
} | rust_cleaned_test_functions.jsonl/23753 | {
"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,
11771,
7592,
14896,
56855,
27803,
2346,
24005,
11207,
91616,
12978,
368,
341,
286,
1077,
5206,
28422,
284,
8406,
49,
968,
280,
286,
1077,
5206,
4916,
284,
8755,
23089,
6533,
486,
931,
32602,
7,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq12_mul_by_014() {
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc, 0xe5,
]);
for _ in 0..1000 {
let c0 = Fq2::random(&mut rng);
let c1 = Fq2::random(&mut rng);
let c5 = Fq2::random(&mut rng);
let mut a = Fq12::random(&mut rng);
let mut b = a;
a.mul_by_014(&c0, &c1, &c5);
b.mul_assign(&Fq12 {
c0: Fq6 {
c0,
c1,
c2: Fq2::zero(),
},
c1: Fq6 {
c0: Fq2::zero(),
c1: c5,
c2: Fq2::zero(),
},
});
assert_eq!(a, b);
}
} | rust_cleaned_test_functions.jsonl/12965 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
16,
17,
24944,
3710,
62,
15,
16,
19,
368,
341,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
286,
220,
15,
87,
20,
24,
11,
220,
15,
87,
21,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_set_root_key() {
let mut tree = Tree::new();
// Should fail because node does not exist in the map yet
assert!(tree.set_root_key("root").is_err());
// Should pass because node exists
let root_node = Node::new("root", "Anode.");
tree.nodes.insert("root".to_owned(), root_node);
assert!(tree.set_root_key("root").is_ok());
// Ensure root key was set
assert_eq!("root", tree.root_key().unwrap());
} | rust_cleaned_test_functions.jsonl/110232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
12993,
3097,
368,
341,
262,
1077,
5206,
4916,
284,
8942,
486,
931,
1428,
262,
442,
12260,
3690,
1576,
2436,
1558,
537,
3000,
304,
279,
2415,
3602,
198,
262,
2060,
10297,
9344,
980,
12993,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_isize() {
check_round_trip(vec![-1, 2, -3, ::std::isize::MIN, 0, 1, ::std::isize::MAX, 2, 1]);
} | rust_cleaned_test_functions.jsonl/24190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
551,
368,
341,
262,
1779,
29896,
63883,
25592,
0,
7609,
16,
11,
220,
17,
11,
481,
18,
11,
3504,
1834,
486,
285,
551,
486,
16413,
11,
220,
15,
11,
220,
16,
11,
3504,
1834,
486,
285,
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 |
#[test]
fn test_aes256_cfb8() {
let pt = "6bc1bee22e409f96e93d7e117393172aae2d";
let ct = "dc1f1a8520a64db55fcc8ac554844e889700";
let key = "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
let iv = "000102030405060708090a0b0c0d0e0f";
cipher_test(super::Cipher::aes_256_cfb8(), pt, ct, key, iv);
} | rust_cleaned_test_functions.jsonl/110547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90958,
17,
20,
21,
666,
10798,
23,
368,
341,
286,
1077,
10817,
284,
330,
21,
8904,
16,
32031,
17,
17,
68,
19,
15,
24,
69,
24,
21,
68,
24,
18,
67,
22,
68,
16,
16,
22,
18,
24,
18,
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_test_mathfuncptr() {
assert_emscripten_output!(
"../../emtests/test_mathfuncptr.wasm",
"test_mathfuncptr",
vec![],
"../../emtests/test_mathfuncptr.out"
);
} | rust_cleaned_test_functions.jsonl/117947 | {
"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,
4452,
65561,
2830,
3505,
368,
341,
262,
2060,
22504,
2282,
268,
7645,
33673,
286,
10208,
336,
23841,
12697,
65561,
2830,
3505,
1418,
10530,
756,
286,
330,
1944,
65561,
2830,
3505,
756,
286,
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 |
#[test]
fn test_documents_ensure_no_duplicates() {
// but we'll guard against it anyway
let (mut documents, documents_path) = setup();
let file_path = documents_path.join("file.ts");
let file_specifier = ModuleSpecifier::from_file_path(&file_path).unwrap();
fs::create_dir_all(&documents_path).unwrap();
fs::write(&file_path, "").unwrap();
// open the document
documents.open(
file_specifier.clone(),
1,
LanguageId::TypeScript,
Default::default(),
);
// make a clone of the document store and close the document in that one
let mut documents2 = documents.clone();
documents2.close(&file_specifier).unwrap();
// At this point the document will be in both documents and the shared file system documents.
// Now make sure that the original documents doesn't return both copies
assert_eq!(documents.documents(false, false).len(), 1);
} | rust_cleaned_test_functions.jsonl/53617 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75927,
62,
27289,
6536,
75051,
368,
341,
1066,
262,
442,
714,
582,
3278,
7616,
2348,
432,
13657,
198,
262,
1077,
320,
6984,
9293,
11,
9293,
2638,
8,
284,
6505,
543,
262,
1077,
1034,
2638,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ints() {
let b = Builder::new();
let mut set = HashSet::new();
for _ in 0..1000 {
let a = b.alloc::<u32>();
let addr: usize = a as *const u32 as usize;
assert!(!set.contains(&addr));
set.insert(addr);
}
} | rust_cleaned_test_functions.jsonl/134744 | {
"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,
4042,
82,
368,
341,
286,
1077,
293,
284,
20626,
486,
931,
543,
286,
1077,
5206,
738,
284,
18931,
486,
931,
1428,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
310,
1077,
264,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_merge_with_hashmap() {
let mut instant_effects1 = Vec::new();
let attacker_pos = PosHex { q: 0, r: 0 };
let effect_kill: Effect = effect::Kill {
attacker_pos: Some(attacker_pos),
}
.into();
instant_effects1.push((Id(0), vec![effect_kill.clone(), Effect::Stun]));
let mut context1 = ExecuteContext {
instant_effects: instant_effects1,
..Default::default()
};
let effect_dodge = effect::Dodge { attacker_pos };
let instant_effects2 = vec![(Id(0), vec![Effect::Vanish, effect_dodge.clone().into()])];
let context2 = ExecuteContext {
instant_effects: instant_effects2,
..Default::default()
};
let instant_effects_expected = vec![(
Id(0),
vec![
effect_kill,
Effect::Stun,
Effect::Vanish,
effect_dodge.into(),
],
)];
let context_expected = ExecuteContext {
instant_effects: instant_effects_expected,
..Default::default()
};
context1.merge_with(context2);
assert_eq!(context_expected, context1);
} | rust_cleaned_test_functions.jsonl/8685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
6615,
8950,
2186,
368,
341,
286,
1077,
5206,
9690,
83171,
16,
284,
11312,
486,
931,
543,
286,
1077,
30710,
6479,
284,
18876,
20335,
314,
2804,
25,
220,
15,
11,
435,
25,
220,
15,
2605,
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_decode_med() {
let mut buf = [Hexbit::default(); 24];
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
.iter()
.map(|&b| Hexbit::new(b))
.collect_slice(&mut buf[..]);
medium::encode(&mut buf);
buf[0] = Hexbit::new(0o00);
buf[10] = Hexbit::new(0o60);
buf[16] = Hexbit::new(0o42);
buf[23] = Hexbit::new(0o14);
let dec = medium::decode(&mut buf);
let exp = [
Hexbit::new(1),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
Hexbit::new(0),
];
assert_eq!(dec, Some((&exp[..], 4)));
} | rust_cleaned_test_functions.jsonl/39697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 623
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
44085,
368,
341,
286,
1077,
5206,
6607,
284,
508,
20335,
4489,
486,
2258,
2129,
220,
17,
19,
935,
286,
508,
16,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_multiple_ids() {
let buf = "one <@123>two<#456><@789> ----";
let mut iter = Id::<UserMarker>::iter(buf);
assert_eq!(Id::new(123), iter.next().unwrap().0);
let (mention, start, end) = iter.next().unwrap();
assert_eq!(Id::new(789), mention);
assert_eq!(19, start);
assert_eq!(24, end);
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/99683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
45233,
8077,
368,
341,
286,
1077,
6607,
284,
330,
603,
366,
31,
16,
17,
18,
29,
19789,
27,
2,
19,
20,
21,
1784,
31,
22,
23,
24,
29,
11304,
876,
286,
1077,
5206,
5367,
284,
5223,
276... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compilation_multi() {
let mut names: Vec<*const i8> = Vec::new();
let mut texts: Vec<*const i8> = Vec::new();
let name1 = CString::new("test1.sv").unwrap();
let name2 = CString::new("test2.sv").unwrap();
let name3 = CString::new("test3.sv").unwrap();
names.push(name1.as_ptr());
names.push(name2.as_ptr());
names.push(name3.as_ptr());
let text1 =
CString::new("module test1; logic [1:0] abc; assign abc[2] = 1'b1; endmodule").unwrap();
let text2 =
CString::new("module test2; logic [1:0] abc; assign abc[2] = 1'b1; endmodule").unwrap();
let text3 =
CString::new("module test3; logic [1:0] abc; assign abc[2] = 1'b1; endmodule").unwrap();
texts.push(text1.as_ptr());
texts.push(text2.as_ptr());
texts.push(text3.as_ptr());
let report_raw = unsafe { compile_sources(names.as_mut_ptr(), texts.as_mut_ptr(), 3) };
let report: &CStr = unsafe { CStr::from_ptr(report_raw) };
let expected = "test1.sv:1:43: error: cannot refer to element 2 of \'logic[1:0]\'\ntest2.sv:1:43: error: cannot refer to element 2 of \'logic[1:0]\'\ntest3.sv:1:43: error: cannot refer to element 2 of \'logic[1:0]\'\n";
let result = report.to_str().unwrap();
assert_eq!(result, expected);
unsafe {
delete_report(report_raw);
}
} | rust_cleaned_test_functions.jsonl/96203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 683
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
13455,
25133,
368,
341,
286,
1077,
5206,
5036,
25,
11312,
78822,
1024,
600,
23,
29,
284,
11312,
486,
931,
543,
286,
1077,
5206,
21984,
25,
11312,
78822,
1024,
600,
23,
29,
284,
11312,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pathify() {
let db = DB::new("./wiki/");
assert_eq!(
"./wiki/keyboard_shortcuts.md",
db.pathify("keyboard shortcuts")
);
assert_eq!("./wiki/Coool.md", db.pathify("Coool!!"));
} | rust_cleaned_test_functions.jsonl/73780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
1437,
368,
341,
286,
1077,
2927,
284,
5952,
486,
931,
13988,
29707,
49897,
286,
2060,
10714,
33673,
310,
5924,
29707,
14,
41713,
16673,
22497,
21324,
756,
310,
2927,
3875,
1437,
445,
41713,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_real() {
let test_cases = vec![
(Some(Real::from(-3.12_f64)), Some(Real::from(-3f64))),
(Some(Real::from(f64::MAX)), Some(Real::from(f64::MAX))),
(Some(Real::from(f64::MIN)), Some(Real::from(f64::MIN))),
(None, None),
];
for (arg, exp) in test_cases {
let got = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate::<Real>(ScalarFuncSig::RoundReal)
.unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/37507 | {
"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,
29896,
15266,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
8373,
7,
12768,
486,
1499,
4080,
18,
13,
16,
17,
761,
21,
19,
5731,
4329,
7,
12768,
486,
1499,
4080,
18,
69,
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... | 2 |
#[test]
fn test_merge_includes() {
let input1 = r#"
<eww>
<definitions>
<def name="test1">
<box orientation="v">
{{var1}}
</box>
</def>
</definitions>
<variables>
<var name="var1">var1</var>
</variables>
<windows>
<window name="window1">
<size x="100" y="200" />
<pos x="100" y="200" />
<widget>
<test1 name="test2" />
</widget>
</window>
</windows>
</eww>
"#;
let input2 = r#"
<eww>
<definitions>
<def name="test2">
<box orientation="v">
{{var2}}
</box>
</def>
</definitions>
<variables>
<var name="var2">var2</var>
</variables>
<windows>
<window name="window2">
<size x="100" y="200" />
<pos x="100" y="200" />
<widget>
<test2 name="test2" />
</widget>
</window>
</windows>
</eww>
"#;
let document1 = roxmltree::Document::parse(&input1).unwrap();
let document2 = roxmltree::Document::parse(input2).unwrap();
let config1 = EwwConfig::from_xml_element(XmlNode::from(document1.root_element()).as_element().unwrap().clone(), "")
.unwrap()
.0;
let config2 = EwwConfig::from_xml_element(XmlNode::from(document2.root_element()).as_element().unwrap().clone(), "")
.unwrap()
.0;
let base_config = EwwConfig {
widgets: HashMap::new(),
windows: HashMap::new(),
initial_variables: HashMap::new(),
script_vars: HashMap::new(),
filepath: "test_path".into(),
};
let merged_config = EwwConfig::merge_includes(base_config, vec![config1, config2]).unwrap();
assert_eq!(merged_config.widgets.len(), 2);
assert_eq!(merged_config.windows.len(), 2);
assert_eq!(merged_config.initial_variables.len(), 2);
assert_eq!(merged_config.script_vars.len(), 0);
} | rust_cleaned_test_functions.jsonl/18855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
1243,
7396,
368,
341,
286,
1077,
1946,
16,
284,
435,
2,
698,
1843,
366,
365,
86,
397,
1060,
366,
48563,
397,
394,
366,
750,
829,
428,
1944,
16,
881,
1698,
366,
2011,
16725,
428,
85,
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... | 1 |
#[test]
fn test_new() {
let gil = Python::acquire_gil();
let py = gil.python();
let ob = PyTuple::new(py, &[1, 2, 3]);
assert_eq!(3, ob.len());
let ob: &PyAny = ob.into();
assert_eq!((1, 2, 3), ob.extract().unwrap());
let mut map = HashSet::new();
map.insert(1);
map.insert(2);
PyTuple::new(py, &map);
} | rust_cleaned_test_functions.jsonl/4176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
1508,
284,
80824,
486,
931,
46827,
11,
44590,
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... | 1 |
#[test]
fn test_compile_not_hl() {
let compiled = bitwise::compile_not("HL".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b11011011);
} | rust_cleaned_test_functions.jsonl/100598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
7913,
1523,
75,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
7913,
445,
13485,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
262,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_csv_record_to_query() {
let inp = CsvRecord {
id: "1".to_string(),
origin_lat: "-37.820189".to_string(),
origin_lon: "145.149954".to_string(),
destination_lat: "-37.819681".to_string(),
destination_lon: "144.952302".to_string(),
departure_time: "1534284000".to_string(),
mode: "driving".to_string(),
avoidances: Option::Some("tolls".to_string()),
traffic_model: Option::Some("best_guess".to_string()),
};
let res = Query {
id: "1".to_string(),
origin: Coord::new(-37.820189, 145.149954).unwrap(),
destination: Coord::new(-37.819681, 144.952302).unwrap(),
departure_time: DepartureTime::new(1537308000).unwrap(),
mode: Mode::Driving,
avoidances: Option::Some(Avoidances::new(&vec![Avoidance::Tolls])),
traffic_model: Option::Some(TrafficModel::BestGuess),
};
assert_eq!(
res,
Query::from_csv_record(inp, &NaiveDateTime::from_timestamp(1536991111, 0),).unwrap()
);
} | rust_cleaned_test_functions.jsonl/75495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 588
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14020,
14192,
2346,
5738,
368,
341,
286,
1077,
32344,
284,
91671,
6471,
341,
310,
877,
25,
330,
16,
3263,
983,
3904,
3148,
310,
6238,
26174,
25,
6523,
18,
22,
13,
23,
17,
15,
16,
23,
24,
326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hw22() {
// our hw doesn't need to be updated
assert_eq!(
compute_hw(
&OffsetInfo { hw: 0, leo: 10 },
2,
&offsets_maps(vec![(5001, OffsetInfo::default())])
),
None
);
// This cause hw = 4 since this is min that is replicated across 2 SPU
assert_eq!(
compute_hw(
&OffsetInfo { hw: 0, leo: 10 },
2,
&offsets_maps(vec![(5001, OffsetInfo { leo: 4, hw: 0 })])
),
Some(4)
);
// we send back follower hw = 4
// This should update hw = 6
assert_eq!(
compute_hw(
&OffsetInfo { hw: 4, leo: 10 },
2,
&offsets_maps(vec![(5001, OffsetInfo { leo: 6, hw: 4 })])
),
Some(6)
);
assert_eq!(
compute_hw(
&OffsetInfo { hw: 6, leo: 10 },
2,
&offsets_maps(vec![(5001, OffsetInfo { leo: 6, hw: 6 })])
),
None
);
// hw should be now 10
assert_eq!(
compute_hw(
&OffsetInfo { hw: 6, leo: 10 },
2,
&offsets_maps(vec![(5001, OffsetInfo { leo: 10, hw: 6 })])
),
Some(10)
);
assert_eq!(
compute_hw(
&OffsetInfo { hw: 10, leo: 10 },
2,
&offsets_maps(vec![(5001, OffsetInfo { leo: 10, hw: 10 })])
),
None
);
} | rust_cleaned_test_functions.jsonl/1567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28792,
17,
17,
368,
341,
23459,
1789,
286,
442,
1039,
31256,
3171,
944,
1184,
311,
387,
6049,
198,
286,
2060,
10714,
33673,
310,
12564,
28792,
1006,
394,
609,
6446,
1731,
314,
31256,
25,
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_chain_genesis_hashes() {
assert_eq!(
GENESIS_HASH_MAINNET,
&[
0x6f, 0xe2, 0x8c, 0x0a, 0xb6, 0xf1, 0xb3, 0x72, 0xc1, 0xa6,
0xa2, 0x46, 0xae, 0x63, 0xf7, 0x4f, 0x93, 0x1e, 0x83, 0x65,
0xe1, 0x5a, 0x08, 0x9c, 0x68, 0xd6, 0x19, 0x00, 0x00, 0x00,
0x00, 0x00,
]
);
assert_eq!(
GENESIS_HASH_TESTNET,
&[
0x43, 0x49, 0x7f, 0xd7, 0xf8, 0x26, 0x95, 0x71, 0x08, 0xf4,
0xa3, 0x0f, 0xd9, 0xce, 0xc3, 0xae, 0xba, 0x79, 0x97, 0x20,
0x84, 0xe9, 0x0e, 0xad, 0x01, 0xea, 0x33, 0x09, 0x00, 0x00,
0x00, 0x00,
]
);
assert_eq!(
GENESIS_HASH_REGTEST,
&[
0x06, 0x22, 0x6e, 0x46, 0x11, 0x1a, 0x0b, 0x59, 0xca, 0xaf,
0x12, 0x60, 0x43, 0xeb, 0x5b, 0xbf, 0x28, 0xc3, 0x4f, 0x3a,
0x5e, 0x33, 0x2a, 0x1f, 0xc7, 0xb2, 0xb7, 0x3c, 0xf1, 0x88,
0x91, 0x0f,
]
);
assert_eq!(
GENESIS_HASH_SIGNET,
&[
0xf6, 0x1e, 0xee, 0x3b, 0x63, 0xa3, 0x80, 0xa4, 0x77, 0xa0,
0x63, 0xaf, 0x32, 0xb2, 0xbb, 0xc9, 0x7c, 0x9f, 0xf9, 0xf0,
0x1f, 0x2c, 0x42, 0x25, 0xe9, 0x73, 0x98, 0x81, 0x08, 0x00,
0x00, 0x00,
]
);
assert_eq!(
GENESIS_HASH_LIQUIDV1,
&[
0x14, 0x66, 0x27, 0x58, 0x36, 0x22, 0x0d, 0xb2, 0x94, 0x4c,
0xa0, 0x59, 0xa3, 0xa1, 0x0e, 0xf6, 0xfd, 0x2e, 0xa6, 0x84,
0xb0, 0x68, 0x8d, 0x2c, 0x37, 0x92, 0x96, 0x88, 0x8a, 0x20,
0x60, 0x03,
]
);
let random_hash = BlockHash::hash(b"random string");
assert_eq!(&Chain::Mainnet.as_genesis_hash()[..], GENESIS_HASH_MAINNET);
assert_eq!(
&Chain::Testnet3.as_genesis_hash()[..],
GENESIS_HASH_TESTNET
);
assert_eq!(
&Chain::Regtest(
BlockHash::from_slice(GENESIS_HASH_REGTEST).unwrap()
)
.as_genesis_hash()[..],
GENESIS_HASH_REGTEST
);
assert_eq!(
&Chain::Regtest(random_hash).as_genesis_hash()[..],
&random_hash[..]
);
assert_eq!(&Chain::Signet.as_genesis_hash()[..], GENESIS_HASH_SIGNET);
assert_eq!(
&Chain::SignetCustom(
BlockHash::from_slice(GENESIS_HASH_SIGNET).unwrap()
)
.as_genesis_hash()[..],
GENESIS_HASH_SIGNET
);
assert_eq!(
&Chain::SignetCustom(random_hash).as_genesis_hash()[..],
&random_hash[..]
);
assert_eq!(
&Chain::LiquidV1.as_genesis_hash()[..],
GENESIS_HASH_LIQUIDV1
);
assert_eq!(
&Chain::Other(Chain::Mainnet.chain_params()).as_genesis_hash()[..],
GENESIS_HASH_MAINNET
);
let mut chain_params = Chain::Mainnet.chain_params();
chain_params.genesis_hash = random_hash;
assert_eq!(
&Chain::Other(chain_params).as_genesis_hash()[..],
&random_hash[..]
);
assert_eq!(
Chain::from_genesis_hash(
&BlockHash::from_slice(GENESIS_HASH_MAINNET).unwrap()
)
.unwrap(),
Chain::Mainnet
);
assert_eq!(
Chain::from_genesis_hash(
&BlockHash::from_slice(GENESIS_HASH_TESTNET).unwrap()
)
.unwrap(),
Chain::Testnet3
);
assert_eq!(
Chain::from_genesis_hash(
&BlockHash::from_slice(GENESIS_HASH_SIGNET).unwrap()
)
.unwrap(),
Chain::Signet
);
assert_eq!(
Chain::from_genesis_hash(
&BlockHash::from_slice(GENESIS_HASH_LIQUIDV1).unwrap()
)
.unwrap(),
Chain::LiquidV1
);
let regtest = Chain::from_genesis_hash(
&BlockHash::from_slice(GENESIS_HASH_REGTEST).unwrap(),
)
.unwrap();
assert_eq!(regtest, Chain::Regtest(*regtest.as_genesis_hash()));
assert_ne!(regtest, Chain::Regtest(random_hash));
assert_eq!(Chain::from_genesis_hash(&random_hash), None);
} | rust_cleaned_test_functions.jsonl/115622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2917
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30583,
16322,
13774,
91616,
368,
341,
286,
2060,
10714,
33673,
310,
42674,
83366,
32309,
32276,
15373,
345,
310,
609,
9640,
394,
220,
15,
87,
21,
69,
11,
220,
15,
8371,
17,
11,
220,
15,
87,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_public_key_to_pem_pkcs1() {
let keypair = super::Rsa::generate(512).unwrap();
let pubkey_pem = keypair.public_key_to_pem_pkcs1().unwrap();
super::Rsa::public_key_from_pem_pkcs1(&pubkey_pem).unwrap();
} | rust_cleaned_test_functions.jsonl/28565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
3097,
2346,
620,
336,
33321,
4837,
16,
368,
341,
286,
1077,
1376,
12670,
284,
2256,
486,
49,
9081,
486,
19366,
7,
20,
16,
17,
568,
15454,
543,
286,
1077,
95116,
620,
336,
284,
1376,
126... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_input_mouse_scroll() {
use super::super::Motion;
let e: Event = Motion::MouseScroll([0.0, 0.0]).into();
let a: Option<Event> = MouseScrollEvent::from_pos([1.0, 0.0], &e);
let b: Option<Event> = a
.clone()
.unwrap()
.mouse_scroll(|pos| MouseScrollEvent::from_pos(pos, a.as_ref().unwrap()))
.unwrap();
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/54698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
39203,
41407,
368,
341,
286,
990,
2256,
486,
9522,
486,
40338,
401,
286,
1077,
384,
25,
3665,
284,
26562,
486,
10493,
8425,
2561,
15,
13,
15,
11,
220,
15,
13,
15,
10697,
18122,
543,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run_functions_args() -> Result<()> {
let query = parse(
r#"
func count x -> s"count({x})"
from employees
aggregate [
count salary
]
"#,
)?;
assert_yaml_snapshot!(query.nodes, @r###"
---
- FuncDef:
name: count
positional_params:
- - Ident: x
- ~
named_params: []
body:
SString:
- String: count(
- Expr:
Ident: x
- String: )
return_type: ~
- Pipeline:
value: ~
functions:
- FuncCall:
name: from
args:
- Ident: employees
named_args: {}
- FuncCall:
name: aggregate
args:
- List:
- FuncCall:
name: count
args:
- Ident: salary
named_args: {}
named_args: {}
"###);
let (res, context) = resolve(query.nodes, None)?;
let pipeline = find_pipeline(res);
let (mat, _, _) = materialize(pipeline.clone(), context.into(), None)?;
// We could make a convenience function for this. It's useful for
// showing the diffs of an operation.
let diff = diff(
&to_string(&pipeline.functions)?,
&to_string(&mat.functions)?,
);
assert!(!diff.is_empty());
assert_display_snapshot!(diff, @r###"
@@ -7,5 +7,9 @@
- Transform:
Aggregate:
assigns:
- - Ident: "<unnamed>"
+ - SString:
+ - String: count(
+ - Expr:
+ Ident: salary
+ - String: )
by: []
"###);
Ok(())
} | rust_cleaned_test_functions.jsonl/90557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
31708,
8384,
368,
1464,
5714,
71698,
341,
286,
1077,
3239,
284,
4715,
1006,
310,
435,
2,
698,
286,
2915,
1760,
856,
1464,
220,
274,
1,
1830,
2306,
87,
5410,
1837,
286,
504,
8256,
198,
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... | 6 |
#[test]
fn test_pcapng_iter_section_interfaces() {
let (_, section) = parse_section(TEST001_LE).expect("could not parse section");
assert_eq!(section.iter_interfaces().count(), 1);
for (idx, interface) in section.iter_interfaces().enumerate() {
println!("found interface {}", idx);
println!(" linktype: {}", interface.linktype);
println!(" snaplen: {}", interface.snaplen);
}
} | rust_cleaned_test_functions.jsonl/132436 | {
"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,
620,
11346,
968,
11723,
16221,
72960,
368,
341,
262,
1077,
39464,
3772,
8,
284,
4715,
16221,
50320,
15,
15,
16,
5280,
568,
17119,
445,
28077,
537,
4715,
3772,
797,
262,
2060,
10714,
10297,
2809,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_basic_args_linter_top_level() {
let genesis_objs = clone_genesis_packages();
let framework_pkg = genesis_objs
.iter()
.find(|q| q.id() == ObjectID::from(SUI_FRAMEWORK_ADDRESS))
.expect("Unable to find framework object");
let module = Identifier::new("Geniteam").unwrap();
let function = Identifier::new("create_monster").unwrap();
let monster_name_raw = "MonsterName";
let monster_img_id_raw = 12345678;
let breed_raw = 89;
let monster_affinity_raw = 200;
let monster_description_raw = "MonsterDescription";
let player_id = json!(format!("0x{:02x}", ObjectID::random()));
let farm_id = json!(format!("0x{:02x}", ObjectID::random()));
let pet_monsters_id = json!(format!("0x{:02x}", ObjectID::random()));
// This is okay since not starting with 0x
let monster_name = json!(monster_name_raw);
// Well within U64 bounds
let monster_img_id = json!(monster_img_id_raw);
// Well within U8 bounds
let breed = json!(breed_raw);
// Well within U8 bounds
let monster_affinity = json!(monster_affinity_raw);
// This is okay since not starting with 0x
let monster_description = json!(monster_description_raw);
// They have to be ordered
let args = vec![
player_id,
farm_id,
pet_monsters_id,
monster_name.clone(),
monster_img_id.clone(),
breed,
monster_affinity.clone(),
monster_description.clone(),
]
.iter()
.map(|q| SuiJsonValue::new(q.clone()).unwrap())
.collect();
let (object_args, pure_args) =
resolve_move_function_args(framework_pkg, module.clone(), function.clone(), args).unwrap();
assert!(!object_args.is_empty());
assert_eq!(
pure_args[0],
bcs::to_bytes(&monster_name_raw.as_bytes().to_vec()).unwrap()
);
assert_eq!(
pure_args[1],
bcs::to_bytes(&(monster_img_id_raw as u64)).unwrap()
);
assert_eq!(pure_args[2], bcs::to_bytes(&(breed_raw as u8)).unwrap());
assert_eq!(
pure_args[3],
bcs::to_bytes(&(monster_affinity_raw as u8)).unwrap()
);
assert_eq!(
pure_args[4],
bcs::to_bytes(&monster_description_raw.as_bytes().to_vec()).unwrap()
);
// Breed is u8 so too large
let args = vec![
monster_name,
monster_img_id,
json!(10000u64),
monster_affinity,
monster_description,
]
.iter()
.map(|q| SuiJsonValue::new(q.clone()).unwrap())
.collect();
assert!(resolve_move_function_args(framework_pkg, module, function, args).is_err());
// Test with vecu8 as address
let module = Identifier::new("ObjectBasics").unwrap();
let function = Identifier::new("create").unwrap();
let value_raw = 29897;
let address = SuiAddress::random_for_testing_only();
let value = json!(value_raw);
// Encode as hex string
let addr = json!(format!("0x{:02x}", address));
// They have to be ordered
let args = vec![value, addr]
.iter()
.map(|q| SuiJsonValue::new(q.clone()).unwrap())
.collect();
let (object_args, pure_args) =
resolve_move_function_args(framework_pkg, module, function, args).unwrap();
assert!(object_args.is_empty());
assert_eq!(pure_args[0], bcs::to_bytes(&(value_raw as u64)).unwrap());
// Need to verify this specially
assert_eq!(
pure_args[1],
bcs::to_bytes(&AccountAddress::from(address)).unwrap()
);
// Test with object args
let module = Identifier::new("ObjectBasics").unwrap();
let function = Identifier::new("transfer").unwrap();
let object_id_raw = ObjectID::random();
let address = SuiAddress::random_for_testing_only();
let object_id = json!(format!("0x{:02x}", object_id_raw));
// Encode as hex string
let addr = json!(format!("0x{:02x}", address));
// They have to be ordered
let args = vec![object_id, addr]
.iter()
.map(|q| SuiJsonValue::new(q.clone()).unwrap())
.collect();
let (object_args, pure_args) =
resolve_move_function_args(framework_pkg, module, function, args).unwrap();
assert!(!object_args.is_empty());
assert_eq!(
object_args[0],
ObjectID::from_hex_literal(&format!("0x{:02x}", object_id_raw)).unwrap()
);
// Need to verify this specially
assert_eq!(
pure_args[0],
bcs::to_bytes(&AccountAddress::from(address)).unwrap()
);
} | rust_cleaned_test_functions.jsonl/95867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1938
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
8384,
907,
2245,
10426,
8274,
368,
341,
262,
1077,
59366,
62673,
284,
14715,
16322,
13774,
41874,
543,
262,
1077,
12626,
64739,
284,
59366,
62673,
198,
286,
659,
2015,
741,
286,
659,
3903,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_ranges() {
let mut wrapper = TableScanTestWrapper::default();
// prepare range
let r1 = get_range(TABLE_ID, i64::MIN, 0);
let r2 = get_range(TABLE_ID, 0, (KEY_NUMBER / 2) as i64);
// prepare point get
let handle = KEY_NUMBER / 2;
let r3 = wrapper.get_point_range(handle as i64);
let r4 = get_range(TABLE_ID, (handle + 1) as i64, i64::MAX);
wrapper.ranges = vec![r1, r2, r3, r4];
let (snapshot, start_ts) = wrapper.store.get_snapshot();
let store = SnapshotStore::new(snapshot, start_ts, IsolationLevel::SI, true);
let mut table_scanner =
TableScanExecutor::new(&wrapper.table_scan, wrapper.ranges, store, false).unwrap();
for handle in 0..KEY_NUMBER {
let row = table_scanner.next().unwrap().unwrap();
assert_eq!(row.handle, handle as i64);
assert_eq!(row.data.len(), wrapper.cols.len());
let expect_row = &wrapper.data.expect_rows[handle];
for col in &wrapper.cols {
let cid = col.get_column_id();
let v = row.data.get(cid).unwrap();
assert_eq!(expect_row[&cid], v.to_vec());
}
}
assert!(table_scanner.next().unwrap().is_none());
} | rust_cleaned_test_functions.jsonl/35049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 639
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
58748,
368,
341,
286,
1077,
5206,
13261,
284,
6633,
26570,
2271,
11542,
486,
2258,
543,
286,
442,
10549,
2088,
198,
286,
1077,
435,
16,
284,
633,
9698,
83006,
3450,
11,
600,
21,
19,
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... | 3 |
#[test]
fn test_part2_samples() {
assert_eq!(count_ways(&[16, 10, 15, 5, 1, 11, 7, 19, 6, 12, 4]), 8);
assert_eq!(
count_ways(&[
28, 33, 18, 42, 31, 14, 46, 20, 48, 47, 24, 23, 49, 45, 19, 38, 39, 11, 1, 32, 25,
35, 8, 17, 7, 9, 4, 2, 34, 10, 3
]),
19208
);
} | rust_cleaned_test_functions.jsonl/71902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
17,
18297,
368,
341,
286,
2060,
10714,
10297,
1830,
1670,
942,
2099,
58,
16,
21,
11,
220,
16,
15,
11,
220,
16,
20,
11,
220,
20,
11,
220,
16,
11,
220,
16,
16,
11,
220,
22,
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_pbkdf2_simple() {
let password = "password";
let out1 = pbkdf2_simple(password, 1024).unwrap();
let out2 = pbkdf2_simple(password, 1024).unwrap();
// This just makes sure that a salt is being applied. It doesn't verify that that salt is
assert!(out1 != out2);
match pbkdf2_check(password, &out1[..]) {
Ok(r) => assert!(r),
Err(_) => panic!()
}
match pbkdf2_check(password, &out2[..]) {
Ok(r) => assert!(r),
Err(_) => panic!()
}
match pbkdf2_check("wrong", &out1[..]) {
Ok(r) => assert!(!r),
Err(_) => panic!()
}
match pbkdf2_check("wrong", &out2[..]) {
Ok(r) => assert!(!r),
Err(_) => panic!()
}
} | rust_cleaned_test_functions.jsonl/98903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31409,
74,
2940,
17,
30015,
368,
341,
286,
1077,
3552,
284,
330,
3833,
3302,
286,
1077,
700,
16,
284,
17310,
74,
2940,
17,
30015,
22768,
11,
220,
16,
15,
17,
19,
568,
15454,
543,
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... | 5 |
#[test]
fn test_stacked_porep_extract_all_blake2s_sub_8_8() {
test_extract_all::<DiskTree<Blake2sHasher, U8, U8, U0>>();
} | rust_cleaned_test_functions.jsonl/56517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
11191,
620,
460,
79,
39123,
5705,
13141,
726,
17,
82,
5228,
62,
23,
62,
23,
368,
341,
262,
1273,
39123,
5705,
27638,
47583,
6533,
27,
91038,
17,
82,
6370,
261,
11,
547,
23,
11,
547,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_confirmed_transaction() {
let slot = 2;
let entries = make_slot_entries_with_transactions(5);
let shreds = entries_to_test_shreds(entries.clone(), slot, slot - 1, true, 0);
let ledger_path = get_tmp_ledger_path!();
let blockstore = Blockstore::open(&ledger_path).unwrap();
blockstore.insert_shreds(shreds, None, false).unwrap();
blockstore.set_roots(&[slot - 1, slot]).unwrap();
let expected_transactions: Vec<(Transaction, Option<UiTransactionStatusMeta>)> = entries
.iter()
.cloned()
.filter(|entry| !entry.is_tick())
.flat_map(|entry| entry.transactions)
.map(|transaction| {
let mut pre_balances: Vec<u64> = vec![];
let mut post_balances: Vec<u64> = vec![];
for (i, _account_key) in transaction.message.account_keys.iter().enumerate() {
pre_balances.push(i as u64 * 10);
post_balances.push(i as u64 * 11);
}
let signature = transaction.signatures[0];
blockstore
.transaction_status_cf
.put(
(0, signature, slot),
&TransactionStatusMeta {
status: Ok(()),
fee: 42,
pre_balances: pre_balances.clone(),
post_balances: post_balances.clone(),
},
)
.unwrap();
(
transaction,
Some(
TransactionStatusMeta {
status: Ok(()),
fee: 42,
pre_balances,
post_balances,
}
.into(),
),
)
})
.collect();
for (transaction, status) in expected_transactions.clone() {
let signature = transaction.signatures[0];
let encoded_transaction =
EncodedTransaction::encode(transaction, UiTransactionEncoding::Json);
let expected_transaction = ConfirmedTransaction {
slot,
transaction: TransactionWithStatusMeta {
transaction: encoded_transaction,
meta: status,
},
};
assert_eq!(
blockstore
.get_confirmed_transaction(signature, None)
.unwrap(),
Some(expected_transaction)
);
}
blockstore.run_purge(0, 2, PurgeType::PrimaryIndex).unwrap();
*blockstore.lowest_cleanup_slot.write().unwrap() = slot;
for (transaction, _) in expected_transactions {
let signature = transaction.signatures[0];
assert_eq!(
blockstore
.get_confirmed_transaction(signature, None)
.unwrap(),
None,
);
}
} | rust_cleaned_test_functions.jsonl/72823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1848
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
16059,
8434,
28884,
368,
341,
286,
1077,
9446,
284,
220,
17,
280,
286,
1077,
10695,
284,
1281,
27563,
26092,
6615,
68182,
7,
20,
317,
286,
1077,
557,
53369,
284,
10695,
2346,
4452,
3712,
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... | 4 |
#[test]
fn test_display_fmt_many_characters() {
let two_length_location = SourceFileLocation::new("test_file.s", 2, 3, 2);
assert_eq!(format!("{}", two_length_location), "test_file.s:2:3-4");
let five_length_location = SourceFileLocation::new("test_file.s", 2, 3, 5);
assert_eq!(format!("{}", five_length_location), "test_file.s:2:3-7");
} | rust_cleaned_test_functions.jsonl/46048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
38128,
22101,
79060,
368,
341,
262,
1077,
1378,
5118,
13126,
284,
8748,
1703,
4707,
486,
931,
445,
1944,
2458,
514,
497,
220,
17,
11,
220,
18,
11,
220,
17,
317,
262,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul_pow10() {
let mut prevpow10 = Big::from_small(1);
for i in 1..340 {
let mut curpow10 = Big::from_small(1);
mul_pow10(&mut curpow10, i);
assert_eq!(curpow10, *prevpow10.clone().mul_small(10));
prevpow10 = curpow10;
}
} | rust_cleaned_test_functions.jsonl/12038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
56183,
16,
15,
368,
341,
262,
1077,
5206,
7872,
21743,
16,
15,
284,
6164,
486,
1499,
31966,
7,
16,
317,
262,
369,
600,
304,
220,
16,
496,
18,
19,
15,
341,
286,
1077,
5206,
2847,
21743... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_option() {
START.call_once(|| {
magick_wand_genesis();
});
let mut wand = MagickWand::new();
assert!(wand.read_image("tests/data/IMG_5745.JPG").is_ok());
// The jpeg:size option is just a hint.
wand.set_option("jpeg:size", "128x128").unwrap();
let blob = wand.write_image_blob("jpeg").unwrap();
assert!(wand.read_image_blob(&blob).is_ok());
assert_eq!(192, wand.get_image_width());
assert_eq!(144, wand.get_image_height());
} | rust_cleaned_test_functions.jsonl/57701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
9672,
368,
341,
262,
20998,
8524,
7630,
79453,
341,
286,
4878,
865,
1670,
437,
16322,
13774,
543,
262,
1625,
262,
1077,
5206,
28710,
284,
87154,
54,
437,
486,
931,
543,
262,
2060,
10297,
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... | 2 |
#[test]
fn test_line_wrap() {
let mut out = PosixRenderer::new(OutputStreamType::Stdout, 4, true, BellStyle::default());
let prompt = Prompt {
text: "> ",
is_default: true,
size: out.calculate_position("> ", Position::default(), 0),
has_continuation: false,
};
let mut line = LineBuffer::init("", 0, None);
let old_layout = out.compute_layout(&prompt, &line, None);
assert_eq!(Position { col: 2, row: 0 }, old_layout.cursor);
assert_eq!(old_layout.cursor, old_layout.end);
assert_eq!(Some(true), line.insert('a', out.cols - prompt.size.col + 1));
let new_layout = out.compute_layout(&prompt, &line, None);
assert_eq!(Position { col: 1, row: 1 }, new_layout.cursor);
assert_eq!(new_layout.cursor, new_layout.end);
out.refresh_line(&prompt, &line, None, &old_layout, &new_layout, None)
.unwrap();
#[rustfmt::skip]
assert_eq!(
"\r\u{1b}[0K> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\u{1b}[1C",
out.buffer
);
} | rust_cleaned_test_functions.jsonl/10660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6528,
38550,
368,
341,
286,
1077,
5206,
700,
284,
18876,
941,
11541,
486,
931,
7,
12795,
929,
486,
22748,
411,
11,
220,
19,
11,
830,
11,
17884,
2323,
486,
2258,
1423,
286,
1077,
9934,
284,
595... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_or() -> TestResult {
let p = polar();
p.load_str(
r#"f(x) if a(x) or b(x);
a(1);
b(3);"#,
)?;
qvar(&p, "f(x)", "x", values![1, 3]);
qeval(&p, "f(1)");
qnull(&p, "f(2)");
qeval(&p, "f(3)");
p.clear_rules();
p.load_str(
r#"g(x) if a(x) or b(x) or c(x);
a(1);
b(3);
c(5);"#,
)?;
qvar(&p, "g(x)", "x", values![1, 3, 5]);
qeval(&p, "g(1)");
qnull(&p, "g(2)");
qeval(&p, "g(3)");
qeval(&p, "g(5)");
Ok(())
} | rust_cleaned_test_functions.jsonl/68112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
543,
262,
281,
5104,
2895,
1006,
286,
435,
55543,
69,
2075,
8,
421,
264,
2075,
8,
476,
293,
2075,
317,
1843,
264,
7,
16,
317,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_priority_update_request_on_push_stream() {
test_wrong_frame_on_push_stream(&[0x80, 0x0f, 0x07, 0x00, 0x01, 0x03]);
} | rust_cleaned_test_functions.jsonl/101889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38161,
8882,
7893,
4470,
14218,
12673,
368,
341,
286,
1273,
75198,
8929,
4470,
14218,
12673,
2099,
58,
15,
87,
23,
15,
11,
220,
15,
87,
15,
69,
11,
220,
15,
87,
15,
22,
11,
220,
15,
87,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parsing_with_included_range_containing_mismatched_positions() {
let source_code = "<div>test</div>{_ignore_this_part_}";
let mut parser = Parser::new();
parser.set_language(get_language("html")).unwrap();
let end_byte = source_code.find("{_ignore_this_part_").unwrap();
let range_to_parse = Range {
start_byte: 0,
start_point: Point {
row: 10,
column: 12,
},
end_byte,
end_point: Point {
row: 10,
column: 12 + end_byte,
},
};
parser.set_included_ranges(&[range_to_parse]).unwrap();
let html_tree = parser.parse(source_code, None).unwrap();
assert_eq!(html_tree.root_node().range(), range_to_parse);
assert_eq!(
html_tree.root_node().to_sexp(),
"(fragment (element (start_tag (tag_name)) (text) (end_tag (tag_name))))"
);
} | rust_cleaned_test_functions.jsonl/73175 | {
"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,
620,
28598,
6615,
1243,
10181,
9698,
10260,
2056,
717,
24976,
291,
37219,
368,
341,
262,
1077,
2530,
4136,
284,
4055,
611,
29,
1944,
522,
611,
7309,
62,
13130,
24868,
10495,
62,
71612,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long_os_string_value() {
with_key!(key, "LongOsStringValue" => {
let name = "RustLongOsStringVal";
let mut val1 = rand::thread_rng().gen_ascii_chars().take(7000).collect::<String>();
val1.push('\u{0}');
let val1 = OsStr::new(&val1);
key.set_value(name, &val1).unwrap();
let val2: OsString = key.get_value(name).unwrap();
assert_eq!(val1, val2);
});
} | rust_cleaned_test_functions.jsonl/128091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
29387,
3904,
3142,
368,
341,
262,
448,
3097,
10297,
792,
11,
330,
6583,
28867,
82696,
1,
589,
341,
286,
1077,
829,
284,
330,
49,
590,
6583,
28867,
703,
2208,
876,
286,
1077,
5206,
1044,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_register_response() {
let repair_type = ShredRepairType::Orphan(9);
let mut outstanding_requests = OutstandingRequests::default();
let nonce = outstanding_requests.add_request(repair_type, timestamp());
let shred = Shred::new_from_data(0, 0, 0, &[], false, false, 0, 0, 0);
let mut expire_timestamp = outstanding_requests
.requests
.get(&nonce)
.unwrap()
.expire_timestamp;
let mut num_expected_responses = outstanding_requests
.requests
.get(&nonce)
.unwrap()
.num_expected_responses;
assert!(num_expected_responses > 1);
// Response that passes all checks should decrease num_expected_responses
assert!(outstanding_requests
.register_response(nonce, &shred, expire_timestamp - 1, |_| ())
.is_some());
num_expected_responses -= 1;
assert_eq!(
outstanding_requests
.requests
.get(&nonce)
.unwrap()
.num_expected_responses,
num_expected_responses
);
// Response with incorrect nonce is ignored
assert!(outstanding_requests
.register_response(nonce + 1, &shred, expire_timestamp - 1, |_| ())
.is_none());
assert!(outstanding_requests
.register_response(nonce + 1, &shred, expire_timestamp, |_| ())
.is_none());
assert_eq!(
outstanding_requests
.requests
.get(&nonce)
.unwrap()
.num_expected_responses,
num_expected_responses
);
// responses from being accepted
assert!(outstanding_requests
.register_response(nonce, &shred, expire_timestamp, |_| ())
.is_none());
assert!(outstanding_requests.requests.get(&nonce).is_none());
let nonce = outstanding_requests.add_request(repair_type, timestamp());
expire_timestamp = outstanding_requests
.requests
.get(&nonce)
.unwrap()
.expire_timestamp;
num_expected_responses = outstanding_requests
.requests
.get(&nonce)
.unwrap()
.num_expected_responses;
assert!(num_expected_responses > 1);
for _ in 0..num_expected_responses {
assert!(outstanding_requests.requests.get(&nonce).is_some());
assert!(outstanding_requests
.register_response(nonce, &shred, expire_timestamp - 1, |_| ())
.is_some());
}
assert!(outstanding_requests.requests.get(&nonce).is_none());
} | rust_cleaned_test_functions.jsonl/50414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14000,
9655,
368,
341,
286,
1077,
12733,
1819,
284,
1417,
1151,
98386,
929,
486,
2195,
9943,
7,
24,
317,
286,
1077,
5206,
18781,
37216,
284,
75341,
35295,
486,
2258,
543,
286,
1077,
39676,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rotate_nearest_rgba() {
fn rotate_nearest_about_center(image: &RgbaImage) -> RgbaImage {
rotate_about_center(
image,
std::f32::consts::PI / 4f32,
Interpolation::Nearest,
Rgba::black(),
)
}
compare_to_truth(
"elephant_rgba.png",
"elephant_rotate_nearest_rgba.png",
rotate_nearest_about_center,
);
} | rust_cleaned_test_functions.jsonl/81460 | {
"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,
60834,
13925,
15432,
95229,
368,
341,
262,
5168,
16919,
13925,
15432,
57975,
21087,
10075,
25,
609,
49,
56380,
1906,
8,
1464,
431,
56380,
1906,
341,
286,
16919,
57975,
21087,
1006,
310,
2168,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_json_path_expr() {
let mut test_cases = vec![
(
"$",
true,
Some(PathExpression {
legs: vec![],
flags: PathExpressionFlag::default(),
}),
),
(
"$.a",
true,
Some(PathExpression {
legs: vec![PathLeg::Key(String::from("a"))],
flags: PathExpressionFlag::default(),
}),
),
(
"$.\"hello world\"",
true,
Some(PathExpression {
legs: vec![PathLeg::Key(String::from("hello world"))],
flags: PathExpressionFlag::default(),
}),
),
(
"$[0]",
true,
Some(PathExpression {
legs: vec![PathLeg::Index(0)],
flags: PathExpressionFlag::default(),
}),
),
(
"$**.a",
true,
Some(PathExpression {
legs: vec![PathLeg::DoubleAsterisk, PathLeg::Key(String::from("a"))],
flags: PATH_EXPRESSION_CONTAINS_DOUBLE_ASTERISK,
}),
),
// invalid path expressions
(".a", false, None),
("xx$[1]", false, None),
("$.a xx .b", false, None),
("$[a]", false, None),
("$.\"\\u33\"", false, None),
("$**", false, None),
];
for (i, (path_expr, no_error, expected)) in test_cases.drain(..).enumerate() {
let r = parse_json_path_expr(path_expr);
if no_error {
assert!(r.is_ok(), "#{} expect parse ok but got err {:?}", i, r);
let got = r.unwrap();
let expected = expected.unwrap();
assert_eq!(
got, expected,
"#{} expect {:?} but got {:?}",
i, expected, got
);
} else {
assert!(r.is_err(), "#{} expect error but got {:?}", i, r);
}
}
} | rust_cleaned_test_functions.jsonl/43061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9455,
2638,
21915,
368,
341,
286,
1077,
5206,
1273,
41427,
284,
7486,
90515,
310,
2399,
394,
5201,
756,
394,
830,
345,
394,
4329,
33030,
9595,
341,
503,
14201,
25,
7486,
20703,
1259,
503,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_primitive_array_builder_finish() {
let mut builder = Int32Builder::new(5);
builder.append_slice(&[2, 4, 6, 8]).unwrap();
let mut arr = builder.finish();
assert_eq!(4, arr.len());
assert_eq!(0, builder.len());
builder.append_slice(&[1, 3, 5, 7, 9]).unwrap();
arr = builder.finish();
assert_eq!(5, arr.len());
assert_eq!(0, builder.len());
} | rust_cleaned_test_functions.jsonl/30978 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
28532,
42980,
368,
341,
286,
1077,
5206,
7363,
284,
1333,
18,
17,
3297,
486,
931,
7,
20,
317,
286,
7363,
2057,
26488,
2099,
58,
17,
11,
220,
19,
11,
220,
21,
11,
220,
23,
10697,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_range() {
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
let stmt = conn.prepare("SELECT $1::INT8RANGE").unwrap();
let err = stmt.query(&[&&[1i64][..]]).unwrap_err();
match err.as_conversion() {
Some(e) if e.is::<WrongType>() => {}
_ => panic!("Unexpected error {:?}", err),
};
} | rust_cleaned_test_functions.jsonl/120864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
9698,
368,
341,
262,
1077,
4534,
284,
11032,
486,
6459,
445,
43070,
1110,
43070,
31,
8301,
25,
20,
19,
18,
18,
497,
350,
4730,
3636,
486,
4064,
568,
15454,
1428,
262,
1077,
20020,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_load_state() {
let name = setup_env();
{
let _ = State::new(&name).unwrap();
}
let mut s = State::load(&name).unwrap();
test_state(&mut s);
} | rust_cleaned_test_functions.jsonl/55500 | {
"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,
12411,
4387,
368,
341,
10217,
829,
284,
6505,
15879,
543,
197,
515,
197,
10217,
716,
284,
3234,
486,
931,
2099,
606,
568,
15454,
543,
197,
532,
10217,
5206,
274,
284,
3234,
486,
1078,
2099,
606,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_transform_all_roles_to_config() {
let role_1 = "role_1";
let role_2 = "role_2";
let role_group_1 = "role_group_1";
let role_group_2 = "role_group_2";
let file_name = "foo.bar";
let roles: HashMap<String, (Vec<PropertyNameKind>, Role<Box<TestConfig>>)> = collection! {
role_1.to_string() => (vec![PropertyNameKind::File(file_name.to_string()), PropertyNameKind::Env], Role {
config: build_common_config(
build_test_config(ROLE_CONFIG, ROLE_ENV, ROLE_CLI),
None,
None,
None,
),
role_groups: collection! {role_group_1.to_string() => RoleGroup {
replicas: Some(1),
config: build_common_config(
build_test_config(GROUP_CONFIG, GROUP_ENV, GROUP_CLI),
None,
None,
None
),
selector: None,
},
role_group_2.to_string() => RoleGroup {
replicas: Some(1),
config: build_common_config(
build_test_config(GROUP_CONFIG, GROUP_ENV, GROUP_CLI),
None,
None,
None
),
selector: None,
}}
}),
role_2.to_string() => (vec![PropertyNameKind::Cli], Role {
config: build_common_config(
build_test_config(ROLE_CONFIG, ROLE_ENV, ROLE_CLI),
None,
None,
None,
),
role_groups: collection! {role_group_1.to_string() => RoleGroup {
replicas: Some(1),
config: build_common_config(
build_test_config(GROUP_CONFIG, GROUP_ENV, GROUP_CLI),
None,
None,
None
),
selector: None,
}},
})
};
let expected: RoleConfigByPropertyKind = collection! {
role_1.to_string() => collection!{
role_group_1.to_string() => collection! {
PropertyNameKind::Env => collection! {
"env".to_string() => Some(GROUP_ENV.to_string())
},
PropertyNameKind::File(file_name.to_string()) => collection! {
"file".to_string() => Some(GROUP_CONFIG.to_string())
}
},
role_group_2.to_string() => collection! {
PropertyNameKind::Env => collection! {
"env".to_string() => Some(GROUP_ENV.to_string())
},
PropertyNameKind::File(file_name.to_string()) => collection! {
"file".to_string() => Some(GROUP_CONFIG.to_string())
}
}
},
role_2.to_string() => collection! {
role_group_1.to_string() => collection! {
PropertyNameKind::Cli => collection! {
"cli".to_string() => Some(GROUP_CLI.to_string())
}
}
}};
let all_config = transform_all_roles_to_config(&String::new(), roles);
assert_eq!(all_config, expected);
} | rust_cleaned_test_functions.jsonl/90571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1904
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18449,
5705,
43061,
2346,
5332,
368,
341,
286,
1077,
3476,
62,
16,
284,
330,
5778,
62,
16,
876,
286,
1077,
3476,
62,
17,
284,
330,
5778,
62,
17,
876,
286,
1077,
3476,
6288,
62,
16,
284,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_unknown() {
let (relayer, always_success_out_point) = build_chain(5);
let peer_index: PeerIndex = 100.into();
let transaction = new_transaction(&relayer, 1, &always_success_out_point);
let transactions = vec![transaction.clone()];
// known tx
{
relayer
.shared
.state()
.mark_as_known_tx(transaction.hash().to_owned());
}
let content = packed::BlockProposal::new_builder()
.transactions(transactions.into_iter().map(|tx| tx.data()).pack())
.build();
let process = BlockProposalProcess::new(content.as_reader(), &relayer, peer_index);
let r = process.execute();
assert_eq!(r.ok(), Some(Status::NoUnknown));
} | rust_cleaned_test_functions.jsonl/30800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
57507,
368,
341,
262,
1077,
320,
3748,
1135,
11,
2677,
18632,
6068,
6085,
8,
284,
1936,
30583,
7,
20,
317,
262,
1077,
14397,
3560,
25,
45147,
1552,
284,
220,
16,
15,
15,
39860,
1428,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_reader_rows_nonnullable() {
let rows = test_file_reader_rows::<Group>("nonnullable.impala.parquet", None).unwrap();
let expected_rows = vec![row![
("ID".to_string(), Value::I64(8)),
("Int_Array".to_string(), listv![Value::I32(-1)]),
(
"int_array_array".to_string(),
listv![listv![Value::I32(-1), Value::I32(-2)], listv![]]
),
(
"Int_Map".to_string(),
mapv![(Value::String("k1".to_string()), Value::I32(-1))]
),
(
"int_map_array".to_string(),
listv![
mapv![],
mapv![(Value::String("k1".to_string()), Value::I32(1))],
mapv![],
mapv![]
]
),
(
"nested_Struct".to_string(),
groupv![
("a".to_string(), Value::I32(-1)),
("B".to_string(), listv![Value::I32(-1)]),
(
"c".to_string(),
groupv![(
"D".to_string(),
listv![listv![groupv![
("e".to_string(), Value::I32(-1)),
("f".to_string(), Value::String("nonnullable".to_string()))
]]]
)]
),
("G".to_string(), mapv![])
]
)
]];
assert_eq!(rows, expected_rows);
} | rust_cleaned_test_functions.jsonl/92459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 602
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
22306,
10949,
21637,
12902,
368,
341,
197,
10217,
6978,
284,
1273,
2458,
22306,
10949,
27638,
2808,
13211,
6280,
12902,
80454,
6053,
33277,
23300,
497,
2240,
568,
15454,
1428,
197,
10217,
3601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_18() {
let key = "1bf32e7c679a3187e22a635d301ce98ad000ca301049f2e891e403250c3358fc";
let nonce = "2030b227bb96e93b88f419afe9f9d660";
let expected_output =
"d0ed414a875a81db1e4cff7609afdbb2ffcdd575ebc17543fb92de53c6487efb";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
16,
23,
368,
341,
310,
1077,
1376,
284,
330,
16,
13233,
18,
17,
68,
22,
66,
21,
22,
24,
64,
18,
16,
23,
22,
68,
17,
17,
64,
21,
18,
20,
67,
18,
15,
16,
346,
24,
23,
329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_submission_part2() {
let input = input_to_grid(SUBMISSION_PATH);
let mut res = part2(input);
assert_eq!(res, 1092012);
} | rust_cleaned_test_functions.jsonl/84161 | {
"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,
75866,
10495,
17,
368,
341,
286,
1077,
1946,
284,
1946,
2346,
15604,
3759,
4493,
25245,
7944,
317,
286,
1077,
5206,
592,
284,
949,
17,
5384,
317,
286,
2060,
10714,
10297,
416,
11,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cp_backup_numbered_with_t() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.arg("--backup=t")
.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!("{}.~1~", TEST_HOW_ARE_YOU_SOURCE)),
"How are you?\n"
);
} | rust_cleaned_test_functions.jsonl/21252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
44710,
5500,
291,
6615,
528,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
1428,
262,
575,
8710,
21186,
21549,
31371,
24000,
1138,
286,
659,
858,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mark_valid_invalid_forks_duplicate() {
let (
mut heaviest_subtree_fork_choice,
duplicate_leaves_descended_from_4,
duplicate_leaves_descended_from_5,
) = setup_duplicate_forks();
let stake = 100;
let (bank, vote_pubkeys) = bank_utils::setup_bank_and_vote_pubkeys(3, stake);
let pubkey_votes: Vec<(Pubkey, SlotHashKey)> = vec![
(vote_pubkeys[0], duplicate_leaves_descended_from_4[0]),
(vote_pubkeys[1], duplicate_leaves_descended_from_5[0]),
];
// The best slot should be the the smallest leaf descended from 4
assert_eq!(
heaviest_subtree_fork_choice.add_votes(
pubkey_votes.iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
),
duplicate_leaves_descended_from_4[0]
);
// the other branch at slot 5
let invalid_candidate = (4, Hash::default());
heaviest_subtree_fork_choice.mark_fork_invalid_candidate(&invalid_candidate);
assert_eq!(
heaviest_subtree_fork_choice.best_overall_slot(),
(2, Hash::default())
);
// Marking candidate as valid again will choose the the heaviest leaf of
// the newly valid branch
let duplicate_slot = duplicate_leaves_descended_from_4[0].0;
let duplicate_descendant = (duplicate_slot + 1, Hash::new_unique());
heaviest_subtree_fork_choice.add_new_leaf_slot(
duplicate_descendant,
Some(duplicate_leaves_descended_from_4[0]),
);
heaviest_subtree_fork_choice.mark_fork_valid_candidate(&invalid_candidate);
assert_eq!(
heaviest_subtree_fork_choice.best_overall_slot(),
duplicate_descendant
);
// Mark the current heaviest branch as invalid again
heaviest_subtree_fork_choice.mark_fork_invalid_candidate(&invalid_candidate);
// If we add a new version of the duplicate slot that is not descended from the invalid
// once it has more weight
let new_duplicate_hash = Hash::default();
// The hash has to be smaller in order for the votes to be counted
assert!(new_duplicate_hash < duplicate_leaves_descended_from_4[0].1);
let new_duplicate = (duplicate_slot, new_duplicate_hash);
heaviest_subtree_fork_choice.add_new_leaf_slot(new_duplicate, Some((3, Hash::default())));
let pubkey_votes: Vec<(Pubkey, SlotHashKey)> = vec![
(vote_pubkeys[0], new_duplicate),
(vote_pubkeys[1], new_duplicate),
];
heaviest_subtree_fork_choice.add_votes(
pubkey_votes.iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
);
assert_eq!(
heaviest_subtree_fork_choice.best_overall_slot(),
new_duplicate
);
} | rust_cleaned_test_functions.jsonl/85884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
8337,
31433,
761,
73302,
70434,
368,
341,
286,
1077,
2399,
310,
5206,
566,
98362,
5228,
9344,
761,
669,
31936,
345,
310,
22513,
11751,
4693,
10986,
2883,
5673,
62,
19,
345,
310,
22513,
1175... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_Hlist_macro() {
let h1: Hlist!(i32, &str, i32) = hlist![1, "2", 3];
let h2: Hlist!(i32, &str, i32,) = hlist![1, "2", 3];
let h3: Hlist!(i32) = hlist![1];
let h4: Hlist!(i32,) = hlist![1,];
assert_eq!(h1, h2);
assert_eq!(h3, h4);
} | rust_cleaned_test_functions.jsonl/24750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2039,
1607,
58810,
368,
341,
286,
1077,
305,
16,
25,
472,
1607,
10297,
72,
18,
17,
11,
609,
495,
11,
600,
18,
17,
8,
284,
305,
1607,
20703,
16,
11,
330,
17,
497,
220,
18,
935,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inode_store_get_by_path() {
let store = build_basic_store();
assert_eq!(store.get_by_path("/").unwrap().attr.ino, 1);
assert_eq!(store.get_by_path("/data").unwrap().attr.ino, 2);
assert_eq!(store.get_by_path("/data/foo.txt").unwrap().attr.ino, 3);
assert_eq!(store.get_by_path("/data/bar.txt").unwrap().attr.ino, 4);
} | rust_cleaned_test_functions.jsonl/35694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46748,
14809,
3062,
3710,
2638,
368,
341,
286,
1077,
3553,
284,
1936,
34729,
14809,
543,
286,
2060,
10714,
10297,
4314,
670,
3710,
2638,
4283,
1827,
15454,
1005,
2991,
1858,
78,
11,
220,
16,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_getcwd() {
// chdir changes the process's cwd
#[allow(unused_variables)]
let m = ::CWD_MTX.lock().expect("Mutex got poisoned by another test");
let tmpdir = TempDir::new("test_getcwd").unwrap();
let tmpdir_path = tmpdir.path().canonicalize().unwrap();
assert!(chdir(&tmpdir_path).is_ok());
assert_eq!(getcwd().unwrap(), tmpdir_path);
// make path 500 chars longer so that buffer doubling in getcwd
// kicks in. Note: One path cannot be longer than 255 bytes
let mut inner_tmp_dir = tmpdir_path.to_path_buf();
for _ in 0..5 {
let newdir = iter::repeat("a").take(100).collect::<String>();
inner_tmp_dir.push(newdir);
assert!(mkdir(inner_tmp_dir.as_path(), Mode::S_IRWXU).is_ok());
}
assert!(chdir(inner_tmp_dir.as_path()).is_ok());
assert_eq!(getcwd().unwrap(), inner_tmp_dir.as_path());
} | rust_cleaned_test_functions.jsonl/8993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
32165,
368,
341,
262,
442,
521,
3741,
4344,
279,
1882,
594,
46938,
198,
262,
11506,
7183,
18364,
2591,
28182,
5563,
262,
1077,
296,
284,
3504,
34,
17563,
1245,
22867,
21003,
1005,
17119,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_config_true() {
let mut c = Config::with_none();
c.indicators = Some(true);
assert_eq!(Some(Indicators(true)), Indicators::from_config(&c));
} | rust_cleaned_test_functions.jsonl/80247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
5332,
16082,
368,
341,
286,
1077,
5206,
272,
284,
5532,
486,
4197,
31488,
543,
286,
272,
28473,
42052,
284,
4329,
3715,
317,
286,
2060,
10714,
10297,
8373,
7,
1425,
42052,
3715,
5731,
2263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_path_with_path() {
check(
r#"
macro_rules! m {
($p:path) => { fn foo() { let a = $p::bar; } }
}
m! { foo }
"#,
expect![[r#"
macro_rules! m {
($p:path) => { fn foo() { let a = $p::bar; } }
}
fn foo() {
let a = foo::bar;
}
"#]],
);
} | rust_cleaned_test_functions.jsonl/85223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
6615,
2638,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
341,
262,
1711,
79,
71796,
8,
589,
314,
5168,
15229,
368,
314,
1077,
264,
284,
400,
79,
486,
2257,
26,
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_add_fees_to_request_valid() {
let (wallet, input_address) = init_wallet_with_address();
let fake_request = json!({
"operation": {
"type": "3"
}
});
let txo = TXO { address: input_address, seq_no: 1 };
let inputs = json!([txo.to_libindy_string().unwrap()]);
let outputs = json!([{
"recipient": "pay:sov:dctKSXBbv2My3TGGUgTFjkxu1A9JM3Sscd5FydY4dkxnfwA7q",
"amount": 20,
}]);
let expected_fees_request = json!({
"fees": [
[
{
"address": "iTQzpdRdugkJ2gLD5vW5c159dncSL9jbAtu3WfPcb8qWD9bUd",
"seqNo": 1
}
],
[
{
"address": "dctKSXBbv2My3TGGUgTFjkxu1A9JM3Sscd5FydY4dkxnfwA7q",
"amount": 20
}
],
["64wPLDPMjGxgqTdrNTZFa9CK4NtvBx7eLJkgnjW3JchRGyMUr29tjkAiHCTnhLtkdW81k5BtBiiqM2tkaMB2eouv"]
],
"operation": {
"type": "3"
}
});
let result = call_add_fees(
wallet.handle,
inputs.to_string(),
outputs.to_string(),
None,
fake_request.to_string()
).unwrap();
assert_eq!(expected_fees_request.to_string(), result);
} | rust_cleaned_test_functions.jsonl/90660 | {
"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,
2891,
761,
5516,
2346,
7893,
8337,
368,
341,
262,
1077,
320,
35735,
11,
1946,
6744,
8,
284,
2930,
62308,
6615,
6744,
1428,
262,
1077,
12418,
7893,
284,
2951,
0,
2262,
981,
330,
9262,
788,
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_gpio_set_low() {
let mut mem = DirectMemory::get().unwrap();
let mut gpio_iface = mem.gpio().unwrap();
gpio_iface.pin_low( 26 );
} | rust_cleaned_test_functions.jsonl/32913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32001,
2602,
23767,
368,
341,
286,
1077,
5206,
1833,
284,
7139,
10642,
486,
455,
1005,
15454,
543,
286,
1077,
5206,
31622,
67666,
284,
1833,
1302,
11917,
1005,
15454,
543,
286,
31622,
67666,
50642,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_xclip_prefix_custom() {
let x = b"GGGGGGATG";
let y = b"ATG";
let score = |a: u8, b: u8| if a == b { 1i32 } else { -1i32 };
let scoring = Scoring::new(-5, -1, &score).xclip(-5);
let mut aligner = banded::Aligner::with_scoring(scoring, 10, 10);
let alignment = aligner.custom(x, y);
assert_eq!(alignment.operations, [Xclip(6), Match, Match, Match]);
} | rust_cleaned_test_functions.jsonl/126759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3212,
7974,
13974,
15875,
368,
341,
286,
1077,
856,
284,
293,
1,
22254,
22254,
22254,
828,
38,
876,
286,
1077,
379,
284,
293,
1,
828,
38,
3302,
286,
1077,
5456,
284,
760,
64,
25,
575,
23,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_extract_struct_several_fields_tuple() {
check_assist(
extract_struct_from_enum_variant,
"enum A { $0One(u32, u32) }",
r#"struct One(u32, u32);
enum A { One(One) }"#,
);
} | rust_cleaned_test_functions.jsonl/36290 | {
"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,
39123,
15126,
3453,
17539,
12132,
21773,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8649,
15126,
5673,
31054,
46112,
345,
310,
330,
9018,
362,
314,
400,
15,
3966,
8154,
18,
17,
11,
575,
18,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compound_rollback() {
let mut sqlite = db::new_connection("").unwrap();
let mut conn = Conn::connect(&mut sqlite).unwrap();
let tempid_offset = get_next_entid(&conn);
// Nothing in the store => USER0 should be our starting point.
assert_eq!(tempid_offset, USER0);
let t = "[[:db/add \"one\" :db/ident :a/keyword1] \
[:db/add \"two\" :db/ident :a/keyword2]]";
// Scoped borrow of `sqlite`.
{
let mut in_progress = conn
.begin_transaction(&mut sqlite)
.expect("begun successfully");
let report = in_progress.transact(t).expect("transacted successfully");
let one = *report.tempids.get("one").expect("found it");
let two = *report.tempids.get("two").expect("found it");
assert!(one != two);
assert!(one == tempid_offset || one == tempid_offset + 1);
assert!(two == tempid_offset || two == tempid_offset + 1);
// Inside the InProgress we can see our changes.
let during = in_progress
.q_once("[:find ?x . :where [?x :db/ident :a/keyword1]]", None)
.expect("query succeeded");
assert_eq!(
during.results,
QueryResults::Scalar(Some(TypedValue::Ref(one).into()))
);
let kw = in_progress
.lookup_value_for_attribute(one, &edn::Keyword::namespaced("db", "ident"))
.expect("lookup succeeded");
assert_eq!(
kw,
Some(TypedValue::Keyword(
edn::Keyword::namespaced("a", "keyword1").into()
))
);
in_progress.rollback().expect("rollback succeeded");
}
let after = conn
.q_once(
&sqlite,
"[:find ?x . :where [?x :db/ident :a/keyword1]]",
None,
)
.expect("query succeeded");
assert_eq!(after.results, QueryResults::Scalar(None));
// The DB part table is unchanged.
let tempid_offset_after = get_next_entid(&conn);
assert_eq!(tempid_offset, tempid_offset_after);
} | rust_cleaned_test_functions.jsonl/76421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
795,
62,
33559,
368,
341,
286,
1077,
5206,
22003,
284,
2927,
486,
931,
15866,
80821,
15454,
543,
286,
1077,
5206,
4534,
284,
18213,
486,
6459,
2099,
6984,
22003,
568,
15454,
1428,
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... | 3 |
#[test]
fn test_canonicalize_resource_3() {
let url = url::Url::parse(
"https://myaccount-secondary.blob.core.windows.\
net/mycontainer/myblob",
)
.unwrap();
assert_eq!(
super::canonicalized_resource(
&MockClientEndpoint {
account: "myaccount-secondary".to_owned(),
key: "useless".to_owned(),
},
&url
),
"/myaccount-secondary/mycontainer/myblob"
);
} | rust_cleaned_test_functions.jsonl/5201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
22391,
551,
17962,
62,
18,
368,
341,
286,
1077,
2515,
284,
2515,
486,
2864,
486,
6400,
1006,
310,
330,
2428,
1110,
2408,
4608,
29383,
96281,
4871,
68113,
13,
5661,
1797,
4179,
34198,
3586,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_signs_and_verifies_empty_message() {
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut jscontext = JavaScript::new(format!("{}/xpring.js", out_dir))?;
let signed_message = sign(
&mut jscontext,
"".to_owned(),
"000974B4CFE004A2E6C4364CBF3510A36A352796728D0861F6B555ED7E54A70389".to_owned(),
)
.unwrap();
let verified_message = verify(
&mut jscontext,
"".to_owned(),
signed_message,
"038BF420B5271ADA2D7479358FF98A29954CF18DC25155184AEAD05796DA737E89".to_owned(),
)?;
assert!(verified_message);
} | rust_cleaned_test_functions.jsonl/118751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
82,
8378,
26042,
9606,
15124,
6462,
368,
341,
286,
1077,
700,
4334,
284,
1460,
486,
3160,
486,
947,
445,
3656,
8291,
1827,
15454,
543,
286,
1077,
5206,
6994,
2147,
284,
12914,
486,
931,
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_progress_leader() {
setup_for_test();
let mut raft = new_test_raft(1, vec![1, 2], 5, 1, new_storage());
raft.become_candidate();
raft.become_leader();
raft.mut_prs().get_mut(2).unwrap().become_replicate();
let prop_msg = new_message(1, 1, MessageType::MsgPropose, 1);
for i in 0..5 {
assert_eq!(
raft.mut_prs().get_mut(1).unwrap().state,
ProgressState::Replicate
);
let matched = raft.mut_prs().get_mut(1).unwrap().matched;
let next_idx = raft.mut_prs().get_mut(1).unwrap().next_idx;
assert_eq!(matched, i + 1);
assert_eq!(next_idx, matched + 1);
assert!(raft.step(prop_msg.clone()).is_ok());
}
} | rust_cleaned_test_functions.jsonl/107089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27200,
79991,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
52455,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
1125,
220,
20,
11,
220,
16,
11,
501,
23310,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dir_locking() {
let name = setup_env();
let mut state = match State::load_else_create(&name) {
Ok(state) => state,
Err(_e) => return,
};
if let Err(_e) = state.set("var", String::from("some value")) {
return;
}
let state2 = State::load_else_create(&name).unwrap();
println!("foo: {:?}", state2.get::<String>("var")); //should never reach this point
} | rust_cleaned_test_functions.jsonl/55494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4334,
9818,
287,
368,
341,
10217,
829,
284,
6505,
15879,
543,
10217,
5206,
1584,
284,
2432,
3234,
486,
1078,
62628,
8657,
2099,
606,
8,
341,
197,
197,
11578,
8390,
8,
589,
1584,
345,
197,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_zero_on_nonzero_integer_u8() {
let bytes = &[0];
assert_eq!(
std::num::NonZeroU8::try_from_slice(bytes)
.unwrap_err()
.to_string(),
ERROR_INVALID_ZERO_VALUE
);
} | rust_cleaned_test_functions.jsonl/103722 | {
"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,
19359,
4470,
21637,
14154,
31725,
7300,
23,
368,
341,
262,
1077,
5820,
284,
44590,
15,
935,
262,
2060,
10714,
33673,
286,
1460,
486,
2413,
486,
8121,
17999,
52,
23,
486,
1539,
5673,
26488,
23158,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_revocation() {
let test_config = KeylimeConfig::default();
let sig_path = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("test-data/revocation.sig");
let signature = fs::read_to_string(sig_path).unwrap(); //#[allow_ci]
let message_path = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("test-data/test_ok.json");
let message = fs::read_to_string(message_path).unwrap(); //#[allow_ci]
let body = json!({
"msg": message,
"signature": signature,
});
let cert_path = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("test-data/test-cert.pem");
let actions_dir =
Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/actions");
let work_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests");
let tmpfs_dir = work_dir.join("tmpfs-dev");
let result = process_revocation(
body,
&cert_path,
&test_config.secure_size,
&test_config.revocation_actions,
&actions_dir,
test_config.allow_payload_revocation_actions,
&work_dir,
&tmpfs_dir,
);
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/120975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 634
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
38082,
2276,
368,
341,
286,
1077,
1273,
5332,
284,
5309,
38943,
2648,
486,
2258,
1428,
286,
1077,
8366,
2638,
284,
7933,
486,
931,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
5455,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_charging_gas_success() {
let (mut runner, mut source_account, dest_address) = initialize_transfer();
let source_address = test_utils::address_from_secret_key(&source_account.secret_key);
let transaction = |nonce| {
let mut tx = test_utils::transfer(dest_address, TRANSFER_AMOUNT, nonce);
tx.gas = 30_000.into();
tx.gas_price = GAS_PRICE.into();
tx
};
// validate pre-state
test_utils::validate_address_balance_and_nonce(
&runner,
source_address,
INITIAL_BALANCE,
INITIAL_NONCE.into(),
);
test_utils::validate_address_balance_and_nonce(&runner, dest_address, Wei::zero(), 0.into());
// do transfer
let result = runner
.submit_with_signer(&mut source_account, transaction)
.unwrap();
let spent_amount = Wei::new_u64(GAS_PRICE * result.gas_used);
let expected_source_balance = INITIAL_BALANCE - TRANSFER_AMOUNT - spent_amount;
let expected_dest_balance = TRANSFER_AMOUNT;
let expected_relayer_balance = spent_amount;
let relayer_address = types::near_account_to_evm_address(
runner.context.predecessor_account_id.as_ref().as_bytes(),
);
// validate post-state
test_utils::validate_address_balance_and_nonce(
&runner,
source_address,
expected_source_balance,
(INITIAL_NONCE + 1).into(),
);
test_utils::validate_address_balance_and_nonce(
&runner,
dest_address,
expected_dest_balance,
0.into(),
);
test_utils::validate_address_balance_and_nonce(
&runner,
relayer_address,
expected_relayer_balance,
0.into(),
);
} | rust_cleaned_test_functions.jsonl/131048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 737
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
4138,
74716,
82116,
18632,
368,
341,
262,
1077,
320,
6984,
22259,
11,
5206,
2530,
13500,
11,
3201,
6744,
8,
284,
9468,
35403,
543,
262,
1077,
2530,
6744,
284,
1273,
17309,
486,
4995,
5673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_attribute_view_from_per_attribute() {
let reference_points = vec![
TestPointType {
intensity: 42,
gps_time: 0.123,
},
TestPointType {
intensity: 43,
gps_time: 0.456,
},
];
let mut storage = PerAttributeVecPointStorage::new(TestPointType::layout());
storage.push_point(reference_points[0]);
storage.push_point(reference_points[1]);
{
let first_attribute_mut_view =
storage.iter_attribute_mut::<u16>(&attributes::INTENSITY);
first_attribute_mut_view.for_each(|a| {
*a *= 2;
});
}
let modified_intensities = vec![84_u16, 86_u16];
{
let attribute_by_val_collected = storage
.iter_attribute::<u16>(&attributes::INTENSITY)
.collect::<Vec<_>>();
assert_eq!(modified_intensities, attribute_by_val_collected);
}
{
let attribute_by_ref_view = storage.iter_attribute_ref::<u16>(&attributes::INTENSITY);
let attribute_by_ref_collected = attribute_by_ref_view.map(|a| *a).collect::<Vec<_>>();
assert_eq!(modified_intensities, attribute_by_ref_collected);
}
} | rust_cleaned_test_functions.jsonl/73944 | {
"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,
19487,
16791,
7122,
5673,
5678,
16791,
368,
341,
286,
1077,
5785,
12928,
284,
7486,
90515,
310,
3393,
2609,
929,
341,
394,
20612,
25,
220,
19,
17,
345,
394,
45567,
3009,
25,
220,
15,
13,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytes_set_memory() {
use slice::bytes::MutableByteVector;
let mut values = [1u8,2,3,4,5];
values.mut_slice(0,5).set_memory(0xAB);
assert!(values == [0xAB, 0xAB, 0xAB, 0xAB, 0xAB]);
values.mut_slice(2,4).set_memory(0xFF);
assert!(values == [0xAB, 0xAB, 0xFF, 0xFF, 0xAB]);
} | rust_cleaned_test_functions.jsonl/33158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
2602,
19195,
368,
341,
286,
990,
15983,
486,
9651,
486,
11217,
7153,
3781,
280,
286,
1077,
5206,
2750,
284,
508,
16,
84,
23,
11,
17,
11,
18,
11,
19,
11,
20,
935,
286,
2750,
744,
332,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_profile_map() -> Result<(), StsClientError> {
let prof_map = AwsProfileInfo::fill_profile_map()?;
for (k, v) in &prof_map {
println!("{} {:?}", k, v);
}
assert!(prof_map.len() > 0);
assert!(prof_map.contains_key("default"));
Ok(())
} | rust_cleaned_test_functions.jsonl/7880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
13789,
5376,
368,
1464,
5714,
68843,
794,
82,
2959,
1454,
29,
341,
286,
1077,
2778,
5376,
284,
40083,
8526,
1731,
486,
7559,
13789,
5376,
94136,
286,
369,
320,
74,
11,
348,
8,
304,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_log2() {
let tests = vec![
(Datum::F64(16_f64), 4_f64),
(Datum::F64(5_f64), 2.321928094887362_f64),
];
let tests_invalid_f64 = vec![
(Datum::F64(-1.234_f64), Datum::Null),
(Datum::F64(0_f64), Datum::Null),
(Datum::Null, Datum::Null),
];
for (arg, exp) in tests {
let got = eval_func(ScalarFuncSig::Log2, &[arg]).unwrap();
assert!((got.f64() - exp).abs() < f64::EPSILON);
}
for (arg, exp) in tests_invalid_f64 {
let got = eval_func(ScalarFuncSig::Log2, &[arg]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/13164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
17,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
68036,
486,
37,
21,
19,
7,
16,
21,
761,
21,
19,
701,
220,
19,
761,
21,
19,
1326,
310,
320,
68036,
486,
37,
21,
19,
7,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_call_reg() {
let prog = &mut [
0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // r0 = 0
0xb7, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // r8 = 1
0x67, 0x08, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x47, 0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
0x8D, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // callx r8
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // exit
0xb7, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, // r0 = 42
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // exit
];
let mut vm = EbpfVm::new(None).unwrap();
vm.set_program(prog).unwrap();
assert_eq!(42, vm.execute_program(&[], &[], &[]).unwrap());
} | rust_cleaned_test_functions.jsonl/15542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
4920,
368,
341,
262,
1077,
29271,
284,
609,
6984,
2278,
286,
220,
15,
7929,
22,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_empty() {
let mut vector_in:Vec<i32> = vec![];
merge_sort(&mut vector_in);
debug_assert_eq!(vector_in, &[]);
} | rust_cleaned_test_functions.jsonl/25081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
15124,
368,
341,
286,
1077,
5206,
4621,
1243,
25,
10050,
21897,
18,
17,
29,
284,
7486,
0,
15078,
286,
10880,
18435,
2099,
6984,
4621,
1243,
317,
286,
7390,
16553,
10714,
10297,
3215,
1243,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bool_array_and_sliced_same_offset_mod8() {
let a = BooleanArray::from(vec![
false, false, true, true, false, false, false, false, false, false, false,
false,
]);
let b = BooleanArray::from(vec![
false, false, false, false, false, false, false, false, false, true, false,
true,
]);
let a = a.slice(0, 4);
let a = a.as_any().downcast_ref::<BooleanArray>().unwrap();
let b = b.slice(8, 4);
let b = b.as_any().downcast_ref::<BooleanArray>().unwrap();
let c = and(&a, &b).unwrap();
assert_eq!(4, c.len());
assert_eq!(false, c.value(0));
assert_eq!(false, c.value(1));
assert_eq!(false, c.value(2));
assert_eq!(true, c.value(3));
} | rust_cleaned_test_functions.jsonl/118981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
3858,
8378,
643,
74630,
33574,
6917,
7480,
23,
368,
341,
286,
1077,
264,
284,
6992,
1857,
486,
1499,
25592,
90515,
310,
895,
11,
895,
11,
830,
11,
830,
11,
895,
11,
895,
11,
895,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_stack() {
test_interpreter_and_jit_asm!(
"
mov r1, 0x78636261
stxw [r10-8], r1
mov r6, 0x0
stxb [r10-4], r6
stxb [r10-12], r6
mov r1, 0x79636261
stxw [r10-16], r1
mov r1, r10
add r1, -8
mov r2, r1
syscall BpfStrCmp
mov r1, r0
mov r0, 0x1
lsh r1, 0x20
rsh r1, 0x20
jne r1, 0x0, +11
mov r1, r10
add r1, -8
mov r2, r10
add r2, -16
syscall BpfStrCmp
mov r1, r0
lsh r1, 0x20
rsh r1, 0x20
mov r0, 0x1
jeq r1, r6, +1
mov r0, 0x0
exit",
[],
(
b"BpfStrCmp" => syscalls::BpfStrCmp::call; syscalls::BpfStrCmp {},
),
{ |_vm, res: Result| { res.unwrap() == 0x0 } },
28
);
} | rust_cleaned_test_functions.jsonl/59032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 604
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
15528,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
16,
11,
220,
15,
87,
22,
23,
21,
18,
21,
17,
21,
16,
198,
286,
357,
87,
86,
508,
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... | 1 |
#[test]
fn test_heikin_ashi() {
let mut candles = RandomCandles::default();
let first = candles.first();
let mut heikin_ashi = HeikinAshi::new((), &first).unwrap();
let prev = candles.first();
candles
.take(100)
.map(|candle| {
let open = (prev.open() + prev.close()) / 2.0;
let close = (candle.open() + candle.high() + candle.low() + candle.close()) / 4.0;
let tested = Candle {
open,
high: candle.high().max(open).max(close),
low: candle.low().min(open).min(close),
close,
..candle
};
(tested, heikin_ashi.next(&candle))
})
.inspect(|(original, ha)| assert_eq_float(original.close(), ha.close()))
.inspect(|(original, ha)| assert_eq_float(original.high(), ha.high()))
.inspect(|(original, ha)| assert_eq_float(original.low(), ha.low()))
.inspect(|(original, ha)| assert_eq_float(original.close(), ha.close()))
.for_each(|(original, ha)| assert_eq_float(original.volume(), ha.volume()));
} | rust_cleaned_test_functions.jsonl/24547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41876,
1579,
258,
62,
30378,
368,
341,
197,
10217,
5206,
51205,
284,
10612,
34,
20125,
486,
2258,
1428,
197,
10217,
1156,
284,
51205,
7389,
543,
197,
10217,
5206,
566,
1579,
258,
62,
30378,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_edgengram_tokenizer_right() {
let tokenizer = NGramTokenizer::new("hello world", 2, 3, Edge::Right);
let tokens = tokenizer.collect::<Vec<Token>>();
assert_eq!(tokens, vec![
Token { term: Term::from_string("lo"), position: 1 },
Token { term: Term::from_string("llo"), position: 1 },
Token { term: Term::from_string("ld"), position: 2 },
Token { term: Term::from_string("rld"), position: 2 },
]);
} | rust_cleaned_test_functions.jsonl/50145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32370,
70,
826,
2396,
6458,
3135,
10539,
368,
341,
286,
1077,
45958,
284,
20018,
2396,
37434,
486,
931,
445,
14990,
1879,
497,
220,
17,
11,
220,
18,
11,
10349,
486,
5979,
317,
286,
1077,
11211,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dialects() -> Result<()> {
// Generic
let query: Query = parse(
r###"
prql dialect:generic
from Employees
select [FirstName]
take 3
"###,
)?;
assert_display_snapshot!((resolve_and_translate(query)?), @r###"
SELECT
FirstName
FROM
Employees
LIMIT
3
"###);
// SQL server
let query: Query = parse(
r###"
prql dialect:mssql
from Employees
select [FirstName]
take 3
"###,
)?;
assert_display_snapshot!((resolve_and_translate(query)?), @r###"
SELECT
TOP (3) FirstName
FROM
Employees
"###);
Ok(())
} | rust_cleaned_test_functions.jsonl/62563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
55056,
82,
368,
1464,
5714,
71698,
341,
286,
442,
21281,
198,
286,
1077,
3239,
25,
11361,
284,
4715,
1006,
310,
435,
14374,
698,
286,
548,
1470,
42279,
25,
35787,
198,
286,
504,
43641,
198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_install_mode_numeric() {
let (at, mut ucmd) = at_and_ucmd!();
let dir = "test_install_target_dir_dir_e";
let file = "test_install_target_dir_file_e";
let mode_arg = "--mode=333";
at.touch(file);
at.mkdir(dir);
ucmd.arg(file).arg(dir).arg(mode_arg).succeeds().no_stderr();
let dest_file = &format!("{}/{}", dir, file);
assert!(at.file_exists(file));
assert!(at.file_exists(dest_file));
let permissions = at.metadata(dest_file).permissions();
assert_eq!(0o100333 as u32, PermissionsExt::mode(&permissions));
} | rust_cleaned_test_functions.jsonl/124409 | {
"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,
34245,
7302,
29418,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
5419,
284,
330,
1944,
34245,
11123,
4334,
4334,
2204,
876,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_type() {
let table_create = TableCreateCommand::new("Test".to_string())
.key_type(DataType::TokyoGeoPoint);
let mut arg: HashMap<String, String> = HashMap::new();
arg.insert("key_type".to_string(), "TokyoGeoPoint".to_string());
let expected = TableCreateCommand {
command: TableCreate,
name: "Test".to_string(),
arguments: arg,
};
assert_eq!(expected, table_create);
} | rust_cleaned_test_functions.jsonl/74221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
1819,
368,
341,
286,
1077,
1965,
8657,
284,
6633,
4021,
4062,
486,
931,
445,
2271,
3263,
983,
3904,
2398,
310,
659,
792,
1819,
63941,
486,
52854,
16032,
37344,
2609,
317,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compact_bools() {
let bools = &[
false, false, true, true, false, false, true, false, true, false,
];
let collected = compact_bools(bools);
let indexes: Vec<_> = iter_set_bools(bools).collect();
assert_eq!(collected.as_slice(), &[0b01001100, 0b00000001]);
assert_eq!(indexes.as_slice(), &[2, 3, 6, 8])
} | rust_cleaned_test_functions.jsonl/29075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
531,
22159,
82,
368,
341,
286,
1077,
1807,
82,
284,
609,
9640,
310,
895,
11,
895,
11,
830,
11,
830,
11,
895,
11,
895,
11,
830,
11,
895,
11,
830,
11,
895,
345,
286,
9747,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_receive_echo() {
crate::testutil::set_logger_for_test();
let req = IcmpEchoRequest::new(0, 0);
let req_body = &[1, 2, 3, 4];
let mut buffer = BufferSerializer::new_vec(Buf::new(req_body.to_vec(), ..))
.encapsulate(IcmpPacketBuilder::<Ipv4, &[u8], _>::new(
DUMMY_CONFIG_V4.remote_ip,
DUMMY_CONFIG_V4.local_ip,
IcmpUnusedCode,
req,
))
.serialize_outer()
.unwrap();
test_receive_ip_packet(
buffer.as_mut(),
DUMMY_CONFIG_V4.local_ip,
64,
IpProto::Icmp,
&["receive_icmp_packet::echo_request", "send_ip_packet"],
req.reply(),
IcmpUnusedCode,
|packet| assert_eq!(packet.original_packet().bytes(), req_body),
);
} | rust_cleaned_test_functions.jsonl/55690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 523
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38557,
68628,
368,
341,
286,
17717,
486,
1944,
1314,
486,
746,
27413,
5478,
4452,
1428,
286,
1077,
4232,
284,
358,
7293,
74994,
1900,
486,
931,
7,
15,
11,
220,
15,
317,
286,
1077,
4232,
14114,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_divu_pair() {
for d in 1..1024 {
for x in 0..1000 {
let ab = divu_gen(d as u32);
assert_eq!(x / d, divu_pair(x, ab));
}
}
} | rust_cleaned_test_functions.jsonl/46711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
84,
14445,
368,
341,
262,
369,
294,
304,
220,
16,
496,
16,
15,
17,
19,
341,
414,
369,
856,
304,
220,
15,
496,
16,
15,
15,
15,
341,
286,
1077,
668,
284,
3429,
84,
16322,
1500,
438,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_real_as_signed_real() {
test_none_with_nothing(cast_real_as_signed_real);
let cs = vec![
(f64::from(f32::MIN), f64::from(f32::MIN)),
(f64::from(f32::MAX), f64::from(f32::MAX)),
(f64::MIN, f64::MIN),
(0f64, 0f64),
(f64::MAX, f64::MAX),
(i64::MIN as f64, i64::MIN as f64),
(i64::MAX as f64, i64::MAX as f64),
(u64::MAX as f64, u64::MAX as f64),
];
for (input, expect) in cs {
let r = cast_real_as_signed_real(Some(Real::new(input).as_ref().unwrap()));
let r = r.map(|x| x.map(|x| x.into_inner()));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/1960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
11898,
55617,
15266,
368,
341,
286,
1273,
31488,
6615,
6536,
1596,
1337,
559,
15266,
11898,
55617,
15266,
626,
286,
1077,
10532,
284,
7486,
90515,
3374,
310,
320,
69,
21,
19,
486,
1499,
955... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decrypt_handle_bytes() {
let handle = DecryptHandle(RistrettoPoint::default());
let encoded = handle.to_bytes();
let decoded = DecryptHandle::from_bytes(&encoded).unwrap();
assert_eq!(handle, decoded);
} | rust_cleaned_test_functions.jsonl/36661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80764,
10630,
12524,
368,
341,
286,
1077,
3705,
284,
89146,
6999,
2785,
380,
2122,
983,
2609,
486,
2258,
5231,
286,
1077,
20498,
284,
3705,
2389,
12524,
543,
286,
1077,
29213,
284,
89146,
6999,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_case_1() {
let input = vec![16, 1, 2, 0, 4, 2, 7, 1, 2, 14];
assert_eq!(37, align_cheapest(&input));
} | rust_cleaned_test_functions.jsonl/27454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
16,
368,
341,
286,
1077,
1946,
284,
7486,
20703,
16,
21,
11,
220,
16,
11,
220,
17,
11,
220,
15,
11,
220,
19,
11,
220,
17,
11,
220,
22,
11,
220,
16,
11,
220,
17,
11,
220,
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_rpc_invalid_requests() {
solana_logger::setup();
let alice = Keypair::new();
let test_validator = TestValidator::with_no_fees(alice.pubkey(), None);
let rpc_url = test_validator.rpc_url();
let bob_pubkey = solana_sdk::pubkey::new_rand();
// test invalid get_balance request
let req = json_req!("getBalance", json!(["invalid9999"]));
let json = post_rpc(req, &rpc_url);
let the_error = json["error"]["message"].as_str().unwrap();
assert_eq!(the_error, "Invalid param: Invalid");
// test invalid get_account_info request
let req = json_req!("getAccountInfo", json!(["invalid9999"]));
let json = post_rpc(req, &rpc_url);
let the_error = json["error"]["message"].as_str().unwrap();
assert_eq!(the_error, "Invalid param: Invalid");
// test invalid get_account_info request
let req = json_req!("getAccountInfo", json!([bob_pubkey.to_string()]));
let json = post_rpc(req, &rpc_url);
let the_value = &json["result"]["value"];
assert!(the_value.is_null());
} | rust_cleaned_test_functions.jsonl/64563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 422
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
31433,
37216,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
70433,
284,
6569,
1082,
1310,
486,
931,
543,
262,
1077,
1273,
64959,
284,
3393,
14256,
486,
4197,
6536,
761,
551... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_watch_devices_remove_existing_phy() {
let mut exec = fasync::TestExecutor::new().expect("failed to create an executor");
let test_values = test_setup();
let watcher_fut = test_values.watcher_fut;
pin_mut!(watcher_fut);
let service_fut = serve_monitor_requests(
test_values.monitor_req_stream,
test_values.phys.clone(),
test_values.ifaces.clone(),
test_values.watcher_service,
test_values.dev_proxy,
);
pin_mut!(service_fut);
assert_variant!(exec.run_until_stalled(&mut service_fut), Poll::Pending);
// Add a PHY before beginning to watch for devices.
let (phy, _phy_stream) = fake_phy();
test_values.phys.insert(0, phy);
assert_variant!(exec.run_until_stalled(&mut watcher_fut), Poll::Pending);
// Watch for new devices.
let (watcher_proxy, watcher_server_end) =
fidl::endpoints::create_proxy().expect("failed to create watcher proxy");
test_values
.monitor_proxy
.watch_devices(watcher_server_end)
.expect("failed to watch devices");
// Progress the service loop.
assert_variant!(exec.run_until_stalled(&mut service_fut), Poll::Pending);
// Start listening for device events.
let mut events_fut = watcher_proxy.take_event_stream();
let next_fut = events_fut.try_next();
pin_mut!(next_fut);
assert_variant!(exec.run_until_stalled(&mut next_fut), Poll::Pending);
// We should be notified of the existing PHY.
assert_variant!(exec.run_until_stalled(&mut watcher_fut), Poll::Pending);
assert_variant!(
exec.run_until_stalled(&mut next_fut),
Poll::Ready(Ok(Some(fidl_svc::DeviceWatcherEvent::OnPhyAdded { phy_id: 0 })))
);
// Remove the PHY and make sure the update is received.
test_values.phys.remove(&0);
assert_variant!(exec.run_until_stalled(&mut watcher_fut), Poll::Pending);
assert_variant!(
exec.run_until_stalled(&mut next_fut),
Poll::Ready(Ok(Some(fidl_svc::DeviceWatcherEvent::OnPhyRemoved { phy_id: 0 })))
);
} | rust_cleaned_test_functions.jsonl/20591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1030
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58562,
41334,
18193,
62630,
50266,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
1273,
9146,
284,
127... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter() {
let bv = BitVec::from_bytes(&[0b1101_0000]);
assert_eq!(
(&bv).into_iter().collect::<Vec<bool>>(),
vec![true, true, false, true, false, false, false, false],
);
assert_eq!(
bv.into_iter().collect::<Vec<bool>>(),
vec![true, true, false, true, false, false, false, false],
);
} | rust_cleaned_test_functions.jsonl/128608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
286,
1077,
56937,
284,
6495,
10050,
486,
1499,
12524,
2099,
58,
15,
65,
16,
16,
15,
16,
62,
15,
15,
15,
15,
10149,
286,
2060,
10714,
33673,
310,
15899,
54929,
568,
18122,
1172... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drain_sorted_leak() {
static DROPS: AtomicU32 = AtomicU32::new(0);
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
struct D(u32, bool);
impl Drop for D {
fn drop(&mut self) {
DROPS.fetch_add(1, Ordering::SeqCst);
if self.1 {
panic!("panic in `drop`");
}
}
}
let mut q = BinaryHeap::from(vec![
D(0, false),
D(1, false),
D(2, false),
D(3, true),
D(4, false),
D(5, false),
]);
catch_unwind(AssertUnwindSafe(|| drop(q.drain_sorted()))).ok();
assert_eq!(DROPS.load(Ordering::SeqCst), 6);
} | rust_cleaned_test_functions.jsonl/62368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
41277,
11751,
585,
368,
341,
262,
1099,
422,
1285,
5012,
25,
30316,
52,
18,
17,
284,
30316,
52,
18,
17,
486,
931,
7,
15,
626,
262,
11506,
27098,
65297,
11,
55039,
11,
33122,
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... | 2 |
#[test]
fn test_no_builder_double_free2() {
let builder = {
let context = Context::create();
context.create_builder()
// Original Context drops fine
};
// Builder continues to function with different context
let context = Context::create();
let module = context.create_module("my_mod");
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[], false);
let fn_value = module.add_function("my_fn", fn_type, None);
let entry = fn_value.append_basic_block("entry");
builder.position_at_end(&entry);
// FIXME: Builder segfaults when making build calls with different context
// 2nd Context drops fine
// Builder drops fine
} | rust_cleaned_test_functions.jsonl/39118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
28532,
24598,
8905,
17,
368,
341,
262,
1077,
7363,
284,
341,
286,
1077,
2266,
284,
9608,
486,
3182,
1428,
286,
2266,
2520,
28532,
2822,
286,
442,
17230,
9608,
21025,
6915,
198,
262,
3634,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_read_message() {
let msg1 = b"content-length: 12\r\n\r\nhello world";
let mut reader1 = std::io::Cursor::new(msg1);
read_message(&mut reader1).unwrap();
} | rust_cleaned_test_functions.jsonl/70778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
6443,
6462,
368,
341,
262,
1077,
3750,
16,
284,
293,
1,
1796,
29325,
25,
220,
16,
17,
12016,
1699,
12016,
1699,
14990,
1879,
876,
262,
1077,
5206,
6604,
16,
284,
1460,
486,
815,
486,
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 |
#[test]
fn test_rebase_descendants_basic_branch_update() {
let settings = testutils::user_settings();
let test_repo = testutils::init_repo(&settings, false);
let repo = &test_repo.repo;
// be updated to point to B2.
// B main B2 main
// A A
let mut tx = repo.start_transaction("test");
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
let commit_a = graph_builder.initial_commit();
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
tx.mut_repo()
.set_local_branch("main".to_string(), RefTarget::Normal(commit_b.id().clone()));
let repo = tx.commit();
let mut tx = repo.start_transaction("test");
let commit_b2 = CommitBuilder::for_rewrite_from(&settings, repo.store(), &commit_b)
.write_to_repo(tx.mut_repo());
tx.mut_repo().rebase_descendants(&settings);
assert_eq!(
tx.mut_repo().get_local_branch("main"),
Some(RefTarget::Normal(commit_b2.id().clone()))
);
assert_eq!(
*tx.mut_repo().view().heads(),
hashset! {commit_b2.id().clone()}
);
} | rust_cleaned_test_functions.jsonl/130809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
3152,
10986,
28310,
34729,
28031,
8882,
368,
341,
262,
1077,
5003,
284,
1273,
6031,
486,
872,
10853,
543,
262,
1077,
1273,
37784,
284,
1273,
6031,
486,
2327,
37784,
2099,
6511,
11,
895,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.