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_get_header_and_dicom_tags() {
let mut header = vec!["foo", "bar", "baz", "qux", "quux", "quuz"];
let mut dicom_tags = vec!["qux", "quux", "quuz"];
get_header_and_dicom_tags(
&mut header,
&mut dicom_tags,
Some(vec!["bar", "quux", "quuz"]),
)
.unwrap();
assert_eq!(header, vec!["bar", "quux", "quuz"]);
assert_eq!(dicom_tags, vec!["quux", "quuz"]);
} | rust_cleaned_test_functions.jsonl/76510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8757,
8378,
39154,
316,
16333,
368,
341,
286,
1077,
5206,
4247,
284,
7486,
0,
1183,
7975,
497,
330,
2257,
497,
330,
42573,
497,
330,
446,
87,
497,
330,
446,
2200,
497,
330,
446,
5197,
63... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_empty_lines() {
new_ucmd!()
.arg("-V")
.arg("version-empty-lines.txt")
.succeeds()
.stdout_is("\n\n\n\n\n\n\n1.2.3-alpha\n1.2.3-alpha2\n\t\t\t1.12.4\n11.2.3\n");
} | rust_cleaned_test_functions.jsonl/131549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
15124,
18323,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
53,
1138,
286,
659,
858,
445,
4366,
39433,
83363,
3909,
1138,
286,
659,
82,
29264,
82,
741,
286,
659,
36358,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strand() {
assert_eq!(Strand::from_char(&'+').unwrap(), Strand::Forward);
assert_eq!(Strand::from_char(&'-').unwrap(), Strand::Reverse);
assert!(Strand::from_char(&'.').unwrap().is_unknown());
assert!(Strand::from_char(&'o').is_err());
assert_eq!(Strand::Forward.strand_symbol(), "+");
assert_eq!(Strand::Reverse.strand_symbol(), "-");
assert_eq!(Strand::Unknown.strand_symbol(), ".");
} | rust_cleaned_test_functions.jsonl/51020 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
437,
368,
341,
286,
2060,
10714,
10297,
2580,
437,
486,
1499,
9232,
2099,
8133,
1823,
15454,
1507,
77302,
486,
25925,
317,
286,
2060,
10714,
10297,
2580,
437,
486,
1499,
9232,
2099,
24293,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_geometry_assigment() {
enable_logging();
assert_parse(
Rule::geometry_assigment,
r#"color= "blue";"#,
GeometryAssigment { key: Ident { content: "color" }, subkey: None, value: "\"blue\"" },
);
assert_parse(
Rule::geometry_assigment,
"key.gap= 0.5;",
GeometryAssigment {
key: Ident { content: "key" },
subkey: Some(Ident { content: "gap" }),
value: "0.5",
},
);
} | rust_cleaned_test_functions.jsonl/23475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57022,
12083,
343,
478,
368,
341,
262,
7283,
59982,
1428,
262,
2060,
21039,
1006,
286,
18100,
486,
15281,
12083,
343,
478,
345,
286,
435,
55543,
3423,
28,
330,
12203,
5123,
57676,
345,
286,
38918,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mod32_imm() {
test_interpreter_and_jit_asm!(
"
lddw r0, 0x100000003
mod32 r0, 3
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x0 } },
3
);
} | rust_cleaned_test_functions.jsonl/58965 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
18,
17,
71370,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
326,
631,
86,
435,
15,
11,
220,
15,
87,
16,
15,
15,
15,
15,
15,
15,
15,
18,
198,
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_encode_decode_json() {
use rustc_serialize::json;
let header: Header = Header::new(128, true, 256, 1000, false, false, 1, 12);
let encode = json::as_pretty_json(&header).to_string();
let decode: Header = json::decode(&encode[..]).unwrap();
assert_eq!(decode, header);
} | rust_cleaned_test_functions.jsonl/52297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
15227,
9455,
368,
341,
220,
990,
23071,
66,
88686,
486,
2236,
401,
220,
1077,
4247,
25,
12104,
284,
12104,
486,
931,
7,
16,
17,
23,
11,
830,
11,
220,
17,
20,
21,
11,
220,
16,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_increment_le_vectors() {
let mut x = [255, 2, 3, 4, 5];
let y = [0, 3, 3, 4, 5];
increment_le(&mut x);
assert!(!x.iter().all(|x| *x == 0));
assert_eq!(x, y);
let mut x = [255, 255, 3, 4, 5];
let y = [0, 0, 4, 4, 5];
increment_le(&mut x);
assert!(!x.iter().all(|x| *x == 0));
assert_eq!(x, y);
let mut x = [255, 255, 255, 4, 5];
let y = [0, 0, 0, 5, 5];
increment_le(&mut x);
assert!(!x.iter().all(|x| *x == 0));
assert_eq!(x, y);
let mut x = [255, 255, 255, 255, 5];
let y = [0, 0, 0, 0, 6];
increment_le(&mut x);
assert!(!x.iter().all(|x| *x == 0));
assert_eq!(x, y);
let mut x = [255, 255, 255, 255, 255];
let y = [0, 0, 0, 0, 0];
increment_le(&mut x);
assert!(x.iter().all(|x| *x == 0));
assert_eq!(x, y);
} | rust_cleaned_test_functions.jsonl/20153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51482,
11751,
49158,
368,
341,
286,
1077,
5206,
856,
284,
508,
17,
20,
20,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
1077,
379,
284,
508,
15,
11,
220,
18,
11,
220,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concat_error() -> Result<()> {
let result = return_type(&ScalarFunction::Concat, &vec![]);
if let Ok(_) = result {
Err(ExecutionError::General(
"Function 'concat' cannot accept zero arguments".to_string(),
))
} else {
Ok(())
}
} | rust_cleaned_test_functions.jsonl/111689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57478,
4096,
368,
1464,
5714,
71698,
341,
286,
1077,
1102,
284,
470,
1819,
2099,
20639,
5152,
486,
78440,
11,
609,
4083,
0,
56703,
286,
421,
1077,
7622,
48139,
284,
1102,
341,
310,
15495,
7,
202... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hidden_prob_calc_not_seen_in_active_scan_lowers_prob() {
// Test that updating hidden probability after not seeing the network in a directed active
// scan lowers the hidden probability
let mut network_config = NetworkConfig::new(
NetworkIdentifier::new(b"some_ssid".to_vec(), SecurityType::None),
Credential::None,
false,
)
.expect("Failed to create network config");
network_config.update_hidden_prob(HiddenProbEvent::NotSeenActive);
let expected_prob = PROB_HIDDEN_DEFAULT - PROB_HIDDEN_INCREMENT_NOT_SEEN_ACTIVE;
assert_eq!(network_config.hidden_probability, expected_prob);
network_config.update_hidden_prob(HiddenProbEvent::NotSeenActive);
let expected_prob = expected_prob - PROB_HIDDEN_INCREMENT_NOT_SEEN_ACTIVE;
assert_eq!(network_config.hidden_probability, expected_prob);
} | rust_cleaned_test_functions.jsonl/114362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26739,
20794,
38241,
7913,
60668,
1243,
12930,
28857,
907,
15965,
20794,
368,
341,
286,
442,
3393,
429,
21010,
8177,
18927,
1283,
537,
9120,
279,
3922,
304,
264,
15540,
4541,
198,
286,
442,
8569,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_whitespace_elements() {
let c = Template::compile(
" {{elem}}\n\t{{#if true}} \
{{/if}}\n{{{{raw}}}} {{{{/raw}}}}\n{{{{raw}}}}{{{{/raw}}}}\n",
);
assert_eq!(c.ok().unwrap().elements.len(), 9);
} | rust_cleaned_test_functions.jsonl/12009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86175,
22801,
368,
341,
262,
1077,
272,
284,
14355,
486,
20433,
1006,
286,
330,
220,
5867,
18871,
3417,
59,
77,
4955,
2979,
2,
333,
830,
3417,
3044,
260,
5867,
14,
333,
3417,
59,
77,
2979,
297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_send_transaction_preflight() {
let exit = Arc::new(AtomicBool::new(false));
let validator_exit = create_validator_exit(&exit);
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let block_commitment_cache = Arc::new(RwLock::new(
BlockCommitmentCache::default_with_blockstore(blockstore.clone()),
));
let bank_forks = new_bank_forks().0;
let health = RpcHealth::stub();
bank_forks.write().unwrap().get(0).unwrap().freeze();
let mut io = MetaIoHandler::default();
let rpc = RpcSolImpl;
io.extend_with(rpc.to_delegate());
let cluster_info = Arc::new(ClusterInfo::new_with_invalid_keypair(
ContactInfo::new_with_socketaddr(&socketaddr!("127.0.0.1:1234")),
));
let meta = JsonRpcRequestProcessor::new(
JsonRpcConfig::default(),
bank_forks.clone(),
block_commitment_cache,
blockstore,
validator_exit,
health.clone(),
cluster_info.clone(),
Hash::default(),
Arc::new(SendTransactionService::new(
&cluster_info,
&bank_forks,
&exit,
)),
);
let mut bad_transaction =
system_transaction::transfer(&Keypair::new(), &Pubkey::default(), 42, Hash::default());
// sendTransaction will fail because the blockhash is invalid
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"sendTransaction","params":["{}"]}}"#,
bs58::encode(serialize(&bad_transaction).unwrap()).into_string()
);
let res = io.handle_request_sync(&req, meta.clone());
assert_eq!(
res,
Some(
r#"{"jsonrpc":"2.0","error":{"code":-32002,"message":"Transaction simulation failed: Blockhash not found"},"id":1}"#.to_string(),
)
);
// sendTransaction will fail due to poor node health
health.stub_set_health_status(Some(RpcHealthStatus::Behind));
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"sendTransaction","params":["{}"]}}"#,
bs58::encode(serialize(&bad_transaction).unwrap()).into_string()
);
let res = io.handle_request_sync(&req, meta.clone());
assert_eq!(
res,
Some(
r#"{"jsonrpc":"2.0","error":{"code":-32002,"message":"RPC node is unhealthy, unable to simulate transaction"},"id":1}"#.to_string(),
)
);
health.stub_set_health_status(None);
// sendTransaction will fail due to invalid signature
bad_transaction.signatures[0] = Signature::default();
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"sendTransaction","params":["{}"]}}"#,
bs58::encode(serialize(&bad_transaction).unwrap()).into_string()
);
let res = io.handle_request_sync(&req, meta.clone());
assert_eq!(
res,
Some(
r#"{"jsonrpc":"2.0","error":{"code":-32002,"message":"Transaction signature verification failed"},"id":1}"#.to_string(),
)
);
// sendTransaction will now succeed because skipPreflight=true even though it's a bad
// transaction
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"sendTransaction","params":["{}", {{"skipPreflight": true}}]}}"#,
bs58::encode(serialize(&bad_transaction).unwrap()).into_string()
);
let res = io.handle_request_sync(&req, meta);
assert_eq!(
res,
Some(
r#"{"jsonrpc":"2.0","result":"1111111111111111111111111111111111111111111111111111111111111111","id":1}"#.to_string(),
)
);
} | rust_cleaned_test_functions.jsonl/14445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1879
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
13565,
28884,
43331,
4145,
368,
341,
286,
1077,
4869,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
1106,
286,
1077,
22935,
16880,
284,
1855,
64959,
16880,
2099,
13652,
317,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exp2() {
assert_eq!(32.0, 5.0f64.exp2());
assert_eq!(1.0, 0.0f64.exp2());
let inf: f64 = INFINITY;
let neg_inf: f64 = NEG_INFINITY;
let nan: f64 = NAN;
assert_eq!(inf, inf.exp2());
assert_eq!(0.0, neg_inf.exp2());
assert!(nan.exp2().is_nan());
} | rust_cleaned_test_functions.jsonl/7840 | {
"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,
14214,
17,
368,
341,
286,
2060,
10714,
10297,
18,
17,
13,
15,
11,
220,
20,
13,
15,
69,
21,
19,
13754,
17,
1423,
286,
2060,
10714,
10297,
16,
13,
15,
11,
220,
15,
13,
15,
69,
21,
19,
1375... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sum_over_multiple_logs_for_same_project() {
let today = test_date().with_day(1).unwrap();
let tl = TimeLog::new_testing_only(BTreeMap::from_iter(vec![(
today.naive_local(),
vec![create_log(1, 30, "Foo"), create_log(1, 10, "Foo")],
)]));
let rc = ReportCreator::new(&tl);
let report = rc.report_day(today);
assert_eq!(report.total_duration, Duration::minutes(40));
assert_eq!(report.projects.len(), 1);
} | rust_cleaned_test_functions.jsonl/27173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
15431,
45233,
42899,
5478,
33574,
16352,
368,
341,
286,
1077,
3351,
284,
1273,
4164,
1005,
4197,
16763,
7,
16,
568,
15454,
543,
286,
1077,
29796,
284,
4120,
2201,
486,
931,
70962,
18410,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_match() {
let mut pager = Pager::new().unwrap();
let mut s_mark = 0;
// A sample index for mocking actual search index matches
pager.search_idx = vec![2, 10, 15, 17, 50];
for i in &pager.search_idx.clone() {
next_match(&mut pager, &mut s_mark);
dbg!(pager.upper_mark);
assert_eq!(pager.upper_mark, *i as usize);
s_mark += 1;
}
} | rust_cleaned_test_functions.jsonl/110567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
10708,
368,
341,
286,
1077,
5206,
52588,
284,
87308,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
274,
18924,
284,
220,
15,
280,
286,
442,
362,
6077,
1922,
369,
66483,
5042,
2711,
1922,
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... | 2 |
#[test]
fn test_iteration_errors() {
use std::io;
let mut iter = glob("/root/*").unwrap();
// GlobErrors shouldn't halt iteration
let next = iter.next();
assert!(next.is_some());
let err = next.unwrap();
assert!(err.is_err());
let err = err.err().unwrap();
assert!(err.path() == Path::new("/root"));
assert!(err.error().kind() == io::ErrorKind::PermissionDenied);
} | rust_cleaned_test_functions.jsonl/40569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62772,
20196,
368,
341,
286,
990,
1460,
486,
815,
280,
286,
1077,
5206,
5367,
284,
13206,
4283,
2888,
1057,
1827,
15454,
1428,
286,
442,
62288,
13877,
13133,
944,
26269,
19569,
198,
286,
1077,
179... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_credential_data() {
init!("true");
let mut proof = ProofMessage::new();
proof.libindy_proof = "".to_string();
assert_eq!(proof.get_credential_info().unwrap_err().kind(), VcxErrorKind::InvalidJson);
proof.libindy_proof = "{}".to_string();
assert_eq!(proof.get_credential_info().unwrap(), Vec::new());
proof.libindy_proof = json!({"identifiers": []}).to_string();
assert_eq!(proof.get_credential_info().unwrap(), Vec::new());
proof.libindy_proof = json!({"identifiers": [{}]}).to_string();
assert_eq!(proof.get_credential_info().unwrap_err().kind(), VcxErrorKind::InvalidProofCredentialData);
proof.libindy_proof = json!({"identifiers": [{
"schema_id": null,
"cred_def_id": null,
}]}).to_string();
assert_eq!(proof.get_credential_info().unwrap_err().kind(), VcxErrorKind::InvalidProofCredentialData);
proof.libindy_proof = json!({"identifiers": [{
"schema_id": SCHEMA_ID,
"cred_def_id": CRED_DEF_ID,
}]}).to_string();
let mut cred_info = CredInfo {
schema_id: SCHEMA_ID.to_string(),
cred_def_id: CRED_DEF_ID.to_string(),
rev_reg_id: None,
timestamp: None
};
assert_eq!(&proof.get_credential_info().unwrap()[0], &cred_info);
proof.libindy_proof = json!({"identifiers": [{
"schema_id": SCHEMA_ID,
"cred_def_id": CRED_DEF_ID,
"rev_reg_id": REV_REG_ID,
"timestamp": 123
}]}).to_string();
cred_info.rev_reg_id = Some(REV_REG_ID.to_string());
cred_info.timestamp = Some(123);
assert_eq!(&proof.get_credential_info().unwrap()[0], &cred_info);
} | rust_cleaned_test_functions.jsonl/74790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 892
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
666,
30320,
1769,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
5206,
11064,
284,
36991,
2052,
486,
931,
543,
286,
11064,
14947,
48990,
86757,
284,
44907,
983,
3904,
543,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_no_such_file_error_msg() {
let dirname = "nonexistent";
let filename = "file";
let path = PathBuf::from(dirname).join(filename);
let path_str = path.to_str().unwrap();
new_ucmd!().arg(&path).fails().stderr_only(format!(
"touch: cannot touch '{}': No such file or directory",
path_str
));
} | rust_cleaned_test_functions.jsonl/41040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60840,
6536,
643,
1387,
2458,
4096,
6483,
368,
341,
262,
1077,
29908,
284,
330,
6280,
64085,
876,
262,
1077,
3899,
284,
330,
1192,
876,
262,
1077,
1815,
284,
7933,
15064,
486,
1499,
38802,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_in_subquery_2() {
assert_eq!(
cake::Entity::find()
.filter(
Condition::any().add(
cake::Column::Id.in_subquery(
Query::select()
.column(cake_filling::Column::CakeId)
.from(cake_filling::Entity)
.to_owned()
)
)
)
.build(DbBackend::MySql)
.to_string(),
[
"SELECT `cake`.`id`, `cake`.`name` FROM `cake`",
"WHERE `cake`.`id` IN (SELECT `cake_id` FROM `cake_filling`)",
]
.join(" ")
);
} | rust_cleaned_test_functions.jsonl/50439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
5228,
1631,
62,
17,
368,
341,
286,
2060,
10714,
33673,
310,
19145,
486,
3030,
486,
3903,
741,
394,
659,
5315,
1006,
503,
15180,
486,
3767,
1005,
718,
1006,
664,
19145,
486,
2933,
486,
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... | 1 |
#[test]
fn test_import_mode_switcher() {
let temp_dir = Builder::new()
.prefix("test_import_mode_switcher")
.tempdir()
.unwrap();
let db = new_test_engine(temp_dir.path().to_str().unwrap(), &["a", "b"]);
let import_db_options = ImportModeDBOptions::new();
let normal_db_options = ImportModeDBOptions::new_options(&db);
let import_cf_options = ImportModeCFOptions::new();
let normal_cf_options = ImportModeCFOptions::new_options(&db, "default");
fn mf(_cf: &str, _name: &str, _v: f64) {}
let cfg = Config::default();
let threads = futures_cpupool::Builder::new()
.name_prefix("sst-importer")
.pool_size(cfg.num_threads)
.create();
let mut switcher = ImportModeSwitcher::new(&cfg, &threads, db.clone());
check_import_options(&db, &normal_db_options, &normal_cf_options);
switcher.enter_import_mode(mf).unwrap();
check_import_options(&db, &import_db_options, &import_cf_options);
switcher.enter_import_mode(mf).unwrap();
check_import_options(&db, &import_db_options, &import_cf_options);
switcher.enter_normal_mode(mf).unwrap();
check_import_options(&db, &normal_db_options, &normal_cf_options);
switcher.enter_normal_mode(mf).unwrap();
check_import_options(&db, &normal_db_options, &normal_cf_options);
} | rust_cleaned_test_functions.jsonl/29499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 642
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18434,
7302,
27652,
261,
368,
341,
286,
1077,
2730,
4334,
284,
20626,
486,
931,
741,
310,
659,
11849,
445,
1944,
18434,
7302,
27652,
261,
1138,
310,
659,
3888,
3741,
741,
310,
659,
15454,
543,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rotate_linestring() {
let linestring = line_string![
(x: 0.0, y: 0.0),
(x: 5.0, y: 5.0),
(x: 5.0, y: 10.0)
];
// results agree with Shapely / GEOS for `centroid`
let rotated_around_centroid = linestring.rotate_around_centroid(-45.0);
assert_relative_eq!(
rotated_around_centroid,
line_string![
(x: -2.196699141100894, y: 3.838834764831844),
(x: 4.874368670764582, y: 3.838834764831844),
(x: 8.40990257669732, y: 7.374368670764582)
]
);
// results agree with Shapely / GEOS for `center`
let rotated_around_center = linestring.rotate_around_center(-45.0);
assert_relative_eq!(
rotated_around_center,
line_string![
(x: -2.803300858899106, y: 3.232233047033631),
(x: 4.267766952966369, y: 3.232233047033632),
(x: 7.803300858899107, y: 6.767766952966369)
],
epsilon = 1e-12
);
} | rust_cleaned_test_functions.jsonl/80253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 642
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
24606,
65040,
368,
341,
286,
1077,
9805,
65040,
284,
1555,
3904,
90515,
310,
320,
87,
25,
220,
15,
13,
15,
11,
379,
25,
220,
15,
13,
15,
1326,
310,
320,
87,
25,
220,
20,
13,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_detect_static_or_dynamic_property() {
use css_parser::{StyleTextAlignmentHorz, InvalidValueErr};
assert_eq!(
determine_static_or_dynamic_css_property("text-align", " center "),
Ok(CssDeclaration::Static(ParsedCssProperty::TextAlign(StyleTextAlignmentHorz::Center)))
);
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[ 400px ]]"),
Err(DynamicCssParseError::NoDefaultCase)
);
assert_eq!(determine_static_or_dynamic_css_property("text-align", "[[ 400px"),
Err(DynamicCssParseError::UnclosedBraces)
);
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[ 400px | center ]]"),
Err(DynamicCssParseError::InvalidId)
);
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[ hello | center ]]"),
Ok(CssDeclaration::Dynamic(DynamicCssProperty {
default: DynamicCssPropertyDefault::Exact(ParsedCssProperty::TextAlign(StyleTextAlignmentHorz::Center)),
dynamic_id: String::from("hello"),
}))
);
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[ hello | auto ]]"),
Ok(CssDeclaration::Dynamic(DynamicCssProperty {
default: DynamicCssPropertyDefault::Auto,
dynamic_id: String::from("hello"),
}))
);
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[ abc | hello ]]"),
Err(DynamicCssParseError::UnexpectedValue(
CssParsingError::InvalidValueErr(InvalidValueErr("hello"))
))
);
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[ ]]"),
Err(DynamicCssParseError::EmptyBraces)
);
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[]]"),
Err(DynamicCssParseError::EmptyBraces)
);
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[ center ]]"),
Err(DynamicCssParseError::NoId)
);
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[ hello | ]]"),
Err(DynamicCssParseError::NoDefaultCase)
);
// debatable if this is a suitable error for this case:
assert_eq!(
determine_static_or_dynamic_css_property("text-align", "[[ | ]]"),
Err(DynamicCssParseError::EmptyBraces)
);
} | rust_cleaned_test_functions.jsonl/22821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56457,
25360,
8734,
45992,
16638,
368,
972,
262,
990,
15877,
18517,
22964,
2323,
1178,
7033,
39601,
89,
11,
13882,
1130,
7747,
15414,
262,
2060,
10714,
0,
7805,
286,
8253,
25360,
8734,
45992,
25924,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new() {
let mut val = Struct::new("Foo");
val.add_field("bar", &FixedSize::bool()).unwrap();
val.add_field("bar2", &FixedSize::bool()).unwrap();
let params = vec![
identifier_expression! { (1) },
identifier_expression! { (2) },
];
assert_eq!(
structs::new(&val, params).to_string(),
"struct_Foo_new(1, 2)"
)
} | rust_cleaned_test_functions.jsonl/1246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
5206,
1044,
284,
16139,
486,
931,
445,
40923,
797,
286,
1044,
1364,
5013,
445,
2257,
497,
609,
73174,
486,
2641,
6011,
15454,
543,
286,
1044,
1364,
5013,
445,
2257,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cover_scene_to_json() {
let config = Config {
width: 800,
height: 600,
samples_per_pixel: 64,
max_depth: 50,
sky: Some(Sky::new_default_sky()),
camera: Camera::new(
Point3D::new(13.0, 2.0, 3.0),
Point3D::new(0.0, 0.0, 0.0),
Point3D::new(0.0, 1.0, 0.0),
20.0,
(800.0 / 600.0) as f64,
),
objects: _make_cover_world(),
};
let serialized = serde_json::to_string_pretty(&config).unwrap();
fs::write("/tmp/cover_scene.json", serialized).unwrap();
} | rust_cleaned_test_functions.jsonl/118686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38087,
37296,
2346,
9455,
368,
341,
262,
1077,
2193,
284,
5532,
341,
286,
2374,
25,
220,
23,
15,
15,
345,
286,
2608,
25,
220,
21,
15,
15,
345,
286,
10469,
5678,
29760,
25,
220,
21,
19,
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_multiple() {
expect_mapping!("12 bark \"earth\"" => Token::integer(12),
Token::word("bark"),
Token::string("earth"),
Token::new_line());
expect_mapping!("a 23 gg \"a\"" => Token::word("a"),
Token::integer(23),
Token::word("gg"),
Token::string("a"),
Token::new_line());
expect_mapping!("4:3{2\n}" => Token::integer(4),
Token::symbol(":"),
Token::integer(3),
Token::symbol("{"),
Token::integer(2),
Token::new_line(),
Token::symbol("}"),
Token::new_line());
} | rust_cleaned_test_functions.jsonl/39350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 799
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
368,
341,
286,
1720,
26930,
17223,
16,
17,
53742,
7245,
27541,
57139,
589,
9660,
486,
11662,
7,
16,
17,
1326,
17264,
9660,
486,
1158,
445,
65,
838,
4461,
17264,
9660,
486,
917,
445,
27541... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_floating() {
let e32 = 2.345f32;
let e64 = 2.345f64;
let tokens = quote! {
#e32
#e64
};
let expected = concat!("2.345f32 2.345f64");
assert_eq!(expected, tokens.to_string());
} | rust_cleaned_test_functions.jsonl/3596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
28493,
368,
341,
262,
1077,
384,
18,
17,
284,
220,
17,
13,
18,
19,
20,
69,
18,
17,
401,
262,
1077,
384,
21,
19,
284,
220,
17,
13,
18,
19,
20,
69,
21,
19,
401,
262,
1077,
11211,
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_snapshot1_close_preopen_fd() {
assert_wasi_output!(
"../../wasitests/snapshot1/close_preopen_fd.wasm",
"snapshot1_close_preopen_fd",
vec![],
vec![(
"hamlet".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/hamlet")
),],
vec![],
"../../wasitests/close_preopen_fd.out"
);
} | rust_cleaned_test_functions.jsonl/40326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53265,
16,
12704,
10442,
2508,
17676,
368,
341,
262,
2060,
1670,
10215,
7645,
33673,
286,
10208,
16123,
275,
17966,
2687,
9601,
16,
94308,
10442,
2508,
17676,
1418,
10530,
756,
286,
330,
35501,
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_atoibm_conv_spec_test() {
new_ucmd!()
.args(&["conv=ibm"])
.pipe_in_fixture("seq-byte-values-b632a992d3aed5d8d1a59cc5a5a455ba.test")
.succeeds()
.stdout_is_fixture_bytes("gnudd-conv-atoibm-seq-byte-values.spec");
} | rust_cleaned_test_functions.jsonl/99849 | {
"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,
3752,
78,
579,
76,
22716,
13594,
4452,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12027,
28,
579,
76,
14108,
286,
659,
13768,
1243,
74409,
445,
13262,
53952,
69050,
145... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display_get_visible_width_without_icons() {
for (s, l) in &[
("Hello,world!", 22),
("ASCII1234-_", 11),
("制作样本。", 10),
("日本語", 6),
("샘플은 무료로 드리겠습니다", 26),
("👩🐩", 4),
("🔬", 2),
] {
let path = Path::new(s);
let name = Name::new(
&path,
FileType::File {
exec: false,
uid: false,
},
);
let output = name.render(
&Colors::new(color::Theme::NoColor),
&Icons::new(icon::Theme::NoIcon),
);
assert_eq!(get_visible_width(&output), *l);
}
} | rust_cleaned_test_functions.jsonl/54833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 549
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
3062,
34371,
7927,
39904,
59819,
368,
341,
286,
369,
320,
82,
11,
326,
8,
304,
609,
9640,
310,
3489,
142172,
144115,
144433,
144433,
144116,
11,
135116,
144116,
144282,
144433,
144514,
18789,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_format_document_2018() {
if skip_slow_tests() {
return;
}
let server = project(
r#"
//- /Cargo.toml
[package]
name = "foo"
version = "0.0.0"
edition = "2018"
//- /src/lib.rs
mod bar;
async fn test() {
}
fn main() {
}
pub use std::collections::HashMap;
"#,
)
.wait_until_workspace_is_loaded();
server.request::<Formatting>(
DocumentFormattingParams {
text_document: server.doc_id("src/lib.rs"),
options: FormattingOptions {
tab_size: 4,
insert_spaces: false,
properties: HashMap::new(),
insert_final_newline: None,
trim_final_newlines: None,
trim_trailing_whitespace: None,
},
work_done_progress_params: WorkDoneProgressParams::default(),
},
json!([
{
"newText": r#"mod bar;
async fn test() {}
fn main() {}
pub use std::collections::HashMap;
"#,
"range": {
"end": { "character": 0, "line": 9 },
"start": { "character": 0, "line": 0 }
}
}
]),
);
} | rust_cleaned_test_functions.jsonl/27495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 654
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
26231,
62,
17,
15,
16,
23,
368,
341,
262,
421,
10706,
82447,
32509,
368,
341,
286,
470,
280,
262,
555,
262,
1077,
3538,
284,
2390,
1006,
286,
435,
2,
698,
61463,
608,
98228,
73494,
75,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_calc_ng() {
assert!(calc("".to_string(), false).is_err());
assert!(calc("( )".to_string(), false).is_err());
assert!(calc("2 3".to_string(), false).is_err());
assert!(calc("2 + + 3".to_string(), false).is_err());
assert!(calc("( 1 + 2 ) ( 3 + 4 )".to_string(), false).is_err());
assert!(calc("1 + ) 3 + 4 ( + 5".to_string(), false).is_err());
assert!(calc("( 1 + 2 ) )".to_string(), false).is_err());
assert!(calc("( + ) * 3".to_string(), false).is_err());
assert!(calc("1 + a".to_string(), false).is_err());
assert!(calc("5 と +7 を足して".to_string(), false).is_err());
assert!(calc("10/0".to_string(), false).is_err());
assert!(calc("10%0".to_string(), false).is_err());
} | rust_cleaned_test_functions.jsonl/2815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38241,
82102,
368,
341,
286,
2060,
10297,
26586,
445,
3263,
983,
3904,
1507,
895,
568,
285,
9266,
1423,
286,
2060,
10297,
26586,
31732,
873,
3263,
983,
3904,
1507,
895,
568,
285,
9266,
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_buffer_referenced() {
let drop_called = Arc::new(AtomicBool::new(false));
let buf = {
let input = vec![b' ', b'2', b'3'];
let gil = Python::acquire_gil();
let py = gil.python();
let instance: PyObject = TestBufferClass {
vec: input.clone(),
drop_called: drop_called.clone(),
}
.into_py(py);
let buf = PyBuffer::<u8>::get(instance.as_ref(py)).unwrap();
assert_eq!(buf.to_vec(py).unwrap(), input);
drop(instance);
buf
};
assert!(!drop_called.load(Ordering::Relaxed));
{
let _py = Python::acquire_gil().python();
drop(buf);
}
assert!(drop_called.load(Ordering::Relaxed));
} | rust_cleaned_test_functions.jsonl/522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
73386,
5767,
368,
341,
262,
1077,
5943,
27859,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
3237,
262,
1077,
6607,
284,
341,
286,
1077,
1946,
284,
7486,
20703,
65,
6,
6614,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq_ignore_ascii_case() {
assert!("url()URL()uRl()Ürl".eq_ignore_ascii_case("url()url()url()Ürl"));
assert!(!"Ürl".eq_ignore_ascii_case("ürl"));
// D assert!("HİKß".eq_ignore_ascii_case("hİKß"));
assert!(!"İ".eq_ignore_ascii_case("i"));
assert!(!"K".eq_ignore_ascii_case("k"));
assert!(!"ß".eq_ignore_ascii_case("s"));
let mut i = 0;
while i <= 500 {
let c = i;
let lower = if 'A' as u32 <= c && c <= 'Z' as u32 { c + 'a' as u32 - 'A' as u32 }
else { c };
assert!((from_u32(i).unwrap()).to_string().as_slice().eq_ignore_ascii_case(
(from_u32(lower).unwrap()).to_string().as_slice()));
i += 1;
}
} | rust_cleaned_test_functions.jsonl/4341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
58493,
50238,
19096,
368,
341,
286,
2060,
17223,
1085,
368,
3144,
368,
84,
49,
75,
368,
52491,
2381,
3263,
11006,
58493,
50238,
19096,
445,
1085,
368,
1085,
368,
1085,
368,
52491,
2381,
401... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_matbuild1()
{
use float_eq::assert_float_eq;
use crate::linalg::FloatGeneric;
type L= FloatGeneric<f64>;
let ref_array = &[
1.,
2.*1.4, 3.,
4.*1.4, 5.*1.4, 6.,
7.*1.4, 8.*1.4, 9.*1.4, 10.,
11.*1.4, 12.*1.4, 13.*1.4, 14.*1.4, 15.,
];
let array = &[
1., 0., 0., 0., 0.,
2., 3., 0., 0., 0.,
4., 5., 6., 0., 0.,
7., 8., 9., 10., 0.,
11., 12., 13., 14., 15.,
];
let m = MatBuild::<L, _>::new(MatType::SymPack(5))
.iter_colmaj(array)
.scale_nondiag(1.4);
assert_float_eq!(m.as_ref(), ref_array.as_ref(), abs_all <= 1e-3);
} | rust_cleaned_test_functions.jsonl/79870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16610,
5834,
16,
3568,
1666,
262,
990,
2224,
10714,
486,
2207,
17586,
10714,
463,
262,
990,
17717,
486,
75,
33231,
486,
5442,
19964,
1926,
262,
943,
444,
28,
13001,
19964,
63895,
21,
19,
29,
192... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pubkey_sign() {
let msg = vec![1,23,42];
let rng = botan::RandomNumberGenerator::new_system().unwrap();
let ecdsa_key = botan::Privkey::create("ECDSA", "secp256r1", &rng).unwrap();
assert!(ecdsa_key.key_agreement_key().is_err());
let signer = botan::Signer::new(&ecdsa_key, "EMSA1(SHA-256)").unwrap();
signer.update(&msg).unwrap();
let signature = signer.finish(&rng).unwrap();
let pub_key = ecdsa_key.pubkey().unwrap();
let verifier = botan::Verifier::new(&pub_key, "EMSA1(SHA-256)").unwrap();
verifier.update(&[1]).unwrap();
verifier.update(&[23, 42]).unwrap();
assert_eq!(verifier.finish(&signature).unwrap(), true);
verifier.update(&[1]).unwrap();
assert_eq!(verifier.finish(&signature).unwrap(), false);
verifier.update(&[1]).unwrap();
verifier.update(&[23, 42]).unwrap();
assert_eq!(verifier.finish(&signature).unwrap(), true);
} | rust_cleaned_test_functions.jsonl/95306 | {
"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,
34014,
792,
11172,
368,
341,
262,
1077,
3750,
284,
7486,
20703,
16,
11,
17,
18,
11,
19,
17,
4821,
262,
1077,
28422,
284,
10924,
276,
486,
13999,
2833,
12561,
486,
931,
17687,
1005,
15454,
1428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_frozen_account_data_modified() {
let frozen_pubkey =
Pubkey::from_str("My11111111111111111111111111111111111111111").unwrap();
let mut db = AccountsDb::new(Vec::new(), &ClusterType::Development);
let mut account = AccountSharedData::new(1, 42, &frozen_pubkey);
db.store_uncached(0, &[(&frozen_pubkey, &account)]);
let ancestors = vec![(0, 0)].into_iter().collect();
db.freeze_accounts(&ancestors, &[frozen_pubkey]);
account.data_as_mut_slice()[0] = 42;
db.store_uncached(0, &[(&frozen_pubkey, &account)]);
} | rust_cleaned_test_functions.jsonl/1373 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
42240,
13500,
1769,
37749,
368,
341,
286,
1077,
19690,
34014,
792,
4035,
310,
22611,
792,
486,
1499,
2895,
445,
5050,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_versioned_message() {
let tx = test_tx();
let mut packet = Packet::from_data(None, tx).unwrap();
let mut legacy_offsets = sigverify::do_get_packet_offsets(&packet, 0).unwrap();
// set message version to 0
let msg_start = legacy_offsets.msg_start as usize;
let msg_bytes = packet.data(msg_start..).unwrap().to_vec();
packet.buffer_mut()[msg_start] = MESSAGE_VERSION_PREFIX;
packet.meta.size += 1;
let msg_end = packet.meta.size;
packet.buffer_mut()[msg_start + 1..msg_end].copy_from_slice(&msg_bytes);
let offsets = sigverify::do_get_packet_offsets(&packet, 0).unwrap();
let expected_offsets = {
legacy_offsets.pubkey_start += 1;
legacy_offsets
};
assert_eq!(expected_offsets, offsets);
} | rust_cleaned_test_functions.jsonl/39075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
291,
6462,
368,
341,
286,
1077,
9854,
284,
1273,
17805,
543,
286,
1077,
5206,
10151,
284,
28889,
486,
1499,
1769,
26717,
11,
9854,
568,
15454,
1428,
286,
1077,
5206,
19588,
56924,
284,
8366,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shrink_all_slots_none() {
let accounts = AccountsDb::new_single();
for _ in 0..10 {
accounts.shrink_candidate_slots();
}
accounts.shrink_all_slots();
} | rust_cleaned_test_functions.jsonl/37795 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
34365,
5705,
54161,
31488,
368,
341,
286,
1077,
9618,
284,
40655,
7994,
486,
931,
19487,
1428,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
9618,
2395,
34365,
62360,
54161,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_compress_portable() {
test_compress_fn(
crate::ffi::blake3_compress_in_place_portable,
crate::ffi::blake3_compress_xof_portable,
);
} | rust_cleaned_test_functions.jsonl/79360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87845,
8716,
480,
368,
341,
262,
1273,
87845,
15246,
1006,
286,
17717,
486,
53799,
486,
2024,
726,
18,
87845,
1243,
34548,
8716,
480,
345,
286,
17717,
486,
53799,
486,
2024,
726,
18,
87845,
3212,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_extract_data_from_content() {
let tp = TokenParser::new("1 2 3\n4 5 6");
assert!(matches!(tp.token::<u8>(1, 1), Ok(5)));
} | rust_cleaned_test_functions.jsonl/96293 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
1769,
5673,
7495,
368,
341,
286,
1077,
18101,
284,
9660,
6570,
486,
931,
445,
16,
220,
17,
220,
18,
1699,
19,
220,
20,
220,
21,
3071,
286,
2060,
10297,
19914,
10297,
790,
14416,
27638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_output_tor_config() -> Result<(), Error> {
let test_dir = "./target/test_output/tor";
setup(test_dir);
let secp_inst = static_secp_instance();
let secp = secp_inst.lock();
let mut test_rng = StepRng::new(1234567890u64, 1);
let sec_key = secp::key::SecretKey::new(&secp, &mut test_rng);
output_tor_listener_config(test_dir, "127.0.0.1:3415", &vec![sec_key])?;
clean_output_dir(test_dir);
Ok(())
} | rust_cleaned_test_functions.jsonl/27557 | {
"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,
7645,
528,
269,
5332,
368,
1464,
5714,
68843,
4600,
29,
341,
197,
10217,
1273,
4334,
284,
5924,
5657,
12697,
7645,
5523,
269,
876,
197,
84571,
8623,
4334,
317,
197,
10217,
511,
4672,
17740,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_calc_workchain_id_by_adnl_id() {
assert_eq!(calc_workchain_id_by_adnl_id(&[0; 32]), -1);
assert_eq!(calc_workchain_id_by_adnl_id(&[1; 32]), 0);
assert_eq!(calc_workchain_id_by_adnl_id(&[2; 32]), 1);
assert_eq!(calc_workchain_id_by_adnl_id(&[3; 32]), 2);
} | rust_cleaned_test_functions.jsonl/90615 | {
"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,
38241,
11498,
8819,
842,
3710,
10027,
15643,
842,
368,
341,
262,
2060,
10714,
10297,
26586,
11498,
8819,
842,
3710,
10027,
15643,
842,
2099,
58,
15,
26,
220,
18,
17,
9719,
481,
16,
317,
262,
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,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_in_tree() {
let tests = [(0u32, 2u32), (1, 2), (2, 2), (5, 5), (8, 5)];
for test in tests.iter() {
node_in_tree(test.0.into(), test.1.into()).unwrap();
}
} | rust_cleaned_test_functions.jsonl/98696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
1243,
11663,
368,
341,
262,
1077,
7032,
284,
17826,
15,
84,
18,
17,
11,
220,
17,
84,
18,
17,
701,
320,
16,
11,
220,
17,
701,
320,
17,
11,
220,
17,
701,
320,
20,
11,
220,
20,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_extern_opaque() {
let mut e = ffi2::c_return_opaque_ptr();
check!(ffi2::c_take_opaque_ref(e.as_ref().unwrap()));
check!(e.c_take_opaque_ref_method());
check!(e.pin_mut().c_take_opaque_mut_ref_method());
check!(ffi2::c_take_opaque_ptr(e));
let f = ffi2::c_return_ns_opaque_ptr();
check!(ffi2::c_take_opaque_ns_ref(f.as_ref().unwrap()));
check!(ffi2::c_take_opaque_ns_ptr(f));
} | rust_cleaned_test_functions.jsonl/50907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4301,
10287,
19659,
368,
341,
262,
1077,
5206,
384,
284,
76956,
17,
486,
66,
12511,
10287,
19659,
4348,
543,
262,
1779,
10297,
53799,
17,
486,
66,
73261,
10287,
19659,
7793,
2026,
5357,
7793,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conditional_expression() {
expect_printed("true ? 1 : 2", "true ? 1 : 2;\n");
expect_printed("3 > 2 ? 3 + 2 : 3 * 2", "3 > 2 ? 3 + 2 : 3 * 2;\n");
expect_printed("(a > b ? a : b)[k] = c", "(a > b ? a : b)[k] = c;\n");
} | rust_cleaned_test_functions.jsonl/93423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24433,
3005,
28068,
368,
341,
262,
1720,
10064,
291,
445,
1866,
937,
220,
16,
549,
220,
17,
497,
330,
1866,
937,
220,
16,
549,
220,
17,
17882,
77,
797,
262,
1720,
10064,
291,
445,
18,
861,
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_passport_is_valid() {
let passports = &[
(
"ecl:gry pid:860033327 eyr:2020 hcl:#fffffd\nbyr:1937 iyr:2017 cid:147 hgt:183cm",
true,
),
(
"iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884\nhcl:#cfa07d byr:1929",
false,
),
(
"hcl:#ae17e1 iyr:2013\neyr:2024\necl:brn pid:760753108 byr:1931\nhgt:179cm",
true,
),
(
"hcl:#cfa07d eyr:2025 pid:166559648\niyr:2011 ecl:brn hgt:59in",
false,
),
];
for &(p, is_valid) in passports {
assert_eq!(Passport::from_str(p).unwrap().is_valid(), is_valid);
}
} | rust_cleaned_test_functions.jsonl/111541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 512
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
403,
6892,
8337,
368,
341,
286,
1077,
74426,
284,
609,
9640,
310,
2399,
394,
330,
68,
564,
70418,
884,
14814,
25,
23,
21,
15,
15,
18,
18,
18,
17,
22,
3912,
81,
25,
17,
15,
17,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_vector_2() {
// The quick brown fox jumps over the lazy dog
let x = [0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63,
0x6b, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x6e, 0x20,
0x66, 0x6f, 0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70,
0x73, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x74,
0x68, 0x65, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20,
0x64, 0x6f, 0x67];
let h_expected = [0xd7, 0xa8, 0xfb, 0xb3, 0x07, 0xd7, 0x80, 0x94,
0x69, 0xca, 0x9a, 0xbc, 0xb0, 0x08, 0x2e, 0x4f,
0x8d, 0x56, 0x51, 0xe4, 0x6d, 0x3c, 0xdb, 0x76,
0x2d, 0x02, 0xd0, 0xbf, 0x37, 0xc9, 0xe5, 0x92];
let Digest(h) = hash(&x);
assert!(h == h_expected);
} | rust_cleaned_test_functions.jsonl/55637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
62,
17,
368,
341,
262,
442,
576,
3974,
13876,
38835,
34208,
916,
279,
15678,
5562,
198,
262,
1077,
856,
284,
508,
15,
87,
20,
19,
11,
220,
15,
87,
21,
23,
11,
220,
15,
87,
21,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_patch_netif() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
sender
.write_all(
b"PATCH /network-interfaces/string HTTP/1.1\r\n\
Content-Type: application/json\r\n\
Content-Length: 24\r\n\r\n{ \
\"iface_id\": \"string\" \
}",
)
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
} | rust_cleaned_test_functions.jsonl/43157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
39643,
19722,
333,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul_scalar_checked() {
let a = Primitive::from(&vec![None, Some(6), None, Some(6)]).to(DataType::Int32);
let result = checked_mul_scalar(&a, &1i32);
let expected = Primitive::from(&vec![None, Some(6), None, Some(6)]).to(DataType::Int32);
assert_eq!(result, expected);
let a = Primitive::from(&vec![None, Some(100), None, Some(100)]).to(DataType::Int8);
let result = checked_mul_scalar(&a, &100i8);
let expected = Primitive::<i8>::from(&vec![None, None, None, None]).to(DataType::Int8);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/12707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
41652,
56456,
368,
341,
286,
1077,
264,
284,
51460,
486,
1499,
2099,
4083,
20703,
4064,
11,
4329,
7,
21,
701,
2240,
11,
4329,
7,
21,
7252,
568,
983,
63941,
486,
1072,
18,
17,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_json() {
let old_json = r#"[{"a":1},{"a":2}]"#;
let to_be_added_json = r#"{"a":3}"#;
let final_json = r#"[{"a":1},{"a":2},{"a":3}]"#;
assert_eq!(update_json(old_json, to_be_added_json), final_json);
} | rust_cleaned_test_functions.jsonl/17531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
9455,
368,
341,
286,
1077,
2310,
9455,
284,
435,
2,
36864,
4913,
64,
788,
16,
36828,
64,
788,
17,
92,
19177,
2,
280,
286,
1077,
311,
21263,
37653,
9455,
284,
435,
55543,
4913,
64,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dotnet_framework_48_without_build_id() {
let mut runtime = RuntimeContext {
raw_description: ".NET Framework 4.8.4250.0".to_string().into(),
..RuntimeContext::default()
};
normalize_runtime_context(&mut runtime);
assert_eq_dbg!(Some(".NET Framework"), runtime.name.as_str());
assert_eq_dbg!(Some("4.8.4250.0"), runtime.version.as_str());
} | rust_cleaned_test_functions.jsonl/68947 | {
"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,
30941,
4711,
27565,
62,
19,
23,
39904,
20801,
842,
368,
341,
262,
1077,
5206,
15592,
284,
10954,
1972,
341,
286,
7112,
11448,
25,
5933,
15373,
23752,
220,
19,
13,
23,
13,
19,
17,
20,
15,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sig_checking() {
// Generate a keypair.
store_new_keypair_cleartext(
&"test_keys/andrew_pub.json".to_string(),
&"test_keys/andrew_priv.json".to_string(),
);
let test_claim1 = vec![AstAssertion::AstFactAssertion {
f: AstFact::AstFlatFactFact {
f: AstFlatFact::AstPredFact {
p: AstPredicate {
name: "isInLondon".to_string(),
args: vec!["Highbury".to_string()],
},
},
},
}];
sign_claim(
&"test_keys/andrew_priv.json".to_string(),
&"test_outputs/claim1.sig".to_string(),
&test_claim1,
);
// The signature check should pass.
assert!(verify_claim(
&"test_keys/andrew_pub.json".to_string(),
&"test_outputs/claim1.sig".to_string(),
&test_claim1
)
.is_ok());
let test_claim2 = vec![AstAssertion::AstFactAssertion {
f: AstFact::AstFlatFactFact {
f: AstFlatFact::AstPredFact {
p: AstPredicate {
name: "isInLondon".to_string(),
args: vec!["Neptune".to_string()],
},
},
},
}];
// The signature check should fail.
assert!(!verify_claim(
&"test_keys/andrew_pub.json".to_string(),
&"test_outputs/claim1.sig".to_string(),
&test_claim2
)
.is_ok());
} | rust_cleaned_test_functions.jsonl/57523 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 955
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29252,
7200,
287,
368,
341,
286,
442,
19813,
264,
1376,
12670,
624,
286,
3553,
5921,
3097,
12670,
666,
273,
471,
427,
1006,
310,
609,
1,
1944,
12631,
14,
437,
4266,
34014,
4323,
3263,
983,
3904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seal_chunk_plaintext_empty_ok() {
let key = SecretKey::default();
let (mut sealer, _) = StreamSealer::new(&key).unwrap();
let plaintext = "".as_bytes();
assert!(sealer.seal_chunk(plaintext, &StreamTag::Message).is_ok());
} | rust_cleaned_test_functions.jsonl/104192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3453,
278,
30539,
6317,
1641,
427,
15124,
19817,
368,
341,
310,
1077,
1376,
284,
8599,
1592,
486,
2258,
543,
310,
1077,
320,
6984,
511,
13111,
11,
27439,
284,
9203,
1514,
13111,
486,
931,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inspect_log_macro_does_not_move_value() {
let (_inspector, mut node) = inspector_and_list_node();
let s = String::from("s");
inspect_log!(node, s: s);
// Should not cause compiler error since value is not moved
println!("{}", s);
} | rust_cleaned_test_functions.jsonl/90894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34386,
987,
5224,
58810,
96374,
7913,
17134,
3142,
368,
341,
1789,
286,
1077,
5453,
1330,
18997,
11,
5206,
2436,
8,
284,
44725,
8378,
2019,
5084,
543,
286,
1077,
274,
284,
923,
486,
1499,
445,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_regressions() {
use semver::ReqParseError;
use semver::VersionReq;
let versions = vec![
(".*", VersionReq::any()),
("0.1.0.", VersionReq::parse("0.1.0").unwrap()),
("0.3.1.3", VersionReq::parse("0.3.13").unwrap()),
("0.2*", VersionReq::parse("0.2.*").unwrap()),
];
for (version, requirement) in versions.into_iter() {
let parsed = VersionReq::parse(version);
let error = parsed.err().unwrap();
assert_eq!(
ReqParseError::DeprecatedVersionRequirement(requirement),
error
);
}
} | rust_cleaned_test_functions.jsonl/4683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
2483,
908,
368,
341,
262,
990,
5234,
423,
486,
27234,
14463,
1454,
280,
262,
990,
5234,
423,
486,
5637,
27234,
401,
262,
1077,
10795,
284,
7486,
90515,
286,
320,
3263,
78729,
6079,
27234,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sorted_storages_2() {
let vec = vec![];
let vec_check = vec.clone();
let slots = [4, 7];
let vecs = [vec.clone(), vec];
let result = SortedStorages::new_with_slots(vecs.iter().zip(slots.iter()), None, None);
assert_eq!(
result.range,
Range {
start: slots[0],
end: slots[1] + 1,
}
);
assert_eq!(result.slot_count, 2);
assert_eq!(result.storages.len() as Slot, slots[1] - slots[0] + 1);
assert!(result.get(0).is_none());
assert!(result.get(3).is_none());
assert!(result.get(5).is_none());
assert!(result.get(6).is_none());
assert!(result.get(8).is_none());
assert_eq!(result.get(slots[0]).unwrap().len(), vec_check.len());
assert_eq!(result.get(slots[1]).unwrap().len(), vec_check.len());
} | rust_cleaned_test_functions.jsonl/23715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41277,
1261,
269,
1134,
62,
17,
368,
341,
286,
1077,
7486,
284,
7486,
0,
15078,
286,
1077,
7486,
7200,
284,
7486,
15997,
543,
286,
1077,
15711,
284,
508,
19,
11,
220,
22,
935,
286,
1077,
7486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_presentation_build_works() {
let presentation: Presentation = Presentation::default()
.set_comment(_comment())
.ask_for_ack()
.set_thread_id(&thread_id())
.set_presentations_attach(_attachment().to_string()).unwrap();
assert_eq!(_presentation(), presentation);
} | rust_cleaned_test_functions.jsonl/103192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
13584,
20801,
11498,
82,
368,
341,
286,
1077,
15496,
25,
50868,
284,
50868,
486,
2258,
741,
310,
659,
746,
17638,
2490,
6182,
2398,
310,
659,
1073,
5478,
48447,
741,
310,
659,
746,
10814,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_additional_condition_left_join() {
let expected_sql =
"SELECT `users`.* FROM `users` LEFT OUTER JOIN `posts` ON (`users`.`id` = `posts`.`user_id` AND `posts`.`published` = ?)";
let query = Select::from_table("users").left_outer_join(
"posts".on(("users", "id")
.equals(Column::from(("posts", "user_id")))
.and(("posts", "published").equals(true))),
);
let (sql, params) = Sqlite::build(query);
assert_eq!(expected_sql, sql);
assert_eq!(
default_params(vec![ParameterizedValue::Boolean(true),]),
params
);
} | rust_cleaned_test_functions.jsonl/80616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81742,
27656,
9579,
31017,
368,
341,
286,
1077,
3601,
18063,
4035,
310,
330,
4858,
1565,
4218,
63,
4908,
4295,
1565,
4218,
63,
21920,
89675,
13069,
1565,
12664,
63,
6197,
28654,
4218,
28905,
307,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_packetizer_abs_send_time() -> Result<()> {
let g722 = Box::new(g7xx::G722Payloader {});
let sequencer = Box::new(new_fixed_sequencer(1234));
let mut pktizer = PacketizerImpl {
mtu: 100,
payload_type: 98,
ssrc: 0x1234ABCD,
payloader: g722,
sequencer,
timestamp: 45678,
clock_rate: 90000,
abs_send_time: 0,
time_gen: Some(fixed_time_gen),
};
pktizer.enable_abs_send_time(1);
let payload = Bytes::from_static(&[0x11, 0x12, 0x13, 0x14]);
let packets = pktizer.packetize(&payload, 2000)?;
let expected = Packet {
header: Header {
version: 2,
padding: false,
extension: true,
marker: true,
payload_type: 98,
sequence_number: 1234,
timestamp: 45678,
ssrc: 0x1234ABCD,
csrc: vec![],
extension_profile: 0xBEDE,
extensions: vec![Extension {
id: 1,
payload: Bytes::from_static(&[0x40, 0, 0]),
}],
},
payload: Bytes::from_static(&[0x11, 0x12, 0x13, 0x14]),
};
if packets.len() != 1 {
assert!(false, "Generated {} packets instead of 1", packets.len())
}
assert_eq!(expected, packets[0]);
Ok(())
} | rust_cleaned_test_functions.jsonl/118823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 712
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21078,
3135,
31170,
13565,
3009,
368,
1464,
5714,
71698,
341,
262,
1077,
342,
22,
17,
17,
284,
8261,
486,
931,
3268,
22,
4146,
486,
38,
22,
17,
17,
20595,
8355,
35311,
262,
1077,
11256,
19529,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_4bit() {
let mut low = 3;
let mut high = 15;
let byte = IntBuffer::u4_to_u8(low, high);
let res = IntBuffer::u8_to_u4(byte);
low = res.0;
high = res.1;
println!("{0}", byte);
println!("{0} {1}", low, high);
} | rust_cleaned_test_functions.jsonl/95496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
19,
4489,
368,
341,
286,
1077,
5206,
3347,
284,
220,
18,
280,
286,
1077,
5206,
1550,
284,
220,
16,
20,
280,
286,
1077,
4922,
284,
1333,
4095,
486,
84,
19,
2346,
7300,
23,
57798,
11,
1550... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
// Binary semaphore should be exclusive:
let semaphore = Semaphore::new(1);
let mut a1 = TestFuture::new(&semaphore, 1);
let g1 = a1.poll().unwrap().unwrap();
let mut a2 = TestFuture::new(&semaphore, 1);
assert_eq!(a1.count(), 0);
assert_eq!(a2.count(), 0);
assert!(a2.poll().is_none());
mem::drop(g1);
assert_eq!(a1.count(), 0);
assert_eq!(a2.count(), 1);
assert!(a2.poll().is_some());
} | rust_cleaned_test_functions.jsonl/84374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
262,
442,
17718,
55918,
1265,
387,
13761,
510,
262,
1077,
55918,
284,
87920,
486,
931,
7,
16,
317,
262,
1077,
5206,
264,
16,
284,
3393,
24206,
486,
931,
2099,
6998,
25545,
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_remove_shred_data_complete_flag() {
let (mut shreds, entries) = make_slot_entries(0, 0, 1);
let ledger_path = get_tmp_ledger_path!();
let ledger = Blockstore::open(&ledger_path).unwrap();
// Remove the data complete flag from the last shred
shreds[0].unset_data_complete();
ledger.insert_shreds(shreds, None, false).unwrap();
// `last_in_slot` flag is set.
let stored_shred = &ledger.get_data_shreds_for_slot(0, 0).unwrap()[0];
assert!(!stored_shred.data_complete());
assert!(stored_shred.last_in_slot());
assert_eq!(entries, ledger.get_any_valid_slot_entries(0, 0));
} | rust_cleaned_test_functions.jsonl/7635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
3712,
1151,
1769,
27675,
10933,
368,
341,
286,
1077,
320,
6984,
557,
53369,
11,
10695,
8,
284,
1281,
27563,
26092,
7,
15,
11,
220,
15,
11,
220,
16,
626,
286,
1077,
46933,
2638,
284,
633... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_onix3_oapen_fundings() {
let mut test_funding = WorkFundings {
program: Some("Name of program".to_string()),
project_name: Some("Name of project".to_string()),
project_shortname: None,
grant_number: Some("Number of grant".to_string()),
jurisdiction: None,
funder: thoth_client::WorkFundingsFunder {
funder_name: "Name of funder".to_string(),
funder_doi: None,
},
};
// Test standard output
let output = generate_test_output(&test_funding);
assert!(output.contains(r#"<Publisher>"#));
assert!(output.contains(r#" <PublishingRole>16</PublishingRole>"#));
assert!(output.contains(r#" <PublisherName>Name of funder</PublisherName>"#));
assert!(output.contains(r#" <Funding>"#));
assert!(output.contains(r#" <FundingIdentifier>"#));
assert!(output.contains(r#" <FundingIDType>01</FundingIDType>"#));
assert!(output.contains(r#" <IDTypeName>programname</IDTypeName>"#));
assert!(output.contains(r#" <IDValue>Name of program</IDValue>"#));
assert!(output.contains(r#" <IDTypeName>projectname</IDTypeName>"#));
assert!(output.contains(r#" <IDValue>Name of project</IDValue>"#));
assert!(output.contains(r#" <IDTypeName>grantnumber</IDTypeName>"#));
assert!(output.contains(r#" <IDValue>Number of grant</IDValue>"#));
// Change all possible values to test that output is updated
test_funding.funder.funder_name = "Different funder".to_string();
test_funding.program = None;
let output = generate_test_output(&test_funding);
assert!(output.contains(r#"<Publisher>"#));
assert!(output.contains(r#" <PublishingRole>16</PublishingRole>"#));
assert!(output.contains(r#" <PublisherName>Different funder</PublisherName>"#));
assert!(output.contains(r#" <Funding>"#));
assert!(output.contains(r#" <FundingIdentifier>"#));
assert!(output.contains(r#" <FundingIDType>01</FundingIDType>"#));
// No program supplied
assert!(!output.contains(r#" <IDTypeName>programname</IDTypeName>"#));
assert!(!output.contains(r#" <IDValue>Name of program</IDValue>"#));
assert!(output.contains(r#" <IDTypeName>projectname</IDTypeName>"#));
assert!(output.contains(r#" <IDValue>Name of project</IDValue>"#));
assert!(output.contains(r#" <IDTypeName>grantnumber</IDTypeName>"#));
assert!(output.contains(r#" <IDValue>Number of grant</IDValue>"#));
test_funding.project_name = None;
let output = generate_test_output(&test_funding);
assert!(output.contains(r#"<Publisher>"#));
assert!(output.contains(r#" <PublishingRole>16</PublishingRole>"#));
assert!(output.contains(r#" <PublisherName>Different funder</PublisherName>"#));
assert!(output.contains(r#" <Funding>"#));
assert!(output.contains(r#" <FundingIdentifier>"#));
assert!(output.contains(r#" <FundingIDType>01</FundingIDType>"#));
// No program supplied
assert!(!output.contains(r#" <IDTypeName>programname</IDTypeName>"#));
assert!(!output.contains(r#" <IDValue>Name of program</IDValue>"#));
// No project supplied
assert!(!output.contains(r#" <IDTypeName>projectname</IDTypeName>"#));
assert!(!output.contains(r#" <IDValue>Name of project</IDValue>"#));
assert!(output.contains(r#" <IDTypeName>grantnumber</IDTypeName>"#));
assert!(output.contains(r#" <IDValue>Number of grant</IDValue>"#));
test_funding.grant_number = None;
let output = generate_test_output(&test_funding);
assert!(output.contains(r#"<Publisher>"#));
assert!(output.contains(r#" <PublishingRole>16</PublishingRole>"#));
assert!(output.contains(r#" <PublisherName>Different funder</PublisherName>"#));
assert!(!output.contains(r#" <Funding>"#));
assert!(!output.contains(r#" <FundingIdentifier>"#));
assert!(!output.contains(r#" <FundingIDType>01</FundingIDType>"#));
assert!(!output.contains(r#" <IDTypeName>programname</IDTypeName>"#));
assert!(!output.contains(r#" <IDValue>Name of program</IDValue>"#));
assert!(!output.contains(r#" <IDTypeName>projectname</IDTypeName>"#));
assert!(!output.contains(r#" <IDValue>Name of project</IDValue>"#));
assert!(!output.contains(r#" <IDTypeName>grantnumber</IDTypeName>"#));
assert!(!output.contains(r#" <IDValue>Number of grant</IDValue>"#));
} | rust_cleaned_test_functions.jsonl/76891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4470,
941,
18,
14179,
391,
268,
761,
1241,
819,
368,
341,
286,
1077,
5206,
1273,
761,
37189,
284,
5547,
58340,
819,
341,
310,
2025,
25,
4329,
445,
675,
315,
2025,
3263,
983,
3904,
14702,
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_outer_join() {
let mut model = Model::default();
let g_id = model.make_box(qgm::get(0).into());
{
let mut b = model.get_mut_box(g_id);
b.add_column(exp::base(0, typ::int32(false)));
b.add_column(exp::base(1, typ::int32(false)));
b.add_column(exp::base(2, typ::int32(false)));
b.add_column(exp::base(3, typ::int32(false)));
b.add_column(exp::base(4, typ::int32(false)));
}
let o_id = model.make_box(OuterJoin::default().into());
let l_id = model.make_quantifier(QuantifierType::PreservedForeach, g_id, o_id);
let r_id = model.make_quantifier(QuantifierType::Foreach, g_id, o_id);
{
let mut b = model.get_mut_box(o_id);
// C0: Q0.0
b.add_column(exp::cref(l_id, 0));
// C1: Q0.1
b.add_column(exp::cref(l_id, 1));
// C2: Q1.3
b.add_column(exp::cref(r_id, 3));
// C3: Q1.4
b.add_column(exp::cref(r_id, 4));
}
RejectedNulls.derive(&mut model, g_id);
RelationType.derive(&mut model, g_id);
RejectedNulls.derive(&mut model, o_id);
RelationType.derive(&mut model, o_id);
{
let b = model.get_box(o_id);
let act_value = b.attributes.get::<RelationType>();
let exp_value = &vec![
typ::int32(false),
typ::int32(false),
typ::int32(true),
typ::int32(true),
];
assert_eq!(act_value, exp_value);
}
} | rust_cleaned_test_functions.jsonl/6656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 947
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67258,
31017,
368,
341,
286,
1077,
5206,
1614,
284,
4903,
486,
2258,
543,
286,
1077,
342,
842,
284,
1614,
10117,
10194,
10583,
26186,
486,
455,
7,
15,
568,
18122,
1423,
286,
341,
310,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_sign_negative() {
assert!(!INFINITY.is_sign_negative());
assert!(!1f64.is_sign_negative());
assert!(!0f64.is_sign_negative());
assert!((-0f64).is_sign_negative());
assert!((-1f64).is_sign_negative());
assert!(NEG_INFINITY.is_sign_negative());
assert!((1f64/NEG_INFINITY).is_sign_negative());
assert!(!NAN.is_sign_negative());
} | rust_cleaned_test_functions.jsonl/7440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
11172,
53865,
368,
341,
286,
2060,
0,
3471,
687,
55990,
2079,
11172,
53865,
1423,
286,
2060,
0,
3471,
16,
69,
21,
19,
2079,
11172,
53865,
1423,
286,
2060,
0,
3471,
15,
69,
21,
19,
2079,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_visibility_filtering() {
check(
r#"
//- /lib.rs crate:lib new_source_root:local
pub mod m {
pub struct A {
private_field: u32,
pub pub_field: u32,
pub(crate) crate_field: u32,
pub(super) super_field: u32,
}
}
//- /main.rs crate:main deps:lib new_source_root:local
fn foo(a: lib::m::A) { a.$0 }
"#,
expect![[r#"
fd private_field u32
fd pub_field u32
fd crate_field u32
fd super_field u32
"#]],
);
check(
r#"
//- /lib.rs crate:lib new_source_root:library
pub mod m {
pub struct A {
private_field: u32,
pub pub_field: u32,
pub(crate) crate_field: u32,
pub(super) super_field: u32,
}
}
//- /main.rs crate:main deps:lib new_source_root:local
fn foo(a: lib::m::A) { a.$0 }
"#,
expect![[r#"
fd pub_field u32
"#]],
);
check(
r#"
//- /lib.rs crate:lib new_source_root:library
pub mod m {
pub struct A(
i32,
pub f64,
);
}
//- /main.rs crate:main deps:lib new_source_root:local
fn foo(a: lib::m::A) { a.$0 }
"#,
expect![[r#"
fd 1 f64
"#]],
);
check(
r#"
//- /lib.rs crate:lib new_source_root:local
pub struct A {}
mod m {
impl super::A {
fn private_method(&self) {}
pub(crate) fn crate_method(&self) {}
pub fn pub_method(&self) {}
}
}
//- /main.rs crate:main deps:lib new_source_root:local
fn foo(a: lib::A) { a.$0 }
"#,
expect![[r#"
me private_method() fn(&self)
me crate_method() fn(&self)
me pub_method() fn(&self)
"#]],
);
check(
r#"
//- /lib.rs crate:lib new_source_root:library
pub struct A {}
mod m {
impl super::A {
fn private_method(&self) {}
pub(crate) fn crate_method(&self) {}
pub fn pub_method(&self) {}
}
}
//- /main.rs crate:main deps:lib new_source_root:local
fn foo(a: lib::A) { a.$0 }
"#,
expect![[r#"
me pub_method() fn(&self)
"#]],
);
} | rust_cleaned_test_functions.jsonl/76771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71256,
8727,
287,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
17717,
25,
2740,
501,
10347,
12993,
25,
2438,
198,
9585,
1463,
296,
341,
262,
6675,
2036,
362,
341,
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_basic_set_functionality() {
let mut sgs = SgSet::<_, 10>::new();
assert!(sgs.is_empty());
sgs.insert(1);
sgs.insert(2);
sgs.insert(3);
sgs.insert(4);
sgs.insert(5);
assert!(!sgs.is_empty());
assert_eq!(sgs.len(), 5);
for k in 1..=5 {
assert!(sgs.contains(&k));
}
sgs.remove(&3);
assert_eq!(
(&sgs).into_iter().collect::<Vec<&usize>>(),
vec![&1, &2, &4, &5]
);
let val = sgs.pop_first().unwrap();
assert_eq!(val, 1);
assert_eq!(
(&sgs).into_iter().collect::<Vec<&usize>>(),
vec![&2, &4, &5]
);
let val = sgs.pop_last().unwrap();
assert_eq!(val, 5);
assert_eq!((&sgs).into_iter().collect::<Vec<&usize>>(), vec![&2, &4]);
assert_eq!(sgs.len(), 2);
sgs.insert(0);
sgs.insert(3);
sgs.insert(10);
assert_eq!(sgs.len(), 5);
assert_eq!(
(&sgs).into_iter().collect::<Vec<&usize>>(),
vec![&0, &2, &3, &4, &10]
);
sgs.clear();
assert_eq!(sgs.len(), 0);
assert!(sgs.is_empty());
let empty_vec: Vec<usize> = Vec::new();
assert_eq!(sgs.into_iter().collect::<Vec<usize>>(), empty_vec);
} | rust_cleaned_test_functions.jsonl/68239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 634
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
2602,
9174,
2719,
368,
341,
262,
1077,
5206,
274,
5857,
284,
328,
70,
1649,
27638,
6878,
220,
16,
15,
6831,
931,
1428,
262,
2060,
10297,
1991,
82,
2079,
15124,
5231,
262,
274,
5857,
7030,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_hit() {
let mut cache = mock_cache();
let cached = cache.get(AssetId(1)).unwrap();
assert_eq!(cache.cache.back().unwrap().id, cached.id);
} | rust_cleaned_test_functions.jsonl/56056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
37697,
368,
341,
286,
1077,
5206,
6500,
284,
7860,
11529,
543,
286,
1077,
20579,
284,
6500,
670,
7,
16604,
764,
7,
16,
4579,
15454,
543,
286,
2060,
10714,
10297,
9360,
20087,
7335,
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 |
#[test]
fn test_serde_df_owned_json() {
let df = sample_dataframe();
let json = serde_json::to_string(&df).unwrap();
dbg!(&json);
let out = serde_json::from_reader::<_, DataFrame>(json.as_bytes()).unwrap(); // uses `DeserializeOwned`
assert!(df.frame_equal_missing(&out));
} | rust_cleaned_test_functions.jsonl/82054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
10894,
51973,
9455,
368,
341,
286,
1077,
6764,
284,
6077,
77570,
543,
286,
1077,
2951,
284,
61570,
9455,
486,
983,
3904,
2099,
2940,
568,
15454,
543,
286,
47904,
0,
2099,
2236,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decal_inheritance() {
let parent = DecalBuilder::new(BaseBuilder::new())
.with_color(Color::opaque(1, 2, 3))
.with_layer(1)
.with_diffuse_texture(create_test_texture())
.with_normal_texture(create_test_texture())
.build_node();
let mut child = DecalBuilder::new(BaseBuilder::new()).build_decal();
child.inherit(&parent).unwrap();
if let Node::Decal(parent) = parent {
check_inheritable_properties_equality(&child.base, &parent.base);
check_inheritable_properties_equality(&child, &parent);
}
} | rust_cleaned_test_functions.jsonl/131543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
5416,
1243,
62443,
368,
341,
286,
1077,
2681,
284,
3714,
278,
3297,
486,
931,
22225,
3297,
486,
931,
2398,
310,
659,
4197,
6714,
15028,
486,
95480,
7,
16,
11,
220,
17,
11,
220,
18,
1171,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_kv_lines() {
let input = b"\
bigtop1.vagrant:50070=localhost:51070
bigtop1.vagrant:50075=localhost:51075
";
let r = read_kv_lines(&input[..]).unwrap();
assert_eq!(r.get("bigtop1.vagrant:50070").map(|r| r.as_ref()), Some("localhost:51070"));
assert_eq!(r.get("bigtop1.vagrant:50075").map(|r| r.as_ref()), Some("localhost:51075"));
} | rust_cleaned_test_functions.jsonl/74232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
97066,
18323,
368,
341,
262,
1077,
1946,
284,
293,
83383,
16154,
3481,
16,
3133,
63487,
25,
20,
15,
15,
22,
15,
84551,
25,
20,
16,
15,
22,
15,
198,
16154,
3481,
16,
3133,
63487,
25,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_all_refs_for_fn_param() {
check(
r#"
fn foo(i$0 : u32) -> u32 { i }
"#,
expect![[r#"
i ValueParam FileId(0) 7..8 7..8
FileId(0) 25..26 Read
"#]],
);
} | rust_cleaned_test_functions.jsonl/60643 | {
"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,
21814,
5705,
60638,
5478,
15246,
4090,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
8822,
15229,
1956,
3,
15,
549,
575,
18,
17,
8,
1464,
575,
18,
17,
314,
600,
456,
57676,
345,
310,
1720,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inr() {
let mut state = State8080::empty_state();
state.memory = vec![0x0c];
state.c = 0x99;
emulate_8080_op(&mut state);
assert_eq!(state.c, 0x9a);
} | rust_cleaned_test_functions.jsonl/7803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
81,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
87,
15,
66,
935,
286,
1584,
520,
284,
220,
15,
87,
24,
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_bit_vec_lt() {
let mut a = BitVec::from_elem(5, false);
let mut b = BitVec::from_elem(5, false);
assert!(!(a < b) && !(b < a));
b.set(2, true);
assert!(a < b);
a.set(3, true);
assert!(a < b);
a.set(2, true);
assert!(!(a < b) && b < a);
b.set(0, true);
assert!(a < b);
} | rust_cleaned_test_functions.jsonl/62095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
13251,
39164,
368,
341,
286,
1077,
5206,
264,
284,
6495,
10050,
486,
1499,
28179,
7,
20,
11,
895,
317,
286,
1077,
5206,
293,
284,
6495,
10050,
486,
1499,
28179,
7,
20,
11,
895,
626,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_uniform_ibig() {
let mut rng = StdRng::seed_from_u64(1);
let distr = Uniform::from(ibig!(-7)..ibig!(3));
let x = (&mut rng).sample_iter(&distr).take(1000).min().unwrap();
assert_eq!(x, ibig!(-7));
let x = (&mut rng).sample_iter(&distr).take(1000).max().unwrap();
assert_eq!(x, ibig!(2));
let distr = Uniform::from(ibig!(-7)..=ibig!(3));
let x = (&mut rng).sample_iter(&distr).take(1000).min().unwrap();
assert_eq!(x, ibig!(-7));
let x = (&mut rng).sample_iter(&distr).take(1000).max().unwrap();
assert_eq!(x, ibig!(3));
} | rust_cleaned_test_functions.jsonl/61295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45066,
66470,
343,
368,
341,
262,
1077,
5206,
28422,
284,
42517,
49,
968,
486,
22602,
5673,
7300,
21,
19,
7,
16,
626,
262,
1077,
7905,
284,
47889,
486,
1499,
93746,
343,
0,
4080,
22,
88512,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_virtio_fs_hotplug_dax_off_w_virtiofsd_rs_daemon() {
test_virtio_fs(false, None, "none", &prepare_virtofsd_rs_daemon, true)
} | rust_cleaned_test_functions.jsonl/29389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
34470,
33433,
47474,
814,
706,
13651,
1670,
2273,
2106,
815,
3848,
67,
47115,
47070,
7291,
368,
341,
310,
1273,
2273,
2106,
815,
34470,
3576,
11,
2240,
11,
330,
6697,
497,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_asin() {
let tests = vec![
(Datum::F64(0.0_f64), 0.0_f64),
(Datum::F64(1f64), f64::consts::PI / 2.0_f64),
(Datum::F64(-1f64), -f64::consts::PI / 2.0_f64),
(
Datum::F64(f64::consts::SQRT_2 / 2.0_f64),
f64::consts::PI / 4.0_f64,
),
];
let tests_invalid_f64 = vec![
(Datum::F64(f64::INFINITY), Datum::Null),
(Datum::F64(f64::NAN), Datum::Null),
(Datum::F64(2f64), Datum::Null),
(Datum::F64(-2f64), Datum::Null),
];
for (arg, exp) in tests {
let got = eval_func(ScalarFuncSig::Asin, &[arg]).unwrap();
assert!((got.f64() - exp).abs() < f64::EPSILON);
}
for (arg, exp) in tests_invalid_f64 {
let got = eval_func(ScalarFuncSig::Asin, &[arg]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/13183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
258,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
68036,
486,
37,
21,
19,
7,
15,
13,
15,
761,
21,
19,
701,
220,
15,
13,
15,
761,
21,
19,
1326,
310,
320,
68036,
486,
37,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_error() {
let dir = tempfile::Builder::new()
.prefix("test_read_error")
.tempdir()
.unwrap();
let cfg = Config {
dir: dir.path().to_str().unwrap().to_owned(),
..Default::default()
};
let entry = vec![b'x'; 1024];
let engine = Engine::open(cfg).unwrap();
// Writing an empty message.
engine
.write(&mut generate_batch(1, 0, 1, None), true)
.unwrap();
engine
.write(&mut generate_batch(2, 1, 10, Some(&entry)), true)
.unwrap();
let mut kv_batch = LogBatch::default();
let entry_value = Entry {
index: 111,
data: entry.to_vec().into(),
..Default::default()
};
kv_batch
.put_message(1, b"k".to_vec(), &entry_value)
.unwrap();
engine.write(&mut kv_batch, true).unwrap();
let mut entries = Vec::new();
let _f = FailGuard::new("log_fd::read::err", "return");
engine
.fetch_entries_to::<MessageExtTyped>(1, 0, 1, None, &mut entries)
.unwrap();
engine.get_message::<Entry>(1, b"k".as_ref()).unwrap();
engine
.fetch_entries_to::<MessageExtTyped>(2, 1, 10, None, &mut entries)
.unwrap_err();
} | rust_cleaned_test_functions.jsonl/55359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 571
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
4096,
368,
341,
262,
1077,
5419,
284,
54819,
486,
3297,
486,
931,
741,
286,
659,
11849,
445,
1944,
6443,
4096,
1138,
286,
659,
3888,
3741,
741,
286,
659,
15454,
543,
262,
1077,
13286,
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_scan_keys() {
test_scan_keys_imp(vec![b"a", b"c", b"e", b"b", b"d", b"f"], vec![b"a", b"b"]);
let v1 = "x".repeat(SHORT_VALUE_MAX_LEN + 1).into_bytes();
let v4 = "v".repeat(SHORT_VALUE_MAX_LEN + 1).into_bytes();
test_scan_keys_imp(vec![b"a", b"c", b"e", b"b", b"d", b"f"], vec![&v1, &v4]);
} | rust_cleaned_test_functions.jsonl/16079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
12631,
368,
341,
286,
1273,
28857,
12631,
36788,
25592,
20703,
65,
56693,
497,
293,
96946,
497,
293,
1,
68,
497,
293,
1,
65,
497,
293,
44917,
497,
293,
96171,
7914,
7486,
20703,
65,
56693... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_queue() {
let mut queue = Queue::new();
queue.enqueue("Element1");
queue.enqueue("Element2");
queue.enqueue("Element3");
assert_eq!(Some(&"Element1"), queue.peek());
assert_eq!(Some("Element1"), queue.dequeue());
assert_eq!(Some("Element2"), queue.dequeue());
assert_eq!(Some("Element3"), queue.dequeue());
assert_eq!(None, queue.dequeue());
} | rust_cleaned_test_functions.jsonl/98958 | {
"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,
10841,
368,
341,
262,
1077,
5206,
7177,
284,
18745,
486,
931,
543,
262,
7177,
47468,
445,
1691,
16,
797,
262,
7177,
47468,
445,
1691,
17,
797,
262,
7177,
47468,
445,
1691,
18,
3071,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_sync_timeout() {
use std::iter::FromIterator;
let faketime_file = faketime::millis_tempfile(0).expect("create faketime file");
faketime::enable(&faketime_file);
let (chain_controller, shared, _notify) = start_chain(None, None);
let synchronizer = gen_synchronizer(chain_controller.clone(), shared.clone());
let network_context = mock_network_context(5);
faketime::write_millis(&faketime_file, MAX_TIP_AGE * 2).expect("write millis");
assert!(synchronizer.shared.is_initial_block_download());
let peers = synchronizer.peers();
// protect should not effect headers_timeout
{
let mut state = peers.state.write();
let mut state_0 = PeerState::default();
state_0.peer_flags.is_protect = true;
state_0.peer_flags.is_outbound = true;
state_0.headers_sync_timeout = Some(0);
let mut state_1 = PeerState::default();
state_1.peer_flags.is_outbound = true;
state_1.headers_sync_timeout = Some(0);
let mut state_2 = PeerState::default();
state_2.peer_flags.is_whitelist = true;
state_2.peer_flags.is_outbound = true;
state_2.headers_sync_timeout = Some(0);
let mut state_3 = PeerState::default();
state_3.peer_flags.is_outbound = true;
state_3.headers_sync_timeout = Some(MAX_TIP_AGE * 2);
state.insert(0.into(), state_0);
state.insert(1.into(), state_1);
state.insert(2.into(), state_2);
state.insert(3.into(), state_3);
}
synchronizer.eviction(&network_context);
let disconnected = network_context.disconnected.lock();
assert_eq!(
disconnected.deref(),
&HashSet::from_iter(vec![0, 1, 2].into_iter().map(Into::into))
)
} | rust_cleaned_test_functions.jsonl/113664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 892
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
23008,
20537,
368,
341,
286,
990,
1460,
486,
2015,
486,
3830,
11951,
280,
286,
1077,
282,
585,
4107,
2458,
284,
282,
585,
4107,
486,
25013,
285,
11771,
1192,
7,
15,
568,
17119,
445,
3182,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stack_guard() {
let engine = TestEngineBuilder::new().build().unwrap();
let read_pool = ReadPool::from(build_read_pool_for_test(
&CoprReadPoolConfig::default_for_test(),
engine,
));
let cm = ConcurrencyManager::new(1.into());
let mut cop = Endpoint::<RocksEngine>::new(&Config::default(), read_pool.handle(), cm);
cop.recursion_limit = 100;
let req = {
let mut expr = Expr::default();
for _ in 0..101 {
let mut e = Expr::default();
e.mut_children().push(expr);
expr = e;
}
let mut e = Executor::default();
e.mut_selection().mut_conditions().push(expr);
let mut dag = DagRequest::default();
dag.mut_executors().push(e);
let mut req = coppb::Request::default();
req.set_tp(REQ_TYPE_DAG);
req.set_data(dag.write_to_bytes().unwrap());
req
};
let resp: coppb::Response = block_on(cop.parse_and_handle_unary_request(req, None));
assert!(!resp.get_other_error().is_empty());
} | rust_cleaned_test_functions.jsonl/4246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 614
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
36796,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
1349,
15709,
284,
4457,
10551,
486,
1499,
43333,
6443,
15709,
5478,
4452,
1006,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_function_doc_extra_parameter() {
let src = "
// Package foo does a thing.
package foo
// one is a function.
//
// ## Parameters
// - x: is any value.
one = () => 1
";
let loc = Locator::new(&src[..]);
assert_docs_full(
src,
PackageDoc {
path: "path".to_string(),
name: "foo".to_string(),
headline: "Package foo does a thing.".to_string(),
description: None,
members: map![
"one" => Doc::Function(Box::new(FunctionDoc{
name: "one".to_string(),
headline: "one is a function.".to_string(),
description: None,
parameters: vec![ParameterDoc{
name: "x".to_string(),
headline: "x: is any value.".to_string(),
description: None,
required: false,
}],
flux_type: "() => int".to_string(),
is_option: false,
source_location: loc.get(9, 9, 9, 22),
examples: vec![],
metadata: None,
})),
],
examples: Vec::new(),
metadata: None,
},
vec![Diagnostic {
msg: "extra documentation for parameter \"x\"".to_string(),
loc: loc.get(9, 9, 9, 22),
}],
);
} | rust_cleaned_test_functions.jsonl/9999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1019
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
18869,
31858,
24899,
368,
341,
286,
1077,
2286,
284,
6228,
286,
442,
16906,
15229,
1558,
264,
3166,
624,
286,
6328,
15229,
271,
286,
442,
825,
374,
264,
729,
624,
286,
6475,
286,
442,
7704... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serialize_full() {
use crate::wire::testdata::dns_request::*;
let (frame, body_range) = EthernetFrame::parse(ETHERNET_FRAME_BYTES).unwrap();
assert_eq!(body_range, ETHERNET_BODY_RANGE);
assert_eq!(frame.src_mac(), ETHERNET_SRC_MAC);
assert_eq!(frame.dst_mac(), ETHERNET_DST_MAC);
assert_eq!(frame.ethertype(), Some(Ok(EtherType::Ipv4)));
let (ip_packet, body_range) = Ipv4Packet::parse(frame.body()).unwrap();
assert_eq!(body_range, IP_BODY_RANGE);
assert_eq!(ip_packet.proto(), Ok(IpProto::Udp));
assert_eq!(ip_packet.dscp(), IP_DSCP);
assert_eq!(ip_packet.ecn(), IP_ECN);
assert_eq!(ip_packet.df_flag(), IP_DONT_FRAGMENT);
assert_eq!(ip_packet.mf_flag(), IP_MORE_FRAGMENTS);
assert_eq!(ip_packet.fragment_offset(), IP_FRAGMENT_OFFSET);
assert_eq!(ip_packet.id(), IP_ID);
assert_eq!(ip_packet.ttl(), IP_TTL);
assert_eq!(ip_packet.src_ip(), IP_SRC_IP);
assert_eq!(ip_packet.dst_ip(), IP_DST_IP);
let (udp_packet, body_range) =
UdpPacket::parse(ip_packet.body(), ip_packet.src_ip(), ip_packet.dst_ip()).unwrap();
assert_eq!(body_range, UDP_BODY_RANGE);
assert_eq!(
udp_packet.src_port().map(|p| p.get()).unwrap_or(0),
UDP_SRC_PORT
);
assert_eq!(udp_packet.dst_port().get(), UDP_DST_PORT);
assert_eq!(udp_packet.body(), UDP_BODY);
let buffer = udp_packet
.body()
.encapsulate(udp_packet.serializer(ip_packet.src_ip(), ip_packet.dst_ip()))
.encapsulate(ip_packet.serializer())
.encapsulate(frame.serializer())
.serialize_outer();
assert_eq!(buffer.as_ref(), ETHERNET_FRAME_BYTES);
} | rust_cleaned_test_functions.jsonl/78656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 957
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
88686,
16372,
368,
341,
286,
990,
17717,
486,
35531,
486,
92425,
486,
45226,
7893,
79304,
286,
1077,
320,
6763,
11,
2487,
9698,
8,
284,
45408,
4369,
486,
6400,
7,
16416,
15373,
22260,
40705... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part2() {
let (timestamp, buses) = parse(&std::fs::read_to_string("data/2020/day13-1").unwrap());
assert_eq!(1068781, part2(timestamp, &buses));
let (timestamp, buses) = parse(&std::fs::read_to_string("data/2020/day13-2").unwrap());
assert_eq!(1202161486, part2(timestamp, &buses));
} | rust_cleaned_test_functions.jsonl/23884 | {
"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,
10495,
17,
368,
341,
286,
1077,
320,
13035,
11,
33380,
8,
284,
4715,
2099,
1834,
486,
3848,
486,
878,
2346,
3904,
445,
691,
14,
17,
15,
17,
15,
44739,
16,
18,
12,
16,
1827,
15454,
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_mul128() {
test_interpreter_and_jit_asm!(
"
mov r0, r1
mov r2, 30
mov r3, 0
mov r4, 20
mov r5, 0
mul64 r3, r4
mul64 r5, r2
add64 r5, r3
mov64 r0, r2
rsh64 r0, 0x20
mov64 r3, r4
rsh64 r3, 0x20
mov64 r6, r3
mul64 r6, r0
add64 r5, r6
lsh64 r4, 0x20
rsh64 r4, 0x20
mov64 r6, r4
mul64 r6, r0
lsh64 r2, 0x20
rsh64 r2, 0x20
mul64 r4, r2
mov64 r0, r4
rsh64 r0, 0x20
add64 r0, r6
mov64 r6, r0
rsh64 r6, 0x20
add64 r5, r6
mul64 r3, r2
lsh64 r0, 0x20
rsh64 r0, 0x20
add64 r0, r3
mov64 r2, r0
rsh64 r2, 0x20
add64 r5, r2
stxdw [r1+0x8], r5
lsh64 r0, 0x20
lsh64 r4, 0x20
rsh64 r4, 0x20
or64 r0, r4
stxdw [r1+0x0], r0
exit",
[0; 16],
(),
{ |_vm, res: Result| { res.unwrap() == 600 } },
42
);
} | rust_cleaned_test_functions.jsonl/58932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 766
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
16,
17,
23,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
435,
16,
198,
286,
1974,
435,
17,
11,
220,
18,
15,
198,
286,
1974,
435... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_interface() {
let logger = slog::Logger::root(slog::Discard, o!());
let sandbox = Sandbox::new(&logger).unwrap();
let agent_service = Box::new(agentService {
sandbox: Arc::new(Mutex::new(sandbox)),
});
let req = protocols::agent::UpdateInterfaceRequest::default();
let (ctx, _) = mk_ttrpc_context();
let result = agent_service.update_interface(&ctx, req);
assert!(result.is_err(), "expected update interface to fail");
} | rust_cleaned_test_functions.jsonl/16650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
20546,
368,
341,
286,
1077,
5925,
284,
34949,
486,
7395,
486,
2888,
1141,
839,
486,
23477,
567,
11,
297,
0,
1423,
286,
1077,
42754,
284,
96860,
486,
931,
2099,
9786,
568,
15454,
1428,
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_compute_position() {
let test_data: Vec<(Vec<(String, i64)>, i64)> = vec![
(
vec![
(String::from("Forward"), 5),
(String::from("down"), 5),
(String::from("Forward"), 8),
(String::from("up"), 3),
(String::from("down"), 8),
(String::from("Forward"), 2)
],
150
),
];
for (test_inp, result) in &test_data {
let instructions = Instruction::construct_instructions(test_inp);
assert_eq!(compute_position(&instructions), *result);
}
} | rust_cleaned_test_functions.jsonl/103178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
9661,
368,
341,
262,
1077,
1273,
1769,
25,
11312,
28706,
10050,
28706,
703,
11,
600,
21,
19,
8,
8066,
600,
21,
19,
16018,
284,
7486,
90515,
286,
2399,
310,
7486,
90515,
394,
320,
703,
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_150() {
assert_eq!(
Solution::eval_rpn(vec_string![
"10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"
]),
22
);
} | rust_cleaned_test_functions.jsonl/5549 | {
"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,
62,
16,
20,
15,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
14170,
1710,
19958,
25592,
3904,
90515,
394,
330,
16,
15,
497,
330,
21,
497,
330,
24,
497,
330,
18,
497,
6630,
497,
6523,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_put_mmds() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
sender
.write_all(http_request("PUT", "/mmds", Some(&"{}")).as_bytes())
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
let body = "{\"ipv4_address\":\"169.254.170.2\"}";
sender
.write_all(http_request("PUT", "/mmds", Some(&body)).as_bytes())
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
} | rust_cleaned_test_functions.jsonl/106584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
15557,
717,
2277,
82,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_btree_ranges_disj_overlap() {
let index_schema = IndexSchema::new(vec![FieldSpec::new(
vec![String::from("a")],
Value::Int32(0),
)]);
let constraint = &HashMap::from([(
vec![String::from("a")],
Constraint::Or(
Box::new(Constraint::LessThan(Value::Int32(3))),
Box::new(Constraint::GreaterThan(Value::Int32(0))),
),
)]);
assert!(are_ranges_equal_unordered(
&index_schema.generate_btree_ranges(constraint),
&vec![(
Bound::Included(Index::new(vec![Value::Int32(0).get_min_value()])),
Bound::Included(Index::new(vec![Value::Int32(0).get_max_value()])),
)]
));
} | rust_cleaned_test_functions.jsonl/71773 | {
"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,
48851,
880,
9344,
58748,
9932,
73,
65794,
368,
341,
286,
1077,
1922,
25371,
284,
8008,
8632,
486,
931,
25592,
20703,
1877,
8327,
486,
931,
1006,
310,
7486,
20703,
703,
486,
1499,
445,
64,
899,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_placement_in() {
let mut map = HashMap::new();
map.extend((0..10).map(|i| (i, i)));
map.entry(100) <- 100;
assert_eq!(map[&100], 100);
map.entry(0) <- 10;
assert_eq!(map[&0], 10);
assert_eq!(map.len(), 11);
} | rust_cleaned_test_functions.jsonl/134446 | {
"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,
90203,
1243,
368,
341,
286,
1077,
5206,
2415,
284,
10528,
486,
931,
543,
286,
2415,
15831,
1188,
15,
496,
16,
15,
568,
2186,
22428,
72,
91,
320,
72,
11,
600,
22525,
286,
2415,
24116,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_table() {
let result = Postgres::read_table(
"postgres://postgres:password@localhost:5432/postgres",
"arrow_data_types",
None,
1024,
)
.unwrap();
let schema = result.get(0).map(|rb| rb.schema()).unwrap();
// create dataframe and write the batches to it
let table = crate::table::Table::from_record_batches(schema, result);
let df = crate::dataframe::DataFrame::from_table(table);
df.to_csv("target/debug/arrow_data_from_sql.csv").unwrap();
} | rust_cleaned_test_functions.jsonl/3795 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
5237,
368,
341,
286,
1077,
1102,
284,
3877,
17818,
486,
878,
5237,
1006,
310,
330,
43070,
1110,
43070,
25,
3833,
31,
8301,
25,
20,
19,
18,
17,
29996,
17818,
756,
310,
330,
6044,
1769,
97... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_str_computed_value() {
let mut foo: Vec<String> = vec!["foo".to_string()];
let computed_value: &str;
{
computed_value = "asdf";
foo[0] = computed_value.to_string();
}
println!("{:?}", foo)
} | rust_cleaned_test_functions.jsonl/24899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2895,
2965,
19292,
3142,
368,
341,
286,
1077,
5206,
15229,
25,
11312,
3464,
29,
284,
7486,
0,
1183,
7975,
3263,
983,
3904,
33800,
286,
1077,
24182,
3142,
25,
609,
495,
280,
286,
341,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ssh_keys_404_ok() {
let mut provider = OpenstackProviderNetwork::try_new().unwrap();
provider.client = provider.client.max_retries(0);
let _m = mockito::mock("GET", "/public-keys")
.with_status(404)
.create();
let v = provider.ssh_keys().unwrap();
assert_eq!(v.len(), 0);
mockito::reset();
provider.ssh_keys().unwrap_err();
} | rust_cleaned_test_functions.jsonl/45108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82805,
12631,
62,
19,
15,
19,
19817,
368,
341,
262,
1077,
5206,
9109,
284,
5264,
7693,
5179,
12320,
486,
1539,
5921,
1005,
15454,
543,
262,
9109,
6581,
284,
9109,
6581,
6678,
1288,
4543,
7,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file() {
let tf = parse_test(
"; before
test cfg option=5
test verify
set enable_float=false
; still preamble
function %comment() system_v {}",
).unwrap();
assert_eq!(tf.commands.len(), 2);
assert_eq!(tf.commands[0].command, "cfg");
assert_eq!(tf.commands[1].command, "verify");
match tf.isa_spec {
IsaSpec::None(s) => {
assert!(s.enable_verifier());
assert!(!s.enable_float());
}
_ => panic!("unexpected ISAs"),
}
assert_eq!(tf.preamble_comments.len(), 2);
assert_eq!(tf.preamble_comments[0].text, "; before");
assert_eq!(tf.preamble_comments[1].text, "; still preamble");
assert_eq!(tf.functions.len(), 1);
assert_eq!(tf.functions[0].0.name.to_string(), "%comment");
} | rust_cleaned_test_functions.jsonl/8153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 581
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
368,
341,
286,
1077,
6409,
284,
4715,
4452,
1006,
310,
18963,
1573,
198,
6526,
1273,
13286,
2999,
28,
20,
198,
6526,
1273,
10146,
198,
6526,
738,
7283,
17586,
12219,
198,
6526,
2587,
2058,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_defaults() {
let mut ns = Namespace::new(false);
let mut nst = NamespaceStack::new(&mut ns);
nst.add_default_xmls();
assert_eq!(nst.into_iter().count(), 3);
let pid = nst.find_prefix_id("").unwrap();
assert!(pid.is_none());
assert_eq!(nst.borrow_prefix(pid), "");
assert_eq!(nst.borrow_uri(nst.find_mapping(pid).unwrap()), "");
let pid = nst.find_prefix_id("xml").unwrap();
assert_eq!(nst.borrow_prefix(pid), "xml");
assert_eq!(
nst.borrow_uri(nst.find_mapping(pid).unwrap()),
"http://www.w3.org/XML/1998/namespace"
);
let pid = nst.find_prefix_id("xmlns").unwrap();
assert_eq!(nst.borrow_prefix(pid), "xmlns");
assert_eq!(
nst.borrow_uri(nst.find_mapping(pid).unwrap()),
"http://www.w3.org/2000/xmlns/"
);
let pid = nst.find_prefix_id("fred");
assert_eq!(pid, None);
nst.push_frame();
nst.add_ns("fred", "http://fred.com");
assert_eq!(nst.into_iter().count(), 4);
let pid = nst.find_prefix_id("fred").unwrap();
assert_eq!(nst.borrow_prefix(pid), "fred");
assert_eq!(
nst.borrow_uri(nst.find_mapping(pid).unwrap()),
"http://fred.com"
);
nst.add_ns_if_unset("fred", "http://NOTfred.com");
assert_eq!(
nst.borrow_uri(nst.find_mapping(pid).unwrap()),
"http://fred.com"
);
nst.add_ns("fred", "http://fred2.com");
assert_eq!(
nst.borrow_uri(nst.find_mapping(pid).unwrap()),
"http://fred2.com"
);
nst.add_ns("xml", "http://xml_override");
let pid = nst.find_prefix_id("xml").unwrap();
assert_eq!(nst.borrow_prefix(pid), "xml");
assert_eq!(
nst.borrow_uri(nst.find_mapping(pid).unwrap()),
"http://xml_override"
);
dump_namespace(&nst);
nst.pop_frame();
assert_eq!(nst.into_iter().count(), 3);
let pid = nst.find_prefix_id("").unwrap();
assert!(pid.is_none());
assert_eq!(nst.borrow_prefix(pid), "");
assert_eq!(nst.borrow_uri(nst.find_mapping(pid).unwrap()), "");
let pid = nst.find_prefix_id("xml").unwrap();
assert_eq!(nst.borrow_prefix(pid), "xml");
assert_eq!(
nst.borrow_uri(nst.find_mapping(pid).unwrap()),
"http://www.w3.org/XML/1998/namespace"
);
let pid = nst.find_prefix_id("xmlns").unwrap();
assert_eq!(nst.borrow_prefix(pid), "xmlns");
assert_eq!(
nst.borrow_uri(nst.find_mapping(pid).unwrap()),
"http://www.w3.org/2000/xmlns/"
);
let pid = nst.find_prefix_id("fred").unwrap(); // Note not None any more
assert_eq!(nst.find_mapping(pid), None);
} | rust_cleaned_test_functions.jsonl/14332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42290,
368,
341,
286,
1077,
5206,
12268,
284,
41962,
486,
931,
3576,
317,
286,
1077,
5206,
308,
267,
284,
41962,
4336,
486,
931,
2099,
6984,
12268,
626,
286,
308,
267,
1364,
9993,
23855,
82,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rook_moves() {
let position =
&Position::from_fen("rnbqkbnr/pppppppp/8/8/8/8/1PPPPPPP/RNB1KBNR w").unwrap();
let mut list = MoveVec::new();
let capture_mask = position.bb_side(position.state().stm.flip());
let push_mask = position.bb_empty();
slider_moves::<MoveVec>(
position,
capture_mask,
push_mask,
EMPTY,
Square(1),
&mut list,
);
assert_list_includes_moves(&list, &["a1xa7", "a1a2", "a1a3", "a1a4", "a1a5", "a1a6"]);
} | rust_cleaned_test_functions.jsonl/69356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26608,
562,
45390,
368,
341,
286,
1077,
2309,
4035,
310,
609,
3812,
486,
1499,
761,
268,
445,
81,
18080,
80,
74,
11081,
81,
87146,
602,
602,
602,
14,
23,
14,
23,
14,
23,
14,
23,
14,
16,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_x_dbladd() {
let (test1,test2) = x_dbladd(paxz(), paxz(), fp2one(), a24());
let test1_aff = affine_x(test1);
let _test2_aff = affine_x(test2);
let p3 = xtpl(paxz(), a24plus(), a24minus());
let p2 = xdbl(paxz(), a24plus(), c24());
let p4 = xdbl(p2, a24plus(), c24());
let xp2_aff = affine_x(p2);
assert_eq!(test1_aff,xp2_aff);
let (p,q) = x_dbladd(p4, p2, xp2_aff, a24());
let p8 = xdbl(p4, a24plus(), c24());
let p6 = xdbl(p3, a24plus(), c24());
let p8_aff = affine_x(p8);
let p6_aff = affine_x(p6);
let p_aff = affine_x(p);
let q_aff = affine_x(q);
assert_eq!(p8_aff,p_aff);
assert_eq!(p6_aff,q_aff);
} | rust_cleaned_test_functions.jsonl/11576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3212,
814,
2024,
718,
368,
1476,
262,
1077,
320,
1944,
16,
67296,
17,
8,
284,
856,
814,
2024,
718,
1295,
706,
89,
1507,
281,
706,
89,
1507,
12007,
17,
603,
1507,
264,
17,
19,
1423,
262,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_scan() {
let storage = TestStorageBuilder::new().build().unwrap();
let (tx, rx) = channel();
let test_data = vec![
(b"a".to_vec(), b"aa".to_vec()),
(b"a1".to_vec(), b"aa11".to_vec()),
(b"a2".to_vec(), b"aa22".to_vec()),
(b"a3".to_vec(), b"aa33".to_vec()),
(b"b".to_vec(), b"bb".to_vec()),
(b"b1".to_vec(), b"bb11".to_vec()),
(b"b2".to_vec(), b"bb22".to_vec()),
(b"b3".to_vec(), b"bb33".to_vec()),
(b"c".to_vec(), b"cc".to_vec()),
(b"c1".to_vec(), b"cc11".to_vec()),
(b"c2".to_vec(), b"cc22".to_vec()),
(b"c3".to_vec(), b"cc33".to_vec()),
(b"d".to_vec(), b"dd".to_vec()),
(b"d1".to_vec(), b"dd11".to_vec()),
(b"d2".to_vec(), b"dd22".to_vec()),
(b"d3".to_vec(), b"dd33".to_vec()),
(b"e".to_vec(), b"ee".to_vec()),
(b"e1".to_vec(), b"ee11".to_vec()),
(b"e2".to_vec(), b"ee22".to_vec()),
(b"e3".to_vec(), b"ee33".to_vec()),
];
// Write key-value pairs in batch
storage
.async_raw_batch_put(
Context::new(),
"".to_string(),
test_data.clone(),
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
// Scan pairs with key only
let mut results: Vec<Option<KvPair>> = test_data
.iter()
.map(|&(ref k, _)| Some((k.clone(), vec![])))
.collect();
expect_multi_values(
results.clone(),
storage
.async_raw_scan(
Context::new(),
"".to_string(),
vec![],
None,
20,
true,
false,
)
.wait(),
);
results = results.split_off(10);
expect_multi_values(
results,
storage
.async_raw_scan(
Context::new(),
"".to_string(),
b"c2".to_vec(),
None,
20,
true,
false,
)
.wait(),
);
let mut results: Vec<Option<KvPair>> = test_data
.clone()
.into_iter()
.map(|(k, v)| Some((k, v)))
.collect();
expect_multi_values(
results.clone(),
storage
.async_raw_scan(
Context::new(),
"".to_string(),
vec![],
None,
20,
false,
false,
)
.wait(),
);
results = results.split_off(10);
expect_multi_values(
results,
storage
.async_raw_scan(
Context::new(),
"".to_string(),
b"c2".to_vec(),
None,
20,
false,
false,
)
.wait(),
);
let results: Vec<Option<KvPair>> = test_data
.clone()
.into_iter()
.map(|(k, v)| Some((k, v)))
.rev()
.collect();
expect_multi_values(
results,
storage
.async_raw_scan(
Context::new(),
"".to_string(),
b"z".to_vec(),
None,
20,
false,
true,
)
.wait(),
);
let results: Vec<Option<KvPair>> = test_data
.clone()
.into_iter()
.map(|(k, v)| Some((k, v)))
.rev()
.take(5)
.collect();
expect_multi_values(
results,
storage
.async_raw_scan(
Context::new(),
"".to_string(),
b"z".to_vec(),
None,
5,
false,
true,
)
.wait(),
);
// Scan with end_key
let results: Vec<Option<KvPair>> = test_data
.clone()
.into_iter()
.skip(6)
.take(4)
.map(|(k, v)| Some((k, v)))
.collect();
expect_multi_values(
results.clone(),
storage
.async_raw_scan(
Context::new(),
"".to_string(),
b"b2".to_vec(),
Some(b"c2".to_vec()),
20,
false,
false,
)
.wait(),
);
let results: Vec<Option<KvPair>> = test_data
.clone()
.into_iter()
.skip(6)
.take(1)
.map(|(k, v)| Some((k, v)))
.collect();
expect_multi_values(
results.clone(),
storage
.async_raw_scan(
Context::new(),
"".to_string(),
b"b2".to_vec(),
Some(b"b2\x00".to_vec()),
20,
false,
false,
)
.wait(),
);
// Reverse scan with end_key
let results: Vec<Option<KvPair>> = test_data
.clone()
.into_iter()
.rev()
.skip(10)
.take(4)
.map(|(k, v)| Some((k, v)))
.collect();
expect_multi_values(
results.clone(),
storage
.async_raw_scan(
Context::new(),
"".to_string(),
b"c2".to_vec(),
Some(b"b2".to_vec()),
20,
false,
true,
)
.wait(),
);
let results: Vec<Option<KvPair>> = test_data
.clone()
.into_iter()
.skip(6)
.take(1)
.map(|(k, v)| Some((k, v)))
.collect();
expect_multi_values(
results.clone(),
storage
.async_raw_scan(
Context::new(),
"".to_string(),
b"b2\x00".to_vec(),
Some(b"b2".to_vec()),
20,
false,
true,
)
.wait(),
);
let ctx = Context::new();
let results = vec![
(b"c1".to_vec(), b"cc11".to_vec()),
(b"c2".to_vec(), b"cc22".to_vec()),
(b"c3".to_vec(), b"cc33".to_vec()),
(b"d".to_vec(), b"dd".to_vec()),
(b"d1".to_vec(), b"dd11".to_vec()),
(b"d2".to_vec(), b"dd22".to_vec()),
].into_iter()
.map(|(k, v)| Some((k, v)));
expect_multi_values(
results.clone().collect(),
<Storage<RocksEngine>>::async_snapshot(storage.get_engine(), &ctx)
.and_then(move |snapshot| {
<Storage<RocksEngine>>::raw_scan(
&snapshot,
&"".to_string(),
&Key::from_encoded(b"c1".to_vec()),
Some(Key::from_encoded(b"d3".to_vec())),
20,
&mut Statistics::default(),
false,
)
})
.wait(),
);
expect_multi_values(
results.rev().collect(),
<Storage<RocksEngine>>::async_snapshot(storage.get_engine(), &ctx)
.and_then(move |snapshot| {
<Storage<RocksEngine>>::reverse_raw_scan(
&snapshot,
&"".to_string(),
&Key::from_encoded(b"d3".to_vec()),
Some(Key::from_encoded(b"c1".to_vec())),
20,
&mut Statistics::default(),
false,
)
})
.wait(),
);
} | rust_cleaned_test_functions.jsonl/22319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5872
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
28857,
368,
341,
286,
1077,
5819,
284,
3393,
5793,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
320,
3998,
11,
19111,
8,
284,
5496,
1428,
286,
1077,
1273,
1769,
284,
7486,
905... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_translate_date_by_days_fore() {
let context = build_context(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 10, 11)));
// every 32th day after the 12 of any month
fn offset(i: &Interval<Paris>, _: &Context<Paris>) -> Option<Interval<Paris>> {
Some(*i + PeriodComp::days(32))
}
let walker = DayOfMonth::new(12).unwrap().translate_with(offset)
.to_walker(&context.reference, &context);
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 05, 14).and_hms(0, 0, 0)),
Grain::Day)),
walker.forward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 06, 13).and_hms(0, 0, 0)),
Grain::Day)),
walker.forward.clone().skip(1).next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 13).and_hms(0, 0, 0)),
Grain::Day)),
walker.backward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 03, 16).and_hms(0, 0, 0)),
Grain::Day)),
walker.backward.clone().skip(1).next());
} | rust_cleaned_test_functions.jsonl/114680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 726
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66381,
4164,
3710,
28353,
35563,
368,
341,
286,
1077,
2266,
284,
1936,
8467,
3189,
12913,
7,
59604,
13,
1600,
67,
7,
17,
15,
16,
22,
11,
220,
15,
19,
11,
220,
17,
20,
568,
437,
1523,
1011,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.