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_without_projection() -> Result<()> {
let schema = Arc::new(Schema::new(vec![
Field::new("a", DataType::Int32, false),
Field::new("b", DataType::Int32, false),
Field::new("c", DataType::Int32, false),
]));
let batch = RecordBatch::try_new(
schema.clone(),
vec![
Arc::new(Int32Array::from(vec![1, 2, 3])),
Arc::new(Int32Array::from(vec![4, 5, 6])),
Arc::new(Int32Array::from(vec![7, 8, 9])),
],
)?;
let provider = MemTable::new(schema, vec![vec![batch]])?;
let exec = provider.scan(&None, 1024)?;
let it = exec.execute(0)?;
let batch1 = it.lock().expect("mutex lock").next_batch()?.unwrap();
assert_eq!(3, batch1.schema().fields().len());
assert_eq!(3, batch1.num_columns());
Ok(())
} | rust_cleaned_test_functions.jsonl/20927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 481
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39904,
72738,
368,
1464,
5714,
71698,
341,
286,
1077,
10802,
284,
19689,
486,
931,
3759,
3416,
486,
931,
25592,
90515,
310,
8601,
486,
931,
445,
64,
497,
33172,
486,
1072,
18,
17,
11,
895,
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... | 6 |
#[test]
fn test_next_with_bars() {
fn bar(close: f64) -> Bar {
Bar::new().close(close)
}
let mut sd = StandardDeviation::new(4).unwrap();
assert_eq!(sd.next(&bar(10.0)), 0.0);
assert_eq!(sd.next(&bar(20.0)), 5.0);
assert_eq!(round(sd.next(&bar(30.0))), 8.165);
assert_eq!(round(sd.next(&bar(20.0))), 7.071);
assert_eq!(round(sd.next(&bar(10.0))), 7.071);
assert_eq!(round(sd.next(&bar(100.0))), 35.355);
} | rust_cleaned_test_functions.jsonl/65296 | {
"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,
11257,
6615,
880,
1561,
368,
341,
286,
5168,
3619,
68890,
25,
282,
21,
19,
8,
1464,
4716,
341,
310,
4716,
486,
931,
1005,
5552,
68890,
340,
286,
555,
286,
1077,
5206,
20585,
284,
11766,
14592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_consensus_withdraw_handler() {
let denom: Denomination = Denomination::from_str("TEST").unwrap();
let mut mock = mock::Mock::default();
let mut ctx = mock.create_ctx();
let mut meta = Metadata {
..Default::default()
};
Accounts::init_or_migrate(
&mut ctx,
&mut meta,
AccountsGenesis {
balances: {
let mut balances = BTreeMap::new();
// Alice.
balances.insert(keys::alice::address(), {
let mut denominations = BTreeMap::new();
denominations.insert(denom.clone(), 1_000_000);
denominations
});
balances
},
total_supplies: {
let mut total_supplies = BTreeMap::new();
total_supplies.insert(denom.clone(), 1_000_000);
total_supplies
},
..Default::default()
},
);
Module::<Accounts, Consensus>::init_or_migrate(&mut ctx, &mut meta, Default::default());
// Simulate successful event.
let me = Default::default();
let h_ctx = types::ConsensusWithdrawContext {
from: keys::alice::address(),
nonce: 0,
address: keys::alice::address(),
amount: BaseUnits::new(1, denom.clone()),
};
Module::<Accounts, Consensus>::message_result_withdraw(&mut ctx, me, h_ctx);
// Ensure runtime balance is updated.
let bals = Accounts::get_balances(ctx.runtime_state(), keys::alice::address()).unwrap();
assert_eq!(
bals.balances[&denom], 1_000_001,
"alice balance deposited in"
)
} | rust_cleaned_test_functions.jsonl/52602 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 798
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31971,
13626,
6615,
7633,
10183,
368,
341,
262,
1077,
49744,
25,
9774,
80380,
284,
9774,
80380,
486,
1499,
2895,
445,
10033,
1827,
15454,
543,
262,
1077,
5206,
7860,
284,
7860,
486,
11571,
486,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_interface_config() {
let fake_factory_path = "/fake_factory_path";
let test_config = create_test_config("/doesntmatter", fake_factory_path, "/doesntmatter");
let mut intf = create_test_interface();
// Should pass because an interface must have exactly one configuration.
match test_config.validate_interface_config(&intf) {
Ok(_) => (),
Err(e) => panic!("Got unexpected error result: {:?}", e),
}
// per interface.
let routed_vlan = Some(RoutedVlan { vlan_id: 1, ipv4: None, ipv6: None });
let switched_vlan = Some(SwitchedVlan {
interface_mode: InterfaceMode::Access,
access_vlan: None,
trunk_vlans: None,
});
let subinterfaces = Subinterface { admin_state: None, ipv4: None, ipv6: None };
intf.routed_vlan = routed_vlan.clone();
intf.subinterfaces = Some(vec![subinterfaces.clone()]);
intf.switched_vlan = switched_vlan.clone();
let r = test_config.validate_interface_config(&intf);
assert_eq!(true, r.is_err());
intf.routed_vlan = None;
intf.subinterfaces = Some(vec![subinterfaces.clone()]);
intf.switched_vlan = switched_vlan.clone();
let r = test_config.validate_interface_config(&intf);
assert_eq!(true, r.is_err());
intf.routed_vlan = routed_vlan.clone();
intf.subinterfaces = None;
intf.switched_vlan = switched_vlan.clone();
let r = test_config.validate_interface_config(&intf);
assert_eq!(true, r.is_err());
intf.routed_vlan = routed_vlan.clone();
intf.subinterfaces = Some(vec![subinterfaces.clone()]);
intf.switched_vlan = None;
let r = test_config.validate_interface_config(&intf);
assert_eq!(true, r.is_err());
intf.routed_vlan = None;
intf.subinterfaces = None;
intf.switched_vlan = None;
let r = test_config.validate_interface_config(&intf);
assert_eq!(true, r.is_err());
} | rust_cleaned_test_functions.jsonl/83805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 956
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
20546,
5332,
368,
341,
286,
1077,
12418,
24269,
2638,
284,
3521,
30570,
24269,
2638,
876,
286,
1077,
1273,
5332,
284,
1855,
4452,
5332,
4283,
27057,
406,
58965,
497,
12418,
24269,
2638,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_remove_mounts() {
skip_if_not_root!();
#[derive(Debug)]
struct TestData<'a> {
mounts: Vec<String>,
// else assume no error.
error_contains: &'a str,
}
let dir = tempdir().expect("failed to create tmpdir");
let drain = slog::Discard;
let logger = slog::Logger::root(drain, o!());
let test_dir_path = dir.path().join("dir");
let test_dir_filename = test_dir_path
.to_str()
.expect("failed to create mount dir filename");
let test_file_path = dir.path().join("file");
let test_file_filename = test_file_path
.to_str()
.expect("failed to create mount file filename");
OpenOptions::new()
.create(true)
.write(true)
.open(test_file_filename)
.expect("failed to create test file");
std::fs::create_dir_all(test_dir_filename).expect("failed to create dir");
let mnt_src = dir.path().join("mnt-src");
let mnt_src_filename = mnt_src
.to_str()
.expect("failed to create mount source filename");
let mnt_dest = dir.path().join("mnt-dest");
let mnt_dest_filename = mnt_dest
.to_str()
.expect("failed to create mount destination filename");
for d in [test_dir_filename, mnt_src_filename, mnt_dest_filename].iter() {
std::fs::create_dir_all(d)
.unwrap_or_else(|_| panic!("failed to create directory {}", d));
}
// Create an actual mount
let result = baremount(
mnt_src_filename,
mnt_dest_filename,
"bind",
MsFlags::MS_BIND,
"",
&logger,
);
assert!(result.is_ok(), "mount for test setup failed");
let tests = &[
TestData {
mounts: vec![],
error_contains: "",
},
TestData {
mounts: vec!["".to_string()],
error_contains: "ENOENT: No such file or directory",
},
TestData {
mounts: vec![test_file_filename.to_string()],
error_contains: "EINVAL: Invalid argument",
},
TestData {
mounts: vec![test_dir_filename.to_string()],
error_contains: "EINVAL: Invalid argument",
},
TestData {
mounts: vec![mnt_dest_filename.to_string()],
error_contains: "",
},
];
for (i, d) in tests.iter().enumerate() {
let msg = format!("test[{}]: {:?}", i, d);
let result = remove_mounts(&d.mounts);
let msg = format!("{}: result: {:?}", msg, result);
if d.error_contains.is_empty() {
assert!(result.is_ok(), "{}", msg);
continue;
}
let error_msg = format!("{:#}", result.unwrap_err());
assert!(error_msg.contains(d.error_contains), "{}", msg);
}
} | rust_cleaned_test_functions.jsonl/32168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
57593,
82,
368,
341,
286,
10706,
11119,
7913,
12993,
0,
1428,
286,
11506,
27098,
42618,
5563,
286,
2036,
93200,
18291,
64,
29,
341,
310,
56222,
25,
11312,
3464,
29,
3554,
3374,
310,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_complete_config() {
let toml = r#"
environment_path = "/path/to/env"
use_dangerous_test_keystore = true
[passphrase_service]
type = "cmd"
[network]
type = "sim2h"
url = "ws://localhost:9000"
encryption_service_uri = "ws://localhost:9001"
decryption_service_uri = "ws://localhost:9002"
signing_service_uri = "ws://localhost:9003"
[dpki]
instance_id = "some_id"
init_params = "some_params"
[[admin_interfaces]]
driver.type = "websocket"
driver.port = 1234
"#;
let result: ConductorResult<ConductorConfig> = config_from_toml(toml);
assert_eq!(
result.unwrap(),
ConductorConfig {
environment_path: PathBuf::from("/path/to/env").into(),
network: Some(NetworkConfig::Sim2h {
url: Url::parse("ws://localhost:9000/").unwrap()
}),
signing_service_uri: None,
encryption_service_uri: None,
decryption_service_uri: None,
dpki: Some(DpkiConfig {
instance_id: "some_id".into(),
init_params: "some_params".into()
}),
passphrase_service: Some(PassphraseServiceConfig::Cmd),
keystore_path: None,
admin_interfaces: Some(vec![AdminInterfaceConfig {
driver: InterfaceDriver::Websocket { port: 1234 }
}]),
use_dangerous_test_keystore: true,
}
);
} | rust_cleaned_test_functions.jsonl/121441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 809
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
27675,
5332,
368,
341,
286,
1077,
311,
1014,
284,
435,
2,
698,
262,
4573,
2638,
284,
3521,
2343,
32429,
14358,
698,
262,
990,
814,
4003,
782,
4452,
45476,
63373,
284,
830,
271,
262,
508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_highest_bank_snapshot_post() {
solana_logger::setup();
let temp_snapshots_dir = tempfile::TempDir::new().unwrap();
let min_slot = 99;
let max_slot = 123;
common_create_bank_snapshot_files(temp_snapshots_dir.path(), min_slot, max_slot);
let highest_bank_snapshot = get_highest_bank_snapshot_post(temp_snapshots_dir.path());
assert!(highest_bank_snapshot.is_some());
assert_eq!(highest_bank_snapshot.unwrap().slot, max_slot - 1);
} | rust_cleaned_test_functions.jsonl/75080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1523,
7504,
35733,
53265,
6333,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2730,
74175,
27634,
4334,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build() -> Result<(), Box<dyn std::error::Error>> {
let mut reference_sequences = ReferenceSequences::default();
reference_sequences.insert(
String::from("sq0"),
sam::header::ReferenceSequence::new(String::from("sq0"), 8),
);
let mut builder = Builder::default();
let record = Record::try_from_sam_record(
&reference_sequences,
&sam::Record::builder()
.set_flags(Flags::empty())
.set_position(Position::try_from(2)?)
.set_cigar("4M".parse()?)
.build(),
)?;
builder.add_record(
&record,
Chunk::new(
bgzf::VirtualPosition::from(55),
bgzf::VirtualPosition::from(89),
),
)?;
let record = Record::try_from_sam_record(
&reference_sequences,
&sam::Record::builder()
.set_position(Position::try_from(6)?)
.set_cigar("2M".parse()?)
.build(),
)?;
builder.add_record(
&record,
Chunk::new(
bgzf::VirtualPosition::from(89),
bgzf::VirtualPosition::from(144),
),
)?;
let actual = builder.build();
let expected = ReferenceSequence::new(
vec![Bin::new(
4681,
vec![Chunk::new(
bgzf::VirtualPosition::from(55),
bgzf::VirtualPosition::from(144),
)],
)],
vec![bgzf::VirtualPosition::from(55)],
Some(Metadata::new(
bgzf::VirtualPosition::from(55),
bgzf::VirtualPosition::from(144),
1,
1,
)),
);
assert_eq!(actual, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/42566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1088
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
286,
1077,
5206,
5785,
58732,
284,
17207,
1514,
43945,
486,
2258,
543,
286,
5785,
58732,
7030,
1006,
310,
923,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_collapse_prev_rollback() {
let engine = TestEngineBuilder::new().build().unwrap();
let (key, value) = (b"key", b"value");
// Add a Rollback whose start ts is 1.
must_prewrite_put(&engine, key, value, key, 1);
must_rollback_collapsed(&engine, key, 1);
must_get_rollback_ts(&engine, key, 1);
// start ts is 1 will be collapsed.
must_prewrite_put(&engine, key, value, key, 2);
must_rollback_collapsed(&engine, key, 2);
must_get_none(&engine, key, 2);
must_get_rollback_ts(&engine, key, 2);
must_get_rollback_ts_none(&engine, key, 1);
// previous rollback whose start ts is 2.
must_rollback_collapsed(&engine, key, 3);
must_get_none(&engine, key, 3);
must_get_rollback_ts(&engine, key, 3);
must_get_rollback_ts_none(&engine, key, 2);
} | rust_cleaned_test_functions.jsonl/16083 | {
"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,
666,
10786,
25566,
62,
33559,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
320,
792,
11,
897,
8,
284,
320,
65,
1,
792,
497,
293,
63307,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reader_rng_insufficient_bytes() {
let mut rng = ReaderRng::new(&[][..]);
let mut v = [0; 3];
rng.fill_bytes(&mut v);
} | rust_cleaned_test_functions.jsonl/29282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22306,
66849,
34386,
26683,
12524,
368,
341,
286,
1077,
5206,
28422,
284,
25166,
49,
968,
486,
931,
2099,
63449,
496,
2558,
286,
1077,
5206,
348,
284,
508,
15,
26,
220,
18,
935,
286,
28422,
1246... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ack_settings_frame() {
let frame = SettingsFrame::ack();
let mut b = Vec::new();
b.write_frame(frame.clone()).unwrap();
assert_eq!(b, [0, 0, 0, 4, 1, 0, 0, 0, 0]);
let mut sl = &b[..];
if let FrameKind::Settings(res) = sl.read_frame().unwrap() {
assert_eq!(frame, res);
assert!(res.is_ack());
} else {
panic!("Wrong frame type")
}
} | rust_cleaned_test_functions.jsonl/93805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48447,
10853,
8929,
368,
341,
286,
1077,
4034,
284,
11296,
4369,
486,
473,
543,
286,
1077,
5206,
293,
284,
11312,
486,
931,
543,
286,
293,
3836,
8929,
15046,
15997,
6011,
15454,
543,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_iteration_sub() {
// Test difference in range.
{
assert_eq!(Iteration::new() - Iteration::new(), 0);
let test_difference = 240924246i32;
let a = Iteration::new();
let b = Iteration{current_iteration: test_difference.into()};
assert_eq!(b - a, test_difference);
assert_eq!(a - b, -test_difference);
}
// Test difference out of range.
{
let a = Iteration::new();
let b = Iteration{current_iteration: i32::MAX as i128 + 429828};
assert_eq!(b - a, i32::MAX);
assert_eq!(a - b, i32::MIN);
}
} | rust_cleaned_test_functions.jsonl/101304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62772,
5228,
368,
341,
262,
442,
3393,
6672,
304,
2088,
624,
262,
341,
286,
2060,
10714,
10297,
53101,
486,
931,
368,
481,
13704,
367,
486,
931,
1507,
220,
15,
317,
286,
1077,
1273,
47525,
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_enc_size() {
let pack = ControlPacket {
timestamp: TimeStamp::from_micros(0),
dest_sockid: SocketId(0),
control_type: ControlTypes::Handshake(HandshakeControlInfo {
init_seq_num: SeqNumber(0),
max_packet_size: 1816,
max_flow_size: 0,
shake_type: ShakeType::Conclusion,
socket_id: SocketId(0),
syn_cookie: 0,
peer_addr: [127, 0, 0, 1].into(),
info: HandshakeVsInfo::V5(HsV5Info {
crypto_size: 16,
ext_km: None,
ext_hs: None,
sid: None,
}),
}),
};
let mut ser = BytesMut::with_capacity(128);
pack.serialize(&mut ser);
let pack_deser = ControlPacket::parse(&mut ser, false).unwrap();
assert!(ser.is_empty());
assert_eq!(pack, pack_deser);
} | rust_cleaned_test_functions.jsonl/5474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 573
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13781,
2368,
368,
341,
286,
1077,
3769,
284,
7779,
16679,
341,
310,
11441,
25,
4120,
20906,
486,
1499,
73003,
82,
7,
15,
1326,
310,
3201,
33103,
307,
25,
20954,
764,
7,
15,
1326,
310,
2524,
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_encode_operations_hash() -> Result<(), failure::Error> {
let decoded = HashType::OperationListListHash.bytes_to_string(&hex::decode("acecbfac449678f1d68b90c7b7a86c9280fd373d872e072f3fb1b395681e7149")?);
let expected = "LLoads9N8uB8v659hpNhpbrLzuzLdUCjz5euiR6Lm2hd7C6sS2Vep";
assert_eq!(expected, decoded);
Ok(())
} | rust_cleaned_test_functions.jsonl/65921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
57345,
8950,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
29213,
284,
6531,
929,
486,
8432,
852,
852,
6370,
42697,
2346,
3904,
2099,
17308,
486,
18196,
445,
578,
7221,
22185... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_with_given_data() {
let input = vec![
35, 20, 15, 25, 47, 40, 62, 55, 65, 95, 102, 117, 150, 182, 127, 219, 299, 277, 309,
576,
];
let result = find_first_outlier(&input, 5);
assert_eq!(result, 127);
} | rust_cleaned_test_functions.jsonl/83363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
57653,
1769,
368,
341,
286,
1077,
1946,
284,
7486,
90515,
310,
220,
18,
20,
11,
220,
17,
15,
11,
220,
16,
20,
11,
220,
17,
20,
11,
220,
19,
22,
11,
220,
19,
15,
11,
220,
21,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aggregate_partition_timestamps() {
let metrics = ExecutionPlanMetricsSet::new();
// 1431648000000000 == 1970-01-17 13:40:48 UTC
let t1 = Utc.timestamp_nanos(1431648000000000);
// 1531648000000000 == 1970-01-18 17:27:28 UTC
let t2 = Utc.timestamp_nanos(1531648000000000);
// 1631648000000000 == 1970-01-19 21:14:08 UTC
let t3 = Utc.timestamp_nanos(1631648000000000);
// 1731648000000000 == 1970-01-21 01:00:48 UTC
let t4 = Utc.timestamp_nanos(1731648000000000);
let start_timestamp0 = MetricBuilder::new(&metrics).start_timestamp(0);
start_timestamp0.set(t1);
let end_timestamp0 = MetricBuilder::new(&metrics).end_timestamp(0);
end_timestamp0.set(t2);
let start_timestamp1 = MetricBuilder::new(&metrics).start_timestamp(0);
start_timestamp1.set(t3);
let end_timestamp1 = MetricBuilder::new(&metrics).end_timestamp(0);
end_timestamp1.set(t4);
// aggregate
let aggregated = metrics.clone_inner().aggregate_by_partition();
let mut ts = aggregated
.iter()
.filter(|metric| {
matches!(metric.value(), MetricValue::StartTimestamp(_))
&& metric.labels().is_empty()
})
.collect::<Vec<_>>();
assert_eq!(ts.len(), 1);
match ts.remove(0).value() {
MetricValue::StartTimestamp(ts) => {
assert_eq!(ts.value(), Some(t1));
}
_ => {
panic!("Not a timestamp");
}
};
let mut ts = aggregated
.iter()
.filter(|metric| {
matches!(metric.value(), MetricValue::EndTimestamp(_))
&& metric.labels().is_empty()
})
.collect::<Vec<_>>();
assert_eq!(ts.len(), 1);
match ts.remove(0).value() {
MetricValue::EndTimestamp(ts) => {
assert_eq!(ts.value(), Some(t4));
}
_ => {
panic!("Not a timestamp");
}
};
} | rust_cleaned_test_functions.jsonl/28188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
14240,
43840,
23073,
82,
368,
341,
286,
1077,
16734,
284,
30928,
20485,
27328,
1649,
486,
931,
1428,
286,
442,
220,
16,
19,
18,
16,
21,
19,
23,
15,
15,
15,
15,
15,
15,
15,
15,
15,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_hashing() {
// swapping the indices should change the hashes!
let a: i64 = 6;
let b: i64 = 2;
let mut counter: i64 = 0;
let mut s = FileStorage::new("file_test").unwrap();
s.flush().unwrap();
assert_eq!(a * b, cache!(s, test_func_2(a, b, &mut counter)));
assert_eq!(counter, 1);
let mut counter: i64 = 0;
assert_eq!(a * b, cache!(s, test_func_2(b, a, &mut counter)));
assert_eq!(counter, 1);
} | rust_cleaned_test_functions.jsonl/123187 | {
"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,
8950,
287,
368,
341,
286,
442,
63719,
279,
14937,
1265,
2297,
279,
50257,
4894,
286,
1077,
264,
25,
600,
21,
19,
284,
220,
21,
280,
286,
1077,
293,
25,
600,
21,
19,
284,
220,
17,
280,
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_complex_tree() {
assert_eq!(
use_tree_names(
"use std::collections::{self, hash_map::{HashMap}, HashSet as MyHashSet};"
),
vec![
named("collections", "use std::collections;"),
named("HashMap", "use std::collections::hash_map::HashMap;"),
named("MyHashSet", "use std::collections::HashSet as MyHashSet;")
]
);
} | rust_cleaned_test_functions.jsonl/37349 | {
"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,
41522,
11663,
368,
341,
286,
2060,
10714,
33673,
310,
990,
11663,
9187,
1006,
394,
330,
810,
1460,
486,
51137,
22964,
721,
11,
5175,
5376,
22964,
18497,
2137,
18931,
438,
3017,
44601,
11061,
698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_setuid_bit_on_own_exe() -> Result<(), Box<dyn error::Error>> {
let image = build_image(&[
"RUN chmod u+s,g+s /sbin/matchhostfsowner",
"RUN addgroup --gid 1234 app",
"RUN adduser --uid 1234 --gid 1234 --gecos '' --disabled-password app",
])?;
let output = run_container(
&image,
&["--user", "1234:1234"],
&["stat", "/sbin/matchhostfsowner"],
)?;
assert_contains_substr!(output.text, "Dropping setuid bit on /sbin/matchhostfsowner");
assert!(output.text.find("Access: (0755/-rwxr-xr-x)").is_some());
assert_eq!(Some(0), output.status.code());
Ok(())
} | rust_cleaned_test_functions.jsonl/90916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
2602,
2423,
13996,
4470,
82100,
76074,
368,
1464,
5714,
68843,
8261,
92846,
1465,
486,
1454,
2452,
341,
262,
1077,
2168,
284,
1936,
4954,
2099,
9640,
286,
330,
47390,
59615,
575,
67797,
21644... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_config_reverse() {
let yaml_string = "sorting:\n reverse: true";
let yaml = YamlLoader::load_from_str(yaml_string).unwrap()[0].clone();
assert_eq!(
Some(SortOrder::Reverse),
SortOrder::from_config(&Config::with_yaml(yaml))
);
} | rust_cleaned_test_functions.jsonl/54309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
5332,
43277,
368,
341,
286,
1077,
32246,
3904,
284,
330,
67039,
7190,
77,
220,
9931,
25,
830,
876,
286,
1077,
32246,
284,
809,
9467,
9181,
486,
1078,
5673,
2895,
7021,
9467,
3904,
568,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_crds_records() {
fn check_crds_records(crds: &Crds) {
assert_eq!(
crds.table.len(),
crds.records.values().map(IndexSet::len).sum::<usize>()
);
for (pubkey, indices) in &crds.records {
for index in indices {
let value = crds.table.index(*index);
assert_eq!(*pubkey, value.value.pubkey());
}
}
}
let mut rng = thread_rng();
let keypairs: Vec<_> = repeat_with(Keypair::new).take(128).collect();
let mut crds = Crds::default();
for k in 0..4096 {
let keypair = &keypairs[rng.gen_range(0, keypairs.len())];
let value = CrdsValue::new_rand(&mut rng, Some(keypair));
let local_timestamp = new_rand_timestamp(&mut rng);
let _ = crds.insert(value, local_timestamp);
if k % 64 == 0 {
check_crds_records(&crds);
}
}
assert!(crds.records.len() > 96);
assert!(crds.records.len() <= keypairs.len());
// Remove values one by one and assert that records stay valid.
while !crds.table.is_empty() {
let index = rng.gen_range(0, crds.table.len());
let key = crds.table.get_index(index).unwrap().0.clone();
crds.remove(&key, /*now=*/ 0);
if crds.table.len() % 64 == 0 {
check_crds_records(&crds);
}
}
assert!(crds.records.is_empty());
} | rust_cleaned_test_functions.jsonl/10458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 859
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32331,
5356,
31279,
368,
341,
286,
5168,
1779,
32331,
5356,
31279,
38962,
5356,
25,
609,
16001,
5356,
8,
341,
310,
2060,
10714,
33673,
394,
1560,
5356,
10336,
19406,
3148,
394,
1560,
5356,
64516,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_filtered_search_results_moves_up_down_list() {
let search = get_blank_search().append_search_string("t");
assert!(search.down().selection().unwrap().as_slice() == "three");
let search = get_blank_search().append_search_string("t");
assert!(search.up().selection().unwrap().as_slice() == "three");
} | rust_cleaned_test_functions.jsonl/96104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51429,
10716,
13576,
45390,
8237,
13998,
2019,
368,
341,
286,
1077,
2711,
284,
633,
56103,
10716,
1005,
5090,
10716,
3904,
445,
83,
797,
286,
2060,
10297,
1836,
18148,
1005,
23617,
1005,
15454,
1005... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sanitize_unsanitary() {
let unsanitary_tx58 = "ju9xZWuDBX4pRxX2oZkTjxU5jB4SSTgEGhX8bQ8PURNzyzqKMPPpNvWihx8zUe\
FfrbVNoAaEsNKZvGzAnTDy5bhNT9kt6KFCTBixpvrLCzg4M5UdFUQYrn1gdgjX\
pLHxcaShD81xBNaFDgnA2nkkdHnKtZt4hVSfKAmw3VRZbjrZ7L2fKZBx21CwsG\
hD6onjM2M3qZW5C8J6d1pj41MxKmZgPBSha3MyKkNLkAGFASK"
.to_string();
let unsanitary_versioned_tx = decode_and_deserialize::<VersionedTransaction>(
unsanitary_tx58,
UiTransactionEncoding::Base58,
)
.unwrap()
.1;
let expect58 = Error::invalid_params(
"invalid transaction: Transaction failed to sanitize accounts offsets correctly"
.to_string(),
);
assert_eq!(
sanitize_transaction(unsanitary_versioned_tx).unwrap_err(),
expect58
);
} | rust_cleaned_test_functions.jsonl/36140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
58652,
4907,
33082,
44806,
368,
341,
286,
1077,
6975,
276,
44806,
17805,
20,
23,
284,
330,
8613,
24,
87,
81756,
84,
3506,
55,
19,
79,
50639,
55,
17,
78,
57,
74,
51,
73,
87,
52,
20,
73... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cmp_x_lt_m() {
let code = vec![0xE0, 0x7];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.X = 0x05;
nes.next(&mut memory).unwrap();
assert_eq!(0, nes.C);
assert_eq!(0, nes.Z);
assert_eq!(1, nes.N);
} | rust_cleaned_test_functions.jsonl/38736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35193,
3212,
39164,
717,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
12606,
15,
11,
220,
15,
87,
22,
935,
286,
1077,
5206,
308,
288,
284,
356,
5584,
486,
931,
543,
286,
1077,
5206,
4938,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sign_serialize() {
assert_eq!(mem::size_of::<SecretKey>(), 32);
assert_eq!(mem::size_of::<PublicKey>(), 48 * 3);
assert_eq!(mem::size_of::<Signature>(), 48 * 2 * 3);
let msg = "abc".as_bytes();
let mut seckey = unsafe { SecretKey::uninit() };
seckey.set_by_csprng();
let pubkey = seckey.get_publickey();
let sig = seckey.sign(&msg);
assert!(sig.verify(&pubkey, &msg));
serialize_test! {SecretKey, seckey};
serialize_test! {PublicKey, pubkey};
serialize_test! {Signature, sig};
} | rust_cleaned_test_functions.jsonl/8590 | {
"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,
11172,
88686,
368,
341,
262,
2060,
10714,
10297,
10536,
486,
2141,
3575,
27638,
19773,
1592,
39019,
220,
18,
17,
317,
262,
2060,
10714,
10297,
10536,
486,
2141,
3575,
27638,
61822,
39019,
220,
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_process_vote_skips_old_vote() {
let mut vote_state = VoteState::default();
let vote = Vote::new(vec![0], Hash::default());
let slot_hashes: Vec<_> = vec![(0, vote.hash)];
assert_eq!(vote_state.process_vote(&vote, &slot_hashes, 0), Ok(()));
let recent = recent_votes(&vote_state);
assert_eq!(
vote_state.process_vote(&vote, &slot_hashes, 0),
Err(VoteError::VoteTooOld)
);
assert_eq!(recent, recent_votes(&vote_state));
} | rust_cleaned_test_functions.jsonl/43739 | {
"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,
11305,
54360,
33811,
3077,
21108,
54360,
368,
341,
286,
1077,
5206,
6910,
4387,
284,
34034,
1397,
486,
2258,
1428,
286,
1077,
6910,
284,
34034,
486,
931,
25592,
20703,
15,
1125,
6531,
486,
2258,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_token_allocations() {
let alice = Keypair::new();
let test_validator =
TestValidator::with_no_fees(alice.pubkey(), None, SocketAddrSpace::Unspecified);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
test_process_distribute_tokens_with_client(&client, alice, None);
} | rust_cleaned_test_functions.jsonl/18250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
6458,
14802,
804,
368,
341,
286,
1077,
70433,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
1273,
64959,
4035,
310,
3393,
14256,
486,
4197,
6536,
761,
5516,
17643,
558,
47773,
792,
1507,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_capsule_support_1() {
let capsule = Capsule::new(2., 1.);
let direction = Vector3::new(1., 0., 0.);
let transform = transform(0., 0., 0., 0.);
let point = capsule.support_point(&direction, &transform);
assert_ulps_eq!(Point3::new(1., 2., 0.), point);
} | rust_cleaned_test_functions.jsonl/18383 | {
"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,
52955,
1111,
25827,
62,
16,
368,
341,
286,
1077,
47639,
284,
43365,
1111,
486,
931,
7,
17,
2572,
220,
16,
58957,
286,
1077,
5106,
284,
4196,
18,
486,
931,
7,
16,
2572,
220,
15,
2572,
220,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_restore_memory() {
let page_size: usize = sysconf::page::pagesize();
let mem_regions = [
(GuestAddress(0), page_size * 2),
(GuestAddress(page_size as u64 * 3), page_size * 2),
];
let guest_memory = GuestMemoryMmap::from_ranges(&mem_regions[..]).unwrap();
// Fill the first region with 1s and the second with 2s.
let first_region = vec![1u8; page_size * 2];
guest_memory
.write(&first_region[..], GuestAddress(0))
.unwrap();
let second_region = vec![2u8; page_size * 2];
guest_memory
.write(&second_region[..], GuestAddress(page_size as u64 * 3))
.unwrap();
let memory_state = guest_memory.describe();
// Case 1: dump the full memory.
{
let memory_file = TempFile::new().unwrap();
guest_memory.dump(&mut memory_file.as_file()).unwrap();
let restored_guest_memory =
GuestMemoryMmap::restore(&memory_file.as_file(), &memory_state).unwrap();
// Check that the region contents are the same.
let mut actual_region = vec![0u8; page_size * 2];
restored_guest_memory
.read(&mut actual_region.as_mut_slice(), GuestAddress(0))
.unwrap();
assert_eq!(first_region, actual_region);
restored_guest_memory
.read(
&mut actual_region.as_mut_slice(),
GuestAddress(page_size as u64 * 3),
)
.unwrap();
assert_eq!(second_region, actual_region);
}
// Case 2: dump only the dirty pages.
{
let mut dirty_bitmap: DirtyBitmap = HashMap::new();
dirty_bitmap.insert(0, vec![0b01; 1]);
dirty_bitmap.insert(1, vec![0b10; 1]);
let file = TempFile::new().unwrap();
guest_memory
.dump_dirty(&mut file.as_file(), &dirty_bitmap)
.unwrap();
let restored_guest_memory =
GuestMemoryMmap::restore(&file.as_file(), &memory_state).unwrap();
// Check that only the dirty pages have been restored.
let zeros = vec![0u8; page_size];
let ones = vec![1u8; page_size];
let twos = vec![2u8; page_size];
let expected_first_region = [ones.as_slice(), zeros.as_slice()].concat();
let expected_second_region = [zeros.as_slice(), twos.as_slice()].concat();
let mut actual_region = vec![0u8; page_size * 2];
restored_guest_memory
.read(&mut actual_region.as_mut_slice(), GuestAddress(0))
.unwrap();
assert_eq!(expected_first_region, actual_region);
restored_guest_memory
.read(
&mut actual_region.as_mut_slice(),
GuestAddress(page_size as u64 * 3),
)
.unwrap();
assert_eq!(expected_second_region, actual_region);
}
} | rust_cleaned_test_functions.jsonl/30209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1617
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62677,
19195,
368,
341,
286,
1077,
2150,
2368,
25,
22301,
284,
5708,
6135,
486,
2893,
486,
84917,
1428,
1789,
286,
1077,
1833,
58035,
284,
2278,
310,
320,
37804,
4286,
7,
15,
701,
2150,
2368,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_term() {
let mut p = make_parser_with(r#"{{true}}"#);
p.next();
let t = p.term();
// broken for now
assert!(t.is_ok());
let t = t.unwrap();
assert!(t.is_some());
let t = t.unwrap();
assert_eq!(t.typ(), &NodeType::Bool);
if let Nodes::Bool(n) = t {
assert_eq!(n.value, Value::from(true));
} else {
assert!(false);
}
let mut p = make_parser_with(r#"{{ false }}"#);
p.next();
let t = p.term();
// broken for now
assert!(t.is_ok());
let t = t.unwrap();
assert!(t.is_some());
let t = t.unwrap();
assert_eq!(t.typ(), &NodeType::Bool);
assert_eq!(t.typ(), &NodeType::Bool);
if let Nodes::Bool(n) = t {
assert_eq!(n.value, Value::from(false));
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/8632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17464,
368,
341,
286,
1077,
5206,
281,
284,
1281,
18517,
6615,
2601,
55543,
2979,
1866,
23386,
2,
317,
286,
281,
4529,
543,
286,
1077,
259,
284,
281,
47770,
543,
286,
442,
10865,
369,
1431,
198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_is_f64(){
let json_value = Json::from_str("12").unwrap();
assert!(!json_value.is_f64());
let json_value = Json::from_str("-12").unwrap();
assert!(!json_value.is_f64());
let json_value = Json::from_str("12.0").unwrap();
assert!(json_value.is_f64());
let json_value = Json::from_str("-12.0").unwrap();
assert!(json_value.is_f64());
} | rust_cleaned_test_functions.jsonl/22748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
761,
21,
19,
3032,
286,
1077,
2951,
3142,
284,
8308,
486,
1499,
2895,
445,
16,
17,
1827,
15454,
543,
286,
2060,
0,
3471,
2236,
3142,
2079,
761,
21,
19,
5231,
286,
1077,
2951,
3142,
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_propose_before_split_and_merge() {
let mut cluster = new_node_cluster(0, 3);
let pd_client = cluster.pd_client.clone();
pd_client.disable_default_operator();
cluster.run();
cluster.must_transfer_leader(1, new_peer(1, 1));
cluster.must_put(b"k", b"v");
let propose_batch_raft_command_fp = "propose_batch_raft_command";
fail::cfg(propose_batch_raft_command_fp, "return").unwrap();
let write_req = make_write_req(&mut cluster, b"k1");
let (cb, cb_receivers) = make_cb(&write_req);
cluster
.sim
.rl()
.async_command_on_node(1, write_req, cb)
.unwrap();
// Proposed cb is called.
cb_receivers.assert_proposed_ok();
let region = cluster.get_region(b"k1");
cluster.must_split(®ion, b"k2");
cb_receivers.assert_applied_ok();
must_get_equal(&cluster.get_engine(1), b"k1", b"v");
let left = cluster.get_region(b"k1");
let right = cluster.get_region(b"k2");
let left_peer1 = find_peer(&left, 1).unwrap().to_owned();
let right_peer2 = find_peer(&right, 2).unwrap().to_owned();
cluster.must_transfer_leader(left.get_id(), left_peer1);
cluster.must_transfer_leader(right.get_id(), right_peer2);
let write_req = make_write_req(&mut cluster, b"k0");
let (cb, cb_receivers) = make_cb(&write_req);
cluster
.sim
.rl()
.async_command_on_node(1, write_req, cb)
.unwrap();
// Proposed cb is called.
cb_receivers.assert_proposed_ok();
let write_req2 = make_write_req(&mut cluster, b"k2");
let (cb2, cb_receivers2) = make_cb(&write_req2);
cluster
.sim
.rl()
.async_command_on_node(2, write_req2, cb2)
.unwrap();
// Proposed cb is called.
cb_receivers2.assert_proposed_ok();
pd_client.must_merge(left.get_id(), right.get_id());
// Write request should succeed.
cb_receivers.assert_applied_ok();
must_get_equal(&cluster.get_engine(1), b"k0", b"v");
cb_receivers2.assert_applied_ok();
must_get_equal(&cluster.get_engine(2), b"k2", b"v");
} | rust_cleaned_test_functions.jsonl/50885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 954
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21663,
960,
23708,
17052,
8378,
20888,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
1077,
7744,
8179,
284,
10652,
556,
67,
8179,
15997,
543,
262,
7744,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_text_with_byte_order_mark() {
let mut parser = Parser::new();
parser.set_language(get_language("rust")).unwrap();
// Parse UTF16 text with a BOM
let tree = parser
.parse_utf16(
&"\u{FEFF}fn a() {}".encode_utf16().collect::<Vec<_>>(),
None,
)
.unwrap();
assert_eq!(
tree.root_node().to_sexp(),
"(source_file (function_item name: (identifier) parameters: (parameters) body: (block)))"
);
assert_eq!(tree.root_node().start_byte(), 2);
// Parse UTF8 text with a BOM
let mut tree = parser.parse("\u{FEFF}fn a() {}", None).unwrap();
assert_eq!(
tree.root_node().to_sexp(),
"(source_file (function_item name: (identifier) parameters: (parameters) body: (block)))"
);
assert_eq!(tree.root_node().start_byte(), 3);
tree.edit(&InputEdit {
start_byte: 0,
old_end_byte: 0,
new_end_byte: 1,
start_position: Point::new(0, 0),
old_end_position: Point::new(0, 0),
new_end_position: Point::new(0, 1),
});
let mut tree = parser.parse(" \u{FEFF}fn a() {}", Some(&tree)).unwrap();
assert_eq!(
tree.root_node().to_sexp(),
"(source_file (ERROR (UNEXPECTED 65279)) (function_item name: (identifier) parameters: (parameters) body: (block)))"
);
assert_eq!(tree.root_node().start_byte(), 1);
tree.edit(&InputEdit {
start_byte: 0,
old_end_byte: 1,
new_end_byte: 0,
start_position: Point::new(0, 0),
old_end_position: Point::new(0, 1),
new_end_position: Point::new(0, 0),
});
let tree = parser.parse("\u{FEFF}fn a() {}", Some(&tree)).unwrap();
assert_eq!(
tree.root_node().to_sexp(),
"(source_file (function_item name: (identifier) parameters: (parameters) body: (block)))"
);
assert_eq!(tree.root_node().start_byte(), 3);
} | rust_cleaned_test_functions.jsonl/15862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 900
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
4326,
6615,
19737,
7869,
18924,
368,
341,
262,
1077,
5206,
6729,
284,
21102,
486,
931,
543,
262,
6729,
980,
29021,
5433,
29021,
445,
35788,
15197,
15454,
1428,
262,
442,
14775,
20076,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recovers_from_invalid_dynamic_config() {
let dynamic_config = make_temp_file(|writer| write!(writer, "invalid"));
let rule = rule!("test.com" => "test.com", "/a" => "/b");
{
let (builder, _) = RewriteManagerBuilder::new(Some(&dynamic_config)).unwrap_err();
let mut manager = builder.build();
assert_eq!(manager.list().cloned().collect::<Vec<_>>(), vec![]);
let mut transaction = manager.transaction();
transaction.add(rule.clone());
manager.apply(transaction).unwrap();
assert_eq!(manager.list().cloned().collect::<Vec<_>>(), vec![rule.clone()]);
}
// Verify the dynamic config file is no longer corrupt and contains the newly added rule.
let manager = RewriteManagerBuilder::new(Some(&dynamic_config)).unwrap().build();
assert_eq!(manager.list().cloned().collect::<Vec<_>>(), vec![rule]);
} | rust_cleaned_test_functions.jsonl/46496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7080,
8969,
5673,
31433,
45992,
5332,
368,
341,
286,
1077,
8741,
5332,
284,
1281,
11771,
2458,
22428,
18189,
91,
3270,
10297,
18189,
11,
330,
11808,
4010,
286,
1077,
5912,
284,
5912,
17223,
1944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_minus_real() {
let test_cases = vec![
(
Real::new(1.01001).ok(),
Real::new(-0.01).ok(),
Real::new(1.02001).ok(),
false,
),
(
Real::new(f64::MIN).ok(),
Real::new(f64::MAX).ok(),
None,
true,
),
(
Real::new(f64::MIN).ok(),
Real::new(1f64).ok(),
Real::new(f64::MIN).ok(),
false,
),
];
for (lhs, rhs, expected, is_err) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(lhs)
.push_param(rhs)
.evaluate(ScalarFuncSig::MinusReal);
if is_err {
assert!(output.is_err())
} else {
let output = output.unwrap();
assert_eq!(output, expected, "lhs={:?}, rhs={:?}", lhs, rhs);
}
}
} | rust_cleaned_test_functions.jsonl/78964 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 696
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38457,
15266,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
2399,
394,
8800,
486,
931,
7,
16,
13,
15,
16,
15,
15,
16,
568,
562,
3148,
394,
8800,
486,
931,
4080,
15,
13,
15,
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... | 3 |
#[test]
fn test_pool_acquire_order_no_timeout() {
let disposed = Arc::new(AtomicCounter::default());
let dcopy = disposed.clone();
let mut pool = counter_pool_config()
.dispose(move |_res, _| {
dcopy.increment();
})
.build()
.unwrap();
block_on(async move {
let fst = pool.acquire().await.unwrap();
let snd = pool.acquire().await.unwrap();
assert_eq!(*fst, 1);
assert_eq!(*snd, 2);
drop(snd);
let trd = pool.acquire().await.unwrap();
assert_eq!(*trd, 3);
drop(fst);
assert_eq!(disposed.value(), 2);
// shutdown must time out because a resource is held
pool = pool.drain(Duration::from_millis(50)).await.unwrap_err();
drop(trd);
pool.drain(Duration::from_millis(500)).await.unwrap();
});
} | rust_cleaned_test_functions.jsonl/99432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15709,
97523,
7869,
6536,
20537,
368,
341,
262,
1077,
25574,
284,
19689,
486,
931,
7,
65857,
14099,
486,
2258,
1423,
262,
1077,
294,
8560,
284,
25574,
15997,
543,
262,
1077,
5206,
7314,
284,
5546,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serve_rpc() -> Result<()> {
let server = make_arc_test_server();
let reply = dispatch(
server,
"echo".to_string(),
RequestMessage::from_static(&[0x08, 0x07]),
)?;
assert_eq!(ReplyMessage::from_static(&[0x07, 0x08]), reply);
Ok(())
} | rust_cleaned_test_functions.jsonl/112196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
5852,
60799,
368,
1464,
5714,
71698,
341,
286,
1077,
3538,
284,
1281,
62914,
4452,
12015,
1428,
286,
1077,
9851,
284,
6845,
1006,
310,
3538,
345,
310,
330,
3047,
3263,
983,
3904,
3148,
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_bank_fees_account() {
let (mut genesis_config, _) = create_genesis_config(500);
genesis_config.fee_calculator.lamports_per_signature = 12345;
let bank = Arc::new(Bank::new(&genesis_config));
let fees_account = bank.get_account(&sysvar::fees::id()).unwrap();
let fees = Fees::from_account(&fees_account).unwrap();
assert_eq!(
bank.fee_calculator.lamports_per_signature,
fees.fee_calculator.lamports_per_signature
);
assert_eq!(fees.fee_calculator.lamports_per_signature, 12345);
} | rust_cleaned_test_functions.jsonl/42420 | {
"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,
35733,
761,
5516,
13500,
368,
341,
286,
1077,
320,
6984,
59366,
5332,
11,
27439,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
317,
286,
59366,
5332,
833,
2127,
24005,
20022,
918,
309,
3394,
567... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_js_doc_tag_serialization() {
assert_eq!(
serde_json::to_value(JsDocTag::Callback {
name: "Predicate".to_string(),
doc: None,
})
.unwrap(),
json!({
"kind": "callback",
"name": "Predicate",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Constructor).unwrap(),
json!({
"kind": "constructor",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Deprecated {
doc: Some("comment".to_string()),
})
.unwrap(),
json!({
"kind": "deprecated",
"doc": "comment",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Enum {
type_ref: "number".to_string(),
doc: None,
})
.unwrap(),
json!({
"kind": "enum",
"type": "number",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Extends {
type_ref: "OtherType<T>".to_string(),
doc: None,
})
.unwrap(),
json!({
"kind": "extends",
"type": "OtherType<T>",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Param {
name: "arg".to_string(),
type_ref: Some("number".to_string()),
doc: Some("comment".to_string()),
})
.unwrap(),
json!({
"kind": "param",
"name": "arg",
"type": "number",
"doc": "comment",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Param {
name: "arg".to_string(),
type_ref: None,
doc: Some("comment".to_string()),
})
.unwrap(),
json!({
"kind": "param",
"name": "arg",
"doc": "comment",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Public).unwrap(),
json!({ "kind": "public" })
);
assert_eq!(
serde_json::to_value(JsDocTag::Private).unwrap(),
json!({ "kind": "private" })
);
assert_eq!(
serde_json::to_value(JsDocTag::Property {
name: "prop".to_string(),
type_ref: "string".to_string(),
doc: None,
})
.unwrap(),
json!({
"kind": "property",
"name": "prop",
"type": "string",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Protected).unwrap(),
json!({ "kind": "protected" })
);
assert_eq!(
serde_json::to_value(JsDocTag::ReadOnly).unwrap(),
json!({ "kind": "readonly" })
);
assert_eq!(
serde_json::to_value(JsDocTag::Return {
type_ref: Some("string".to_string()),
doc: Some("comment".to_string()),
})
.unwrap(),
json!({
"kind": "return",
"type": "string",
"doc": "comment",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Template {
name: "T".to_string(),
doc: None,
})
.unwrap(),
json!({
"kind": "template",
"name": "T",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::This {
type_ref: "Record<string, unknown>".to_string(),
doc: None,
})
.unwrap(),
json!({
"kind": "this",
"type": "Record<string, unknown>",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::TypeDef {
name: "Interface".to_string(),
type_ref: "object".to_string(),
doc: None,
})
.unwrap(),
json!({
"kind": "typedef",
"name": "Interface",
"type": "object",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::TypeRef {
type_ref: "Map<string, string>".to_string(),
doc: None,
})
.unwrap(),
json!({
"kind": "type",
"type": "Map<string, string>",
})
);
assert_eq!(
serde_json::to_value(JsDocTag::Unsupported {
value: "unsupported".to_string()
})
.unwrap(),
json!({
"kind": "unsupported",
"value": "unsupported",
})
);
} | rust_cleaned_test_functions.jsonl/119533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26250,
18869,
9372,
25602,
2022,
368,
341,
262,
2060,
10714,
33673,
414,
61570,
9455,
486,
983,
3142,
16368,
82,
9550,
5668,
486,
7494,
341,
286,
829,
25,
330,
36329,
3263,
983,
3904,
3148,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_unified() {
let storage = StorageReadPoolConfig {
use_unified_pool: Some(false),
..Default::default()
};
assert!(!storage.use_unified_pool());
let coprocessor = CoprReadPoolConfig::default();
assert!(coprocessor.use_unified_pool());
let mut cfg = ReadPoolConfig {
storage,
coprocessor,
..Default::default()
};
assert!(cfg.is_unified_pool_enabled());
cfg.storage.use_unified_pool = Some(false);
cfg.coprocessor.use_unified_pool = Some(false);
assert!(!cfg.is_unified_pool_enabled());
} | rust_cleaned_test_functions.jsonl/2142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
4907,
1870,
368,
341,
286,
1077,
5819,
284,
14693,
4418,
10551,
2648,
341,
310,
990,
4907,
1870,
15709,
25,
4329,
3576,
1326,
310,
5241,
3675,
486,
2258,
741,
286,
2605,
286,
2060,
0,
3471... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_new_no_parent() {
solana_logger::setup();
let (genesis_block, _) = GenesisBlock::new(10_000);
let bank = Bank::new(&genesis_block);
trace!("get balance {}", genesis_block.mint_id);
let bal = bank.get_balance(&genesis_block.mint_id);
trace!("done get balance {}", bal);
assert_eq!(bal, 10_000);
} | rust_cleaned_test_functions.jsonl/41878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
5921,
6536,
15960,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
320,
77894,
7113,
11,
27439,
284,
40788,
4713,
486,
931,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
6073... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part2() {
assert_eq!(solve(&as_input(INPUT)).1, 32);
assert_eq!(solve(&as_input(INPUT2)).1, 126);
} | rust_cleaned_test_functions.jsonl/82251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
17,
368,
341,
286,
2060,
10714,
10297,
59419,
2099,
300,
5898,
57911,
4579,
16,
11,
220,
18,
17,
317,
286,
2060,
10714,
10297,
59419,
2099,
300,
5898,
57911,
17,
4579,
16,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_apply_without_alpha_rgba() {
let mut rgba = Rgba([0, 0, 0, 0]);
rgba.apply_without_alpha(|s| s + 1);
assert_eq!(rgba, Rgba([1, 1, 1, 0]));
} | rust_cleaned_test_functions.jsonl/46642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
39904,
26633,
95229,
368,
341,
286,
1077,
5206,
23524,
284,
431,
56380,
2561,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
2558,
286,
23524,
13045,
39904,
26633,
22428,
82,
91,
274,
488,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_status_service_fail_endpoints_can_trigger_fails() {
let _guard = fail::FailScenario::setup();
let temp_dir = tempfile::TempDir::new().unwrap();
let mut status_server = StatusServer::new(
1,
ConfigController::default(),
Arc::new(SecurityConfig::default()),
MockRouter,
temp_dir.path().to_path_buf(),
)
.unwrap();
let addr = "127.0.0.1:0".to_owned();
let _ = status_server.start(addr);
let client = Client::new();
let addr = status_server.listening_addr().to_string();
let handle = status_server.thread_pool.spawn(async move {
// test add fail point
let uri = Uri::builder()
.scheme("http")
.authority(addr.as_str())
.path_and_query("/fail/a_test_fail_name_nobody_else_is_using")
.build()
.unwrap();
let mut req = Request::new(Body::from("return"));
*req.method_mut() = Method::PUT;
*req.uri_mut() = uri;
let res = client.request(req).await.unwrap();
assert_eq!(res.status(), StatusCode::OK);
});
block_on(handle).unwrap();
status_server.stop();
let true_only_if_fail_point_triggered = || {
fail_point!("a_test_fail_name_nobody_else_is_using", |_| { true });
false
};
assert!(true_only_if_fail_point_triggered());
} | rust_cleaned_test_functions.jsonl/6917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 768
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
12267,
22121,
6213,
7706,
27421,
32925,
761,
6209,
368,
341,
286,
1077,
716,
26098,
284,
3690,
486,
19524,
54031,
486,
15188,
543,
286,
1077,
2730,
4334,
284,
54819,
486,
12151,
6184,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read_array() {
assert_eq!(from_str("["), Err(SyntaxError(EOFWhileParsingValue, 1, 2)));
assert_eq!(from_str("[1"), Err(SyntaxError(EOFWhileParsingArray, 1, 3)));
assert_eq!(from_str("[1,"), Err(SyntaxError(EOFWhileParsingValue, 1, 4)));
assert_eq!(from_str("[1,]"), Err(SyntaxError(InvalidSyntax, 1, 4)));
assert_eq!(from_str("[6 7]"), Err(SyntaxError(InvalidSyntax, 1, 4)));
assert_eq!(from_str("[]"), Ok(Array(vec![])));
assert_eq!(from_str("[ ]"), Ok(Array(vec![])));
assert_eq!(from_str("[true]"), Ok(Array(vec![Boolean(true)])));
assert_eq!(from_str("[ false ]"), Ok(Array(vec![Boolean(false)])));
assert_eq!(from_str("[null]"), Ok(Array(vec![Null])));
assert_eq!(from_str("[3, 1]"),
Ok(Array(vec![U64(3), U64(1)])));
assert_eq!(from_str("\n[3, 2]\n"),
Ok(Array(vec![U64(3), U64(2)])));
assert_eq!(from_str("[2, [4, 1]]"),
Ok(Array(vec![U64(2), Array(vec![U64(4), U64(1)])])));
} | rust_cleaned_test_functions.jsonl/6547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 600
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
3858,
368,
341,
286,
2060,
10714,
10297,
1499,
2895,
445,
1183,
701,
257,
15495,
93549,
1454,
7,
23483,
7983,
68839,
1130,
11,
220,
16,
11,
220,
17,
4945,
286,
2060,
10714,
10297,
1499,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_begin_end() {
let _executor = fasync::Executor::new().expect("unable to create executor");
let tmp_dir = TempDir::new().expect("should have created tempdir");
let file_path = tmp_dir.path().join("tmp_file");
let tmp_file = File::create(&file_path).expect("should have created file");
let mut expected = "".to_string();
// Begin-End message filter test
let mut filter_options = LocalOptions::default();
filter_options.begin.push("second".to_string());
filter_options.begin.push("fifth".to_string());
filter_options.end.push("fourth".to_string());
filter_options.end.push("sixth".to_string());
let mut l = Listener::new(tmp_file, filter_options, Decorator::new());
let mut message3 = LogMessage {
pid: 0,
tid: 0,
severity: 0,
time: 0,
msg: String::default(),
dropped_logs: 0,
tags: vec![],
};
message3.msg = "first".to_string();
l.log(copy_log_message(&message3));
message3.msg = "second".to_string();
l.log(copy_log_message(&message3));
message3.msg = "third".to_string();
l.log(copy_log_message(&message3));
message3.msg = "fourth".to_string();
l.log(copy_log_message(&message3));
message3.msg = "fifth".to_string();
l.log(copy_log_message(&message3));
message3.msg = "sixth".to_string();
l.log(copy_log_message(&message3));
message3.msg = "seventh".to_string();
l.log(copy_log_message(&message3));
expected.push_str("[00000.000000][0][0][] INFO: second\n");
expected.push_str("[00000.000000][0][0][] INFO: third\n");
expected.push_str("[00000.000000][0][0][] INFO: fifth\n");
// Compare the log output with the expectation.
let mut tmp_file = File::open(&file_path).expect("should have opened the file");
let mut content = String::new();
tmp_file.read_to_string(&mut content).expect("something went wrong reading the file");
assert_eq!(content, expected);
} | rust_cleaned_test_functions.jsonl/113585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 944
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23338,
6213,
368,
341,
286,
1077,
716,
80787,
284,
282,
7692,
486,
25255,
486,
931,
1005,
17119,
445,
45928,
311,
1855,
31558,
797,
286,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_https() {
let svcb = parse_record("crypto.cloudflare.com. 299 IN HTTPS 1 . alpn=h2, ipv4hint=162.159.135.79,162.159.136.79, echconfig=\"/gkAQwATY2xvdWRmbGFyZS1lc25pLmNvbQAgUbBtC3UeykwwE6C87TffqLJ/1CeaAvx3iESGyds85l8AIAAEAAEAAQAAAAA=\" ipv6hint=2606:4700:7::a29f:874f,2606:4700:7::a29f:884f,");
assert_eq!(svcb.svc_priority(), 1);
assert_eq!(*svcb.target_name(), Name::root());
} | rust_cleaned_test_functions.jsonl/62129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
26817,
368,
341,
286,
1077,
13559,
7221,
284,
4715,
14192,
445,
35772,
38299,
905,
13,
220,
17,
24,
24,
1964,
61044,
220,
16,
659,
452,
19958,
54113,
17,
11,
45475,
19,
46125,
28,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_applicable_cursor_position() {
check_assist_not_applicable(introduce_named_lifetime, r#"impl Cursor<'_><|> {"#);
check_assist_not_applicable(introduce_named_lifetime, r#"impl Cursor<|><'_> {"#);
} | rust_cleaned_test_functions.jsonl/109552 | {
"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,
7913,
8191,
46114,
28601,
9661,
368,
341,
286,
1779,
12083,
380,
7913,
8191,
46114,
1548,
47845,
71834,
98827,
11,
435,
55543,
6383,
28067,
18291,
62,
1784,
91,
29,
5212,
2,
317,
286,
1779,
12083,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_option() {
let value: Option<string::String> = super::decode("null").unwrap();
assert_eq!(value, None);
let value: Option<string::String> = super::decode("\"jodhpurs\"").unwrap();
assert_eq!(value, Some("jodhpurs".into_string()));
} | rust_cleaned_test_functions.jsonl/6555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
9672,
368,
341,
286,
1077,
897,
25,
6959,
4947,
486,
703,
29,
284,
2256,
486,
18196,
445,
2921,
1827,
15454,
543,
286,
2060,
10714,
10297,
957,
11,
2240,
626,
286,
1077,
897,
25,
6959,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mac_parsing() {
for test in wycheproof::mac::TestName::all() {
let _kat = wycheproof::mac::TestSet::load(test).unwrap();
}
} | rust_cleaned_test_functions.jsonl/5837 | {
"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,
22802,
620,
28598,
368,
341,
262,
369,
1273,
304,
289,
5641,
747,
75636,
486,
11948,
486,
2271,
675,
486,
541,
368,
341,
286,
1077,
716,
33755,
284,
289,
5641,
747,
75636,
486,
11948,
486,
2271,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dep() {
let array = [0xA, 0xB, 0xC, 0xD, 0xE, 0xF];
let data = Data {
twentyone: 21u64,
twentytwo: 22u64,
twentythree: 23u64,
twentyfour: 24u64,
twentyfive: 25u32,
array: &array,
};
assert_eq!(TestDep { thirty: 30 }, TestDep::new(&data, 1, 2, 3, 4, 5));
} | rust_cleaned_test_functions.jsonl/21192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49258,
368,
341,
286,
1077,
1334,
284,
508,
15,
14673,
11,
220,
15,
14377,
11,
220,
15,
12125,
11,
220,
15,
15764,
11,
220,
15,
12606,
11,
220,
15,
9770,
935,
286,
1077,
821,
284,
2885,
341,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_safe_head() {
let rope: Rope = Rope::from_str("foo");
let res = safe_head(rope);
assert_eq!(res, Some(('f', Rope::from_str("oo"))));
} | rust_cleaned_test_functions.jsonl/20278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34067,
13138,
368,
341,
262,
1077,
33420,
25,
97896,
284,
97896,
486,
1499,
2895,
445,
7975,
797,
262,
1077,
592,
284,
6092,
13138,
78009,
375,
317,
262,
2060,
10714,
10297,
416,
11,
4329,
45675,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bomful_invalid_utf8_to_cow_without_bom_handling_and_without_replacement() {
assert!(UTF_8
.decode_without_bom_handling_and_without_replacement(
b"\xEF\xBB\xBF\xE2\x82\xAC\x80\xC3\xA4"
)
.is_none());
} | rust_cleaned_test_functions.jsonl/90262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
880,
316,
1262,
31433,
39453,
23,
2346,
666,
363,
39904,
880,
316,
75642,
8378,
39904,
1288,
16101,
368,
341,
286,
2060,
10297,
8561,
62,
23,
198,
310,
659,
18196,
39904,
880,
316,
75642,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug_local() {
let vi = get_version_info!();
let s = format!("{:?}", vi);
assert_eq!(
s,
"VersionInfo { crate_name: \"rustc_tools_util\", major: 0, minor: 2, patch: 0 }"
);
} | rust_cleaned_test_functions.jsonl/19653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
13564,
368,
341,
286,
1077,
3275,
284,
633,
9438,
3109,
0,
543,
286,
1077,
274,
284,
3561,
88928,
25,
52652,
3275,
317,
286,
2060,
10714,
33673,
310,
274,
345,
310,
330,
5637,
1731,
314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lddw() {
test_interpreter_and_jit_asm!(
"
lddw r0, 0x1122334455667788
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x1122334455667788 } },
2
);
} | rust_cleaned_test_functions.jsonl/58991 | {
"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,
50573,
29406,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
326,
631,
86,
435,
15,
11,
220,
15,
87,
16,
16,
17,
17,
18,
18,
19,
19,
20,
20,
21,
21,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_decimal_str() {
assert_eq!(U256::from_decimal_str(""), Err(ParseError::Empty));
assert_eq!(U256::from_decimal_str("0"), Ok(U256::ZERO));
assert_eq!(U256::from_decimal_str("00"), Ok(U256::ZERO));
assert_eq!(U256::from_decimal_str("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), Ok(U256::ZERO));
assert_eq!(U256::from_decimal_str("1"), Ok(U256::ONE));
assert_eq!(
U256::from_decimal_str(
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
),
Ok(u256h!(
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
))
);
assert_eq!(
U256::from_decimal_str(
"115792089237316195423570985008687907853269984665640564039457584007913129639936"
),
Err(ParseError::Overflow)
);
assert_eq!(
U256::from_decimal_str(
"1000000000000000000000000000000000000000000000000000000000000000000000000000000"
),
Err(ParseError::Overflow)
);
assert!(U256::from_decimal_str("12a3").is_err());
} | rust_cleaned_test_functions.jsonl/68066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 642
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
74429,
2895,
368,
341,
286,
2060,
10714,
10297,
52,
17,
20,
21,
486,
1499,
74429,
2895,
86076,
15495,
71812,
1454,
486,
3522,
1106,
286,
2060,
10714,
10297,
52,
17,
20,
21,
486,
1499,
7442... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_into_iter_project() {
let path = get_test_path("alltypes_plain.parquet");
let result = vec![path]
.iter()
.map(|p| SerializedFileReader::try_from(p.as_path()).unwrap())
.flat_map(|r| {
let schema = "message schema { OPTIONAL INT32 id; }";
let proj = parse_message_type(&schema).ok();
r.into_iter().project(proj).unwrap()
})
.map(|r| format!("{}", r))
.collect::<Vec<_>>()
.join(",");
assert_eq!(
result,
"{id: 4},{id: 5},{id: 6},{id: 7},{id: 2},{id: 3},{id: 0},{id: 1}"
);
} | rust_cleaned_test_functions.jsonl/27259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
22306,
45514,
11723,
16352,
368,
341,
286,
1077,
1815,
284,
633,
4452,
2638,
445,
541,
9242,
41015,
33277,
23300,
797,
286,
1077,
1102,
284,
7486,
20703,
2343,
921,
310,
659,
2015,
741,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poll_timeouts_if_source_has_no_events() {
let source = FakeSource::default();
let mut reader = InternalEventReader {
events: VecDeque::new(),
source: Some(Box::new(source)),
};
assert!(!reader
.poll(Some(Duration::from_secs(0)), &InternalEventFilter)
.unwrap());
} | rust_cleaned_test_functions.jsonl/101473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40002,
3009,
11672,
11119,
10347,
21778,
6536,
19691,
368,
341,
286,
1077,
2530,
284,
36965,
3608,
486,
2258,
1428,
286,
1077,
5206,
6604,
284,
15412,
1556,
5062,
341,
310,
4357,
25,
11312,
73891,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sum_of_potentials() {
let left_image = [[1, 9].to_vec(), [5, 6].to_vec()].to_vec();
let right_image = [[6, 3].to_vec(), [6, 6].to_vec()].to_vec();
let mut diffusion_graph = DiffusionGraph::initialize(left_image, right_image, 2, 1.);
diffusion_graph.potentials[0][0][2][0] = 9.4;
diffusion_graph.potentials[0][0][3][0] = -1.8;
diffusion_graph.potentials[0][1][0][0] = 6.7;
diffusion_graph.potentials[0][1][0][1] = -1.4;
diffusion_graph.potentials[1][0][1][0] = 4.1;
assert_eq!(true, approx_equal(7.6, diffusion_graph.sum_of_potentials(0, 0, 0), 1E-6));
assert_eq!(true, approx_equal(6.7, diffusion_graph.sum_of_potentials(0, 1, 0), 1E-6));
assert_eq!(true, approx_equal(-1.4, diffusion_graph.sum_of_potentials(0, 1, 1), 1E-6));
assert_eq!(true, approx_equal(4.1, diffusion_graph.sum_of_potentials(1, 0, 0), 1E-6));
assert_eq!(true, approx_equal(0., diffusion_graph.sum_of_potentials(1, 1, 0), 1E-6));
assert_eq!(true, approx_equal(0., diffusion_graph.sum_of_potentials(1, 1, 1), 1E-6));
} | rust_cleaned_test_functions.jsonl/70576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
3575,
57952,
8476,
368,
341,
286,
1077,
2115,
4954,
284,
4318,
16,
11,
220,
24,
936,
983,
13251,
1507,
508,
20,
11,
220,
21,
936,
983,
13251,
57590,
983,
13251,
543,
286,
1077,
1290,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_inc_multiple() {
for i in 0..250 {
let source = "+".repeat(i);
let instructions = Parser::parse_instructions(&Parser::parse_string(source.as_str()));
assert_eq!(instructions, vec![Instruction::INC(1); i]);
}
} | rust_cleaned_test_functions.jsonl/56691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
31285,
45233,
368,
341,
262,
369,
600,
304,
220,
15,
496,
17,
20,
15,
341,
286,
1077,
2530,
284,
6630,
3263,
30624,
1956,
317,
286,
1077,
11221,
284,
21102,
486,
6400,
82427,
2099,
6570,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_css_border_1() {
assert_eq!(
parse_style_border("5px solid red"),
Ok(StyleBorderSide {
border_width: PixelValue::px(5.0),
border_style: BorderStyle::Solid,
border_color: ColorU {
r: 255,
g: 0,
b: 0,
a: 255
},
})
);
} | rust_cleaned_test_functions.jsonl/114000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25924,
31940,
62,
16,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
15117,
31940,
445,
20,
1767,
6437,
2518,
4461,
310,
7622,
7,
2323,
10691,
16384,
341,
394,
3886,
7927,
25,
27469,
1130,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_expression() {
expect_printed("new MyClass()", "new MyClass();\n");
expect_printed("new MyClass(a, b, c)", "new MyClass(a, b, c);\n");
expect_printed("new function() {}()", "new function() {}();\n");
expect_printed("new a.b.c(e)", "new a.b.c(e);\n");
expect_printed("new a.b.c(...e, a)", "new a.b.c(...e, a);\n");
expect_printed("new a", "new a();\n");
} | rust_cleaned_test_functions.jsonl/93445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
28068,
368,
341,
262,
1720,
10064,
291,
445,
931,
83826,
50514,
330,
931,
83826,
2129,
59,
77,
797,
262,
1720,
10064,
291,
445,
931,
83826,
2877,
11,
293,
11,
272,
11583,
330,
931,
83826,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collect_root_ancestors() {
{
let mut graph = graph::CachedStableGraph::new();
let idx0 = graph.add_node(&("0".to_string().into()));
let idx1 = graph.add_node(&("1".to_string().into()));
let idx2 = graph.add_node(&("2".to_string().into()));
let idx3 = graph.add_node(&("3".to_string().into()));
graph.add_edge(
idx0,
idx1,
IncludePosition {
line: 2,
start: 0,
end: 0,
},
);
graph.add_edge(
idx1,
idx2,
IncludePosition {
line: 3,
start: 0,
end: 0,
},
);
graph.add_edge(
idx3,
idx1,
IncludePosition {
line: 4,
start: 0,
end: 0,
},
);
let roots = graph.collect_root_ancestors(idx2);
assert_eq!(roots, vec![idx3, idx0]);
let roots = graph.collect_root_ancestors(idx1);
assert_eq!(roots, vec![idx3, idx0]);
let roots = graph.collect_root_ancestors(idx0);
assert_eq!(roots, vec![]);
let roots = graph.collect_root_ancestors(idx3);
assert_eq!(roots, vec![]);
}
{
let mut graph = graph::CachedStableGraph::new();
let idx0 = graph.add_node(&("0".to_string().into()));
let idx1 = graph.add_node(&("1".to_string().into()));
let idx2 = graph.add_node(&("2".to_string().into()));
let idx3 = graph.add_node(&("3".to_string().into()));
graph.add_edge(
idx0,
idx1,
IncludePosition {
line: 2,
start: 0,
end: 0,
},
);
graph.add_edge(
idx0,
idx2,
IncludePosition {
line: 3,
start: 0,
end: 0,
},
);
graph.add_edge(
idx1,
idx3,
IncludePosition {
line: 5,
start: 0,
end: 0,
},
);
let roots = graph.collect_root_ancestors(idx3);
assert_eq!(roots, vec![idx0]);
let roots = graph.collect_root_ancestors(idx2);
assert_eq!(roots, vec![idx0]);
let roots = graph.collect_root_ancestors(idx1);
assert_eq!(roots, vec![idx0]);
let roots = graph.collect_root_ancestors(idx0);
assert_eq!(roots, vec![]);
}
{
let mut graph = graph::CachedStableGraph::new();
let idx0 = graph.add_node(&("0".to_string().into()));
let idx1 = graph.add_node(&("1".to_string().into()));
let idx2 = graph.add_node(&("2".to_string().into()));
let idx3 = graph.add_node(&("3".to_string().into()));
graph.add_edge(
idx0,
idx1,
IncludePosition {
line: 2,
start: 0,
end: 0,
},
);
graph.add_edge(
idx2,
idx3,
IncludePosition {
line: 3,
start: 0,
end: 0,
},
);
graph.add_edge(
idx1,
idx3,
IncludePosition {
line: 5,
start: 0,
end: 0,
},
);
let roots = graph.collect_root_ancestors(idx3);
assert_eq!(roots, vec![idx0, idx2]);
let roots = graph.collect_root_ancestors(idx2);
assert_eq!(roots, vec![]);
let roots = graph.collect_root_ancestors(idx1);
assert_eq!(roots, vec![idx0]);
let roots = graph.collect_root_ancestors(idx0);
assert_eq!(roots, vec![]);
}
{
let mut graph = graph::CachedStableGraph::new();
let idx0 = graph.add_node(&("0".to_string().into()));
let idx1 = graph.add_node(&("1".to_string().into()));
let idx2 = graph.add_node(&("2".to_string().into()));
let idx3 = graph.add_node(&("3".to_string().into()));
graph.add_edge(
idx0,
idx1,
IncludePosition {
line: 2,
start: 0,
end: 0,
},
);
graph.add_edge(
idx1,
idx2,
IncludePosition {
line: 4,
start: 0,
end: 0,
},
);
graph.add_edge(
idx1,
idx3,
IncludePosition {
line: 6,
start: 0,
end: 0,
},
);
let roots = graph.collect_root_ancestors(idx3);
assert_eq!(roots, vec![idx0]);
let roots = graph.collect_root_ancestors(idx2);
assert_eq!(roots, vec![idx0]);
let roots = graph.collect_root_ancestors(idx1);
assert_eq!(roots, vec![idx0]);
let roots = graph.collect_root_ancestors(idx0);
assert_eq!(roots, vec![]);
}
} | rust_cleaned_test_functions.jsonl/56154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
12993,
62,
681,
267,
1087,
368,
341,
262,
341,
286,
1077,
5206,
4771,
284,
4771,
486,
70293,
623,
480,
11212,
486,
931,
1428,
286,
1077,
7187,
15,
284,
4771,
1364,
5084,
2099,
445,
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_hash_url() {
let specifier = deno_core::resolve_url(
"data:application/javascript,console.log(\"Hello%20Deno\");",
)
.unwrap();
assert_eq!(hash_url(&specifier, &MediaType::JavaScript), "data:///d300ea0796bd72b08df10348e0b70514c021f2e45bfe59cec24e12e97cd79c58.js");
} | rust_cleaned_test_functions.jsonl/2837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
2903,
368,
341,
262,
1077,
97616,
284,
3371,
78,
15467,
486,
17325,
2903,
1006,
414,
330,
691,
25,
5132,
9837,
11,
5354,
1665,
36014,
9707,
4,
17,
15,
35,
11790,
59,
5038,
756,
262,
1727... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_encoded_bytes_size() {
let n = bytes::ENC_GROUP_SIZE;
let tbl: Vec<(usize, usize)> = vec![
(0, n + 1 + number::U64_SIZE),
(n / 2, n + 1 + number::U64_SIZE),
(n, 2 * (n + 1) + number::U64_SIZE),
];
for (x, y) in tbl {
assert_eq!(max_encoded_bytes_size(x), y);
}
} | rust_cleaned_test_functions.jsonl/79736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
73069,
12524,
2368,
368,
341,
286,
1077,
308,
284,
5820,
486,
16226,
20130,
4098,
280,
286,
1077,
21173,
25,
11312,
28706,
51878,
11,
22301,
16018,
284,
7486,
90515,
310,
320,
15,
11,
308,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_1() {
let inp = "start-A
start-b
A-c
A-b
b-d
A-end
b-end";
let parsed = input_generator(inp);
assert_eq!(solve_part1(&parsed), 10);
} | rust_cleaned_test_functions.jsonl/115634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
368,
341,
286,
1077,
32344,
284,
330,
2468,
6691,
198,
2468,
1455,
198,
32,
1786,
198,
32,
1455,
198,
65,
1737,
198,
32,
13068,
198,
65,
13068,
876,
286,
1077,
15676,
284,
1946,
25813,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_separator() {
assert_eq!(is_valid_separator(b'_'), true);
assert_eq!(is_valid_separator(b'\''), true);
assert_eq!(is_valid_separator(b'0'), false);
assert_eq!(is_valid_separator(128), false);
} | rust_cleaned_test_functions.jsonl/88903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
8337,
58204,
368,
341,
286,
2060,
10714,
10297,
285,
8337,
58204,
1883,
36777,
4567,
830,
317,
286,
2060,
10714,
10297,
285,
8337,
58204,
1883,
6,
10169,
4567,
830,
317,
286,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_city() {
let res = ",1997,20.5".parse::<Climate>();
assert_eq!(res, Err(ParseClimateError::NoCity));
assert_eq!(res.unwrap_err().to_string(), "no city name");
} | rust_cleaned_test_functions.jsonl/10205 | {
"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,
6536,
24971,
368,
341,
286,
1077,
592,
284,
3670,
16,
24,
24,
22,
11,
17,
15,
13,
20,
3263,
6400,
27638,
82046,
3913,
286,
2060,
10714,
10297,
416,
11,
15495,
71812,
82046,
1454,
486,
2753,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_regions() {
// No regions provided should return error.
assert_eq!(
format!("{:?}", GuestMemory::new(&vec![]).err().unwrap()),
format!("{:?}", Error::NoMemoryRegions)
);
let start_addr1 = GuestAddress(0x0);
let start_addr2 = GuestAddress(0x400);
let guest_mem =
GuestMemory::new(&vec![(start_addr1, 0x400), (start_addr2, 0x400)]).unwrap();
assert_eq!(guest_mem.num_regions(), 2);
assert!(guest_mem.address_in_range(GuestAddress(0x200)));
assert!(guest_mem.address_in_range(GuestAddress(0x600)));
let end_addr = GuestAddress(0x800);
assert!(!guest_mem.address_in_range(end_addr));
assert_eq!(guest_mem.end_addr(), end_addr);
assert!(guest_mem.checked_offset(start_addr1, 0x700).is_some());
assert!(guest_mem.checked_offset(start_addr2, 0x800).is_none());
} | rust_cleaned_test_functions.jsonl/35877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58035,
368,
341,
286,
442,
2308,
13604,
3897,
1265,
470,
1465,
624,
286,
2060,
10714,
33673,
310,
3561,
88928,
25,
52652,
26215,
10642,
486,
931,
2099,
4083,
0,
1294,
568,
615,
1005,
15454,
14702,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rename_for_macro_args() {
test_rename(
r#"
macro_rules! foo {($i:ident) => {$i} }
fn main() {
let a<|> = "test";
foo!(a);
}"#,
"b",
r#"
macro_rules! foo {($i:ident) => {$i} }
fn main() {
let b = "test";
foo!(b);
}"#,
);
} | rust_cleaned_test_functions.jsonl/16209 | {
"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,
79399,
5478,
58810,
8384,
368,
341,
286,
1273,
79399,
1006,
310,
435,
2,
698,
262,
18072,
21407,
0,
15229,
314,
699,
72,
25,
1713,
8,
589,
13924,
72,
92,
456,
262,
5168,
1887,
368,
341,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tokenize_simplified() {
let sentence = "人人生而自由﹐在尊严和权利上一律平等。他们赋有理性和良心﹐并应以兄弟关系的精神互相对待。";
let tokens = vec![
"人人", "生", "而", "自由", "在", "尊严", "和", "权利", "上", "一律", "平等", "他们",
"赋", "有理", "性", "和", "良心", "并", "应", "以", "兄弟", "关系", "的", "精神",
"互相", "对待",
];
assert_eq!(tokens, tokenize(sentence));
} | rust_cleaned_test_functions.jsonl/64484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86508,
643,
73837,
368,
341,
197,
10217,
11652,
284,
330,
17340,
101986,
68536,
101972,
123930,
238,
18493,
112201,
33108,
102445,
17447,
109929,
105987,
1773,
99650,
100970,
18830,
21887,
105178,
111770,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decrypting_files_with_short_ciphertext() {
let kp1 = KeyPair::from_secret("000081c29e8142bb6a81bef5a92bda7a8328a5c85bb2f9542e76f9b0f94fc018".parse().unwrap()).unwrap();
let kp2 = KeyPair::from_secret("00fa7b3db73dc7dfdf8c5fbdb796d741e4488628c41fc4febd9160a866ba0f35".parse().unwrap()).unwrap();
let dir = RootDiskDirectory::at(ciphertext_path());
let store = EthStore::open(Box::new(dir)).unwrap();
let accounts = store.accounts().unwrap();
assert_eq!(accounts, vec![
StoreAccountRef::root(Address::from_str("31e9d1e6d844bd3a536800ef8d8be6a9975db509").unwrap()),
StoreAccountRef::root(Address::from_str("d1e64e5480bfaf733ba7d48712decb8227797a4e").unwrap()),
]);
let message = [1u8; 32].into();
let s1 = store.sign(&accounts[0], &"foo".into(), &message).unwrap();
let s2 = store.sign(&accounts[1], &"foo".into(), &message).unwrap();
assert!(verify_address(&accounts[0].address, &s1, &message).unwrap());
assert!(verify_address(&kp1.address(), &s1, &message).unwrap());
assert!(verify_address(&kp2.address(), &s2, &message).unwrap());
} | rust_cleaned_test_functions.jsonl/16264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80764,
287,
10931,
6615,
16673,
666,
45043,
368,
341,
1572,
10217,
60319,
16,
284,
5309,
12443,
486,
1499,
21962,
445,
15,
15,
15,
15,
23,
16,
66,
17,
24,
68,
23,
16,
19,
17,
6066,
21,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_8xy5_sub_assign_with_borrow() {
let mut machine = Machine::new(TestContext::new());
machine.register_set(0xB, 0xA);
machine.register_set(0xC, 0xD);
machine.test_opcode(0x8BC5);
assert_eq!(machine.register_get(0xB), 0xAu8.wrapping_sub(0xD));
// Should not affect VY
assert_eq!(machine.register_get(0xC), 0xD);
assert!(!machine.carry_flag_set());
// Should increment program counter by two
assert_eq!(machine.pc, PC_BEGIN + 2);
} | rust_cleaned_test_functions.jsonl/127963 | {
"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,
62,
23,
4130,
20,
5228,
20688,
6615,
880,
7768,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
1066,
262,
5662,
9929,
2602,
7,
15,
14377,
11,
220,
15,
1467... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_current_user_guild_member() {
let route = Route::GetCurrentUserGuildMember { guild_id: GUILD_ID };
assert_eq!(
route.to_string(),
format!("users/@me/guilds/{guild_id}/member", guild_id = GUILD_ID)
)
} | rust_cleaned_test_functions.jsonl/119927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
11080,
3317,
1889,
1498,
19388,
368,
341,
286,
1077,
6021,
284,
9572,
486,
62981,
1474,
72574,
9366,
314,
26411,
842,
25,
479,
18023,
3450,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_symbol() {
let arena = Arena::new();
assert_syntaxes(
&parse(&arena, ".foo", &lang()),
&[Syntax::new_atom(
&arena,
vec![SingleLineSpan {
line: 0.into(),
start_col: 0,
end_col: 4,
}],
".foo",
AtomKind::Other,
)],
);
} | rust_cleaned_test_functions.jsonl/52646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
21179,
368,
341,
286,
1077,
24902,
284,
27047,
486,
931,
1428,
286,
2060,
78894,
288,
1006,
310,
609,
6400,
2099,
30527,
11,
5933,
7975,
497,
609,
5205,
14702,
310,
44590,
33890,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rent_eager_pubkey_range_noop_range() {
let test_map = map_to_test_bad_range();
let range = Bank::pubkey_range_from_partition((0, 0, 3));
assert_eq!(
range,
Pubkey::new_from_array([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
])
..=Pubkey::new_from_array([
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x54, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff
])
);
test_map.range(range);
let range = Bank::pubkey_range_from_partition((1, 1, 3));
assert_eq!(
range,
Pubkey::new_from_array([
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
])
..=Pubkey::new_from_array([
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
])
);
test_map.range(range);
let range = Bank::pubkey_range_from_partition((2, 2, 3));
assert_eq!(
range,
Pubkey::new_from_array([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff
])
..=Pubkey::new_from_array([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff
])
);
test_map.range(range);
} | rust_cleaned_test_functions.jsonl/2546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
2204,
1409,
34014,
792,
9698,
6536,
453,
9698,
368,
341,
286,
1077,
1273,
5376,
284,
2415,
2346,
4452,
34199,
9698,
1428,
286,
1077,
2088,
284,
8547,
486,
9585,
792,
9698,
5673,
43840,
1188... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scan_black_four() {
let result = Sequence::scan(Black, Four, 0b0011110, 0b0100000, 7, 0);
let expected = [Sequence::new(1, 5, Some(5), None)];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Four, 0b0101110, 0b0010000, 7, 0);
let expected = [Sequence::new(1, 5, Some(4), None)];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Four, 0b0110110, 0b0001000, 7, 0);
let expected = [Sequence::new(1, 5, Some(3), None)];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Four, 0b0111010, 0b0000100, 7, 0);
let expected = [Sequence::new(1, 5, Some(2), None)];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Four, 0b0111100, 0b00000010, 7, 0);
let expected = [Sequence::new(1, 5, Some(1), None)];
assert_eq!(result, expected);
// open four
let result = Sequence::scan(Black, Four, 0b00111100, 0b01000010, 8, 0);
let expected = [
Sequence::new(1, 5, Some(1), None),
Sequence::new(2, 6, Some(6), None),
];
assert_eq!(result, expected);
// not open four
let result = Sequence::scan(Black, Four, 0b00111100, 0b00000010, 8, 0);
let expected = [Sequence::new(1, 5, Some(1), None)];
assert_eq!(result, expected);
// not open four
let result = Sequence::scan(Black, Four, 0b00111100, 0b01000000, 8, 0);
let expected = [Sequence::new(2, 6, Some(6), None)];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Four, 0b10111100, 0b01000010, 8, 0);
let expected = [Sequence::new(1, 5, Some(1), None)];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Four, 0b00111101, 0b01000010, 8, 0);
let expected = [Sequence::new(2, 6, Some(6), None)];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Four, 0b10111101, 0b01000010, 8, 0);
let expected = [];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Four, 0b01110110, 0b10001001, 8, 0);
let expected = [];
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/56139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1064
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
40272,
56142,
368,
341,
286,
1077,
1102,
284,
28871,
486,
16405,
7,
14417,
11,
13322,
11,
220,
15,
65,
15,
15,
16,
16,
16,
16,
15,
11,
220,
15,
65,
15,
16,
15,
15,
15,
15,
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_new() {
let bv = BitVec::new(5);
assert_eq!(
bv.iter().collect::<Vec<bool>>(),
vec![false, false, false, false, false]
);
assert_eq!(bv.count_ones(), 0);
assert_eq!(bv.count_zeros(), 5);
} | rust_cleaned_test_functions.jsonl/128587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
56937,
284,
6495,
10050,
486,
931,
7,
20,
317,
286,
2060,
10714,
33673,
310,
56937,
19471,
1005,
17384,
27638,
10050,
17028,
2452,
3148,
310,
7486,
20703,
3849,
11,
895,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_nat_config() {
let expected_subnet_lifip =
LifIpAddr { address: "192.168.0.0".parse().unwrap(), prefix: 24 };
let expected_lifip = LifIpAddr { address: "17.0.0.1".parse().unwrap(), prefix: 32 };
let ip: IpAddr = "192.168.0.0".parse().unwrap();
let expected_subnet = fidl_fuchsia_net::Subnet {
addr: fidl_fuchsia_net::IpAddress::Ipv4(Ipv4Address {
addr: match ip {
std::net::IpAddr::V4(v4addr) => v4addr.octets(),
std::net::IpAddr::V6(_) => panic!("unexpected ipv6 address"),
},
}),
prefix_len: 24,
};
let expected_pid = hal::PortId::from(1);
// should fail if all fields are set to None.
let mut nat_config = NatConfig {
enable: true,
local_subnet: None,
global_ip: None,
pid: None,
};
let result = from_nat_config(&mut nat_config);
assert_eq!(result.is_err(), true);
// should fail if local_subnet is missing.
let mut nat_config = NatConfig {
enable: true,
local_subnet: None,
global_ip: Some(expected_lifip.clone()),
pid: Some(expected_pid),
};
let result = from_nat_config(&mut nat_config);
assert_eq!(result.is_err(), true);
// should fail if global_ip is missing.
let mut nat_config = NatConfig {
enable: true,
local_subnet: Some(expected_subnet_lifip.clone()),
global_ip: None,
pid: Some(expected_pid),
};
let result = from_nat_config(&mut nat_config);
assert_eq!(result.is_err(), true);
// should fail if pid is missing.
let mut nat_config = NatConfig {
enable: true,
local_subnet: Some(expected_subnet_lifip.clone()),
global_ip: Some(expected_lifip.clone()),
pid: None,
};
let result = from_nat_config(&mut nat_config);
assert_eq!(result.is_err(), true);
// should pass when all fields are present.
let expected_wan_ip = fidl_fuchsia_net::IpAddress::Ipv4(fidl_fuchsia_net::Ipv4Address {
addr: match expected_lifip.clone().address {
IpAddr::V4(v4addr) => v4addr.octets(),
IpAddr::V6(_) => panic!("unexpected ipv6 address"),
},
});
let mut nat_config = NatConfig {
enable: true,
local_subnet: Some(expected_subnet_lifip.clone()),
global_ip: Some(expected_lifip.clone()),
pid: Some(expected_pid),
};
let result = from_nat_config(&mut nat_config);
assert_eq!(result.is_ok(), true);
let (actual_subnet, actual_wan_ip, actual_nicid) = match result {
Ok((s, w, n)) => (s, w, n),
Err(e) => panic!("NatConfig test failed: {:?}", e),
};
assert_eq!(expected_subnet, actual_subnet);
assert_eq!(expected_wan_ip, actual_wan_ip);
assert_eq!(expected_pid.to_u32(), actual_nicid);
} | rust_cleaned_test_functions.jsonl/52758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1597
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
38169,
5332,
368,
341,
286,
1077,
3601,
95681,
907,
333,
573,
4035,
310,
64763,
23378,
13986,
314,
2621,
25,
330,
16,
24,
17,
13,
16,
21,
23,
13,
15,
13,
15,
3263,
6400,
1005,
15454,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_compiled_literals() {
assert::is_true(
"
def f():
return [[]]
y = f()
y.append(1)
y == [[],1]",
);
assert::is_true(
"
def f():
return {1:2}
y = f()
y[3] = 4
y == {1:2, 3:4}",
);
// This test breaks if we compile constants deep compile the literals
// and don't deep thaw them
assert::is_true(
"
def f():
return [[]]
y = f()[0]
y.append(1)
y == [1]",
);
} | rust_cleaned_test_functions.jsonl/92429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
2181,
49643,
368,
341,
262,
2060,
486,
285,
16082,
1006,
286,
6228,
750,
282,
3932,
262,
470,
84507,
921,
88,
284,
282,
741,
88,
2057,
7,
16,
340,
88,
621,
4318,
1125,
16,
45016,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_arg_method_ordering() -> TestResult {
let mut p = Polar::new();
p.load_str(
r#"bar(2, 1);
bar(1, 1);
bar(1, 2);
bar(2, 2);"#,
)?;
qvars(
&mut p,
"bar(a, b)",
&["a", "b"],
values![[2, 1], [1, 1], [1, 2], [2, 2]],
);
Ok(())
} | rust_cleaned_test_functions.jsonl/97614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
6057,
9032,
7869,
287,
368,
1464,
3393,
2077,
341,
262,
1077,
5206,
281,
284,
55896,
486,
931,
543,
262,
281,
5104,
2895,
1006,
286,
435,
55543,
2257,
7,
17,
11,
220,
16,
317,
1843,
361... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ignore_too_many_messages_in_ihave() {
let config = GossipsubConfigBuilder::default()
.max_ihave_messages(10)
.max_ihave_length(10)
.build()
.unwrap();
//build gossipsub with full mesh
let (mut gs, _, topics) = inject_nodes1()
.peer_no(config.mesh_n_high())
.topics(vec!["test".into()])
.to_subscribe(false)
.gs_config(config.clone())
.create_network();
//add another peer not in the mesh
let peer = add_peer(&mut gs, &topics, false, false);
//peer has 20 messages
let mut seq = 0;
let message_ids: Vec<_> = (0..20)
.map(|_| random_message(&mut seq, &topics))
.map(|msg| gs.data_transform.inbound_transform(msg.clone()).unwrap())
.map(|msg| config.message_id(&msg))
.collect();
//peer sends us three ihaves
gs.handle_ihave(
&peer,
vec![(
topics[0].clone(),
message_ids[0..8].iter().cloned().collect(),
)],
);
gs.handle_ihave(
&peer,
vec![(
topics[0].clone(),
message_ids[0..12].iter().cloned().collect(),
)],
);
gs.handle_ihave(
&peer,
vec![(
topics[0].clone(),
message_ids[0..20].iter().cloned().collect(),
)],
);
let first_twelve: HashSet<_> = message_ids.iter().take(12).collect();
//we send iwant only for the first 10 messages
let mut sum = 0;
assert_eq!(
count_control_msgs(&gs, |p, action| match action {
GossipsubControlAction::IWant { message_ids } =>
p == &peer && {
assert!(first_twelve.is_superset(&message_ids.iter().collect()));
sum += message_ids.len();
true
},
_ => false,
}),
2,
"the third ihave should get ignored and no iwant sent"
);
assert_eq!(sum, 10, "exactly the first ten ihaves should be processed");
//after a heartbeat everything is forgotten
gs.heartbeat();
gs.handle_ihave(
&peer,
vec![(
topics[0].clone(),
message_ids[10..20].iter().cloned().collect(),
)],
);
//we sent 20 iwant messages
let mut sum = 0;
assert_eq!(
count_control_msgs(&gs, |p, action| match action {
GossipsubControlAction::IWant { message_ids } =>
p == &peer && {
sum += message_ids.len();
true
},
_ => false,
}),
3
);
assert_eq!(sum, 20, "exactly 20 iwants should get sent");
} | rust_cleaned_test_functions.jsonl/66939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1708
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
2346,
78,
22101,
23428,
1243,
5318,
19016,
368,
341,
286,
1077,
2193,
284,
479,
41473,
1966,
2648,
3297,
486,
2258,
741,
310,
659,
2810,
5318,
19016,
23428,
7,
16,
15,
340,
310,
659,
2810... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_kdtree_search() {
let m = Matrix::new(5, 2, vec![1., 2.,
8., 0.,
6., 10.,
3., 6.,
0., 3.]);
let mut tree = KDTree::new(3);
tree.build(m);
// search first leaf
let (kn, _) = tree.search_leaf(&vec![3., 4.9], 1).unwrap();
assert_eq!(kn.pairs, vec![(0, (2.0f64 * 2.0f64 + 2.9f64 * 2.9f64).sqrt())]);
// search tree
let (ind, dist) = tree.search(&vec![3., 4.9], 1).unwrap();
assert_eq!(ind, vec![3]);
assert_eq!(dist, vec![1.0999999999999996]);
let (ind, dist) = tree.search(&vec![3., 4.9], 3).unwrap();
assert_eq!(ind, vec![3, 0, 4]);
assert_eq!(dist, vec![1.0999999999999996, 3.5227829907617076, 3.551056180912941]);
// search first leaf
let (kn, _) = tree.search_leaf(&vec![3., 4.9], 2).unwrap();
assert_eq!(kn.pairs, vec![(0, (2.0f64 * 2.0f64 + 2.9f64 * 2.9f64).sqrt()),
(4, (3.0f64 * 3.0f64 + (4.9f64 - 3.0f64) * (4.9f64 - 3.0f64)).sqrt())]);
// search tree
let (ind, dist) = tree.search(&vec![3., 4.9], 2).unwrap();
assert_eq!(ind, vec![3, 0]);
assert_eq!(dist, vec![1.0999999999999996, 3.5227829907617076]);
} | rust_cleaned_test_functions.jsonl/114538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 837
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
8047,
765,
10716,
368,
341,
286,
1077,
296,
284,
11631,
486,
931,
7,
20,
11,
220,
17,
11,
7486,
20703,
16,
2572,
220,
17,
38088,
11070,
220,
23,
2572,
220,
15,
38088,
11070,
220,
21,
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_content_type_colliions() {
assert!(mt_mt_collide("application/json", "application/json"));
assert!(mt_mt_collide("*/json", "application/json"));
assert!(mt_mt_collide("*/*", "application/json"));
assert!(mt_mt_collide("application/*", "application/json"));
assert!(mt_mt_collide("application/*", "*/json"));
assert!(mt_mt_collide("something/random", "something/random"));
assert!(!mt_mt_collide("text/*", "application/*"));
assert!(!mt_mt_collide("*/text", "*/json"));
assert!(!mt_mt_collide("*/text", "application/test"));
assert!(!mt_mt_collide("something/random", "something_else/random"));
assert!(!mt_mt_collide("something/random", "*/else"));
assert!(!mt_mt_collide("*/random", "*/else"));
assert!(!mt_mt_collide("something/*", "random/else"));
} | rust_cleaned_test_functions.jsonl/67666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7495,
1819,
10211,
742,
908,
368,
341,
286,
2060,
10297,
2501,
65944,
43597,
577,
445,
5132,
8931,
497,
330,
5132,
8931,
4010,
286,
2060,
10297,
2501,
65944,
43597,
577,
445,
1812,
2236,
497,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concurrent_write_error() {
let dir = tempfile::Builder::new()
.prefix("test_concurrent_write_error")
.tempdir()
.unwrap();
let cfg = Config {
dir: dir.path().to_str().unwrap().to_owned(),
bytes_per_sync: ReadableSize::kb(1024),
target_file_size: ReadableSize::kb(1024),
..Default::default()
};
let entry = vec![b'x'; 1024];
let engine = Arc::new(Engine::open(cfg.clone()).unwrap());
let mut ctx = ConcurrentWriteContext::new(engine.clone());
// The second of three writes will fail.
let seq = AtomicU64::new(0);
fail::cfg_callback("file_pipe_log::append", move || {
match seq.fetch_add(1, std::sync::atomic::Ordering::Relaxed) {
1 => fail::cfg("log_fd::write::err", "return").unwrap(),
2 => fail::remove("log_fd::write::err"),
_ => {}
}
})
.unwrap();
let entry_clone = entry.clone();
ctx.write_ext(move |e| {
e.write(&mut generate_batch(1, 1, 11, Some(&entry_clone)), false)
.unwrap();
});
let entry_clone = entry.clone();
ctx.write_ext(move |e| {
e.write(&mut generate_batch(2, 1, 11, Some(&entry_clone)), false)
.unwrap_err();
});
let entry_clone = entry.clone();
ctx.write_ext(move |e| {
e.write(&mut generate_batch(3, 1, 11, Some(&entry_clone)), false)
.unwrap();
});
ctx.join();
fail::remove("file_pipe_log::append");
assert_eq!(
10,
engine
.fetch_entries_to::<MessageExtTyped>(1, 1, 11, None, &mut vec![])
.unwrap()
);
assert_eq!(
0,
engine
.fetch_entries_to::<MessageExtTyped>(2, 1, 11, None, &mut vec![])
.unwrap()
);
assert_eq!(
10,
engine
.fetch_entries_to::<MessageExtTyped>(3, 1, 11, None, &mut vec![])
.unwrap()
);
{
let _f1 = FailGuard::new("log_fd::write::err", "return");
let _f2 = FailGuard::new("log_fd::truncate::err", "return");
let entry_clone = entry.clone();
ctx.write_ext(move |e| {
catch_unwind_silent(|| {
e.write(&mut generate_batch(1, 11, 21, Some(&entry_clone)), false)
})
.unwrap_err();
});
ctx.join();
}
engine
.write(&mut generate_batch(1, 11, 21, Some(&entry)), true)
.unwrap();
drop(ctx);
drop(engine);
let engine = Engine::open(cfg).unwrap();
assert_eq!(
20,
engine
.fetch_entries_to::<MessageExtTyped>(1, 1, 21, None, &mut vec![])
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/55361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
3231,
9165,
4096,
368,
341,
262,
1077,
5419,
284,
54819,
486,
3297,
486,
931,
741,
286,
659,
11849,
445,
1944,
3382,
3231,
9165,
4096,
1138,
286,
659,
3888,
3741,
741,
286,
659,
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_get_header_type_with_commit() {
let header = [0x63, 0x6F, 0x6D, 0x6D, 0x69, 0x74, 32u8, 0x31, 0x35, 0x0];
assert_eq!(Object::Commit, get_header_type(&header));
} | rust_cleaned_test_functions.jsonl/108328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8757,
1819,
6615,
36346,
368,
341,
286,
1077,
4247,
284,
508,
15,
87,
21,
18,
11,
220,
15,
87,
21,
37,
11,
220,
15,
87,
21,
35,
11,
220,
15,
87,
21,
35,
11,
220,
15,
87,
21,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fair_reads() {
let (tx, rx) = futures::sync::mpsc::channel(10);
let (trigger, tripwire) = Tripwire::new();
let dir = tempdir().unwrap();
let config = file::FileConfig {
include: vec![dir.path().join("*")],
start_at_beginning: true,
max_read_bytes: 1,
oldest_first: false,
..test_default_file_config(&dir)
};
let older_path = dir.path().join("z_older_file");
let mut older = File::create(&older_path).unwrap();
sleep();
let newer_path = dir.path().join("a_newer_file");
let mut newer = File::create(&newer_path).unwrap();
writeln!(&mut older, "hello i am the old file").unwrap();
writeln!(&mut older, "i have been around a while").unwrap();
writeln!(&mut older, "you can read newer files at the same time").unwrap();
writeln!(&mut newer, "and i am the new file").unwrap();
writeln!(&mut newer, "this should be interleaved with the old one").unwrap();
writeln!(&mut newer, "which is fine because we want fairness").unwrap();
sleep();
let source = file::file_source(&config, config.data_dir.clone().unwrap(), tx);
let mut rt = tokio::runtime::Runtime::new().unwrap();
rt.spawn(source.select(tripwire).map(|_| ()).map_err(|_| ()));
sleep();
drop(trigger);
shutdown_on_idle(rt);
let received = wait_with_timeout(
rx.map(|event| event.as_log().get(&event::MESSAGE).unwrap().clone())
.collect(),
);
assert_eq!(
received,
vec![
"hello i am the old file".into(),
"and i am the new file".into(),
"i have been around a while".into(),
"this should be interleaved with the old one".into(),
"you can read newer files at the same time".into(),
"which is fine because we want fairness".into(),
]
);
} | rust_cleaned_test_functions.jsonl/13347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 950
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
1310,
66628,
368,
341,
286,
1077,
320,
3998,
11,
19111,
8,
284,
36823,
486,
12996,
486,
1307,
2388,
486,
10119,
7,
16,
15,
317,
286,
1077,
320,
18468,
11,
8411,
35531,
8,
284,
26754,
3553... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rejects_empty_exception_fields() {
let mut processor = NormalizeProcessor::new(Arc::new(StoreConfig::default()), None);
let mut exception = Annotated::new(Exception {
value: Annotated::new("".to_string().into()),
ty: Annotated::new("".to_string()),
..Default::default()
});
process_value(&mut exception, &mut processor, ProcessingState::root()).unwrap();
assert!(exception.value().is_none());
assert!(exception.meta().has_errors());
} | rust_cleaned_test_functions.jsonl/14078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
583,
82,
15124,
17499,
12132,
368,
341,
262,
1077,
5206,
17654,
284,
68092,
22946,
486,
931,
4346,
1287,
486,
931,
7,
6093,
2648,
486,
2258,
11858,
2240,
626,
262,
1077,
5206,
4683,
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... | 1 |
#[test]
fn test_treesitter_indent_rust_2() {
test_treesitter_indent("indent.rs", "source.rust");
// Currently this fails because we can't align the parameters of a closure yet
} | rust_cleaned_test_functions.jsonl/18666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75791,
3248,
69045,
1710,
590,
62,
17,
368,
341,
262,
1273,
75791,
3248,
69045,
445,
32840,
25638,
497,
330,
2427,
1746,
590,
797,
1066,
262,
442,
24150,
419,
14525,
1576,
582,
646,
944,
5285,
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 |
#[test]
fn test_in_memory_write() -> anyhow::Result<()> {
let schema = Arc::new(DataSchema::new(vec![
DataField::new("col_i", DataType::Int64, false),
DataField::new("col_s", DataType::String, false),
]));
let col0 = Series::new(vec![0 as i64, 1, 2]);
let col1 = Series::new(vec!["str1", "str2", "str3"]);
let block = DataBlock::create_by_array(schema.clone(), vec![col0.clone(), col1.clone()]);
let buffer = write_in_memory(block)?;
let cursor = Cursor::new(buffer);
let mut reader =
read::RecordReader::try_new(cursor, None, None, Arc::new(|_, _| true), None)?;
let arrow_schema = schema.to_arrow();
if let Some(maybe_batch) = reader.next() {
let batch = maybe_batch?;
assert_eq!(batch.schema().as_ref(), &arrow_schema);
assert_eq!(batch.column(0), &col0.get_array_ref());
assert_eq!(batch.column(1), &col1.get_array_ref());
Ok(())
} else {
bail!("empty record set?")
}
} | rust_cleaned_test_functions.jsonl/115548 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
19195,
9165,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
10802,
284,
19689,
486,
931,
18959,
8632,
486,
931,
25592,
90515,
310,
2885,
1877,
486,
931,
445,
2074,
5318,
497,
33172,
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... | 5 |
#[test]
fn test_params_from_route() {
let mut request = Request::new().with_route("/test/route/query?arg1=1&arg2=2".to_string());
let params: HashMap<String, String> = [("arg1".to_string(), "1".to_string()),
("arg2".to_string(), "2".to_string())]
.iter().cloned().collect();
request = request.query_params_from_route();
assert_eq!(request.get_query_params(), params)
} | rust_cleaned_test_functions.jsonl/60431 | {
"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,
6745,
5673,
28109,
368,
341,
262,
1077,
5206,
1681,
284,
6145,
486,
931,
1005,
4197,
28109,
4283,
1944,
7382,
2133,
66762,
30,
858,
16,
28,
16,
5,
858,
17,
28,
17,
3263,
983,
3904,
1423,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_small_packet() {
let tx = test_tx();
let mut packet = sigverify::make_packet_from_transaction(tx);
packet.data[0] = 0xff;
packet.data[1] = 0xff;
packet.meta.size = 2;
let res = sigverify::do_get_packet_offsets(&packet, 0);
assert_eq!(res, Err(PacketError::InvalidLen));
} | rust_cleaned_test_functions.jsonl/22073 | {
"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,
31966,
21078,
368,
341,
286,
1077,
9854,
284,
1273,
17805,
543,
286,
1077,
5206,
10151,
284,
8366,
12446,
486,
6927,
21078,
5673,
28884,
27301,
626,
286,
10151,
2196,
58,
15,
60,
284,
220,
15,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_open_sync() {
use std::io::prelude::*;
let tmp = tempfile::tempdir().unwrap();
let dir = tmp.path().to_owned();
crate::write_sync(&dir, "my-key", b"hello world").unwrap();
let mut handle = crate::SyncReader::open(&dir, "my-key").unwrap();
let mut str = String::new();
handle.read_to_string(&mut str).unwrap();
handle.check().unwrap();
assert_eq!(str, String::from("hello world"));
} | rust_cleaned_test_functions.jsonl/64593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
23008,
368,
341,
286,
990,
1460,
486,
815,
486,
1726,
52538,
56162,
286,
1077,
4174,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
5419,
284,
4174,
3875,
1005,
983,
51973,
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... | 1 |
#[test]
fn test_clean_and_unclean_slot() {
let mut index = AccountsIndex::<bool>::default();
assert_eq!(0, index.uncleaned_roots.len());
index.add_root(1);
assert_eq!(1, index.uncleaned_roots.len());
index.clean_dead_slot(1);
assert_eq!(0, index.uncleaned_roots.len());
} | rust_cleaned_test_functions.jsonl/20860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19573,
8378,
76576,
2675,
27563,
368,
341,
286,
1077,
5206,
1922,
284,
40655,
1552,
27638,
2641,
6831,
2258,
543,
286,
2060,
10714,
10297,
15,
11,
1922,
13,
1347,
2675,
291,
26608,
2412,
19406,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_two_channel() {
let commands = super::channels_to_commands(
&vec![
"trades.BTC-26MAR21.raw".to_string(),
"ticker.BTC-26MAR21.100ms".to_string(),
],
true,
);
assert_eq!(2, commands.len());
assert_eq!(
r#"{"method": "public/subscribe", "params": {"channels": ["trades.BTC-26MAR21.raw","ticker.BTC-26MAR21.100ms"]}}"#,
commands[0]
);
assert_eq!(
r#"{"method": "public/set_heartbeat", "params": {"interval": 10}}"#,
commands[1]
);
} | rust_cleaned_test_functions.jsonl/133008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
14571,
368,
341,
286,
1077,
11293,
284,
2256,
486,
32425,
2346,
44151,
1006,
310,
609,
4083,
90515,
394,
330,
376,
3452,
1785,
7749,
12,
17,
21,
60661,
17,
16,
18152,
3263,
983,
3904,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_variable_sized_nulls() {
let array =
StringArray::from(vec![Some("a"), Some("bc"), None, Some("defh")]).data();
let arrays = vec![array.as_ref()];
let mut mutable = MutableArrayData::new(arrays, false, 0);
mutable.extend(0, 1, 3);
let result = mutable.freeze();
let result = StringArray::from(Arc::new(result));
let expected = StringArray::from(vec![Some("bc"), None]);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/102339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14635,
643,
1506,
15162,
82,
368,
341,
286,
1077,
1334,
4035,
310,
923,
1857,
486,
1499,
25592,
20703,
8373,
445,
64,
3975,
4329,
445,
8904,
3975,
2240,
11,
4329,
445,
750,
71,
899,
10697,
691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primary_expression_identifier_reference() {
assert_parse_success!(
primary_expression(false, false),
"abc123",
Expression::Identifier {
loc: Some(((1, 0), (1, 6)).into()),
name: "abc123".to_string()
}
);
} | rust_cleaned_test_functions.jsonl/66469 | {
"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,
45314,
28068,
33176,
25433,
368,
341,
262,
2060,
21039,
18632,
33673,
286,
6028,
28068,
3576,
11,
895,
1326,
286,
330,
13683,
16,
17,
18,
756,
286,
16378,
486,
8714,
341,
310,
1329,
25,
4329,
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_parse_valid_s3_get_bucket_policy() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"s3-get-bucket-policy.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = S3Client::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = GetBucketPolicyRequest::default();
let result = client.get_bucket_policy(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/29199 | {
"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,
21039,
8337,
643,
18,
3062,
38749,
22773,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
82,
18,
22491,
145... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u64_leading_zero_bytes() {
proptest!(niters(2000), |(x in any::<u64>())| {
prop_assert_eq!(u64_leading_zero_bytes_ref(x), u64_leading_zero_bytes(x));
});
} | rust_cleaned_test_functions.jsonl/97281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
21,
19,
11751,
2228,
19359,
12524,
368,
341,
286,
462,
70334,
10297,
44068,
388,
7,
17,
15,
15,
15,
701,
760,
7,
87,
304,
894,
27638,
84,
21,
19,
92783,
91,
341,
310,
2004,
16553,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_null_array_slice() {
let array1 = NullArray::new(32);
let array2 = array1.slice(8, 16);
assert_eq!(array2.len(), 16);
assert_eq!(array2.null_count(), 16);
assert_eq!(array2.offset(), 8);
} | rust_cleaned_test_functions.jsonl/29645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
3858,
26488,
368,
341,
286,
1077,
1334,
16,
284,
18084,
1857,
486,
931,
7,
18,
17,
626,
286,
1077,
1334,
17,
284,
1334,
16,
14530,
7,
23,
11,
220,
16,
21,
317,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.