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_list_of_string_dictionary_from_json() {
let schema = Schema::new(vec![Field::new(
"events",
List(Box::new(Field::new(
"item",
Dictionary(Box::new(DataType::UInt64), Box::new(DataType::Utf8)),
true,
))),
true,
)]);
let builder = ReaderBuilder::new()
.with_schema(Arc::new(schema))
.with_batch_size(64);
let mut reader: Reader<File> = builder
.build::<File>(File::open("test/data/list_string_dict_nested.json").unwrap())
.unwrap();
let batch = reader.next().unwrap().unwrap();
assert_eq!(1, batch.num_columns());
assert_eq!(3, batch.num_rows());
let schema = reader.schema();
let batch_schema = batch.schema();
assert_eq!(schema, batch_schema);
let events = schema.column_with_name("events").unwrap();
assert_eq!(
&List(Box::new(Field::new(
"item",
Dictionary(Box::new(DataType::UInt64), Box::new(DataType::Utf8)),
true
))),
events.1.data_type()
);
let evs_list = batch
.column(events.0)
.as_any()
.downcast_ref::<ListArray>()
.unwrap();
let evs_list = evs_list.values();
let evs_list = evs_list
.as_any()
.downcast_ref::<DictionaryArray<UInt64Type>>()
.unwrap();
assert_eq!(6, evs_list.len());
assert!(evs_list.is_valid(1));
assert_eq!(DataType::Utf8, evs_list.value_type());
// dict from the events list
let dict_el = evs_list.values();
let dict_el = dict_el.as_any().downcast_ref::<StringArray>().unwrap();
assert_eq!(3, dict_el.len());
assert_eq!("Elect Leader", dict_el.value(0));
assert_eq!("Do Ballot", dict_el.value(1));
assert_eq!("Send Data", dict_el.value(2));
} | rust_cleaned_test_functions.jsonl/22604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1069
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
3575,
3904,
42605,
5673,
9455,
368,
341,
286,
1077,
10802,
284,
12539,
486,
931,
25592,
20703,
1877,
486,
931,
1006,
310,
330,
12389,
756,
310,
1759,
67758,
486,
931,
57788,
486,
931,
1006,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incorrect_sd() -> Result<()> {
let mut msg =
b"<13>1 2021-03-18T20:30:00.123Z 74794bfb6795 root 8449 - [incorrect x] message"
.to_vec();
let mut codec = test_codec();
let decoded = codec.decode(msg.as_mut_slice(), 0)?.unwrap();
let expected = literal!({
"hostname": "74794bfb6795",
"severity": "notice",
"facility": "user",
"appname": "root",
"msg": "message",
"procid": "8449",
"protocol": "RFC5424",
"protocol_version": 1,
"timestamp": 1_616_099_400_123_000_000_u64
});
assert_eq!(
tremor_script::utils::sorted_serialize(&expected)?,
tremor_script::utils::sorted_serialize(&decoded)?
);
Ok(())
} | rust_cleaned_test_functions.jsonl/89207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
19928,
40168,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
3750,
4035,
310,
293,
22476,
16,
18,
29,
16,
220,
17,
15,
17,
16,
12,
15,
18,
12,
16,
23,
51,
17,
15,
25,
18,
15,
25,
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... | 4 |
#[test]
fn test_mono_to_stereo_can_have_the_source_changed() {
let mut mono = MonoToStereoProcessor::new(1);
mono.set_source_channel(0);
let mut samples = [1., 0.1, 1., 0.1, 1., 0.1, 1., 0.1, 1., 0.1, 1., 0.1];
let mut input = InterleavedAudioBuffer::new(2, &mut samples);
mono.process(&mut input);
for sample_index in 0..input.num_samples() {
for channel_index in 0..input.num_channels() {
let sample = *input.get(channel_index, sample_index);
assert_f_eq!(sample, 1.);
}
}
} | rust_cleaned_test_functions.jsonl/11995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60080,
2346,
1261,
64853,
27421,
67301,
16068,
10347,
25213,
368,
341,
286,
1077,
5206,
39674,
284,
12691,
1249,
80350,
24612,
22946,
486,
931,
7,
16,
317,
286,
39674,
980,
10347,
14571,
7,
15,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_linuxcontainer_pause_bad_status() {
let ret = new_linux_container_and_then(|mut c: LinuxContainer| {
c.status.transition(ContainerState::Paused);
c.pause().map_err(|e| anyhow!(e))
});
assert!(ret.is_err(), "Expecting error, Got {:?}", ret);
assert!(format!("{:?}", ret).contains("failed to pause container"))
} | rust_cleaned_test_functions.jsonl/16616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77463,
3586,
59989,
34199,
4773,
368,
341,
286,
1077,
2112,
284,
501,
77463,
15847,
8378,
68367,
22428,
6984,
272,
25,
14340,
4502,
91,
341,
3374,
310,
272,
4299,
42792,
75145,
1397,
486,
52749,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_as_json() {
test_none_with_ctx(cast_any_as_any::<Time, Json>);
// TODO: add more case for other TimeType
let cs = vec![
// Add time_type filed here is to make maintainer know clearly that what is the type of the time.
(
Time::parse_utc_datetime("2000-01-01T12:13:14", 0).unwrap(),
TimeType::DateTime,
Json::String("2000-01-01 12:13:14.000000".to_string()),
),
(
Time::parse_utc_datetime("2000-01-01T12:13:14.6666", 0).unwrap(),
TimeType::DateTime,
Json::String("2000-01-01 12:13:15.000000".to_string()),
),
(
Time::parse_utc_datetime("2000-01-01T12:13:14", 6).unwrap(),
TimeType::DateTime,
Json::String("2000-01-01 12:13:14.000000".to_string()),
),
(
Time::parse_utc_datetime("2000-01-01T12:13:14.6666", 6).unwrap(),
TimeType::DateTime,
Json::String("2000-01-01 12:13:14.666600".to_string()),
),
(
Time::parse_utc_datetime("2019-09-01", 0).unwrap(),
TimeType::DateTime,
Json::String("2019-09-01 00:00:00.000000".to_string()),
),
(
Time::parse_utc_datetime("2019-09-01", 6).unwrap(),
TimeType::DateTime,
Json::String("2019-09-01 00:00:00.000000".to_string()),
),
];
for (input, time_type, expect) in cs {
let mut ctx = EvalContext::default();
let result = cast_any_as_any::<Time, Json>(&mut ctx, &Some(input.clone()));
let result_str = result.as_ref().map(|x| x.as_ref().map(|x| x.to_string()));
let log = format!(
"input: {}, expect_time_type: {:?}, real_time_type: {:?}, expect: {}, result: {:?}",
&input,
time_type,
input.get_time_type(),
&expect,
result_str
);
assert_eq!(input.get_time_type(), time_type, "{}", log);
check_result(Some(&expect), &result, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/101818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
11898,
9455,
368,
341,
286,
1273,
31488,
6615,
15147,
1337,
559,
37248,
11898,
37248,
27638,
1462,
11,
8308,
29,
626,
286,
442,
5343,
25,
912,
803,
1142,
369,
1008,
4120,
929,
198,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_binary_expr() {
test_walk(
"a+b",
vec![
"File",
"ExprStmt",
"BinaryExpr",
"IdentifierExpr",
"IdentifierExpr",
],
)
} | rust_cleaned_test_functions.jsonl/3323 | {
"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,
31761,
21915,
368,
341,
310,
1273,
56131,
1006,
394,
330,
64,
35093,
756,
394,
7486,
90515,
503,
330,
1703,
756,
503,
330,
16041,
31063,
756,
503,
330,
21338,
16041,
756,
503,
330,
8714,
16041,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_lockup_linear() {
let e = Env::init(None);
let users = Users::init(&e);
let amount = d(60000, TOKEN_DECIMALS);
e.set_time_sec(GENESIS_TIMESTAMP_SEC);
let lockups = e.get_account_lockups(&users.alice);
assert!(lockups.is_empty());
let lockup = Lockup {
account_id: users.alice.valid_account_id(),
schedule: Schedule(vec![
Checkpoint {
timestamp: GENESIS_TIMESTAMP_SEC,
balance: 0,
},
Checkpoint {
timestamp: GENESIS_TIMESTAMP_SEC + ONE_YEAR_SEC,
balance: amount,
},
]),
claimed_balance: 0,
termination_config: None,
};
let balance: WrappedBalance = e.add_lockup(&e.owner, amount, &lockup).unwrap_json();
assert_eq!(balance.0, amount);
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups.len(), 1);
assert_eq!(lockups[0].1.total_balance, amount);
assert_eq!(lockups[0].1.claimed_balance, 0);
assert_eq!(lockups[0].1.unclaimed_balance, 0);
// 1/3 unlock
e.set_time_sec(GENESIS_TIMESTAMP_SEC + ONE_YEAR_SEC / 3);
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups[0].1.total_balance, amount);
assert_eq!(lockups[0].1.claimed_balance, 0);
assert_eq!(lockups[0].1.unclaimed_balance, amount / 3);
// Claim tokens
ft_storage_deposit(&users.alice, TOKEN_ID, &users.alice.account_id);
let res: WrappedBalance = e.claim(&users.alice).unwrap_json();
assert_eq!(res.0, amount / 3);
let balance = e.ft_balance_of(&users.alice);
assert_eq!(balance, amount / 3);
// Check lockup after claim
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups[0].1.total_balance, amount);
assert_eq!(lockups[0].1.claimed_balance, amount / 3);
assert_eq!(lockups[0].1.unclaimed_balance, 0);
// 1/2 unlock
e.set_time_sec(GENESIS_TIMESTAMP_SEC + ONE_YEAR_SEC / 2);
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups[0].1.total_balance, amount);
assert_eq!(lockups[0].1.claimed_balance, amount / 3);
assert_eq!(lockups[0].1.unclaimed_balance, amount / 6);
// Remove storage from token to verify claim refund.
storage_force_unregister(&users.alice, TOKEN_ID);
let balance = e.ft_balance_of(&users.alice);
assert_eq!(balance, 0);
let res: WrappedBalance = e.claim(&users.alice).unwrap_json();
assert_eq!(res.0, 0);
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups[0].1.total_balance, amount);
assert_eq!(lockups[0].1.claimed_balance, amount / 3);
assert_eq!(lockups[0].1.unclaimed_balance, amount / 6);
// Claim again but with storage deposit
ft_storage_deposit(&users.alice, TOKEN_ID, &users.alice.account_id);
let res: WrappedBalance = e.claim(&users.alice).unwrap_json();
assert_eq!(res.0, amount / 6);
let balance = e.ft_balance_of(&users.alice);
assert_eq!(balance, amount / 6);
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups[0].1.total_balance, amount);
assert_eq!(lockups[0].1.claimed_balance, amount / 2);
assert_eq!(lockups[0].1.unclaimed_balance, 0);
// 2/3 unlock
e.set_time_sec(GENESIS_TIMESTAMP_SEC + ONE_YEAR_SEC * 2 / 3);
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups[0].1.claimed_balance, amount / 2);
assert_eq!(lockups[0].1.unclaimed_balance, amount / 6);
// Claim tokens
let res: WrappedBalance = e.claim(&users.alice).unwrap_json();
assert_eq!(res.0, amount / 6);
let balance = e.ft_balance_of(&users.alice);
assert_eq!(balance, amount / 3);
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups[0].1.claimed_balance, amount * 2 / 3);
assert_eq!(lockups[0].1.unclaimed_balance, 0);
// Claim again with no unclaimed_balance
let res: WrappedBalance = e.claim(&users.alice).unwrap_json();
assert_eq!(res.0, 0);
let balance = e.ft_balance_of(&users.alice);
assert_eq!(balance, amount / 3);
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups[0].1.claimed_balance, amount * 2 / 3);
assert_eq!(lockups[0].1.unclaimed_balance, 0);
// full unlock
e.set_time_sec(GENESIS_TIMESTAMP_SEC + ONE_YEAR_SEC);
let lockups = e.get_account_lockups(&users.alice);
assert_eq!(lockups[0].1.claimed_balance, amount * 2 / 3);
assert_eq!(lockups[0].1.unclaimed_balance, amount / 3);
// Final claim
let res: WrappedBalance = e.claim(&users.alice).unwrap_json();
assert_eq!(res.0, amount / 3);
let balance = e.ft_balance_of(&users.alice);
assert_eq!(balance, amount * 2 / 3);
let lockups = e.get_account_lockups(&users.alice);
assert!(lockups.is_empty());
// Manually checking the lockup by index
let lockup = e.get_lockup(0);
assert_eq!(lockup.claimed_balance, amount);
assert_eq!(lockup.unclaimed_balance, 0);
} | rust_cleaned_test_functions.jsonl/52663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9818,
454,
40674,
368,
341,
262,
1077,
384,
284,
37039,
486,
2327,
26717,
317,
262,
1077,
3847,
284,
14627,
486,
2327,
2099,
68,
317,
262,
1077,
3311,
284,
294,
7,
21,
15,
15,
15,
15,
11,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_words() {
let mut state = new();
{
let words = ["burrito", "like","a"];
let mut iter=words.iter().cloned().map(RCow::from);
let param = RemoveWords {
string: "Monads are like a burrito wrapper.".into(),
words: DynTrait::from_borrowing_ptr(&mut iter,CowStrIter),
};
assert_eq!(&*remove_words(&mut state, param), "Monads are wrapper.");
}
{
let words = ["largest","is"];
let mut iter=words.iter().cloned().map(RCow::from);
let param = RemoveWords {
string: "The largest planet is jupiter.".into(),
words: DynTrait::from_borrowing_ptr(&mut iter,CowStrIter),
};
assert_eq!(&*remove_words(&mut state, param), "The planet jupiter.");
}
} | rust_cleaned_test_functions.jsonl/66068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 451
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
18981,
368,
341,
286,
1077,
5206,
1584,
284,
501,
543,
286,
341,
310,
1077,
4244,
284,
4383,
11240,
28041,
497,
330,
4803,
2198,
64,
6332,
310,
1077,
5206,
5367,
28,
5761,
19471,
1005,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_manifest_generation_environment() {
let mut m = Manifest {
pkg_ident: PackageIdent::from_str("core/nginx").unwrap(),
metadata_name: "nginx-latest".to_owned(),
image: "core/nginx:latest".to_owned(),
count: 3,
service_topology: Default::default(),
service_group: Some("group1".to_owned()),
config: None,
ring_secret_name: Some("deltaechofoxtrot".to_owned()),
binds: vec![],
persistent_storage: None,
environment: vec![
"FOO=bar".parse().unwrap(),
"QUOTES=quo\"te".parse().unwrap(),
],
};
let expected = include_str!("../tests/KubernetesManifestTestEnvironment.yaml");
let mut o = vec![];
m.generate(&mut o).unwrap();
let out = String::from_utf8(o).unwrap();
assert_eq!(out, expected);
} | rust_cleaned_test_functions.jsonl/32939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 476
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74269,
64191,
51774,
368,
341,
286,
1077,
5206,
296,
284,
39361,
341,
310,
24793,
38399,
25,
16906,
28301,
486,
1499,
2895,
445,
2153,
69261,
1827,
15454,
3148,
310,
11160,
1269,
25,
330,
73561,
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_benchmark_id_make_directory_name_unique() {
let existing_id = BenchmarkId::new(
"group".to_owned(),
Some("function".to_owned()),
Some("value".to_owned()),
None,
);
let mut directories = HashSet::new();
directories.insert(existing_id.as_directory_name().to_owned());
let mut new_id = existing_id.clone();
new_id.ensure_directory_name_unique(&directories);
assert_eq!("group/function/value_2", new_id.as_directory_name());
directories.insert(new_id.as_directory_name().to_owned());
new_id = existing_id.clone();
new_id.ensure_directory_name_unique(&directories);
assert_eq!("group/function/value_3", new_id.as_directory_name());
directories.insert(new_id.as_directory_name().to_owned());
} | rust_cleaned_test_functions.jsonl/51507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
39381,
842,
28230,
14846,
1269,
21218,
368,
341,
286,
1077,
6350,
842,
284,
61622,
764,
486,
931,
1006,
310,
330,
4074,
3263,
983,
51973,
3148,
310,
4329,
445,
1688,
3263,
983,
51973,
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_fuzzy(){
let seeds = generate_fuzzy_seed();
for seed in seeds {
println!("*********************************************");
println!("current seed : {}", seed);
println!("*********************************************");
let (root, owner, farming, pool, users) = prepair_env();
let mut rng = Pcg32::seed_from_u64(seed as u64);
let mut ctx = view!(farming.get_farm(FARM_ID.to_string())).unwrap_json::<FarmInfo>().clone();
for i in 0..OPERATION_NUM{
let operator = get_operator(&mut rng, &users);
println!("NO.{} : {:?}", i, operator);
do_operation(&mut ctx, &mut rng, &root, operator, &farming, &pool);
}
let farm_info = show_farminfo(&farming, FARM_ID.to_string(), false);
assert_farming(&farm_info, "Ended".to_string(), to_yocto(&OPERATION_NUM.to_string()), ctx.cur_round, ctx.last_round, ctx.claimed_reward.0, ctx.unclaimed_reward.0, ctx.beneficiary_reward.0);
let out_come = call!(
owner,
farming.force_clean_farm(FARM_ID.to_string()),
deposit = 0
);
out_come.assert_success();
assert_farming(&farm_info, "Ended".to_string(), to_yocto(&OPERATION_NUM.to_string()), ctx.cur_round, ctx.last_round, ctx.claimed_reward.0, ctx.unclaimed_reward.0, ctx.beneficiary_reward.0);
}
} | rust_cleaned_test_functions.jsonl/25206 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 623
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
34758,
19328,
262,
1077,
19056,
284,
6923,
761,
34758,
33809,
543,
262,
369,
10320,
304,
19056,
1476,
286,
13751,
17223,
40072,
18275,
797,
286,
13751,
17223,
3231,
10320,
549,
24689,
10320,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_simple() {
#[cfg(not(feature = "component"))]
let elem: Element = "<message xmlns='jabber:client'/>".parse().unwrap();
#[cfg(feature = "component")]
let elem: Element = "<message xmlns='jabber:component:accept'/>"
.parse()
.unwrap();
let message = Message::try_from(elem).unwrap();
assert_eq!(message.from, None);
assert_eq!(message.to, None);
assert_eq!(message.id, None);
assert_eq!(message.type_, MessageType::Normal);
assert!(message.payloads.is_empty());
} | rust_cleaned_test_functions.jsonl/112970 | {
"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,
30015,
368,
341,
286,
11506,
14072,
24772,
27062,
284,
330,
8571,
2761,
921,
286,
1077,
11750,
25,
8543,
284,
4055,
1994,
24967,
1131,
38916,
652,
25,
2972,
87315,
3263,
6400,
1005,
15454,
543,
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_add_vary_precision() {
assert_eq!(
decimal("100000000000000000000000000000000000000000000")
+ decimal("0.00000000000000000000000000000000000000001"),
decimal(BIGS[0])
)
} | rust_cleaned_test_functions.jsonl/58118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
2273,
658,
54618,
368,
341,
262,
2060,
10714,
33673,
286,
12122,
445,
16,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_other_users_cannot_change_my_email() {
let (app, anon, user) = TestApp::init().with_user();
let another_user = app.db_new_user("not_me");
let another_user_model = another_user.as_model();
let json = user
.update_email_more_control(
another_user_model.id,
Some("pineapple@pineapples.pineapple"),
)
.bad_with_status(200);
assert!(
json.errors[0]
.detail
.contains("current user does not match requested user",),
"{:?}",
json.errors
);
anon.update_email_more_control(
another_user_model.id,
Some("pineapple@pineapples.pineapple"),
)
.bad_with_status(403);
} | rust_cleaned_test_functions.jsonl/34879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30456,
16348,
666,
3401,
15947,
35686,
9172,
368,
341,
262,
1077,
320,
676,
11,
74812,
11,
1196,
8,
284,
3393,
2164,
486,
2327,
1005,
4197,
3317,
543,
262,
1077,
2441,
3317,
284,
906,
7076,
5921... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_requests() {
let peers = vec![PeerId::random(), PeerId::random()];
let mut peer_manager = PeerManager::new(peers.clone());
peer_manager.process_request(1, peers[0]);
peer_manager.process_request(3, peers[1]);
peer_manager.process_request(5, peers[0]);
peer_manager.process_request(10, peers[0]);
peer_manager.process_request(12, peers[1]);
peer_manager.remove_requests(5);
assert!(!peer_manager.has_requested(1, peers[0]));
assert!(!peer_manager.has_requested(3, peers[1]));
assert!(!peer_manager.has_requested(5, peers[0]));
assert!(peer_manager.has_requested(10, peers[0]));
assert!(peer_manager.has_requested(12, peers[1]));
} | rust_cleaned_test_functions.jsonl/67353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
37216,
368,
341,
262,
1077,
25029,
284,
7486,
20703,
30888,
764,
486,
11463,
1507,
45147,
764,
486,
11463,
33800,
262,
1077,
5206,
14397,
12144,
284,
45147,
2043,
486,
931,
65079,
388,
15997,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_ext_info_nft_cell_success() {
let (mut context, tx) =
create_test_context(Action::Update(UpdateCase::AddExtInfo), NftError::NoError);
let tx = context.complete_tx(tx);
// run
let cycles = context
.verify_tx(&tx, MAX_CYCLES)
.expect("pass verification");
println!("consume cycles: {}", cycles);
} | rust_cleaned_test_functions.jsonl/33578 | {
"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,
2891,
9927,
3109,
1089,
723,
16648,
18632,
368,
341,
262,
1077,
320,
6984,
2266,
11,
9854,
8,
4035,
286,
1855,
4452,
8467,
21905,
486,
4289,
7,
4289,
4207,
486,
2212,
6756,
1731,
701,
451,
723,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpool_r1_wrong_secret() {
let dh_secret: Secp256r1Scalar = ECScalar::from(
&BigInt::from_hex("efa8b1420c958881923ba9f7fcaf1c5bd994499d31da5d677ca9fa79c5762a28")
.unwrap(),
)
.unwrap();
let dh_public = Secp256r1Point::from_bigint(
&BigInt::from_hex("2ba1b94b7ab036e2597081e3127d762e02f9967cc7badedfe1cc7ee142a75aba0")
.unwrap(),
)
.unwrap();
let dh_secret_vec = vec![dh_secret.clone()];
let dh_public_vec = vec![dh_public];
let computed = compute_rpool_secp256r1(&dh_secret_vec, &dh_public_vec).unwrap();
let mut expected = HashMap::new();
expected.insert(
"03195834f65ee4df0d11d2c4a6dc1fbc205692539b613f1cfdb6177ee1c11300dd".to_string(),
dh_secret,
);
assert_ne!(computed, expected);
} | rust_cleaned_test_functions.jsonl/62599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
10285,
1710,
16,
75198,
21962,
368,
341,
286,
1077,
34096,
21962,
25,
4520,
79,
17,
20,
21,
81,
16,
20639,
284,
20633,
20639,
486,
1499,
1006,
310,
609,
87474,
486,
1499,
32655,
445,
75631... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_table_create() {
let table = sqlz::TableCreate {
name: "test".to_string(),
columns: vec![
sqlz::Column {
name: "id".to_string(),
key: Some(sqlz::ColumnKey::Primary),
..Default::default()
},
sqlz::Column {
name: "name".to_string(),
..Default::default()
},
],
..Default::default()
};
println!("{:?}", Builder::PG.create_table(&table, true));
} | rust_cleaned_test_functions.jsonl/38376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5237,
8657,
368,
341,
286,
1077,
1965,
284,
5704,
89,
486,
2556,
4021,
341,
310,
829,
25,
330,
1944,
3263,
983,
3904,
3148,
310,
8147,
25,
7486,
90515,
394,
5704,
89,
486,
2933,
341,
503,
829,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_request() {
let repair_type = ShredRepairType::Orphan(9);
let mut outstanding_requests = OutstandingRequests::default();
let nonce = outstanding_requests.add_request(repair_type, timestamp());
let request_status = outstanding_requests.requests.get(&nonce).unwrap();
assert_eq!(request_status.request, repair_type);
assert_eq!(
request_status.num_expected_responses,
repair_type.num_expected_responses()
);
} | rust_cleaned_test_functions.jsonl/50412 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
7893,
368,
341,
286,
1077,
12733,
1819,
284,
1417,
1151,
98386,
929,
486,
2195,
9943,
7,
24,
317,
286,
1077,
5206,
18781,
37216,
284,
75341,
35295,
486,
2258,
543,
286,
1077,
39676,
284,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_semi_colon_stmt() {
let conn = Connection::open_in_memory().unwrap();
let stmt = conn.prepare(";").unwrap();
assert_eq!(0, stmt.column_count());
} | rust_cleaned_test_functions.jsonl/57190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3453,
8155,
10211,
263,
21824,
368,
341,
286,
1077,
4534,
284,
11032,
486,
2508,
1243,
19195,
1005,
15454,
543,
286,
1077,
20020,
284,
4534,
21934,
61064,
1827,
15454,
543,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_correct_foldup_and_not_visible_scroll_position() {
let items = string_vec_to_status(&[
"a/b/b1",
"c/d1",
"c/d2",
]);
//0 a/b/
//2 b1
//3 c/
//4 d1
//5 d2
// Set up test terminal
let test_backend = tui::backend::TestBackend::new(100, 100);
let mut terminal = tui::Terminal::new(test_backend)
.expect("Unable to set up terminal");
let mut frame = terminal.get_frame();
// set up file tree
let mut ftc = FileTreeComponent::new(
"title",
true,
None,
SharedTheme::default(),
SharedKeyConfig::default(),
);
ftc.update(&items)
.expect("Updating FileTreeComponent failed");
ftc.move_selection(MoveSelection::Left); // Fold a/b/
ftc.move_selection(MoveSelection::Down); // Move to c/
ftc.draw(&mut frame, Rect::new(0, 0, 10, 5))
.expect("Draw failed");
assert_eq!(ftc.scroll_top.get(), 0); // should still be at top
} | rust_cleaned_test_functions.jsonl/122437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31550,
61187,
454,
8378,
7913,
34371,
41407,
9661,
368,
341,
197,
10217,
3589,
284,
914,
13251,
2346,
4773,
2099,
9640,
298,
197,
56693,
3470,
3470,
16,
497,
715,
298,
197,
96946,
3446,
16,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sort_colors() {
let mut nums = vec![2, 0, 2, 1, 1, 0];
Solution::sort_colors(&mut nums);
assert_eq!(nums, vec![0, 0, 1, 1, 2, 2]);
} | rust_cleaned_test_functions.jsonl/131351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
33670,
368,
341,
286,
1077,
5206,
10307,
284,
7486,
20703,
17,
11,
220,
15,
11,
220,
17,
11,
220,
16,
11,
220,
16,
11,
220,
15,
935,
286,
12478,
486,
6860,
33670,
2099,
6984,
10307,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sync_status_json() {
let status = Web3SyncStatus::False;
let json = json::parse(&serde_json::to_string(&status).unwrap()).unwrap();
assert!(json.is_boolean());
let status = Web3SyncStatus::Doing(SyncStatus {
starting_block: fastrand::u64(..).into(),
current_block: fastrand::u64(..).into(),
highest_block: fastrand::u64(..).into(),
known_states: U256::default(),
pulled_states: U256::default(),
});
let json = json::parse(&serde_json::to_string(&status).unwrap()).unwrap();
assert!(json.is_object());
} | rust_cleaned_test_functions.jsonl/115667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23008,
4773,
9455,
368,
341,
286,
1077,
2639,
284,
4895,
18,
12154,
2522,
486,
4049,
280,
286,
1077,
2951,
284,
2951,
486,
6400,
2099,
47024,
9455,
486,
983,
3904,
2099,
2829,
568,
15454,
6011,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_prev_user_key_out_of_bound_3() {
let engine = TestEngineBuilder::new().build().unwrap();
// Generate 1 put for [c].
must_prewrite_put(&engine, b"c", b"value", b"c", 1);
must_commit(&engine, b"c", 1, 1);
// Generate N+M+1 put for [b] .
for ts in 1..SEEK_BOUND + REVERSE_SEEK_BOUND + 2 {
must_prewrite_put(&engine, b"b", &[ts as u8], b"b", ts);
must_commit(&engine, b"b", ts, ts);
}
let snapshot = engine.snapshot(&Context::default()).unwrap();
let mut scanner = ScannerBuilder::new(snapshot, REVERSE_SEEK_BOUND + 1, true)
.range(None, None)
.build()
.unwrap();
// Initial position: 1 seek_to_last:
// b_11 b_10 b_9 b_8 b_7 b_6 b_5 b_4 b_3 b_2 b_1 c_1
// ^cursor
// b_11 b_10 b_9 b_8 b_7 b_6 b_5 b_4 b_3 b_2 b_1 c_1
// ^cursor
// b_11 b_10 b_9 b_8 b_7 b_6 b_5 b_4 b_3 b_2 b_1 c_1
// ^cursor
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(b"c"), b"value".to_vec())),
);
let statistics = scanner.take_statistics();
assert_eq!(statistics.write.seek, 1);
assert_eq!(statistics.write.seek_for_prev, 0);
assert_eq!(statistics.write.next, 0);
assert_eq!(statistics.write.prev, 1);
// Before:
// b_11 b_10 b_9 b_8 b_7 b_6 b_5 b_4 b_3 b_2 b_1 c_1
// ^cursor
// Use M-1 prev trying to get specified version:
// b_11 b_10 b_9 b_8 b_7 b_6 b_5 b_4 b_3 b_2 b_1 c_1
// ^cursor
// b_11 b_10 b_9 b_8 b_7 b_6 b_5 b_4 b_3 b_2 b_1 c_1
// ^cursor
// Now we got wanted value.
// b_11 b_10 b_9 b_8 b_7 b_6 b_5 b_4 b_3 b_2 b_1 c_1
// ^cursor
// b_11 b_10 b_9 b_8 b_7 b_6 b_5 b_4 b_3 b_2 b_1 c_1
// ^cursor
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(b"b"), vec![(REVERSE_SEEK_BOUND + 1) as u8])),
);
let statistics = scanner.take_statistics();
assert_eq!(statistics.write.seek, 1);
assert_eq!(statistics.write.seek_for_prev, 1);
assert_eq!(statistics.write.next, 0);
assert_eq!(
statistics.write.prev,
(REVERSE_SEEK_BOUND - 1 + SEEK_BOUND - 1) as usize
);
// Next we should get nothing.
assert_eq!(scanner.next().unwrap(), None);
let statistics = scanner.take_statistics();
assert_eq!(statistics.write.seek, 0);
assert_eq!(statistics.write.seek_for_prev, 0);
assert_eq!(statistics.write.next, 0);
assert_eq!(statistics.write.prev, 0);
} | rust_cleaned_test_functions.jsonl/36638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1778
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
25566,
3317,
3097,
6068,
3575,
19447,
62,
18,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
1428,
23459,
286,
442,
19813,
220,
16,
2182,
369,
508,
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... | 2 |
#[test]
fn test_adapter() {
let system: LegacySystem = LegacySystem {};
let adapter = Adapter::new(system);
assert_eq!(adapter.new_process_a(), "ふるーい処理A");
assert_eq!(adapter.new_process_b(), "ふるーい処理B");
} | rust_cleaned_test_functions.jsonl/21167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43682,
368,
341,
286,
1077,
1849,
25,
37887,
2320,
284,
37887,
2320,
20375,
286,
1077,
12956,
284,
28807,
486,
931,
46006,
626,
286,
2060,
10714,
10297,
19731,
4618,
11305,
4306,
1507,
330,
129102,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_extension() {
std::env::set_var("POLARS_ALLOW_EXTENSION", "1");
// Run this under MIRI.
let foo = Foo {
a: 1,
b: 1,
other_heap: "foo".into(),
};
let foo2 = Foo {
a: 1,
b: 1,
other_heap: "bar".into(),
};
let vals = vec![Some(foo), Some(foo2)];
create_extension(vals.into_iter());
} | rust_cleaned_test_functions.jsonl/20896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
31035,
368,
341,
286,
1460,
486,
3160,
486,
746,
4612,
445,
49303,
17048,
44324,
37012,
497,
330,
16,
797,
286,
442,
6452,
419,
1212,
386,
2801,
40,
624,
286,
1077,
15229,
284,
33428,
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_parse_invalid_move_module_id_string() {
assert_eq!(
"invalid Move module id: 0x1",
"0x1".parse::<MoveModuleId>().err().unwrap().to_string()
);
assert_eq!(
"invalid Move module id: 0x1:",
"0x1:".parse::<MoveModuleId>().err().unwrap().to_string()
);
assert_eq!(
"invalid Move module id: 0x1:::",
"0x1:::".parse::<MoveModuleId>().err().unwrap().to_string()
);
assert_eq!(
"invalid Move module id: 0x1::???",
"0x1::???"
.parse::<MoveModuleId>()
.err()
.unwrap()
.to_string()
);
assert_eq!(
"invalid Move module id: Diem::Diem",
"Diem::Diem"
.parse::<MoveModuleId>()
.err()
.unwrap()
.to_string()
);
assert_eq!(
"invalid Move module id: 0x1::Diem::Diem",
"0x1::Diem::Diem"
.parse::<MoveModuleId>()
.err()
.unwrap()
.to_string()
);
} | rust_cleaned_test_functions.jsonl/66279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 737
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
31433,
17134,
10750,
842,
3904,
368,
341,
286,
2060,
10714,
33673,
310,
330,
11808,
14561,
4688,
877,
25,
220,
15,
87,
16,
756,
310,
330,
15,
87,
16,
3263,
6400,
27638,
9860,
3332,
764,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_source_uninitialized() {
let stake_pubkey = solana_sdk::pubkey::new_rand();
let stake_lamports = 42;
let stake_account = AccountSharedData::new_ref_data_with_space(
stake_lamports,
&StakeState::Uninitialized,
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let split_stake_pubkey = solana_sdk::pubkey::new_rand();
let split_stake_account = AccountSharedData::new_ref_data_with_space(
0,
&StakeState::Uninitialized,
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, false, &stake_account);
let split_stake_keyed_account =
KeyedAccount::new(&split_stake_pubkey, false, &split_stake_account);
// no signers should fail
assert_eq!(
stake_keyed_account.split(
stake_lamports / 2,
&split_stake_keyed_account,
&HashSet::default() // no signers
),
Err(InstructionError::MissingRequiredSignature)
);
let signers = HashSet::from([stake_pubkey]);
// splitting an uninitialized account where the destination is the same as the source
{
// - when split amount is the full balance
// - when split amount is zero
// - when split amount is non-zero and less than the full balance
// and splitting should fail when the split amount is greater than the balance
assert_eq!(
stake_keyed_account.split(stake_lamports, &stake_keyed_account, &signers),
Ok(()),
);
assert_eq!(
stake_keyed_account.split(0, &stake_keyed_account, &signers),
Ok(()),
);
assert_eq!(
stake_keyed_account.split(stake_lamports / 2, &stake_keyed_account, &signers),
Ok(()),
);
assert_eq!(
stake_keyed_account.split(stake_lamports + 1, &stake_keyed_account, &signers),
Err(InstructionError::InsufficientFunds),
);
}
// this should work
assert_eq!(
stake_keyed_account.split(stake_lamports / 2, &split_stake_keyed_account, &signers),
Ok(())
);
assert_eq!(
stake_keyed_account.account.borrow().lamports(),
split_stake_keyed_account.account.borrow().lamports()
);
} | rust_cleaned_test_functions.jsonl/87015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
10347,
4907,
36161,
368,
341,
286,
1077,
18279,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
18279,
907,
309,
3394,
284,
220,
19,
17,
280,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_path_for() {
let dir = tempdir().unwrap();
let network_home = NetworkHome::new(dir.path().join("localhost").as_path());
let correct_dir = dir.path().join("localhost/accounts/latest/dev.key");
assert_eq!(correct_dir, network_home.key_path_for("latest"));
} | rust_cleaned_test_functions.jsonl/39536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
2638,
5478,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
3922,
21653,
284,
8141,
7623,
486,
931,
14161,
3875,
1005,
5987,
445,
8301,
1827,
300,
2638,
1423,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make() {
let blob = Blob::make(&mock_struct_data(), &mock_issue_data()).unwrap_or_else(|s| panic!("{:?}", s));
assert_eq!(blob.tabs.len(), 1);
let tab = &blob.tabs[0];
assert_eq!(tab.id, "foo");
assert_eq!(tab.title, "Foo");
assert_eq!(tab.tags, &["a".to_owned(), "b".to_owned()]);
assert_eq!(tab.categories.len(), 1);
let cat = &tab.categories[0];
assert_eq!(cat.title, "Rustfmt");
} | rust_cleaned_test_functions.jsonl/53386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
368,
341,
286,
1077,
23404,
284,
49439,
486,
6927,
2099,
16712,
15126,
1769,
1507,
609,
16712,
53340,
1769,
6011,
15454,
8734,
62628,
22428,
82,
91,
21975,
88928,
25,
52652,
274,
1106,
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_null() -> SimpleResult<()> {
let mut record: Record<Action> = Record::new(
H2Project::new("name", "1.0")
);
let action = NullAction::new();
record.apply(action)?;
record.undo()?;
record.redo()?;
Ok(())
} | rust_cleaned_test_functions.jsonl/128384 | {
"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,
15162,
368,
1464,
8993,
2077,
71698,
341,
286,
1077,
5206,
3255,
25,
13583,
67424,
29,
284,
13583,
486,
931,
1006,
310,
472,
17,
7849,
486,
931,
445,
606,
497,
330,
16,
13,
15,
1138,
286,
3475... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_write_with_overflow_returns_error() {
let (_ramdisk, remote_block_device) = make_ramdisk();
let mut cache = Cache::new(remote_block_device).expect("Cache::new failed");
let buf = [0u8; 2];
cache.write_at(&buf, u64::MAX - 1).expect_err("write_at succeeded");
} | rust_cleaned_test_functions.jsonl/96362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
6615,
79073,
58900,
4096,
368,
341,
286,
1077,
5453,
2396,
30496,
11,
8699,
7113,
9204,
8,
284,
1281,
62124,
30496,
543,
286,
1077,
5206,
6500,
284,
19479,
486,
931,
61381,
7113,
9204,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_empty_file_with_reused_tree() {
let mut parser = Parser::new();
parser.set_language(get_language("rust")).unwrap();
let tree = parser.parse("", None);
parser.parse("", tree.as_ref());
let tree = parser.parse("\n ", None);
parser.parse("\n ", tree.as_ref());
} | rust_cleaned_test_functions.jsonl/73164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
15124,
2458,
6615,
1288,
2591,
11663,
368,
341,
262,
1077,
5206,
6729,
284,
21102,
486,
931,
543,
262,
6729,
980,
29021,
5433,
29021,
445,
35788,
15197,
15454,
1428,
262,
1077,
4916,
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_valid_name() {
expect_ok!(Name, "foo");
expect_ok!(Name, "foO123._-");
expect_ok!(Name, repeat("x").take(100).collect::<String>());
} | rust_cleaned_test_functions.jsonl/98663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
1269,
368,
341,
286,
1720,
19817,
10297,
675,
11,
330,
7975,
797,
286,
1720,
19817,
10297,
675,
11,
330,
824,
46,
16,
17,
18,
1436,
12,
797,
286,
1720,
19817,
10297,
675,
11,
13153,
445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_recognizer_2() {
let mut router = Router::<usize>::build();
router.path("/index.json", 10);
router.path("/{source}.json", 11);
let mut router = router.finish();
let mut path = Path::new("/index.json");
let (h, _) = router.recognize_mut(&mut path).unwrap();
assert_eq!(*h, 10);
let mut path = Path::new("/test.json");
let (h, _) = router.recognize_mut(&mut path).unwrap();
assert_eq!(*h, 11);
} | rust_cleaned_test_functions.jsonl/79577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7080,
3934,
3135,
62,
17,
368,
341,
286,
1077,
5206,
9273,
284,
10554,
27638,
51878,
6831,
5834,
543,
286,
9273,
3875,
4283,
1252,
4323,
497,
220,
16,
15,
317,
286,
9273,
3875,
65871,
2427,
7810... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_pk() {
let sk_a = "77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a";
let pk_a = "8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a";
let sk_b = "5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb";
let pk_b = "de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f";
let k = "4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742";
assert_eq!(h2b(pk_a), gen_pk(&h2b(sk_a)));
assert_eq!(h2b(pk_b), gen_pk(&h2b(sk_b)));
check(k, sk_a, pk_b);
check(k, sk_b, pk_a);
} | rust_cleaned_test_functions.jsonl/82555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
33321,
368,
341,
286,
1077,
1901,
4306,
284,
330,
22,
22,
15,
22,
21,
67,
15,
64,
22,
18,
16,
23,
64,
20,
22,
67,
18,
66,
16,
21,
66,
16,
22,
17,
20,
16,
65,
17,
21,
21,
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_not_in_valid_empty() {
let mut params = Map::new();
params.assign("in", Value::String("".into())).ok();
let mut rules = BTreeMap::new();
rules.insert("in",
vec![Rule::NotIn(vec![Value::String("2".into()), Value::U64(1)])]);
let result = validate(&rules, params);
assert!(result.is_ok());
assert_eq!(result.unwrap().find(&["in"]).unwrap(),
&Value::String("".into()));
} | rust_cleaned_test_functions.jsonl/104859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
1243,
8337,
15124,
368,
341,
262,
1077,
5206,
3628,
284,
5027,
486,
931,
543,
262,
3628,
17870,
445,
258,
497,
5162,
486,
703,
445,
3263,
18122,
34670,
562,
1428,
262,
1077,
5206,
5601,
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_lazy_binary_ops() {
let df = df!("a" => &[1, 2, 3, 4, 5, ]).unwrap();
let new = df
.lazy()
.select([col("a").eq(lit(2)).alias("foo")])
.collect()
.unwrap();
assert_eq!(new.column("foo").unwrap().sum::<i32>(), Some(1));
} | rust_cleaned_test_functions.jsonl/115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
31761,
21959,
368,
341,
262,
1077,
6764,
284,
6764,
17223,
64,
1,
589,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
96711,
15454,
543,
262,
1077,
501,
284,
6764,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_value() {
for (field_type, default_json, default_datum) in DEFAULT_VALUE_EXAMPLES.iter() {
let reader_schema = Schema::parse_str(&format!(
r#"{{
"type": "record",
"name": "Test",
"fields": [
{{"name": "H", "type": {}, "default": {}}}
]
}}"#,
field_type, default_json
))
.unwrap();
let datum_to_read = Value::Record(vec![("H".to_string(), default_datum.clone())]);
let encoded = to_avro_datum(&LONG_RECORD_SCHEMA, LONG_RECORD_DATUM.clone()).unwrap();
let datum_read = from_avro_datum(
&LONG_RECORD_SCHEMA,
&mut Cursor::new(encoded),
Some(&reader_schema),
)
.unwrap();
assert_eq!(
datum_read, datum_to_read,
"{} -> {}",
*field_type, *default_json
);
}
} | rust_cleaned_test_functions.jsonl/129455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 547
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
3142,
368,
341,
262,
369,
320,
2566,
1819,
11,
1638,
9455,
11,
1638,
15353,
372,
8,
304,
11955,
7476,
4966,
18918,
50,
19471,
368,
341,
286,
1077,
6604,
25371,
284,
12539,
486,
6400,
2895,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_flow_control() {
let (mut cfg, _dir) = TiKvConfig::with_tmp().unwrap();
cfg.storage.flow_control.l0_files_threshold = 50;
cfg.validate().unwrap();
let (storage, cfg_controller, _, flow_controller) = new_engines(cfg);
let db = storage.get_engine().get_rocksdb();
assert_eq!(
db.get_options_cf(CF_DEFAULT)
.unwrap()
.get_level_zero_slowdown_writes_trigger(),
50
);
assert_eq!(
db.get_options_cf(CF_DEFAULT)
.unwrap()
.get_level_zero_stop_writes_trigger(),
50
);
assert_eq!(
db.get_options_cf(CF_DEFAULT)
.unwrap()
.get_disable_write_stall(),
true
);
assert_eq!(flow_controller.enabled(), true);
cfg_controller
.update_config("storage.flow-control.enable", "false")
.unwrap();
assert_eq!(
db.get_options_cf(CF_DEFAULT)
.unwrap()
.get_disable_write_stall(),
false
);
assert_eq!(flow_controller.enabled(), false);
cfg_controller
.update_config("storage.flow-control.enable", "true")
.unwrap();
assert_eq!(
db.get_options_cf(CF_DEFAULT)
.unwrap()
.get_disable_write_stall(),
true
);
assert_eq!(flow_controller.enabled(), true);
} | rust_cleaned_test_functions.jsonl/2154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 863
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27441,
13436,
368,
341,
286,
1077,
320,
6984,
13286,
11,
716,
3741,
8,
284,
22325,
42,
85,
2648,
486,
4197,
16125,
1005,
15454,
543,
286,
13286,
22403,
34071,
13436,
918,
15,
10931,
21858,
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_legal_moves_banmen_with_kaku_top_wall_opponent_gote() {
let blank_banmen = Banmen([[Blank; 9]; 9]);
let mut wall_banmen = blank_banmen.clone();
for x in 1..8 {
wall_banmen.0[0][x] = SFu;
}
for x in 2..7 {
let mut banmen = wall_banmen.clone();
banmen.0[1][x] = GKaku;
assert_eq!(legal_moves_from_banmen(&Teban::Gote,&banmen),
Rule::legal_moves_from_banmen(Teban::Gote,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
);
}
} | rust_cleaned_test_functions.jsonl/81109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
4698,
23557,
10426,
50731,
10287,
1146,
1889,
1272,
368,
972,
10217,
10113,
880,
276,
5676,
284,
22730,
5676,
27119,
22770,
26,
220,
24,
5265,
220,
24,
55531,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_initial_tab_counts_as_8_columns() {
new_ucmd!()
.arg("-w8")
.pipe_in("\t1")
.succeeds()
.stdout_is("\t\n1");
} | rust_cleaned_test_functions.jsonl/23276 | {
"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,
15809,
17344,
25977,
11898,
62,
23,
22590,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
86,
23,
1138,
286,
659,
13768,
1243,
4921,
83,
16,
1138,
286,
659,
82,
29264,
82,
741,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_peek() {
let test_bytes: Vec<u8> = hex::decode(TEST_HEX).expect("");
let binary_parser = BinaryParser::from(test_bytes.as_ref());
assert_eq!(binary_parser.peek(), Some([test_bytes[0]; 1]));
} | rust_cleaned_test_functions.jsonl/20411 | {
"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,
62,
29107,
368,
341,
286,
1077,
1273,
12524,
25,
11312,
34837,
23,
29,
284,
12371,
486,
18196,
50320,
86502,
568,
17119,
13056,
286,
1077,
7868,
18517,
284,
17718,
6570,
486,
1499,
8623,
12524,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_record_changeset2() {
extern crate serde_json;
use dao::Dao;
let input = r#"
{
"record": {
"description": {
"Text": "A Fanciful Documentary of a Frisbee And a Lumberjack who must Chase a Monkey in A Shark Tank"
},
"film_id": {
"Int": 4
},
"fulltext": {
"Text": "'affair':1 'chase':14 'documentari':5 'fanci':4 'frisbe':8 'lumberjack':11 'monkey':16 'must':13 'prejudic':2 'shark':19 'tank':20"
},
"language_id": {
"Int": 1
},
"last_update": {
"Timestamp": "2007-09-11T01:46:03Z"
},
"length": {
"Smallint": 117
},
"original_language_id": "Nil",
"rating": {
"Text": "G"
},
"release_year": {
"Smallint": 2006
},
"rental_duration": {
"Smallint": 5
},
"rental_rate": {
"BigDecimal": "2.99"
},
"replacement_cost": {
"BigDecimal": "26.99"
},
"title": {
"Text": "AFFAIR PREJUDICE"
}
},
"action": "Edited",
"one_ones": [],
"has_many": [
[
{
"name": "inventory",
"schema": "public"
},
"Edited",
{
"columns": [
"inventory_id",
"last_update",
"film_id",
"store_id"
],
"data": []
}
],
[
{
"name": "inventory",
"schema": "public"
},
"LinkNew",
{
"columns": [
"inventory_id",
"last_update",
"film_id",
"store_id"
],
"data": []
}
],
[
{
"name": "inventory",
"schema": "public",
"alias": null
},
"Unlink",
{
"columns": [
"inventory_id",
"last_update",
"film_id",
"store_id"
],
"data": []
}
]
],
"indirect": [
[
{
"name": "actor",
"schema": "public",
"alias": null
},
{
"name": "film_actor",
"schema": "public",
"alias": null
},
"LinkNew",
{
"columns": [
"actor_id",
"first_name",
"last_name",
"last_update"
],
"data": []
}
],
[
{
"name": "category",
"schema": "public",
"alias": null
},
{
"name": "film_category",
"schema": "public",
"alias": null
},
"LinkNew",
{
"columns": [
"category_id",
"name",
"last_update"
],
"data": []
}
],
[
{
"name": "actor",
"schema": "public",
"alias": null
},
{
"name": "film_actor",
"schema": "public",
"alias": null
},
"LinkExisting",
{
"columns": [
"actor_id"
],
"data": []
}
],
[
{
"name": "category",
"schema": "public",
"alias": null
},
{
"name": "film_category",
"schema": "public"
},
"LinkExisting",
{
"columns": [
"category_id"
],
"data": [
[
{
"Int": 3
}
]
]
}
],
[
{
"name": "actor",
"schema": "public",
"alias": null
},
{
"name": "film_actor",
"schema": "public"
},
"Unlink",
{
"columns": [
"actor_id",
"first_name",
"last_name",
"last_update"
],
"data": []
}
],
[
{
"name": "category",
"schema": "public",
"alias": null
},
{
"name": "film_category",
"schema": "public",
"alias": null
},
"Unlink",
{
"columns": [
"category_id",
"name",
"last_update"
],
"data": []
}
]
]
}
"#;
let mut dao = Dao::new();
dao.insert("city", "Akishima");
let changeset = RecordChangeset {
record: dao,
action: RecordAction::Edited,
one_ones: vec![],
has_many: vec![],
indirect: vec![],
};
let changeset_json = serde_json::to_string(&changeset).unwrap();
println!("changeset json: {}", changeset_json);
let result: Result<RecordChangeset, _> = serde_json::from_str(input);
println!("result: {:#?}", result);
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/13721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2655
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
47526,
295,
17,
368,
341,
262,
15637,
17717,
61570,
9455,
280,
262,
990,
24775,
486,
12197,
401,
262,
1077,
1946,
284,
435,
2,
698,
515,
220,
330,
8548,
788,
341,
262,
330,
4684,
788,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poll_future_notify_with_slow_source() {
let (tx, rx) = oneshot::channel::<usize>();
let (signal_tx, signal_rx) = oneshot::channel();
thread::Builder::new()
.name("source".to_owned())
.spawn(move || {
signal_rx.wait().unwrap();
tx.send(100).unwrap();
})
.unwrap();
let (tx1, rx1) = oneshot::channel::<usize>();
poll_future_notify(
rx.map(move |i| {
assert_eq!(thread::current().name(), Some("source"));
tx1.send(i + 100).unwrap();
})
.map_err(|_| ()),
);
signal_tx.send(()).unwrap();
assert_eq!(rx1.wait().unwrap(), 200);
} | rust_cleaned_test_functions.jsonl/7268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40002,
59740,
36654,
6615,
82447,
10347,
368,
341,
286,
1077,
320,
3998,
11,
19111,
8,
284,
389,
4288,
354,
486,
10119,
27638,
51878,
3913,
286,
1077,
320,
26622,
17805,
11,
8286,
24330,
8,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_binop_override() {
// won't be used as an empty tuple constructor.
assert_eq! {
rune! {
(bool, bool, bool, bool) => r#"
struct Timeout;
fn main() {
let timeout = Timeout;
(
timeout is Timeout,
timeout is not Timeout,
!(timeout is Timeout),
!(timeout is not Timeout),
)
}
"#
},
(true, false, false, true),
};
} | rust_cleaned_test_functions.jsonl/19365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21816,
453,
48576,
368,
341,
1066,
262,
442,
2765,
944,
387,
1483,
438,
458,
4287,
14405,
4692,
624,
262,
2060,
10714,
0,
341,
286,
63499,
0,
341,
310,
320,
2641,
11,
1807,
11,
1807,
11,
1807,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_link_existing_file() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "test_link_existing_file";
let link = "test_link_existing_file_link";
at.touch(file);
at.write(file, "foobar");
assert!(at.file_exists(file));
ucmd.args(&[file, link]).succeeds().no_stderr();
assert!(at.file_exists(file));
assert!(at.file_exists(link));
assert_eq!(at.read(file), at.read(link));
} | rust_cleaned_test_functions.jsonl/64115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
62630,
2458,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
284,
330,
1944,
7233,
62630,
2458,
876,
262,
1077,
2656,
284,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_outcome_one_majority_vote() {
let guilty = UUID::random();
let p1 = UUID::random();
let p2 = UUID::random();
let p3 = UUID::random();
let state = TallyingState::new(
vec![
(VoteTarget::Player { uuid: guilty }, vec![p1, p2, p3]),
(VoteTarget::Player { uuid: p1 }, vec![guilty]),
]
.into_iter()
.collect(),
);
assert_eq!(
state.determine_outcome_of_election(),
VoteOutcome::Player { uuid: guilty }
);
} | rust_cleaned_test_functions.jsonl/58283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
6068,
2020,
11667,
47916,
487,
54360,
368,
341,
262,
1077,
16007,
284,
23698,
486,
11463,
543,
262,
1077,
281,
16,
284,
23698,
486,
11463,
543,
262,
1077,
281,
17,
284,
23698,
486,
11463,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_withdraw_all_offset_curve() {
let trade_fee_numerator = 1;
let trade_fee_denominator = 10;
let owner_trade_fee_numerator = 1;
let owner_trade_fee_denominator = 30;
let owner_withdraw_fee_numerator = 0;
let owner_withdraw_fee_denominator = 30;
let host_fee_numerator = 10;
let host_fee_denominator = 100;
let token_a_amount = 1_000_000_000;
let token_b_amount = 10;
let fees = Fees {
trade_fee_numerator,
trade_fee_denominator,
owner_trade_fee_numerator,
owner_trade_fee_denominator,
owner_withdraw_fee_numerator,
owner_withdraw_fee_denominator,
host_fee_numerator,
host_fee_denominator,
};
let token_b_offset = 2_000_000;
let swap_curve = SwapCurve {
curve_type: CurveType::Offset,
calculator: Box::new(OffsetCurve { token_b_offset }),
};
let total_pool = swap_curve.calculator.new_pool_supply();
let user_key = Pubkey::new_unique();
let withdrawer_key = Pubkey::new_unique();
let mut accounts =
SwapAccountInfo::new(&user_key, fees, swap_curve, token_a_amount, token_b_amount);
accounts.initialize_swap().unwrap();
let (
token_a_key,
mut token_a_account,
token_b_key,
mut token_b_account,
_pool_key,
_pool_account,
) = accounts.setup_token_accounts(&user_key, &withdrawer_key, 0, 0, 0);
let pool_key = accounts.pool_token_key;
let mut pool_account = accounts.pool_token_account.clone();
// WithdrawAllTokenTypes takes all tokens for A and B.
// The curve's calculation for token B will say to transfer
// moved.
accounts
.withdraw_all_token_types(
&user_key,
&pool_key,
&mut pool_account,
&token_a_key,
&mut token_a_account,
&token_b_key,
&mut token_b_account,
total_pool.try_into().unwrap(),
0,
0,
)
.unwrap();
let token_a = spl_token::state::Account::unpack(&token_a_account.data).unwrap();
assert_eq!(token_a.amount, token_a_amount);
let token_b = spl_token::state::Account::unpack(&token_b_account.data).unwrap();
assert_eq!(token_b.amount, token_b_amount);
let swap_token_a =
spl_token::state::Account::unpack(&accounts.token_a_account.data).unwrap();
assert_eq!(swap_token_a.amount, 0);
let swap_token_b =
spl_token::state::Account::unpack(&accounts.token_b_account.data).unwrap();
assert_eq!(swap_token_b.amount, 0);
} | rust_cleaned_test_functions.jsonl/14320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
7633,
5705,
6917,
43407,
368,
341,
286,
1077,
6559,
34305,
1089,
60969,
284,
220,
16,
280,
286,
1077,
6559,
34305,
49522,
30206,
284,
220,
16,
15,
280,
286,
1077,
6372,
52162,
34305,
1089,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_declaration_invalid_missing_space_after_fn_keyword_and_no_parens() {
let mut p = make_parser("functionname { echo body; }");
assert_eq!(
Err(Unexpected(Token::CurlyOpen, src(13, 1, 14))),
p.function_declaration()
);
} | rust_cleaned_test_functions.jsonl/69866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
77926,
31433,
40447,
14663,
19844,
15246,
45824,
8378,
6536,
620,
546,
4412,
368,
341,
262,
1077,
5206,
281,
284,
1281,
18517,
445,
1688,
606,
314,
1687,
2487,
26,
335,
797,
262,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seek_error() {
let ps = ParseStream {
content: "Hello".to_string(),
cursor: 1,
};
let err = ps.seek("H").unwrap_err();
assert_eq!(ps.cursor, 1);
assert_eq!(err.cursor, 1);
assert_eq!(err.message, "expected `H`".to_string())
} | rust_cleaned_test_functions.jsonl/41156 | {
"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,
74473,
4096,
368,
341,
286,
1077,
4726,
284,
14775,
3027,
341,
310,
2213,
25,
330,
9707,
3263,
983,
3904,
3148,
310,
8128,
25,
220,
16,
345,
286,
3634,
286,
1077,
1848,
284,
4726,
38179,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_head_empty_body() {
let req = Request::with_connector(
Head, Url::parse("http://example.dom").unwrap(), &mut MockConnector
).unwrap();
let req = req.start().unwrap();
let stream = *req.body.end().unwrap()
.into_inner().unwrap().downcast::<MockStream>().ok().unwrap();
let bytes = stream.write;
let s = from_utf8(&bytes[..]).unwrap();
assert!(!s.contains("Content-Length:"));
assert!(!s.contains("Transfer-Encoding:"));
} | rust_cleaned_test_functions.jsonl/74536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13138,
15124,
14114,
368,
341,
286,
1077,
4232,
284,
6145,
486,
4197,
76393,
1006,
310,
11203,
11,
22840,
486,
6400,
445,
1254,
1110,
8687,
21435,
1827,
15454,
1507,
609,
6984,
14563,
35954,
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... | 1 |
#[test]
fn test_db_file_locking() {
let db_tempdir = tempdir().unwrap();
let wallet_path = db_tempdir.path().join("alice_db").with_extension("sqlite3");
let connection = run_migration_and_create_sqlite_connection(&wallet_path, 16).expect("Could not open Sqlite db");
match run_migration_and_create_sqlite_connection(&wallet_path, 16) {
Err(WalletStorageError::CannotAcquireFileLock) => {},
_ => panic!("Should not be able to acquire file lock"),
}
drop(connection);
assert!(run_migration_and_create_sqlite_connection(&wallet_path, 16).is_ok());
} | rust_cleaned_test_functions.jsonl/132203 | {
"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,
8685,
2458,
9818,
287,
368,
341,
262,
1077,
2927,
11771,
3741,
284,
2730,
3741,
1005,
15454,
543,
262,
1077,
15085,
2638,
284,
2927,
11771,
3741,
3875,
1005,
5987,
445,
63195,
8685,
1827,
4197,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_constants() {
assert_eq!(dec::consts::E.to_string(), "2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274");
assert_eq!(dec::consts::PI.to_string(), "3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068");
} | rust_cleaned_test_functions.jsonl/87131 | {
"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,
55642,
368,
341,
262,
2060,
10714,
10297,
8169,
486,
95773,
486,
36,
2389,
3904,
1507,
330,
17,
13,
22,
16,
23,
17,
23,
16,
23,
17,
23,
19,
20,
24,
15,
19,
20,
17,
18,
20,
18,
21,
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_add_bucket() -> Result<(), Error> {
// to requests immediately.
let (service, _cache_dir) = setup_service();
let (_symsrv, source) = test::symbol_server();
let request = get_symbolication_request(vec![]);
let request_id = service.symbolication().symbolicate_stacktraces(request)?;
let response = get_symbolication_response(&service, request_id)?;
insta::assert_yaml_snapshot!(response);
let request = get_symbolication_request(vec![source]);
let request_id = service.symbolication().symbolicate_stacktraces(request)?;
let response = get_symbolication_response(&service, request_id)?;
insta::assert_yaml_snapshot!(response);
Ok(())
} | rust_cleaned_test_functions.jsonl/84404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
38749,
368,
1464,
5714,
68843,
4600,
29,
341,
1789,
286,
442,
311,
7388,
7069,
382,
286,
1077,
320,
7936,
11,
716,
9360,
4334,
8,
284,
6505,
12267,
543,
286,
1077,
5453,
22860,
1011,
10553... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_long() {
assert_eq!(
Variant::VSingle(5.1).multiply(Variant::VLong(2)).unwrap(),
Variant::VSingle(10.2)
);
} | rust_cleaned_test_functions.jsonl/84582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
10888,
7,
20,
13,
16,
568,
64648,
12410,
15341,
486,
53,
6583,
7,
17,
4579,
15454,
3148,
503,
39292,
486,
53,
10888,
7,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_split_fanout() {
assert_eq!(split_fanout(0b11_1111), (0b11_1111, 0));
assert_eq!(split_fanout(0b111_1111), (0b11_1111, 0b1));
} | rust_cleaned_test_functions.jsonl/68783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
761,
276,
411,
368,
341,
262,
2060,
10714,
10297,
6960,
761,
276,
411,
7,
15,
65,
16,
16,
62,
16,
16,
16,
16,
701,
320,
15,
65,
16,
16,
62,
16,
16,
16,
16,
11,
220,
15,
1106,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply_vote_and_generate_vote_diff_dup_vote() {
let mut local = VoteState::default();
// another vote for slot 0 should return an empty vote as the diff.
let vote =
Tower::apply_vote_and_generate_vote_diff(&mut local, 0, Hash::default(), Some(0));
assert!(vote.slots.is_empty());
} | rust_cleaned_test_functions.jsonl/61146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
54360,
8378,
48851,
54360,
15850,
51932,
54360,
368,
341,
286,
1077,
5206,
2205,
284,
34034,
1397,
486,
2258,
543,
1789,
286,
442,
2441,
6910,
369,
9446,
220,
15,
1265,
470,
458,
4287,
6910... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_from_bit_enums() {
assert_eq!(
dr::Operand::LoopControl(spirv::LoopControl::DONT_UNROLL | spirv::LoopControl::UNROLL),
dr::Operand::from(spirv::LoopControl::DONT_UNROLL | spirv::LoopControl::UNROLL)
);
assert_eq!(
dr::Operand::MemoryAccess(spirv::MemoryAccess::NONE),
dr::Operand::from(spirv::MemoryAccess::NONE)
);
} | rust_cleaned_test_functions.jsonl/49204 | {
"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,
34910,
5673,
13996,
6205,
6237,
368,
341,
286,
2060,
10714,
33673,
310,
1353,
486,
29940,
486,
14620,
3273,
1141,
5565,
85,
486,
14620,
3273,
486,
35,
10232,
6735,
22284,
760,
18318,
85,
486,
1462... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hash() {
// Test data in json5 format for cleaner look
let data = r#"
{
name: "1361ee2a-e384-4eda-9f25-694affdeb30e",
content_address_storage: "fuchsia-blobs.googleusercontent.com",
type: "tuf",
attributes: {version: "63"},
artifacts: [
{ name: "one", merkle: "hash_1", sha256: "2", type: "package" },
{ name: "two", merkle: "hash_2", sha256: "3", type: "package" },
],
}"#;
// Parse the test data
let v: ArtifactStoreGroup = serde_json5::from_str(data).unwrap();
assert_eq!(get_artifact(&v, "one").unwrap().hash, "hash_1");
} | rust_cleaned_test_functions.jsonl/7944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8950,
368,
341,
286,
442,
3393,
821,
304,
2951,
20,
3561,
369,
31881,
1401,
198,
286,
1077,
821,
284,
435,
2,
698,
688,
341,
310,
829,
25,
330,
16,
18,
21,
16,
2127,
17,
64,
5655,
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_socketaddr() {
let addr = socketaddr!("127.0.0.1:10");
let ci = ContactInfo::new_with_socketaddr(&addr);
assert_eq!(ci.tpu, addr);
assert_eq!(ci.gossip.port(), 11);
assert_eq!(ci.tvu.port(), 12);
assert_eq!(ci.tpu_forwards.port(), 13);
assert_eq!(ci.rpc.port(), 8899);
assert_eq!(ci.rpc_pubsub.port(), 8900);
assert!(ci.storage_addr.ip().is_unspecified());
} | rust_cleaned_test_functions.jsonl/81573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19555,
6214,
368,
341,
286,
1077,
10789,
284,
7575,
6214,
17223,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
16,
15,
797,
286,
1077,
11825,
284,
9180,
1731,
486,
931,
6615,
19555,
6214,
2099,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_platform_monitor_memory_layout() {
use std::mem;
assert_eq!(
mem::size_of::<PlatformMonitor>(),
mem::size_of::<sys::ImGuiPlatformMonitor>()
);
assert_eq!(
mem::align_of::<PlatformMonitor>(),
mem::align_of::<sys::ImGuiPlatformMonitor>()
);
use sys::ImGuiPlatformMonitor;
macro_rules! assert_field_offset {
($l:ident, $r:ident) => {
assert_eq!(
memoffset::offset_of!(PlatformMonitor, $l),
memoffset::offset_of!(ImGuiPlatformMonitor, $r)
);
};
}
assert_field_offset!(main_pos, MainPos);
assert_field_offset!(main_size, MainSize);
assert_field_offset!(work_pos, WorkPos);
assert_field_offset!(work_size, WorkSize);
assert_field_offset!(dpi_scale, DpiScale);
} | rust_cleaned_test_functions.jsonl/54517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34260,
40112,
19195,
14466,
368,
341,
262,
990,
1460,
486,
10536,
280,
262,
2060,
10714,
33673,
286,
1833,
486,
2141,
3575,
27638,
17296,
30098,
65766,
286,
1833,
486,
2141,
3575,
27638,
7791,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq_legendre() {
use crate::fields::LegendreSymbol::*;
assert_eq!(QuadraticResidue, Fq::one().legendre());
assert_eq!(Zero, Fq::zero().legendre());
assert_eq!(
QuadraticResidue,
Fq::from_repr(BigInteger384::from(4)).legendre()
);
assert_eq!(
QuadraticNonResidue,
Fq::from_repr(BigInteger384::from(5)).legendre()
);
} | rust_cleaned_test_functions.jsonl/27359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
76612,
265,
368,
341,
262,
990,
17717,
486,
9007,
486,
39675,
265,
15090,
79304,
262,
2060,
10714,
10297,
2183,
88678,
1061,
60607,
11,
434,
80,
486,
603,
1005,
14505,
265,
1423,
262,
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_is_ascii_fail() {
let mut src: Vec<u8> = Vec::with_capacity(128);
src.resize(128, 0);
for i in 0..src.len() {
src[i] = i as u8;
}
for i in 0..src.len() {
let tail = &mut src[i..];
for j in 0..tail.len() {
tail[j] = 0xA0;
assert!(!is_ascii(tail));
}
}
} | rust_cleaned_test_functions.jsonl/27297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
50238,
22121,
368,
341,
286,
1077,
5206,
2286,
25,
11312,
34837,
23,
29,
284,
11312,
486,
4197,
35603,
7,
16,
17,
23,
317,
286,
2286,
17382,
7,
16,
17,
23,
11,
220,
15,
317,
286,
369,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_woff2_transformed_glyf_table_composite_glyph() {
let expected = Glyph {
number_of_contours: -1,
bounding_box: BoundingBox {
x_min: 205,
y_min: 0,
x_max: 4514,
y_max: 1434,
},
data: GlyphData::Composite {
glyphs: vec![
CompositeGlyph {
flags: CompositeGlyphFlag::from_bits_truncate(0x1027),
glyph_index: 7,
argument1: CompositeGlyphArgument::I16(3453),
argument2: CompositeGlyphArgument::I16(0),
scale: None,
},
CompositeGlyph {
flags: CompositeGlyphFlag::from_bits_truncate(0x1027),
glyph_index: 6,
argument1: CompositeGlyphArgument::I16(2773),
argument2: CompositeGlyphArgument::I16(0),
scale: None,
},
CompositeGlyph {
flags: CompositeGlyphFlag::from_bits_truncate(0x1027),
glyph_index: 5,
argument1: CompositeGlyphArgument::I16(1182),
argument2: CompositeGlyphArgument::I16(0),
scale: None,
},
CompositeGlyph {
flags: CompositeGlyphFlag::from_bits_truncate(0x1007),
glyph_index: 4,
argument1: CompositeGlyphArgument::I16(205),
argument2: CompositeGlyphArgument::I16(0),
scale: None,
},
],
instructions: &[],
},
};
with_woff2_glyf_table("tests/fonts/woff2/SFNT-TTF-Composite.woff2", |glyf| {
let actual = glyf
.records
.iter()
.map(|glyph| match glyph {
GlyfRecord::Parsed(
found @ Glyph {
data: GlyphData::Composite { .. },
..
},
) => Some(found),
_ => None,
})
.find(|candidate| candidate.is_some())
.unwrap()
.unwrap();
assert_eq!(*actual, expected)
});
} | rust_cleaned_test_functions.jsonl/40130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
68585,
17,
18449,
291,
1889,
398,
69,
5237,
2965,
13607,
88703,
368,
341,
1066,
262,
1077,
3601,
284,
87413,
341,
286,
1372,
3575,
10260,
2471,
25,
481,
16,
345,
286,
30618,
10194,
25,
425,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_json_rpc_spec() {
// # cargo -q run --bin generate-json-rpc-spec -- record
let status = std::process::Command::new(GENERATE_JSON_RPC_SPEC_BIN)
.arg("test")
.status()
.expect("failed to execute process");
assert!(status.success());
} | rust_cleaned_test_functions.jsonl/6347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
60799,
13594,
368,
341,
1066,
262,
442,
671,
25652,
481,
80,
1598,
1177,
6863,
6923,
56080,
3795,
3992,
57794,
1177,
3255,
198,
262,
1077,
2639,
284,
1460,
486,
4630,
486,
4062,
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_parse() -> Result<(), Box<dyn error::Error>> {
assert_eq!(
StructTag::RawStringLiteral(r#"`foo"bar`"#.to_owned()),
r#"`foo"bar`"#.parse()?
);
assert_eq!(
StructTag::InterpretedStringLiteral(r#""foo`bar""#.to_owned()),
r#""foo`bar""#.parse()?
);
assert_eq!(
StructTag::Convention(
vec![ConventionStructTag::Unknown(
"foo".to_owned(),
"bar".to_owned()
)]
.into_iter()
.collect()
),
r#"`foo:"bar"`"#.parse()?
);
Ok(())
} | rust_cleaned_test_functions.jsonl/2124 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
1464,
5714,
68843,
8261,
92846,
1465,
486,
1454,
2452,
341,
286,
2060,
10714,
33673,
310,
16139,
5668,
486,
20015,
703,
17350,
2601,
2,
39917,
7975,
1,
2257,
63,
57676,
13,
983,
51973,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_run_destructors() {
// Make sure that destructors get run on slice literals
struct Foo<'a> {
x: &'a Cell<isize>,
}
impl<'a> Drop for Foo<'a> {
fn drop(&mut self) {
self.x.set(self.x.get() + 1);
}
}
fn foo(x: &Cell<isize>) -> Foo<'_> {
Foo { x }
}
let x = &Cell::new(0);
{
let l = &[foo(x)];
assert_eq!(l[0].x.get(), 0);
}
assert_eq!(x.get(), 1);
} | rust_cleaned_test_functions.jsonl/9712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
14007,
2259,
91366,
368,
341,
262,
442,
7405,
2704,
429,
20780,
1087,
633,
1598,
389,
15983,
75275,
198,
262,
2036,
33428,
18291,
64,
29,
341,
286,
856,
25,
30136,
64,
13972,
27,
285,
551... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invite() {
let value = Invite {
approximate_member_count: Some(31),
approximate_presence_count: Some(7),
channel: Channel::Group(Group {
application_id: None,
icon: None,
id: ChannelId(2),
kind: ChannelType::Group,
last_message_id: None,
last_pin_timestamp: None,
name: None,
owner_id: UserId(3),
recipients: Vec::new(),
}),
code: "uniquecode".to_owned(),
guild: None,
inviter: None,
target_user_type: Some(TargetUserType::Stream),
target_user: None,
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "Invite",
len: 8,
},
Token::Str("approximate_member_count"),
Token::Some,
Token::U64(31),
Token::Str("approximate_presence_count"),
Token::Some,
Token::U64(7),
Token::Str("channel"),
Token::Struct {
name: "Group",
len: 9,
},
Token::Str("application_id"),
Token::None,
Token::Str("icon"),
Token::None,
Token::Str("id"),
Token::NewtypeStruct { name: "ChannelId" },
Token::Str("2"),
Token::Str("type"),
Token::U8(3),
Token::Str("last_message_id"),
Token::None,
Token::Str("last_pin_timestamp"),
Token::None,
Token::Str("name"),
Token::None,
Token::Str("owner_id"),
Token::NewtypeStruct { name: "UserId" },
Token::Str("3"),
Token::Str("recipients"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::StructEnd,
Token::Str("code"),
Token::Str("uniquecode"),
Token::Str("guild"),
Token::None,
Token::Str("inviter"),
Token::None,
Token::Str("target_user_type"),
Token::Some,
Token::U8(1),
Token::Str("target_user"),
Token::None,
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/107529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1614
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
94910,
368,
341,
286,
1077,
897,
284,
84923,
341,
310,
44868,
19388,
3180,
25,
4329,
7,
18,
16,
1326,
310,
44868,
56403,
3180,
25,
4329,
7,
22,
1326,
310,
5496,
25,
13434,
486,
2808,
79535,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_writer() {
let mut writer = Writer::new(Vec::new());
writer.write("id", Some("desc"), b"ACCGTAGGCTGA").unwrap();
writer.write("id2", None, b"ATTGTTGTTTTA").unwrap();
writer.flush().unwrap();
assert_eq!(writer.writer.get_ref(), &WRITE_FASTA_FILE);
} | rust_cleaned_test_functions.jsonl/62851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
368,
341,
286,
1077,
5206,
6916,
284,
29404,
486,
931,
49923,
486,
931,
1423,
286,
6916,
3836,
445,
307,
497,
4329,
445,
8614,
3975,
293,
1,
1706,
8798,
32144,
38,
1162,
16128,
1827,
1545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_email_listunsubscribe() {
let email = Email::new("test-from@email.org", "test-to@email.org", "Body text")
.with_list_unsubscribe("X-List-Unsubscribe: <http://www.host.com/list.cgi?cmd=unsub&lst=list>, <mailto:list-request@host.com?subject=unsubscribe>");
assert_eq!(email.to_string(), "{\"from\":\"test-from@email.org\",\"to\":\"test-to@email.org\",\"textbody\":\"Body text\",\"list_unsubscribe\":\"X-List-Unsubscribe: <http://www.host.com/list.cgi?cmd=unsub&lst=list>, <mailto:list-request@host.com?subject=unsubscribe>\"}");
} | rust_cleaned_test_functions.jsonl/67593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
9172,
2019,
90423,
368,
341,
262,
1077,
2551,
284,
8299,
486,
931,
445,
1944,
38051,
71776,
2659,
497,
330,
1944,
4686,
71776,
2659,
497,
330,
5444,
1467,
1138,
286,
659,
4197,
2019,
4907,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_on_allocate() {
// Make a heap
let heap = Heap::new(1000).unwrap();
let emtpy_size = heap.used_bytes();
let one_object_size;
// Fill heap
{
let scope = HandleScope::new(&heap);
scope.str("foo").unwrap();
one_object_size = heap.used_bytes() - emtpy_size;
// Loop until next allocate would fill heap
while heap.free_bytes() > one_object_size {
scope.str("foo").unwrap();
}
let full_size = heap.used_bytes();
// actually release anything else by the HandleScope.
heap.collect().unwrap();
assert_eq!(heap.used_bytes(), full_size);
}
assert!(heap.used_bytes() > one_object_size);
let scope = HandleScope::new(&heap);
scope.str("foo").unwrap();
assert_eq!(heap.used_bytes(), one_object_size);
} | rust_cleaned_test_functions.jsonl/6669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
4470,
77078,
368,
341,
286,
442,
7405,
264,
17364,
198,
286,
1077,
17364,
284,
47307,
486,
931,
7,
16,
15,
15,
15,
568,
15454,
543,
286,
1077,
976,
790,
88,
2368,
284,
17364,
83202,
125... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_ranges_of_device_sample_rate() {
if let Some(device) = test_get_default_device(Scope::Input) {
let ranges = get_ranges_of_device_sample_rate(device, DeviceType::INPUT).unwrap();
println!("ranges of input sample rate: {:?}", ranges);
} else {
println!("No input device.");
}
if let Some(device) = test_get_default_device(Scope::Output) {
let ranges = get_ranges_of_device_sample_rate(device, DeviceType::OUTPUT).unwrap();
println!("ranges of output sample rate: {:?}", ranges);
} else {
println!("No output device.");
}
} | rust_cleaned_test_functions.jsonl/113826 | {
"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,
3062,
58748,
3575,
9204,
17491,
9246,
368,
341,
262,
421,
1077,
4329,
17848,
8,
284,
1273,
3062,
9993,
9204,
3759,
2417,
486,
2505,
8,
341,
286,
1077,
21283,
284,
633,
58748,
3575,
9204,
17491,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vec_list_new() {
let list: VecList<i32> = VecList::new();
assert_eq!(list.capacity(), 0);
assert_eq!(list.len(), 0);
} | rust_cleaned_test_functions.jsonl/11542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
5921,
368,
341,
286,
1077,
1140,
25,
11312,
852,
21897,
18,
17,
29,
284,
11312,
852,
486,
931,
543,
286,
2060,
10714,
10297,
1607,
59168,
1507,
220,
15,
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 |
#[test]
fn test_trunc() {
assert_approx_eq!(1.0f64.trunc(), 1.0f64);
assert_approx_eq!(1.3f64.trunc(), 1.0f64);
assert_approx_eq!(1.5f64.trunc(), 1.0f64);
assert_approx_eq!(1.7f64.trunc(), 1.0f64);
assert_approx_eq!(0.0f64.trunc(), 0.0f64);
assert_approx_eq!((-0.0f64).trunc(), -0.0f64);
assert_approx_eq!((-1.0f64).trunc(), -1.0f64);
assert_approx_eq!((-1.3f64).trunc(), -1.0f64);
assert_approx_eq!((-1.5f64).trunc(), -1.0f64);
assert_approx_eq!((-1.7f64).trunc(), -1.0f64);
} | rust_cleaned_test_functions.jsonl/7435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
1347,
368,
341,
286,
2060,
90425,
10714,
10297,
16,
13,
15,
69,
21,
19,
5427,
1347,
1507,
220,
16,
13,
15,
69,
21,
19,
317,
286,
2060,
90425,
10714,
10297,
16,
13,
18,
69,
21,
19,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_edit() {
let mut code = JSON_EXAMPLE.as_bytes().to_vec();
let mut tree = parse_json_example();
let mut rand = Rand::new(0);
for _ in 0..10 {
let mut nodes_before = get_all_nodes(&tree);
let edit = get_random_edit(&mut rand, &mut code);
let mut tree2 = tree.clone();
let edit = perform_edit(&mut tree2, &mut code, &edit);
for node in nodes_before.iter_mut() {
node.edit(&edit);
}
let nodes_after = get_all_nodes(&tree2);
for (i, node) in nodes_before.into_iter().enumerate() {
assert_eq!(
(node.kind(), node.start_byte(), node.start_position()),
(
nodes_after[i].kind(),
nodes_after[i].start_byte(),
nodes_after[i].start_position()
),
);
}
tree = tree2;
}
} | rust_cleaned_test_functions.jsonl/99269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
13156,
368,
341,
262,
1077,
5206,
2038,
284,
4718,
4966,
18918,
5357,
12524,
1005,
983,
13251,
543,
262,
1077,
5206,
4916,
284,
4715,
9455,
39304,
543,
262,
1077,
5206,
10382,
284,
23963,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_bind_two_consecutive_in_range() {
solana_logger::setup();
let ip_addr = IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0));
if let Ok(((port1, _), (port2, _))) = bind_two_consecutive_in_range(ip_addr, (1024, 65535))
{
assert!(port2 == port1 + 1);
}
} | rust_cleaned_test_functions.jsonl/43718 | {
"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,
27461,
23241,
3382,
85780,
1243,
9698,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
5997,
7387,
284,
35033,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
486,
931,
7,
15,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_cgroup_path() {
let cid = "sample_container_id";
assert_eq!(
get_cgroup_path(&None, cid, false),
PathBuf::from("sample_container_id")
);
assert_eq!(
get_cgroup_path(&Some(PathBuf::from("/youki")), cid, false),
PathBuf::from("/youki")
);
} | rust_cleaned_test_functions.jsonl/115231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
666,
4074,
2638,
368,
341,
286,
1077,
32141,
284,
330,
13611,
15847,
842,
876,
286,
2060,
10714,
33673,
310,
633,
666,
4074,
2638,
2099,
4064,
11,
32141,
11,
895,
1326,
310,
7933,
15064,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_changed_ranges() {
let source_code = b"{a: null};\n".to_vec();
let mut parser = Parser::new();
parser.set_language(get_language("javascript")).unwrap();
let tree = parser.parse(&source_code, None).unwrap();
assert_eq!(
tree.root_node().to_sexp(),
"(program (expression_statement (object (pair (property_identifier) (null)))))"
);
// Updating one token
{
let mut tree = tree.clone();
let mut source_code = source_code.clone();
// Replace `null` with `nothing` - that token has changed syntax
let edit = Edit {
position: index_of(&source_code, "ull"),
deleted_length: 3,
inserted_text: b"othing".to_vec(),
};
let inverse_edit = invert_edit(&source_code, &edit);
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, edit);
assert_eq!(ranges, vec![range_of(&source_code, "nothing")]);
// Replace `nothing` with `null` - that token has changed syntax
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, inverse_edit);
assert_eq!(ranges, vec![range_of(&source_code, "null")]);
}
// Changing only leading whitespace
{
let mut tree = tree.clone();
let mut source_code = source_code.clone();
// Insert leading newline - no changed ranges
let edit = Edit {
position: 0,
deleted_length: 0,
inserted_text: b"\n".to_vec(),
};
let inverse_edit = invert_edit(&source_code, &edit);
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, edit);
assert_eq!(ranges, vec![]);
// Remove leading newline - no changed ranges
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, inverse_edit);
assert_eq!(ranges, vec![]);
}
// Inserting elements
{
let mut tree = tree.clone();
let mut source_code = source_code.clone();
// Insert a key-value pair before the `}` - those tokens are changed
let edit1 = Edit {
position: index_of(&source_code, "}"),
deleted_length: 0,
inserted_text: b", b: false".to_vec(),
};
let inverse_edit1 = invert_edit(&source_code, &edit1);
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, edit1);
assert_eq!(ranges, vec![range_of(&source_code, ", b: false")]);
let edit2 = Edit {
position: index_of(&source_code, ", b"),
deleted_length: 0,
inserted_text: b", c: 1".to_vec(),
};
let inverse_edit2 = invert_edit(&source_code, &edit2);
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, edit2);
assert_eq!(ranges, vec![range_of(&source_code, ", c: 1")]);
// Remove the middle pair
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, inverse_edit2);
assert_eq!(ranges, vec![]);
// Remove the second pair
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, inverse_edit1);
assert_eq!(ranges, vec![]);
}
// Wrapping elements in larger expressions
{
let mut tree = tree.clone();
let mut source_code = source_code.clone();
// Replace `null` with the binary expression `b === null`
let edit1 = Edit {
position: index_of(&source_code, "null"),
deleted_length: 0,
inserted_text: b"b === ".to_vec(),
};
let inverse_edit1 = invert_edit(&source_code, &edit1);
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, edit1);
assert_eq!(ranges, vec![range_of(&source_code, "b === null")]);
// Undo
let ranges = get_changed_ranges(&mut parser, &mut tree, &mut source_code, inverse_edit1);
assert_eq!(ranges, vec![range_of(&source_code, "null")]);
}
} | rust_cleaned_test_functions.jsonl/131722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
25213,
58748,
368,
341,
262,
1077,
2530,
4136,
284,
293,
14129,
64,
25,
845,
11061,
59,
77,
3263,
983,
13251,
1428,
262,
1077,
5206,
6729,
284,
21102,
486,
931,
543,
262,
6729,
980,
29021,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_define_int() {
let cxx = indoc! {"
"};
let hdr = indoc! {"
#define BOB 3
"};
let rs = quote! {
assert_eq!(ffi::BOB, 3);
};
run_test(cxx, hdr, rs, &["BOB"], &[]);
} | rust_cleaned_test_functions.jsonl/9759 | {
"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,
51049,
4042,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
262,
330,
2440,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
1289,
7811,
33,
220,
18,
198,
262,
330,
244... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_f4v() {
let format = FileFormat::from_file("fixtures/video/sample.f4v").unwrap();
assert_eq!(format, FileFormat::AdobeFlashPlayerVideo);
} | rust_cleaned_test_functions.jsonl/115183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
19,
85,
368,
341,
262,
1077,
3561,
284,
2887,
4061,
486,
1499,
2458,
445,
45247,
41303,
69851,
833,
19,
85,
1827,
15454,
543,
262,
2060,
10714,
10297,
2243,
11,
2887,
4061,
486,
81605,
2387... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_addr_iter_multi() {
let localhost = SocketAddr::from((IpAddr::from(Ipv4Addr::LOCALHOST), 8080));
let unspecified = SocketAddr::from((IpAddr::from(Ipv4Addr::UNSPECIFIED), 8080));
let mut addrs = VecDeque::new();
addrs.push_back(localhost);
addrs.push_back(unspecified);
let mut iter = AddrsIter::Multi(addrs.iter());
assert_eq!(iter.next(), Some(localhost));
assert_eq!(iter.next(), Some(unspecified));
assert_eq!(iter.next(), None);
} | rust_cleaned_test_functions.jsonl/32858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7387,
11723,
25133,
368,
341,
286,
1077,
47422,
284,
20954,
13986,
486,
1499,
1188,
23378,
13986,
486,
1499,
8972,
30168,
19,
13986,
486,
39081,
28687,
701,
220,
23,
15,
23,
15,
1106,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_migrations_backward() {
// The same manifest as `test_migrations_forward` but this time we will migrate backward.
let path = "./tests/data/migrations.json";
let manifest: Manifest = serde_json::from_reader(File::open(path).unwrap()).unwrap();
let from = Version::parse("1.5.0").unwrap();
let to = Version::parse("1.0.0").unwrap();
let targets = find_migrations(&from, &to, &manifest).unwrap();
assert!(targets.len() == 3);
let mut i = targets.iter();
assert!(i.next().unwrap() == "migration_1.5.0_shortcut");
assert!(i.next().unwrap() == "migration_1.1.0_b");
assert!(i.next().unwrap() == "migration_1.1.0_a");
} | rust_cleaned_test_functions.jsonl/49371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
17824,
70477,
368,
341,
286,
442,
576,
1852,
14455,
438,
1565,
1944,
717,
17824,
32121,
63,
714,
419,
882,
582,
686,
44566,
27555,
624,
286,
1077,
1815,
284,
5924,
23841,
13167,
3183,
17824,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_max() {
let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
assert_eq!(v[..4].iter().cloned().max(), Some(3));
assert_eq!(v.iter().cloned().max(), Some(10));
assert_eq!(v[..0].iter().cloned().max(), None);
assert_eq!(v.iter().cloned().map(Mod3).max().map(|x| x.0), Some(8));
} | rust_cleaned_test_functions.jsonl/54119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
6345,
368,
341,
262,
1077,
348,
25,
609,
13496,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_2() {
assert_eq!(
parse_column_extra(&mut Parser::new(
"DEFAULT_GENERATED on update CURRENT_TIMESTAMP"
)),
ColumnExtra {
auto_increment: false,
on_update_current_timestamp: true,
generated: false,
default_generated: true,
}
);
} | rust_cleaned_test_functions.jsonl/73831 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8744,
31858,
2099,
6984,
21102,
486,
931,
1006,
394,
330,
17285,
18693,
9005,
389,
2647,
43107,
47854,
698,
310,
39290,
310,
9332,
11612,
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_dicom_time() {
assert_eq!(
DicomTime::from_hms_micro(9, 1, 1, 123456).unwrap(),
DicomTime(DicomTimeImpl::Fraction(9, 1, 1, 123456, 6))
);
assert_eq!(
DicomTime::from_hms_micro(9, 1, 1, 1).unwrap(),
DicomTime(DicomTimeImpl::Fraction(9, 1, 1, 1, 6))
);
assert_eq!(
DicomTime::from_hms(9, 0, 0).unwrap(),
DicomTime(DicomTimeImpl::Second(9, 0, 0))
);
assert_eq!(
DicomTime::from_hm(23, 59).unwrap(),
DicomTime(DicomTimeImpl::Minute(23, 59))
);
assert_eq!(
DicomTime::from_h(1).unwrap(),
DicomTime(DicomTimeImpl::Hour(1))
);
assert_eq!(
DicomTime::from_hms_milli(9, 1, 1, 123)
.unwrap()
.earliest()
.unwrap(),
NaiveTime::from_hms_micro(9, 1, 1, 123_000)
);
assert_eq!(
DicomTime::from_hms_milli(9, 1, 1, 123)
.unwrap()
.latest()
.unwrap(),
NaiveTime::from_hms_micro(9, 1, 1, 123_999)
);
assert_eq!(
DicomTime::from_hms_milli(9, 1, 1, 2)
.unwrap()
.earliest()
.unwrap(),
NaiveTime::from_hms_micro(9, 1, 1, 002000)
);
assert_eq!(
DicomTime::from_hms_milli(9, 1, 1, 2)
.unwrap()
.latest()
.unwrap(),
NaiveTime::from_hms_micro(9, 1, 1, 002999)
);
assert_eq!(
DicomTime::from_hms_micro(9, 1, 1, 123456)
.unwrap()
.is_precise(),
true
);
assert_eq!(
DicomTime::from_hms_milli(9, 1, 1, 1).unwrap(),
DicomTime(DicomTimeImpl::Fraction(9, 1, 1, 1, 3))
);
assert_eq!(
DicomTime::try_from(&NaiveTime::from_hms_milli(16, 31, 28, 123)).unwrap(),
DicomTime(DicomTimeImpl::Fraction(16, 31, 28, 123_000, 6))
);
assert_eq!(
DicomTime::try_from(&NaiveTime::from_hms_micro(16, 31, 28, 123)).unwrap(),
DicomTime(DicomTimeImpl::Fraction(16, 31, 28, 000123, 6))
);
assert_eq!(
DicomTime::try_from(&NaiveTime::from_hms_micro(16, 31, 28, 1234)).unwrap(),
DicomTime(DicomTimeImpl::Fraction(16, 31, 28, 001234, 6))
);
assert_eq!(
DicomTime::try_from(&NaiveTime::from_hms_micro(16, 31, 28, 0)).unwrap(),
DicomTime(DicomTimeImpl::Fraction(16, 31, 28, 0, 6))
);
assert_eq!(
DicomTime::from_hmsf(9, 1, 1, 1, 4).unwrap().to_string(),
"09:01:01.0001"
);
assert_eq!(
DicomTime::from_hmsf(9, 1, 1, 0, 1).unwrap().to_string(),
"09:01:01.0"
);
assert_eq!(
DicomTime::from_hmsf(7, 55, 1, 1, 5).unwrap().to_encoded(),
"075501.00001"
);
// any precision for zero is just one zero
assert_eq!(
DicomTime::from_hmsf(9, 1, 1, 0, 6).unwrap().to_encoded(),
"090101.0"
);
assert!(matches!(
DicomTime::from_hmsf(9, 1, 1, 1, 7),
Err(Error::FractionPrecisionRange { value: 7, .. })
));
assert!(matches!(
DicomTime::from_hms_milli(9, 1, 1, 1000),
Err(Error::InvalidComponent {
component: DateComponent::Millisecond,
..
})
));
assert!(matches!(
DicomTime::from_hmsf(9, 1, 1, 123456, 3),
Err(Error::FractionPrecisionMismatch {
fraction: 123456,
precision: 3,
..
})
));
assert!(matches!(
DicomTime::try_from(&NaiveTime::from_hms_micro(16, 31, 28, 1_000_000)),
Err(Error::InvalidComponent {
component: DateComponent::Fraction,
..
})
));
assert!(matches!(
DicomTime::from_hmsf(9, 1, 1, 12345, 5).unwrap().exact(),
Err(crate::value::range::Error::ImpreciseValue { .. })
));
} | rust_cleaned_test_functions.jsonl/105188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2609
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39154,
316,
3009,
368,
341,
286,
2060,
10714,
33673,
310,
422,
53994,
1462,
486,
1499,
1523,
1011,
73003,
7,
24,
11,
220,
16,
11,
220,
16,
11,
220,
16,
17,
18,
19,
20,
21,
568,
15454,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_if_expression_alt() {
let exp = statement_expression("if (x < y) { x } else { z }");
let (cond, conds, alts) = match exp {
Expression::If {
condition,
consequence,
alternative: Some(alternative),
..
} => {
let conds = match *consequence {
Statement::Block {
statements: conds, ..
} => conds,
_ => panic!("Expected block"),
};
let alts = match *alternative {
Statement::Block {
statements: alts, ..
} => alts,
_ => panic!("Expected block"),
};
(condition, conds, alts)
}
_ => panic!("Expected if"),
};
verify_infix_ident(*cond, "x", "<", "y");
assert_eq!(1, conds.len());
match &conds[0] {
Statement::Expression {
value: Expression::Identifier(Identifier { value, .. }),
..
} => assert_eq!("x", value),
_ => panic!("Expected identifier"),
}
assert_eq!(1, alts.len());
match &alts[0] {
Statement::Expression {
value: Expression::Identifier(Identifier { value, .. }),
..
} => assert_eq!("z", value),
_ => panic!("Expected identifier"),
}
} | rust_cleaned_test_functions.jsonl/64081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 885
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
28068,
32105,
368,
341,
286,
1077,
1343,
284,
5114,
28068,
445,
333,
320,
87,
366,
379,
8,
314,
856,
335,
770,
314,
1147,
335,
797,
286,
1077,
320,
1297,
11,
390,
5356,
11,
452,
2576,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_case_part_1() {
let input = "0,9 -> 5,9
8,0 -> 0,8
9,4 -> 3,4
2,2 -> 2,1
7,0 -> 7,4
6,4 -> 2,0
0,9 -> 2,9
3,4 -> 1,4
0,0 -> 8,8
5,5 -> 8,2";
assert_eq!(5, part1(input).unwrap())
} | rust_cleaned_test_functions.jsonl/69279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
10495,
62,
16,
368,
341,
286,
1077,
1946,
284,
330,
15,
11,
24,
1464,
220,
20,
11,
24,
198,
23,
11,
15,
1464,
220,
15,
11,
23,
198,
24,
11,
19,
1464,
220,
18,
11,
19,
198,
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... | 1 |
#[test]
fn test_debug() {
let sgm = SgMap::from([(3, 4), (1, 2), (5, 6)]);
let btm = BTreeMap::from([(3, 4), (1, 2), (5, 6)]);
assert!(sgm.iter().eq(btm.iter()));
let sgt_str = format!("{:#?}", sgm);
let btm_str = format!("{:#?}", btm);
assert_eq!(sgt_str, btm_str);
println!("DEBUG:\n{}", sgt_str);
} | rust_cleaned_test_functions.jsonl/18643 | {
"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,
15446,
368,
341,
262,
1077,
274,
26186,
284,
328,
70,
2227,
486,
1499,
58590,
18,
11,
220,
19,
701,
320,
16,
11,
220,
17,
701,
320,
20,
11,
220,
21,
41958,
262,
1077,
293,
13730,
284,
425,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_offset_u8() {
let s = b"abcd123";
let a = &s[..];
let b = &a[2..];
let c = &a[..4];
let d = &a[3..5];
assert_eq!(a.offset(b), 2);
assert_eq!(a.offset(c), 0);
assert_eq!(a.offset(d), 3);
} | rust_cleaned_test_functions.jsonl/30005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6917,
7300,
23,
368,
341,
262,
1077,
274,
284,
293,
1,
68644,
16,
17,
18,
876,
262,
1077,
264,
284,
609,
82,
95874,
935,
262,
1077,
293,
284,
609,
64,
58,
17,
496,
935,
262,
1077,
272,
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_zsh_completions() {
let mut config = FrumConfig::default();
config.base_dir = Some(tempdir().unwrap().path().to_path_buf());
let file = File::open("completions/frum.zsh").unwrap();
let mut buf_reader = BufReader::new(file);
let mut expected = String::new();
buf_reader.read_to_string(&mut expected).unwrap();
let actual = customize_completions(Shell::Zsh).unwrap();
assert_diff!(actual.as_str(), expected.as_str(), "\n", 0);
} | rust_cleaned_test_functions.jsonl/106654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
927,
2965,
10819,
908,
368,
341,
286,
1077,
5206,
2193,
284,
2869,
372,
2648,
486,
2258,
543,
286,
2193,
8928,
4334,
284,
4329,
9758,
3741,
1005,
15454,
1005,
2343,
1005,
983,
2638,
10363,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_embed_author_name_limit() {
let mut embed = base_embed();
embed.author.replace(EmbedAuthor {
icon_url: None,
name: Some(str::repeat("a", 256)),
proxy_icon_url: None,
url: None,
});
assert!(super::embed(&embed).is_ok());
embed.author.replace(EmbedAuthor {
icon_url: None,
name: Some(str::repeat("a", 257)),
proxy_icon_url: None,
url: None,
});
assert!(matches!(
super::embed(&embed).unwrap_err().kind(),
EmbedValidationErrorType::AuthorNameTooLarge { chars: 257 }
));
} | rust_cleaned_test_functions.jsonl/29942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24007,
22938,
1269,
14763,
368,
341,
286,
1077,
5206,
11579,
284,
2331,
24007,
543,
286,
11579,
16314,
6980,
7,
25486,
7133,
341,
310,
4603,
2903,
25,
2240,
345,
310,
829,
25,
4329,
4199,
486,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_coords_from_text_only_ints() {
let txt = "1 2 3";
let res = coords_from_text(0, txt);
assert!(res.is_ok());
let pt = res.unwrap();
assert_eq!(1, pt.id);
assert_eq!(2, pt.dim());
assert_eq!(Some(2.0), pt.get(0));
assert_eq!(Some(3.0), pt.get(1));
} | rust_cleaned_test_functions.jsonl/58852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32576,
5673,
4326,
18410,
4042,
82,
368,
341,
286,
1077,
7932,
284,
330,
16,
220,
17,
220,
18,
3302,
286,
1077,
592,
284,
23897,
5673,
4326,
7,
15,
11,
7932,
317,
286,
2060,
10297,
416,
2079,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lex_sort_mixed_types2() {
// test mix of string and in64 with option
let c1 = Int64Array::from(&[Some(0), Some(2), Some(-1), Some(0)]);
let c2 = Utf8Array::<i32>::from(&vec![Some("foo"), Some("9"), Some("7"), Some("bar")]);
let input = vec![
SortColumn {
values: &c1,
options: Some(SortOptions {
descending: true,
nulls_first: true,
}),
},
SortColumn {
values: &c2,
options: Some(SortOptions {
descending: true,
nulls_first: true,
}),
},
];
let expected = vec![
Box::new(Int64Array::from(&[Some(2), Some(0), Some(0), Some(-1)])) as Box<dyn Array>,
Box::new(Utf8Array::<i32>::from(&vec![
Some("9"),
Some("foo"),
Some("bar"),
Some("7"),
])) as Box<dyn Array>,
];
test_lex_sort_arrays(input, expected);
} | rust_cleaned_test_functions.jsonl/23572 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 658
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74547,
18435,
717,
3286,
9763,
17,
368,
341,
286,
442,
1273,
6514,
315,
914,
323,
304,
21,
19,
448,
2999,
198,
286,
1077,
272,
16,
284,
1333,
21,
19,
1857,
486,
1499,
2099,
58,
8373,
7,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vrf() {
let private_key = string_to_bytes_utf8("random key");
let public_key = WedprCurve25519Vrf::derive_public_key(&private_key);
let message = string_to_bytes_utf8("test message");
assert_eq!(WedprCurve25519Vrf::is_valid_public_key(&public_key), true);
// Private key is not a public key.
assert_eq!(
WedprCurve25519Vrf::is_valid_public_key(&private_key),
false
);
let proof = WedprCurve25519Vrf::prove(&private_key, &message).unwrap();
assert_eq!(proof.verify(&public_key, &message), true);
let proof_hash = proof.proof_to_hash().unwrap();
// TODO: Add the expected value here.
println!("hash_proof = {:?}", proof_hash);
let invalid_private_key = string_to_bytes_utf8("invalid key");
assert_eq!(
WedprCurve25519Vrf::prove(&invalid_private_key, &message)
.unwrap()
.verify(&public_key, &message),
false
);
let recovered_proof =
WedprCurve25519Vrf::decode_proof(&proof.encode_proof()).unwrap();
assert_eq!(recovered_proof.verify(&public_key, &message), true);
} | rust_cleaned_test_functions.jsonl/28508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 574
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
8052,
368,
341,
286,
1077,
869,
3097,
284,
914,
2346,
12524,
39453,
23,
445,
11463,
1376,
797,
286,
1077,
584,
3097,
284,
6521,
649,
31325,
17,
20,
20,
16,
24,
53,
8052,
486,
27098,
2707... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_point_size_equals_size_of_two_scalars_used_in_alloc_run_pos() {
use std::mem;
assert_eq!(mem::size_of::<Point>(), mem::size_of::<[scalar; 2]>())
} | rust_cleaned_test_functions.jsonl/82888 | {
"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,
6085,
2368,
61664,
2368,
3575,
23241,
28656,
1561,
27803,
1243,
14802,
14007,
6479,
368,
341,
262,
990,
1460,
486,
10536,
280,
262,
2060,
10714,
10297,
10536,
486,
2141,
3575,
27638,
2609,
39019,
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 |
#[test]
fn test_fold_get_elem2_1() {
fold("x = 'string'[5]", "x = 'g'");
fold("x = 'string'[0]", "x = 's'");
fold("x = 's'[0]", "x = 's'");
fold("x = '\\uD83D\\uDCA9'[0]", "x = '\\uD83D'");
fold("x = '\\uD83D\\uDCA9'[1]", "x = '\\uDCA9'");
} | rust_cleaned_test_functions.jsonl/122193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
3062,
28179,
17,
62,
16,
368,
341,
262,
11555,
445,
87,
284,
364,
917,
66895,
20,
19076,
330,
87,
284,
364,
70,
28116,
262,
11555,
445,
87,
284,
364,
917,
66895,
15,
19076,
330,
87,
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_alphanumeric_h() {
let data = "H";
let res = encode_alphanumeric(data.as_bytes());
let goal: usize = 0b010001;
assert_eq!(res[0], BitsWithLength(goal, 6));
} | rust_cleaned_test_functions.jsonl/114436 | {
"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,
8418,
65788,
1523,
368,
341,
286,
1077,
821,
284,
330,
39,
876,
286,
1077,
592,
284,
16164,
8418,
65788,
2592,
5357,
12524,
1423,
286,
1077,
5795,
25,
22301,
284,
220,
15,
65,
15,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_min_max_pointer() {
let object = json!({
"name": "John",
"age": {
"human": "$max",
"dog": 49,
}
});
let ptr = get_min_max_pointer(&object.as_object().unwrap());
// A Result containing an Option containing a tuple
assert_eq!(
ptr.unwrap().unwrap(),
MinMaxPointer { pointer: "/age/human".to_string(), is_min: false }
)
} | rust_cleaned_test_functions.jsonl/7945 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7260,
6345,
21425,
368,
341,
286,
1077,
1633,
284,
2951,
0,
2262,
310,
330,
606,
788,
330,
13079,
756,
310,
330,
424,
788,
341,
394,
330,
25312,
788,
5201,
2810,
756,
394,
330,
18457,
78... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_revocation() {
let mut deps = mock_dependencies(&[]);
deps.querier.with_terraswap_pairs(&[
(&"uusdasset0000".to_string(), &"LP0000".to_string()),
(&"uusdasset0001".to_string(), &"LP0001".to_string()),
(&"uusdmirror0000".to_string(), &"MIRLP000".to_string()),
]);
deps.querier.with_oracle_price(&[
(&"asset0000".to_string(), &Decimal::percent(100)),
(&"asset0001".to_string(), &Decimal::percent(200)),
]);
deps.querier.with_mint_configs(&[
(
&"asset0000".to_string(),
&(Decimal::percent(1), Decimal::percent(1)),
),
(
&"asset0001".to_string(),
&(Decimal::percent(1), Decimal::percent(1)),
),
]);
let msg = InstantiateMsg {
base_denom: BASE_DENOM.to_string(),
token_code_id: TOKEN_CODE_ID,
distribution_schedule: vec![],
};
let info = mock_info("addr0000", &[]);
let _res = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap();
let msg = ExecuteMsg::PostInitialize {
owner: "owner0000".to_string(),
mirror_token: "mirror0000".to_string(),
mint_contract: "mint0000".to_string(),
staking_contract: "staking0000".to_string(),
commission_collector: "collector0000".to_string(),
oracle_contract: "oracle0000".to_string(),
terraswap_factory: "terraswapfactory".to_string(),
};
let _res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
whitelist_token(&mut deps, "tesla derivative", "mTSLA", "asset0000", 100u32);
whitelist_token(&mut deps, "apple derivative", "mAPPL", "asset0001", 100u32);
// unauthorized revoke attempt
let msg = ExecuteMsg::RevokeAsset {
asset_token: "asset0000".to_string(),
};
let info = mock_info("address0000", &[]);
let err = execute(deps.as_mut(), mock_env(), info, msg.clone()).unwrap_err();
match err {
StdError::GenericErr { msg, .. } => assert_eq!(msg, "unauthorized"),
_ => panic!("DO NOT ENTER HERE"),
}
// SUCCESS - revoke item 1
let info = mock_info("owner0000", &[]);
let res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
assert_eq!(
res.messages,
vec![SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute {
contract_addr: "mint0000".to_string(),
funds: vec![],
msg: to_binary(&MintExecuteMsg::RegisterMigration {
asset_token: "asset0000".to_string(),
end_price: Decimal::percent(100), // last price feed
})
.unwrap(),
}))]
);
let msg = ExecuteMsg::RevokeAsset {
asset_token: "asset0001".to_string(),
};
// SUCCESS - revoke item 2
let info = mock_info("owner0000", &[]);
let res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
assert_eq!(
res.messages,
vec![SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute {
contract_addr: "mint0000".to_string(),
funds: vec![],
msg: to_binary(&MintExecuteMsg::RegisterMigration {
asset_token: "asset0001".to_string(),
end_price: Decimal::percent(200), // last price feed
})
.unwrap(),
}))]
);
} | rust_cleaned_test_functions.jsonl/36377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38082,
2276,
368,
341,
262,
1077,
5206,
48178,
284,
7860,
71841,
2099,
56703,
262,
48178,
13,
15959,
1268,
18164,
72493,
12784,
21726,
36430,
2099,
9640,
286,
15899,
1,
84,
355,
67,
9852,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.