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_open_write() {
let tmp = tempfile::TempDir::new().unwrap();
let file = EncryptedFile::new(tmp.path(), "encrypted");
assert_eq!(file.base, tmp.path());
assert_eq!(file.name, "encrypted");
let ret = file.read(&PlaintextBacklightlike::default());
assert_matches!(ret, Err(Error::Io(_)));
if let Err(Error::Io(e)) = file.read(&PlaintextBacklightlike::default()) {
assert_eq!(ErrorKind::NotFound, e.kind());
}
let content = b"test content";
file.write(content, &PlaintextBacklightlike::default()).unwrap();
drop(file);
let file = EncryptedFile::new(tmp.path(), "encrypted");
assert_eq!(file.read(&PlaintextBacklightlike::default()).unwrap(), content);
} | rust_cleaned_test_functions.jsonl/8376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
9165,
368,
341,
286,
1077,
4174,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
1034,
284,
10751,
14026,
1703,
486,
931,
10368,
3875,
1507,
330,
36444,
797,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_mint() {
let mut service = TestService::new();
let caller = TestService::caller();
let ctx = mock_context(caller);
let asset = create_asset!(service, ctx.clone(), 10000, 10);
let recipient = Address::from_hex("0x666cdba6ae4f479f7164792b318b2a06c759833b").unwrap();
let asset_to_mint = MintAssetPayload {
asset_id: asset.id.clone(),
to: recipient.clone(),
amount: 100,
proof: Hex::from_string("0x1122".to_owned()).unwrap(),
memo: "".to_owned(),
};
let minted = service.mint(ctx, asset_to_mint.clone());
assert!(minted.is_error(), "mint require admin permission");
let ctx = mock_context(TestService::admin());
service_call!(service, mint, ctx.clone(), asset_to_mint);
assert_eq!(ctx.get_events().len(), 1);
let event: MintAssetEvent = serde_json::from_str(&ctx.get_events()[0].data).expect("event");
assert_eq!(event.asset_id, asset.id);
assert_eq!(event.to, recipient);
assert_eq!(event.amount, 100);
let recipient_balance = service_call!(service, get_balance, ctx.clone(), GetBalancePayload {
asset_id: asset.id.clone(),
user: recipient,
});
assert_eq!(recipient_balance.balance, 100);
let asset_ret = service_call!(service, get_asset, ctx, GetAssetPayload { id: asset.id });
assert_eq!(asset_ret.supply, 10100)
} | rust_cleaned_test_functions.jsonl/27233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
396,
368,
341,
262,
1077,
5206,
2473,
284,
3393,
1860,
486,
931,
543,
262,
1077,
19865,
284,
3393,
1860,
486,
56126,
543,
262,
1077,
5635,
284,
7860,
8467,
1337,
13956,
317,
262,
1077,
9329... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scalar_squaring() {
let a = Scalar(blst::blst_fr {
l: [
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0x73eda753299d7d47,
],
});
assert_eq!(
a.square(),
Scalar::from_u64s_le(&[
0xc0d698e7bde077b8,
0xb79a310579e76ec2,
0xac1da8d0a9af4e5f,
0x13f629c49bf23e97
])
.unwrap()
);
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..1000000 {
let a = Scalar::random(&mut rng);
let tmp = a.square();
let mut tmp2 = a;
tmp2.mul_assign(&a);
assert_eq!(tmp, tmp2);
}
} | rust_cleaned_test_functions.jsonl/54671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 667
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
643,
446,
3249,
368,
341,
286,
1077,
264,
284,
35176,
29811,
267,
486,
2024,
267,
41537,
341,
310,
326,
25,
2278,
394,
220,
15,
41798,
53697,
345,
394,
220,
15,
41798,
53697,
345,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_empty_projection() {
let testdata = arrow::util::test_util::parquet_test_data();
let path = format!("{}/alltypes_plain.parquet", testdata);
let file = File::open(&path).unwrap();
let mut arrow_reader = ParquetFileArrowReader::try_new(file).unwrap();
let file_metadata = arrow_reader.metadata().file_metadata();
let expected_rows = file_metadata.num_rows() as usize;
let schema = file_metadata.schema_descr_ptr();
let mask = ProjectionMask::leaves(&schema, []);
let batch_reader = arrow_reader.get_record_reader_by_columns(mask, 2).unwrap();
let mut total_rows = 0;
for maybe_batch in batch_reader {
let batch = maybe_batch.unwrap();
total_rows += batch.num_rows();
assert_eq!(batch.num_columns(), 0);
assert!(batch.num_rows() <= 2);
}
assert_eq!(total_rows, expected_rows);
} | rust_cleaned_test_functions.jsonl/83386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
72738,
368,
341,
286,
1077,
1273,
691,
284,
17921,
486,
1314,
486,
1944,
18974,
486,
1732,
23300,
4452,
1769,
543,
286,
1077,
1815,
284,
3561,
88928,
4472,
541,
9242,
41015,
33277,
23300,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_varlist_combine_same_lists() {
let mut lst1: Vec<Var> = vec![];
lst1.push(generate_var2(
0,
0,
5,
vec!["A".to_string(), "G".to_string()],
));
lst1.push(generate_var2(
1,
0,
100,
vec!["T".to_string(), "A".to_string()],
));
lst1.push(generate_var2(
2,
0,
200,
vec!["T".to_string(), "G".to_string()],
));
let mut vlst1 = VarList::new(
lst1,
vec!["chr1".to_string(), "chr2".to_string(), "chr3".to_string()],
)
.unwrap();
let vlst1_bak = vlst1.clone();
let mut lst2: Vec<Var> = vec![];
lst2.push(generate_var2(
0,
0,
5,
vec!["A".to_string(), "G".to_string()],
));
lst2.push(generate_var2(
1,
0,
100,
vec!["T".to_string(), "A".to_string()],
));
lst2.push(generate_var2(
2,
0,
200,
vec!["T".to_string(), "G".to_string()],
));
let mut vlst2 = VarList::new(
lst2,
vec!["chr1".to_string(), "chr2".to_string(), "chr3".to_string()],
)
.unwrap();
vlst1.combine(&mut vlst2).unwrap();
assert!(varlist_pos_alleles_eq(vlst1, vlst1_bak));
} | rust_cleaned_test_functions.jsonl/25112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 956
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
1607,
72374,
33574,
37288,
368,
341,
286,
1077,
5206,
18845,
16,
25,
11312,
27,
3962,
29,
284,
7486,
0,
15078,
286,
18845,
16,
2552,
3268,
13220,
4612,
17,
1006,
310,
220,
15,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_state_synchronization() {
// - Kill one node and continue submitting transactions to the others.
// - Restart the node
// - Wait for all the nodes to catch up
// - Verify that the restarted node has synced up with the submitted transactions.
let mut swarm = new_local_swarm(4);
for validator in swarm.validators_mut() {
let mut config = validator.config().clone();
config.state_sync.chunk_limit = 5;
config.save(validator.config_path()).unwrap();
validator.restart().unwrap();
}
swarm.launch().unwrap(); // Make sure all nodes are healthy and live
let validator_peer_ids = swarm.validators().map(|v| v.peer_id()).collect::<Vec<_>>();
let client_1 = swarm
.validator(validator_peer_ids[1])
.unwrap()
.json_rpc_client();
let transaction_factory = swarm.chain_info().transaction_factory();
let mut account_0 = create_and_fund_account(&mut swarm, 100);
let account_1 = create_and_fund_account(&mut swarm, 10);
transfer_coins(
&client_1,
&transaction_factory,
&mut account_0,
&account_1,
10,
);
assert_balance(&client_1, &account_0, 90);
assert_balance(&client_1, &account_1, 20);
// Stop a node
let node_to_restart = validator_peer_ids[0];
swarm.validator_mut(node_to_restart).unwrap().stop();
// Do a transfer and ensure it still executes
transfer_coins(
&client_1,
&transaction_factory,
&mut account_0,
&account_1,
1,
);
assert_balance(&client_1, &account_0, 89);
assert_balance(&client_1, &account_1, 21);
// Restart killed node and wait for all nodes to catchup
swarm
.validator_mut(node_to_restart)
.unwrap()
.start()
.unwrap();
swarm
.validator_mut(node_to_restart)
.unwrap()
.wait_until_healthy(Instant::now() + Duration::from_secs(10))
.unwrap();
swarm
.wait_for_all_nodes_to_catchup(Instant::now() + Duration::from_secs(60))
.unwrap();
// Connect to the newly recovered node and verify its state
let client_0 = swarm.validator(node_to_restart).unwrap().json_rpc_client();
assert_balance(&client_0, &account_0, 89);
assert_balance(&client_0, &account_1, 21);
// Test multiple chunk sync
swarm.validator_mut(node_to_restart).unwrap().stop();
for _ in 0..10 {
transfer_coins(
&client_1,
&transaction_factory,
&mut account_0,
&account_1,
1,
);
}
assert_balance(&client_1, &account_0, 79);
assert_balance(&client_1, &account_1, 31);
// Restart killed node and wait for all nodes to catchup
swarm
.validator_mut(node_to_restart)
.unwrap()
.start()
.unwrap();
swarm
.validator_mut(node_to_restart)
.unwrap()
.wait_until_healthy(Instant::now() + Duration::from_secs(10))
.unwrap();
swarm
.wait_for_all_nodes_to_catchup(Instant::now() + Duration::from_secs(60))
.unwrap();
assert_balance(&client_0, &account_0, 79);
assert_balance(&client_0, &account_1, 31);
} | rust_cleaned_test_functions.jsonl/10524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1432
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
4387,
643,
67929,
368,
341,
1066,
262,
442,
481,
26835,
825,
2436,
323,
3060,
33094,
14131,
311,
279,
3800,
624,
262,
442,
481,
56801,
279,
2436,
198,
262,
442,
481,
13824,
369,
678,
279,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_trim_end() {
let result = trim_end(&to_value(" hello ").unwrap(), &HashMap::new());
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(" hello").unwrap());
} | rust_cleaned_test_functions.jsonl/119638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70025,
6213,
368,
341,
286,
1077,
1102,
284,
11013,
6213,
2099,
983,
3142,
445,
220,
23811,
220,
27510,
15454,
1507,
609,
18497,
486,
931,
1423,
286,
2060,
10297,
1382,
2079,
19817,
1423,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vectors() {
let x: Vec<i32> = vec![];
assert_eq!(format!("{:?}", x), "[]");
assert_eq!(format!("{:?}", vec![1]), "[1]");
assert_eq!(format!("{:?}", vec![1, 2, 3]), "[1, 2, 3]");
assert!(format!("{:?}", vec![vec![], vec![1], vec![1, 1]]) == "[[], [1], [1, 1]]");
} | rust_cleaned_test_functions.jsonl/3180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49158,
368,
341,
262,
1077,
856,
25,
11312,
21897,
18,
17,
29,
284,
7486,
0,
15078,
262,
2060,
10714,
10297,
2243,
88928,
25,
52652,
856,
701,
330,
1294,
797,
262,
2060,
10714,
10297,
2243,
8892... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_write_positions() -> crate::Result<()> {
let mut positions_buffer = vec![];
let mut serializer = PositionSerializer::new(&mut positions_buffer);
serializer.write_positions_delta(&[1u32, 12u32]);
serializer.write_positions_delta(&[4u32, 17u32]);
serializer.write_positions_delta(&[443u32]);
serializer.close_term()?;
serializer.close()?;
let position_delta = OwnedBytes::new(positions_buffer);
let mut output_delta_pos_buffer = vec![0u32; 5];
let mut position_reader = PositionReader::open(position_delta)?;
position_reader.read(0, &mut output_delta_pos_buffer[..]);
assert_eq!(
&output_delta_pos_buffer[..],
&[1u32, 12u32, 4u32, 17u32, 443u32]
);
Ok(())
} | rust_cleaned_test_functions.jsonl/110171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
9165,
37219,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
1077,
5206,
9892,
7776,
284,
7486,
0,
15078,
286,
1077,
5206,
21759,
284,
12380,
13909,
486,
931,
2099,
6984,
9892,
7776,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_user_update() {
let pool = BDPool::new().unwrap();
let con = pool.get().unwrap();
let new_user = NewUser::new(
"user_test_user_update@email.com",
"user_test_user_update",
"some_password",
);
let mut user = new_user.create(&con).unwrap();
user.email = user.email + "_other";
user.name = user.name + "_other";
user.password = user.password + "_other";
let result = User::update(&con, &user).unwrap();
assert_eq!(result.id, user.id);
assert_eq!(result.email, user.email);
assert_eq!(result.name, user.name);
assert_eq!(result.password, user.password);
assert_eq!(result.create_time, user.create_time);
assert!(result.update_time > user.update_time);
let expected = User::find_by_id(&con, user.id).unwrap();
assert_eq!(result, expected);
User::delete(&con, user.id).unwrap();
} | rust_cleaned_test_functions.jsonl/32737 | {
"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,
3317,
8882,
368,
341,
262,
1077,
7314,
284,
425,
10298,
1749,
486,
931,
1005,
15454,
543,
262,
1077,
390,
284,
7314,
670,
1005,
15454,
1428,
262,
1077,
501,
3317,
284,
1532,
1474,
486,
931,
1006... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basics() {
fn test(_: &Environment, a: u32, b: u32) -> Result<bool, Error> {
Ok(a == b)
}
let env = Environment::new();
let bx = BoxedTest::new(test);
assert!(bx
.perform(&env, Value::from(23), vec![Value::from(23)])
.unwrap());
} | rust_cleaned_test_functions.jsonl/96665 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
67981,
368,
341,
262,
5168,
1273,
73834,
609,
12723,
11,
264,
25,
575,
18,
17,
11,
293,
25,
575,
18,
17,
8,
1464,
5714,
17028,
11,
4600,
29,
341,
286,
7622,
2877,
621,
293,
340,
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_symbol_regex() {
let haystack = "sdfsdfsd symbols: Qoij345 and Ndds fgfdg";
let reg_test = SymbolRegex::new();
//Make sure the regex finds all the matches
{
let mut capture_iter = reg_test.captures_iter(haystack);
assert_eq!(capture_iter.next().unwrap().first().as_str(), "Qoij345");
assert_eq!(capture_iter.next().unwrap().first().as_str(), "Ndds");
}
//Make sure the regex correctly identifies the captures in the first regex
{
let first_match = reg_test.captures(haystack).unwrap();
assert_eq!(first_match.first().as_str(), "Qoij345");
assert_eq!(first_match.get(1).unwrap().as_str(), "Qoij");
assert_eq!(first_match.get(2).unwrap().as_str(), "345");
}
} | rust_cleaned_test_functions.jsonl/114476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21179,
41832,
368,
341,
286,
1077,
88447,
284,
330,
82,
34378,
2940,
13446,
17738,
25,
220,
1207,
78,
3172,
18,
19,
20,
323,
451,
33650,
29799,
6902,
70,
3302,
286,
1077,
1217,
4452,
284,
19612,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stylemap() -> Result<(), OdsError> {
let mut wb = WorkBook::new();
let mut ce12 = CellStyle::new("ce12", &"num2".into());
ce12.set_origin(StyleOrigin::Styles);
ce12.set_styleuse(StyleUse::Named);
ce12.set_display_name("CC12");
ce12.set_color(Rgb::new(192, 128, 0));
wb.add_cellstyle(ce12);
let mut ce11 = CellStyle::new("ce11", &"num2".into());
ce11.set_origin(StyleOrigin::Styles);
ce11.set_styleuse(StyleUse::Named);
ce11.set_display_name("CC11");
ce11.set_color(Rgb::new(0, 192, 128));
wb.add_cellstyle(ce11);
let mut ce13 = CellStyle::new("ce13", &"num4".into());
ce13.push_stylemap(StyleMap::new(
ValueCondition::content_eq("BB"),
"ce12",
CellRef::remote("s0", 4, 3),
));
ce13.push_stylemap(StyleMap::new(
ValueCondition::content_eq("CC"),
"ce11",
CellRef::remote("s0", 4, 3),
));
let ce13 = wb.add_cellstyle(ce13);
let mut sh = Sheet::new_with_name("s0");
sh.set_styled_value(4, 3, "AA", &ce13);
sh.set_styled_value(5, 3, "BB", &ce13);
sh.set_styled_value(6, 3, "CC", &ce13);
wb.push_sheet(sh);
write_ods(&mut wb, "test_out/styles.ods")?;
Ok(())
} | rust_cleaned_test_functions.jsonl/60154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 585
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15117,
2186,
368,
1464,
5714,
68843,
506,
5356,
1454,
29,
341,
262,
1077,
5206,
37858,
284,
5547,
7134,
486,
931,
1428,
262,
1077,
5206,
3761,
16,
17,
284,
13972,
2323,
486,
931,
445,
346,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_txn_store_gc3() {
let key = "k";
let store = AssertionStorage::default();
store.test_txn_store_gc3(key.as_bytes()[0]);
let (mut cluster, mut raft_store) =
AssertionStorageApiV1::new_raft_storage_with_store_count(3, key);
raft_store.test_txn_store_gc3_for_cluster(&mut cluster, key.as_bytes()[0]);
} | rust_cleaned_test_functions.jsonl/37886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
49423,
18,
368,
341,
262,
1077,
1376,
284,
330,
74,
876,
262,
1077,
3553,
284,
46730,
5793,
486,
2258,
543,
262,
3553,
5958,
92299,
14809,
49423,
18,
4857,
5357,
12524,
10116,
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_precomputed_payload() {
let payload_hash = "44ce7dd67c959e0d3524ffac1771dfbba87d2b6b4b4e99e42034a8b803f8b072";
let req = test_request("get-vanilla-query-order-key-case");
let req = SignableRequest::new(
req.method(),
req.uri(),
req.headers(),
SignableBody::Precomputed(String::from(payload_hash)),
);
let settings = SigningSettings {
payload_checksum_kind: PayloadChecksumKind::XAmzSha256,
..Default::default()
};
let signing_params = signing_params(settings);
let creq = CanonicalRequest::from(&req, &signing_params).unwrap();
assert_eq!(creq.values.content_sha256(), payload_hash);
assert!(creq.to_string().ends_with(payload_hash));
} | rust_cleaned_test_functions.jsonl/83738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
71011,
32813,
368,
341,
286,
1077,
7729,
8950,
284,
330,
19,
19,
346,
22,
631,
21,
22,
66,
24,
20,
24,
68,
15,
67,
18,
20,
17,
19,
542,
580,
16,
22,
22,
16,
2940,
65,
4645,
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_straight_flush_with_pair() {
let cards = parse_cards("As 2d 2s 3s 4s 5s 5c");
let result = hand(cards);
assert_eq!(result.hand_type, StraightFlush, "{:#?}", result);
assert_eq!(result.cards.to_vec(), parse_cards("5s 4s 3s 2s As"));
} | rust_cleaned_test_functions.jsonl/3091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
7386,
39213,
6615,
14445,
368,
341,
286,
1077,
7411,
284,
4715,
41357,
445,
2121,
220,
17,
67,
220,
17,
82,
220,
18,
82,
220,
19,
82,
220,
20,
82,
220,
20,
66,
797,
286,
1077,
1102,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_difference_size_hint() {
let s246 = BTreeSet::from([2, 4, 6]);
let s23456 = BTreeSet::from_iter(2..=6);
let mut iter = s246.difference(&s23456);
assert_eq!(iter.size_hint(), (0, Some(3)));
assert_eq!(iter.next(), None);
let s12345 = BTreeSet::from_iter(1..=5);
iter = s246.difference(&s12345);
assert_eq!(iter.size_hint(), (0, Some(3)));
assert_eq!(iter.next(), Some(&6));
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next(), None);
let s34567 = BTreeSet::from_iter(3..=7);
iter = s246.difference(&s34567);
assert_eq!(iter.size_hint(), (0, Some(3)));
assert_eq!(iter.next(), Some(&2));
assert_eq!(iter.size_hint(), (0, Some(2)));
assert_eq!(iter.next(), None);
let s1 = BTreeSet::from_iter(-9..=1);
iter = s246.difference(&s1);
assert_eq!(iter.size_hint(), (3, Some(3)));
let s2 = BTreeSet::from_iter(-9..=2);
iter = s246.difference(&s2);
assert_eq!(iter.size_hint(), (2, Some(2)));
assert_eq!(iter.next(), Some(&4));
assert_eq!(iter.size_hint(), (1, Some(1)));
let s23 = BTreeSet::from([2, 3]);
iter = s246.difference(&s23);
assert_eq!(iter.size_hint(), (1, Some(3)));
assert_eq!(iter.next(), Some(&4));
assert_eq!(iter.size_hint(), (1, Some(1)));
let s4 = BTreeSet::from([4]);
iter = s246.difference(&s4);
assert_eq!(iter.size_hint(), (2, Some(3)));
assert_eq!(iter.next(), Some(&2));
assert_eq!(iter.size_hint(), (1, Some(2)));
assert_eq!(iter.next(), Some(&6));
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next(), None);
let s56 = BTreeSet::from([5, 6]);
iter = s246.difference(&s56);
assert_eq!(iter.size_hint(), (1, Some(3)));
assert_eq!(iter.next(), Some(&2));
assert_eq!(iter.size_hint(), (0, Some(2)));
let s6 = BTreeSet::from_iter(6..=19);
iter = s246.difference(&s6);
assert_eq!(iter.size_hint(), (2, Some(2)));
assert_eq!(iter.next(), Some(&2));
assert_eq!(iter.size_hint(), (1, Some(1)));
let s7 = BTreeSet::from_iter(7..=19);
iter = s246.difference(&s7);
assert_eq!(iter.size_hint(), (3, Some(3)));
} | rust_cleaned_test_functions.jsonl/13738 | {
"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,
47525,
2368,
45825,
368,
341,
262,
1077,
274,
17,
19,
21,
284,
425,
6533,
1649,
486,
1499,
2561,
17,
11,
220,
19,
11,
220,
21,
2558,
262,
1077,
274,
17,
18,
19,
20,
21,
284,
425,
6533,
164... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_touch_set_both_time_and_date() {
let (_at, mut ucmd) = at_and_ucmd!();
let file = "test_touch_set_both_time_and_date";
ucmd.args(&[
"-t",
"2015010112342",
"-d",
"Thu Jan 01 12:34:00 2015",
file,
])
.fails();
} | rust_cleaned_test_functions.jsonl/41028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60840,
2602,
88819,
3009,
8378,
4164,
368,
341,
262,
1077,
5453,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
284,
330,
1944,
60840,
2602,
88819,
3009,
8378... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_512range_parse_panic_2() {
let err = "1000-2000".parse::<BA512Range>().unwrap_err();
assert_eq!(err, Parse512AlignedError::SplitNotFound);
} | rust_cleaned_test_functions.jsonl/25049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
20,
16,
17,
9669,
21039,
620,
31270,
62,
17,
368,
341,
286,
1077,
1848,
284,
330,
16,
15,
15,
15,
12,
17,
15,
15,
15,
3263,
6400,
27638,
7064,
20,
16,
17,
6046,
10483,
15454,
9266,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_all_transaction_outputs() {
// Create a new streaming service client and listener
let (streaming_service_client, streaming_service_listener) =
new_streaming_service_client_listener_pair();
// Note the request we expect to receive on the streaming service side
let request_start_version = 101;
let request_end_version = 200;
let request_proof_version = 300;
let expected_request =
StreamRequest::GetAllTransactionOutputs(GetAllTransactionOutputsRequest {
start_version: request_start_version,
end_version: request_end_version,
proof_version: request_proof_version,
});
// Spawn a new server thread to handle any transaction output stream requests
let _handler = spawn_service_and_expect_request(streaming_service_listener, expected_request);
// Send a transaction output stream request and verify we get a data stream listener
let response = block_on(streaming_service_client.get_all_transaction_outputs(
request_start_version,
request_end_version,
request_proof_version,
));
assert_ok!(response);
} | rust_cleaned_test_functions.jsonl/125042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5705,
28884,
35189,
368,
341,
262,
442,
4230,
264,
501,
16842,
2473,
2943,
323,
11446,
198,
262,
1077,
320,
4027,
287,
12267,
8179,
11,
16842,
12267,
46493,
8,
4035,
286,
501,
12673,
287,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_into_public_key_credential_type() {
let cbor_credential_type: cbor::Value = cbor_text!("public-key");
let credential_type = PublicKeyCredentialType::try_from(cbor_credential_type.clone());
let expected_credential_type = PublicKeyCredentialType::PublicKey;
assert_eq!(credential_type, Ok(expected_credential_type));
let created_cbor: cbor::Value = credential_type.unwrap().into();
assert_eq!(created_cbor, cbor_credential_type);
let cbor_unknown_type: cbor::Value = cbor_text!("unknown-type");
let unknown_type = PublicKeyCredentialType::try_from(cbor_unknown_type);
let expected_unknown_type = PublicKeyCredentialType::Unknown;
assert_eq!(unknown_type, Ok(expected_unknown_type));
} | rust_cleaned_test_functions.jsonl/49001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
45514,
27074,
3097,
666,
30320,
1819,
368,
341,
286,
1077,
272,
9368,
666,
30320,
1819,
25,
272,
9368,
486,
1130,
284,
272,
9368,
4326,
17223,
888,
16173,
797,
286,
1077,
40207,
1819,
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_unwrap_wrong_key() {
let mut kek = Vec::from_hex("000102030405060708090A0B0C0D0E0F").unwrap();
let data = Vec::from_hex("00112233445566778899AABBCCDDEEFF").unwrap();
let keywrap = NistAes;
let result = keywrap.wrap_key(&kek[..], &[0; 16], &data[..]);
assert_eq!(result.is_ok(), true);
kek[0] = 0xFF;
let plain = keywrap.unwrap_key(&kek[..], &[0; 16], &data[..]);
assert_eq!(plain.is_err(), true);
} | rust_cleaned_test_functions.jsonl/16546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
10097,
75198,
3097,
368,
341,
286,
1077,
5206,
1962,
74,
284,
11312,
486,
1499,
32655,
445,
15,
15,
15,
16,
15,
17,
15,
18,
15,
19,
15,
20,
15,
21,
15,
22,
15,
23,
15,
24,
15,
32,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_matches_with_last_named_child() {
allocations::record(|| {
let language = get_language("c");
let query = Query::new(
language,
"(compound_statement
(_)
(_)
(expression_statement
(identifier) @last_id) .)",
)
.unwrap();
assert_query_matches(
language,
&query,
"
void one() { a; b; c; }
void two() { d; e; }
void three() { f; g; h; i; }
",
&[(0, vec![("last_id", "c")]), (0, vec![("last_id", "i")])],
);
});
} | rust_cleaned_test_functions.jsonl/77423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 409
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
6615,
12195,
71834,
17268,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
66,
797,
286,
1077,
3239,
284,
11361,
486,
931,
1006,
310,
4128,
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... | 2 |
#[test]
fn test_until_event() {
// Menu event
let cols = vec!["send".to_string(), "name".to_string()];
let vals = vec![
Value::String {
val: "Menu".to_string(),
span: Span::test_data(),
},
Value::String {
val: "history_menu".to_string(),
span: Span::test_data(),
},
];
let menu_event = Value::Record {
cols,
vals,
span: Span::test_data(),
};
// Enter event
let cols = vec!["send".to_string()];
let vals = vec![Value::String {
val: "Enter".to_string(),
span: Span::test_data(),
}];
let enter_event = Value::Record {
cols,
vals,
span: Span::test_data(),
};
// Until event
let cols = vec!["until".to_string()];
let vals = vec![Value::List {
vals: vec![menu_event, enter_event],
span: Span::test_data(),
}];
let span = Span::test_data();
let b = EventType::try_from_columns(&cols, &vals, &span).unwrap();
assert!(matches!(b, EventType::Until(_)));
let event = Value::Record {
cols,
vals,
span: Span::test_data(),
};
let config = Config::default();
let parsed_event = parse_event(&event, &config).unwrap();
assert_eq!(
parsed_event,
ReedlineEvent::UntilFound(vec![
ReedlineEvent::Menu("history_menu".to_string()),
ReedlineEvent::Enter,
])
);
} | rust_cleaned_test_functions.jsonl/86562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 923
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44352,
6748,
368,
341,
286,
442,
9738,
1538,
198,
286,
1077,
17000,
284,
7486,
0,
1183,
6681,
3263,
983,
3904,
1507,
330,
606,
3263,
983,
3904,
33800,
286,
1077,
28356,
284,
7486,
90515,
310,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitfield_remove_wide() {
let width = 16;
let start = 0;
let mut tester = setup_wide(width, start);
let slot = width;
assert!(!tester.remove(&slot));
} | rust_cleaned_test_functions.jsonl/2214 | {
"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,
13996,
2566,
18193,
1670,
577,
368,
341,
286,
1077,
2374,
284,
220,
16,
21,
280,
286,
1077,
1191,
284,
220,
15,
280,
286,
1077,
5206,
37111,
284,
6505,
1670,
577,
16425,
11,
1191,
317,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_projection() {
let dataset = Dataset::open(fixture!("tinymarble.png")).unwrap();
let projection = dataset.projection();
assert_eq!(
projection.chars().take(16).collect::<String>(),
"GEOGCS[\"WGS 84\","
);
} | rust_cleaned_test_functions.jsonl/83430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
72738,
368,
341,
262,
1077,
10337,
284,
39183,
486,
2508,
94886,
17223,
55971,
1600,
277,
891,
3508,
15197,
15454,
543,
1066,
262,
1077,
21615,
284,
10337,
2709,
7606,
543,
262,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stream_safe_nfd() {
let okay = "Da\u{031b}\u{0316}\u{0317}\u{0318}\u{0319}\u{031c}\u{031d}\u{0300}\u{0301}\u{0302}\u{0303}\u{0304}\u{0305}\u{0306}\u{0307}\u{0308}\u{0309}\u{030a}\u{030b}\u{030c}\u{030d}\u{030e}\u{030f}\u{0310}\u{0311}\u{0312}\u{0313}\u{0314}\u{0315}\u{031a}ngerzone";
assert_eq!(is_nfd_stream_safe_quick(okay.chars()), IsNormalized::Yes);
let too_much = "Da\u{031b}\u{0316}\u{0317}\u{0318}\u{0319}\u{031c}\u{031d}\u{031e}\u{0300}\u{0301}\u{0302}\u{0303}\u{0304}\u{0305}\u{0306}\u{0307}\u{0308}\u{0309}\u{030a}\u{030b}\u{030c}\u{030d}\u{030e}\u{030f}\u{0310}\u{0311}\u{0312}\u{0313}\u{0314}\u{0315}\u{031a}ngerzone";
assert_eq!(is_nfd_stream_safe_quick(too_much.chars()), IsNormalized::No);
} | rust_cleaned_test_functions.jsonl/41742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
34067,
1089,
6902,
368,
341,
286,
1077,
16910,
284,
330,
30416,
3770,
90,
15,
18,
16,
65,
11035,
84,
90,
15,
18,
16,
21,
11035,
84,
90,
15,
18,
16,
22,
11035,
84,
90,
15,
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_siphash_function() -> Result<()> {
#[allow(dead_code)]
struct Test {
name: &'static str,
input_column: DataColumn,
expect_output_column: DataColumn,
error: &'static str,
}
let tests = vec![
Test {
name: "Int8Array siphash",
input_column: Series::new(vec![1i8, 2, 1]).into(),
expect_output_column: Series::new(vec![
4952851536318644461u64,
7220060526038107403,
4952851536318644461,
])
.into(),
error: "",
},
Test {
name: "Int16Array siphash",
input_column: Series::new(vec![1i16, 2, 1]).into(),
expect_output_column: Series::new(vec![
10500823559348167161u64,
4091451155859037844,
10500823559348167161,
])
.into(),
error: "",
},
Test {
name: "Int32Array siphash",
input_column: Series::new(vec![1i32, 2, 1]).into(),
expect_output_column: Series::new(vec![
1742378985846435984u64,
16336925911988107921,
1742378985846435984,
])
.into(),
error: "",
},
Test {
name: "Int64Array siphash",
input_column: Series::new(vec![1i64, 2, 1]).into(),
expect_output_column: Series::new(vec![
2206609067086327257u64,
11876854719037224982,
2206609067086327257,
])
.into(),
error: "",
},
Test {
name: "UInt8Array siphash",
input_column: Series::new(vec![1u8, 2, 1]).into(),
expect_output_column: Series::new(vec![
4952851536318644461u64,
7220060526038107403,
4952851536318644461,
])
.into(),
error: "",
},
Test {
name: "UInt16Array siphash",
input_column: Series::new(vec![1u16, 2, 1]).into(),
expect_output_column: Series::new(vec![
10500823559348167161u64,
4091451155859037844,
10500823559348167161,
])
.into(),
error: "",
},
Test {
name: "UInt32Array siphash",
input_column: Series::new(vec![1u32, 2, 1]).into(),
expect_output_column: Series::new(vec![
1742378985846435984u64,
16336925911988107921,
1742378985846435984,
])
.into(),
error: "",
},
Test {
name: "UInt64Array siphash",
input_column: Series::new(vec![1u64, 2, 1]).into(),
expect_output_column: Series::new(vec![
2206609067086327257u64,
11876854719037224982,
2206609067086327257,
])
.into(),
error: "",
},
Test {
name: "Float32Array siphash",
input_column: Series::new(vec![1.0f32, 2., 1.]).into(),
expect_output_column: Series::new(vec![
729488449357906283u64,
9872512741335963328,
729488449357906283,
])
.into(),
error: "",
},
Test {
name: "Float64Array siphash",
input_column: Series::new(vec![1.0f64, 2., 1.]).into(),
expect_output_column: Series::new(vec![
13833534234735907638u64,
12773237290464453619,
13833534234735907638,
])
.into(),
error: "",
},
];
for test in tests {
let function = SipHashFunction::try_create("siphash")?;
let rows = test.input_column.len();
let columns = vec![DataColumnWithField::new(
test.input_column.clone(),
DataField::new("dummpy", test.input_column.data_type(), false),
)];
match function.eval(&columns, rows) {
Ok(result_column) => assert_eq!(
&result_column.get_array_ref()?,
&test.expect_output_column.get_array_ref()?,
"failed in the test: {}",
test.name
),
Err(error) => assert_eq!(
test.error,
error.to_string(),
"failed in the test: {}",
test.name
),
};
}
Ok(())
} | rust_cleaned_test_functions.jsonl/35163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2784
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
573,
8296,
9174,
368,
1464,
5714,
71698,
341,
262,
11506,
7183,
83207,
4136,
5563,
262,
2036,
3393,
341,
286,
829,
25,
30136,
1978,
607,
345,
286,
1946,
8744,
25,
72515,
345,
286,
1720,
764... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bitmap_accumulator() {
util::init_test_logger();
let mut accumulator = BitmapAccumulator::new();
assert_eq!(accumulator.root(), Hash::default());
accumulator.apply(vec![0], vec![0], 1).unwrap();
let expected_hash = {
let mut bit_vec = BitVec::from_elem(1024, false);
bit_vec.set(0, true);
bit_vec.to_bytes().hash_with_index(0)
};
assert_eq!(accumulator.root(), expected_hash);
accumulator.apply(vec![0], vec![0, 1], 2).unwrap();
let expected_hash = {
let mut bit_vec = BitVec::from_elem(1024, false);
bit_vec.set(0, true);
bit_vec.set(1, true);
bit_vec.to_bytes().hash_with_index(0)
};
assert_eq!(accumulator.root(), expected_hash);
accumulator.apply(vec![0], vec![1], 2).unwrap();
let expected_hash = {
let mut bit_vec = BitVec::from_elem(1024, false);
bit_vec.set(1, true);
let expected_bytes = bit_vec.to_bytes();
expected_bytes.hash_with_index(0)
};
assert_eq!(accumulator.root(), expected_hash);
accumulator.apply(vec![1], vec![1], 2).unwrap();
let expected_hash = {
let mut bit_vec = BitVec::from_elem(1024, false);
bit_vec.set(1, true);
let expected_bytes = bit_vec.to_bytes();
expected_bytes.hash_with_index(0)
};
assert_eq!(accumulator.root(), expected_hash);
accumulator.apply(vec![0], vec![1, 1023], 1024).unwrap();
let expected_hash = {
let mut bit_vec = BitVec::from_elem(1024, false);
bit_vec.set(1, true);
bit_vec.set(1023, true);
let expected_bytes = bit_vec.to_bytes();
expected_bytes.hash_with_index(0)
};
assert_eq!(accumulator.root(), expected_hash);
// Now set bits such that we extend the bitmap accumulator across multiple 1024 bit chunks.
// We need a second bit_vec here to reflect the additional chunk.
accumulator
.apply(vec![0], vec![1, 1023, 1024], 1025)
.unwrap();
let expected_hash = {
let mut bit_vec = BitVec::from_elem(1024, false);
bit_vec.set(1, true);
bit_vec.set(1023, true);
let mut bit_vec2 = BitVec::from_elem(1024, false);
bit_vec2.set(0, true);
let expected_bytes_0 = bit_vec.to_bytes();
let expected_bytes_1 = bit_vec2.to_bytes();
let expected_hash_0 = expected_bytes_0.hash_with_index(0);
let expected_hash_1 = expected_bytes_1.hash_with_index(1);
(expected_hash_0, expected_hash_1).hash_with_index(2)
};
assert_eq!(accumulator.root(), expected_hash);
// Just rebuild the second bitmap chunk.
accumulator.apply(vec![1025], vec![1025], 1026).unwrap();
let expected_hash = {
let mut bit_vec = BitVec::from_elem(1024, false);
bit_vec.set(1, true);
bit_vec.set(1023, true);
let mut bit_vec2 = BitVec::from_elem(1024, false);
bit_vec2.set(1, true);
let expected_bytes_0 = bit_vec.to_bytes();
let expected_bytes_1 = bit_vec2.to_bytes();
let expected_hash_0 = expected_bytes_0.hash_with_index(0);
let expected_hash_1 = expected_bytes_1.hash_with_index(1);
(expected_hash_0, expected_hash_1).hash_with_index(2)
};
assert_eq!(accumulator.root(), expected_hash);
// Rebuild the first bitmap chunk and all chunks after it.
accumulator.apply(vec![1], vec![1, 1025], 1026).unwrap();
let expected_hash = {
let mut bit_vec = BitVec::from_elem(1024, false);
bit_vec.set(1, true);
let mut bit_vec2 = BitVec::from_elem(1024, false);
bit_vec2.set(1, true);
let expected_bytes_0 = bit_vec.to_bytes();
let expected_bytes_1 = bit_vec2.to_bytes();
let expected_hash_0 = expected_bytes_0.hash_with_index(0);
let expected_hash_1 = expected_bytes_1.hash_with_index(1);
(expected_hash_0, expected_hash_1).hash_with_index(2)
};
assert_eq!(accumulator.root(), expected_hash);
// Make sure we handle the case where the first chunk is all 0s
accumulator.apply(vec![1], vec![1025], 1026).unwrap();
let expected_hash = {
let bit_vec = BitVec::from_elem(1024, false);
let mut bit_vec2 = BitVec::from_elem(1024, false);
bit_vec2.set(1, true);
let expected_bytes_0 = bit_vec.to_bytes();
let expected_bytes_1 = bit_vec2.to_bytes();
let expected_hash_0 = expected_bytes_0.hash_with_index(0);
let expected_hash_1 = expected_bytes_1.hash_with_index(1);
(expected_hash_0, expected_hash_1).hash_with_index(2)
};
assert_eq!(accumulator.root(), expected_hash);
// Check that removing the last bit in a chunk removes the now empty chunk
// if it is the rightmost chunk.
accumulator.apply(vec![1023], vec![1023], 1024).unwrap();
let expected_hash = {
let mut bit_vec = BitVec::from_elem(1024, false);
bit_vec.set(1023, true);
let expected_bytes = bit_vec.to_bytes();
expected_bytes.hash_with_index(0)
};
assert_eq!(accumulator.root(), expected_hash);
// Make sure we pad appropriately with 0s if we set a distant bit to 1.
// Start with an empty accumulator.
let mut accumulator = BitmapAccumulator::new();
accumulator.apply(vec![4095], vec![4095], 4096).unwrap();
let expected_hash = {
let bit_vec0 = BitVec::from_elem(1024, false);
let bit_vec1 = BitVec::from_elem(1024, false);
let bit_vec2 = BitVec::from_elem(1024, false);
let mut bit_vec3 = BitVec::from_elem(1024, false);
bit_vec3.set(1023, true);
let expected_bytes_0 = bit_vec0.to_bytes();
let expected_bytes_1 = bit_vec1.to_bytes();
let expected_bytes_2 = bit_vec2.to_bytes();
let expected_bytes_3 = bit_vec3.to_bytes();
let expected_hash_0 = expected_bytes_0.hash_with_index(0);
let expected_hash_1 = expected_bytes_1.hash_with_index(1);
let expected_hash_2 = (expected_hash_0, expected_hash_1).hash_with_index(2);
let expected_hash_3 = expected_bytes_2.hash_with_index(3);
let expected_hash_4 = expected_bytes_3.hash_with_index(4);
let expected_hash_5 = (expected_hash_3, expected_hash_4).hash_with_index(5);
(expected_hash_2, expected_hash_5).hash_with_index(6)
};
assert_eq!(accumulator.root(), expected_hash);
} | rust_cleaned_test_functions.jsonl/92540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41527,
75837,
10511,
368,
341,
79138,
486,
2327,
4452,
27413,
1428,
10217,
5206,
56312,
284,
17533,
14603,
372,
10511,
486,
931,
543,
6948,
10714,
10297,
94810,
12576,
1507,
6531,
486,
2258,
5231,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rfcomm_channel_is_relayed_to_client() {
let (mut exec, mut rfcomm) = setup_rfcomm_manager();
// Profile-client reserves a server channel.
let (c, mut s) = create_proxy_and_stream::<ConnectionReceiverMarker>().unwrap();
let first_channel = {
let fut = rfcomm.allocate_server_channel(c.clone());
pin_mut!(fut);
match exec.run_until_stalled(&mut fut) {
Poll::Ready(Some(sc)) => sc,
x => panic!("Expected server channel but got {:?}", x),
}
};
let profile_client_fut = s.next();
pin_mut!(profile_client_fut);
assert!(exec.run_until_stalled(&mut profile_client_fut).is_pending());
// Start up a session with remote peer.
let id = PeerId(1);
let (remote, channel) = Channel::create();
assert!(rfcomm.new_l2cap_connection(id, channel).is_ok());
assert!(rfcomm.is_active_session(&id));
let mut vec = Vec::new();
let remote_fut = remote.read_datagram(&mut vec);
pin_mut!(remote_fut);
assert!(exec.run_until_stalled(&mut remote_fut).is_pending());
// Remote device requests to start up session multiplexer.
let sabm = Frame::make_sabm_command(Role::Unassigned, DLCI::MUX_CONTROL_DLCI);
let mut buf = vec![0; sabm.encoded_len()];
assert!(sabm.encode(&mut buf[..]).is_ok());
assert!(remote.as_ref().write(&buf).is_ok());
// Expect a response to the sent frame.
assert!(exec.run_until_stalled(&mut remote_fut).is_ready());
// Remote device requests to open up an RFCOMM channel. The DLCI is the ServerChannel
let user_dlci = DLCI::try_from(first_channel.0 << 1).unwrap();
let user_sabm = Frame::make_sabm_command(Role::Initiator, user_dlci);
let mut buf = vec![0; sabm.encoded_len()];
assert!(user_sabm.encode(&mut buf[..]).is_ok());
assert!(remote.as_ref().write(&buf).is_ok());
// Expect a response to the sent frame.
let mut vec = Vec::new();
let remote_fut = remote.read_datagram(&mut vec);
pin_mut!(remote_fut);
assert!(exec.run_until_stalled(&mut remote_fut).is_ready());
// the Channel should be relayed to the profile client.
match exec.run_until_stalled(&mut profile_client_fut) {
Poll::Ready(Some(Ok(bredr::ConnectionReceiverRequest::Connected { .. }))) => {}
x => panic!("Expected connection but got {:?}", x),
}
} | rust_cleaned_test_functions.jsonl/130348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
65466,
3621,
14571,
6892,
1288,
6651,
291,
2346,
8179,
368,
341,
286,
1077,
320,
6984,
3883,
11,
5206,
36026,
3621,
8,
284,
6505,
65466,
3621,
12144,
1428,
286,
442,
12329,
30011,
29500,
264... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_check_slots_are_valid_bad_hash() {
let vote_state = VoteState::default();
let vote = Vote::new(vec![0], Hash::default());
let slot_hashes: Vec<_> = vec![(*vote.slots.last().unwrap(), hash(vote.hash.as_ref()))];
assert_eq!(
vote_state.check_slots_are_valid(&vote, &slot_hashes),
Err(VoteError::SlotHashMismatch)
);
} | rust_cleaned_test_functions.jsonl/43742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
54161,
56855,
8337,
34199,
8950,
368,
341,
286,
1077,
6910,
4387,
284,
34034,
1397,
486,
2258,
1428,
286,
1077,
6910,
284,
34034,
486,
931,
25592,
20703,
15,
1125,
6531,
486,
2258,
1423,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_print_waypoints() {
let (_env, op_tool, backend, _) = launch_swarm_with_op_tool_and_backend(1, 0);
// Insert a new waypoint and genesis waypoint into storage
let inserted_waypoint =
Waypoint::new_any(&LedgerInfo::new(BlockInfo::empty(), HashValue::zero()));
op_tool
.insert_waypoint(inserted_waypoint, &backend, true)
.unwrap();
// Print the waypoint
let waypoint = op_tool.print_waypoint(WAYPOINT, &backend).unwrap();
assert_eq!(inserted_waypoint, waypoint);
// Print the gensis waypoint
let genesis_waypoint = op_tool.print_waypoint(GENESIS_WAYPOINT, &backend).unwrap();
assert_eq!(inserted_waypoint, genesis_waypoint);
} | rust_cleaned_test_functions.jsonl/64973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
48936,
7706,
368,
341,
262,
1077,
5453,
3160,
11,
1179,
22785,
11,
19163,
11,
27439,
284,
7050,
32581,
2178,
6615,
10287,
22785,
8378,
40011,
7,
16,
11,
220,
15,
626,
262,
442,
17101,
264... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_set_chain() -> Result<(), Box<EvalAltResult>> {
#[derive(Clone)]
struct TestChild {
x: INT,
}
impl TestChild {
fn get_x(&mut self) -> INT {
self.x
}
fn set_x(&mut self, new_x: INT) {
self.x = new_x;
}
fn new() -> TestChild {
TestChild { x: 1 }
}
}
#[derive(Clone)]
struct TestParent {
child: TestChild,
}
impl TestParent {
fn get_child(&mut self) -> TestChild {
self.child.clone()
}
fn set_child(&mut self, new_child: TestChild) {
self.child = new_child;
}
fn new() -> TestParent {
TestParent {
child: TestChild::new(),
}
}
}
let mut engine = Engine::new();
engine.register_type::<TestChild>();
engine.register_type_with_name::<TestParent>("TestParent");
engine.register_get_set("x", TestChild::get_x, TestChild::set_x);
engine.register_get_set("child", TestParent::get_child, TestParent::set_child);
engine.register_fn("new_tp", TestParent::new);
assert_eq!(
engine.eval::<INT>("let a = new_tp(); a.child.x = 500; a.child.x")?,
500
);
assert_eq!(
engine.eval::<String>("let a = new_tp(); type_of(a)")?,
"TestParent"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/10535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 697
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2602,
30583,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
11506,
27098,
65297,
5563,
262,
2036,
3393,
3652,
341,
286,
856,
25,
9221,
345,
262,
555,
262,
11605,
3393... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_eq_scalar() {
cmp_i64_scalar!(
eq_scalar,
&[6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
8,
vec![false, false, true, false, false, false, false, true, false, false]
);
} | rust_cleaned_test_functions.jsonl/38865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
10714,
41652,
368,
341,
286,
26089,
5318,
21,
19,
41652,
33673,
310,
8939,
41652,
345,
310,
44590,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
11,
220,
16,
15,
11,
220,
21,
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_trait_cast() {
assert_eq!(type_path_schema_expr(&syn::parse2::<TypePath>(quote!{i32}).unwrap()).to_string(), quote!{<i32 as apache_avro::schema::derive::AvroSchemaComponent>::get_schema_in_ctxt(named_schemas, enclosing_namespace)}.to_string());
assert_eq!(type_path_schema_expr(&syn::parse2::<TypePath>(quote!{Vec<T>}).unwrap()).to_string(), quote!{<Vec<T> as apache_avro::schema::derive::AvroSchemaComponent>::get_schema_in_ctxt(named_schemas, enclosing_namespace)}.to_string());
assert_eq!(type_path_schema_expr(&syn::parse2::<TypePath>(quote!{AnyType}).unwrap()).to_string(), quote!{<AnyType as apache_avro::schema::derive::AvroSchemaComponent>::get_schema_in_ctxt(named_schemas, enclosing_namespace)}.to_string());
} | rust_cleaned_test_functions.jsonl/110874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78491,
5303,
368,
341,
286,
2060,
10714,
10297,
1313,
2638,
25371,
21915,
2099,
20339,
486,
6400,
17,
27638,
929,
1820,
2235,
2949,
0,
90,
72,
18,
17,
16630,
15454,
6011,
983,
3904,
1507,
12641,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_emoji_generation() {
let bytes = vec![0, 0, 0, 0, 0, 0];
let index: Vec<(&'static str, &'static str)> = vec![0, 0, 0, 0, 0, 0, 0]
.into_iter()
.map(emoji_from_index)
.collect();
assert_eq!(bytes_to_emoji(bytes), index);
let bytes = vec![0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF];
let index: Vec<(&'static str, &'static str)> = vec![63, 63, 63, 63, 63, 63, 63]
.into_iter()
.map(emoji_from_index)
.collect();
assert_eq!(bytes_to_emoji(bytes), index);
} | rust_cleaned_test_functions.jsonl/94926 | {
"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,
62,
37523,
64191,
368,
341,
286,
1077,
5820,
284,
7486,
20703,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
935,
286,
1077,
1922,
25,
11312,
27,
2099,
6,
1978,
607,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ovs_dpdk() {
let focal1 = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest1 = Guest::new(Box::new(focal1));
let focal2 = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest2 = Guest::new(Box::new(focal2));
let api_socket = temp_api_path(&guest2.tmp_dir);
let (mut child1, mut child2) = setup_ovs_dpdk_guests(&guest1, &guest2, &api_socket);
// Create the snapshot directory
let snapshot_dir = temp_snapshot_dir_path(&guest2.tmp_dir);
let r = std::panic::catch_unwind(|| {
// Remove one of the two ports from the OVS bridge
assert!(exec_host_command_status("ovs-vsctl del-port vhost-user1").success());
// Spawn a new netcat listener in the first VM
let guest_ip = guest1.network.guest_ip.clone();
thread::spawn(move || {
ssh_command_ip(
"nc -l 12345",
&guest_ip,
DEFAULT_SSH_RETRIES,
DEFAULT_SSH_TIMEOUT,
)
.unwrap();
});
// Wait for the server to be listening
thread::sleep(std::time::Duration::new(5, 0));
// Check the connection fails this time
assert!(guest2.ssh_command("nc -vz 172.100.0.1 12345").is_err());
// Add the OVS port back
assert!(exec_host_command_status("ovs-vsctl add-port ovsbr0 vhost-user1 -- set Interface vhost-user1 type=dpdkvhostuserclient options:vhost-server-path=/tmp/dpdkvhostclient1").success());
// And finally check the connection is functional again
guest2.ssh_command("nc -vz 172.100.0.1 12345").unwrap();
// Pause the VM
assert!(remote_command(&api_socket, "pause", None));
// Take a snapshot from the VM
assert!(remote_command(
&api_socket,
"snapshot",
Some(format!("file://{}", snapshot_dir).as_str()),
));
// Wait to make sure the snapshot is completed
thread::sleep(std::time::Duration::new(10, 0));
});
// Shutdown the source VM
let _ = child2.kill();
let output = child2.wait_with_output().unwrap();
handle_child_output(r, &output);
// Remove the vhost-user socket file.
Command::new("rm")
.arg("-f")
.arg("/tmp/dpdkvhostclient2")
.output()
.unwrap();
// Restore the VM from the snapshot
let mut child2 = GuestCommand::new(&guest2)
.args(&["--api-socket", &api_socket])
.args(&[
"--restore",
format!("source_url=file://{}", snapshot_dir).as_str(),
])
.capture_output()
.spawn()
.unwrap();
// Wait for the VM to be restored
thread::sleep(std::time::Duration::new(10, 0));
let r = std::panic::catch_unwind(|| {
// Resume the VM
assert!(remote_command(&api_socket, "resume", None));
// Spawn a new netcat listener in the first VM
let guest_ip = guest1.network.guest_ip.clone();
thread::spawn(move || {
ssh_command_ip(
"nc -l 12345",
&guest_ip,
DEFAULT_SSH_RETRIES,
DEFAULT_SSH_TIMEOUT,
)
.unwrap();
});
// Wait for the server to be listening
thread::sleep(std::time::Duration::new(5, 0));
// And check the connection is still functional after restore
guest2.ssh_command("nc -vz 172.100.0.1 12345").unwrap();
});
cleanup_ovs_dpdk();
let _ = child1.kill();
let _ = child2.kill();
let output = child1.wait_with_output().unwrap();
child2.wait().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/26179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2039
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83981,
82,
53872,
7584,
368,
341,
286,
1077,
41099,
16,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
286,
1077,
8640,
16,
284,
26215,
486,
931,
67758,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_process_withdraw_ix_bad_recent_blockhash_state_fail() {
assert_eq!(
process_instruction(
&Pubkey::default(),
vec![
KeyedAccount::new(&Pubkey::default(), true, &create_default_account()),
KeyedAccount::new(&Pubkey::default(), false, &create_default_account()),
KeyedAccount::new(
&sysvar::recent_blockhashes::id(),
false,
&create_default_account()
),
],
&serialize(&SystemInstruction::WithdrawNonceAccount(42)).unwrap(),
),
Err(InstructionError::InvalidArgument),
);
} | rust_cleaned_test_functions.jsonl/73067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
6615,
7633,
62686,
34199,
62361,
7113,
8296,
4387,
22121,
368,
341,
286,
2060,
10714,
33673,
310,
1882,
54923,
1006,
394,
609,
29162,
792,
486,
2258,
3148,
394,
7486,
90515,
503,
5309,
291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dedup() {
fn case(a: Vec<uint>, b: Vec<uint>) {
let mut v = a;
v.dedup();
assert_eq!(v, b);
}
case(vec![], vec![]);
case(vec![1u], vec![1]);
case(vec![1u,1], vec![1]);
case(vec![1u,2,3], vec![1,2,3]);
case(vec![1u,1,2,3], vec![1,2,3]);
case(vec![1u,2,2,3], vec![1,2,3]);
case(vec![1u,2,3,3], vec![1,2,3]);
case(vec![1u,1,2,2,2,3,3], vec![1,2,3]);
} | rust_cleaned_test_functions.jsonl/31836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
291,
454,
368,
341,
286,
5168,
1142,
2877,
25,
11312,
16434,
8066,
293,
25,
11312,
16434,
9231,
341,
310,
1077,
5206,
348,
284,
264,
280,
310,
348,
950,
291,
454,
543,
310,
2060,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_keys_bip39_mnemonic() {
let mnemonic =
"aim bunker wash balance finish force paper analyst cabin spoon stable organ";
let mnemonic = Mnemonic::from_phrase(mnemonic, Language::English).unwrap();
let path = bip32::DerivationPath::from_str("m/44'/0'/0'/0").unwrap();
let key = (mnemonic, path);
let (desc, keys, networks) = crate::descriptor!(wpkh(key)).unwrap();
assert_eq!(desc.to_string(), "wpkh([be83839f/44'/0'/0']xpub6DCQ1YcqvZtSwGWMrwHELPehjWV3f2MGZ69yBADTxFEUAoLwb5Mp5GniQK6tTp3AgbngVz9zEFbBJUPVnkG7LFYt8QMTfbrNqs6FNEwAPKA/0/*)#0r8v4nkv");
assert_eq!(keys.len(), 1);
assert_eq!(networks.len(), 4);
} | rust_cleaned_test_functions.jsonl/57386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12631,
880,
573,
18,
24,
717,
70775,
368,
341,
286,
1077,
86801,
4035,
310,
330,
2640,
83672,
11369,
8172,
6248,
5344,
5567,
18237,
13386,
45505,
15175,
2872,
876,
286,
1077,
86801,
284,
56731,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nz_number() {
assert!(number(b"").is_err());
assert!(number(b"?").is_err());
assert!(nz_number(b"0?").is_err());
assert!(nz_number(b"55?").is_ok());
assert!(nz_number(b"999?").is_ok());
} | rust_cleaned_test_functions.jsonl/78685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
89,
5500,
368,
341,
286,
2060,
10297,
4082,
1883,
1,
1827,
285,
9266,
1423,
286,
2060,
10297,
4082,
1883,
43869,
1827,
285,
9266,
5231,
286,
2060,
10297,
50824,
5500,
1883,
1,
15,
30,
1827... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normal_format() {
let args = ["-c", NORMAL_FMTSTR, "/boot"];
new_ucmd!().args(&args)
.run()
.stdout_is(expected_result(&args));
} | rust_cleaned_test_functions.jsonl/36722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13973,
8955,
368,
341,
262,
1077,
2827,
284,
4383,
12,
66,
497,
52431,
44332,
6666,
11,
3521,
4619,
6332,
262,
501,
68887,
2277,
0,
1005,
2116,
2099,
2116,
340,
286,
659,
6108,
741,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bpf_loader_upgradeable_initialize_buffer() {
let instruction =
bincode::serialize(&UpgradeableLoaderInstruction::InitializeBuffer).unwrap();
let buffer_address = Pubkey::new_unique();
let buffer_account = AccountSharedData::new_ref(
1,
UpgradeableLoaderState::buffer_len(9).unwrap(),
&bpf_loader_upgradeable::id(),
);
let authority_address = Pubkey::new_unique();
let authority_account = AccountSharedData::new_ref(
1,
UpgradeableLoaderState::buffer_len(9).unwrap(),
&bpf_loader_upgradeable::id(),
);
// Case: Success
let keyed_accounts = vec![
KeyedAccount::new(&buffer_address, false, &buffer_account),
KeyedAccount::new(&authority_address, false, &authority_account),
];
assert_eq!(
Ok(()),
process_instruction(
&bpf_loader_upgradeable::id(),
&instruction,
&mut MockInvokeContext::new(keyed_accounts)
)
);
let state: UpgradeableLoaderState = buffer_account.borrow().state().unwrap();
assert_eq!(
state,
UpgradeableLoaderState::Buffer {
authority_address: Some(authority_address)
}
);
// Case: Already initialized
let keyed_accounts = vec![
KeyedAccount::new(&buffer_address, false, &buffer_account),
KeyedAccount::new(&authority_address, false, &authority_account),
];
assert_eq!(
Err(InstructionError::AccountAlreadyInitialized),
process_instruction(
&bpf_loader_upgradeable::id(),
&instruction,
&mut MockInvokeContext::new(keyed_accounts)
)
);
let state: UpgradeableLoaderState = buffer_account.borrow().state().unwrap();
assert_eq!(
state,
UpgradeableLoaderState::Buffer {
authority_address: Some(authority_address)
}
);
} | rust_cleaned_test_functions.jsonl/35381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1052
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
15897,
22139,
67794,
480,
40889,
7776,
368,
341,
286,
1077,
7600,
4035,
310,
9544,
1851,
486,
24166,
2099,
43861,
480,
9181,
16664,
486,
9928,
4095,
568,
15454,
543,
286,
1077,
4147,
6744,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_commit_status() {
let commit_status: CommitStatus = read_test_file("commit_status");
assert_eq!(commit_status.id, CommitStatusId::new(931_434));
assert_eq!(
commit_status.sha,
ObjectId::new("de4ac3cf96cb8a0893be22b03f5171d934f9d392"),
);
assert_eq!(commit_status.ref_.as_ref().unwrap(), "master");
assert_eq!(commit_status.status, StatusState::Success);
assert_eq!(commit_status.name, "rust-gitlab-megas-linux-debug");
assert_eq!(
commit_status.target_url.as_ref().unwrap(),
"https://buildbot.kitware.com/builders/rust-gitlab-megas-linux-debug/builds/41",
);
assert_eq!(commit_status.description.as_ref().unwrap(), "expected");
assert_eq!(
commit_status.created_at,
datetime((2016, 11, 8), (14, 35, 32, 627)),
);
assert_eq!(commit_status.started_at, None);
assert_eq!(
commit_status.finished_at.unwrap(),
datetime((2016, 11, 8), (14, 35, 32, 629)),
);
assert!(!commit_status.allow_failure);
check_user_buildbot(&commit_status.author);
assert_eq!(commit_status.coverage, None);
} | rust_cleaned_test_functions.jsonl/12941 | {
"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,
6443,
36346,
4773,
368,
341,
262,
1077,
5266,
4773,
25,
9205,
2522,
284,
1349,
4452,
2458,
445,
17413,
4773,
3071,
262,
2060,
10714,
10297,
17413,
4773,
1764,
11,
9205,
2522,
764,
486,
931,
7,
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_delimited_paren() {
equal_tokens! {
<nodes>
"(abc)" -> b::token_list(vec![b::parens(vec![b::bare("abc")])])
}
equal_tokens! {
<nodes>
"( abc )" -> b::token_list(vec![b::parens(vec![b::ws(" "), b::bare("abc"), b::ws(" ")])])
}
equal_tokens! {
<nodes>
"( abc def )" -> b::token_list(vec![b::parens(vec![b::ws(" "), b::bare("abc"), b::ws(" "), b::bare("def"), b::ws(" ")])])
}
equal_tokens! {
<nodes>
"( abc def 123 456GB )" -> b::token_list(vec![b::parens(vec![
b::ws(" "), b::bare("abc"), b::ws(" "), b::bare("def"), b::ws(" "), b::int(123), b::ws(" "), b::bare("456GB"), b::ws(" ")
])])
}
} | rust_cleaned_test_functions.jsonl/7256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18029,
31511,
620,
9151,
368,
341,
286,
6144,
28838,
0,
341,
310,
366,
20008,
397,
310,
11993,
13683,
9940,
1464,
293,
486,
5839,
2019,
25592,
20703,
65,
486,
3380,
4412,
25592,
20703,
65,
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_restore_from_snap_msg() {
let l = default_logger();
let s = new_snapshot(11, 11, vec![1, 2]); // magic number
let mut sm = new_test_raft(2, vec![1, 2], 10, 1, new_storage(), &l);
let mut m = new_message(1, 0, MessageType::MsgSnapshot, 0);
m.term = 2;
m.set_snapshot(s);
sm.step(m).expect("");
assert_eq!(sm.leader_id, 1);
// TODO: port the remaining if upstream completed this test.
} | rust_cleaned_test_functions.jsonl/19143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62677,
5673,
74175,
6483,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
274,
284,
501,
53265,
7,
16,
16,
11,
220,
16,
16,
11,
7486,
20703,
16,
11,
220,
17,
14979,
442,
10963,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_pair() {
assert_eq!((0, 1), _0.into());
assert_eq!((-2, 1), _NEG2.into());
assert_eq!((1, -2), _1_NEG2.into());
} | rust_cleaned_test_functions.jsonl/843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
14445,
368,
341,
286,
2060,
10714,
0,
1188,
15,
11,
220,
16,
701,
716,
15,
39860,
1423,
286,
2060,
10714,
0,
54934,
17,
11,
220,
16,
701,
716,
97127,
17,
39860,
1423,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_map_in_out() {
#[derive(Deserialize, Serialize, Apiv2Schema)]
struct ImageId(u64);
#[derive(Serialize, Apiv2Schema)]
struct Image {
data: String,
id: ImageId,
}
#[api_v2_operation]
fn some_images() -> impl Future<Output = web::Json<BTreeMap<String, Image>>> {
#[allow(unreachable_code)]
ready(unimplemented!())
}
run_and_check_app(
|| {
App::new()
.wrap_api()
.with_json_spec_at("/api/spec")
.service(web::resource("/images").route(web::get().to(some_images)))
.build()
},
|addr| {
let resp = CLIENT
.get(&format!("http://{}/api/spec", addr))
.send()
.expect("request failed?");
check_json(
resp,
json!({
"info":{"title":"","version":""},
"definitions": {
"Image": {
"properties": {
"data": {
"type": "string"
},
"id":{
"format":"int64",
"type":"integer"
}
},
"required": ["data", "id"]
}
},
"paths": {
"/images": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"additionalProperties": {
"$ref": "#/definitions/Image"
},
"type": "object"
}
}
}
}
}
},
"swagger": "2.0"
}),
);
},
);
} | rust_cleaned_test_functions.jsonl/18937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
1243,
6068,
368,
341,
262,
11506,
27098,
7,
64465,
11,
39900,
11,
5232,
344,
17,
8632,
5563,
262,
2036,
4654,
764,
8154,
21,
19,
626,
262,
11506,
27098,
3759,
9050,
11,
5232,
344,
17,
86... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_filter() {
let mut x = BTreeSet::from([1]);
let mut y = BTreeSet::from([1]);
x.drain_filter(|_| true);
y.drain_filter(|_| false);
assert_eq!(x.len(), 0);
assert_eq!(y.len(), 1);
} | rust_cleaned_test_functions.jsonl/13746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
8727,
368,
341,
262,
1077,
5206,
856,
284,
425,
6533,
1649,
486,
1499,
2561,
16,
2558,
262,
1077,
5206,
379,
284,
425,
6533,
1649,
486,
1499,
2561,
16,
10149,
262,
856,
950,
29093,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_cache_packages_manifest() {
let hash =
"0000000000000000000000000000000000000000000000000000000000000000".parse().unwrap();
let cache_packages = CachePackages::from_entries(vec![(
PackagePath::from_name_and_variant("potato", "0").unwrap(),
hash,
)]);
let empty_cache_packages = CachePackages::from_entries(vec![]);
let fuchsia_url = PkgUrl::parse("fuchsia-pkg://fuchsia.com/potato").unwrap();
let variant_zero_fuchsia_url = PkgUrl::parse("fuchsia-pkg://fuchsia.com/potato/0").unwrap();
let other_repo_url = PkgUrl::parse("fuchsia-pkg://nope.com/potato/0").unwrap();
let wrong_variant_fuchsia_url =
PkgUrl::parse("fuchsia-pkg://fuchsia.com/potato/17").unwrap();
assert_eq!(
hash_from_cache_packages_manifest(&fuchsia_url, &cache_packages),
Some(hash.into())
);
assert_eq!(
hash_from_cache_packages_manifest(&variant_zero_fuchsia_url, &cache_packages),
Some(hash.into())
);
assert_eq!(hash_from_cache_packages_manifest(&other_repo_url, &cache_packages), None);
assert_eq!(
hash_from_cache_packages_manifest(&wrong_variant_fuchsia_url, &cache_packages),
None
);
assert_eq!(hash_from_cache_packages_manifest(&fuchsia_url, &empty_cache_packages), None);
} | rust_cleaned_test_functions.jsonl/42450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 663
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
5673,
11529,
41874,
74269,
368,
341,
286,
1077,
5175,
4035,
310,
330,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_map_ext_blanket_impl() {
use hyper::{header::*, Method};
let mut headers = HeaderMap::new();
assert!(headers.is_empty());
let allow_methods = vec![Method::POST, Method::GET];
let ret = headers.insert_vec(ACCESS_CONTROL_ALLOW_METHODS, allow_methods.clone());
assert_eq!(ret, None);
assert_eq!(
headers.get(ACCESS_CONTROL_ALLOW_METHODS),
Some(&HeaderValue::from_vec(allow_methods.clone()))
);
let ret = headers.insert_vec(ACCESS_CONTROL_ALLOW_METHODS, vec![Method::PATCH]);
assert_eq!(ret, Some(HeaderValue::from_vec(allow_methods)));
assert_eq!(
headers.get(ACCESS_CONTROL_ALLOW_METHODS),
Some(&HeaderValue::from_vec(vec![Method::PATCH]))
);
let allow_headers = vec![ORIGIN, ACCEPT];
let ret = headers.insert_vec(ACCESS_CONTROL_ALLOW_HEADERS, allow_headers.clone());
assert_eq!(ret, None);
assert_eq!(
headers.get(ACCESS_CONTROL_ALLOW_HEADERS),
Some(&HeaderValue::from_vec(allow_headers))
);
} | rust_cleaned_test_functions.jsonl/59750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
5376,
9927,
56103,
295,
21007,
368,
341,
286,
990,
17071,
22964,
2708,
486,
12314,
6730,
2315,
286,
1077,
5206,
7102,
284,
12104,
2227,
486,
931,
543,
286,
2060,
10297,
7713,
2079,
15124,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_completer() {
let state = Arc::new(Mutex::new(State { peers: HashMap::new() }));
let cmdhelper = CmdHelper::new(state);
assert!(cmdhelper.complete("he", 0).unwrap().1.contains(&"help".to_string()));
assert!(cmdhelper.complete("dis", 0).unwrap().1.contains(&"discoverable".to_string()));
assert!(cmdhelper.complete("set-", 0).unwrap().1.contains(&"set-local-name".to_string()));
} | rust_cleaned_test_functions.jsonl/72704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
694,
465,
368,
341,
286,
1077,
1584,
284,
19689,
486,
931,
3189,
9371,
486,
931,
49196,
314,
25029,
25,
10528,
486,
931,
368,
17830,
286,
1077,
5439,
18764,
284,
40210,
5511,
486,
931,
839... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_in_string() {
let cases = vec![
(
vec![Some("times naive"), Some("young"), Some("simple"), None],
Collation::Binary,
None,
),
(
vec![
Some("times naive"),
Some("young"),
Some("simple"),
Some("times naive"),
],
Collation::Binary,
Some(1),
),
(
vec![
Some("pINGcap"),
Some("PINGCAP"),
Some("PingCAP"),
Some("pingcap"),
Some("pingCap"),
],
Collation::Utf8Mb4Bin,
Some(0),
),
(
vec![
Some("pINGcap"),
Some("PINGCAP"),
Some("PingCAP"),
Some("pingcap"),
Some("pingCap"),
],
Collation::Utf8Mb4GeneralCi,
Some(1),
),
(
vec![Some("breeswish"), Some("breezewish")],
Collation::Utf8Mb4GeneralCi,
Some(0),
),
(
vec![Some("breeswish"), Some("breezewish")],
Collation::Utf8Mb4GeneralCi,
Some(0),
),
(
vec![Some("codeworm96"), Some("CODEWORM96"), Some("CoDeWorm99")],
Collation::Utf8Mb4GeneralCi,
Some(1),
),
(
vec![
Some("扩散性百万甜🍞"),
Some("扩散性百万辣🍞"),
Some("扩散性百万咸🍞"),
],
Collation::Utf8Mb4GeneralCi,
Some(0),
),
(
vec![Some("🐰"), Some("🐇"), Some("🐻"), Some("🐰")],
Collation::Utf8Mb4GeneralCi,
Some(1),
),
(
vec![Some("🐰"), Some("🐇"), Some("🐻"), Some("🐰")],
Collation::Utf8Mb4UnicodeCi,
Some(1),
),
];
for (args, collation, expected) in cases {
let ft = FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.collation(collation)
.build();
let mut builder = ExprDefBuilder::scalar_func(ScalarFuncSig::InString, ft);
for arg in args {
builder = builder.push_child(match arg {
Some(v) => ExprDefBuilder::constant_bytes(String::from(v).into_bytes()),
None => ExprDefBuilder::constant_null(FieldTypeTp::String),
});
}
let node = builder.build();
let exp = RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node,
map_expr_node_to_rpn_func,
1,
)
.unwrap();
if let RpnExpressionNode::FnCall { args_len, .. } = exp[0] {
// all constant args except base_val should be removed.
et mut ctx = EvalContext::default();
let schema = &[];
let mut columns = LazyBatchColumnVec::empty();
let result = exp.eval(&mut ctx, schema, &mut columns, &[], 1);
let val = result.unwrap();
assert!(val.is_vector());
assert_eq!(
val.vector_value().unwrap().as_ref().to_int_vec(),
&[expected]
);
}
}
} | rust_cleaned_test_functions.jsonl/16820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
3904,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
7486,
20703,
8373,
445,
15136,
49665,
3975,
4329,
445,
81179,
3975,
4329,
445,
22944,
3975,
2240,
1259,
394,
12905,
367,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_transpile_tsx() {
let specifier = resolve_url_or_path("https://deno.land/x/mod.ts")
.expect("could not resolve specifier");
let source = r#"
export class A {
render() {
return <div><span></span></div>
}
}
"#;
let module = parse_module(ParseParams {
specifier: specifier.as_str().to_string(),
source: SourceTextInfo::from_string(source.to_string()),
media_type: deno_ast::MediaType::Tsx,
capture_tokens: false,
maybe_syntax: None,
scope_analysis: true, // ensure scope analysis doesn't conflict with a second resolver pass
})
.expect("could not parse module");
let (code, _) = transpile(&module, &EmitOptions::default())
.expect("could not strip types");
assert!(code.contains("React.createElement(\"div\", null"));
} | rust_cleaned_test_functions.jsonl/65183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
12192,
25023,
87,
368,
341,
262,
1077,
97616,
284,
8830,
2903,
8734,
2638,
445,
2428,
1110,
5183,
78,
87627,
10776,
38479,
21288,
1138,
414,
659,
17119,
445,
28077,
537,
8830,
97616,
797,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_blur_image_correctly() {
extern crate image;
use super::gaussian_blur;
use super::utils;
let image_bytes = include_bytes!("../assets/cballs.png");
let image_reference_bytes = include_bytes!("../assets/cballs_reference_5px_blur.png");
let res1 = image::load_from_memory_with_format(image_bytes, image::ImageFormat::PNG);
let res2 = image::load_from_memory_with_format(image_reference_bytes, image::ImageFormat::PNG);
if let (Ok(image::DynamicImage::ImageRgb8(png_data)),
Ok(image::DynamicImage::ImageRgb8(reference_data))) =
(res1, res2)
{
let width = png_data.width() as usize;
let height = png_data.height() as usize;
let data = png_data.into_raw();
let mut data_new = Vec::<[u8;3]>::with_capacity(width * height);
data_new.resize(width * height, [0, 0, 0]);
let mut data_new = Vec::<[u8;3]>::with_capacity(width * height);
data_new.resize(width * height, [0, 0, 0]);
for y in 0..height {
for x in 0..width {
let offset = ((width * y) + x) as usize;
data_new[((width * y) + x) as usize] = [data[offset * 3], data[(offset * 3) + 1], data[(offset * 3) + 2]];
}
}
let reference = reference_data.into_raw();
let mut reference_new = Vec::<[u8;3]>::with_capacity(width * height);
reference_new.resize(width * height, [0, 0, 0]);
for y in 0..height {
for x in 0..width {
let offset = ((width * y) + x) as usize;
reference_new[((width * y) + x) as usize] = [reference[offset * 3], reference[(offset * 3) + 1], reference[(offset * 3) + 2]];
}
}
gaussian_blur(&mut data_new, width as usize, height as usize, 6.0);
utils::write_image("test.ppm", &data_new, width as usize, height as usize).unwrap();
// and I don't know if Javascript does things differently in terms of floating-point calculations
} else {
panic!("could not decode png");
}
} | rust_cleaned_test_functions.jsonl/88737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 943
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13141,
324,
4954,
31550,
398,
368,
341,
262,
15637,
17717,
2168,
401,
262,
990,
2256,
486,
6743,
15579,
13141,
324,
280,
262,
990,
2256,
486,
6031,
401,
262,
1077,
2168,
12524,
284,
2924,
12524,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_parse_with_duplicate_program_ids() {
let s = "\
@PG\tID:pg0
@PG\tID:pg0
";
assert_eq!(
parse(s),
Err(ParseError::DuplicateProgramId(String::from("pg0")))
);
} | rust_cleaned_test_functions.jsonl/8728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6615,
70434,
25096,
8077,
368,
341,
286,
1077,
274,
284,
93317,
31,
11383,
4955,
915,
25,
3517,
15,
198,
31,
11383,
4955,
915,
25,
3517,
15,
198,
876,
286,
2060,
10714,
33673,
310,
4715,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_encode_summary() {
let metric = Metric {
name: "requests".to_owned(),
timestamp: None,
tags: Some(tags()),
kind: MetricKind::Absolute,
value: MetricValue::AggregatedSummary {
quantiles: vec![0.01, 0.5, 0.99],
values: vec![1.5, 2.0, 3.0],
count: 6,
sum: 12.0,
},
};
let header = encode_metric_header("", &metric);
let frame = encode_metric_datum("", &[], false, &metric);
assert_eq!(
header,
"# HELP requests requests\n# TYPE requests summary\n".to_owned()
);
assert_eq!(frame, "requests{code=\"200\",quantile=\"0.01\"} 1.5\nrequests{code=\"200\",quantile=\"0.5\"} 2\nrequests{code=\"200\",quantile=\"0.99\"} 3\nrequests_sum{code=\"200\"} 12\nrequests_count{code=\"200\"} 6\n".to_owned());
} | rust_cleaned_test_functions.jsonl/120141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 491
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
27251,
368,
341,
286,
1077,
18266,
284,
52458,
341,
310,
829,
25,
330,
36242,
3263,
983,
51973,
3148,
310,
11441,
25,
2240,
345,
310,
9492,
25,
4329,
57213,
14702,
310,
3093,
25,
52458,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_extract_table_lookup_for_invalid_table() {
let writable_key = Pubkey::new_unique();
let mut compiled_keys = CompiledKeys {
payer: None,
key_meta_map: BTreeMap::from([
(writable_key, KeyFlags::WRITABLE.into()),
(Pubkey::new_unique(), KeyFlags::empty().into()),
]),
};
const MAX_LENGTH_WITHOUT_OVERFLOW: usize = u8::MAX as usize + 1;
let mut addresses = vec![Pubkey::default(); MAX_LENGTH_WITHOUT_OVERFLOW];
addresses.push(writable_key);
let lookup_table_account = AddressLookupTableAccount {
key: Pubkey::new_unique(),
addresses,
};
let expected_compiled_keys = compiled_keys.clone();
assert_eq!(
compiled_keys.try_extract_table_lookup(&lookup_table_account),
Err(CompileError::AddressTableLookupIndexOverflow),
);
assert_eq!(compiled_keys, expected_compiled_keys);
} | rust_cleaned_test_functions.jsonl/52070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 482
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
39123,
5237,
27464,
5478,
31433,
5237,
368,
341,
286,
1077,
45905,
3097,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5206,
19697,
12631,
284,
96471,
8850,
341,
310,
69275,
25,
2240,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_named_file_image() {
let mut file = NamedFile::open("tests/test.png").unwrap();
{
file.file();
let _f: &File = &file;
}
{
let _f: &mut File = &mut file;
}
let req = TestRequest::default().to_http_request();
let resp = file.respond_to(&req).unwrap();
assert_eq!(
resp.headers().get(header::CONTENT_TYPE).unwrap(),
"image/png"
);
assert_eq!(
resp.headers().get(header::CONTENT_DISPOSITION).unwrap(),
"inline; filename=\"test.png\""
);
} | rust_cleaned_test_functions.jsonl/35486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71834,
2458,
4954,
368,
341,
286,
1077,
5206,
1034,
284,
40459,
1703,
486,
2508,
445,
23841,
12697,
3508,
1827,
15454,
543,
286,
341,
310,
1034,
9715,
543,
310,
1077,
716,
69,
25,
609,
1703,
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_utimensat_futimens() {
use std::os::unix::prelude::*;
let tmpfile_open = tempfile::NamedTempFile::new().unwrap();
let tmpfile = tmpfile_open.as_ref();
let t1 = TimeSpec {
tv_sec: 1,
tv_nsec: 1,
};
let t2 = TimeSpec {
tv_sec: 2,
tv_nsec: 2,
};
utimensat(libc::AT_FDCWD, tmpfile, t1, t2, AtFlag::empty()).unwrap();
let st = crate::stat(tmpfile).unwrap();
assert_eq!(st.atime(), t1);
assert_eq!(st.mtime(), t2);
utimensat(libc::AT_FDCWD, tmpfile, UTIMENS_OMIT, t1, AtFlag::empty()).unwrap();
let st = crate::stat(tmpfile).unwrap();
assert_eq!(st.atime(), t1);
assert_eq!(st.mtime(), t1);
utimensat(libc::AT_FDCWD, tmpfile, t2, UTIMENS_OMIT, AtFlag::empty()).unwrap();
let st = crate::stat(tmpfile).unwrap();
assert_eq!(st.atime(), t2);
assert_eq!(st.mtime(), t1);
futimens(tmpfile_open.as_raw_fd(), t1, t2).unwrap();
let st = crate::stat(tmpfile).unwrap();
assert_eq!(st.atime(), t1);
assert_eq!(st.mtime(), t2);
} | rust_cleaned_test_functions.jsonl/43167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 628
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60363,
45597,
266,
761,
332,
45597,
368,
341,
286,
990,
1460,
486,
436,
486,
56646,
486,
1726,
52538,
79304,
286,
1077,
4174,
1192,
11311,
284,
54819,
486,
15810,
12151,
1703,
486,
931,
1005,
1545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_data_strings() -> Result<(), Error> {
let mut info = Data::new();
assert_eq!(info.to_string(), " root ->\n\n\n");
info.apply(&create_node!(parent: ROOT_ID, id: 1, name: "foo"))?;
assert_eq!(info.to_string(), " root ->\n\n> foo ->\n\n\n\n");
info.apply(&delete_node!( id: 1 ))?;
assert_eq!(info.to_string(), " root ->\n\n\n");
Ok(())
} | rust_cleaned_test_functions.jsonl/10347 | {
"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,
34729,
1769,
33500,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
3546,
284,
2885,
486,
931,
543,
286,
2060,
10714,
10297,
2733,
2389,
3904,
1507,
330,
3704,
1464,
59,
77,
1699,
1699,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_try_panic_any_message_owned_str() {
match thread::spawn(move || {
panic_any("owned string".to_string());
})
.join()
{
Err(e) => {
type T = String;
assert!(e.is::<T>());
assert_eq!(*e.downcast::<T>().unwrap(), "owned string".to_string());
}
Ok(()) => panic!(),
}
} | rust_cleaned_test_functions.jsonl/44049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
620,
31270,
37248,
6462,
51973,
2895,
368,
341,
262,
2432,
4516,
486,
46087,
34081,
1369,
341,
286,
21975,
37248,
445,
18332,
914,
3263,
983,
3904,
1423,
262,
2751,
262,
659,
5987,
741,
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... | 3 |
#[test]
fn test_bytewise_backspaced_char_should_be_preserved() {
new_ucmd!()
.arg("-b")
.pipe_in("x\x08")
.succeeds()
.stdout_is("x\x08");
} | rust_cleaned_test_functions.jsonl/23314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3710,
83,
24350,
3895,
2154,
4435,
9232,
43378,
21263,
32116,
2771,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
65,
1138,
286,
659,
13768,
1243,
445,
87,
3462,
15,
23,
1138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_make_unique() {
let hdr = indoc! {"
#include <string>
inline void take_string(const std::string*) {};
"};
let rs = quote! {
let s = ffi::make_string("");
unsafe { ffi::take_string(s.as_ref().unwrap()) };
};
run_test("", hdr, rs, &["take_string"], &[]);
} | rust_cleaned_test_functions.jsonl/9813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
28230,
21218,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
917,
397,
286,
7381,
737,
1896,
3904,
2741,
1460,
486,
917,
3764,
9321,
262,
330,
2440,
262,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_textgroup_text_only() {
const FORMAT_STR: &str = "[text](red bold)";
let formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper);
let result = formatter.parse(None).unwrap();
let mut result_iter = result.iter();
match_next!(result_iter, "text", Some(Color::Red.bold()));
} | rust_cleaned_test_functions.jsonl/71877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
4074,
4326,
18410,
368,
341,
286,
733,
52225,
7159,
25,
609,
495,
284,
10545,
1318,
9533,
1151,
13939,
24023,
286,
1077,
24814,
284,
923,
14183,
486,
931,
7832,
98084,
7159,
568,
15454,
1005... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_args() {
let args = items(quote! {test1, test2, test3="None"}).unwrap();
assert!(
args == vec![
Argument::Arg(parse_quote! {test1}, None),
Argument::Arg(parse_quote! {test2}, None),
Argument::Arg(parse_quote! {test3}, Some("None".to_owned())),
]
);
} | rust_cleaned_test_functions.jsonl/79350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
8384,
368,
341,
286,
1077,
2827,
284,
3589,
7,
2949,
0,
314,
1944,
16,
11,
1273,
17,
11,
1273,
18,
428,
4064,
9207,
568,
15454,
543,
286,
2060,
33673,
310,
2827,
621,
7486,
90515,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_hash2() -> Result<()> {
let addr = Address::from_hash(
Prefix::SimpleLedger,
AddressType::P2PKH,
Hash160::new([0; 20]),
);
assert_eq!(
addr.cash_addr(),
"simpleledger:qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq9gud9630"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/16398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
8950,
17,
368,
1464,
5714,
71698,
341,
286,
1077,
10789,
284,
9177,
486,
1499,
8950,
1006,
310,
56483,
486,
16374,
60850,
1389,
345,
310,
9177,
929,
486,
47,
17,
22242,
39,
345,
310,
6531,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resource_block_types() {
let p = Polar::new();
expect_error(
&p,
"Org{}",
"Expected 'actor' or 'resource' but found nothing.",
);
expect_error(
&p,
"seahorse Org{}",
"Expected 'actor' or 'resource' but found 'seahorse'.",
);
} | rust_cleaned_test_functions.jsonl/31750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17962,
7113,
9763,
368,
341,
286,
1077,
281,
284,
55896,
486,
931,
1428,
286,
1720,
4096,
1006,
310,
609,
79,
345,
310,
330,
42437,
6257,
756,
310,
330,
18896,
364,
5621,
6,
476,
364,
9233,
6,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_start_rule_is_token() {
let (syntax_grammar, lexical_grammar) =
extract_tokens(build_grammar(vec![Variable::named(
"rule_0",
Rule::string("hello"),
)]))
.unwrap();
assert_eq!(
syntax_grammar.variables,
vec![Variable::named("rule_0", Rule::terminal(0)),]
);
assert_eq!(
lexical_grammar.variables,
vec![Variable::anonymous("hello", Rule::string("hello")),]
)
} | rust_cleaned_test_functions.jsonl/99761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
21124,
6892,
6458,
368,
341,
286,
1077,
320,
56193,
62,
41094,
11,
77586,
62,
41094,
8,
4035,
310,
8649,
28838,
43333,
62,
41094,
25592,
20703,
7827,
486,
30245,
1006,
394,
330,
12937,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lossless_conversions() {
use super::IntoColor;
use crate::traits::Primitive;
test_lossless_conversion!(Luma<u8>, Luma<u16>, Luma<u8>);
test_lossless_conversion!(LumaA<u8>, LumaA<u16>, LumaA<u8>);
test_lossless_conversion!(Rgb<u8>, Rgb<u16>, Rgb<u8>);
test_lossless_conversion!(Rgba<u8>, Rgba<u16>, Rgba<u8>);
} | rust_cleaned_test_functions.jsonl/46646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11193,
1717,
3382,
28290,
368,
341,
286,
990,
2256,
486,
26591,
1636,
280,
286,
990,
17717,
486,
62633,
486,
33313,
401,
286,
1273,
11193,
1717,
64132,
10297,
43,
13416,
34837,
23,
8066,
444,
1341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_region_collection_seek_region() {
let mut cluster = new_node_cluster(0, 3);
let worker = Arc::new(Mutex::new(Worker::new("test")));
let share_worker = worker.clone();
let (tx, rx) = channel();
cluster
.sim
.wl()
.post_create_coprocessor_host(Box::new(move |id, host| {
let worker = share_worker.lock().unwrap();
let p = RegionInfoAccessor::new(host, &*worker);
tx.send((id, p)).unwrap()
}));
cluster.run();
let region_info_providers: HashMap<_, _> = rx.try_iter().collect();
assert_eq!(region_info_providers.len(), 3);
test_seek_region_impl(cluster, region_info_providers.clone());
for (_, p) in region_info_providers {
p.stop();
}
} | rust_cleaned_test_functions.jsonl/51511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20627,
25019,
74473,
20627,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
626,
262,
1077,
11864,
284,
19689,
486,
931,
3189,
9371,
486,
931,
7,
21936,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_legacy() {
let reader = std::io::BufReader::new(LEGACYRUN);
let parser = MsfParser::new();
let run = parser.parse(reader);
assert!(run.is_ok());
} | rust_cleaned_test_functions.jsonl/83009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
97555,
368,
341,
286,
1077,
6604,
284,
1460,
486,
815,
486,
15064,
5062,
486,
931,
7,
35213,
43745,
47390,
317,
286,
1077,
6729,
284,
16064,
69,
6570,
486,
931,
543,
286,
1077,
1598,
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 |
#[test]
fn test_async_prewrite_primary() {
let engine = TestEngineBuilder::new().build().unwrap();
let ctx = Context::default();
let cm = ConcurrencyManager::new(42.into());
let do_prewrite = || {
let snapshot = engine.snapshot(Default::default()).unwrap();
let mut txn = MvccTxn::new(snapshot, TimeStamp::new(2), true, cm.clone());
let mutation = Mutation::Put((Key::from_raw(b"key"), b"value".to_vec()));
let (min_commit_ts, _) = prewrite(
&mut txn,
&txn_props(
TimeStamp::new(2),
b"key",
CommitKind::Async(TimeStamp::zero()),
None,
0,
false,
),
mutation,
&Some(vec![b"key1".to_vec(), b"key2".to_vec(), b"key3".to_vec()]),
false,
)
.unwrap();
let modifies = txn.into_modifies();
if !modifies.is_empty() {
engine
.write(&ctx, WriteData::from_modifies(modifies))
.unwrap();
}
min_commit_ts
};
assert_eq!(do_prewrite(), 43.into());
let snapshot = engine.snapshot(Default::default()).unwrap();
let mut reader = MvccReader::new(snapshot, None, true, IsolationLevel::Si);
let lock = reader.load_lock(&Key::from_raw(b"key")).unwrap().unwrap();
assert_eq!(lock.ts, TimeStamp::new(2));
assert_eq!(lock.use_async_commit, true);
assert_eq!(
lock.secondaries,
vec![b"key1".to_vec(), b"key2".to_vec(), b"key3".to_vec()]
);
assert_eq!(lock.min_commit_ts, TimeStamp::new(43));
// A duplicate prewrite request should return the min_commit_ts in the primary key
assert_eq!(do_prewrite(), 43.into());
} | rust_cleaned_test_functions.jsonl/16091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1068
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28346,
620,
52473,
45314,
368,
341,
23459,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
5635,
284,
9608,
486,
2258,
543,
286,
1077,
9961,
284,
1200,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_count_node_metadata() {
let pool = create_connection_pool_and_migrate();
let registry = DieselRegistry::new(pool);
registry
.insert_node(get_node_1())
.expect("Unable to insert node");
registry
.insert_node(get_node_2())
.expect("Unable to insert node");
registry
.insert_node(get_node_3())
.expect("Unable to insert node");
let filter = vec![MetadataPredicate::Eq(
"company".into(),
get_node_2().metadata.get("company").unwrap().to_string(),
)];
let count = registry
.count_nodes(&filter)
.expect("Failed to retrieve nodes");
assert_eq!(count, 2);
} | rust_cleaned_test_functions.jsonl/106302 | {
"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,
3180,
5084,
22220,
368,
341,
286,
1077,
7314,
284,
1855,
15866,
15709,
8378,
717,
34479,
543,
286,
1077,
19424,
284,
53794,
15603,
486,
931,
41838,
626,
286,
19424,
198,
310,
659,
4208,
5084,
5433... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_two_neuron_disagree_identical_voting_power_one_does_not_vote_proposal_should_rejected_at_expiration(
) {
check_proposal_status_after_voting_and_after_expiration(
vec![
Neuron {
dissolve_state: NOTDISSOLVING_MIN_DISSOLVE_DELAY_TO_VOTE,
cached_neuron_stake_e8s: 1,
..Neuron::default()
},
Neuron {
dissolve_state: NOTDISSOLVING_MIN_DISSOLVE_DELAY_TO_VOTE,
cached_neuron_stake_e8s: 40,
..Neuron::default()
},
],
"P-",
ProposalStatus::Open,
ProposalStatus::Rejected,
);
} | rust_cleaned_test_functions.jsonl/1112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
13925,
36090,
9932,
68100,
38399,
938,
2273,
11519,
20421,
11667,
96374,
7913,
54360,
21663,
32556,
43378,
1288,
28303,
3752,
2702,
28479,
1006,
8,
341,
262,
1779,
21663,
32556,
4773,
19844,
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_basic_wrappers() {
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct SBox(#[serde_as(as = "Box<DisplayFromStr>")] Box<u32>);
is_equal(SBox(Box::new(123)), expect![[r#""123""#]]);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct SRc(#[serde_as(as = "Rc<DisplayFromStr>")] Rc<u32>);
is_equal(SRc(Rc::new(123)), expect![[r#""123""#]]);
#[serde_as]
#[derive(Debug, Serialize, Deserialize)]
struct SRcWeak(#[serde_as(as = "RcWeak<DisplayFromStr>")] RcWeak<u32>);
check_serialization(SRcWeak(RcWeak::new()), expect![[r#"null"#]]);
let s: SRcWeak = serde_json::from_str("null").unwrap();
assert!(s.0.upgrade().is_none());
let s: SRcWeak = serde_json::from_str("\"123\"").unwrap();
assert!(s.0.upgrade().is_none());
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct SArc(#[serde_as(as = "Arc<DisplayFromStr>")] Arc<u32>);
is_equal(SArc(Arc::new(123)), expect![[r#""123""#]]);
#[serde_as]
#[derive(Debug, Serialize, Deserialize)]
struct SArcWeak(#[serde_as(as = "ArcWeak<DisplayFromStr>")] ArcWeak<u32>);
check_serialization(SArcWeak(ArcWeak::new()), expect![[r#"null"#]]);
let s: SArcWeak = serde_json::from_str("null").unwrap();
assert!(s.0.upgrade().is_none());
let s: SArcWeak = serde_json::from_str("\"123\"").unwrap();
assert!(s.0.upgrade().is_none());
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct SCell(#[serde_as(as = "Cell<DisplayFromStr>")] Cell<u32>);
is_equal(SCell(Cell::new(123)), expect![[r#""123""#]]);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct SRefCell(#[serde_as(as = "RefCell<DisplayFromStr>")] RefCell<u32>);
is_equal(SRefCell(RefCell::new(123)), expect![[r#""123""#]]);
#[serde_as]
#[derive(Debug, Serialize, Deserialize)]
struct SMutex(#[serde_as(as = "Mutex<DisplayFromStr>")] Mutex<u32>);
check_serialization(SMutex(Mutex::new(123)), expect![[r#""123""#]]);
let s: SMutex = serde_json::from_str("\"123\"").unwrap();
assert_eq!(*s.0.lock().unwrap(), 123);
#[serde_as]
#[derive(Debug, Serialize, Deserialize)]
struct SRwLock(#[serde_as(as = "RwLock<DisplayFromStr>")] RwLock<u32>);
let expected = expect![[r#""123""#]];
check_serialization(SRwLock(RwLock::new(123)), expected);
let s: SRwLock = serde_json::from_str("\"123\"").unwrap();
assert_eq!(*s.0.read().unwrap(), 123);
} | rust_cleaned_test_functions.jsonl/45724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
44074,
27821,
368,
341,
262,
11506,
47024,
11898,
921,
262,
11506,
27098,
42618,
11,
39900,
11,
48440,
11,
55039,
5563,
262,
2036,
328,
1611,
7,
13353,
47024,
11898,
36951,
284,
330,
1611,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitxor() {
for elm in BIT_TESTS {
let (a_vec, b_vec, _, _, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);
assert_op!(a ^ b == c);
assert_op!(b ^ a == c);
assert_op!(a ^ c == b);
assert_op!(c ^ a == b);
assert_op!(b ^ c == a);
assert_op!(c ^ b == a);
}
} | rust_cleaned_test_functions.jsonl/90118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
71311,
368,
341,
286,
369,
42205,
304,
24247,
80312,
341,
310,
1077,
320,
64,
13251,
11,
293,
13251,
11,
8358,
8358,
272,
13251,
8,
284,
353,
23162,
280,
310,
1077,
264,
284,
6164,
21570,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_create_srv_record() {
let srv = DnsTypeSRV::new(10, 1, 8080, "ftp.zhangmingkai.cn.");
assert_eq!(srv.is_ok(), true);
let srv = srv.unwrap();
assert_eq!(srv.get_type(), DNSType::SRV);
} | rust_cleaned_test_functions.jsonl/63630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
63921,
14192,
368,
341,
286,
1077,
43578,
284,
422,
4412,
929,
14557,
53,
486,
931,
7,
16,
15,
11,
220,
16,
11,
220,
23,
15,
23,
15,
11,
330,
25068,
3938,
20658,
5311,
74,
2143,
22057,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_default_standard_bulletin_a() {
let eop = EarthOrientationData::from_default_standard(EOPExtrapolation::Hold, true, EOPType::StandardBulletinA);
// These need to be structured slightly differently since the
// default package data is regularly updated.
assert_ne!(eop.data.len(), 0);
assert_eq!(eop.mjd_min, 41684);
assert!(eop.mjd_max >= 59519);
assert!(eop.mjd_last_lod >= 59570);
assert!(eop.mjd_last_dxdy >= 59648);
assert_eq!(eop.eop_type, EOPType::StandardBulletinA);
assert_eq!(eop.extrapolate, EOPExtrapolation::Hold);
assert_eq!(eop.interpolate, true);
} | rust_cleaned_test_functions.jsonl/128063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
9993,
48688,
94619,
258,
4306,
368,
341,
286,
1077,
384,
453,
284,
9237,
22332,
1043,
486,
1499,
9993,
48688,
10722,
3067,
840,
376,
16657,
367,
486,
47427,
11,
830,
11,
468,
3067,
929,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_affine_scale() {
let matrix = Matrix4x4::from_affine_scale(5);
let unit_w = Vector4::unit_w();
let expected = Vector4::new(5, 5, 5, 1);
let result = matrix * Vector4::new(1, 1, 1, 1);
assert_eq!(result, expected);
assert_eq!(matrix * unit_w, unit_w);
} | rust_cleaned_test_functions.jsonl/129108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
48914,
482,
16727,
368,
341,
286,
1077,
6172,
284,
11631,
19,
87,
19,
486,
1499,
48914,
482,
16727,
7,
20,
317,
286,
1077,
4982,
1670,
284,
4196,
19,
486,
3843,
1670,
543,
286,
1077,
360... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_circuit_empty_endpoint() {
let state = setup_splinter_state();
let peer_connector = setup_peer_connector();
let orchestrator = setup_orchestrator();
// set up key registry
let mut key_registry = StorageKeyRegistry::new("memory".to_string()).unwrap();
let key_info = KeyInfo::builder(b"test_signer_a".to_vec(), "node_a".to_string()).build();
key_registry.save_key(key_info).unwrap();
let admin_shared = AdminServiceShared::new(
"node_a".into(),
orchestrator,
peer_connector,
Box::new(MockAuthInquisitor),
state,
Box::new(HashVerifier),
Box::new(key_registry),
Box::new(AllowAllKeyPermissionManager),
"memory",
)
.unwrap();
let mut circuit = setup_test_circuit();
let mut node_a = SplinterNode::new();
node_a.set_node_id("node_a".to_string());
node_a.set_endpoint("test://endpoint_a:0".to_string());
let mut node_b = SplinterNode::new();
node_b.set_node_id("node_b".to_string());
node_b.set_endpoint("".to_string());
circuit.set_members(RepeatedField::from_vec(vec![node_a, node_b]));
if let Ok(_) = admin_shared.validate_create_circuit(&circuit, b"test_signer_a", "node_a") {
panic!("Should have been invalid because a member has an empty endpoint");
}
} | rust_cleaned_test_functions.jsonl/124176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 687
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
666,
37268,
15124,
36699,
368,
341,
286,
1077,
1584,
284,
6505,
643,
500,
2245,
4387,
543,
286,
1077,
14397,
76393,
284,
6505,
45159,
76393,
543,
286,
1077,
65128,
850,
284,
6505,
8734,
331... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_consider() {
let mut index = ChunkIndex::new();
let pos_a = ChunkPos::new(0, 1, 2);
let pos_b = ChunkPos::new(3, 4, 5);
assert_eq!(index.consider(pos_a), false);
assert_eq!(index.consider(pos_b), false);
index.mark(pos_a);
assert_eq!(index.consider(pos_a), true);
assert_eq!(index.consider(pos_b), false);
} | rust_cleaned_test_functions.jsonl/40082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31971,
1776,
368,
341,
262,
1077,
5206,
1922,
284,
45513,
1552,
486,
931,
1428,
262,
1077,
1133,
4306,
284,
45513,
4859,
486,
931,
7,
15,
11,
220,
16,
11,
220,
17,
317,
262,
1077,
1133,
880,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_mips() {
// 1D
assert_eq!(
Extent3d {
width: 240,
height: 1,
depth_or_array_layers: 1
}
.max_mips(TextureDimension::D1),
1
);
// 2D
assert_eq!(
Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1
}
.max_mips(TextureDimension::D2),
1
);
assert_eq!(
Extent3d {
width: 60,
height: 60,
depth_or_array_layers: 1
}
.max_mips(TextureDimension::D2),
6
);
assert_eq!(
Extent3d {
width: 240,
height: 1,
depth_or_array_layers: 1000
}
.max_mips(TextureDimension::D2),
8
);
// 3D
assert_eq!(
Extent3d {
width: 16,
height: 30,
depth_or_array_layers: 60
}
.max_mips(TextureDimension::D3),
6
);
} | rust_cleaned_test_functions.jsonl/134314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 643
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
717,
3077,
368,
341,
262,
442,
220,
16,
35,
198,
262,
2060,
10714,
33673,
286,
9447,
306,
18,
67,
341,
310,
2374,
25,
220,
17,
19,
15,
345,
310,
2608,
25,
220,
16,
345,
310,
7990,
87... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_curly_bracket_open() {
{
let code = r#"{}"#;
let tokenization_result = tokenize(code);
let tokens = tokenization_result.unwrap();
assert_eq_code_and_tokens_length(code, &tokens);
assert!(tokens.len() == 2);
let token = &tokens[0];
assert!(token.id == TokenId::CurlyBracketOpen);
assert!(token.index == 0);
assert!(token.length == 1);
}
} | rust_cleaned_test_functions.jsonl/116445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18956,
398,
17682,
5709,
11311,
368,
341,
286,
341,
310,
1077,
2038,
284,
435,
55543,
6257,
57676,
401,
310,
1077,
3950,
2022,
5287,
284,
77651,
15842,
317,
310,
1077,
11211,
284,
3950,
2022,
5287... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let reader = std::io::BufReader::new(V1RUN);
let parser = MsfParser::new();
let run = parser.parse(reader);
println!("{:?}", run);
assert!(run.is_ok());
} | rust_cleaned_test_functions.jsonl/83008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
6604,
284,
1460,
486,
815,
486,
15064,
5062,
486,
931,
12410,
16,
47390,
317,
286,
1077,
6729,
284,
16064,
69,
6570,
486,
931,
543,
286,
1077,
1598,
284,
6729,
4632,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_csp_get_message_5() {
let json = r#"{
"csp-report": {
"document-uri": "http://example.com/foo",
"effective-directive": "script-src",
"blocked-uri": "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D"
}
}"#;
let mut event = Event::default();
Csp::apply_to_event(json.as_bytes(), &mut event).unwrap();
let message = &event.logentry.value().unwrap().formatted;
insta::assert_debug_snapshot!(message.as_str().unwrap(), @r###""Blocked \'script\' from \'data:\'""###);
} | rust_cleaned_test_functions.jsonl/4032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2154,
3062,
6462,
62,
20,
368,
341,
286,
1077,
2951,
284,
435,
55543,
515,
310,
330,
66,
2154,
47411,
788,
341,
394,
330,
6062,
87232,
788,
330,
1254,
1110,
8687,
905,
60555,
756,
394,
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_parse_config() -> Result<(), serde_yaml::Error> {
let yml = r#"
---
s3mon:
endpoint: endpoint
region: region
access_key: ACCESS_KEY_ID
secret_key: SECRET_ACCESS_KEY
buckets:
bucket_A:
- prefix: foo
age: 43200
- prefix: bar
- prefix: baz
size: 1024
"#;
let mut buckets = std::collections::BTreeMap::new();
buckets.insert(
"bucket_A".to_string(),
vec![
config::Object {
prefix: "foo".to_string(),
age: 43200,
size: 0,
},
config::Object {
prefix: "bar".to_string(),
age: 86400,
size: 0,
},
config::Object {
prefix: "baz".to_string(),
age: 86400,
size: 1024,
},
],
);
let cfg = config::Config {
s3mon: config::Data {
endpoint: "endpoint".to_string(),
region: "region".to_string(),
access_key: "ACCESS_KEY_ID".to_string(),
secret_key: "SECRET_ACCESS_KEY".to_string(),
buckets,
},
};
let y: config::Config = serde_yaml::from_str(yml)?;
assert_eq!(cfg, y);
Ok(())
} | rust_cleaned_test_functions.jsonl/125233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 860
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5332,
368,
1464,
5714,
68843,
61570,
64380,
486,
1454,
29,
341,
286,
1077,
379,
1014,
284,
435,
2,
698,
10952,
82,
18,
1645,
510,
220,
14887,
25,
14887,
198,
220,
5537,
25,
5537,
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... | 2 |
#[test]
fn test_0092_example_2() {
let head = linked![5];
let left = 1;
let right = 1;
let result = linked![5];
assert_eq!(Solution::reverse_between(head, left, right), result);
} | rust_cleaned_test_functions.jsonl/5691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
24,
17,
39304,
62,
17,
368,
341,
286,
1077,
1968,
284,
10592,
20703,
20,
935,
286,
1077,
2115,
284,
220,
16,
280,
286,
1077,
1290,
284,
220,
16,
280,
286,
1077,
1102,
284,
10592,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pause_split_when_snap_gen_never_split() {
let is_generating_snapshot = "is_generating_snapshot";
let region_split_skip_max_count = "region_split_skip_max_count";
fail::cfg(region_split_skip_max_count, "return()").unwrap();
fail::cfg(is_generating_snapshot, "return()").unwrap();
let (region, left, right) = gen_split_region();
assert_eq!(region, left);
assert_eq!(left, right);
fail::remove(is_generating_snapshot);
fail::remove(region_split_skip_max_count);
} | rust_cleaned_test_functions.jsonl/45465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59989,
17052,
47636,
74175,
16322,
13925,
423,
17052,
368,
341,
262,
1077,
374,
71963,
1095,
53265,
284,
330,
285,
71963,
1095,
53265,
876,
262,
1077,
5537,
17052,
44830,
6345,
3180,
284,
330,
3943,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_from_out_of_range_should_give_error() {
let deserialize_result = serde_json::from_str::<Coin>("\"10000000000000000001\"");
assert!(deserialize_result.is_err());
} | rust_cleaned_test_functions.jsonl/51903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
5673,
6068,
3575,
9698,
43378,
1889,
533,
4096,
368,
341,
310,
1077,
35240,
5287,
284,
61570,
9455,
486,
1499,
2895,
27638,
41180,
13211,
2105,
16,
15,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_valid_configs() {
for val in [true, false].iter() {
verify_load(
json!({
"enable_dynamic_configuration": *val,
}),
Config { enable_dynamic_configuration: *val },
);
}
} | rust_cleaned_test_functions.jsonl/103880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
8337,
59150,
368,
341,
286,
369,
1044,
304,
508,
1866,
11,
895,
936,
2015,
368,
341,
310,
10146,
12411,
1006,
394,
2951,
0,
2262,
503,
330,
12552,
45992,
35726,
788,
353,
831,
345,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_create_account_with_seed() {
let new_owner = Pubkey::new(&[9; 32]);
let from = Pubkey::new_unique();
let seed = "shiny pepper";
let to = Pubkey::create_with_seed(&from, seed, &new_owner).unwrap();
let from_account = AccountSharedData::new(100, 0, &system_program::id());
let to_account = AccountSharedData::new(0, 0, &Pubkey::default());
let accounts = process_instruction(
&bincode::serialize(&SystemInstruction::CreateAccountWithSeed {
base: from,
seed: seed.to_string(),
lamports: 50,
space: 2,
owner: new_owner,
})
.unwrap(),
vec![(from, from_account), (to, to_account)],
vec![
AccountMeta {
pubkey: from,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: to,
is_signer: true,
is_writable: false,
},
],
Ok(()),
super::process_instruction,
);
assert_eq!(accounts[0].lamports(), 50);
assert_eq!(accounts[1].lamports(), 50);
assert_eq!(accounts[1].owner(), &new_owner);
assert_eq!(accounts[1].data(), &[0, 0]);
} | rust_cleaned_test_functions.jsonl/95869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 789
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
13500,
6615,
33809,
368,
341,
286,
1077,
501,
29027,
284,
22611,
792,
486,
931,
2099,
58,
24,
26,
220,
18,
17,
2558,
286,
1077,
504,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
103... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_term_scorer_shallow_advance() -> crate::Result<()> {
let bm25_weight = Bm25Weight::for_one_term(300, 1024, 10.0);
let mut doc_and_tfs = vec![];
for i in 0u32..300u32 {
let doc = i * 10;
doc_and_tfs.push((doc, 1u32 + doc % 3u32));
}
let fieldnorms: Vec<u32> = std::iter::repeat(10u32).take(3_000).collect();
let mut term_scorer = TermScorer::create_for_test(&doc_and_tfs, &fieldnorms, bm25_weight);
assert_eq!(term_scorer.doc(), 0u32);
term_scorer.shallow_seek(1289);
assert_eq!(term_scorer.doc(), 0u32);
term_scorer.seek(1289);
assert_eq!(term_scorer.doc(), 1290);
Ok(())
} | rust_cleaned_test_functions.jsonl/94102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17464,
643,
6005,
261,
3712,
7183,
98093,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
1077,
34868,
17,
20,
15876,
284,
425,
76,
17,
20,
8295,
486,
1958,
11667,
17464,
7,
18,
15,
15,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_join_request_app_eui_extraction() {
let data = phy_join_request_payload();
let phy = PhyPayload::new(&data[..]);
assert!(phy.is_ok());
if let MacPayload::JoinRequest(join_request) = phy.unwrap().mac_payload() {
assert_eq!(join_request.app_eui(), EUI64::new(&data[1..9]).unwrap());
} else {
panic!("failed to parse JoinRequest mac payload");
}
} | rust_cleaned_test_functions.jsonl/81615 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
7893,
8191,
2204,
1963,
94842,
368,
341,
262,
1077,
821,
284,
36455,
31017,
7893,
32813,
543,
262,
1077,
36455,
284,
92582,
29683,
486,
931,
2099,
691,
95874,
10149,
262,
2060,
10297,
12700,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_keywords_in_use_stmt() {
check(
r"use <|>",
expect![[r#"
kw crate::
kw self
kw super::
"#]],
);
check(
r"use a::<|>",
expect![[r#"
kw self
kw super::
"#]],
);
check(
r"use a::{b, <|>}",
expect![[r#"
kw self
kw super::
"#]],
);
} | rust_cleaned_test_functions.jsonl/99570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
1243,
15951,
21824,
368,
341,
286,
1779,
1006,
310,
435,
25372,
82639,
35452,
310,
1720,
0,
15505,
81,
2,
698,
394,
29525,
17717,
49577,
394,
29525,
656,
198,
394,
29525,
2256,
49577,
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_server_cookie() {
let mut ctx: CCPContext = CCPContext::new();
let mut buf: [u8; CCP_MAX_PACKET_SIZE] = [0; CCP_MAX_PACKET_SIZE];
let mut ret = ctx.mk_server_cookie(&mut buf);
if ret > 0 {
ret = ctx.parse_server_cookie(&buf, ret as usize);
}
assert!(ret == mem::size_of::<ServerCookie>() as isize);
} | rust_cleaned_test_functions.jsonl/100575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
38663,
368,
341,
286,
1077,
5206,
5635,
25,
75921,
1972,
284,
75921,
1972,
486,
931,
543,
286,
1077,
5206,
6607,
25,
508,
84,
23,
26,
75921,
6806,
40328,
4098,
60,
284,
508,
15,
26,
759... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_side_metadata_sanity_verify_no_overlap_contiguous() {
let spec_1 = SideMetadataSpec {
name: "spec_1",
is_global: true,
offset: SideMetadataOffset::addr(Address::ZERO),
log_num_of_bits: 0,
log_bytes_in_region: 0,
};
let spec_2 = SideMetadataSpec {
name: "spec_2",
is_global: true,
offset: SideMetadataOffset::layout_after(&spec_1),
log_num_of_bits: 0,
log_bytes_in_region: 0,
};
assert!(verify_no_overlap_contiguous(&spec_1, &spec_1).is_err());
assert!(verify_no_overlap_contiguous(&spec_1, &spec_2).is_ok());
let spec_1 = SideMetadataSpec {
name: "spec_1",
is_global: true,
offset: SideMetadataOffset::addr(unsafe { Address::from_usize(1) }),
log_num_of_bits: 0,
log_bytes_in_region: 0,
};
assert!(verify_no_overlap_contiguous(&spec_1, &spec_2).is_err());
let spec_1 = SideMetadataSpec {
name: "spec_1",
is_global: true,
offset: SideMetadataOffset::addr(Address::ZERO),
log_num_of_bits: 0,
log_bytes_in_region: 0,
};
let spec_2 = SideMetadataSpec {
name: "spec_2",
is_global: true,
// We specifically make up an invalid offset
offset: SideMetadataOffset::addr(
spec_1.get_absolute_offset() + metadata_address_range_size(&spec_1) - 1,
),
log_num_of_bits: 0,
log_bytes_in_region: 0,
};
assert!(verify_no_overlap_contiguous(&spec_1, &spec_2).is_err());
} | rust_cleaned_test_functions.jsonl/50089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 928
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30862,
22220,
643,
38270,
35638,
6536,
65794,
10260,
27029,
368,
341,
286,
1077,
1398,
62,
16,
284,
16659,
14610,
8327,
341,
310,
829,
25,
330,
9535,
62,
16,
756,
310,
374,
19296,
25,
830,
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_process_nonce_ix_no_keyed_accs_fail() {
process_instruction(
&serialize(&SystemInstruction::AdvanceNonceAccount).unwrap(),
Vec::new(),
Vec::new(),
Err(InstructionError::NotEnoughAccountKeys),
super::process_instruction,
);
} | rust_cleaned_test_functions.jsonl/95892 | {
"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,
11305,
48508,
62686,
6536,
3097,
291,
17737,
82,
22121,
368,
341,
286,
1882,
54923,
1006,
310,
609,
24166,
2099,
2320,
16664,
486,
95027,
90528,
7365,
568,
15454,
3148,
310,
11312,
486,
931,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_all_query() {
let index = create_test_index();
let searcher = index.searcher().unwrap();
let weight = AllQuery.weight(&searcher, false).unwrap();
{
let reader = searcher.segment_reader(0);
let mut scorer = weight.scorer(reader, 1.0).unwrap();
assert_eq!(scorer.doc(), 0u32);
assert_eq!(scorer.advance(), 1u32);
assert_eq!(scorer.doc(), 1u32);
assert_eq!(scorer.advance(), TERMINATED);
}
{
let reader = searcher.segment_reader(1);
let mut scorer = weight.scorer(reader, 1.0).unwrap();
assert_eq!(scorer.doc(), 0u32);
assert_eq!(scorer.advance(), TERMINATED);
}
} | rust_cleaned_test_functions.jsonl/121588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
5738,
368,
341,
286,
1077,
1922,
284,
1855,
4452,
3560,
543,
286,
1077,
94674,
284,
1922,
9288,
261,
1005,
15454,
543,
286,
1077,
4680,
284,
2009,
2859,
25152,
2099,
1836,
261,
11,
895,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_candidate_carry_sets() {
let things = vec![gen("a") ,gen("b"), gen("c")];
let expected: Vec<Vec<ScienceThing>> = vec![
vec![gen("a")],
vec![gen("a"), gen("b")],
vec![gen("a"), gen("c")],
vec![gen("b")],
vec![gen("b"), gen("c")],
vec![gen("c")],
];
assert_eq!(expected, candidate_carry_sets(things));
} | rust_cleaned_test_functions.jsonl/55911 | {
"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,
62360,
666,
11433,
21289,
368,
341,
10217,
2513,
284,
7486,
20703,
4370,
445,
64,
899,
1154,
4370,
445,
65,
3975,
4081,
445,
66,
899,
935,
10217,
3601,
25,
11312,
50439,
27,
35400,
52940,
2452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.