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_no_row() {
let src_exec = MockExecutor::new(
vec![FieldTypeTp::LongLong.into()],
vec![
BatchExecuteResult {
physical_columns: LazyBatchColumnVec::from(vec![VectorValue::Int(
vec![Some(5)].into(),
)]),
logical_rows: Vec::new(),
warnings: EvalWarnings::default(),
is_drained: Ok(false),
},
BatchExecuteResult {
physical_columns: LazyBatchColumnVec::empty(),
logical_rows: Vec::new(),
warnings: EvalWarnings::default(),
is_drained: Ok(true),
},
],
);
let mut exec = BatchTopNExecutor::new_for_test(
src_exec,
vec![
RpnExpressionBuilder::new_for_test()
.push_column_ref_for_test(0)
.build_for_test(),
],
vec![false],
10,
);
let r = exec.next_batch(1);
assert_eq!(r.physical_columns.rows_len(), 0);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert_eq!(r.physical_columns.rows_len(), 0);
assert!(r.is_drained.unwrap());
} | rust_cleaned_test_functions.jsonl/34168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 819
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
8530,
368,
341,
286,
1077,
2286,
18430,
284,
14563,
25255,
486,
931,
1006,
310,
7486,
20703,
63733,
62241,
486,
6583,
6583,
39860,
73845,
310,
7486,
90515,
394,
33904,
17174,
2077,
341,
503,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_left_leaf() {
// construct a accumulator
let leaves = create_leaves(800..820);
let mock_store = MockAccumulatorStore::new();
let accumulator = MerkleAccumulator::new(
*ACCUMULATOR_PLACEHOLDER_HASH,
vec![],
0,
0,
Arc::new(mock_store),
);
let root_hash = accumulator.append(&leaves).unwrap();
proof_verify(&accumulator, root_hash, &leaves, 0);
} | rust_cleaned_test_functions.jsonl/51494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
9579,
38909,
368,
341,
262,
442,
9245,
264,
56312,
198,
262,
1077,
10901,
284,
1855,
11751,
4693,
7,
23,
15,
15,
496,
23,
17,
15,
317,
262,
1077,
7860,
14809,
284,
14563,
14603,
372,
105... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction_missing_key() {
let keypair = Keypair::new();
Transaction::new_unsigned_instructions(vec![]).sign(&[&keypair], Hash::default());
} | rust_cleaned_test_functions.jsonl/25844 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
40447,
3097,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
17869,
486,
931,
67830,
82427,
25592,
0,
1294,
568,
7752,
2099,
58,
5,
792,
12670,
1125,
6531,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_str_to_vsock_port() {
#[derive(Debug)]
struct TestData<'a> {
port: Option<&'a str>,
default_port: &'a str,
result: Result<u32>,
}
let tests = &[
TestData {
port: None,
default_port: "",
result: Err(anyhow!(ERR_VSOCK_PORT_EMPTY)),
},
TestData {
port: None,
default_port: "foo",
result: Err(anyhow!(ERR_VSOCK_PORT_NOT_NUMERIC)),
},
TestData {
port: None,
default_port: "1 foo",
result: Err(anyhow!(ERR_VSOCK_PORT_NOT_NUMERIC)),
},
TestData {
port: None,
default_port: "0",
result: Err(anyhow!(ERR_VSOCK_PORT_ZERO)),
},
TestData {
port: None,
default_port: "1234",
result: Ok(1234),
},
TestData {
port: Some(""),
default_port: "1234",
result: Err(anyhow!(ERR_VSOCK_PORT_EMPTY)),
},
TestData {
port: Some("1 foo"),
default_port: "1234",
result: Err(anyhow!(ERR_VSOCK_PORT_NOT_NUMERIC)),
},
TestData {
port: Some("0"),
default_port: "1234",
result: Err(anyhow!(ERR_VSOCK_PORT_ZERO)),
},
];
for (i, d) in tests.iter().enumerate() {
let msg = format!("test[{}]: {:?}", i, d);
let result = str_to_vsock_port(d.port, d.default_port);
let msg = format!("{}: result: {:?}", msg, result);
assert_result!(d.result, result, msg);
}
} | rust_cleaned_test_functions.jsonl/40944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
2346,
2273,
13199,
8716,
368,
341,
286,
11506,
27098,
42618,
5563,
286,
2036,
93200,
18291,
64,
29,
341,
310,
2635,
25,
6959,
52244,
6,
64,
607,
12520,
310,
1638,
8716,
25,
30136,
64,
607,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rule_type_validation_errors_for_non_class_specializers() {
let mut kb = KnowledgeBase::new();
kb.register_constant(sym!("String1"), term!("not an external instance"))
.unwrap();
kb.register_constant(sym!("String2"), term!("also not an external instance"))
.unwrap();
kb.register_constant(
sym!("ExternalInstanceWithoutMRO1"),
term!(Value::ExternalInstance(ExternalInstance {
instance_id: 1,
constructor: None,
repr: None
})),
)
.unwrap();
kb.register_constant(
sym!("ExternalInstanceWithoutMRO2"),
term!(Value::ExternalInstance(ExternalInstance {
instance_id: 2,
constructor: None,
repr: None
})),
)
.unwrap();
kb.register_constant(
sym!("Class1"),
term!(Value::ExternalInstance(ExternalInstance {
instance_id: 3,
constructor: None,
repr: None
})),
)
.unwrap();
kb.add_mro(sym!("Class1"), vec![3]).unwrap();
kb.register_constant(
sym!("Class2"),
term!(Value::ExternalInstance(ExternalInstance {
instance_id: 4,
constructor: None,
repr: None
})),
)
.unwrap();
kb.add_mro(sym!("Class2"), vec![4]).unwrap();
// Same unregistered specializer.
kb.add_rule_type(rule!("f", ["_"; instance!("Unregistered")]));
kb.add_rule(rule!("f", ["_"; instance!("Unregistered")]));
assert!(kb.validate_rules().is_empty());
// Different unregistered specializers.
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("Unregistered1")]));
kb.add_rule(rule!("f", ["_"; instance!("Unregistered2")]));
let diagnostics = kb.validate_rules();
assert_eq!(diagnostics.len(), 1);
let diagnostic = diagnostics.first().unwrap().to_string();
assert_eq!(diagnostic, "Unregistered class: Unregistered1");
// Same specializer registered as a non-instance constant.
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("String1")]));
kb.add_rule(rule!("f", ["_"; instance!("String1")]));
assert!(kb.validate_rules().is_empty());
// Different specializers registered as non-instance constants.
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("String1")]));
kb.add_rule(rule!("f", ["_"; instance!("String2")]));
let diagnostics = kb.validate_rules();
assert_eq!(diagnostics.len(), 1);
let diagnostic = diagnostics.first().unwrap().to_string();
let expected = "Rule type specializer String1 on parameter 1 should be a registered class, but instead it's registered as a constant with value: \"not an external instance\"";
assert!(diagnostic.contains(expected), "{}", diagnostic);
// Same specializer registered as an external instance without an MRO.
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("ExternalInstanceWithoutMRO1")]));
kb.add_rule(rule!("f", ["_"; instance!("ExternalInstanceWithoutMRO1")]));
assert!(kb.validate_rules().is_empty());
// Different specializers registered as external instances without MROs.
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("ExternalInstanceWithoutMRO1")]));
kb.add_rule(rule!("f", ["_"; instance!("ExternalInstanceWithoutMRO2")]));
let diagnostics = kb.validate_rules();
assert_eq!(diagnostics.len(), 1);
let diagnostic = diagnostics.first().unwrap().to_string();
let expected = "Rule specializer ExternalInstanceWithoutMRO2 on parameter 1 is not registered as a class.";
assert!(diagnostic.contains(expected), "{}", diagnostic);
// Same specializer registered as a class.
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("Class1")]));
kb.add_rule(rule!("f", ["_"; instance!("Class1")]));
assert!(kb.validate_rules().is_empty());
// Different specializers registered as classes.
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("Class1")]));
kb.add_rule(rule!("f", ["_"; instance!("Class2")]));
let diagnostics = kb.validate_rules();
assert_eq!(diagnostics.len(), 1);
let diagnostic = diagnostics.first().unwrap().to_string();
let expected =
"Rule specializer Class2 on parameter 1 must match rule type specializer Class1";
assert!(diagnostic.contains(expected), "{}", diagnostic);
// Rule type specializer: unregistered
// Rule specializer: non-instance constant
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("Unregistered")]));
kb.add_rule(rule!("f", ["_"; instance!("String1")]));
let diagnostics = kb.validate_rules();
assert_eq!(diagnostics.len(), 1);
let diagnostic = diagnostics.first().unwrap().to_string();
assert_eq!(diagnostic, "Unregistered class: Unregistered");
// Rule type specializer: non-instance constant
// Rule specializer: unregistered
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("String1")]));
kb.add_rule(rule!("f", ["_"; instance!("Unregistered")]));
let diagnostics = kb.validate_rules();
assert_eq!(diagnostics.len(), 1);
let diagnostic = diagnostics.first().unwrap().to_string();
let expected = "Rule type specializer String1 on parameter 1 should be a registered class, but instead it's registered as a constant with value: \"not an external instance\"";
assert!(diagnostic.contains(expected), "{}", diagnostic);
// Rule type specializer: external instance w/o MRO
// Rule specializer: unregistered
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("ExternalInstanceWithoutMRO1")]));
kb.add_rule(rule!("f", ["_"; instance!("Unregistered")]));
let diagnostics = kb.validate_rules();
assert_eq!(diagnostics.len(), 1);
let diagnostic = diagnostics.first().unwrap().to_string();
let expected = "Rule specializer Unregistered on parameter 1 is not registered as a class.";
assert!(diagnostic.contains(expected), "{}", diagnostic);
// Rule type specializer: external instance w/o MRO
// Rule specializer: class
kb.clear_rules();
kb.add_rule_type(rule!("f", ["_"; instance!("ExternalInstanceWithoutMRO1")]));
kb.add_rule(rule!("f", ["_"; instance!("Class1")]));
let diagnostics = kb.validate_rules();
assert_eq!(diagnostics.len(), 1);
let diagnostic = diagnostics.first().unwrap().to_string();
let expected = "Rule specializer Class1 on parameter 1 must match rule type specializer ExternalInstanceWithoutMRO1";
assert!(diagnostic.contains(expected), "{}", diagnostic);
} | rust_cleaned_test_functions.jsonl/39056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3027
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21124,
1819,
19416,
20196,
5478,
21637,
4790,
41629,
12230,
368,
341,
286,
1077,
5206,
38653,
284,
31925,
3978,
486,
931,
1428,
286,
38653,
9929,
34967,
62512,
17223,
703,
16,
3975,
4647,
17223,
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_create_farm_with_double_ip_fails() {
ExternalityBuilder::build().execute_with(|| {
create_entity();
create_twin();
let farm_name = "test_farm".as_bytes().to_vec();
let mut pub_ips = Vec::new();
pub_ips.push(super::types::PublicIP {
ip: "1.1.1.0".as_bytes().to_vec(),
gateway: "1.1.1.1".as_bytes().to_vec(),
contract_id: 0,
});
pub_ips.push(super::types::PublicIP {
ip: "1.1.1.0".as_bytes().to_vec(),
gateway: "1.1.1.1".as_bytes().to_vec(),
contract_id: 0,
});
assert_noop!(
TfgridModule::create_farm(Origin::signed(alice()), farm_name, pub_ips),
Error::<TestRuntime>::IpExists
);
});
} | rust_cleaned_test_functions.jsonl/35356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
761,
2178,
6615,
24598,
10385,
761,
6209,
368,
341,
262,
1374,
4160,
2719,
3297,
486,
5834,
1005,
10257,
6615,
79453,
341,
286,
1855,
19169,
543,
286,
1855,
528,
7526,
1428,
286,
1077,
8785,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sync_and_send() {
const PRIVATE_KEY_DER: &'static [u8] =
include_bytes!("signature_rsa_example_private_key.der");
let key_bytes_der = untrusted::Input::from(PRIVATE_KEY_DER);
let key_pair = signature::RSAKeyPair::from_der(key_bytes_der).unwrap();
let key_pair = std::sync::Arc::new(key_pair);
let _: &Send = &key_pair;
let _: &Sync = &key_pair;
let signing_state = signature::RSASigningState::new(key_pair).unwrap();
let _: &Send = &signing_state;
} | rust_cleaned_test_functions.jsonl/89885 | {
"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,
23008,
8378,
13565,
368,
341,
286,
733,
57793,
6600,
96062,
25,
30136,
1978,
508,
84,
23,
60,
4035,
310,
2924,
12524,
17223,
34140,
82522,
39304,
26249,
3097,
75819,
797,
286,
1077,
1376,
12524,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_derive_cbw_ht() {
{
let want = fidl_common::Cbw::Cbw20;
let got = derive_cbw_ht(
&fake_ht_cap_chanwidth(fidl_mlme::ChanWidthSet::TwentyForty),
&fake_ht_op_sec_offset(fidl_mlme::SecChanOffset::SecondaryNone),
);
assert_eq!(want, got);
}
{
let want = fidl_common::Cbw::Cbw20;
let got = derive_cbw_ht(
&fake_ht_cap_chanwidth(fidl_mlme::ChanWidthSet::TwentyOnly),
&fake_ht_op_sec_offset(fidl_mlme::SecChanOffset::SecondaryAbove),
);
assert_eq!(want, got);
}
{
let want = fidl_common::Cbw::Cbw40;
let got = derive_cbw_ht(
&fake_ht_cap_chanwidth(fidl_mlme::ChanWidthSet::TwentyForty),
&fake_ht_op_sec_offset(fidl_mlme::SecChanOffset::SecondaryAbove),
);
assert_eq!(want, got);
}
{
let want = fidl_common::Cbw::Cbw40Below;
let got = derive_cbw_ht(
&fake_ht_cap_chanwidth(fidl_mlme::ChanWidthSet::TwentyForty),
&fake_ht_op_sec_offset(fidl_mlme::SecChanOffset::SecondaryBelow),
);
assert_eq!(want, got);
}
} | rust_cleaned_test_functions.jsonl/17783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 772
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
16450,
86,
49086,
368,
341,
286,
341,
310,
1077,
1366,
284,
32104,
75,
21107,
486,
34,
39824,
486,
34,
39824,
17,
15,
280,
310,
1077,
2684,
284,
42430,
16450,
86,
49086,
1006,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_passive_discovery_scan_args() {
let mut sched = create_sched();
let req = sched
.enqueue_scan_to_discover(passive_discovery_scan(10))
.expect("expected a ScanRequest");
assert_eq!(req.txn_id, 1);
assert_eq!(req.scan_type, fidl_mlme::ScanTypes::Passive);
assert_eq!(req.channel_list, Vec::<u8>::new());
assert_eq!(req.ssid_list, Vec::<Vec<u8>>::new());
assert_eq!(req.probe_delay, 0);
assert_eq!(req.min_channel_time, 200);
assert_eq!(req.max_channel_time, 200);
} | rust_cleaned_test_functions.jsonl/80343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
533,
9932,
7449,
28857,
8384,
368,
341,
286,
1077,
5206,
5575,
284,
1855,
67394,
543,
286,
1077,
4232,
284,
5575,
198,
310,
659,
61373,
28857,
2346,
9932,
3688,
39790,
533,
9932,
7449,
2885... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simulate_pocket_pair() {
let hands = ["AdAh", "2c2s"]
.iter()
.map(|s| Hand::new_from_str(s).unwrap())
.collect();
let mut g = MonteCarloGame::new_with_hands(hands, vec![]).unwrap();
let result = g.simulate();
assert!(result.1 >= Rank::OnePair(0));
} | rust_cleaned_test_functions.jsonl/18430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18314,
6334,
620,
4537,
14445,
368,
341,
286,
1077,
6078,
284,
4383,
2589,
24765,
497,
330,
17,
66,
17,
82,
7026,
310,
659,
2015,
741,
310,
659,
2186,
22428,
82,
91,
8536,
486,
931,
5673,
2895... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_histogram() {
let histogram = Histogram::new(&[]);
assert!(histogram.is_none());
let buckets = &[10.0, 25.0, 100.0];
let values = vec![3.0, 2.0, 6.0, 12.0, 56.0, 82.0, 202.0, 100.0, 29.0];
let mut histogram = Histogram::new(buckets).expect("histogram should have been created");
histogram.record_many(&values);
histogram.record(89.0);
let result = histogram.buckets();
assert_eq!(result.len(), 3);
let (_, first) = result[0];
assert_eq!(first, 3);
let (_, second) = result[1];
assert_eq!(second, 4);
let (_, third) = result[2];
assert_eq!(third, 9);
assert_eq!(histogram.count(), values.len() as u64 + 1);
assert_eq!(histogram.sum(), 581.0);
} | rust_cleaned_test_functions.jsonl/18003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68564,
368,
341,
1789,
286,
1077,
30281,
284,
82138,
486,
931,
2099,
56703,
286,
2060,
10297,
21158,
12958,
2079,
31488,
5231,
286,
1077,
42112,
284,
44590,
16,
15,
13,
15,
11,
220,
17,
20,
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_shift_left() {
let mut buffer = setup_buffer("Test");
buffer.set_mark(Mark::Cursor(0), 2);
buffer.shift_mark(Mark::Cursor(0), Direction::Left, 1);
assert_eq!(buffer.get_mark_idx(Mark::Cursor(0)).unwrap(), 1);
} | rust_cleaned_test_functions.jsonl/94759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22230,
9579,
368,
341,
286,
1077,
5206,
4147,
284,
6505,
7776,
445,
2271,
797,
286,
4147,
980,
18924,
3189,
838,
486,
14543,
7,
15,
701,
220,
17,
317,
286,
4147,
29154,
18924,
3189,
838,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_equality() {
let s0 = Atom::from_slice("fn");
let s1 = Atom::from_slice("fn");
let s2 = Atom::from_slice("loop");
let i0 = Atom::from_slice("blah");
let i1 = Atom::from_slice("blah");
let i2 = Atom::from_slice("blah2");
let d0 = Atom::from_slice("zzzzzzzz");
let d1 = Atom::from_slice("zzzzzzzz");
let d2 = Atom::from_slice("zzzzzzzzz");
assert!(s0 == s1);
assert!(s0 != s2);
assert!(i0 == i1);
assert!(i0 != i2);
assert!(d0 == d1);
assert!(d0 != d2);
assert!(s0 != i0);
assert!(s0 != d0);
assert!(i0 != d0);
} | rust_cleaned_test_functions.jsonl/15251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
10473,
368,
341,
286,
1077,
274,
15,
284,
39516,
486,
1499,
26488,
445,
8822,
797,
286,
1077,
274,
16,
284,
39516,
486,
1499,
26488,
445,
8822,
797,
286,
1077,
274,
17,
284,
39516,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legal_moves_from_mochigoma_with_kyou_gote() {
let mut banmen = rule::BANMEN_START_POS.clone();
banmen.0[8-0][8-8] = Blank;
let mut mg:HashMap<MochigomaKind,u32> = HashMap::new();
mg.insert(MochigomaKind::Kyou, 1);
let mc:MochigomaCollections = MochigomaCollections::Pair(HashMap::new(),mg);
assert_eq!(legal_moves_from_mochigoma(&Teban::Gote,&mc,&banmen),
Rule::legal_moves_from_mochigoma(Teban::Gote,&mc,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
);
} | rust_cleaned_test_functions.jsonl/81332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
5673,
717,
4953,
343,
7786,
6615,
4698,
9330,
1889,
1272,
368,
972,
10217,
5206,
8943,
5676,
284,
5912,
486,
33,
1093,
44,
953,
13044,
18313,
15997,
7317,
2233,
276,
5676,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double_hash() {
const HASH1: &'static str = "212300e77d897f2f059366ed03c8bf2757bc2b1dd30df15d34f6f1ee521e58e8";
const HASH2: &'static str = "4feec9316077e49b59bc23173303e13be9e9f5f9fa0660a58112a04a65a84ef1";
const HASH3: &'static str = "03b750bf691caf40b7e33d8e15f64dd16becf944b39a82710d6d257159361b93";
let hash1 = Hash32Buf::from_slice(&from_hex_rev(HASH1));
let hash2 = Hash32Buf::from_slice(&from_hex_rev(HASH2));
let hash3 = Hash32Buf::from_slice(&from_hex_rev(HASH3));
let paired = Hash32Buf::double_sha256_from_pair(hash1.as_ref(), hash2.as_ref());
assert_eq!(hash3, paired);
} | rust_cleaned_test_functions.jsonl/106109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
8950,
368,
18507,
286,
733,
58857,
16,
25,
30136,
1978,
607,
284,
330,
17,
16,
17,
18,
15,
15,
68,
22,
22,
67,
23,
24,
22,
69,
17,
69,
15,
20,
24,
18,
21,
21,
291,
15,
18,
66,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_indirect_goto() {
let r = parse_and_eval(
r#"
block 0 {
r2 = 200;
r3 = 10;
goto(r3);
}
block 10 {
r2 = r2 + r3;
exit(r2);
}"#,
).unwrap();
assert!(r == 210);
} | rust_cleaned_test_functions.jsonl/55933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9122,
1226,
97732,
368,
341,
286,
1077,
435,
284,
4715,
8378,
21296,
1006,
310,
435,
2,
698,
310,
2504,
220,
15,
341,
394,
435,
17,
284,
220,
17,
15,
15,
280,
394,
435,
18,
284,
220,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chrono_timezone_value() {
let timestamp = DateTime::parse_from_rfc3339("2020-01-01T02:02:02+08:00").unwrap();
let value: Value = timestamp.into();
let out: DateTime<FixedOffset> = value.unwrap();
assert_eq!(out, timestamp);
} | rust_cleaned_test_functions.jsonl/12488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2248,
78,
53193,
3142,
368,
341,
286,
1077,
11441,
284,
6520,
486,
6400,
5673,
1710,
8316,
18,
18,
18,
24,
445,
17,
15,
17,
15,
12,
15,
16,
12,
15,
16,
51,
15,
17,
25,
15,
17,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_p2shwsh() {
// stolen from Bitcoin transaction f9ee2be4df05041d0e0a35d7caa3157495ca4f93b233234c9967b6901dacf7a9
let script = hex_script!("522103e5529d8eaa3d559903adb2e881eb06c86ac2574ffa503c45f4e942e2a693b33e2102e5f10fcdcdbab211e0af6a481f5532536ec61a5fdbf7183770cf8680fe729d8152ae");
let addr = Address::p2shwsh(&script, Bitcoin);
assert_eq!(&addr.to_string(), "36EqgNnsWW94SreZgBWc1ANC6wpFZwirHr");
assert_eq!(addr.address_type(), Some(AddressType::P2sh));
roundtrips(&addr);
} | rust_cleaned_test_functions.jsonl/59119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
17,
927,
86,
927,
368,
341,
286,
442,
22329,
504,
13127,
7745,
282,
24,
2127,
17,
1371,
19,
2940,
15,
20,
15,
19,
16,
67,
15,
68,
15,
64,
18,
20,
67,
22,
87734,
18,
16,
20,
22,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_hmac() -> Fallible<()> {
let cryptosys = LibSodiumCryptoSystem::new(Default::default())?;
assert_eq!(
*cryptosys.hash(b"abc"),
hex!("ddaf35a193617aba cc417349ae204131 12e6fa4e89a97ea2 0a9eeee64b55d39a")
);
assert_eq!(
*cryptosys.hash(b""),
hex!("cf83e1357eefb8bd f1542850d66d8007 d620e4050b5715dc 83f4a921d36ce9ce")
);
assert_eq!(
*cryptosys.hmac(
b"Hi There",
&hex!("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b 000000000000000000000000")
),
hex!("87aa7cdea5ef619d4ff0b4241a1d6cb0 2379f4e2ce4ec2787ad0b30545e17cde")
);
assert_eq!(
*cryptosys.hmac(
b"what do ya want for nothing?",
b"Jefe\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
),
hex!("164b7a7bfcf819e2e395fbe73b56e0a3 87bd64222e831fd610270cd7ea250554")
);
Ok(())
} | rust_cleaned_test_functions.jsonl/49527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 692
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
1523,
11948,
368,
1464,
14785,
1238,
71698,
341,
286,
1077,
14436,
436,
1047,
284,
5688,
50,
46776,
58288,
2320,
486,
931,
87874,
486,
2258,
2140,
69493,
1789,
286,
2060,
10714,
33673,
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... | 2 |
#[test]
fn test_chmod_ugo_copy() {
let tests = vec!{
TestCase{args: vec!{"u=g", TEST_FILE}, before: 0o070, after: 0o770},
TestCase{args: vec!{"g=o", TEST_FILE}, before: 0o005, after: 0o055},
TestCase{args: vec!{"o=u", TEST_FILE}, before: 0o200, after: 0o202},
TestCase{args: vec!{"u-g", TEST_FILE}, before: 0o710, after: 0o610},
TestCase{args: vec!{"u+g", TEST_FILE}, before: 0o250, after: 0o750},
};
run_tests(tests);
} | rust_cleaned_test_functions.jsonl/95245 | {
"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,
4138,
2593,
62,
33501,
16096,
368,
341,
262,
1077,
7032,
284,
7486,
0,
515,
286,
30573,
90,
2116,
25,
7486,
0,
4913,
84,
37162,
497,
13602,
8087,
2137,
1573,
25,
220,
15,
78,
15,
22,
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_u8_littleendian() {
let mut storage = vec![0; 1024];
type Field1 = PrimitiveField<u8, LittleEndian, 5>;
type Field2 = PrimitiveField<u8, LittleEndian, 20>;
Field1::write(&mut storage, 50);
Field2::write(&mut storage, 20);
assert_eq!(50, Field1::read(&storage));
assert_eq!(20, Field2::read(&storage));
assert_eq!(50, u8::from_le_bytes((&storage[5..6]).try_into().unwrap()));
assert_eq!(
20,
u8::from_le_bytes((&storage[20..21]).try_into().unwrap())
);
assert_eq!(Some(1), PrimitiveField::<u8, LittleEndian, 5>::SIZE);
assert_eq!(Some(1), PrimitiveField::<u8, LittleEndian, 5>::SIZE);
} | rust_cleaned_test_functions.jsonl/35727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
23,
907,
2377,
408,
1103,
368,
341,
286,
1077,
5206,
5819,
284,
7486,
20703,
15,
26,
220,
16,
15,
17,
19,
4821,
286,
943,
8601,
16,
284,
51460,
1877,
34837,
23,
11,
14671,
43231,
11,
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_loglinear1() {
let md = ModelData::IntKeyToIntPos(vec![(2, 2), (3, 4), (4, 16)]);
let loglin_mod = LogLinearModel::new(&md);
assert_eq!(loglin_mod.predict_to_int(2.into()), 1);
assert_eq!(loglin_mod.predict_to_int(4.into()), 13);
} | rust_cleaned_test_functions.jsonl/112147 | {
"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,
5224,
22763,
16,
368,
341,
286,
1077,
10688,
284,
4903,
1043,
486,
1072,
1592,
38544,
4859,
25592,
0,
9697,
17,
11,
220,
17,
701,
320,
18,
11,
220,
19,
701,
320,
19,
11,
220,
16,
21,
7252,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error() {
bitrange! {
Test: u8, "u8",
"1111_111a",
a: _first
}
// Because the pattern is 1111_111
if let Err(e) = Test::from(0) {
assert_eq!(0b1111_1110, e.expected);
assert_eq!(0, e.provided);
} else {
panic!("Test should have failed but didn't");
}
} | rust_cleaned_test_functions.jsonl/39141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
368,
341,
262,
2699,
9669,
0,
341,
286,
3393,
25,
575,
23,
11,
330,
84,
23,
756,
286,
330,
16,
16,
16,
16,
62,
16,
16,
16,
64,
756,
286,
264,
25,
716,
3896,
198,
262,
456,
262,
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_query_matches_with_repeated_internal_nodes() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(
language,
"
(_
(method_definition
(decorator (identifier) @deco)+
name: (property_identifier) @name))
",
)
.unwrap();
assert_query_matches(
language,
&query,
"
class A {
@c
@d
e() {}
}
",
&[(0, vec![("deco", "c"), ("deco", "d"), ("name", "e")])],
);
})
} | rust_cleaned_test_functions.jsonl/25166 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
6615,
1288,
41954,
23472,
14896,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
797,
286,
1077,
3239,
284,
11361,
486,
931,
1006,
310,
4128... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_or3() {
let compiled = compile("SET A 255\nOR A A");
let out_cpu = test_program(compiled);
assert_eq!(out_cpu.a.value, 255);
assert_eq!(out_cpu.f.value, 0);
} | rust_cleaned_test_functions.jsonl/63170 | {
"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,
8734,
18,
368,
341,
262,
1077,
19697,
284,
19192,
445,
5884,
362,
220,
17,
20,
20,
1699,
868,
362,
362,
797,
262,
1077,
700,
21795,
284,
1273,
25096,
30008,
2181,
626,
262,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_is_ident() {
parse_macro(
r#"
macro_rules! foo {
($lit0:literal, $lit1:literal) => { const VALUE: (bool,bool) = ($lit0,$lit1); };
}
"#,
)
.assert_expand(
r#"foo!(true,false);"#,
r#"
SUBTREE $
IDENT const 14
IDENT VALUE 15
PUNCH : [alone] 16
SUBTREE () 17
IDENT bool 18
PUNCH , [alone] 19
IDENT bool 20
PUNCH = [alone] 21
SUBTREE () 22
IDENT true 29
PUNCH , [joint] 25
IDENT false 31
PUNCH ; [alone] 28
"#,
);
} | rust_cleaned_test_functions.jsonl/28756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
6892,
38399,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
1060,
1711,
31635,
15,
25,
35785,
11,
400,
31635,
16,
25,
35785,
8,
589,
314,
733,
268... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_2nnn_call() {
let mut machine = Machine::new(TestContext::new());
machine.test_opcode(0x2BCD);
// Should store the current location in the stack to jump back later
assert_eq!(machine.stack[0], PC_BEGIN);
// Should increment stack pointer
assert_eq!(machine.sp, 1);
// Should set program counter to new location
assert_eq!(machine.pc, 0xBCD);
} | rust_cleaned_test_functions.jsonl/127949 | {
"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,
62,
17,
7370,
77,
13429,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
262,
5662,
5958,
71319,
7,
15,
87,
17,
4897,
35,
317,
262,
442,
12260,
3553,
279,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_substitute_parameters_fail() {
let bri = CheatedInput::new(2);
let mut circs: Vec<Circuit> = Vec::new();
let mut circ1 = Circuit::new();
let mut circ1_subs = Circuit::new();
circ1 += operations::RotateX::new(0, "theta".into());
circ1_subs += operations::RotateX::new(0, 0.0.into());
let mut circ2 = Circuit::new();
let mut circ2_subs = Circuit::new();
circ2 += operations::RotateZ::new(0, "theta2".into());
circ2_subs += operations::RotateZ::new(0, 1.0.into());
circs.push(circ1);
let br = Cheated {
constant_circuit: Some(circ2),
circuits: circs.clone(),
input: bri,
};
let mut map: HashMap<String, f64> = HashMap::new();
map.insert("teta".to_string(), 0.0);
map.insert("teta2".to_string(), 1.0);
let br_substitutes = br.substitute_parameters(map);
assert!(br_substitutes.is_err());
} | rust_cleaned_test_functions.jsonl/16061 | {
"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,
5228,
7660,
18263,
22121,
368,
341,
262,
1077,
39468,
284,
8436,
657,
2505,
486,
931,
7,
17,
317,
262,
1077,
5206,
4225,
82,
25,
11312,
20373,
37268,
29,
284,
11312,
486,
931,
543,
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_solid_character_range_invert() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-s", "-c", "1,4-6", "-v", "tr", "[:upper:]", "[:lower:]"])
.write_stdin("ABCEFG\nHIJKLM")
.assert()
.stdout("AbcEFG\nHijKLM");
} | rust_cleaned_test_functions.jsonl/7916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
5192,
40988,
9698,
1243,
1621,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
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_random_net_chord() {
let seed: &[_] = &[1,2,3,4,9];
let mut rng: StdRng = rand::SeedableRng::from_seed(seed);
let num_nodes = 5;
let num_neighbors = 2;
let l: usize = 6; // Size of keyspace
random_net_chord(num_nodes,num_neighbors,l,&mut rng);
} | rust_cleaned_test_functions.jsonl/53244 | {
"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,
22644,
19722,
4138,
539,
368,
341,
286,
1077,
10320,
25,
609,
13496,
60,
284,
44590,
16,
11,
17,
11,
18,
11,
19,
11,
24,
935,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
10382,
486,
414... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gecos_getters() {
// test if the Gecos field can be parsed and the resulting struct is populated correctly.
let gcdetail = "Full Name,504,11345342,ä1-2312,myemail@test.com".to_string();
let gcsimple = "A böring comment →".to_string();
let gc_no_other = "systemd Network Management,,,".to_string();
let res_detail = crate::Gecos::try_from(gcdetail).unwrap();
let res_simple = crate::Gecos::try_from(gcsimple).unwrap();
let res_no_other = crate::Gecos::try_from(gc_no_other).unwrap();
assert_eq!(res_simple.get_comment(), Some("A böring comment →"));
assert_eq!(res_detail.get_comment(), None);
assert_eq!(res_detail.get_full_name(), Some("Full Name"));
assert_eq!(res_detail.get_room(), Some("504"));
assert_eq!(res_detail.get_phone_work(), Some("11345342"));
assert_eq!(res_detail.get_phone_home(), Some("ä1-2312"));
assert_eq!(
res_detail.get_other(),
Some(&vec!["myemail@test.com".to_string()])
);
assert_eq!(
res_no_other.get_full_name(),
Some("systemd Network Management")
);
assert_eq!(res_no_other.get_room(), None);
assert_eq!(res_no_other.get_phone_work(), None);
assert_eq!(res_no_other.get_phone_home(), None);
assert_eq!(res_no_other.get_other(), None);
} | rust_cleaned_test_functions.jsonl/72915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32933,
9407,
3062,
5045,
368,
341,
262,
442,
1273,
421,
279,
479,
757,
436,
2070,
646,
387,
15676,
323,
279,
12942,
2036,
374,
34359,
12440,
624,
262,
1077,
44858,
1628,
284,
330,
9432,
3988,
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_record_from() {
let r = Record {
promise_id: 1,
arg: 3,
result: 4,
};
let expected = r.clone();
let buf: Buf = r.into();
#[cfg(target_endian = "little")]
assert_eq!(
buf,
vec![1u8, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0].into_boxed_slice()
);
let actual = Record::from(buf);
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/38176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
5673,
368,
341,
220,
1077,
435,
284,
13583,
341,
262,
11222,
842,
25,
220,
16,
345,
262,
1392,
25,
220,
18,
345,
262,
1102,
25,
220,
19,
345,
220,
2605,
220,
1077,
3601,
284,
435,
159... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tag_size_to_usize() {
assert_eq!(MAX_TAG_SIZE, 512 * 1024 * 1024);
let s = match tag_size_to_usize(0) {
Ok(v) => v,
_ => panic!(),
};
assert_eq!(s, 0);
let s = match tag_size_to_usize(MAX_TAG_SIZE) {
Ok(v) => v,
_ => panic!(),
};
assert_eq!(s as u64, MAX_TAG_SIZE);
match tag_size_to_usize(MAX_TAG_SIZE + 1) {
Err(ErrorKind::TagTooLarge) => (),
_ => panic!(),
};
} | rust_cleaned_test_functions.jsonl/25680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9372,
2368,
2346,
11306,
551,
368,
341,
262,
2060,
10714,
10297,
10586,
16592,
4098,
11,
220,
20,
16,
17,
353,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
626,
262,
1077,
274,
284,
2432,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_resolve_parent_module_for_inline() {
let (analysis, pos) = analysis_and_position(
"
//- /lib.rs
mod foo {
mod bar {
mod baz { <|> }
}
}
",
);
let nav = analysis.parent_module(pos).unwrap().pop().unwrap();
nav.assert_match("baz MODULE FileId(1) [32; 44)");
} | rust_cleaned_test_functions.jsonl/120405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
15960,
10750,
5478,
41871,
368,
341,
286,
1077,
320,
34484,
11,
1133,
8,
284,
6358,
8378,
9661,
1006,
310,
6228,
310,
78406,
608,
2740,
25638,
198,
310,
1463,
15229,
341,
394,
1463,
3619,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lit_timestamp_nano() {
let expr = col("time").eq(lit_timestamp_nano(10)); // 10 is an implicit i32
let expected =
col("time").eq(lit(ScalarValue::TimestampNanosecond(Some(10), None)));
assert_eq!(expr, expected);
let i: i64 = 10;
let expr = col("time").eq(lit_timestamp_nano(i));
assert_eq!(expr, expected);
let i: u32 = 10;
let expr = col("time").eq(lit_timestamp_nano(i));
assert_eq!(expr, expected);
} | rust_cleaned_test_functions.jsonl/26825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98399,
23073,
1089,
5652,
368,
341,
286,
1077,
15169,
284,
1375,
445,
1678,
1827,
11006,
2333,
275,
23073,
1089,
5652,
7,
16,
15,
5905,
442,
220,
16,
15,
374,
458,
17995,
600,
18,
17,
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_async_arrows() {
assert_not_implemented("const a = async a => 1;");
assert_error_eq("foo(a, b) => {}", ParseError::ArrowHeadInvalid);
} | rust_cleaned_test_functions.jsonl/7980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28346,
25842,
1811,
368,
341,
1066,
262,
2060,
7913,
17895,
14231,
445,
1024,
264,
284,
3312,
264,
589,
220,
16,
34649,
14808,
262,
2060,
4096,
10714,
445,
7975,
2877,
11,
293,
8,
589,
24689,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_original_console_color_is_set() {
assert_eq!(ORIGINAL_CONSOLE_COLOR.load(Ordering::Relaxed), u32::MAX);
// will call `init_console_color`
set_foreground_color(Color::Blue).unwrap();
assert_ne!(ORIGINAL_CONSOLE_COLOR.load(Ordering::Relaxed), u32::MAX);
} | rust_cleaned_test_functions.jsonl/61032 | {
"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,
39556,
51724,
6714,
6892,
2602,
368,
341,
286,
2060,
10714,
10297,
98201,
89292,
14471,
5104,
39692,
287,
486,
6740,
51451,
701,
575,
18,
17,
486,
10586,
626,
286,
442,
686,
1618,
1565,
2327,
5172... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_backup_mode_short_only_ignore_env() {
let _dummy = TEST_MUTEX.lock().unwrap();
env::set_var(ENV_VERSION_CONTROL, "none");
let matches = make_app().get_matches_from(vec!["app", "-b"]);
let result = determine_backup_mode(&matches).unwrap();
assert_eq!(result, BackupMode::ExistingBackup);
env::remove_var(ENV_VERSION_CONTROL);
} | rust_cleaned_test_functions.jsonl/98147 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
7302,
16673,
18410,
58493,
15879,
368,
341,
286,
1077,
716,
31390,
284,
13602,
66994,
21003,
1005,
15454,
543,
286,
6105,
486,
746,
4612,
7,
30360,
10678,
23680,
11,
330,
6697,
797,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_indices_double_ended() {
let mut list = VecList::new();
list.push_back(0);
list.push_back(1);
list.push_back(-1);
list.push_back(2);
list.push_back(-2);
let mut indices = list.indices();
assert_eq!(indices.next().unwrap().index, 0);
assert_eq!(indices.next_back().unwrap().index, 4);
assert_eq!(indices.next().unwrap().index, 1);
assert_eq!(indices.next_back().unwrap().index, 3);
assert_eq!(indices.next().unwrap().index, 2);
assert_eq!(indices.next_back(), None);
} | rust_cleaned_test_functions.jsonl/11493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18333,
24598,
62,
2883,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
1140,
2552,
3895,
7,
15,
317,
286,
1140,
2552,
3895,
7,
16,
317,
286,
1140,
2552,
3895,
4080,
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_lsr() {
let mut r = Register::new();
let mut b = MockBus::new();
b.memory[0x80] = 0x01;
lsr(0x80, &mut r, &mut b);
assert_eq!(b.read(0x80), 0x00);
assert_eq!(r.get_status_carry(), true);
b.memory[0x80] = 0x02;
lsr(0x80, &mut r, &mut b);
assert_eq!(b.read(0x80), 0x01);
assert_eq!(r.get_status_carry(), false);
} | rust_cleaned_test_functions.jsonl/14216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
15094,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
1077,
5206,
293,
284,
14563,
15073,
486,
931,
543,
262,
293,
36611,
58,
15,
87,
23,
15,
60,
284,
220,
15,
87,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fountain_cbor() {
let part = Part {
sequence: 12,
sequence_count: 8,
message_length: 100,
checksum: 0x1234_5678,
data: vec![1, 5, 3, 3, 5],
};
let cbor = part.cbor().unwrap();
let part2 = Part::from_cbor(&cbor).unwrap();
let cbor2 = part2.cbor().unwrap();
assert_eq!(cbor, cbor2);
} | rust_cleaned_test_functions.jsonl/106876 | {
"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,
761,
34524,
666,
9368,
368,
341,
286,
1077,
949,
284,
3660,
341,
310,
8500,
25,
220,
16,
17,
345,
310,
8500,
3180,
25,
220,
23,
345,
310,
1943,
5118,
25,
220,
16,
15,
15,
345,
310,
32529,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_ciphers() {
let message = "hello world";
let key = "passwordhaha";
println!("ORIGINAL {:?}", message.as_bytes());
let types = [
cipher::CipherType::Aes128Cfb,
cipher::CipherType::Aes128Cfb1,
cipher::CipherType::Aes128Cfb8,
cipher::CipherType::Aes128Cfb128,
cipher::CipherType::Aes192Cfb,
cipher::CipherType::Aes192Cfb1,
cipher::CipherType::Aes192Cfb8,
cipher::CipherType::Aes192Cfb128,
cipher::CipherType::Aes256Cfb,
cipher::CipherType::Aes256Cfb1,
cipher::CipherType::Aes256Cfb8,
cipher::CipherType::Aes256Cfb128,
cipher::CipherType::Aes128Ofb,
cipher::CipherType::Aes192Ofb,
cipher::CipherType::Aes256Ofb,
cipher::CipherType::BfCfb,
cipher::CipherType::Cast5Cfb,
cipher::CipherType::DesCfb,
cipher::CipherType::Rc2Cfb,
];
for t in types.iter() {
let k = t.bytes_to_key(key.as_bytes());
let iv = t.gen_init_vec();
let mut enc = OpenSSLCipher::new(*t, &k[..], &iv[..], CryptoMode::Encrypt);
let mut encrypted_msg = Vec::new();
enc.update(message.as_bytes(), &mut encrypted_msg).unwrap();
enc.finalize(&mut encrypted_msg).unwrap();
println!("ENC {:?}", encrypted_msg);
let mut dec = OpenSSLCipher::new(*t, &k[..], &iv[..], CryptoMode::Decrypt);
let mut decrypted_msg = Vec::new();
dec.update(&encrypted_msg[..], &mut decrypted_msg).unwrap();
dec.finalize(&mut decrypted_msg).unwrap();
println!("DEC {:?}", &decrypted_msg[..]);
assert_eq!(message.as_bytes(), &decrypted_msg[..]);
}
} | rust_cleaned_test_functions.jsonl/125393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 964
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
666,
82077,
368,
1476,
286,
1077,
1943,
284,
330,
14990,
1879,
876,
286,
1077,
1376,
284,
330,
3833,
71,
13546,
3302,
286,
13751,
17223,
98201,
71964,
1943,
5357,
12524,
5231,
286,
1077,
449... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_frame_read_co2_response() {
let frame = Frame::new([0xff, 0x86, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x77]);
assert!(frame.has_valid_start_byte());
assert!(frame.is_response());
assert_eq!(frame.op_code(), 0x86);
assert_eq!(frame.data(), [0x01, 0x02, 0x00, 0x00, 0x00, 0x00]);
assert!(frame.has_valid_checksum());
assert!(frame.validate().is_ok());
} | rust_cleaned_test_functions.jsonl/86323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8929,
6443,
11393,
17,
9655,
368,
341,
286,
1077,
4034,
284,
16321,
486,
931,
2561,
15,
9020,
11,
220,
15,
87,
23,
21,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_past_end() {
let a = VecMem::new(5);
let s = a.as_volatile_slice();
let res = s.write(&[1, 2, 3, 4, 5, 6], 0);
assert!(res.is_ok());
assert_eq!(res.unwrap(), 5);
} | rust_cleaned_test_functions.jsonl/63199 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
93019,
6213,
368,
341,
286,
1077,
264,
284,
11312,
18816,
486,
931,
7,
20,
317,
286,
1077,
274,
284,
264,
5357,
2273,
25517,
26488,
543,
286,
1077,
592,
284,
274,
3836,
2099,
58,
16,
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_validate_ip_v4() {
let tests = vec![
("1.1.1.1", true),
("255.0.0.0", true),
("0.0.0.0", true),
("256.1.1.1", false),
("25.1.1.", false),
("25,1,1,1", false),
("25.1 .1.1", false),
("1.1.1.1\n", false),
("٧.2٥.3٣.243", false),
];
for (input, expected) in tests {
assert_eq!(validate_ip_v4(input), expected);
}
} | rust_cleaned_test_functions.jsonl/46417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
10385,
2273,
19,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
3489,
16,
13,
16,
13,
16,
13,
16,
497,
830,
1326,
310,
3489,
17,
20,
20,
13,
15,
13,
15,
13,
15,
497,
830,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_dispatch_with_selecting_request_valid_selecting_request_maintains_server_invariants() {
let requested_ip_addr = Ipv4Addr::new(192, 168, 1, 2);
let mut req = new_test_request();
req.ciaddr = requested_ip_addr;
req.options.remove(0);
let mut server = new_test_server(|| 42);
server.cache.insert(
req.chaddr,
CachedConfig {
client_addr: requested_ip_addr,
options: vec![],
expiration: std::i64::MAX,
},
);
server.pool.allocate_addr(requested_ip_addr);
let _ = server.dispatch(req.clone()).unwrap();
assert!(server.cache.contains_key(&req.chaddr));
assert!(server.pool.addr_is_allocated(requested_ip_addr));
} | rust_cleaned_test_functions.jsonl/61722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
6615,
13051,
287,
7893,
8337,
13051,
287,
7893,
717,
1641,
1735,
12015,
1243,
54611,
368,
341,
286,
1077,
11223,
10385,
7387,
284,
358,
30168,
19,
13986,
486,
931,
7,
16,
24,
17,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_specificity() {
use self::CssPathSelector::*;
assert_eq!(get_specificity(&CssPath { selectors: vec![Id("hello".into())] }), (1, 0, 0));
assert_eq!(get_specificity(&CssPath { selectors: vec![Class("hello".into())] }), (0, 1, 0));
assert_eq!(get_specificity(&CssPath { selectors: vec![Type(NodeTypePath::Div)] }), (0, 0, 1));
assert_eq!(get_specificity(&CssPath { selectors: vec![Id("hello".into()), Type(NodeTypePath::Div)] }), (1, 0, 1));
} | rust_cleaned_test_functions.jsonl/22823 | {
"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,
56592,
487,
368,
972,
262,
990,
656,
486,
40275,
1820,
5877,
34076,
463,
262,
2060,
10714,
10297,
455,
56592,
487,
2099,
40275,
1820,
314,
56037,
25,
7486,
20703,
764,
445,
14990,
3263,
18122,
214... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_smart_case() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
te.assert_output(
&["c.foo"],
"one/two/c.foo
one/two/C.Foo2",
);
te.assert_output(&["C.Foo"], "one/two/C.Foo2");
te.assert_output(&["Foo"], "one/two/C.Foo2");
// Only literal uppercase chars should trigger case sensitivity.
te.assert_output(
&["\\Ac"],
"one/two/c.foo
one/two/C.Foo2",
);
te.assert_output(&["\\AC"], "one/two/C.Foo2");
} | rust_cleaned_test_functions.jsonl/10852 | {
"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,
88825,
19096,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
1013,
3713,
7645,
1006,
286,
609,
1183,
66,
58432,
8097,
286,
330,
603,
5523,
1126,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_three_element_accumulator() {
let element0_hash = b"hello".test_only_hash();
let element1_hash = b"world".test_only_hash();
let element2_hash = b"!".test_only_hash();
let internal0_hash = TestAccumulatorInternalNode::new(element0_hash, element1_hash).hash();
let internal1_hash =
TestAccumulatorInternalNode::new(element2_hash, *ACCUMULATOR_PLACEHOLDER_HASH).hash();
let root_hash = TestAccumulatorInternalNode::new(internal0_hash, internal1_hash).hash();
assert!(
TestAccumulatorProof::new(vec![element1_hash, internal1_hash])
.verify(root_hash, element0_hash, 0)
.is_ok()
);
assert!(
TestAccumulatorProof::new(vec![element0_hash, internal1_hash])
.verify(root_hash, element1_hash, 1)
.is_ok()
);
assert!(
TestAccumulatorProof::new(vec![*ACCUMULATOR_PLACEHOLDER_HASH, internal0_hash])
.verify(root_hash, element2_hash, 2)
.is_ok()
);
} | rust_cleaned_test_functions.jsonl/33621 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 462
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
50016,
7894,
75837,
10511,
368,
341,
262,
1077,
2392,
15,
8950,
284,
293,
1,
14990,
3263,
1944,
18410,
8950,
543,
262,
1077,
2392,
16,
8950,
284,
293,
1,
14615,
3263,
1944,
18410,
8950,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_to_resource_table_not_empty() {
let mut table = ResourceTable::default();
table.add("fake1", Box::new(FakeResource::new(1)));
table.add("fake2", Box::new(FakeResource::new(2)));
assert_eq!(table.map.len(), 2);
} | rust_cleaned_test_functions.jsonl/133160 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
2346,
17962,
5237,
7913,
15124,
368,
341,
262,
1077,
5206,
1965,
284,
11765,
2556,
486,
2258,
543,
262,
1965,
1364,
445,
30570,
16,
497,
8261,
486,
931,
7832,
726,
4783,
486,
931,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_error_codec_roundtrip() -> Result<(), String> {
let original = DecodeError::Text("ciao".to_string());
let mut encoded = Vec::new();
original.encode(&mut encoded);
let decoded = DecodeError::decode(&encoded)?;
assert_eq!(decoded, original);
Ok(())
} | rust_cleaned_test_functions.jsonl/65743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
4096,
51084,
29896,
32981,
368,
1464,
5714,
68843,
923,
29,
341,
286,
1077,
4024,
284,
50194,
1454,
486,
1178,
445,
66,
22516,
3263,
983,
3904,
1423,
286,
1077,
5206,
20498,
284,
11312,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tiledinputpart_num_y_tiles_failed_invalid_level() {
let input = MultiPartInputFile::new(&*SRC_IMAGE_PATH, 0, true).unwrap();
let tiled_input_part = super::TiledInputPart::new(&input, 0);
tiled_input_part.num_y_tiles(i32::MIN).unwrap();
} | rust_cleaned_test_functions.jsonl/59308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
2181,
1355,
4480,
4273,
4178,
60857,
35060,
31433,
8274,
368,
341,
286,
1077,
1946,
284,
17439,
5800,
2505,
1703,
486,
931,
2099,
9,
56017,
19121,
7944,
11,
220,
15,
11,
830,
568,
15454,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fails() {
// Test interrupts.
let file = File::open("tests/pi.txt").unwrap();
let mut buf = [0; 4];
{
let interrupt = ReadCustom::new(&file,
|| Err(Error::new(ErrorKind::Interrupted, "interrupt!")));
interrupt.read_exact_at(10, buf.as_mut()).unwrap();
assert_eq!(&buf, b"3589");
}
// Test errors.
{
let fail = ReadCustom::new(&file, || Err(Error::new(ErrorKind::Other, "random fail")));
assert!(fail.read_exact_at(10, buf.as_mut()).is_err());
}
// Test EOF.
assert!(file.read_exact_at(1000000000, buf.as_mut()).is_err());
} | rust_cleaned_test_functions.jsonl/115215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
761,
6209,
368,
341,
262,
442,
3393,
43437,
624,
262,
1077,
1034,
284,
2887,
486,
2508,
445,
23841,
62228,
3909,
1827,
15454,
543,
262,
1077,
5206,
6607,
284,
508,
15,
26,
220,
19,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_request_type_from() {
assert_eq!(RequestType::from(VIRTIO_BLK_T_IN), RequestType::In);
assert_eq!(RequestType::from(VIRTIO_BLK_T_OUT), RequestType::Out);
assert_eq!(RequestType::from(VIRTIO_BLK_T_FLUSH), RequestType::Flush);
assert_eq!(
RequestType::from(VIRTIO_BLK_T_GET_ID),
RequestType::GetDeviceID
);
assert_eq!(RequestType::from(42), RequestType::Unsupported(42));
} | rust_cleaned_test_functions.jsonl/8890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
1819,
5673,
368,
341,
286,
2060,
10714,
10297,
1900,
929,
486,
1499,
12410,
30521,
3810,
87634,
1139,
2158,
701,
6145,
929,
486,
641,
317,
286,
2060,
10714,
10297,
1900,
929,
486,
1499,
1241... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_reader_try_from() {
// Valid file path
let test_file = get_test_file("alltypes_plain.parquet");
let test_path_buf = get_test_path("alltypes_plain.parquet");
let test_path = test_path_buf.as_path();
let test_path_str = test_path.to_str().unwrap();
let reader = SerializedFileReader::try_from(test_file);
assert!(reader.is_ok());
let reader = SerializedFileReader::try_from(test_path);
assert!(reader.is_ok());
let reader = SerializedFileReader::try_from(test_path_str);
assert!(reader.is_ok());
let reader = SerializedFileReader::try_from(test_path_str.to_string());
assert!(reader.is_ok());
// Invalid file path
let test_path = Path::new("invalid.parquet");
let test_path_str = test_path.to_str().unwrap();
let reader = SerializedFileReader::try_from(test_path);
assert!(reader.is_err());
let reader = SerializedFileReader::try_from(test_path_str);
assert!(reader.is_err());
let reader = SerializedFileReader::try_from(test_path_str.to_string());
assert!(reader.is_err());
} | rust_cleaned_test_functions.jsonl/27257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
22306,
53283,
5673,
368,
341,
286,
442,
7818,
1034,
1815,
198,
286,
1077,
1273,
2458,
284,
633,
4452,
2458,
445,
541,
9242,
41015,
33277,
23300,
797,
286,
1077,
1273,
2638,
10363,
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_evaluate_game_score_by_depth() {
let score = simulator::calculate_game_score(10);
debug_assert_eq!(
evaluate_game_score_by_depth(score, 0, DEFAULT_FATAL_FIRE_MAX_CHAIN_COUNT),
51.69897000433602
);
let score = simulator::calculate_game_score(11);
debug_assert_eq!(
evaluate_game_score_by_depth(score, 0, DEFAULT_FATAL_FIRE_MAX_CHAIN_COUNT),
68.82607480270083
);
let score = simulator::calculate_game_score(12);
debug_assert_eq!(
evaluate_game_score_by_depth(score, 2, DEFAULT_FATAL_FIRE_MAX_CHAIN_COUNT),
76.33440779869551
);
let score = simulator::calculate_game_score(13);
debug_assert_eq!(
evaluate_game_score_by_depth(score, 2, DEFAULT_FATAL_FIRE_MAX_CHAIN_COUNT),
88.85604075017984
);
let score = simulator::calculate_game_score(14);
debug_assert_eq!(
evaluate_game_score_by_depth(score, 3, DEFAULT_FATAL_FIRE_MAX_CHAIN_COUNT),
81.0894512189861
);
let s1 = evaluate_game_score_by_depth(
simulator::calculate_game_score(14),
11,
DEFAULT_FATAL_FIRE_MAX_CHAIN_COUNT,
);
let s2 = evaluate_game_score_by_depth(
simulator::calculate_game_score(12),
7,
DEFAULT_FATAL_FIRE_MAX_CHAIN_COUNT,
);
debug_assert!(s1 < s2);
} | rust_cleaned_test_functions.jsonl/24651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
19642,
18547,
10405,
3710,
19061,
368,
341,
262,
1077,
5456,
284,
41891,
486,
35597,
18547,
10405,
7,
16,
15,
317,
262,
7390,
16553,
10714,
33673,
286,
15442,
18547,
10405,
3710,
19061,
34480,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_struct_pat() {
check(
r#"
struct S {
field<|>: u8,
}
fn f(s: S) {
match s {
S { field } => {}
}
}
"#,
expect![[r#"
field Field FileId(0) 15..24 15..20 Other
FileId(0) 68..73 FieldShorthandForField Read
"#]],
);
} | rust_cleaned_test_functions.jsonl/47786 | {
"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,
21814,
5705,
60638,
15126,
55824,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
328,
341,
262,
2070,
27,
91,
26818,
575,
23,
345,
630,
8822,
282,
1141,
25,
328,
8,
341,
262,
2432,
274,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_small_clear() {
let mut b = Bitv::from_elem(14, true);
assert!(!b.none() && b.all());
b.clear();
assert!(b.none() && !b.all());
} | rust_cleaned_test_functions.jsonl/119293 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
21811,
368,
341,
286,
1077,
5206,
293,
284,
6495,
85,
486,
1499,
28179,
7,
16,
19,
11,
830,
317,
286,
2060,
0,
3471,
65,
52063,
368,
1009,
293,
7670,
1423,
286,
293,
7426,
543,
286,
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
] | 3 |
#[test]
fn test_none_float() {
let records = dbase::read(NONE_FLOAT_DBF).unwrap();
assert_eq!(records.len(), 1);
let mut expected_fields = HashMap::new();
expected_fields.insert(
"name".to_owned(),
dbase::FieldValue::Character(Some("tralala".to_owned())),
);
expected_fields.insert(
"value_f".to_owned(),
dbase::FieldValue::Float(Some(12.345)),
);
expected_fields.insert(
"value_f_non".to_owned(),
dbase::FieldValue::Float(None),
);
expected_fields.insert(
"value_n".to_owned(),
dbase::FieldValue::Numeric(Some(4.0)),
);
expected_fields.insert(
"value_n_non".to_owned(),
dbase::FieldValue::Numeric(None),
);
assert_eq!(records[0], expected_fields);
} | rust_cleaned_test_functions.jsonl/42352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31488,
17586,
368,
341,
262,
1077,
7424,
284,
2927,
519,
486,
878,
8204,
5225,
21496,
16310,
37,
568,
15454,
543,
262,
2060,
10714,
10297,
26203,
19406,
1507,
220,
16,
626,
262,
1077,
5206,
3601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_param_completion_nth_param() {
assert_debug_snapshot!(
do_magic_completion(
r"
fn foo(file_id: FileId) {}
fn bar(file_id: FileId) {}
fn baz(file<|>, x: i32) {}
",
),
@r###"
[
CompletionItem {
label: "file_id: FileId",
source_range: [110; 114),
delete: [110; 114),
insert: "file_id: FileId",
lookup: "file_id",
},
]
"###
);
} | rust_cleaned_test_functions.jsonl/67165 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
60164,
78342,
4090,
368,
341,
286,
2060,
15446,
53265,
33673,
286,
653,
54612,
60164,
1006,
394,
435,
698,
394,
5168,
15229,
4866,
842,
25,
2887,
764,
8,
5613,
394,
5168,
3619,
4866,
842,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conj() {
for &c in all_consts.iter() {
assert_eq!(c.conj(), Complex::new(c.re, -c.im));
assert_eq!(c.conj().conj(), c);
}
} | rust_cleaned_test_functions.jsonl/105654 | {
"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,
3382,
73,
368,
341,
286,
369,
609,
66,
304,
678,
48530,
19471,
368,
341,
310,
2060,
10714,
10297,
66,
2862,
73,
1507,
22096,
486,
931,
1337,
1327,
11,
481,
66,
12053,
1106,
310,
2060,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_parse_system_advance_nonce_account_ix() {
let nonce_pubkey = Pubkey::new_unique();
let authorized_pubkey = Pubkey::new_unique();
let instruction =
system_instruction::advance_nonce_account(&nonce_pubkey, &authorized_pubkey);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_system(
&message.instructions[0],
&AccountKeys::new(&message.account_keys, None)
)
.unwrap(),
ParsedInstructionEnum {
instruction_type: "advanceNonce".to_string(),
info: json!({
"nonceAccount": nonce_pubkey.to_string(),
"recentBlockhashesSysvar": sysvar::recent_blockhashes::ID.to_string(),
"nonceAuthority": authorized_pubkey.to_string(),
}),
}
);
assert!(parse_system(
&message.instructions[0],
&AccountKeys::new(&message.account_keys[0..2], None)
)
.is_err());
} | rust_cleaned_test_functions.jsonl/108612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 570
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
17687,
98093,
48508,
13500,
62686,
368,
341,
286,
1077,
39676,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
18630,
34014,
792,
284,
22611,
792,
486,
931,
21218,
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_bank_prepare_filter_for_pending_transaction() {
assert_eq!(
BankingStage::prepare_filter_for_pending_transactions(6, &[2, 4, 5]),
vec![
Err(TransactionError::BlockhashNotFound),
Err(TransactionError::BlockhashNotFound),
Ok(()),
Err(TransactionError::BlockhashNotFound),
Ok(()),
Ok(())
]
);
assert_eq!(
BankingStage::prepare_filter_for_pending_transactions(6, &[0, 2, 3]),
vec![
Ok(()),
Err(TransactionError::BlockhashNotFound),
Ok(()),
Ok(()),
Err(TransactionError::BlockhashNotFound),
Err(TransactionError::BlockhashNotFound),
]
);
} | rust_cleaned_test_functions.jsonl/2931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
47460,
8727,
5478,
37861,
28884,
368,
341,
286,
2060,
10714,
33673,
310,
49499,
19398,
486,
13609,
8727,
5478,
37861,
68182,
7,
21,
11,
44590,
17,
11,
220,
19,
11,
220,
20,
17036,
310,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_static_provider_minimal_creation() {
let result =
StaticProvider::new_minimal("fake-key-2".to_owned(), "fake-secret-2".to_owned())
.credentials()
.wait();
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/83674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25360,
29518,
7260,
2861,
46163,
368,
341,
286,
1077,
1102,
4035,
310,
23105,
5179,
486,
931,
7260,
2861,
445,
30570,
16173,
12,
17,
3263,
983,
51973,
1507,
330,
30570,
68892,
12,
17,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_for_loop_end_expression_evaluated_only_once() {
let input = "
N% = 3
FOR I% = 1 TO N%
PRINT I%
N% = N% - 1
NEXT
";
let mut interpreter = interpret(input);
assert_has_variable!(interpreter, "I%", 4);
assert_has_variable!(interpreter, "N%", 0);
assert_eq!(interpreter.stdout().output_lines(), vec!["1", "2", "3"]);
} | rust_cleaned_test_functions.jsonl/64162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
17198,
6213,
28068,
21296,
12852,
18410,
7630,
368,
341,
262,
1077,
1946,
284,
6228,
262,
451,
4,
284,
220,
18,
198,
262,
4613,
358,
4,
284,
220,
16,
5146,
451,
13744,
286,
35893,
358,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rwlock_try_write() {
let lock = RwLock::new(0isize);
let read_guard = lock.read().unwrap();
let write_result = lock.try_write();
match write_result {
Err(TryLockError::WouldBlock) => (),
Ok(_) => assert!(false, "try_write should not succeed while read_guard is in scope"),
Err(_) => assert!(false, "unexpected error"),
}
drop(read_guard);
} | rust_cleaned_test_functions.jsonl/5885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98850,
53283,
9165,
368,
341,
286,
1077,
5296,
284,
55294,
11989,
486,
931,
7,
15,
285,
551,
317,
286,
1077,
1349,
36796,
284,
5296,
4125,
1005,
15454,
1428,
286,
1077,
3270,
5287,
284,
5296,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_deserialize_account_settings_local() -> Result<(), Box<dyn Error>> {
let data = r#"{
"data": {
"email": "josh@imgur.com",
"public_images": false,
"album_privacy": "secret",
"pro_expiration": false,
"accepted_gallery_terms": true,
"active_emails": [],
"messaging_enabled": true,
"blocked_users": [{
"blocked_id" : 384077,
"blocked_url": "joshTest"
}],
"show_mature": false,
"first_party": true
},
"success": true,
"status": 200
}"#;
let account_settings = serde_json::from_str::<Basic<AccountSettings>>(data)?;
println!("{:#?}", account_settings);
Ok(())
} | rust_cleaned_test_functions.jsonl/52320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
13500,
10853,
13564,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
821,
284,
435,
55543,
515,
310,
330,
691,
788,
341,
394,
330,
2332,
788,
330,
73,
9267,
31,
189... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_percent() {
let stmt = Stmt::Expr(binary(
literal(5f64),
Percent,
group(binary(literal(3f64), Plus, unary(Percent, literal(2f64)))),
));
assert!(cmp(interpret(stmt).unwrap().unwrap(), 1.94f64));
} | rust_cleaned_test_functions.jsonl/103396 | {
"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,
29883,
368,
341,
286,
1077,
20020,
284,
97023,
486,
16041,
63926,
1006,
310,
23141,
7,
20,
69,
21,
19,
1326,
310,
55348,
345,
310,
1874,
63926,
2333,
9953,
7,
18,
69,
21,
19,
701,
12343,
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_example_case_simplified() {
check_assist(
introduce_named_lifetime,
r#"impl Cursor<'_<|>> {"#,
r#"impl<'a> Cursor<'a> {"#,
);
} | rust_cleaned_test_functions.jsonl/109548 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
19096,
643,
73837,
368,
341,
286,
1779,
12083,
380,
1006,
310,
19131,
71834,
98827,
345,
310,
435,
55543,
6383,
28067,
18291,
41743,
91,
2452,
5212,
2,
345,
310,
435,
55543,
6383,
18291,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_straight_beats_three_of_a_kind() {
test(&["4S 5H 4C 8D 4H", "3S 4D 2S 6D 5C"], &["3S 4D 2S 6D 5C"])
} | rust_cleaned_test_functions.jsonl/49907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
7386,
21263,
1862,
50016,
3575,
4306,
33162,
368,
341,
262,
1273,
2099,
1183,
19,
50,
220,
20,
39,
220,
19,
34,
220,
23,
35,
220,
19,
39,
497,
330,
18,
50,
220,
19,
35,
220,
17,
50,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_grow_right() {
let mut store = Store::new(150);
for i in &[-100, -50, 150, -20, 10] {
store.add(*i)
}
assert_eq!(store.count, 5);
} | rust_cleaned_test_functions.jsonl/7524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
651,
10539,
368,
341,
286,
1077,
5206,
3553,
284,
9129,
486,
931,
7,
16,
20,
15,
317,
286,
369,
600,
304,
609,
7609,
16,
15,
15,
11,
481,
20,
15,
11,
220,
16,
20,
15,
11,
481,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_adaptive_threshold() {
use imageproc::contrast::adaptive_threshold;
compare_to_truth_grayscale("zebra.png", "zebra_adaptive_threshold.png", |image| adaptive_threshold(image, 41));
} | rust_cleaned_test_functions.jsonl/20077 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10027,
27781,
21858,
368,
341,
262,
990,
2168,
15782,
486,
84224,
486,
41562,
21858,
280,
262,
9429,
2346,
49186,
15682,
50348,
445,
2986,
14383,
3508,
497,
330,
2986,
14383,
10027,
27781,
21858,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_query() {
let mut mint = Mint::new("tests/it/testdata");
let mut file = mint.new_goldenfile("query.txt").unwrap();
let cases = &[
r#"select c_count, count(*) as custdist, sum(c_acctbal) as totacctbal
from customer, orders ODS,
(
select
c_custkey,
count(o_orderkey)
from
customer left outer join orders on
c_custkey = o_custkey
and o_comment not like '%:1%:2%'
group by
c_custkey
) as c_orders
group by c_count
order by custdist desc, c_count asc, totacctbal
limit 10, totacctbal"#,
r#"select * from customer inner join orders on a = b limit 1"#,
r#"select * from customer natural full join orders"#,
r#"select * from customer natural join orders left outer join detail using (id)"#,
];
for case in cases {
test_parse!(file, query, case);
}
} | rust_cleaned_test_functions.jsonl/118104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 608
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
368,
341,
262,
1077,
5206,
28337,
284,
41310,
486,
931,
445,
23841,
14,
275,
12697,
691,
797,
262,
1077,
5206,
1034,
284,
28337,
4618,
54696,
268,
1192,
445,
1631,
3909,
1827,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_input_value_fmt() {
let value: InputValue = graphql_input_value!(null);
assert_eq!(format!("{}", value), "null");
let value: InputValue = graphql_input_value!(123);
assert_eq!(format!("{}", value), "123");
let value: InputValue = graphql_input_value!(12.3);
assert_eq!(format!("{}", value), "12.3");
let value: InputValue = graphql_input_value!("FOO");
assert_eq!(format!("{}", value), "\"FOO\"");
let value: InputValue = graphql_input_value!(true);
assert_eq!(format!("{}", value), "true");
let value: InputValue = graphql_input_value!(BAR);
assert_eq!(format!("{}", value), "BAR");
let value: InputValue = graphql_input_value!(@baz);
assert_eq!(format!("{}", value), "$baz");
let value: InputValue = graphql_input_value!([1, 2]);
assert_eq!(format!("{}", value), "[1, 2]");
let value: InputValue = graphql_input_value!({"foo": 1,"bar": 2});
assert_eq!(format!("{}", value), "{foo: 1, bar: 2}");
} | rust_cleaned_test_functions.jsonl/3220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 491
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
3142,
38128,
368,
341,
286,
1077,
897,
25,
5571,
1130,
284,
48865,
5898,
3142,
10297,
2921,
317,
286,
2060,
10714,
10297,
2243,
79878,
897,
701,
330,
2921,
3071,
286,
1077,
897,
25,
5571,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_switch_implies_cfg_test() {
syntax::with_globals(|| {
let matches = &match optgroups().parse(&["--test".to_string()]) {
Ok(m) => m,
Err(f) => panic!("test_switch_implies_cfg_test: {}", f),
};
let registry = errors::registry::Registry::new(&[]);
let (sessopts, cfg) = build_session_options_and_crate_config(matches);
let sess = build_session(sessopts, None, registry);
let cfg = build_configuration(&sess, cfg);
assert!(cfg.contains(&(Symbol::intern("test"), None)));
});
} | rust_cleaned_test_functions.jsonl/44815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
21007,
550,
18343,
4452,
368,
341,
286,
19482,
486,
4197,
58775,
79453,
341,
310,
1077,
9071,
284,
609,
6347,
3387,
16753,
1005,
6400,
2099,
1183,
313,
1944,
3263,
983,
3904,
368,
2467,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_valid_key_no_options_or_comment() {
let line = format!("ecdsa-sha2-nistp256 {}", VALID_ECDSA_KEY);
let key = line.parse::<KeyEntry>().expect("parse ok");
assert_eq!(key.options, None);
assert_eq!(key.key_type, "ecdsa-sha2-nistp256");
assert_eq!(key.key, VALID_ECDSA_KEY);
assert_eq!(key.comment, None);
assert_eq!(line, key.to_string());
} | rust_cleaned_test_functions.jsonl/31214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
3097,
6536,
8743,
8734,
17638,
368,
341,
286,
1077,
1555,
284,
3561,
17223,
757,
96780,
7514,
64,
17,
5279,
380,
79,
17,
20,
21,
24689,
43291,
69510,
72638,
6600,
317,
286,
1077,
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_enum() {
check_round_trip(vec![Enum::Variant1,
Enum::Variant2(1, 2.5),
Enum::Variant3 {
a: 3,
b: 'b',
c: false,
},
Enum::Variant3 {
a: -4,
b: 'f',
c: true,
}]);
} | rust_cleaned_test_functions.jsonl/24198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
368,
341,
262,
1779,
29896,
63883,
25592,
20703,
10766,
486,
20746,
16,
345,
3502,
14086,
486,
20746,
17,
7,
16,
11,
220,
17,
13,
20,
1326,
3502,
14086,
486,
20746,
18,
341,
4597,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concurrent_operation_divergence() {
let test_env = TestEnvironment::default();
test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]);
let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_success(&repo_path, &["describe", "-m", "message 1"]);
test_env.jj_cmd_success(
&repo_path,
&["describe", "-m", "message 2", "--at-op", "@-"],
);
// We should be informed about the concurrent modification
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]);
insta::assert_snapshot!(stdout, @r###"
Concurrent modification detected, resolving automatically.
o message 2
| @ message 1
|/
o
"###);
} | rust_cleaned_test_functions.jsonl/63549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
3231,
32565,
16237,
2375,
763,
368,
341,
262,
1077,
1273,
15879,
284,
3393,
12723,
486,
2258,
543,
262,
1273,
15879,
1169,
73,
11684,
18632,
8623,
15879,
9265,
12993,
1507,
609,
1183,
2327,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_object_literal() {
fold("(!{})", "false");
fold("(!{a:1})", "false");
fold("(!{a:foo()})", "foo(), false;");
fold("(!{'a':foo()})", "foo(), false;");
} | rust_cleaned_test_functions.jsonl/122222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
34100,
368,
341,
262,
11555,
445,
3471,
28875,
497,
330,
3849,
797,
262,
11555,
445,
3471,
90,
64,
25,
16,
78608,
330,
3849,
797,
262,
11555,
445,
3471,
90,
64,
25,
7975,
368,
78608,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_two_documents() {
let yaml = indoc! {"
---
0
---
1
"};
let expected = "deserializing from YAML containing more than one document is not supported";
test_error::<usize>(yaml, expected);
} | rust_cleaned_test_functions.jsonl/45567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
75927,
368,
341,
262,
1077,
32246,
284,
1257,
509,
0,
314,
698,
286,
53923,
286,
220,
15,
198,
286,
53923,
286,
220,
16,
198,
262,
330,
2440,
262,
1077,
3601,
284,
330,
5799,
2848,
4849... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type() {
assert_eq!(
runner().err(
"@use \'sass:color\';\
\na {b: color.hwb(\"foo\" 30% 40%)}\n"
),
"Error: $hue: \"foo\" is not a number.\
\n ,\
\n2 | a {b: color.hwb(\"foo\" 30% 40%)}\
\n | ^^^^^^^^^^^^^^^^^^^^^^^^\
\n \'\
\n input.scss 2:7 root stylesheet",
);
} | rust_cleaned_test_functions.jsonl/84816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
368,
341,
286,
2060,
10714,
33673,
310,
22259,
1005,
615,
1006,
394,
8428,
810,
27152,
60326,
25,
3423,
59,
6967,
5661,
1797,
1124,
3376,
314,
65,
25,
1894,
860,
20211,
36014,
7975,
2105,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_product_none() {
let mut transaction_context = MockTransactionContext::default();
let state = ProductState::new(&mut transaction_context);
let result = state.get_product("not_a_product").unwrap();
assert!(result.is_none())
} | rust_cleaned_test_functions.jsonl/20316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9840,
31488,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
14563,
8070,
1972,
486,
2258,
543,
286,
1077,
1584,
284,
5643,
1397,
486,
931,
2099,
6984,
7745,
8467,
626,
286,
1077,
1102,
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 |
#[test]
fn test_complex_expr() {
#[derive(Debug, Template)]
#[template_inline = "x: {{ x.map(|x| x * 4).unwrap_or(0) * 2 }}"]
struct MyTemplate {
x: Option<i32>,
}
assert_render!(MyTemplate { x: Some(3) }, "x: 24");
} | rust_cleaned_test_functions.jsonl/110465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41522,
21915,
368,
341,
262,
11506,
27098,
42618,
11,
14355,
5563,
262,
11506,
4214,
41871,
284,
330,
87,
25,
5867,
856,
4770,
22428,
87,
91,
856,
353,
220,
19,
568,
15454,
8734,
7,
15,
8,
353... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_several_files_record() {
check_assist(
extract_struct_from_enum_variant,
r#"
//- /main.rs
enum E {
<|>V { i: i32, j: i32 }
}
mod foo;
//- /foo.rs
use crate::E;
fn f() {
let e = E::V { i: 9, j: 2 };
}
"#,
r#"
//- /main.rs
struct V{ pub i: i32, pub j: i32 }
enum E {
V(V)
}
mod foo;
//- /foo.rs
use crate::{E, V};
fn f() {
let e = E::V(V { i: 9, j: 2 });
}
"#,
)
} | rust_cleaned_test_functions.jsonl/13109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3453,
17539,
10931,
14192,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8649,
15126,
5673,
31054,
46112,
345,
310,
435,
2,
698,
61463,
608,
3817,
25638,
198,
9018,
468,
341,
262,
82639,
29,
53,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ok_routing() {
let router = router_with_routes(&["/hello"]);
assert!(route(&router, Get, "/hello").is_some());
let router = router_with_routes(&["/<a>"]);
assert!(route(&router, Get, "/hello").is_some());
assert!(route(&router, Get, "/hi").is_some());
assert!(route(&router, Get, "/bobbbbbbbbbby").is_some());
assert!(route(&router, Get, "/dsfhjasdf").is_some());
let router = router_with_routes(&["/<a>/<b>"]);
assert!(route(&router, Get, "/hello/hi").is_some());
assert!(route(&router, Get, "/a/b/").is_some());
assert!(route(&router, Get, "/i/a").is_some());
assert!(route(&router, Get, "/jdlk/asdij").is_some());
let mut router = Router::new();
router.add_route(Route::new(Put, "/hello", dummy_handler));
router.add_route(Route::new(Post, "/hello", dummy_handler));
router.add_route(Route::new(Delete, "/hello", dummy_handler));
assert!(route(&router, Put, "/hello").is_some());
assert!(route(&router, Post, "/hello").is_some());
assert!(route(&router, Delete, "/hello").is_some());
let router = router_with_routes(&["/<a..>"]);
assert!(route(&router, Get, "/").is_some());
assert!(route(&router, Get, "//").is_some());
assert!(route(&router, Get, "/hi").is_some());
assert!(route(&router, Get, "/hello/hi").is_some());
assert!(route(&router, Get, "/a/b/").is_some());
assert!(route(&router, Get, "/i/a").is_some());
assert!(route(&router, Get, "/a/b/c/d/e/f").is_some());
let router = router_with_routes(&["/foo/<a..>"]);
assert!(route(&router, Get, "/foo").is_some());
assert!(route(&router, Get, "/foo/").is_some());
assert!(route(&router, Get, "/foo///bar").is_some());
} | rust_cleaned_test_functions.jsonl/25746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 850
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19817,
97710,
368,
341,
286,
1077,
9273,
284,
9273,
6615,
64314,
2099,
1183,
14,
14990,
15049,
286,
2060,
10297,
8966,
2099,
9937,
11,
2126,
11,
3521,
14990,
1827,
285,
61855,
5231,
286,
1077,
927... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dual_vec_sin() {
let res = DualVec64::<2>::new(1.2, StaticVec::new_vec([1.0, 1.0])).sin();
assert!((res.re - 0.932039085967226).abs() < 1e-12);
assert!((res.eps[0] - 0.362357754476674).abs() < 1e-12);
assert!((res.eps[1] - 0.362357754476674).abs() < 1e-12);
} | rust_cleaned_test_functions.jsonl/28616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96772,
13251,
78710,
368,
341,
262,
1077,
592,
284,
33659,
10050,
21,
19,
27638,
17,
6831,
931,
7,
16,
13,
17,
11,
23105,
10050,
486,
931,
13251,
2561,
16,
13,
15,
11,
220,
16,
13,
15,
54697... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_users() {
let client = AojClient::default();
let users = client.fetch_user_ranking(0, 10).unwrap();
assert_eq!(users.users.len(), 10);
let page = (users.total_user_count - 1) / 10;
let count = (users.total_user_count - 1) % 10;
let users = client.fetch_user_ranking(page, 10).unwrap();
assert_eq!(users.users.len(), count as usize);
} | rust_cleaned_test_functions.jsonl/68067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16348,
368,
341,
286,
1077,
2943,
284,
362,
21265,
2959,
486,
2258,
543,
286,
1077,
3847,
284,
2943,
16121,
3317,
20417,
287,
7,
15,
11,
220,
16,
15,
568,
15454,
543,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_observe_protocol_state() {
block_on(async {
let config = config_generator();
let mut state_machine = StateMachine::new_stub(&config, make_test_app_set()).await;
let protocol_state = Rc::new(RefCell::new(ProtocolState::default()));
state_machine.set_observer(TestObserver {
protocol_state: Some(protocol_state.clone()),
..TestObserver::default()
});
state_machine.start_update_check(CheckOptions::default()).await;
let protocol_state = protocol_state.borrow();
assert_eq!(*protocol_state, state_machine.context.state);
});
} | rust_cleaned_test_functions.jsonl/94223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36322,
13267,
34880,
4387,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2193,
284,
2193,
25813,
543,
310,
1077,
5206,
1584,
38695,
284,
3234,
21605,
486,
931,
62781,
2099,
1676,
11,
1281,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prioritizes_brotli() {
let client = Client::new(rocket()).expect("valid rocket instance");
let mut response = client
.get("/")
.header(Header::new("Accept-Encoding", "deflate, gzip, br"))
.dispatch();
assert_eq!(response.status(), Status::Ok);
assert!(response
.headers()
.get("Content-Encoding")
.any(|x| x == "br"));
let mut body_plain = Cursor::new(Vec::<u8>::new());
brotli::BrotliDecompress(
&mut Cursor::new(response.body_bytes().unwrap()),
&mut body_plain,
)
.expect("decompress response");
assert_eq!(
String::from_utf8(body_plain.get_mut().to_vec()).unwrap(),
String::from(HELLO)
);
} | rust_cleaned_test_functions.jsonl/107452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58782,
275,
4756,
880,
4640,
742,
368,
341,
286,
1077,
2943,
284,
8423,
486,
931,
7,
46790,
6011,
17119,
445,
1891,
24306,
2867,
797,
286,
1077,
5206,
2033,
284,
2943,
198,
310,
659,
455,
61710,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sort_by_in_groups() -> Result<()> {
let df = fruits_cars();
let out = df
.lazy()
.sort("cars", false)
.select(vec![
col("fruits"),
col("cars"),
col("A")
.sort_by(col("B"), false)
.over(vec![col("cars")])
.explode()
.alias("sorted_A_by_B"),
])
.collect()?;
assert_eq!(
Vec::from(out.column("sorted_A_by_B")?.i32()?),
&[Some(2), Some(5), Some(4), Some(3), Some(1)]
);
Ok(())
} | rust_cleaned_test_functions.jsonl/22414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
3710,
1243,
21148,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
25322,
666,
1561,
1428,
262,
1077,
700,
284,
6764,
198,
286,
659,
49013,
741,
286,
659,
6860,
445,
50708,
497,
895,
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... | 4 |
#[test]
fn test_init_protocol_context() {
// change cfg
apply_encoded_message(ProtocolMessage::ChangeRuntimeConfigurationCall(
TezosRuntimeConfiguration {
log_level: Some(TezosRuntimeLogLevel::Info),
log_enabled: common::is_ocaml_log_enabled(),
},
))
.unwrap();
let storage_dir = "test_storage_01";
let tezos_env = TezosEnvironment::Carthagenet;
// init empty storage for test WITH commit genesis
let InitProtocolContextResult {
genesis_commit_hash,
supported_protocol_hashes,
} = prepare_protocol_context(storage_dir, &tezos_env, true);
// check
assert!(!supported_protocol_hashes.is_empty());
assert!(genesis_commit_hash.is_some());
let genesis_commit_hash = genesis_commit_hash.unwrap();
assert_eq!(
genesis_commit_hash.to_base58_check(),
"CoWZVRSM6DdNUpn3mamy7e8rUSxQVWkQCQfJBg7DrTVXUjzGZGCa",
);
// init the same storage without commit
let InitProtocolContextResult {
genesis_commit_hash,
supported_protocol_hashes,
} = prepare_protocol_context(storage_dir, &tezos_env, false);
// check
assert!(!supported_protocol_hashes.is_empty());
assert!(genesis_commit_hash.is_none());
} | rust_cleaned_test_functions.jsonl/42774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 525
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
34880,
8467,
368,
341,
262,
442,
2297,
13286,
198,
262,
3796,
73069,
6462,
7,
20689,
2052,
486,
4072,
15123,
7688,
7220,
1006,
286,
2655,
53701,
15123,
7688,
341,
310,
1487,
8274,
25,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drop_in_insert() {
use std::cell::Cell;
let flag = &Cell::new(0);
struct Bump<'a>(&'a Cell<i32>);
impl<'a> Drop for Bump<'a> {
fn drop(&mut self) {
let n = self.0.get();
self.0.set(n + 1);
}
}
flag.set(0);
{
let mut array = ArrayVec::<[_; 2]>::new();
array.push(Bump(flag));
array.insert(0, Bump(flag));
assert_eq!(flag.get(), 0);
let ret = array.try_insert(1, Bump(flag));
assert_eq!(flag.get(), 0);
assert_matches!(ret, Err(_));
drop(ret);
assert_eq!(flag.get(), 1);
}
assert_eq!(flag.get(), 3);
} | rust_cleaned_test_functions.jsonl/36790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
1243,
17678,
368,
341,
262,
990,
1460,
486,
5873,
486,
3599,
401,
262,
1077,
5181,
284,
609,
3599,
486,
931,
7,
15,
626,
262,
2036,
425,
1510,
18291,
64,
44784,
6,
64,
13972,
21897,
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_return_reference() {
let cxx = indoc! {"
const Bob& give_bob(const Bob& input_bob) {
return input_bob;
}
"};
let hdr = indoc! {"
#include <cstdint>
struct Bob {
uint32_t a;
uint32_t b;
};
const Bob& give_bob(const Bob& input_bob);
"};
let rs = quote! {
let b = ffi::Bob { a: 3, b: 4 };
assert_eq!(ffi::give_bob(&b).b, 4);
};
run_test(cxx, hdr, rs, &["give_bob"], &["Bob"]);
} | rust_cleaned_test_functions.jsonl/9794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12511,
25433,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
733,
14261,
5,
2968,
880,
674,
2741,
14261,
5,
1946,
880,
674,
8,
341,
310,
470,
1946,
880,
674,
280,
286,
456... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_config_wrong_type() {
let mut doc = create_doc();
assert!(
handle_update_configuration(&mut doc, "status.disabled.not_a_table", "true").is_err()
);
} | rust_cleaned_test_functions.jsonl/134241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5332,
75198,
1819,
368,
341,
286,
1077,
5206,
4629,
284,
1855,
18869,
1428,
286,
2060,
33673,
310,
3705,
8882,
35726,
2099,
6984,
4629,
11,
330,
2829,
34956,
11971,
4306,
5237,
497,
330,
186... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ascii_digit() {
assert_all!(is_ascii_digit,
"",
"0123456789",
);
assert_none!(is_ascii_digit,
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOQPRSTUVWXYZ",
"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
" \t\n\x0c\r",
"\x00\x01\x02\x03\x04\x05\x06\x07",
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
"\x10\x11\x12\x13\x14\x15\x16\x17",
"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
"\x7f",
);
} | rust_cleaned_test_functions.jsonl/35078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
50238,
48403,
368,
341,
286,
2060,
5705,
10297,
285,
50238,
48403,
345,
310,
8324,
310,
330,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
756,
286,
1439,
286,
2060,
31488,
10297,
285,
50238,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fail_atom_too_long() {
let src_data = b"(test) abc 123";
let mut limits = yass_parser::ParserLimits::unlimited();
limits.max_atom_length = 2;
let expected_error = yass_parser::ParserError::AtomTooLong { pos: yass::Pos::new(0, 11) };
assert_eq!(yass_parser::parse(limits, src_data).unwrap_err(), expected_error);
} | rust_cleaned_test_functions.jsonl/126508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22121,
42292,
2346,
78,
17799,
368,
341,
262,
1077,
2286,
1769,
284,
293,
29209,
1944,
8,
39022,
220,
16,
17,
18,
876,
262,
1077,
5206,
13388,
284,
379,
395,
18517,
486,
6570,
94588,
486,
359,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normal_add() {
let builder = PassThroughHasherBuilder {};
let mut hll: HyperLogLogPlus<u64, PassThroughHasherBuilder> =
HyperLogLogPlus::new(16, builder).unwrap();
hll.sparse_to_normal();
assert!(hll.registers.is_some());
hll.add(&0x00010fffffffffff);
assert_eq!(hll.registers.as_ref().unwrap().get(1), 5);
hll.add(&0x0002ffffffffffff);
assert_eq!(hll.registers.as_ref().unwrap().get(2), 1);
hll.add(&0x0003000000000000);
assert_eq!(hll.registers.as_ref().unwrap().get(3), 49);
hll.add(&0x0003000000000001);
assert_eq!(hll.registers.as_ref().unwrap().get(3), 49);
hll.add(&0xff03700000000000);
assert_eq!(hll.registers.as_ref().unwrap().get(0xff03), 2);
hll.add(&0xff03080000000000);
assert_eq!(hll.registers.as_ref().unwrap().get(0xff03), 5);
let builder = PassThroughHasherBuilder {};
let mut hll: HyperLogLogPlus<u64, PassThroughHasherBuilder> =
HyperLogLogPlus::new(4, builder).unwrap();
hll.sparse_to_normal();
hll.add(&0x1fffffffffffffff);
assert_eq!(hll.registers.as_ref().unwrap().get(1), 1);
hll.add(&0xffffffffffffffff);
assert_eq!(hll.registers.as_ref().unwrap().get(0xf), 1);
hll.add(&0x00ffffffffffffff);
assert_eq!(hll.registers.as_ref().unwrap().get(0), 5);
} | rust_cleaned_test_functions.jsonl/8341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 701
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13973,
2891,
368,
341,
286,
1077,
7363,
284,
9970,
23857,
6370,
261,
3297,
20375,
286,
1077,
5206,
305,
654,
25,
32732,
2201,
2201,
21807,
34837,
21,
19,
11,
9970,
23857,
6370,
261,
3297,
29,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_counters_packed_struct_read_write() {
let buff = AlignedBuffer::with_capacity(NUM_COUNTERS * counters::METADATA_LENGTH);
let metadata_buffer = AtomicBuffer::from_aligned(&buff);
let meta = CounterMetaDataDefn {
state: 1,
type_id: 2,
free_to_reuse_deadline: 3,
key: CounterMetaDataKey { key: [1; 112] },
label_length: 4,
label: CounterMetaDataLabel { val: [68; 380] },
};
metadata_buffer.put::<CounterMetaDataDefn>(0, meta);
let read = metadata_buffer.get::<CounterMetaDataDefn>(0);
println!("Put: {:?}", meta);
println!("Read: {:?}", read);
let state = meta.state;
let read = read.state;
assert_eq!(state, read);
} | rust_cleaned_test_functions.jsonl/131307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85632,
620,
11191,
15126,
6443,
9165,
368,
341,
286,
1077,
11522,
284,
1674,
1542,
4095,
486,
4197,
35603,
78928,
48411,
50,
353,
31532,
486,
44875,
39119,
15023,
317,
286,
1077,
11160,
7776,
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_centered_rect() {
assert_eq!(
centered_rect(50, 50, Rect::new(0, 0, 100, 100)),
Rect::new(25, 25, 50, 50)
);
} | rust_cleaned_test_functions.jsonl/20390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21087,
291,
16979,
368,
341,
286,
2060,
10714,
33673,
310,
30188,
16979,
7,
20,
15,
11,
220,
20,
15,
11,
11920,
486,
931,
7,
15,
11,
220,
15,
11,
220,
16,
15,
15,
11,
220,
16,
15,
15,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ed25519() {
generic_test(
confg_toml(),
"tests/named_test_configs/dnssec/ed25519.pk8",
KeyFormat::Pkcs8,
Algorithm::ED25519,
);
} | rust_cleaned_test_functions.jsonl/110032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32370,
17,
20,
20,
16,
24,
368,
341,
262,
13954,
4452,
1006,
286,
2335,
70,
528,
316,
75,
3148,
286,
330,
23841,
9612,
3606,
4452,
59150,
3446,
4412,
5024,
14,
291,
17,
20,
20,
16,
24,
38628... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.