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_wpa3_get_auth_method() {
let bss = fake_bss!(Wpa3);
let credential = fidl_sme::Credential::Password(vec![0xBB; 8]);
let protection = get_wpa3_rsna(&fake_device_info(CLIENT_ADDR), &credential, &bss)
.expect("expected successful SAE RSNA with valid credential");
assert_variant!(protection, Protection::Rsna(rsna) => {
assert_eq!(rsna.supplicant.get_auth_method(), auth::MethodName::Sae);
});
} | rust_cleaned_test_functions.jsonl/6071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
6595,
18,
3062,
14014,
9032,
368,
341,
286,
1077,
293,
778,
284,
12418,
880,
778,
10297,
54,
6595,
18,
317,
286,
1077,
40207,
284,
32104,
75,
643,
2660,
486,
48265,
486,
4876,
25592,
20703... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solution_works() {
let solution = solution().unwrap();
let real_solution = Birthday {
month: Month::July,
day: 16,
};
assert_eq!(solution, real_solution);
} | rust_cleaned_test_functions.jsonl/84353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50274,
11498,
82,
368,
341,
262,
1077,
6291,
284,
6291,
1005,
15454,
1428,
262,
1077,
1931,
50274,
284,
36240,
341,
286,
2254,
25,
19397,
486,
28427,
345,
286,
1899,
25,
220,
16,
21,
345,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_read_buffer_to_env_and_flags() {
let buff = Cursor::new(
"
cargo:rustc-link-lib=sdfsdf
cargo:rustc-env=FOO=BAR
cargo:rustc-link-search=/some/absolute/path/bleh
cargo:rustc-env=BAR=FOO
cargo:rustc-flags=-Lblah
cargo:rerun-if-changed=ignored
cargo:rustc-cfg=feature=awesome
cargo:version=123
cargo:version_number=1010107f
cargo:include_path=/some/absolute/path/include
cargo:rustc-env=SOME_PATH=/some/absolute/path/beep
",
);
let reader = BufReader::new(buff);
let result = BuildScriptOutput::from_reader(reader);
assert_eq!(result.len(), 10);
assert_eq!(result[0], BuildScriptOutput::LinkLib("sdfsdf".to_owned()));
assert_eq!(result[1], BuildScriptOutput::Env("FOO=BAR".to_owned()));
assert_eq!(
result[2],
BuildScriptOutput::LinkSearch("/some/absolute/path/bleh".to_owned())
);
assert_eq!(result[3], BuildScriptOutput::Env("BAR=FOO".to_owned()));
assert_eq!(result[4], BuildScriptOutput::Flags("-Lblah".to_owned()));
assert_eq!(
result[5],
BuildScriptOutput::Cfg("feature=awesome".to_owned())
);
assert_eq!(
result[6],
BuildScriptOutput::DepEnv("VERSION=123".to_owned())
);
assert_eq!(
result[7],
BuildScriptOutput::DepEnv("VERSION_NUMBER=1010107f".to_owned())
);
assert_eq!(
result[9],
BuildScriptOutput::Env("SOME_PATH=/some/absolute/path/beep".to_owned())
);
assert_eq!(
BuildScriptOutput::to_dep_env(&result, "ssh2", "/some/absolute/path"),
"DEP_SSH2_VERSION=123\nDEP_SSH2_VERSION_NUMBER=1010107f\nDEP_SSH2_INCLUDE_PATH=${pwd}/include".to_owned()
);
assert_eq!(
BuildScriptOutput::to_env(&result, "/some/absolute/path"),
"FOO=BAR\nBAR=FOO\nSOME_PATH=${pwd}/beep".to_owned()
);
assert_eq!(
BuildScriptOutput::to_flags(&result, "/some/absolute/path"),
CompileAndLinkFlags {
compile_flags: "-Lblah\n--cfg=feature=awesome".to_owned(),
link_flags: "-lsdfsdf\n-L${pwd}/bleh".to_owned(),
}
);
} | rust_cleaned_test_functions.jsonl/93536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
6443,
7776,
2346,
15879,
8378,
14130,
368,
341,
286,
1077,
11522,
284,
28067,
486,
931,
1006,
310,
6228,
66715,
25,
35788,
66,
8965,
38641,
14149,
34378,
2940,
198,
66715,
25,
35788,
66,
674... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unnamed_values() {
let build = |len, values| build(&Values::Unnamed(len, values));
assert_eq!(build(1, vec![MinkowskiType::Long(1)]),
"VALUES (1)");
assert_eq!(build(2, vec![MinkowskiType::Boolean(false), MinkowskiType::Long(1)]),
"VALUES (0, 1)");
assert_eq!(build(2, vec![MinkowskiType::Boolean(false), MinkowskiType::Long(1),
MinkowskiType::Boolean(true), MinkowskiType::Long(2)]),
"VALUES (0, 1), (1, 2)");
} | rust_cleaned_test_functions.jsonl/45650 | {
"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,
4907,
30245,
9146,
368,
341,
286,
1077,
1936,
284,
760,
2892,
11,
2750,
91,
1936,
2099,
6227,
486,
78925,
6901,
11,
2750,
3237,
286,
2060,
10714,
10297,
5834,
7,
16,
11,
7486,
20703,
44,
766,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_occupied_entry_ref_replace_entry_with() {
let mut a: HashMap<std::string::String, &str> = HashMap::new();
let key = "a key";
let value = "an initial value";
let new_value = "a new value";
let entry = a.entry_ref(key).insert(value).replace_entry_with(|k, v| {
assert_eq!(k, key);
assert_eq!(v, value);
Some(new_value)
});
match entry {
EntryRef::Occupied(e) => {
assert_eq!(e.key(), key);
assert_eq!(e.get(), &new_value);
}
EntryRef::Vacant(_) => panic!(),
}
assert_eq!(a[key], new_value);
assert_eq!(a.len(), 1);
let entry = match a.entry_ref(key) {
EntryRef::Occupied(e) => e.replace_entry_with(|k, v| {
assert_eq!(k, key);
assert_eq!(v, new_value);
None
}),
EntryRef::Vacant(_) => panic!(),
};
match entry {
EntryRef::Vacant(e) => assert_eq!(e.key(), key),
EntryRef::Occupied(_) => panic!(),
}
assert!(!a.contains_key(key));
assert_eq!(a.len(), 0);
} | rust_cleaned_test_functions.jsonl/26980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 679
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
40356,
9078,
7793,
10633,
9078,
6615,
368,
341,
286,
1077,
5206,
264,
25,
10528,
8050,
486,
917,
486,
703,
11,
609,
495,
29,
284,
10528,
486,
931,
1428,
286,
1077,
1376,
284,
330,
64,
1376... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_calc_invoice_hash() {
use ::{RawInvoice, RawHrp, RawDataPart, Currency, PositiveTimestamp};
use ::TaggedField::*;
let invoice = RawInvoice {
hrp: RawHrp {
currency: Currency::Bitcoin,
raw_amount: None,
si_prefix: None,
},
data: RawDataPart {
timestamp: PositiveTimestamp::from_unix_timestamp(1496314658).unwrap(),
tagged_fields: vec![
PaymentHash(::Sha256(sha256::Hash::from_hex(
"0001020304050607080900010203040506070809000102030405060708090102"
).unwrap())).into(),
Description(::Description::new(
"Please consider supporting this project".to_owned()
).unwrap()).into(),
],
},
};
let expected_hash = [
0xc3, 0xd4, 0xe8, 0x3f, 0x64, 0x6f, 0xa7, 0x9a, 0x39, 0x3d, 0x75, 0x27, 0x7b, 0x1d,
0x85, 0x8d, 0xb1, 0xd1, 0xf7, 0xab, 0x71, 0x37, 0xdc, 0xb7, 0x83, 0x5d, 0xb2, 0xec,
0xd5, 0x18, 0xe1, 0xc9
];
assert_eq!(invoice.hash(), expected_hash)
} | rust_cleaned_test_functions.jsonl/68817 | {
"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,
38241,
39225,
8950,
368,
341,
197,
41819,
3504,
90,
20015,
34674,
11,
23022,
39,
22252,
11,
23022,
1043,
5800,
11,
28453,
11,
43903,
20812,
2440,
197,
41819,
3504,
5668,
3556,
1877,
79304,
197,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collect_clears_data_model_before_adding_new() {
let mock_reader = Box::new(MockPackageReader::new());
let (_, model) = create_model();
// Put some "previous" content into the model.
{
let mut comps = vec![];
comps.push(Component {
id: 1,
url: String::from("test.component"),
version: 0,
inferred: false,
});
comps.push(Component {
id: 1,
url: String::from("foo.bar"),
version: 0,
inferred: false,
});
model.set(Components { entries: comps }).unwrap();
let mut manis = vec![];
manis.push(crate::core::collection::Manifest {
component_id: 1,
manifest: ManifestData::Version1(String::from("test.component.manifest")),
uses: vec![Capability::Protocol(ProtocolCapability::new(String::from(
"test.service",
)))],
});
manis.push(crate::core::collection::Manifest {
component_id: 2,
manifest: ManifestData::Version1(String::from("foo.bar.manifest")),
uses: Vec::new(),
});
model.set(Manifests { entries: manis }).unwrap();
let mut routes = vec![];
routes.push(Route {
id: 1,
src_id: 1,
dst_id: 2,
service_name: String::from("test.service"),
protocol_id: 0,
});
model.set(Routes { entries: routes }).unwrap();
}
let mut targets = HashMap::new();
targets.insert(
String::from("123"),
FarPackageDefinition { custom: Custom { merkle: String::from("123") } },
);
mock_reader.append_target(TargetsJson { signed: Signed { targets: targets } });
let sb = create_test_sandbox(vec![String::from("fuchsia.test.service")]);
let cms = create_test_cmx_map(vec![(String::from("meta/bar.cmx"), sb)]);
let pkg = create_test_package_with_cms(String::from("fuchsia-pkg://fuchsia.com/foo"), cms);
mock_reader.append_pkg_def(pkg);
let reader: Box<dyn PackageReader> = mock_reader;
let getter: Box<dyn PackageGetter> = Box::new(MockPackageGetter::new());
let collector = PackageDataCollector::default();
collector.collect_with_reader(reader, getter, Arc::clone(&model)).unwrap();
// Ensure the model reflects only the latest collection.
let comps = &model.get::<Components>().unwrap().entries;
let manis = &model.get::<Manifests>().unwrap().entries;
let routes = &model.get::<Routes>().unwrap().entries;
assert_eq!(comps.len(), 2);
assert_eq!(manis.len(), 1);
assert_eq!(routes.len(), 1);
} | rust_cleaned_test_functions.jsonl/19465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
21811,
82,
1769,
5047,
23708,
2891,
287,
5921,
368,
341,
286,
1077,
7860,
22306,
284,
8261,
486,
931,
66436,
13100,
5062,
486,
931,
1423,
286,
1077,
39464,
1614,
8,
284,
1855,
5047,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_webp() {
assert_eq_ok!(
ImageInfo::from_file_path("images/valid/webp/lossless.webp"),
ImageInfo {
format: ImageFormat::WEBP,
ext: "webp",
full_ext: "webp",
mimetype: "image/webp",
size: ImageSize { width: 123, height: 456 },
entry_sizes: vec![],
}
);
assert_eq_ok!(
ImageInfo::from_file_path("images/valid/webp/extended.webp"),
ImageInfo {
format: ImageFormat::WEBP,
ext: "webp",
full_ext: "webp",
mimetype: "image/webp",
size: ImageSize { width: 123, height: 456 },
entry_sizes: vec![],
}
);
assert_eq_ok!(
ImageInfo::from_file_path("images/valid/webp/lossy.webp"),
ImageInfo {
format: ImageFormat::WEBP,
ext: "webp",
full_ext: "webp",
mimetype: "image/webp",
size: ImageSize { width: 123, height: 456 },
entry_sizes: vec![],
}
);
} | rust_cleaned_test_functions.jsonl/65170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25960,
79,
368,
341,
262,
2060,
10714,
19817,
33673,
286,
4654,
1731,
486,
1499,
2458,
2638,
445,
3642,
14,
1891,
21808,
79,
14,
9379,
1717,
6411,
79,
4461,
286,
4654,
1731,
341,
310,
3561,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_closest_edge_3() {
let edge = closest_edge(&vec![sup(10., 10.), sup(-10., 5.), sup(2., -5.)]);
assert!(edge.is_some());
let edge = edge.unwrap();
assert_eq!(2, edge.index);
assert_ulps_eq!(2.5607374, edge.distance);
assert_ulps_eq!(-0.6401844, edge.normal.x);
assert_ulps_eq!(-0.7682213, edge.normal.y);
} | rust_cleaned_test_functions.jsonl/129728 | {
"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,
12704,
267,
17932,
62,
18,
368,
341,
286,
1077,
6821,
284,
18093,
17932,
2099,
4083,
20703,
12776,
7,
16,
15,
2572,
220,
16,
15,
24389,
1026,
4080,
16,
15,
2572,
220,
20,
24389,
1026,
7,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_native_context_fn_name() -> Result<(), Box<EvalAltResult>> {
fn add_double(
context: NativeCallContext,
args: &mut [&mut Dynamic],
) -> Result<Dynamic, Box<EvalAltResult>> {
let x = args[0].as_int().unwrap();
let y = args[1].as_int().unwrap();
Ok(format!("{}_{}", context.fn_name(), x + 2 * y).into())
}
let mut engine = Engine::new();
engine
.register_raw_fn(
"add_double",
&[TypeId::of::<INT>(), TypeId::of::<INT>()],
add_double,
)
.register_raw_fn(
"append_x2",
&[TypeId::of::<INT>(), TypeId::of::<INT>()],
add_double,
);
assert_eq!(engine.eval::<String>("add_double(40, 1)")?, "add_double_42");
assert_eq!(engine.eval::<String>("append_x2(40, 1)")?, "append_x2_42");
Ok(())
} | rust_cleaned_test_functions.jsonl/75937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44494,
8467,
15246,
1269,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
5168,
912,
24598,
1006,
286,
2266,
25,
16703,
7220,
1972,
345,
286,
2827,
25,
609,
6984,
34336,
698... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculate_relative_path_basic_fork() {
assert_eq!(
calculate_relative_path("/a/b/c", "/a/d/c"), "../b/c".to_string()
);
} | rust_cleaned_test_functions.jsonl/19994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
29286,
2638,
34729,
761,
669,
368,
341,
286,
2060,
10714,
33673,
310,
11047,
29286,
2638,
4283,
64,
3470,
2899,
497,
3521,
64,
3446,
2899,
3975,
7005,
65,
2899,
3263,
983,
3904,
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 |
#[test]
fn test_parse_css_font_family_2() {
assert_eq!(parse_css_font_family("'Webly Sleeky UI'"), Ok(StyleFontFamily {
fonts: vec![
FontId::ExternalFont("Webly Sleeky UI".into()),
]
}));
} | rust_cleaned_test_functions.jsonl/37122 | {
"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,
21039,
25924,
17451,
26823,
62,
17,
368,
341,
286,
2060,
10714,
10297,
6400,
25924,
17451,
26823,
45456,
5981,
398,
88458,
1225,
88,
3689,
6,
3975,
7622,
7,
2323,
5447,
15192,
341,
310,
32980,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_close_matches() {
let matches = get_close_matches("appel", &["ape", "apple", "peach", "puppy"][..], 3, 0.6);
assert_eq!(matches, vec!["apple", "ape"]);
let matches = get_close_matches(
"hulo",
&[
"hi", "hulu", "hali", "hoho", "amaz", "zulo", "blah", "hopp", "uulo", "aulo",
][..],
5,
0.7,
);
assert_eq!(matches, vec!["aulo", "hulu", "uulo", "zulo"]);
} | rust_cleaned_test_functions.jsonl/83755 | {
"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,
3062,
12704,
38344,
368,
341,
262,
1077,
9071,
284,
633,
12704,
38344,
445,
676,
301,
497,
609,
1183,
2027,
497,
330,
22377,
497,
330,
375,
610,
497,
330,
79,
64029,
18121,
496,
1125,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_manager_persistence() {
let _guard = LOCK_FOR_GAUGE.lock().unwrap();
let tmp_dir = tempfile::TempDir::new().unwrap();
let manager = new_key_manager_def(&tmp_dir, None).unwrap();
// Create a file and a datakey.
manager.new_file("foo").unwrap();
let files = manager.dicts.file_dict.lock().unwrap().clone();
let keys = manager.dicts.key_dict.lock().unwrap().clone();
// Close and re-open.
drop(manager);
let manager1 = new_key_manager_def(&tmp_dir, None).unwrap();
let files1 = manager1.dicts.file_dict.lock().unwrap().clone();
let keys1 = manager1.dicts.key_dict.lock().unwrap().clone();
assert_eq!(files, files1);
assert_eq!(keys, keys1);
} | rust_cleaned_test_functions.jsonl/22021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
12144,
620,
8026,
368,
341,
286,
1077,
716,
26098,
284,
49463,
14516,
2646,
32,
47644,
21003,
1005,
15454,
543,
286,
1077,
4174,
4334,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_ref() {
let mut flags = RundownFlags::empty();
flags = to_flags(flags.add_ref());
assert_eq!(1, flags.get_ref());
assert!(!flags.is_ref_zero());
assert!(flags.is_ref_active());
} | rust_cleaned_test_functions.jsonl/52966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
7793,
368,
341,
286,
1077,
5206,
8042,
284,
431,
1241,
779,
9195,
486,
3194,
543,
286,
8042,
284,
311,
14130,
51113,
1364,
7793,
5231,
286,
2060,
10714,
10297,
16,
11,
8042,
670,
7793,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_archive_unpack_snapshot_too_large() {
let mut header = Header::new_gnu();
header.set_path("version").unwrap();
header.set_size(1024 * 1024 * 1024 * 1024 * 1024);
header.set_cksum();
let data: &[u8] = &[1, 2, 3, 4];
let mut archive = Builder::new(Vec::new());
archive.append(&header, data).unwrap();
let result = finalize_and_unpack_snapshot(archive);
assert_matches!(
result,
Err(UnpackError::Archive(ref message))
if message == &format!(
"too large archive: 1125899906842624 than limit: {}", MAX_SNAPSHOT_ARCHIVE_UNPACKED_APPARENT_SIZE
)
);
} | rust_cleaned_test_functions.jsonl/18333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42873,
54889,
53265,
2346,
78,
45228,
368,
341,
286,
1077,
5206,
4247,
284,
12104,
486,
931,
1889,
8933,
543,
286,
4247,
980,
2638,
445,
4366,
1827,
15454,
543,
286,
4247,
980,
2368,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fn_signature_for_impl() {
check(
r#"
struct F;
impl F { pub fn new() { } }
fn bar() {
let _ : F = F::new(<|>);
}
"#,
expect![[r#"
fn new()
()
"#]],
);
} | rust_cleaned_test_functions.jsonl/21221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
39859,
5478,
21007,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
434,
280,
6383,
434,
314,
6675,
5168,
501,
368,
314,
335,
456,
8822,
3619,
368,
341,
262,
1077,
716,
549,
434,
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_ignored_file_in_worktree() {
let temp_dir = TempDir::default();
let index = test_repo(&temp_dir, &vec![Path::new("simple_file.txt")]);
for name in &["ignored.txt", ".gitignore"] {
let file = temp_dir.join(name);
fs::create_dir_all(file.parent().unwrap()).unwrap();
fs::write(&file, "ignore*").unwrap();
}
let value = WorkTree::diff_against_index(&temp_dir, index).unwrap();
// Only the gitignore should show up as new
let entries = vec![StatusEntry {
name: ".gitignore".to_string(),
state: Status::New,
}];
assert_eq!(value.entries, entries);
} | rust_cleaned_test_functions.jsonl/36176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
58471,
2458,
1243,
11498,
9344,
368,
341,
286,
1077,
2730,
4334,
284,
19944,
6184,
486,
2258,
543,
286,
1077,
1922,
284,
1273,
37784,
2099,
3888,
4334,
11,
609,
4083,
20703,
1820,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_sponsored_smart_contract_tx() {
let input_path = {
let mut r = PathBuf::new();
r.push(env!("CARGO_MANIFEST_DIR"));
r.push("tests");
r.push("sponsored_smart_contract");
r.set_extension("json");
r
};
let str = std::fs::read_to_string(input_path).expect("Error opening json file");
let json: SmartContractTx = serde_json::from_str(&str).unwrap();
let bytes = hex::decode(&json.raw).unwrap();
let mut transaction = Transaction::from_bytes(&bytes).unwrap();
transaction.read(&bytes).unwrap();
assert!(!transaction.transaction_auth.is_standard_auth());
assert!(transaction.payload.is_smart_contract_payload());
let contract_name =
core::str::from_utf8(transaction.payload.contract_name().unwrap()).unwrap();
assert_eq!(json.contract_name, contract_name);
let spending_condition = transaction.transaction_auth.origin();
let spending_condition_s = transaction.transaction_auth.sponsor().unwrap();
assert_eq!(json.nonce, spending_condition.nonce());
assert_eq!(json.fee as u32, spending_condition.fee() as u32);
let origin = spending_condition
.signer_address(transaction.version)
.unwrap();
let origin = core::str::from_utf8(&origin[0..origin.len()]).unwrap();
assert_eq!(json.sender, origin);
let sponsor_addrs = spending_condition_s
.signer_address(transaction.version)
.unwrap();
let sponsor_addrs = core::str::from_utf8(&sponsor_addrs[0..sponsor_addrs.len()]).unwrap();
assert_eq!(json.sponsor_addrs.unwrap(), sponsor_addrs);
assert!(Transaction::validate(&mut transaction).is_ok());
} | rust_cleaned_test_functions.jsonl/134588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 790
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
34741,
88825,
51499,
17805,
368,
341,
286,
1077,
1946,
2638,
284,
341,
310,
1077,
5206,
435,
284,
7933,
15064,
486,
931,
543,
310,
435,
2552,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_warns_when_using_fields_with_deprecated_field() {
#[allow(deprecated)]
let message = deprecated_field::Test {
not_outdated: ".ogg".to_string(),
outdated: ".wav".to_string(),
};
// be raised by the compiler.
// This test has a shortcoming since it doesn't explicitly check for the presence of the
// `deprecated` attribute since it doesn't exist at runtime. If complied without the `allow`
// attribute the following warning would be raised:
// warning: use of deprecated item 'deprecated_field::deprecated_field::Test::outdated'
// --> tests/src/deprecated_field.rs:11:9
drop(message);
} | rust_cleaned_test_functions.jsonl/121784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55045,
82,
47636,
75180,
12132,
6615,
2259,
19889,
5013,
368,
341,
262,
11506,
7183,
12797,
19889,
5563,
262,
1077,
1943,
284,
31590,
5013,
486,
2271,
341,
286,
537,
6068,
3577,
25,
5933,
16108,
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_too_many_requested() {
let tmp_dir = TempPath::new();
let db = DiemDB::new_for_test(&tmp_dir);
assert!(db.get_transactions(0, 1001 /* limit */, 0, true).is_err());
} | rust_cleaned_test_functions.jsonl/97526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
78,
22101,
72709,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
1820,
486,
931,
543,
262,
1077,
2927,
284,
7767,
336,
3506,
486,
931,
5478,
4452,
2099,
5173,
4334,
626,
262,
2060,
10297,
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_diff_children_keys() {
let prev = [view! { <div key=0/> }, view! { <div key=1/> }];
let next = [view! { <div key=1/> }, view! { <div key=0/> }];
let diff = diff_children(&prev, &next);
let &(index, ref key) = &diff.removes[0];
assert_eq!(index, 1);
assert_eq!(key, &Some(&String::from("1")));
let &(ref key, index) = &diff.inserts[0];
assert_eq!(index, 0);
assert_eq!(key, &Some(&String::from("1")));
} | rust_cleaned_test_functions.jsonl/64277 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
31206,
12631,
368,
341,
262,
1077,
7872,
284,
508,
1050,
0,
314,
366,
611,
1376,
28,
15,
9685,
2470,
1651,
0,
314,
366,
611,
1376,
28,
16,
9685,
19376,
262,
1077,
1790,
284,
508,
1050,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fixed_size_list_array_unequal_children() {
// Construct a value array
let value_data = ArrayData::builder(DataType::Int32)
.len(8)
.add_buffer(Buffer::from_slice_ref(&[0, 1, 2, 3, 4, 5, 6, 7]))
.build();
// Construct a list array from the above two
let list_data_type = DataType::FixedSizeList(
Box::new(Field::new("item", DataType::Int32, false)),
3,
);
let list_data = ArrayData::builder(list_data_type)
.len(3)
.add_child_data(value_data)
.build();
FixedSizeListArray::from(list_data);
} | rust_cleaned_test_functions.jsonl/3842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37839,
2368,
2019,
3858,
62,
2886,
1751,
31206,
368,
341,
286,
442,
18678,
264,
897,
1334,
198,
286,
1077,
897,
1769,
284,
2910,
1043,
486,
17850,
63941,
486,
1072,
18,
17,
340,
310,
659,
2892,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from() {
let l1 = LinkedList::new_with_head(Box::new(Node::new(1, STATE_VALID)));
let l2 = LinkedList::new_with_head(Owned::new(Node::new(1, STATE_VALID)));
} | rust_cleaned_test_functions.jsonl/44797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
368,
341,
286,
1077,
326,
16,
284,
22917,
486,
931,
6615,
13138,
67758,
486,
931,
22078,
486,
931,
7,
16,
11,
22425,
27335,
4945,
286,
1077,
326,
17,
284,
22917,
486,
931,
6615,
13138,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_noto_sans() {
run_test(
&TEST_DATA,
"harfbuzz/good-noto-sans.bn",
"noto/NotoSansBengali-Regular.ttf",
&[JOINER_GLYPH_INDEX],
11,
);
} | rust_cleaned_test_functions.jsonl/91151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2072,
643,
596,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
12982,
10798,
8889,
4846,
1386,
29169,
78,
1331,
596,
60862,
756,
503,
330,
1921,
78,
20290,
2072,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_set_item() {
let gil = Python::acquire_gil();
let py = gil.python();
let v: Vec<i32> = vec![1, 2];
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
assert_eq!(2, seq.get_item(1).unwrap().extract::<i32>().unwrap());
assert!(seq.set_item(1, 10).is_ok());
assert_eq!(10, seq.get_item(1).unwrap().extract::<i32>().unwrap());
} | rust_cleaned_test_functions.jsonl/47414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
2602,
5634,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
25,
11312,
21897,
18,
17,
29,
284,
7486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compare() {
let uuid1 = Uuid::new_v4();
let uuid2 = Uuid::new_v4();
assert!(uuid1 == uuid1);
assert!(uuid2 == uuid2);
assert!(uuid1 != uuid2);
assert!(uuid2 != uuid1);
} | rust_cleaned_test_functions.jsonl/58275 | {
"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,
32235,
368,
341,
286,
1077,
16040,
16,
284,
547,
2423,
486,
931,
2273,
19,
543,
286,
1077,
16040,
17,
284,
547,
2423,
486,
931,
2273,
19,
1428,
286,
2060,
10297,
17128,
16,
621,
16040,
16,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bool_array_and_sliced_offset1() {
let a = BooleanArray::from(vec![
false, false, false, false, false, false, false, false, false, false, true,
true,
]);
let b = BooleanArray::from(vec![false, true, false, true]);
let a = a.slice(8, 4);
let a = a.as_any().downcast_ref::<BooleanArray>().unwrap();
let c = and(&a, &b).unwrap();
let expected = BooleanArray::from(vec![false, false, false, true]);
assert_eq!(expected, c);
} | rust_cleaned_test_functions.jsonl/45019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
3858,
8378,
643,
74630,
6917,
16,
368,
341,
286,
1077,
264,
284,
6992,
1857,
486,
1499,
25592,
90515,
310,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conjugate_gradient() {
let a = vec![3., 1., 1., 2.];
let b = vec![6., 7.];
let mut x = vec![2., 1.];
let epsilon = 1e-4;
conjugate_gradient(&a, &b, &mut x, epsilon);
let x_exact = vec![1., 3.];
let mut d = 0.;
for i in 0..x.len() {
let dx = x[i] - x_exact[i];
d += dx * dx;
}
assert!(d < epsilon);
} | rust_cleaned_test_functions.jsonl/92826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
47702,
349,
49482,
368,
341,
220,
1077,
264,
284,
7486,
20703,
18,
2572,
220,
16,
2572,
220,
16,
2572,
220,
17,
13,
935,
220,
1077,
293,
284,
7486,
20703,
21,
2572,
220,
22,
13,
935,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_caches_tmp_cleared() {
let basedir = tempdir().unwrap();
let cachedir = basedir.path().join("cache");
let tmpdir = cachedir.join("tmp");
create_dir_all(&tmpdir).unwrap();
let spam = tmpdir.join("spam");
File::create(&spam).unwrap();
let fsinfo = fs::metadata(&spam).unwrap();
assert!(fsinfo.is_file());
let cfg = Config {
cache_dir: Some(cachedir),
..Default::default()
};
let caches = Caches::from_config(&cfg).unwrap();
caches.clear_tmp(&cfg).unwrap();
let fsinfo = fs::metadata(spam);
assert!(fsinfo.is_err());
} | rust_cleaned_test_functions.jsonl/3788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
14242,
16125,
666,
92333,
368,
341,
286,
1077,
3118,
404,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
20579,
404,
284,
3118,
404,
3875,
1005,
5987,
445,
9360,
797,
286,
1077,
4174,
3741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escape_html() {
let tests = vec![
(r"", ""),
(r"a&b", "a&b"),
(r"<a", "<a"),
(r">a", ">a"),
(r#"""#, """),
(r#"'"#, "'"),
(r#"大阪"#, "大阪"),
];
for (input, expected) in tests {
assert_eq!(escape_html(input), expected);
}
let empty = String::new();
assert_eq!(escape_html(&empty), empty);
} | rust_cleaned_test_functions.jsonl/98068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21832,
9564,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
81,
56323,
72712,
310,
320,
81,
56693,
5,
65,
497,
330,
64,
27066,
54933,
4461,
310,
320,
81,
22476,
64,
497,
13399,
4832,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_uid_fetch_extra_space() {
// DavMail inserts an extra space after RFC822.HEADER
match parse_response(b"* 4 FETCH (UID 71372 RFC822.HEADER {10275}\r\n") {
Err(nom::Err::Incomplete(nom::Needed::Size(10275))) => {}
rsp => panic!("unexpected response {:?}", rsp),
}
} | rust_cleaned_test_functions.jsonl/8546 | {
"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,
25396,
11803,
31858,
14663,
368,
341,
286,
442,
5347,
16702,
49298,
458,
4960,
3550,
1283,
39233,
23,
17,
17,
13,
38098,
198,
286,
2432,
4715,
9655,
1883,
61593,
220,
19,
32316,
320,
6463,
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_parse_extended_opcodes() {
fn test<Operands>(
raw: constants::DwLne,
operands: Operands,
expected: LineInstruction<EndianSlice<LittleEndian>>,
) where
Operands: AsRef<[u8]>,
{
let mut input = Vec::new();
input.push(0);
let operands = operands.as_ref();
input.push(1 + operands.len() as u8);
input.push(raw.0);
input.extend_from_slice(operands);
let expected_rest = [0, 1, 2, 3, 4];
input.extend_from_slice(&expected_rest);
let input = EndianSlice::new(&input, LittleEndian);
let header = make_test_header(input);
let mut rest = input;
let opcode =
LineInstruction::parse(&header, &mut rest).expect("Should parse the opcode OK");
assert_eq!(opcode, expected);
assert_eq!(*rest, expected_rest);
}
test(
constants::DW_LNE_end_sequence,
[],
LineInstruction::EndSequence,
);
test(
constants::DW_LNE_set_address,
[1, 2, 3, 4, 5, 6, 7, 8],
LineInstruction::SetAddress(578_437_695_752_307_201),
);
test(
constants::DW_LNE_set_discriminator,
[42],
LineInstruction::SetDiscriminator(42),
);
let mut file = Vec::new();
// "foo.c"
let path_name = [b'f', b'o', b'o', b'.', b'c', 0];
file.extend_from_slice(&path_name);
// Directory index.
file.push(0);
// Last modification of file.
file.push(1);
// Size of file.
file.push(2);
test(
constants::DW_LNE_define_file,
file,
LineInstruction::DefineFile(FileEntry {
path_name: AttributeValue::String(EndianSlice::new(b"foo.c", LittleEndian)),
directory_index: 0,
timestamp: 1,
size: 2,
md5: [0; 16],
}),
);
// Unknown extended opcode.
let operands = [1, 2, 3, 4, 5, 6];
let opcode = constants::DwLne(99);
test(
opcode,
operands,
LineInstruction::UnknownExtended(opcode, EndianSlice::new(&operands, LittleEndian)),
);
} | rust_cleaned_test_functions.jsonl/3356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
61678,
10287,
25814,
368,
341,
286,
5168,
1273,
27,
5494,
2844,
17055,
310,
7112,
25,
18021,
486,
35,
86,
43,
811,
345,
310,
54510,
25,
7461,
2844,
345,
310,
3601,
25,
7083,
16664,
27,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sprite_evaluation_soam_overflow() {
let mut context = Context::new();
let mut sprites = Sprites::new();
// set scanline position
context.vpos = 1;
context.hpos = 65;
// init oam test in range sprites
init_oam(&mut sprites.primary_oam);
set_sprite(&mut sprites.primary_oam, 0x1, 0x1, 0);
set_sprite(&mut sprites.primary_oam, 0x2, 0x2, 1);
set_sprite(&mut sprites.primary_oam, 0x3, 0x3, 2);
set_sprite(&mut sprites.primary_oam, 0x4, 0x4, 3);
set_sprite(&mut sprites.primary_oam, 0x5, 0x5, 4);
set_sprite(&mut sprites.primary_oam, 0x6, 0x6, 5);
set_sprite(&mut sprites.primary_oam, 0x7, 0x7, 6);
set_sprite(&mut sprites.primary_oam, 0x7, 0x8, 7);
// more than 8 sprites on line should overflow
set_sprite(&mut sprites.primary_oam, 0x7, 0x9, 8);
set_sprite(&mut sprites.primary_oam, 0x7, 0x9, 9);
for _i in 65..=256 {
sprites.process_sprite_evaluation(&mut context);
context.hpos += 1;
}
assert_eq!(sprites.sprite_count, 8);
assert_eq!(context.status_reg.contains(StatusRegister::SPRITE_OVERFLOW), true);
} | rust_cleaned_test_functions.jsonl/74931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45489,
86505,
39833,
309,
79073,
368,
341,
197,
10217,
5206,
2266,
284,
9608,
486,
931,
543,
197,
10217,
5206,
46757,
284,
15515,
3611,
486,
931,
543,
197,
197,
322,
738,
8569,
1056,
2309,
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... | 2 |
#[test]
fn test_max_concurrency() {
env::set_var("TVM_NUM_THREADS", "42");
env::set_var("OMP_NUM_THREADS", "24");
assert_eq!(max_concurrency(), 42);
env::remove_var("TVM_NUM_THREADS");
assert_eq!(max_concurrency(), 24);
} | rust_cleaned_test_functions.jsonl/15587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
3382,
15973,
368,
341,
286,
6105,
486,
746,
4612,
445,
51,
11187,
9631,
56239,
497,
330,
19,
17,
797,
286,
6105,
486,
746,
4612,
445,
51607,
9631,
56239,
497,
330,
17,
19,
797,
286,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_vec() {
let mut r = task_rng();
assert_eq!(r.gen_vec::<u8>(0u).len(), 0u);
assert_eq!(r.gen_vec::<u8>(10u).len(), 10u);
assert_eq!(r.gen_vec::<f64>(16u).len(), 16u);
} | rust_cleaned_test_functions.jsonl/46778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
13251,
368,
341,
286,
1077,
5206,
435,
284,
3383,
66849,
543,
286,
2060,
10714,
10297,
81,
22822,
13251,
27638,
84,
23,
2235,
15,
84,
568,
2892,
1507,
220,
15,
84,
317,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_interface_type() {
assert_to_bytes!(InterfaceType::S8, &[0x00]);
assert_to_bytes!(InterfaceType::S16, &[0x01]);
assert_to_bytes!(InterfaceType::S32, &[0x02]);
assert_to_bytes!(InterfaceType::S64, &[0x03]);
assert_to_bytes!(InterfaceType::U8, &[0x04]);
assert_to_bytes!(InterfaceType::U16, &[0x05]);
assert_to_bytes!(InterfaceType::U32, &[0x06]);
assert_to_bytes!(InterfaceType::U64, &[0x07]);
assert_to_bytes!(InterfaceType::F32, &[0x08]);
assert_to_bytes!(InterfaceType::F64, &[0x09]);
assert_to_bytes!(InterfaceType::String, &[0x0a]);
assert_to_bytes!(InterfaceType::Anyref, &[0x0b]);
assert_to_bytes!(InterfaceType::I32, &[0x0c]);
assert_to_bytes!(InterfaceType::I64, &[0x0d]);
} | rust_cleaned_test_functions.jsonl/132561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20546,
1819,
368,
341,
286,
2060,
2346,
12524,
10297,
5051,
929,
486,
50,
23,
11,
44590,
15,
87,
15,
15,
2558,
286,
2060,
2346,
12524,
10297,
5051,
929,
486,
50,
16,
21,
11,
44590,
15,
87,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_children() {
let tree = parse_json_example();
let mut cursor = tree.walk();
let array_node = tree.root_node().child(0).unwrap();
assert_eq!(
array_node
.children(&mut cursor)
.map(|n| n.kind())
.collect::<Vec<_>>(),
&["[", "number", ",", "false", ",", "object", "]",]
);
assert_eq!(
array_node
.named_children(&mut cursor)
.map(|n| n.kind())
.collect::<Vec<_>>(),
&["number", "false", "object"]
);
let object_node = array_node
.named_children(&mut cursor)
.find(|n| n.kind() == "object")
.unwrap();
assert_eq!(
object_node
.children(&mut cursor)
.map(|n| n.kind())
.collect::<Vec<_>>(),
&["{", "pair", "}",]
);
} | rust_cleaned_test_functions.jsonl/99264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
31206,
368,
341,
262,
1077,
4916,
284,
4715,
9455,
39304,
543,
262,
1077,
5206,
8128,
284,
4916,
51394,
543,
262,
1077,
1334,
5084,
284,
4916,
12576,
5084,
1005,
3048,
7,
15,
568,
15454,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_aclentry() {
let unspecified_ip_address = "0.0.0.0";
let unspecified_prefix = 0u8;
let unspecified_v4 = NetIpAddr(unspecified_ip_address.parse().unwrap());
let ssh_port = 22u16;
let block_ssh_on_wlan = AclEntry {
config: config::FilterConfig {
forwarding_action: config::ForwardingAction::Drop,
device_id: Some("device_id".to_string()),
direction: None,
comment: Some("Blocks SSH access over the wlan".to_string()),
},
ipv4: Some(config::IpFilter {
src_address: None,
src_ports: None,
dst_address: Some(config::CidrAddress {
ip: unspecified_v4,
prefix_length: unspecified_prefix,
}),
dst_ports: Some(config::PortRange { from: ssh_port, to: ssh_port }),
protocol: Some(config::Protocol::Tcp),
}),
ipv6: None,
};
match parse_aclentry(&block_ssh_on_wlan) {
Ok(v) => {
assert_eq!(v.len(), 1);
assert_eq!(v[0].element, netconfig::Id { uuid: [0; 16], version: 0 });
assert_eq!(v[0].action, netconfig::FilterAction::Drop);
assert_eq!(v[0].selector.src_address, None);
assert_eq!(v[0].selector.src_ports, None);
assert_eq!(
v[0].selector.dst_address,
Some(netconfig::CidrAddress {
address: Some(unspecified_v4.into()),
prefix_length: Some(unspecified_prefix),
..netconfig::CidrAddress::EMPTY
})
);
assert_eq!(
v[0].selector.dst_ports,
Some(vec![netconfig::PortRange { from: ssh_port, to: ssh_port }])
);
assert_eq!(v[0].selector.protocol, Some(netconfig::Protocol::Tcp));
}
Err(e) => panic!("Unexpected 'Error' result: {:?}", e),
}
} | rust_cleaned_test_functions.jsonl/52759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
63692,
4085,
368,
341,
286,
1077,
54311,
10385,
6744,
284,
330,
15,
13,
15,
13,
15,
13,
15,
876,
286,
1077,
54311,
13974,
284,
220,
15,
84,
23,
280,
286,
1077,
54311,
2273,
19,
284,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_new_normal_value() {
let plain_value = "hello";
let len = plain_value.len() as i32;
let normal_value = Value::new_normal(plain_value);
assert_eq!(normal_value.body, b"hello");
match normal_value.value_type {
ValueType::Normal(l) => assert_eq!(l, len),
_ => unreachable!(),
}
} | rust_cleaned_test_functions.jsonl/41641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
13973,
3142,
368,
341,
286,
1077,
14396,
3142,
284,
330,
14990,
876,
286,
1077,
2422,
284,
14396,
3142,
19406,
368,
438,
600,
18,
17,
280,
286,
1077,
4622,
3142,
284,
5162,
486,
931,
13973... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_datetime() {
let mut nmea = Nmea::new();
let res = nmea.parse("$,GRMC,,A,,,,,,,290290GLCR*40");
println!("parse result {:?}", res);
assert!(matches!(res, Err(NmeaError::ParsingError(_))));
} | rust_cleaned_test_functions.jsonl/24087 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
28943,
368,
341,
262,
1077,
5206,
308,
2660,
64,
284,
451,
2660,
64,
486,
931,
543,
262,
1077,
592,
284,
308,
2660,
64,
4632,
20912,
11,
8626,
11604,
10631,
32,
26758,
60723,
17,
24,
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_sort_deglob_str() {
assert_eq!(sort_deglob_str(""), "");
assert_eq!(sort_deglob_str("foo"), "foo");
assert_eq!(sort_deglob_str("a, b"), "a, b");
assert_eq!(sort_deglob_str("b, a"), "a, b");
assert_eq!(sort_deglob_str("foo, bar, baz"), "bar, baz, foo");
assert_eq!(
sort_deglob_str("Curve, curve, ARC, bow, Bow, arc, Arc"),
"arc, bow, curve, Arc, Bow, Curve, ARC",
);
} | rust_cleaned_test_functions.jsonl/50365 | {
"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,
18435,
46057,
1684,
2895,
368,
341,
286,
2060,
10714,
10297,
6860,
46057,
1684,
2895,
86076,
14498,
286,
2060,
10714,
10297,
6860,
46057,
1684,
2895,
445,
7975,
3975,
330,
7975,
797,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_get_item() {
let gil = Python::acquire_gil();
let py = gil.python();
let v : Vec<i32> = vec![1, 1, 2, 3, 5, 8];
let seq = v.to_py_object(py).into_object().cast_into::<PySequence>(py).unwrap();
assert_eq!(1, seq.get_item(py, 0).unwrap().extract::<i32>(py).unwrap());
assert_eq!(1, seq.get_item(py, 1).unwrap().extract::<i32>(py).unwrap());
assert_eq!(2, seq.get_item(py, 2).unwrap().extract::<i32>(py).unwrap());
assert_eq!(3, seq.get_item(py, 3).unwrap().extract::<i32>(py).unwrap());
assert_eq!(5, seq.get_item(py, 4).unwrap().extract::<i32>(py).unwrap());
assert_eq!(8, seq.get_item(py, 5).unwrap().extract::<i32>(py).unwrap());
assert_eq!(8, seq.get_item(py, -1).unwrap().extract::<i32>(py).unwrap());
assert_eq!(5, seq.get_item(py, -2).unwrap().extract::<i32>(py).unwrap());
assert_eq!(3, seq.get_item(py, -3).unwrap().extract::<i32>(py).unwrap());
assert_eq!(2, seq.get_item(py, -4).unwrap().extract::<i32>(py).unwrap());
assert_eq!(1, seq.get_item(py, -5).unwrap().extract::<i32>(py).unwrap());
assert!(seq.get_item(py, 10).is_err());
} | rust_cleaned_test_functions.jsonl/22527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 602
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
3062,
5634,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
549,
11312,
21897,
18,
17,
29,
284,
748... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_psd() {
let info = Infer::new();
assert_eq!(infer::Type {
mime: String::from("image/vnd.adobe.photoshop"),
ext: String::from("psd"),
},
info.get(&fs::read("testdata/sample.psd").unwrap()).unwrap());
} | rust_cleaned_test_functions.jsonl/110138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
13446,
368,
341,
262,
1077,
3546,
284,
62658,
486,
931,
543,
1066,
262,
2060,
10714,
10297,
89559,
486,
929,
314,
715,
286,
45270,
25,
923,
486,
1499,
445,
1805,
42701,
11640,
15422,
64348,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_status_success() {
let mut cmd = process::Command::new("printf");
cmd.arg("hello");
if let Err(error) = status(cmd) {
panic!("expected status success but got: {:?}", error);
}
} | rust_cleaned_test_functions.jsonl/74400 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
18632,
368,
341,
220,
1077,
5206,
5439,
284,
1882,
486,
4062,
486,
931,
445,
2517,
797,
220,
5439,
21186,
445,
14990,
797,
220,
421,
1077,
15495,
6390,
8,
284,
2639,
14160,
8,
341,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_command_latches() {
let mut temp_map = HashMap::default();
temp_map.insert(10, 20);
let readonly_cmds = vec![
Command::ScanLock {
ctx: Context::new(),
max_ts: 5,
start_key: None,
limit: 0,
},
Command::ResolveLock {
ctx: Context::new(),
txn_status: temp_map.clone(),
scan_key: None,
key_locks: vec![],
},
Command::MvccByKey {
ctx: Context::new(),
key: Key::from_raw(b"k"),
},
Command::MvccByStartTs {
ctx: Context::new(),
start_ts: 25,
},
];
let write_cmds = vec![
Command::Prewrite {
ctx: Context::new(),
mutations: vec![Mutation::Put((Key::from_raw(b"k"), b"v".to_vec()))],
primary: b"k".to_vec(),
start_ts: 10,
options: Options::default(),
},
Command::Commit {
ctx: Context::new(),
keys: vec![Key::from_raw(b"k")],
lock_ts: 10,
commit_ts: 20,
},
Command::Cleanup {
ctx: Context::new(),
key: Key::from_raw(b"k"),
start_ts: 10,
},
Command::Rollback {
ctx: Context::new(),
keys: vec![Key::from_raw(b"k")],
start_ts: 10,
},
Command::ResolveLock {
ctx: Context::new(),
txn_status: temp_map.clone(),
scan_key: None,
key_locks: vec![(
Key::from_raw(b"k"),
mvcc::Lock::new(mvcc::LockType::Put, b"k".to_vec(), 10, 20, None),
)],
},
];
let mut latches = Latches::new(1024);
let write_locks: Vec<Lock> = write_cmds
.into_iter()
.enumerate()
.map(|(id, cmd)| {
let mut lock = gen_command_lock(&latches, &cmd);
assert_eq!(latches.acquire(&mut lock, id as u64), id == 0);
lock
})
.collect();
for (id, cmd) in readonly_cmds.iter().enumerate() {
let mut lock = gen_command_lock(&latches, cmd);
assert!(latches.acquire(&mut lock, id as u64));
}
// acquire/release locks one by one.
let max_id = write_locks.len() as u64 - 1;
for (id, mut lock) in write_locks.into_iter().enumerate() {
let id = id as u64;
if id != 0 {
assert!(latches.acquire(&mut lock, id));
}
let unlocked = latches.release(&lock, id);
if id as u64 == max_id {
assert!(unlocked.is_empty());
} else {
assert_eq!(unlocked, vec![id + 1]);
}
}
} | rust_cleaned_test_functions.jsonl/133220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1855
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10811,
907,
9118,
368,
341,
286,
1077,
5206,
2730,
5376,
284,
10528,
486,
2258,
543,
286,
2730,
5376,
7030,
7,
16,
15,
11,
220,
17,
15,
317,
286,
1077,
5762,
89472,
284,
7486,
90515,
310,
7348... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_collect_vote_lockouts_sums() {
//two accounts voting for slot 0 with 1 token staked
let mut accounts = gen_stakes(&[(1, &[0]), (1, &[0])]);
accounts.sort_by_key(|(pk, _)| *pk);
let account_latest_votes: PubkeyVotes =
accounts.iter().map(|(pubkey, _)| (*pubkey, 0)).collect();
let ancestors = vec![(1, vec![0].into_iter().collect()), (0, HashSet::new())]
.into_iter()
.collect();
let ComputedBankState {
voted_stakes,
total_stake,
bank_weight,
pubkey_votes,
..
} = Tower::collect_vote_lockouts(
&Pubkey::default(),
1,
accounts.into_iter(),
&ancestors,
&mut PubkeyReferences::default(),
);
assert_eq!(voted_stakes[&0], 2);
assert_eq!(total_stake, 2);
let mut pubkey_votes = Arc::try_unwrap(pubkey_votes).unwrap();
pubkey_votes.sort();
assert_eq!(pubkey_votes, account_latest_votes);
assert_eq!(bank_weight, 12)
} | rust_cleaned_test_functions.jsonl/77019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
54360,
9818,
11672,
643,
6237,
368,
341,
286,
442,
19789,
9618,
15668,
369,
9446,
220,
15,
448,
220,
16,
3950,
357,
7741,
198,
286,
1077,
5206,
9618,
284,
4081,
1261,
2050,
2099,
9697,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bank_update_epoch_stakes() {
impl Bank {
fn epoch_stake_keys(&self) -> Vec<Epoch> {
let mut keys: Vec<Epoch> = self.epoch_stakes.keys().copied().collect();
keys.sort_unstable();
keys
}
fn epoch_stake_key_info(&self) -> (Epoch, Epoch, usize) {
let mut keys: Vec<Epoch> = self.epoch_stakes.keys().copied().collect();
keys.sort_unstable();
(*keys.first().unwrap(), *keys.last().unwrap(), keys.len())
}
}
let (genesis_config, _mint_keypair) = create_genesis_config(100_000);
let mut bank = Bank::new(&genesis_config);
let initial_epochs = bank.epoch_stake_keys();
assert_eq!(initial_epochs, vec![0, 1]);
for existing_epoch in &initial_epochs {
bank.update_epoch_stakes(*existing_epoch);
assert_eq!(bank.epoch_stake_keys(), initial_epochs);
}
for epoch in (initial_epochs.len() as Epoch)..MAX_LEADER_SCHEDULE_STAKES {
bank.update_epoch_stakes(epoch);
assert_eq!(bank.epoch_stakes.len() as Epoch, epoch + 1);
}
assert_eq!(
bank.epoch_stake_key_info(),
(
0,
MAX_LEADER_SCHEDULE_STAKES - 1,
MAX_LEADER_SCHEDULE_STAKES as usize
)
);
bank.update_epoch_stakes(MAX_LEADER_SCHEDULE_STAKES);
assert_eq!(
bank.epoch_stake_key_info(),
(
0,
MAX_LEADER_SCHEDULE_STAKES,
MAX_LEADER_SCHEDULE_STAKES as usize + 1
)
);
bank.update_epoch_stakes(MAX_LEADER_SCHEDULE_STAKES + 1);
assert_eq!(
bank.epoch_stake_key_info(),
(
1,
MAX_LEADER_SCHEDULE_STAKES + 1,
MAX_LEADER_SCHEDULE_STAKES as usize + 1
)
);
} | rust_cleaned_test_functions.jsonl/2525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
8882,
20682,
1261,
2050,
368,
341,
286,
11605,
8547,
341,
310,
5168,
16342,
1261,
726,
12631,
2099,
721,
8,
1464,
11312,
27,
44338,
29,
341,
394,
1077,
5206,
6894,
25,
11312,
27,
44338,
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_dd() {
let dd = DangdangMall::new("dd_account".into(), "dd_pwd".into());
let url = "http://product.dangdang.com/1509704171.html".into();
let base64 = dd.generate_goods_poster(url);
println!("result is {}", base64);
} | rust_cleaned_test_functions.jsonl/74856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43174,
368,
341,
286,
1077,
19647,
284,
422,
524,
67,
524,
44,
541,
486,
931,
445,
631,
13500,
3263,
18122,
1507,
330,
631,
50957,
3263,
18122,
1423,
286,
1077,
2515,
284,
330,
1254,
1110,
3031,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_integration() {
let max_parser = AggrFnDefinitionParserExtremum::<Max>::new();
let min_parser = AggrFnDefinitionParserExtremum::<Min>::new();
let max = ExprDefBuilder::aggr_func(ExprType::Max, FieldTypeTp::LongLong)
.push_child(ExprDefBuilder::column_ref(0, FieldTypeTp::LongLong))
.build();
max_parser.check_supported(&max).unwrap();
let min = ExprDefBuilder::aggr_func(ExprType::Min, FieldTypeTp::LongLong)
.push_child(ExprDefBuilder::column_ref(0, FieldTypeTp::LongLong))
.build();
min_parser.check_supported(&min).unwrap();
let src_schema = [FieldTypeTp::LongLong.into()];
let mut columns = LazyBatchColumnVec::from(vec![{
let mut col = LazyBatchColumn::decoded_with_capacity_and_tp(0, EvalType::Int);
col.mut_decoded().push_int(Some(10000));
col.mut_decoded().push_int(Some(1));
col.mut_decoded().push_int(Some(23));
col.mut_decoded().push_int(Some(42));
col.mut_decoded().push_int(Some(-10000));
col.mut_decoded().push_int(None);
col.mut_decoded().push_int(Some(99));
col.mut_decoded().push_int(Some(-1));
col
}]);
let logical_rows = vec![3, 2, 6, 5, 1, 7];
let mut schema = vec![];
let mut exp = vec![];
let mut ctx = EvalContext::default();
let max_fn = max_parser
.parse(max, &mut ctx, &src_schema, &mut schema, &mut exp)
.unwrap();
assert_eq!(schema.len(), 1);
assert_eq!(schema[0].as_accessor().tp(), FieldTypeTp::LongLong);
assert_eq!(exp.len(), 1);
let min_fn = min_parser
.parse(min, &mut ctx, &src_schema, &mut schema, &mut exp)
.unwrap();
assert_eq!(schema.len(), 2);
assert_eq!(schema[1].as_accessor().tp(), FieldTypeTp::LongLong);
assert_eq!(exp.len(), 2);
let mut ctx = EvalContext::default();
let mut max_state = max_fn.create_state();
let mut min_state = min_fn.create_state();
let mut aggr_result = [VectorValue::with_capacity(0, EvalType::Int)];
// max
{
let max_result = exp[0]
.eval(&mut ctx, &src_schema, &mut columns, &logical_rows, 6)
.unwrap();
let max_result = max_result.vector_value().unwrap();
let max_slice: &[Option<Int>] = max_result.as_ref().as_ref();
max_state
.update_vector(&mut ctx, max_slice, max_result.logical_rows())
.unwrap();
max_state.push_result(&mut ctx, &mut aggr_result).unwrap();
}
// min
{
let min_result = exp[0]
.eval(&mut ctx, &src_schema, &mut columns, &logical_rows, 6)
.unwrap();
let min_result = min_result.vector_value().unwrap();
let min_slice: &[Option<Int>] = min_result.as_ref().as_ref();
min_state
.update_vector(&mut ctx, min_slice, min_result.logical_rows())
.unwrap();
min_state.push_result(&mut ctx, &mut aggr_result).unwrap();
}
assert_eq!(aggr_result[0].as_int_slice(), &[Some(99), Some(-1i64),]);
} | rust_cleaned_test_functions.jsonl/9279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1676
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90250,
368,
341,
286,
1077,
1932,
18517,
284,
4598,
901,
24911,
10398,
6570,
6756,
1826,
372,
27638,
5974,
6831,
931,
543,
286,
1077,
1308,
18517,
284,
4598,
901,
24911,
10398,
6570,
6756,
1826,
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_record_changeset3() {
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",
"alias": null
},
"Edited",
{
"columns": [
"inventory_id",
"last_update",
"film_id",
"store_id"
],
"data": [],
"count": null
}
],
[
{
"name": "inventory",
"schema": "public",
"alias": null
},
"LinkNew",
{
"columns": [
"inventory_id",
"last_update",
"film_id",
"store_id"
],
"data": [],
"count": null
}
],
[
{
"name": "inventory",
"schema": "public",
"alias": null
},
"Unlink",
{
"columns": [
"inventory_id",
"last_update",
"film_id",
"store_id"
],
"data": [],
"count": null
}
]
],
"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": [],
"count": null
}
],
[
{
"name": "category",
"schema": "public",
"alias": null
},
{
"name": "film_category",
"schema": "public",
"alias": null
},
"LinkNew",
{
"columns": [
"category_id",
"name",
"last_update"
],
"data": [],
"count": null
}
],
[
{
"name": "actor",
"schema": "public",
"alias": null
},
{
"name": "film_actor",
"schema": "public",
"alias": null
},
"LinkExisting",
{
"columns": [
"actor_id"
],
"data": [
[]
],
"count": null
}
],
[
{
"name": "category",
"schema": "public",
"alias": null
},
{
"name": "film_category",
"schema": "public",
"alias": null
},
"LinkExisting",
{
"columns": [
"category_id"
],
"data": [
[
{
"Int": 3
}
]
],
"count": null
}
],
[
{
"name": "actor",
"schema": "public",
"alias": null
},
{
"name": "film_actor",
"schema": "public",
"alias": null
},
"Unlink",
{
"columns": [
"actor_id",
"first_name",
"last_name",
"last_update"
],
"data": [],
"count": null
}
],
[
{
"name": "category",
"schema": "public",
"alias": null
},
{
"name": "film_category",
"schema": "public",
"alias": null
},
"Unlink",
{
"columns": [
"category_id",
"name",
"last_update"
],
"data": [],
"count": null
}
]
]
}
"#;
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/13722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2838
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
47526,
295,
18,
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_scan() {
let ctx = TestContext::new();
let mut con = ctx.connection();
redis::cmd("SADD").arg("foo").arg(1).execute(&mut con);
redis::cmd("SADD").arg("foo").arg(2).execute(&mut con);
redis::cmd("SADD").arg("foo").arg(3).execute(&mut con);
let (cur, mut s): (i32, Vec<i32>) = redis::cmd("SSCAN")
.arg("foo")
.arg(0)
.query(&mut con)
.unwrap();
s.sort();
assert_eq!(cur, 0i32);
assert_eq!(s.len(), 3);
assert_eq!(&s, &[1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/108947 | {
"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,
28857,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
1428,
262,
20870,
486,
8710,
445,
50,
15665,
1827,
858,
445,
7975,
1827,
858,
7,
16,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_star_plus_question() {
compare(
r#"
grammar;
extern { enum Tok { "Hi" => Hi(..) } }
A = Z*;
X = "Hi"*;
Y = "Hi"+;
Z = "Hi"?;
"#,
vec![
("A", "::std::vec::Vec<::std::option::Option<Tok>>"),
("X", "::std::vec::Vec<Tok>"),
("Y", "::std::vec::Vec<Tok>"),
("Z", "::std::option::Option<Tok>"),
],
)
} | rust_cleaned_test_functions.jsonl/50470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31681,
28043,
28915,
368,
341,
262,
9429,
1006,
286,
435,
2,
698,
41094,
280,
262,
15637,
314,
7618,
21447,
314,
330,
13048,
1,
589,
21018,
56422,
8,
335,
456,
262,
362,
284,
1863,
9,
280,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stmts() {
let lexer = Lexer::new("fn bar_2() { let x: int = 100; let y: bool = false; x = 987; }");
let actual: Vec<TokType> = lexer.map(|t| t.0).collect();
let expected = vec![
TokType::KwFn,
TokType::Iden("bar_2".to_string()),
TokType::OpenParent,
TokType::CloseParent,
TokType::OpenBracket,
TokType::KwLet,
TokType::Iden("x".to_string()),
TokType::Colon,
TokType::KwInt,
TokType::Assign,
TokType::IntConst(100),
TokType::SemiColon,
TokType::KwLet,
TokType::Iden("y".to_string()),
TokType::Colon,
TokType::KwBool,
TokType::Assign,
TokType::KwFalse,
TokType::SemiColon,
TokType::Iden("x".to_string()),
TokType::Assign,
TokType::IntConst(987),
TokType::SemiColon,
TokType::CloseBracket,
];
assert_eq!(actual, expected)
} | rust_cleaned_test_functions.jsonl/24692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21824,
82,
368,
341,
286,
1077,
53259,
284,
85082,
486,
931,
445,
8822,
3619,
62,
17,
368,
314,
1077,
856,
25,
526,
284,
220,
16,
15,
15,
26,
1077,
379,
25,
1807,
284,
895,
26,
856,
284,
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_long_format_wo_user() {
// "no username specified; at least one must be specified when using -l"
new_ucmd!().arg("-l").fails().code_is(1);
} | rust_cleaned_test_functions.jsonl/24863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
8955,
96058,
3317,
368,
341,
262,
442,
330,
2152,
5934,
5189,
26,
518,
3245,
825,
1969,
387,
5189,
979,
1667,
481,
75,
698,
262,
501,
68887,
2277,
0,
1005,
858,
13645,
75,
1827,
59631,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iterator_values() {
let (src, size) = build_table(build_data());
let data = build_data();
let table = Table::new(Options::default(), wrap_buffer(src), size).unwrap();
let mut iter = table.iter();
let mut i = 0;
iter.next();
iter.next();
// Verifies that prev/next works well.
loop {
iter.prev();
if let Some((k, v)) = current_key_val(&iter) {
assert_eq!(
(data[i].0.as_bytes(), data[i].1.as_bytes()),
(k.as_ref(), v.as_ref())
);
} else {
break;
}
i += 1;
if iter.next().is_none() || iter.next().is_none() {
break;
}
}
assert_eq!(i, 6);
} | rust_cleaned_test_functions.jsonl/3807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5237,
13491,
9146,
368,
341,
286,
1077,
320,
3548,
11,
1379,
8,
284,
1936,
5237,
43333,
1769,
1423,
286,
1077,
821,
284,
1936,
1769,
1428,
286,
1077,
1965,
284,
6633,
486,
931,
7,
3798,
486,
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... | 4 |
#[test]
fn test_encode_option_u16_with_val() {
let mut dest = vec![];
let value: Option<u16> = Some(16);
let result = value.encode(&mut dest, 0);
assert!(result.is_ok());
assert_eq!(dest.len(), 3);
assert_eq!(dest[0], 0x01);
assert_eq!(dest[1], 0x00);
assert_eq!(dest[2], 0x10);
assert_eq!(value.write_size(0), 3);
} | rust_cleaned_test_functions.jsonl/126945 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
9672,
7300,
16,
21,
6615,
6189,
368,
341,
286,
1077,
5206,
3201,
284,
7486,
0,
15078,
286,
1077,
897,
25,
6959,
34837,
16,
21,
29,
284,
4329,
7,
16,
21,
317,
286,
1077,
1102,
284,
897... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rgb_to_and_from_lch() {
for r in 0..10 {
for g in 0..10 {
for b in 0..10 {
let nr = (r as f32) / 255.0;
let ng = (g as f32) / 255.0;
let nb = (b as f32) / 255.0;
let rgb = Rgb::new(nr, ng, nb);
let lch = Lch::from(rgb);
let rgb2 = Rgb::from(lch);
let _r2 = (rgb2.red * 255.0) as i32;
let _g2 = (rgb2.green * 255.0) as i32;
let _b2 = (rgb2.blue * 255.0) as i32;
}
}
}
} | rust_cleaned_test_functions.jsonl/101482 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37407,
2346,
8378,
5673,
907,
331,
368,
341,
286,
369,
435,
304,
220,
15,
496,
16,
15,
341,
310,
369,
342,
304,
220,
15,
496,
16,
15,
341,
394,
369,
293,
304,
220,
15,
496,
16,
15,
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... | 4 |
#[test]
fn test_plus_tag() {
assert_eq!(plus_tag("+abc").unwrap().1, tag!("abc"));
assert_eq!(plus_tag("+abc123").unwrap().1, tag!("abc123"));
assert!(plus_tag("-abc123").is_err());
assert!(plus_tag("+1abc").is_err());
} | rust_cleaned_test_functions.jsonl/86120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28043,
9372,
368,
341,
286,
2060,
10714,
10297,
7138,
9372,
34973,
13683,
1827,
15454,
1005,
16,
11,
4772,
17223,
13683,
4010,
286,
2060,
10714,
10297,
7138,
9372,
34973,
13683,
16,
17,
18,
1827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replay_planner_fail_missing_database_checkpoint() {
let mut planner = ReplayPlanner::new();
planner.register_partition_checkpoint(
&part_ckpt!("table_1", "partition_1", {1 => (11, 12), 2 => (21, 22)}),
);
planner.register_database_checkpoint(&db_ckpt!({1 => 10, 3 => 30}));
let err = planner.build().unwrap_err();
assert!(matches!(err, Error::NoDatabaseCheckpointFound { .. }));
} | rust_cleaned_test_functions.jsonl/6756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1363,
6317,
4887,
22121,
40447,
27341,
55208,
368,
341,
286,
1077,
5206,
49711,
284,
59061,
2120,
4887,
486,
931,
1428,
286,
49711,
9929,
43840,
55208,
1006,
310,
609,
4480,
62,
68175,
17223,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_subscribe() {
let GenesisConfigInfo {
mut genesis_config,
mint_keypair: alice,
..
} = create_genesis_config(10_000);
// This test depends on the budget program
genesis_config
.native_instruction_processors
.push(solana_budget_program!());
let bob_pubkey = Pubkey::new_rand();
let witness = Keypair::new();
let contract_funds = Keypair::new();
let contract_state = Keypair::new();
let budget_program_id = solana_budget_program::id();
let bank = Bank::new(&genesis_config);
let blockhash = bank.last_blockhash();
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let bank0 = bank_forks.read().unwrap().get(0).unwrap().clone();
let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
bank_forks.write().unwrap().insert(bank1);
let rpc = RpcSolPubSubImpl {
subscriptions: Arc::new(RpcSubscriptions::new(
&Arc::new(AtomicBool::new(false)),
bank_forks.clone(),
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_bank(
bank_forks.read().unwrap().get(1).unwrap().clone(),
1,
))),
)),
uid: Arc::new(atomic::AtomicUsize::default()),
};
let session = create_session();
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("accountNotification");
rpc.account_subscribe(
session,
subscriber,
contract_state.pubkey().to_string(),
Some(CommitmentConfig::recent()),
);
let tx = system_transaction::transfer(&alice, &contract_funds.pubkey(), 51, blockhash);
process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions, 1).unwrap();
let ixs = budget_instruction::when_signed(
&contract_funds.pubkey(),
&bob_pubkey,
&contract_state.pubkey(),
&witness.pubkey(),
None,
51,
);
let message = Message::new(&ixs, Some(&contract_funds.pubkey()));
let tx = Transaction::new(&[&contract_funds, &contract_state], message, blockhash);
process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions, 1).unwrap();
sleep(Duration::from_millis(200));
// Test signature confirmation notification #1
let expected_data = bank_forks
.read()
.unwrap()
.get(1)
.unwrap()
.get_account(&contract_state.pubkey())
.unwrap()
.data;
let expected = json!({
"jsonrpc": "2.0",
"method": "accountNotification",
"params": {
"result": {
"context": { "slot": 1 },
"value": {
"owner": budget_program_id.to_string(),
"lamports": 51,
"data": bs58::encode(expected_data).into_string(),
"executable": false,
"rentEpoch": 1,
},
},
"subscription": 0,
}
});
let (response, _) = robust_poll_or_panic(receiver);
assert_eq!(serde_json::to_string(&expected).unwrap(), response);
let tx = system_transaction::transfer(&alice, &witness.pubkey(), 1, blockhash);
process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions, 1).unwrap();
sleep(Duration::from_millis(200));
let ix = budget_instruction::apply_signature(
&witness.pubkey(),
&contract_state.pubkey(),
&bob_pubkey,
);
let message = Message::new(&[ix], Some(&witness.pubkey()));
let tx = Transaction::new(&[&witness], message, blockhash);
process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions, 1).unwrap();
sleep(Duration::from_millis(200));
assert_eq!(
bank_forks
.read()
.unwrap()
.get(1)
.unwrap()
.get_account(&contract_state.pubkey()),
None
);
} | rust_cleaned_test_functions.jsonl/16578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
88935,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
345,
310,
28337,
3097,
12670,
25,
70433,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_iter() {
let schema = iter_schema();
let mut iter = schema.time_iter();
assert_eq!(iter.next().unwrap().name(), "time");
assert_eq!(iter.next(), None);
assert_eq!(iter.next(), None);
} | rust_cleaned_test_functions.jsonl/44073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
11723,
368,
341,
286,
1077,
10802,
284,
5367,
25371,
1428,
286,
1077,
5206,
5367,
284,
10802,
6378,
11723,
543,
286,
2060,
10714,
10297,
2015,
4529,
1005,
15454,
1005,
606,
1507,
330,
1678,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_array_length() {
// Can fold
fold("x = [].length", "x = 0");
fold("x = [1,2,3].length", "x = 3");
fold("x = [a,b].length", "x = 2");
// Not handled yet
fold("x = [,,1].length", "x = 3");
// Cannot fold
fold("x = [foo(), 0].length", "x = [foo(),0].length");
fold_same("x = y.length");
} | rust_cleaned_test_functions.jsonl/122204 | {
"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,
61187,
3858,
5118,
368,
341,
262,
442,
2980,
11555,
198,
262,
11555,
445,
87,
284,
72375,
4129,
497,
330,
87,
284,
220,
15,
797,
262,
11555,
445,
87,
284,
508,
16,
11,
17,
11,
18,
936,
4129,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trie_insert() {
let mut trie = Trie::default();
trie.insert("key".to_string());
trie.insert("keyy".to_string());
assert_eq!(trie.size, 2, "expected size 2, got: {}", trie.size)
} | rust_cleaned_test_functions.jsonl/116652 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
645,
17678,
368,
341,
286,
1077,
5206,
59067,
284,
62783,
486,
2258,
1428,
286,
59067,
7030,
445,
792,
3263,
983,
3904,
1423,
286,
59067,
7030,
445,
792,
88,
3263,
983,
3904,
5231,
1789,
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_split_num_prefixed_chunks_by_lines() {
let (at, mut ucmd) = at_and_ucmd!();
let name = "split_num_prefixed_chunks_by_lines";
RandomFile::new(&at, name).add_lines(10000);
ucmd.args(&["-d", "-l", "1000", name, "c"]).succeeds();
let glob = Glob::new(&at, ".", r"c\d\d$");
assert_eq!(glob.count(), 10);
assert_eq!(glob.collate(), at.read_bytes(name));
} | rust_cleaned_test_functions.jsonl/25855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
4273,
43331,
3286,
65470,
3710,
18323,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
829,
284,
330,
6960,
4273,
43331,
3286,
65470... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_contains() {
assert!(Range::new(1, 2).contains(Range::new(1, 1)));
assert!(Range::new(1, 2).contains(Range::new(2, 2)));
assert!(!Range::new(1, 2).contains(Range::new(0, 0)));
assert!(!Range::new(1, 2).contains(Range::new(3, 10)));
} | rust_cleaned_test_functions.jsonl/75326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
63598,
368,
341,
286,
2060,
10297,
6046,
486,
931,
7,
16,
11,
220,
17,
568,
13372,
2785,
844,
486,
931,
7,
16,
11,
220,
16,
4945,
286,
2060,
10297,
6046,
486,
931,
7,
16,
11,
220,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector_2() {
let secp = Secp256k1::new();
let seed = hex_decode("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542").unwrap();
// m
test_path(&secp, Bitcoin, &seed, "m".parse().unwrap(),
"xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U",
"xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB");
// m/0
test_path(&secp, Bitcoin, &seed, "m/0".parse().unwrap(),
"xprv9vHkqa6EV4sPZHYqZznhT2NPtPCjKuDKGY38FBWLvgaDx45zo9WQRUT3dKYnjwih2yJD9mkrocEZXo1ex8G81dwSM1fwqWpWkeS3v86pgKt",
"xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH");
// m/0/2147483647h
test_path(&secp, Bitcoin, &seed, "m/0/2147483647h".parse().unwrap(),
"xprv9wSp6B7kry3Vj9m1zSnLvN3xH8RdsPP1Mh7fAaR7aRLcQMKTR2vidYEeEg2mUCTAwCd6vnxVrcjfy2kRgVsFawNzmjuHc2YmYRmagcEPdU9",
"xpub6ASAVgeehLbnwdqV6UKMHVzgqAG8Gr6riv3Fxxpj8ksbH9ebxaEyBLZ85ySDhKiLDBrQSARLq1uNRts8RuJiHjaDMBU4Zn9h8LZNnBC5y4a");
// m/0/2147483647h/1
test_path(&secp, Bitcoin, &seed, "m/0/2147483647h/1".parse().unwrap(),
"xprv9zFnWC6h2cLgpmSA46vutJzBcfJ8yaJGg8cX1e5StJh45BBciYTRXSd25UEPVuesF9yog62tGAQtHjXajPPdbRCHuWS6T8XA2ECKADdw4Ef",
"xpub6DF8uhdarytz3FWdA8TvFSvvAh8dP3283MY7p2V4SeE2wyWmG5mg5EwVvmdMVCQcoNJxGoWaU9DCWh89LojfZ537wTfunKau47EL2dhHKon");
// m/0/2147483647h/1/2147483646h
test_path(&secp, Bitcoin, &seed, "m/0/2147483647h/1/2147483646h".parse().unwrap(),
"xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc",
"xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL");
// m/0/2147483647h/1/2147483646h/2
test_path(&secp, Bitcoin, &seed, "m/0/2147483647h/1/2147483646h/2".parse().unwrap(),
"xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j",
"xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt");
} | rust_cleaned_test_functions.jsonl/63330 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1725
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
62,
17,
368,
341,
286,
1077,
511,
4672,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
543,
286,
1077,
10320,
284,
12371,
15227,
445,
542,
8316,
69,
24,
69,
21,
69,
18,
69,
15,
15326,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_queue_state_sync() {
let mut q = QueueStateSync::new(0x1000);
let mut q2 = q.clone();
let q3 = q.clone();
let barrier = Arc::new(Barrier::new(3));
let b2 = barrier.clone();
let b3 = barrier.clone();
let t1 = std::thread::spawn(move || {
{
let guard = q2.lock();
assert!(!guard.ready());
}
b2.wait();
b2.wait();
{
let guard = q2.lock();
assert!(guard.ready());
}
});
let t2 = std::thread::spawn(move || {
assert!(!q3.ready());
b3.wait();
b3.wait();
assert!(q3.ready());
});
barrier.wait();
q.set_ready(true);
barrier.wait();
t1.join().unwrap();
t2.join().unwrap();
} | rust_cleaned_test_functions.jsonl/103663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10841,
4387,
23008,
368,
341,
286,
1077,
5206,
2804,
284,
18745,
1397,
12154,
486,
931,
7,
15,
87,
16,
15,
15,
15,
317,
286,
1077,
5206,
2804,
17,
284,
2804,
15997,
543,
286,
1077,
2804,
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... | 3 |
#[test]
fn test_new_containing_spread_1() {
// be preserved.
test("new Date(...c)", "[...c]");
test("new Date(4, ...c, a)", "[...c]");
test("new Date(...a, b, ...c)", "[...a, ...c]");
test("new Date(...b, ...c)", "[...b, ...c]");
} | rust_cleaned_test_functions.jsonl/463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
10260,
2056,
10123,
878,
62,
16,
368,
341,
1066,
262,
442,
387,
33583,
624,
262,
1273,
445,
931,
2631,
18850,
66,
11583,
10545,
1112,
66,
37389,
262,
1273,
445,
931,
2631,
7,
19,
11,
250... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_diff_multiple_inputs_all_different() {
let diff = Diff::default_refinement(&[b"a b c", b"a X c", b"a c X"]);
assert_eq!(
diff.hunks().collect_vec(),
vec![
DiffHunk::Matching(b"a "),
DiffHunk::Different(vec![b"b ", b"X ", b""]),
DiffHunk::Matching(b"c"),
DiffHunk::Different(vec![b"", b"", b" X"]),
]
);
} | rust_cleaned_test_functions.jsonl/89260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
45233,
28557,
5705,
82741,
368,
341,
286,
1077,
3638,
284,
28369,
486,
2258,
7793,
37184,
2099,
58,
65,
56693,
293,
272,
497,
293,
56693,
1599,
272,
497,
293,
56693,
272,
1599,
15049,
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_construct_subtree_with_new_leaf_create_extension() {
// root root
// o o o o
// o existing_key => o subtree
// y placeholder
// x placeholder
// existing_key new_key
let existing_key = b"world".test_only_hash();
let existing_blob = AccountStateBlob::from(b"world".to_vec());
let existing_blob_hash = existing_blob.hash();
let new_key = b"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".test_only_hash();
let new_blob = AccountStateBlob::from(b"new_blob!!!!!".to_vec());
assert_eq!(existing_key[0], 0b0100_0010);
assert_eq!(new_key[0], 0b0100_1011);
let existing_leaf = LeafNode::new(existing_key, LeafValue::BlobHash(existing_blob.hash()));
let subtree = SparseMerkleTree::construct_subtree_with_new_leaf(
new_key,
new_blob.clone(),
&existing_leaf,
/* distance_from_root_to_existing_leaf = */ 2,
);
let smt = SparseMerkleTree { root: subtree };
let new_blob_hash = new_blob.hash();
let existing_leaf_hash = hash_leaf(existing_key, existing_blob_hash);
let new_leaf_hash = hash_leaf(new_key, new_blob_hash);
let x_hash = hash_internal(existing_leaf_hash, new_leaf_hash);
let y_hash = hash_internal(x_hash, *SPARSE_MERKLE_PLACEHOLDER_HASH);
let root_hash = hash_internal(y_hash, *SPARSE_MERKLE_PLACEHOLDER_HASH);
assert_eq!(smt.root_hash(), root_hash);
} | rust_cleaned_test_functions.jsonl/15414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 798
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64803,
5228,
9344,
6615,
5921,
38909,
8657,
31035,
368,
341,
262,
442,
286,
3704,
5968,
3704,
7213,
262,
442,
414,
297,
414,
297,
5180,
297,
414,
297,
7213,
262,
442,
262,
297,
256,
6350,
3097,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request2() {
use helix::*;
let req = CheckUserSubscriptionRequest::builder()
.broadcaster_id("123".to_string())
.build();
// From twitch docs.
let data = br#"
{
"error": "Not Found",
"message": "twitchdev has no subscription to twitchpresents",
"status": 404
}
"#
.to_vec();
let http_response = http::Response::builder().status(404).body(data).unwrap();
let uri = req.get_uri().unwrap();
assert_eq!(
uri.to_string(),
"https://api.twitch.tv/helix/subscriptions/user?broadcaster_id=123"
);
dbg!(CheckUserSubscriptionRequest::parse_response(Some(req), &uri, http_response).unwrap_err());
} | rust_cleaned_test_functions.jsonl/113786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
17,
368,
341,
262,
990,
11338,
941,
56162,
262,
1077,
4232,
284,
4248,
1474,
33402,
1900,
486,
17850,
741,
286,
659,
65,
8546,
32020,
842,
445,
16,
17,
18,
3263,
983,
3904,
2398,
286,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collation_cases() {
let table = vec![
("", ""),
("Foo/Bar", "foo/bar"),
// These go from 2 to 3 code points when lower-cased
("ȺȾ", "ⱥⱦ"),
// A m ("表ポあA鷗Œé/B逍Üߪąñ丂㐀𠀀", "表ポあa鷗œé/b逍üssaąñ丂㐀𠀀"),
("Faſt/Carſ", "fast/cars"),
("a/ß/Minnow", "a/ss/minnow"),
("spiffiest", "spiffiest"),
// The uppercase 'È' (or 'È' if that first one doesn't display correctly
// in your editor) is composed of ascii 'E' (\u{0045}), plus the
// combining diacritic '\u{0300}'. The lowercase version 'è' is
// represented by its own code point.
("a\u{0045}\"\u{00e8}", "è"),
];
for (input, expect) in table {
assert_eq!(collate(input.chars()).collect::<String>().as_str(), expect);
}
} | rust_cleaned_test_functions.jsonl/94480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43597,
367,
41427,
368,
341,
286,
1077,
1965,
284,
7486,
90515,
310,
3489,
497,
72712,
310,
3489,
40923,
14,
3428,
497,
330,
7975,
49513,
4461,
310,
442,
4220,
728,
504,
220,
17,
311,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_error_messages() {
assert_eq!(
format!("{}", Error::EmptyRulesVector),
"The seccomp rules vector is empty."
);
assert_eq!(
format!("{}", Error::FilterTooLarge),
"The seccomp filter contains too many BPF instructions."
);
assert_eq!(
format!("{}", Error::IntoBpf),
"Failed to translate the seccomp rules into BPF."
);
assert_eq!(
format!("{}", Error::InvalidArgumentNumber),
"The seccomp rule contains an invalid argument number."
);
assert_eq!(
format!("{}", Error::InvalidLevel),
"The requested seccomp level is invalid."
);
assert_eq!(
format!("{}", Error::Load(42)),
"Failed to load seccomp rules into the kernel with error 42."
);
} | rust_cleaned_test_functions.jsonl/17481 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
23428,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
79878,
4600,
486,
3522,
26008,
3781,
1326,
310,
330,
785,
511,
638,
14435,
5601,
4621,
374,
4287,
10040,
286,
1439,
286,
2060,
10714,
336... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_master_key_failure_and_succeed() {
let _guard = LOCK_FOR_GAUGE.lock().unwrap();
let tmp_dir = tempfile::TempDir::new().unwrap();
let wrong_key = Box::new(MockBackend {
is_wrong_master_key: true,
encrypt_fail: true,
..MockBackend::default()
});
let right_key = Box::new(MockBackend {
is_wrong_master_key: true,
encrypt_fail: false,
..MockBackend::default()
});
let previous = Box::new(PlaintextBackend::default()) as Box<dyn Backend>;
let result = new_key_manager(&tmp_dir, None, wrong_key, previous);
assert!(result.is_err());
let previous = Box::new(PlaintextBackend::default()) as Box<dyn Backend>;
let result = new_key_manager(&tmp_dir, None, right_key, previous);
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/22024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24582,
3097,
43618,
8378,
643,
29264,
368,
341,
286,
1077,
716,
26098,
284,
49463,
14516,
2646,
32,
47644,
21003,
1005,
15454,
543,
286,
1077,
4174,
4334,
284,
54819,
486,
12151,
6184,
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... | 1 |
#[test]
fn test_create_proposal_already_exists() {
let mut transaction_context = MockTransactionContext::default();
let receiving_agent_key = "receiving_agent_key";
transaction_context.add_agent(PUBLIC_KEY);
transaction_context.add_agent(receiving_agent_key);
transaction_context.add_proposal(
PUBLIC_KEY,
receiving_agent_key,
Role::Owner,
Status::Open,
);
let mut state = TrackAndTraceState::new(&mut transaction_context);
let transaction_handler = TrackAndTraceTransactionHandler::new();
match transaction_handler._create_proposal(
&create_proposal_action(Role::Owner, receiving_agent_key),
&mut state,
PUBLIC_KEY,
TIMESTAMP,
) {
Ok(()) => panic!("Proposal already exists, InvalidTransaction should be returned"),
Err(ApplyError::InvalidTransaction(err)) => {
assert!(err.contains("Proposal already exists"));
}
Err(err) => panic!("Should have gotten invalid error but got {}", err),
}
} | rust_cleaned_test_functions.jsonl/32558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
21663,
32556,
80772,
9766,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
14563,
8070,
1972,
486,
2258,
543,
286,
1077,
12308,
25730,
3097,
284,
330,
265,
46344,
25730,
3097,
876,
286,
7745,
84... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tridiag() {
// Case : normal
let a = vec![0.0, 1.0, 1.0, 1.0];
let b = vec![2.0, 2.0, 2.0, 2.0];
let c = vec![1.0, 1.0, 1.0, 0.0];
let r = vec![4.0, 8.0, 12.0, 11.0];
let mut u = vec![0.0f32; 4];
let res = tridiag(&a, &b, &c, &r, &mut u);
assert!(res.is_ok(), "{:?}", res);
println!("u = {:?}", u);
assert!((u[0] - 1.0).abs() < 1e-5, "u[0] = {}", u[0]);
assert!((u[1] - 2.0).abs() < 1e-5, "u[0] = {}", u[1]);
assert!((u[2] - 3.0).abs() < 1e-5, "u[0] = {}", u[2]);
assert!((u[3] - 4.0).abs() < 1e-5, "u[0] = {}", u[3]);
// Case : error
let b = vec![1.0, 1.0, 1.0, 1.0];
let res = tridiag(&a, &b, &c, &r, &mut u);
assert!(res.is_err());
// Case : error
let b = vec![0.0, 1.0, 1.0, 1.0];
let res = tridiag(&a, &b, &c, &r, &mut u);
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/21732 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 590
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
12278,
351,
368,
341,
286,
442,
11538,
549,
4622,
198,
286,
1077,
264,
284,
7486,
20703,
15,
13,
15,
11,
220,
16,
13,
15,
11,
220,
16,
13,
15,
11,
220,
16,
13,
15,
935,
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_large_sig_len() {
let tx = test_tx();
let mut packet = sigverify::make_packet_from_transaction(tx);
// Make the signatures len huge
packet.data[0] = 0x7f;
let res = sigverify::do_get_packet_offsets(&packet, 0);
assert_eq!(res, Err(PacketError::InvalidSignatureLen));
} | rust_cleaned_test_functions.jsonl/22076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45228,
29252,
6043,
368,
341,
286,
1077,
9854,
284,
1273,
17805,
543,
286,
1077,
5206,
10151,
284,
8366,
12446,
486,
6927,
21078,
5673,
28884,
27301,
626,
286,
442,
7405,
279,
32628,
2422,
6765,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_increase_indent() {
let arm_list = {
let arm = make::match_arm(iter::once(make::placeholder_pat().into()), make::expr_unit());
make::match_arm_list(vec![arm.clone(), arm])
};
assert_eq!(
arm_list.syntax().to_string(),
"{
_ => (),
_ => (),
}"
);
let indented = IndentLevel(2).increase_indent(arm_list);
assert_eq!(
indented.syntax().to_string(),
"{
_ => (),
_ => (),
}"
);
} | rust_cleaned_test_functions.jsonl/1694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73807,
69045,
368,
341,
262,
1077,
6773,
2019,
284,
341,
286,
1077,
6773,
284,
1281,
486,
6347,
34680,
27070,
486,
13184,
36944,
486,
12384,
55824,
1005,
18122,
11858,
1281,
486,
9413,
14832,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_char() {
let b = b"Vi\xE1\xBB\x87t";
let mut r = BufReader::new(b);
assert_eq!(r.read_char(), Ok('V'));
assert_eq!(r.read_char(), Ok('i'));
assert_eq!(r.read_char(), Ok('ệ'));
assert_eq!(r.read_char(), Ok('t'));
assert!(r.read_char().is_err());
} | rust_cleaned_test_functions.jsonl/7091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9232,
368,
341,
286,
1077,
293,
284,
293,
1,
35544,
3462,
36,
16,
3462,
10098,
3462,
23,
22,
83,
876,
286,
1077,
5206,
435,
284,
69013,
5062,
486,
931,
1883,
317,
286,
2060,
10714,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_null_variable_sized() {
let array = new_null_array(&DataType::Utf8, 9);
let a = array.as_any().downcast_ref::<StringArray>().unwrap();
assert_eq!(a.len(), 9);
assert_eq!(a.value_offsets()[9], 0i32);
for i in 0..9 {
assert!(a.is_null(i));
}
} | rust_cleaned_test_functions.jsonl/7991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
14635,
643,
1506,
368,
341,
286,
1077,
1334,
284,
501,
15162,
3858,
2099,
22653,
486,
38980,
23,
11,
220,
24,
317,
286,
1077,
264,
284,
1334,
5357,
37248,
1005,
2923,
3829,
7793,
27638,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bank_executor_cache() {
solana_logger::setup();
let (genesis_config, _) = create_genesis_config(1);
let bank = Bank::new(&genesis_config);
let key1 = solana_sdk::pubkey::new_rand();
let key2 = solana_sdk::pubkey::new_rand();
let key3 = solana_sdk::pubkey::new_rand();
let key4 = solana_sdk::pubkey::new_rand();
let executor: Arc<dyn Executor> = Arc::new(TestExecutor {});
let message = Message {
header: MessageHeader {
num_required_signatures: 1,
num_readonly_signed_accounts: 0,
num_readonly_unsigned_accounts: 1,
},
account_keys: vec![key1, key2],
recent_blockhash: Hash::default(),
instructions: vec![],
};
let loaders = &[
vec![
(key3, AccountSharedData::default()),
(key4, AccountSharedData::default()),
],
vec![(key1, AccountSharedData::default())],
];
// don't do any work if not dirty
let mut executors = Executors::default();
executors.insert(key1, executor.clone());
executors.insert(key2, executor.clone());
executors.insert(key3, executor.clone());
executors.insert(key4, executor.clone());
let executors = Rc::new(RefCell::new(executors));
executors.borrow_mut().is_dirty = false;
bank.update_executors(executors);
let executors = bank.get_executors(&message, loaders);
assert_eq!(executors.borrow().executors.len(), 0);
// do work
let mut executors = Executors::default();
executors.insert(key1, executor.clone());
executors.insert(key2, executor.clone());
executors.insert(key3, executor.clone());
executors.insert(key4, executor.clone());
let executors = Rc::new(RefCell::new(executors));
bank.update_executors(executors);
let executors = bank.get_executors(&message, loaders);
assert_eq!(executors.borrow().executors.len(), 4);
assert!(executors.borrow().executors.contains_key(&key1));
assert!(executors.borrow().executors.contains_key(&key2));
assert!(executors.borrow().executors.contains_key(&key3));
assert!(executors.borrow().executors.contains_key(&key4));
// Check inheritance
let bank = Bank::new_from_parent(&Arc::new(bank), &solana_sdk::pubkey::new_rand(), 1);
let executors = bank.get_executors(&message, loaders);
assert_eq!(executors.borrow().executors.len(), 4);
assert!(executors.borrow().executors.contains_key(&key1));
assert!(executors.borrow().executors.contains_key(&key2));
assert!(executors.borrow().executors.contains_key(&key3));
assert!(executors.borrow().executors.contains_key(&key4));
bank.remove_executor(&key1);
bank.remove_executor(&key2);
bank.remove_executor(&key3);
bank.remove_executor(&key4);
let executors = bank.get_executors(&message, loaders);
assert_eq!(executors.borrow().executors.len(), 0);
assert!(!executors.borrow().executors.contains_key(&key1));
assert!(!executors.borrow().executors.contains_key(&key2));
assert!(!executors.borrow().executors.contains_key(&key3));
assert!(!executors.borrow().executors.contains_key(&key4));
} | rust_cleaned_test_functions.jsonl/2652 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1598
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
81207,
11529,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
320,
77894,
5332,
11,
27439,
284,
1855,
16322,
13774,
5332,
7,
16,
317,
286,
1077,
6073,
284,
8547,
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_score() {
let text = "Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types of systems and systems of mixed types.";
let sw = StopWords::from_file("tests/SmartStoplist.txt").unwrap();
let r = Rake::new(sw);
let keywords = r.run(text);
keywords.iter().for_each(
|&KeywordScore {
ref keyword,
ref score,
}| println!("{}: {}", keyword, score),
);
assert_eq!(keywords[0].keyword, "minimal generating sets");
assert_eq!(keywords[1].keyword, "linear Diophantine equations");
assert_eq!(keywords[2].keyword, "minimal supporting set");
assert_eq!(keywords[3].keyword, "minimal set");
} | rust_cleaned_test_functions.jsonl/103105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10405,
368,
341,
262,
1077,
1467,
284,
330,
85880,
315,
5942,
315,
13482,
16982,
916,
279,
738,
315,
5810,
5109,
13,
14243,
315,
24748,
315,
264,
1849,
315,
13482,
7767,
5127,
38357,
37906,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_option_empty_string() {
let a = Some(String::new());
match a {
None => panic!("unexpected None while matching on Some(String::new())"),
_ => {}
}
} | rust_cleaned_test_functions.jsonl/107078 | {
"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,
10708,
9672,
15124,
3904,
368,
341,
262,
1077,
264,
284,
4329,
2242,
486,
931,
1423,
262,
2432,
264,
341,
286,
2240,
589,
21975,
17223,
53859,
2240,
1393,
12579,
389,
4329,
2242,
486,
931,
2140,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_record_update_first_seen_time() {
block_on(async {
let storage = Rc::new(Mutex::new(MemStorage::new()));
let mut state_machine =
StateMachineBuilder::new_stub().storage(Rc::clone(&storage)).build().await;
let mut mock_time = MockTimeSource::new_from_now();
mock_time.truncate_submicrosecond_walltime();
let now = mock_time.now_in_walltime();
assert_eq!(state_machine.record_update_first_seen_time("id", now).await, now);
{
let storage = storage.lock().await;
assert_eq!(storage.get_string(INSTALL_PLAN_ID).await, Some("id".to_string()));
assert_eq!(storage.get_time(UPDATE_FIRST_SEEN_TIME).await, Some(now));
assert_eq!(storage.len(), 2);
assert!(storage.committed());
}
mock_time.advance(Duration::from_secs(1000));
let now2 = mock_time.now_in_walltime();
assert_eq!(state_machine.record_update_first_seen_time("id", now2).await, now);
{
let storage = storage.lock().await;
assert_eq!(storage.get_string(INSTALL_PLAN_ID).await, Some("id".to_string()));
assert_eq!(storage.get_time(UPDATE_FIRST_SEEN_TIME).await, Some(now));
assert_eq!(storage.len(), 2);
assert!(storage.committed());
}
assert_eq!(state_machine.record_update_first_seen_time("id2", now2).await, now2);
{
let storage = storage.lock().await;
assert_eq!(storage.get_string(INSTALL_PLAN_ID).await, Some("id2".to_string()));
assert_eq!(storage.get_time(UPDATE_FIRST_SEEN_TIME).await, Some(now2));
assert_eq!(storage.len(), 2);
assert!(storage.committed());
}
});
} | rust_cleaned_test_functions.jsonl/59704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 986
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
8882,
12978,
60668,
3009,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
5819,
284,
81463,
486,
931,
3189,
9371,
486,
931,
3189,
336,
5793,
486,
931,
7392,
310,
1077,
5206,
1584,
38695,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quarternion_conjugate() {
let q1 = Quaternion::new(7.0, [3.0, 23.0, 11.0]);
let expected = Quaternion::new(7.0, [-3.0, -23.0, -11.0]);
let q2 = q1.conjugate();
assert!(q2 == expected);
} | rust_cleaned_test_functions.jsonl/113347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
277,
4160,
290,
3382,
47702,
349,
368,
341,
197,
10217,
2804,
16,
284,
24801,
486,
931,
7,
22,
13,
15,
11,
508,
18,
13,
15,
11,
220,
17,
18,
13,
15,
11,
220,
16,
16,
13,
15,
2558,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_by_words() {
let jieba = Jieba::new();
let sentence = "洗衣机,国内掀起了大数据、云计算的热潮。仙鹤门地区。";
let (ret, _) = split_by_words(&jieba, sentence);
assert_eq!(
ret,
vec![
SplitWord {
word: "洗",
status: "B",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "衣",
status: "I",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "机",
status: "E",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: ",",
status: "S",
tag: "x".to_string(),
entity_type: String::new()
},
SplitWord {
word: "国",
status: "B",
tag: "s".to_string(),
entity_type: String::new()
},
SplitWord {
word: "内",
status: "E",
tag: "s".to_string(),
entity_type: String::new()
},
SplitWord {
word: "掀",
status: "B",
tag: "v".to_string(),
entity_type: String::new()
},
SplitWord {
word: "起",
status: "E",
tag: "v".to_string(),
entity_type: String::new()
},
SplitWord {
word: "了",
status: "S",
tag: "ul".to_string(),
entity_type: String::new()
},
SplitWord {
word: "大",
status: "S",
tag: "a".to_string(),
entity_type: String::new()
},
SplitWord {
word: "数",
status: "B",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "据",
status: "E",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "、",
status: "S",
tag: "x".to_string(),
entity_type: String::new()
},
SplitWord {
word: "云",
status: "S",
tag: "ns".to_string(),
entity_type: String::new()
},
SplitWord {
word: "计",
status: "B",
tag: "v".to_string(),
entity_type: String::new()
},
SplitWord {
word: "算",
status: "E",
tag: "v".to_string(),
entity_type: String::new()
},
SplitWord {
word: "的",
status: "S",
tag: "uj".to_string(),
entity_type: String::new()
},
SplitWord {
word: "热",
status: "B",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "潮",
status: "E",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "。",
status: "S",
tag: "x".to_string(),
entity_type: String::new()
},
SplitWord {
word: "仙",
status: "B",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "鹤",
status: "E",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "门",
status: "S",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "地",
status: "B",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "区",
status: "E",
tag: "n".to_string(),
entity_type: String::new()
},
SplitWord {
word: "。",
status: "S",
tag: "x".to_string(),
entity_type: String::new()
},
]
);
} | rust_cleaned_test_functions.jsonl/101362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3955
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
3710,
18981,
368,
341,
286,
1077,
502,
645,
4645,
284,
619,
645,
4645,
486,
931,
543,
286,
1077,
11652,
284,
330,
113642,
3837,
100156,
103246,
102300,
104315,
5373,
107692,
9370,
111147,
177... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cmp_x_gt_m() {
let code = vec![0xE0, 0x2];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.X = 0x05;
nes.next(&mut memory).unwrap();
assert_eq!(1, nes.C);
assert_eq!(0, nes.Z);
} | rust_cleaned_test_functions.jsonl/38734 | {
"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,
35193,
3212,
37479,
717,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
12606,
15,
11,
220,
15,
87,
17,
935,
286,
1077,
5206,
308,
288,
284,
356,
5584,
486,
931,
543,
286,
1077,
5206,
4938,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_hashtag() {
assert_eq!(get_hashtag(&b"foo{bar}baz"[..]), Some(&b"bar"[..]));
assert_eq!(get_hashtag(&b"foo{}{baz}"[..]), None);
assert_eq!(get_hashtag(&b"foo{{bar}}zap"[..]), Some(&b"{bar"[..]));
} | rust_cleaned_test_functions.jsonl/107897 | {
"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,
3062,
21778,
34311,
368,
341,
286,
2060,
10714,
10297,
455,
21778,
34311,
2099,
65,
1,
7975,
90,
2257,
92,
42573,
36864,
496,
9719,
4329,
2099,
65,
1,
2257,
36864,
496,
14382,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_str() {
let string = "in a string".to_string();
assert_value!(&'a str: String, as_str, eq => "hello world", &string);
} | rust_cleaned_test_functions.jsonl/89992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 63
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
368,
341,
262,
1077,
914,
284,
330,
258,
264,
914,
3263,
983,
3904,
543,
262,
2060,
3142,
0,
2099,
6,
64,
607,
25,
923,
11,
438,
2895,
11,
8939,
589,
330,
14990,
1879,
497,
609,
917,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_utf16() {
use unicode::str::is_utf16;
macro_rules! pos {
($($e:expr),*) => { { $(assert!(is_utf16($e));)* } }
}
// non-surrogates
pos!(&[0x0000],
&[0x0001, 0x0002],
&[0xD7FF],
&[0xE000]);
// surrogate pairs (randomly generated with Python 3's
pos!(&[0xdb54, 0xdf16, 0xd880, 0xdee0, 0xdb6a, 0xdd45],
&[0xd91f, 0xdeb1, 0xdb31, 0xdd84, 0xd8e2, 0xde14],
&[0xdb9f, 0xdc26, 0xdb6f, 0xde58, 0xd850, 0xdfae]);
pos!(&[0xd921, 0xdcc2, 0x002d, 0x004d, 0xdb32, 0xdf65],
&[0xdb45, 0xdd2d, 0x006a, 0xdacd, 0xddfe, 0x0006],
&[0x0067, 0xd8ff, 0xddb7, 0x000f, 0xd900, 0xdc80]);
// negative tests
macro_rules! neg {
($($e:expr),*) => { { $(assert!(!is_utf16($e));)* } }
}
neg!(
// surrogate + regular unit
&[0xdb45, 0x0000],
// surrogate + lead surrogate
&[0xd900, 0xd900],
// unterminated surrogate
&[0xd8ff],
// trail surrogate without a lead
&[0xddb7]);
// failed on
neg!(&[0x5b3d, 0x0141, 0xde9e, 0x8fdc, 0xc6e7],
&[0xdf5a, 0x82a5, 0x62b9, 0xb447, 0x92f3],
&[0xda4e, 0x42bc, 0x4462, 0xee98, 0xc2ca],
&[0xbe00, 0xb04a, 0x6ecb, 0xdd89, 0xe278],
&[0x0465, 0xab56, 0xdbb6, 0xa893, 0x665e],
&[0x6b7f, 0x0a19, 0x40f4, 0xa657, 0xdcc5],
&[0x9b50, 0xda5e, 0x24ec, 0x03ad, 0x6dee],
&[0x8d17, 0xcaa7, 0xf4ae, 0xdf6e, 0xbed7],
&[0xdaee, 0x2584, 0x7d30, 0xa626, 0x121a],
&[0xd956, 0x4b43, 0x7570, 0xccd6, 0x4f4a],
&[0x9dcf, 0x1b49, 0x4ba5, 0xfce9, 0xdffe],
&[0x6572, 0xce53, 0xb05a, 0xf6af, 0xdacf],
&[0x1b90, 0x728c, 0x9906, 0xdb68, 0xf46e],
&[0x1606, 0xbeca, 0xbe76, 0x860f, 0xdfa5],
&[0x8b4f, 0xde7a, 0xd220, 0x9fac, 0x2b6f],
&[0xb8fe, 0xebbe, 0xda32, 0x1a5f, 0x8b8b],
&[0x934b, 0x8956, 0xc434, 0x1881, 0xddf7],
&[0x5a95, 0x13fc, 0xf116, 0xd89b, 0x93f9],
&[0xd640, 0x71f1, 0xdd7d, 0x77eb, 0x1cd8],
&[0x348b, 0xaef0, 0xdb2c, 0xebf1, 0x1282],
&[0x50d7, 0xd824, 0x5010, 0xb369, 0x22ea]);
} | rust_cleaned_test_functions.jsonl/2450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1632
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
39453,
16,
21,
368,
341,
286,
990,
26077,
486,
495,
486,
285,
39453,
16,
21,
280,
286,
18072,
21407,
0,
1133,
341,
310,
1711,
699,
68,
96011,
701,
3764,
589,
314,
314,
4930,
2207,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_commitment_revoked_fail_backward_exhaustive_b() {
do_test_commitment_revoked_fail_backward_exhaustive(false, true, true);
do_test_commitment_revoked_fail_backward_exhaustive(true, true, true);
do_test_commitment_revoked_fail_backward_exhaustive(false, false, true);
do_test_commitment_revoked_fail_backward_exhaustive(true, false, true);
} | rust_cleaned_test_functions.jsonl/16883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
478,
38082,
10823,
22121,
70477,
2702,
15074,
533,
880,
368,
341,
19935,
4452,
36346,
478,
38082,
10823,
22121,
70477,
2702,
15074,
533,
3576,
11,
830,
11,
830,
317,
19935,
4452,
36346,
478,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_store_txs_positions() {
let mut rng = thread_rng();
let sandbox = timestamping_sandbox();
let sandbox_state = SandboxState::new();
let data_size = 20;
let generator = TimestampingTxGenerator::with_keypair(
data_size,
gen_keypair_from_seed(&Seed::new([11; 32])),
);
let committed_height = Height(rng.gen_range(2, 30u64));
{
for _ in 1..committed_height.0 {
add_one_height(&sandbox, &sandbox_state)
}
}
let num_txs = rng.gen_range(3, 100);
let committed_block1 = generator
.take(num_txs)
.map(|tx| (tx.hash(), tx.raw().clone()))
.collect::<BTreeMap<Hash, RawMessage>>();
let hashes =
add_one_height_with_transactions(&sandbox, &sandbox_state, committed_block1.values());
sandbox.assert_state(committed_height.next(), ROUND_ONE);
let snapshot = sandbox.blockchain_ref().snapshot();
let schema = Schema::new(&snapshot);
let locations = schema.transactions_locations();
for (expected_idx, hash) in hashes.iter().enumerate() {
let location = locations.get(hash).unwrap();
assert_eq!(expected_idx as u64, location.position_in_block());
assert_eq!(committed_height, location.block_height());
}
} | rust_cleaned_test_functions.jsonl/8878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
17805,
82,
37219,
368,
341,
262,
1077,
5206,
28422,
284,
4516,
66849,
543,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
543,
262,
1077,
42754,
4387,
284,
96860,
1397,
486,
931,
1428,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_rbtree_iterator() {
let zone = example_zone_v2();
let mut index = 0;
let iter_order = [
"*.baidu.com.",
"test\\.dns.baidu.com.",
"baidu.com.",
"google.com.",
"com.",
".",
];
for ix in zone {
assert_eq!(
ix.deref().borrow().get_name().to_string(),
String::from(iter_order[index])
);
index = index + 1;
}
let zone = UnSafeRBTreeStorage::default();
for ix in zone {
assert_eq!(
ix.deref().borrow().get_name().to_string(),
String::from(".")
);
}
} | rust_cleaned_test_functions.jsonl/29055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68544,
9344,
13491,
368,
341,
286,
1077,
10143,
284,
3110,
28692,
2273,
17,
543,
286,
1077,
5206,
1922,
284,
220,
15,
280,
286,
1077,
5367,
7869,
284,
2278,
310,
59128,
65,
35801,
905,
10346,
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_buf_writer() {
let mut buf = [0 as u8, ..9];
{
let mut writer = BufWriter::new(&mut buf);
assert_eq!(writer.tell(), Ok(0));
writer.write(&[0]).unwrap();
assert_eq!(writer.tell(), Ok(1));
writer.write(&[1, 2, 3]).unwrap();
writer.write(&[4, 5, 6, 7]).unwrap();
assert_eq!(writer.tell(), Ok(8));
writer.write(&[]).unwrap();
assert_eq!(writer.tell(), Ok(8));
assert_eq!(writer.write(&[8, 9]).unwrap_err().kind, io::ShortWrite(1));
assert_eq!(writer.write(&[10]).unwrap_err().kind, io::EndOfFile);
}
let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8];
assert_eq!(buf, b);
} | rust_cleaned_test_functions.jsonl/7085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10363,
28908,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
438,
575,
23,
11,
5241,
24,
935,
286,
341,
310,
1077,
5206,
6916,
284,
69013,
6492,
486,
931,
2099,
6984,
6607,
317,
310,
2060,
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_prepare_failures() -> Result<()> {
let db = checked_memory_handle();
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
let _ = db.prepare("SELECT * FROM does_not_exist").unwrap_err();
Ok(())
} | rust_cleaned_test_functions.jsonl/113057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47460,
22121,
1413,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
543,
286,
2927,
7769,
14534,
445,
22599,
14363,
15229,
2075,
30381,
1215,
899,
69493,
286,
1077,
716,
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
] | 2 |
#[test]
fn test_unwrap_placeholder() {
assert!(unwrap_placeholder("").is_err());
assert!(unwrap_placeholder(" ").is_err());
assert!(unwrap_placeholder("FIXME").is_err());
assert!(unwrap_placeholder("Ok").is_ok());
} | rust_cleaned_test_functions.jsonl/133329 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
10097,
60383,
368,
341,
262,
2060,
10297,
15454,
60383,
80821,
285,
9266,
1423,
262,
2060,
10297,
15454,
60383,
445,
256,
27510,
285,
9266,
1423,
262,
2060,
10297,
15454,
60383,
445,
81019,
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 |
#[test]
fn test_parse_payee_pub_key() {
use ::PayeePubKey;
use bech32::FromBase32;
let input = from_bech32("q0n326hr8v9zprg8gsvezcch06gfaqqhde2aj730yg0durunfhv66".as_bytes());
let pk_bytes = [
0x03, 0xe7, 0x15, 0x6a, 0xe3, 0x3b, 0x0a, 0x20, 0x8d, 0x07, 0x44, 0x19, 0x91, 0x63,
0x17, 0x7e, 0x90, 0x9e, 0x80, 0x17, 0x6e, 0x55, 0xd9, 0x7a, 0x2f, 0x22, 0x1e, 0xde,
0x0f, 0x93, 0x4d, 0xd9, 0xad
];
let expected = Ok(PayeePubKey(
PublicKey::from_slice(&pk_bytes[..]).unwrap()
));
assert_eq!(PayeePubKey::from_base32(&input), expected);
// expects 33 bytes
let input_unexpected_length = from_bech32(
"q0n326hr8v9zprg8gsvezcch06gfaqqhde2aj730yg0durunfhvq".as_bytes()
);
assert_eq!(PayeePubKey::from_base32(&input_unexpected_length), Err(ParseError::Skip));
} | rust_cleaned_test_functions.jsonl/123246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 434
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
28925,
2127,
34014,
3097,
368,
341,
197,
41819,
3504,
20595,
2127,
29162,
1592,
280,
197,
41819,
387,
331,
18,
17,
486,
3830,
3978,
18,
17,
401,
197,
10217,
1946,
284,
504,
880,
4737,
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_handle_round_timeout_queue_prevote_message_from_next_round() {
let sandbox = timestamping_sandbox();
sandbox.recv(&Prevote::new(VALIDATOR_2,
HEIGHT_ONE,
ROUND_TWO,
&empty_hash(),
Round::zero(),
sandbox.s(VALIDATOR_2)));
// trigger round_timeout
sandbox.add_time(Duration::from_millis(sandbox.round_timeout()));
// trigger request_propose_timeout
sandbox.add_time(Duration::from_millis(PROPOSE_REQUEST_TIMEOUT));
// observe requestPropose request
sandbox.add_time(Duration::from_millis(0));
} | rust_cleaned_test_functions.jsonl/8886 | {
"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,
10630,
29896,
20537,
10841,
25566,
1272,
6462,
5673,
11257,
29896,
368,
341,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
1428,
262,
42754,
40433,
2099,
4703,
29358,
486,
931,
7,
10044,
11857,
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_add() {
let a = BalancedTernary::from(45);
let b = BalancedTernary::from(2);
let c = BalancedTernary::from(-2);
assert_eq!(i128::try_from(a.clone() + b), Ok(47));
assert_eq!(i128::try_from(c + a), Ok(43));
} | rust_cleaned_test_functions.jsonl/73619 | {
"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,
2891,
368,
341,
286,
1077,
264,
284,
97109,
51,
932,
658,
486,
1499,
7,
19,
20,
317,
286,
1077,
293,
284,
97109,
51,
932,
658,
486,
1499,
7,
17,
317,
286,
1077,
272,
284,
97109,
51,
932,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.