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_looping_logic() {
let runner = actix::System::new();
runner.block_on(async move {
let max_iter = 10000;
let mut blocks_to_search = 99999;
let xdai_client = Web3::new("https://dai.althea.net", Duration::from_secs(5));
let latest_block = xdai_client.eth_block_number().await.unwrap();
let (start, end) =
compute_start_end(0, latest_block.clone(), blocks_to_search, max_iter);
assert_eq!(start, latest_block.clone() - blocks_to_search.into());
assert_eq!(end, start + max_iter.into());
blocks_to_search = 9999;
let (start, end) =
compute_start_end(0, latest_block.clone(), blocks_to_search, max_iter);
assert_eq!(start, latest_block.clone() - blocks_to_search.into());
assert_eq!(end, start + blocks_to_search.into());
blocks_to_search = 10000;
let (start, end) =
compute_start_end(0, latest_block.clone(), blocks_to_search, max_iter);
assert_eq!(start, latest_block.clone() - blocks_to_search.into());
assert_eq!(end, start + blocks_to_search.into());
blocks_to_search = 10001;
let (start, end) =
compute_start_end(0, latest_block.clone(), blocks_to_search, max_iter);
assert_eq!(start, latest_block.clone() - blocks_to_search.into());
assert_eq!(end, start + max_iter.into());
let (start, end) =
compute_start_end(1, latest_block.clone(), blocks_to_search, max_iter);
assert_eq!(start, latest_block - 1u32.into());
assert_eq!(end, start + 1u32.into());
});
} | rust_cleaned_test_functions.jsonl/21538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 853
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17198,
287,
54335,
368,
341,
286,
1077,
22259,
284,
1160,
941,
486,
2320,
486,
931,
543,
286,
22259,
15697,
4470,
18285,
3271,
341,
310,
1077,
1932,
11723,
284,
220,
16,
15,
15,
15,
15,
401,
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_mktemp_make_temp_dir() {
let scene = TestScenario::new(util_name!());
let pathname = scene.fixtures.as_string();
scene
.ucmd()
.env(TMPDIR, &pathname)
.arg("-d")
.arg(TEST_TEMPLATE1)
.succeeds();
scene
.ucmd()
.env(TMPDIR, &pathname)
.arg("-d")
.arg(TEST_TEMPLATE2)
.fails();
scene
.ucmd()
.env(TMPDIR, &pathname)
.arg("-d")
.arg(TEST_TEMPLATE3)
.fails();
scene
.ucmd()
.env(TMPDIR, &pathname)
.arg("-d")
.arg(TEST_TEMPLATE4)
.fails();
scene
.ucmd()
.env(TMPDIR, &pathname)
.arg("-d")
.arg(TEST_TEMPLATE5)
.succeeds();
scene
.ucmd()
.env(TMPDIR, &pathname)
.arg("-d")
.arg(TEST_TEMPLATE6)
.succeeds();
scene
.ucmd()
.env(TMPDIR, &pathname)
.arg("-d")
.arg(TEST_TEMPLATE7)
.succeeds();
scene
.ucmd()
.env(TMPDIR, &pathname)
.arg("-d")
.arg(TEST_TEMPLATE8)
.fails();
} | rust_cleaned_test_functions.jsonl/38028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 725
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64861,
3888,
28230,
11771,
4334,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
5231,
262,
1077,
39683,
284,
6109,
67785,
18513,
5357,
3904,
1428,
262,
6109,
198,
286,
659,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_flight_data_dictionary() {
let options = arrow::ipc::writer::IpcWriteOptions::default();
let c1 = UInt32Array::from(vec![1, 2, 3, 4, 5, 6]);
let c2: DictionaryArray<Int32Type> = vec![
Some("foo"),
Some("bar"),
None,
Some("fiz"),
None,
Some("foo"),
]
.into_iter()
.collect();
let batch =
RecordBatch::try_from_iter(vec![("a", Arc::new(c1) as ArrayRef), ("b", Arc::new(c2))])
.expect("cannot create record batch");
let original_schema = batch.schema();
let optimized_schema = Arc::new(optimize_schema(&original_schema));
let optimized_batch = optimize_record_batch(&batch, Arc::clone(&optimized_schema)).unwrap();
let (_, flight_data) =
arrow_flight::utils::flight_data_from_arrow_batch(&optimized_batch, &options);
let batch =
flight_data_to_arrow_batch(&flight_data, Arc::clone(&optimized_schema), &[None, None])
.unwrap();
// Should hydrate string dictionary for transport
assert_eq!(optimized_schema.field(1).data_type(), &DataType::Utf8);
let array = batch
.column(1)
.as_any()
.downcast_ref::<StringArray>()
.unwrap();
let expected = StringArray::from(vec![
Some("foo"),
Some("bar"),
None,
Some("fiz"),
None,
Some("foo"),
]);
assert_eq!(array, &expected)
} | rust_cleaned_test_functions.jsonl/30628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 808
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
90370,
1769,
42605,
368,
341,
286,
1077,
2606,
284,
17921,
486,
68281,
486,
18189,
486,
40,
3992,
7985,
3798,
486,
2258,
1428,
286,
1077,
272,
16,
284,
22275,
18,
17,
1857,
486,
1499,
255... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pop_b() {
let mut state = State8080::empty_state();
state.memory = vec![0xc1, 0xc3, 0xff];
state.sp = 0x01;
state.b = 0x00;
state.c = 0x00;
emulate_8080_op(&mut state);
assert_eq!(state.b, 0xff);
assert_eq!(state.c, 0xc3);
assert_eq!(state.sp, 0x03);
} | rust_cleaned_test_functions.jsonl/7771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
880,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
8148,
16,
11,
220,
15,
8148,
18,
11,
220,
15,
9020,
935,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generator() {
assert_eq!(
generator("rect 1x2")[0],
Instruction::Rectangle { x: 1, y: 2 }
);
assert_eq!(
generator("rotate row y=1 by 5")[0],
Instruction::RotateRow { row: 1, delta: 5 }
);
assert_eq!(
generator("rotate column x=30 by 1")[0],
Instruction::RotateColumn { col: 30, delta: 1 }
);
} | rust_cleaned_test_functions.jsonl/43444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25813,
368,
341,
286,
2060,
10714,
33673,
310,
13823,
445,
2851,
220,
16,
87,
17,
17135,
15,
1259,
310,
29051,
486,
21095,
314,
856,
25,
220,
16,
11,
379,
25,
220,
17,
456,
286,
1439,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_nested() {
let deserializer = &mut Deserializer::from_str(r#"{"answer":null, "other":21}"#);
// It should reject the "null" value and add an error
let value = Annotated::from(Test {
answer: Annotated::from_error("invalid type: null, expected i32"),
other: 21,
});
assert_eq_dbg!(
value,
deserialize_meta(deserializer, MetaMap::new()).unwrap()
);
} | rust_cleaned_test_functions.jsonl/126359 | {
"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,
40447,
66279,
368,
341,
286,
1077,
939,
41939,
284,
609,
6984,
3874,
41939,
486,
1499,
2895,
2601,
55543,
4913,
9217,
788,
2921,
11,
330,
1575,
788,
17,
16,
9863,
2,
626,
286,
442,
1084,
1265,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assert_08() {
let ast = check_parse("void f() { assert false; }");
assert_eq!(ast.get(2),&Node::BoolExpr(false));
assert_eq!(ast.get(3),&Node::AssertStmt(Expr(2)));
} | rust_cleaned_test_functions.jsonl/96565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16553,
62,
15,
23,
368,
341,
262,
1077,
11763,
284,
1779,
21039,
445,
1004,
282,
368,
314,
2060,
895,
26,
335,
797,
262,
2060,
10714,
10297,
559,
670,
7,
17,
701,
5,
1955,
486,
11233,
16041,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_literal() {
parse_macro(
r#"
macro_rules! foo {
($ type:ty $ lit:literal) => { const VALUE: $ type = $ lit;};
}
"#,
)
.assert_expand_items(r#"foo!(u8 0);"#, r#"const VALUE : u8 = 0 ;"#);
} | rust_cleaned_test_functions.jsonl/85994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34100,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
1060,
1711,
943,
25,
1881,
400,
13020,
25,
35785,
8,
589,
314,
733,
26827,
25,
400,
943,
284,
400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_spin_option() {
let m = UciMessage::Option(UciOptionConfig::Spin {
name: "Selectivity".to_string(),
default: Some(2),
min: Some(0),
max: Some(4),
});
assert_eq!(m.serialize(), "option name Selectivity type spin default 2 min 0 max 4");
} | rust_cleaned_test_functions.jsonl/19051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
47965,
9672,
368,
341,
286,
1077,
296,
284,
547,
5855,
2052,
486,
5341,
12317,
5855,
5341,
2648,
486,
41738,
341,
310,
829,
25,
330,
3379,
1927,
3263,
983,
3904,
3148,
310,
1638,
25,
4329... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_import_error() {
use url::ParseError::*;
use ModuleResolutionError::*;
let tests = vec![
(
"005_more_imports.ts",
"http://deno.land/core/tests/006_url_imports.ts",
ImportPrefixMissing("005_more_imports.ts".to_string()),
),
(
".tomato",
"http://deno.land/core/tests/006_url_imports.ts",
ImportPrefixMissing(".tomato".to_string()),
),
(
"..zucchini.mjs",
"http://deno.land/core/tests/006_url_imports.ts",
ImportPrefixMissing("..zucchini.mjs".to_string()),
),
(
r".\yam.es",
"http://deno.land/core/tests/006_url_imports.ts",
ImportPrefixMissing(r".\yam.es".to_string()),
),
(
r"..\yam.es",
"http://deno.land/core/tests/006_url_imports.ts",
ImportPrefixMissing(r"..\yam.es".to_string()),
),
(
"https://eggplant:b/c",
"http://deno.land/core/tests/006_url_imports.ts",
InvalidUrl(InvalidPort),
),
(
"https://eggplant@/c",
"http://deno.land/core/tests/006_url_imports.ts",
InvalidUrl(EmptyHost),
),
(
"./foo.ts",
"/relative/base/url",
InvalidBaseUrl(RelativeUrlWithoutBase),
),
];
for (specifier, base, expected_err) in tests {
let err = ModuleSpecifier::resolve_import(specifier, base).unwrap_err();
assert_eq!(err, expected_err);
}
} | rust_cleaned_test_functions.jsonl/59601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 766
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
18434,
4096,
368,
341,
262,
990,
2515,
486,
14463,
1454,
56162,
262,
990,
13711,
38106,
1454,
79304,
262,
1077,
7032,
284,
7486,
90515,
414,
2399,
286,
330,
15,
15,
20,
36664,
18434,
82,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_addv_assign() {
let mut a = [1.2, 1.3, 1.4];
let b = [1.3, 1.5, 2.4];
a.addv_assign(&b);
let a_expected: [f64; 3] = [2.5, 2.8, 3.8];
for i in 0..a.len() {
assert_approx_eq!(a[i], a_expected[i]);
}
} | rust_cleaned_test_functions.jsonl/66745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
85,
20688,
368,
341,
286,
1077,
5206,
264,
284,
508,
16,
13,
17,
11,
220,
16,
13,
18,
11,
220,
16,
13,
19,
935,
286,
1077,
293,
284,
508,
16,
13,
18,
11,
220,
16,
13,
20,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_markdown_internal_url() {
let base_url = "https://localhost.com/";
let input = "This is [an internal url](@/internal.md) \
This is [an internal url](@/internal.markdown) \
This is [an internal url](@/internal.markdown#example) \
This is [an internal url](@/internal.md#example)";
let links: HashSet<Uri> = extract_links(
&InputContent::from_string(input, FileType::Markdown),
Some(Url::parse(base_url).unwrap()),
)
.into_iter()
.map(|r| r.uri)
.collect();
let expected = [
website("https://localhost.com/@/internal.md"),
website("https://localhost.com/@/internal.markdown"),
website("https://localhost.com/@/internal.md#example"),
website("https://localhost.com/@/internal.markdown#example"),
]
.iter()
.cloned()
.collect();
assert_eq!(links, expected)
} | rust_cleaned_test_functions.jsonl/93890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
2923,
23472,
2903,
368,
341,
286,
1077,
2331,
2903,
284,
330,
2428,
1110,
8301,
905,
37254,
286,
1077,
1946,
284,
330,
1986,
374,
508,
276,
5306,
2515,
60,
5957,
14,
10481,
21324,
8,
3044... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage() {
let mut array = PackedStringArray::<i32>::new();
array.append("hello");
array.append("world");
array.append("cupcake");
assert_eq!(array.get(0).unwrap(), "hello");
assert_eq!(array.get(1).unwrap(), "world");
assert_eq!(array.get(2).unwrap(), "cupcake");
assert!(array.get(-1_i32 as usize).is_none());
assert!(array.get(3).is_none());
array.extend(2);
assert_eq!(array.get(3).unwrap(), "");
assert_eq!(array.get(4).unwrap(), "");
assert!(array.get(5).is_none());
} | rust_cleaned_test_functions.jsonl/47436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
368,
341,
286,
1077,
5206,
1334,
284,
393,
11191,
703,
1857,
27638,
72,
18,
17,
6831,
931,
1428,
286,
1334,
2057,
445,
14990,
797,
286,
1334,
2057,
445,
14615,
797,
286,
1334,
2057,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_chunks_num_chunks_oversized_32() {
#[cfg(target_pointer_width = "32")]
{
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("file");
scene
.ucmd()
.args(&["--number", "5000000000", "file"])
.fails()
.code_is(1)
.stderr_only("split: Number of chunks too big");
}
} | rust_cleaned_test_functions.jsonl/25864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
65470,
4273,
65470,
62,
8969,
1506,
62,
18,
17,
368,
341,
262,
11506,
14072,
8637,
21425,
7927,
284,
330,
18,
17,
5422,
262,
341,
286,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nested_struct_param() {
assert_eq!(
HumanReadableParser::parse_type("(address,bool,(bool,uint256))").unwrap(),
ParamType::Tuple(vec![
ParamType::Address,
ParamType::Bool,
ParamType::Tuple(vec![ParamType::Bool, ParamType::Uint(256)])
])
);
} | rust_cleaned_test_functions.jsonl/77868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
66279,
15126,
4090,
368,
341,
286,
2060,
10714,
33673,
310,
11097,
57938,
6570,
486,
6400,
1819,
31732,
4995,
63634,
12950,
2641,
56798,
17,
20,
21,
593,
1827,
15454,
3148,
310,
6991,
929,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_proc_maps_line() {
let test_line = "56187cdca000-56187cdcc000 r--p 00000420 103:02 7733675 /usr/bin/cat";
let (
path,
offset,
permissions,
) = parse_proc_maps_line(test_line);
assert_eq!(path, "/usr/bin/cat");
assert_eq!(offset, 0x00000420);
assert_eq!(permissions.start_address, 0x56187cdca000);
assert_eq!(permissions.end_address, 0x56187cdcc000);
assert_eq!(permissions.read, true);
assert_eq!(permissions.write, false);
assert_eq!(permissions.execute, false);
} | rust_cleaned_test_functions.jsonl/18764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
24436,
46512,
6528,
368,
341,
286,
1077,
1273,
6528,
284,
330,
20,
21,
16,
23,
22,
4385,
924,
15,
15,
15,
12,
20,
21,
16,
23,
22,
4385,
638,
15,
15,
15,
435,
313,
79,
220,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rust_builder_scope_signal_handler() {
test_synced(move || {
use crate::Button;
pub struct Callbacks {}
#[template_callbacks]
impl Callbacks {
#[template_callback]
fn button_clicked(button: &Button) {
skip_assert_initialized!();
assert_eq!(button.label().unwrap().as_str(), "Hello World");
button.set_label("Clicked");
}
}
let builder = Builder::new();
let scope = BuilderRustScope::new();
Callbacks::add_callbacks_to_scope(&scope);
builder.set_scope(Some(&scope));
builder.add_from_string(SIGNAL_XML).unwrap();
let button = builder.object::<Button>("button").unwrap();
button.emit_clicked();
assert_eq!(button.label().unwrap().as_str(), "Clicked");
});
} | rust_cleaned_test_functions.jsonl/84768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
590,
28532,
23199,
21137,
10183,
368,
341,
286,
1273,
23008,
291,
34081,
1369,
341,
310,
990,
17717,
486,
1567,
401,
310,
6675,
2036,
22668,
82,
5613,
310,
11506,
4214,
60148,
921,
310,
1160... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookahead() {
compare(
r#"
grammar;
extern { type Location = usize; enum Tok { } }
A = @L;
"#,
vec![("A", "usize")],
)
} | rust_cleaned_test_functions.jsonl/50471 | {
"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,
24271,
42787,
368,
341,
262,
9429,
1006,
286,
435,
2,
698,
41094,
280,
262,
15637,
314,
943,
9866,
284,
22301,
26,
7618,
21447,
314,
335,
456,
262,
362,
284,
569,
43,
280,
57676,
345,
286,
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 |
#[test]
fn test_directory_writable_fails_if_not_directory() {
let path = Path::new("/fake/directory/is/fake");
let result = test_directory_writable("test", path);
assert_eq!(
format!("{:?}", result),
"Err(ActionError(\"test path \\\"/fake/directory/is/fake\\\" \
does not exist\"))"
);
} | rust_cleaned_test_functions.jsonl/80500 | {
"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,
14846,
1670,
22533,
761,
6209,
11119,
7913,
14846,
368,
341,
286,
1077,
1815,
284,
7933,
486,
931,
4283,
30570,
3446,
4758,
46427,
6663,
726,
3071,
286,
1077,
1102,
284,
1273,
14846,
1670,
22533,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_batch_receiver() {
let (tx, rx) = unbounded::<u64>(4);
let rx = BatchReceiver::new(rx, 8, || Vec::with_capacity(4), VecCollector);
let msg_counter = Arc::new(AtomicUsize::new(0));
let msg_counter_spawned = Arc::clone(&msg_counter);
let (nty, polled) = mpsc::sync_channel(1);
let pool = CpuPool::new(1);
let _res = pool.spawn(
rx.select(stream::poll_fn(move || -> Poll<Option<Vec<u64>>, ()> {
nty.send(()).unwrap();
Ok(Async::Ready(None))
}))
.for_each(move |v| {
let len = v.len();
assert!(len <= 8);
msg_counter_spawned.fetch_add(len, Ordering::AcqRel);
Ok(())
}),
);
// Wait until the receiver has been polled in the spawned thread.
polled.recv().unwrap();
assert!(tx.send(0).is_ok());
thread::sleep(time::Duration::from_millis(10));
assert_eq!(msg_counter.load(Ordering::Acquire), 0);
// Send with notify.
let notifier = tx.get_notifier().unwrap();
assert!(tx.get_notifier().is_none());
notifier.notify();
thread::sleep(time::Duration::from_millis(10));
assert_eq!(msg_counter.load(Ordering::Acquire), 1);
// Auto notify with more sendings.
for _ in 0..16 {
assert!(tx.send(0).is_ok());
}
thread::sleep(time::Duration::from_millis(10));
assert_eq!(msg_counter.load(Ordering::Acquire), 17);
} | rust_cleaned_test_functions.jsonl/54984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 800
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
65691,
368,
341,
286,
1077,
320,
3998,
11,
19111,
8,
284,
650,
65686,
27638,
84,
21,
19,
2235,
19,
626,
286,
1077,
19111,
284,
33904,
25436,
486,
931,
75279,
11,
220,
23,
11,
1369,
1131... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transaction_decoding() {
let example_trytes = get_example_trytes();
let tx = Transaction::from_tryte_string(&example_trytes);
assert_eq!(EXAMPLE_ADDR, tx.address);
assert_eq!(-7_297_419_313, tx.value);
assert_eq!(1_544_207_541_879, tx.attachment_timestamp);
} | rust_cleaned_test_functions.jsonl/1278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
13783,
3700,
368,
341,
286,
1077,
3110,
53283,
2338,
284,
633,
39304,
53283,
2338,
543,
286,
1077,
9854,
284,
17869,
486,
1499,
53283,
665,
3904,
2099,
8687,
53283,
2338,
626,
286,
2060,
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_set_vsock_device() {
let mut vm_resources = default_vm_resources();
let new_vsock_cfg = VsockDeviceConfig {
vsock_id: "new_vsock".to_string(),
guest_cid: 1,
uds_path: String::from("uds_path"),
};
assert!(vm_resources.vsock.is_none());
vm_resources.set_vsock_device(new_vsock_cfg.clone());
let actual_vsock_cfg = vm_resources.vsock.as_ref().unwrap().clone();
assert_eq!(actual_vsock_cfg, new_vsock_cfg);
} | rust_cleaned_test_functions.jsonl/51473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
2273,
13199,
9204,
368,
341,
286,
1077,
5206,
10995,
35569,
284,
1638,
39008,
35569,
543,
286,
1077,
501,
2273,
13199,
18343,
284,
647,
13199,
6985,
2648,
341,
310,
348,
13199,
842,
25,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_program_bpf_instruction_introspection() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50_000);
let mut bank = Bank::new(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin(&name, id, entrypoint);
let bank = Arc::new(bank);
let bank_client = BankClient::new_shared(&bank);
let program_id = load_bpf_program(
&bank_client,
&bpf_loader::id(),
&mint_keypair,
"solana_bpf_rust_instruction_introspection",
);
// Passing transaction
let account_metas = vec![AccountMeta::new_readonly(
solana_sdk::sysvar::instructions::id(),
false,
)];
let instruction0 = Instruction::new_with_bytes(program_id, &[0u8, 0u8], account_metas.clone());
let instruction1 = Instruction::new_with_bytes(program_id, &[0u8, 1u8], account_metas.clone());
let instruction2 = Instruction::new_with_bytes(program_id, &[0u8, 2u8], account_metas);
let message = Message::new(
&[instruction0, instruction1, instruction2],
Some(&mint_keypair.pubkey()),
);
let result = bank_client.send_and_confirm_message(&[&mint_keypair], message);
assert!(result.is_ok());
let account_metas = vec![AccountMeta::new(
solana_sdk::sysvar::instructions::id(),
false,
)];
let instruction = Instruction::new_with_bytes(program_id, &[0], account_metas);
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
assert_eq!(
result.unwrap_err().unwrap(),
// sysvar write locks are demoted to read only. So this will no longer
// cause InvalidAccountIndex error.
TransactionError::InstructionError(0, InstructionError::ProgramFailedToComplete),
);
let instruction = Instruction::new_with_bytes(program_id, &[0], vec![]);
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
assert!(result.is_err());
assert_eq!(
result.unwrap_err().unwrap(),
TransactionError::InstructionError(
0,
solana_sdk::instruction::InstructionError::NotEnoughAccountKeys
)
);
assert!(bank
.get_account(&solana_sdk::sysvar::instructions::id())
.is_none());
} | rust_cleaned_test_functions.jsonl/11453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 990
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
880,
15897,
54923,
4042,
3630,
16076,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
40788,
2648,
1731,
341,
286,
59366,
5332,
345,
286,
28337,
3097,
12670,
345,
286,
54538,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dlsd_radixsort_f32_inf() {
let mut a = helper_random_array_uniform_f32(2000);
a[1999] = std::f32::NEG_INFINITY;
a[0] = std::f32::INFINITY;
let mut check = a.to_vec();
dlsd_radixsort(&mut a, 8);
check.par_sort_unstable_by(|a, b| a.partial_cmp(b).unwrap());
assert_eq!(a, check);
} | rust_cleaned_test_functions.jsonl/43404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
814,
4730,
67,
39764,
941,
6860,
761,
18,
17,
26051,
368,
341,
262,
1077,
5206,
264,
284,
13137,
22644,
3858,
45066,
761,
18,
17,
7,
17,
15,
15,
15,
317,
262,
264,
58,
16,
24,
24,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_select_pos_diff() {
let weights = vec![
to_ratio(array![[1, 0, 1]]),
to_ratio(array![[-1, 1, 1]]),
to_ratio(array![[1, 1, -1]]),
to_ratio(array![[-1, 2, -1]]),
];
let result = select_pos_diff(&to_ratio(array![[1, 1, 0]]), &weights);
let mut expected: HashSet<Array2R> = HashSet::new();
expected.insert(to_ratio(array![[0, 0, 1]]));
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/12044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
6479,
15850,
368,
341,
286,
1077,
14324,
284,
7486,
90515,
310,
311,
19917,
6110,
0,
15505,
16,
11,
220,
15,
11,
220,
16,
5053,
1326,
310,
311,
19917,
6110,
20703,
7609,
16,
11,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display_debug() {
let buf = AlignedBuffer::<u64, [u8; 8]>::default();
let lv = LayoutVerified::<_, u64>::new(&buf.buf[..]).unwrap();
assert_eq!(format!("{}", lv), "0");
assert_eq!(format!("{:?}", lv), "LayoutVerified(0)");
let buf = AlignedBuffer::<u64, [u8; 8]>::default();
let lv = LayoutVerified::<_, [u64]>::new_slice(&buf.buf[..]).unwrap();
assert_eq!(format!("{:?}", lv), "LayoutVerified([0])");
} | rust_cleaned_test_functions.jsonl/18905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
15446,
368,
341,
286,
1077,
6607,
284,
1674,
1542,
4095,
27638,
84,
21,
19,
11,
508,
84,
23,
26,
220,
23,
60,
6831,
2258,
543,
286,
1077,
28378,
284,
13821,
54558,
27638,
6878,
575,
21,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_decode() {
assert_encode_decode::<TransactionAccumulatorSchema>(
&Position::from_inorder_index(100),
&HashValue::random(),
);
} | rust_cleaned_test_functions.jsonl/127156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
15227,
368,
341,
262,
2060,
11224,
15227,
27638,
8070,
14603,
372,
10511,
8632,
17055,
286,
609,
3812,
486,
1499,
1243,
1358,
3560,
7,
16,
15,
15,
1326,
286,
609,
6370,
1130,
486,
11463,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_no_ignore_aliases() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
te.assert_output(
&["-u", "foo"],
"a.foo
fdignored.foo
gitignored.foo
one/b.foo
one/two/c.foo
one/two/C.Foo2
one/two/three/d.foo
one/two/three/directory_foo",
);
te.assert_output(
&["-uu", "foo"],
".hidden.foo
a.foo
fdignored.foo
gitignored.foo
one/b.foo
one/two/c.foo
one/two/C.Foo2
one/two/three/d.foo
one/two/three/directory_foo",
);
} | rust_cleaned_test_functions.jsonl/10869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
58493,
90233,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
1013,
3713,
7645,
1006,
286,
609,
1183,
12,
84,
497,
330,
7975,
8097,
286,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tag() {
if let Err(_) = tag("ROR").easy_parse("ROR") {
assert!(false);
}
if let Ok(_) = tag("ROR").easy_parse("RO_R") {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/103361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9372,
368,
341,
286,
421,
1077,
15495,
48139,
284,
4772,
445,
49,
868,
1827,
45022,
21039,
445,
49,
868,
899,
341,
310,
2060,
10297,
3849,
317,
286,
555,
286,
421,
1077,
7622,
48139,
284,
4772,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sort_descending() {
let input = "{\"bar\":3,\"foo\":4}\n{\"bar\":4,\"foo\":7}\n";
let mut output = vec![];
sort(
input.as_bytes(),
&mut output,
vec![(vec![Selector::Identifier("bar".into())], false)],
)
.unwrap();
assert_eq!(
output,
"{\"bar\":4,\"foo\":7}\n{\"bar\":3,\"foo\":4}\n".as_bytes()
);
} | rust_cleaned_test_functions.jsonl/8715 | {
"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,
18435,
10986,
2459,
368,
341,
286,
1077,
1946,
284,
54734,
2257,
11693,
18,
52318,
7975,
11693,
19,
11035,
77,
64238,
2257,
11693,
19,
52318,
7975,
11693,
22,
11035,
77,
3302,
286,
1077,
5206,
255... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quaternion_sum() {
let q1 = Quaternion::new(1.0, [2.0, 3.0, 4.0]);
let q2 = Quaternion::new(1.0, [2.0, 3.0, 4.0]);
let expected = Quaternion::new(2.0, [4.0, 6.0, 8.0]);
let q3 = q1 + q2;
assert!(q3 == expected);
} | rust_cleaned_test_functions.jsonl/113345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
16351,
10160,
368,
341,
197,
10217,
2804,
16,
284,
24801,
486,
931,
7,
16,
13,
15,
11,
508,
17,
13,
15,
11,
220,
18,
13,
15,
11,
220,
19,
13,
15,
2558,
197,
10217,
2804,
17,
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_strip_types() {
let ast_parser = AstParser::default();
let result = ast_parser
.strip_types("test.ts", MediaType::TypeScript, "const a: number = 10;")
.unwrap();
assert!(result.starts_with(
"const a = 10;\n//# sourceMappingURL=data:application/json;base64,"
));
} | rust_cleaned_test_functions.jsonl/38403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66130,
9763,
368,
341,
220,
1077,
11763,
18517,
284,
20113,
6570,
486,
2258,
543,
220,
1077,
1102,
284,
11763,
18517,
198,
262,
659,
13105,
9763,
445,
1944,
21288,
497,
50423,
486,
929,
5910,
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_counter() {
env_logger::Builder::from_env(env_logger::Env::new().default_filter_or("morgan=info"))
.init();
let _readlock = get_env_lock().read();
static mut COUNTER: Counter = create_counter!("test", 1000, 1);
let count = 1;
inc_counter!(COUNTER, Level::Info, count);
unsafe {
assert_eq!(COUNTER.counts.load(Ordering::Relaxed), 1);
assert_eq!(COUNTER.times.load(Ordering::Relaxed), 1);
assert_eq!(COUNTER.lograte.load(Ordering::Relaxed), 1000);
assert_eq!(COUNTER.lastlog.load(Ordering::Relaxed), 0);
assert_eq!(COUNTER.name, "test");
}
for _ in 0..199 {
inc_counter!(COUNTER, Level::Info, 2);
}
unsafe {
assert_eq!(COUNTER.lastlog.load(Ordering::Relaxed), 397);
}
inc_counter!(COUNTER, Level::Info, 2);
unsafe {
assert_eq!(COUNTER.lastlog.load(Ordering::Relaxed), 399);
}
} | rust_cleaned_test_functions.jsonl/92058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 527
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15730,
368,
341,
286,
6105,
27413,
486,
3297,
486,
1499,
15879,
16978,
27413,
486,
14359,
486,
931,
1005,
2258,
8727,
8734,
445,
96391,
28,
2733,
5455,
310,
659,
2327,
543,
286,
1077,
716,
878,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iterate_into_string() {
let words = vec!["hello", " ", "world"];
let capitalized_words = "Hello World".to_string(); // TODO
assert_eq!(capitalized_words, "Hello World");
} | rust_cleaned_test_functions.jsonl/55633 | {
"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,
11723,
349,
45514,
3904,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
3670,
330,
14615,
6332,
286,
1077,
97321,
18981,
284,
330,
9707,
4337,
3263,
983,
3904,
2129,
442,
5343,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_path_try_from() {
let hex = hex::decode(TEST_PATH_BUFFER).expect("");
let path = Path::try_from(PATH_TEST).unwrap();
assert_eq!(path.as_ref(), hex)
} | rust_cleaned_test_functions.jsonl/77245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
53283,
5673,
368,
341,
286,
1077,
12371,
284,
12371,
486,
18196,
50320,
7944,
14394,
568,
17119,
13056,
286,
1077,
1815,
284,
7933,
486,
1539,
5673,
72791,
11641,
568,
15454,
1428,
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 |
#[test]
fn test_arena() {
use crate::bigqueue::Arena;
use std::path::PathBuf;
let mut t = match Arena::new(PathBuf::from("/tmp/11.dat"), 5 * 8) {
Ok(t) => t,
_ => {
panic!("")
}
};
t.write_u64_at(0, 100u64);
t.write_u64_at(8, 10u64);
t.flush().unwrap();
println!("{}", t);
} | rust_cleaned_test_functions.jsonl/45008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
30527,
368,
341,
286,
990,
17717,
486,
16154,
4584,
486,
93937,
280,
286,
990,
1460,
486,
2343,
486,
1820,
15064,
280,
286,
1077,
5206,
259,
284,
2432,
27047,
486,
931,
33030,
15064,
486,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_i8042_read_write_and_event() {
let mut i8042 = I8042Device::new(EventFd::new().unwrap());
let reset_evt = i8042.get_eventfd_clone().unwrap();
// Check if reading in a 2-length array doesn't have side effects.
let mut data = [1, 2];
i8042.read(0, &mut data);
assert_eq!(data, [1, 2]);
i8042.read(1, &mut data);
assert_eq!(data, [1, 2]);
// Check if reset works.
assert!(reset_evt.write(1).is_ok());
let mut data = [RESET_CMD];
i8042.write(0, &mut data);
assert_eq!(reset_evt.read().unwrap(), 2);
// Check if reading with offset 1 doesn't have side effects.
i8042.read(1, &mut data);
assert_eq!(data[0], RESET_CMD);
// Check if reading in a 1-length array with offset 0 returns [0].
i8042.read(0, &mut data);
assert_eq!(data[0], 0);
// Check invalid `write`s.
let before = METRICS.i8042.missed_write_count.count();
// offset != 0.
i8042.write(1, &mut data);
// data != RESET_CMD
data[0] = RESET_CMD + 1;
i8042.write(1, &mut data);
let mut data = [RESET_CMD; 2];
i8042.write(1, &mut data);
assert_eq!(METRICS.i8042.missed_write_count.count(), before + 3);
} | rust_cleaned_test_functions.jsonl/67924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 677
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
23,
15,
19,
17,
6443,
9165,
8378,
6748,
368,
341,
286,
1077,
5206,
600,
23,
15,
19,
17,
284,
358,
23,
15,
19,
17,
6985,
486,
931,
30469,
74476,
486,
931,
1005,
15454,
1423,
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_mvcc_txn_prewrite_check_not_exist() {
let engine = TestEngineBuilder::new().build().unwrap();
let (k1, v1, v2, v3) = (b"k1", b"v1", b"v2", b"v3");
must_prewrite_put(&engine, k1, v1, k1, 1);
must_commit(&engine, k1, 1, 2);
assert!(try_prewrite_check_not_exists(&engine, k1, k1, 3).is_err());
// Delete "k1"
must_prewrite_delete(&engine, k1, k1, 4);
must_commit(&engine, k1, 4, 5);
assert!(try_prewrite_check_not_exists(&engine, k1, k1, 6).is_ok());
assert!(try_prewrite_insert(&engine, k1, v2, k1, 7).is_ok());
must_commit(&engine, k1, 7, 8);
// Rollback
must_prewrite_put(&engine, k1, v3, k1, 9);
must_rollback(&engine, k1, 9);
assert!(try_prewrite_check_not_exists(&engine, k1, k1, 10).is_err());
// Delete "k1" again
must_prewrite_delete(&engine, k1, k1, 11);
must_commit(&engine, k1, 11, 12);
// Rollback again
must_prewrite_put(&engine, k1, v3, k1, 13);
must_rollback(&engine, k1, 13);
assert!(try_prewrite_check_not_exists(&engine, k1, k1, 14).is_ok());
} | rust_cleaned_test_functions.jsonl/16068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 633
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
638,
92299,
620,
52473,
7200,
7913,
35906,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
320,
74,
16,
11,
348,
16,
11,
348,
17,
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_fn_signature_with_docs_simple() {
let info = call_info(
r#"
/// test
// non-doc-comment
fn foo(j: u32) -> u32 {
j
}
fn bar() {
let _ = foo(<|>);
}
"#,
);
assert_eq!(info.parameters, vec!["j".to_string()]);
assert_eq!(info.active_parameter, Some(0));
assert_eq!(info.label, "fn foo(j: u32) -> u32".to_string());
assert_eq!(info.doc, Some("test".into()));
} | rust_cleaned_test_functions.jsonl/129607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
39859,
6615,
49692,
30015,
368,
341,
286,
1077,
3546,
284,
1618,
3109,
1006,
310,
435,
2,
698,
2575,
1273,
198,
322,
2477,
11527,
45666,
198,
8822,
15229,
3325,
25,
575,
18,
17,
8,
1464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_increment_existing_and_missing_version_different_shard() {
test_increment_existing_and_missing_version(|map, v1, v2| {
map.determine_map(&v1) != map.determine_map(&v2)
})
} | rust_cleaned_test_functions.jsonl/71846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51482,
62630,
8378,
40447,
9438,
82741,
3712,
567,
368,
341,
286,
1273,
51482,
62630,
8378,
40447,
9438,
22428,
2186,
11,
348,
16,
11,
348,
17,
91,
341,
310,
2415,
950,
24308,
5376,
2099,
85,
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 |
#[test]
fn test_lines_with_size_suffix() {
const FILE: &str = "test_lines_with_size_suffix.txt";
const EXPECTED_FILE: &str = "test_lines_with_size_suffix_expected.txt";
const LINES: usize = 3_000;
const N_ARG: usize = 2 * 1024;
let (at, mut ucmd) = at_and_ucmd!();
let mut big_input = at.make_file(FILE);
for i in 0..LINES {
writeln!(&mut big_input, "Line {}", i).expect("Could not write to FILE");
}
big_input.flush().expect("Could not flush FILE");
let mut big_expected = at.make_file(EXPECTED_FILE);
for i in (LINES - N_ARG)..LINES {
writeln!(&mut big_expected, "Line {}", i).expect("Could not write to EXPECTED_FILE");
}
big_expected.flush().expect("Could not flush EXPECTED_FILE");
ucmd.arg(FILE)
.arg("-n")
.arg("2K")
.run()
.stdout_is_fixture(EXPECTED_FILE);
} | rust_cleaned_test_functions.jsonl/39295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18323,
6615,
2368,
37151,
368,
341,
262,
733,
11837,
25,
609,
495,
284,
330,
1944,
18323,
6615,
2368,
37151,
3909,
876,
262,
733,
8921,
1479,
8087,
25,
609,
495,
284,
330,
1944,
18323,
6615,
236... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_accumulate_batched_transaction_costs() {
let signature_cost = 1;
let write_lock_cost = 2;
let data_bytes_cost = 3;
let builtins_execution_cost = 4;
let bpf_execution_cost = 10;
let num_txs = 4;
let tx_costs: Vec<_> = (0..num_txs)
.map(|_| TransactionCost {
signature_cost,
write_lock_cost,
data_bytes_cost,
builtins_execution_cost,
bpf_execution_cost,
..TransactionCost::default()
})
.collect();
let tx_results: Vec<_> = (0..num_txs)
.map(|n| {
if n % 2 == 0 {
Ok(())
} else {
Err(TransactionError::WouldExceedMaxBlockCostLimit)
}
})
.collect();
// should only accumulate half of the costs that are OK
let expected_signatures = signature_cost * (num_txs / 2);
let expected_write_locks = write_lock_cost * (num_txs / 2);
let expected_data_bytes = data_bytes_cost * (num_txs / 2);
let expected_builtins_execution_costs = builtins_execution_cost * (num_txs / 2);
let expected_bpf_execution_costs = bpf_execution_cost * (num_txs / 2);
let batched_transaction_details =
BankingStage::accumulate_batched_transaction_costs(tx_costs.iter(), tx_results.iter());
assert_eq!(
expected_signatures,
batched_transaction_details.costs.batched_signature_cost
);
assert_eq!(
expected_write_locks,
batched_transaction_details.costs.batched_write_lock_cost
);
assert_eq!(
expected_data_bytes,
batched_transaction_details.costs.batched_data_bytes_cost
);
assert_eq!(
expected_builtins_execution_costs,
batched_transaction_details
.costs
.batched_builtins_execute_cost
);
assert_eq!(
expected_bpf_execution_costs,
batched_transaction_details.costs.batched_bpf_execute_cost
);
} | rust_cleaned_test_functions.jsonl/15501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75837,
6334,
14534,
291,
28884,
85946,
368,
341,
286,
1077,
11957,
15890,
284,
220,
16,
280,
286,
1077,
3270,
9818,
15890,
284,
220,
17,
280,
286,
1077,
821,
12524,
15890,
284,
220,
18,
280,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_signing() {
test_with_wasm(
include_bytes!("./fixtures/signing/signing.wasm"),
hex!("ed4b9d1b"),
hex!("928b2036"),
);
} | rust_cleaned_test_functions.jsonl/122571 | {
"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,
11172,
287,
368,
341,
262,
1273,
6615,
1670,
10530,
1006,
286,
2924,
12524,
0,
13988,
45247,
35763,
287,
35763,
287,
1418,
10530,
4461,
286,
12371,
17223,
291,
19,
65,
24,
67,
16,
65,
4461,
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 |
#[test]
fn test_read_trips() {
let iter: GTFSIterator<_, Trip> =
GTFSIterator::from_path("./examples/good_feed/trips.txt").unwrap();
for result in iter {
assert!(result.is_ok(), format!("{}", result.err().unwrap()));
}
} | rust_cleaned_test_functions.jsonl/7503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
3547,
3077,
368,
341,
262,
1077,
5367,
25,
11911,
8485,
11951,
27,
6878,
26754,
29,
4035,
286,
11911,
8485,
11951,
486,
1499,
2638,
13988,
51668,
4846,
1386,
42390,
21485,
3077,
3909,
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... | 2 |
#[test]
fn test_decode() {
for decode_param in &["-d", "--decode"] {
let input = "JBSWY3DPFQQFO33SNRSCC===\n"; // spell-checker:disable-line
new_ucmd!()
.arg(decode_param)
.pipe_in(input)
.succeeds()
.stdout_only("Hello, World!");
}
} | rust_cleaned_test_functions.jsonl/23689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
368,
341,
262,
369,
16895,
4090,
304,
609,
1183,
12,
67,
497,
14482,
18196,
1341,
341,
286,
1077,
1946,
284,
330,
41,
7347,
54,
56,
18,
10298,
37,
48026,
3788,
18,
18,
18966,
49,
3540,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_list() {
let runc_id = format!("{}", Uuid::new_v4());
let runc_path = env::temp_dir().join(&runc_id).join("runc.amd64");
let runc_root =
PathBuf::from(env::var_os("XDG_RUNTIME_DIR").expect("expected temporary path"))
.join("rust-runc")
.join(&runc_id);
fs::create_dir_all(&runc_root).expect("unable to create runc root");
extract_tarball(
&PathBuf::from("test_fixture/runc_v1.0.0-rc10.tar.gz"),
&env::temp_dir().join(&runc_id),
)
.expect("unable to extract runc");
let mut config: RuncConfiguration = Default::default();
config.command = Some(runc_path.clone());
config.root = Some(runc_root.clone());
let runc = Runc::new(config).expect("Unable to create runc instance");
let task = async move {
let container = ManagedContainer::new(
&runc_path,
&runc_root,
&PathBuf::from("test_fixture/busybox.tar.gz"),
)
.await
.unwrap();
let containers = runc.list().await.unwrap();
if containers.len() != 1 {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
"expected a single container",
));
}
if let Some(container_item) = containers.get(0) {
if let Some(id) = container_item.id.clone() {
if id == container.id {
return Ok(runc);
}
}
}
Err(io::Error::new(
io::ErrorKind::InvalidData,
"expected container to match",
))
};
let mut runtime = Runtime::new().expect("unable to create runtime");
runtime.block_on(task).expect("test failed");
} | rust_cleaned_test_functions.jsonl/24468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1037
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
368,
341,
286,
1077,
435,
1347,
842,
284,
3561,
79878,
547,
2423,
486,
931,
2273,
19,
1423,
286,
1077,
435,
1347,
2638,
284,
6105,
486,
3888,
4334,
1005,
5987,
2099,
81,
1347,
842,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_error_messages() {
let start_addr1 = GuestAddress(0x0);
let start_addr2 = GuestAddress(0x1000);
let guest_mem = GuestMemory::new(&[(start_addr1, 0x1000), (start_addr2, 0x1000)]).unwrap();
let device_manager =
MMIODeviceManager::new(guest_mem, &mut 0xd000_0000, (arch::IRQ_BASE, arch::IRQ_MAX));
let mut cmdline = kernel_cmdline::Cmdline::new(4096);
let e = Error::Cmdline(
cmdline
.insert(
"virtio_mmio=device",
&format!(
"{}K@0x{:08x}:{}",
MMIO_LEN / 1024,
device_manager.mmio_base,
device_manager.irq
),
)
.unwrap_err(),
);
assert_eq!(
format!("{}", e),
format!(
"unable to add device to kernel command line: {}",
kernel_cmdline::Error::HasEquals
),
);
assert_eq!(
format!("{}", Error::UpdateFailed),
"failed to update the mmio device"
);
assert_eq!(
format!("{}", Error::BusError(devices::BusError::Overlap)),
format!(
"failed to perform bus operation: {}",
devices::BusError::Overlap
)
);
assert_eq!(
format!(
"{}",
Error::CreateMmioDevice(io::Error::from_raw_os_error(0))
),
format!(
"failed to create mmio device: {}",
io::Error::from_raw_os_error(0)
)
);
assert_eq!(
format!("{}", Error::IrqsExhausted),
"no more IRQs are available"
);
assert_eq!(
format!("{}", Error::RegisterIoEvent(errno::Error::new(0))),
format!("failed to register IO event: {}", errno::Error::new(0))
);
assert_eq!(
format!("{}", Error::RegisterIrqFd(errno::Error::new(0))),
format!("failed to register irqfd: {}", errno::Error::new(0))
);
} | rust_cleaned_test_functions.jsonl/102330 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
23428,
368,
341,
286,
1077,
1191,
7387,
16,
284,
26215,
4286,
7,
15,
87,
15,
317,
286,
1077,
1191,
7387,
17,
284,
26215,
4286,
7,
15,
87,
16,
15,
15,
15,
317,
286,
1077,
8640,
12976,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hunk_header_merge() {
let parsed = parse_hunk_header("@@@ -293,11 -358,15 +358,16 @@@ dependencies =");
let code_fragment = parsed.0;
let line_numbers_and_hunk_lengths = parsed.1;
assert_eq!(code_fragment, " dependencies =");
assert_eq!(line_numbers_and_hunk_lengths[0], (293, 11),);
assert_eq!(line_numbers_and_hunk_lengths[1], (358, 15),);
assert_eq!(line_numbers_and_hunk_lengths[2], (358, 16),);
} | rust_cleaned_test_functions.jsonl/108164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1523,
3122,
8757,
20888,
368,
341,
286,
1077,
15676,
284,
4715,
1523,
3122,
8757,
10662,
19191,
481,
17,
24,
18,
11,
16,
16,
481,
18,
20,
23,
11,
16,
20,
488,
18,
20,
23,
11,
16,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_short_int() {
assert_eq!(parse_short_int(&[0, 0][..]), Ok((EMPTY, 0)));
assert_eq!(parse_short_int(&[255, 255][..]), Ok((EMPTY, -1)));
} | rust_cleaned_test_functions.jsonl/25451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16673,
4042,
368,
341,
286,
2060,
10714,
10297,
6400,
16673,
4042,
2099,
58,
15,
11,
220,
15,
1457,
496,
9719,
7622,
1188,
32858,
11,
220,
15,
4945,
286,
2060,
10714,
10297,
6400,
16673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitfield_len() {
for len in 1..9 {
let bitfield = Bitfield { shift: 0, len };
for i in 0..(1 << len) {
let read = bitfield.read(i);
let calc = (i as f64 / ((1 << len) - 1) as f64 * 255f64).round() as u8;
if read != calc {
println!("len:{} i:{} read:{} calc:{}", len, i, read, calc);
}
assert_eq!(read, calc);
}
}
} | rust_cleaned_test_functions.jsonl/21165 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
2566,
6043,
368,
341,
286,
369,
2422,
304,
220,
16,
496,
24,
341,
310,
1077,
2699,
2566,
284,
6495,
2566,
314,
6407,
25,
220,
15,
11,
2422,
2605,
310,
369,
600,
304,
220,
15,
496,
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... | 4 |
#[test]
fn test_analyze_access_idexed_object_returned_from_function_call() {
let b = ast::BaseNode::default();
let pkg = ast::Package {
base: b.clone(),
path: "path".to_string(),
package: "main".to_string(),
files: vec![ast::File {
base: b.clone(),
name: "foo.flux".to_string(),
package: None,
imports: Vec::new(),
body: vec![ast::Statement::Expr(ast::ExprStmt {
base: b.clone(),
expression: ast::Expression::Index(Box::new(ast::IndexExpr {
base: b.clone(),
array: ast::Expression::Call(Box::new(ast::CallExpr {
base: b.clone(),
callee: ast::Expression::Identifier(ast::Identifier {
base: b.clone(),
name: "f".to_string(),
}),
arguments: vec![],
})),
index: ast::Expression::Integer(ast::IntegerLit {
base: b.clone(),
value: 3,
}),
})),
})],
}],
};
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Index(Box::new(IndexExpr {
loc: b.location.clone(),
typ: type_info(),
array: Expression::Call(Box::new(CallExpr {
loc: b.location.clone(),
typ: type_info(),
pipe: None,
callee: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "f".to_string(),
}),
arguments: Vec::new(),
})),
index: Expression::Integer(IntegerLit {
loc: b.location.clone(),
typ: type_info(),
value: 3,
}),
})),
})],
}],
};
let got = test_analyze(pkg).unwrap();
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/61571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1808
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12008,
55856,
12759,
842,
327,
291,
5314,
12511,
291,
5673,
9174,
13429,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
11763,
486,
13100,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simplify_dir_dots() {
let mut correct = HashSet::new();
correct.insert(PathBuf::from("src"));
assert_eq!(simplify_dir_names(vec!["src/."]), correct);
} | rust_cleaned_test_functions.jsonl/32366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
70206,
4334,
814,
2412,
368,
341,
286,
1077,
5206,
4396,
284,
18931,
486,
931,
543,
286,
4396,
7030,
33030,
15064,
486,
1499,
445,
3548,
4010,
286,
2060,
10714,
10297,
82,
70206,
4334,
9187,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sequence_number() {
let path = TempDir::new("_rust_rocksdb_sequence_number").expect("");
let mut opts = DBOptions::new();
opts.create_if_missing(true);
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
let snap = db.snapshot();
let snap_seq = snap.get_sequence_number();
let seq1 = db.get_latest_sequence_number();
assert_eq!(snap_seq, seq1);
db.put(b"key", b"value").unwrap();
let seq2 = db.get_latest_sequence_number();
assert!(seq2 > seq1);
} | rust_cleaned_test_functions.jsonl/99624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23735,
5500,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
16975,
35788,
26608,
14553,
1999,
23735,
5500,
1827,
17119,
56141,
286,
1077,
5206,
12185,
284,
5952,
3798,
486,
931,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_parquet_with_projection() {
let mut buf: Cursor<Vec<u8>> = Cursor::new(Vec::new());
let df = df!("a" => [1, 2, 3], "b" => [2, 3, 4], "c" => [3, 4, 5]).unwrap();
ParquetWriter::new(&mut buf)
.finish(&df)
.expect("parquet writer");
buf.set_position(0);
let expected = df!("b" => [2, 3, 4], "c" => [3, 4, 5]).unwrap();
let df_read = ParquetReader::new(buf)
.with_projection(Some(vec![1, 2]))
.finish()
.unwrap();
assert_eq!(df_read.shape(), (3, 2));
df_read.frame_equal(&expected);
} | rust_cleaned_test_functions.jsonl/111169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
22654,
23300,
6615,
72738,
368,
341,
286,
1077,
5206,
6607,
25,
28067,
50439,
34837,
23,
2452,
284,
28067,
486,
931,
49923,
486,
931,
1423,
286,
1077,
6764,
284,
6764,
17223,
64,
1,
589,
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_keypair_to_curve25519() {
let (pk, sk) = gen_keypair();
let curve25519_pk = pk.to_curve25519();
let curve25519_sk = sk.to_curve25519();
assert_ne!(
curve25519::scalarmult(&curve25519_sk, &curve25519_pk),
Err(())
);
} | rust_cleaned_test_functions.jsonl/11391 | {
"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,
3097,
12670,
2346,
43407,
17,
20,
20,
16,
24,
368,
341,
286,
1077,
320,
20819,
11,
1901,
8,
284,
4081,
3097,
12670,
543,
286,
1077,
15655,
17,
20,
20,
16,
24,
33321,
284,
22458,
2389,
43407,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_r() {
let mut r1 = [0u8; 32];
let mut r2 = [0u8; 32];
// Verify different r values are generated
librustzcash_sapling_generate_r(&mut r1);
librustzcash_sapling_generate_r(&mut r2);
assert_ne!(r1, r2);
// Verify r values are valid in the field
let mut repr = FsRepr::default();
repr.read_le(&r1[..]).expect("length is not 32 bytes");
let _ = Fs::from_repr(repr).unwrap();
repr.read_le(&r2[..]).expect("length is not 32 bytes");
let _ = Fs::from_repr(repr).unwrap();
} | rust_cleaned_test_functions.jsonl/26244 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
1710,
368,
341,
262,
1077,
5206,
435,
16,
284,
508,
15,
84,
23,
26,
220,
18,
17,
935,
262,
1077,
5206,
435,
17,
284,
508,
15,
84,
23,
26,
220,
18,
17,
4821,
262,
442,
25429,
2155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_invite() {
let route = Route::DeleteInvite { code: CODE };
assert_eq!(route.to_string(), format!("invites/{code}", code = CODE));
} | rust_cleaned_test_functions.jsonl/119900 | {
"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,
11353,
94910,
368,
341,
286,
1077,
6021,
284,
9572,
486,
6435,
93540,
314,
2038,
25,
13765,
2605,
286,
2060,
10714,
10297,
8966,
2389,
3904,
1507,
3561,
17223,
14057,
3611,
9388,
1851,
9545,
2038,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_missing_primary_node() {
let mut bytecode: Vec<u8> = BIND_HEADER.to_vec();
append_section_header(&mut bytecode, SYMB_MAGIC_NUM, 29);
let device_name: [u8; 5] = [0x4C, 0x4F, 0x4F, 0x4E, 0]; // "LOON"
bytecode.extend_from_slice(&[1, 0, 0, 0]);
bytecode.extend_from_slice(&device_name);
let primary_node_name: [u8; 6] = [0x47, 0x52, 0x45, 0x42, 0x45, 0]; // "GREBE"
bytecode.extend_from_slice(&[2, 0, 0, 0]);
bytecode.extend_from_slice(&primary_node_name);
let additional_node_name: [u8; 6] = [0x53, 0x43, 0x41, 0x55, 0x50, 0]; // "SCAUP"
bytecode.extend_from_slice(&[3, 0, 0, 0]);
bytecode.extend_from_slice(&additional_node_name);
let additional_node_inst_1 = [0x02, 0x01, 0, 0, 0, 0x02, 0x02, 0, 0, 0x10];
let additional_node_inst_2 = [0x30];
let composite_insts_sz = COMPOSITE_NAME_ID_BYTES
+ ((NODE_TYPE_HEADER_SZ * 2)
+ additional_node_inst_1.len()
+ additional_node_inst_2.len()) as u32;
append_section_header(&mut bytecode, COMPOSITE_MAGIC_NUM, composite_insts_sz);
// Add device name ID.
bytecode.extend_from_slice(&[1, 0, 0, 0]);
// Add the node instructions.
append_node_header(
&mut bytecode,
RawNodeType::Additional,
2,
additional_node_inst_1.len() as u32,
);
bytecode.extend_from_slice(&additional_node_inst_1);
append_node_header(
&mut bytecode,
RawNodeType::Additional,
3,
additional_node_inst_2.len() as u32,
);
bytecode.extend_from_slice(&additional_node_inst_2);
assert_eq!(Err(BytecodeError::InvalidPrimaryNode), DecodedRules::new(bytecode));
} | rust_cleaned_test_functions.jsonl/24045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 940
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
45314,
5084,
368,
341,
286,
1077,
5206,
75129,
25,
11312,
34837,
23,
29,
284,
91370,
20330,
2389,
13251,
543,
286,
8737,
16221,
8757,
2099,
6984,
75129,
11,
16079,
8412,
49194,
9631,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lexicographic_permutations() {
let v : &mut[_] = &mut[1, 2, 3, 4, 5];
assert!(v.prev_permutation() == false);
assert!(v.next_permutation());
let b: &mut[_] = &mut[1, 2, 3, 5, 4];
assert!(v == b);
assert!(v.prev_permutation());
let b: &mut[_] = &mut[1, 2, 3, 4, 5];
assert!(v == b);
assert!(v.next_permutation());
assert!(v.next_permutation());
let b: &mut[_] = &mut[1, 2, 4, 3, 5];
assert!(v == b);
assert!(v.next_permutation());
let b: &mut[_] = &mut[1, 2, 4, 5, 3];
assert!(v == b);
let v : &mut[_] = &mut[1, 0, 0, 0];
assert!(v.next_permutation() == false);
assert!(v.prev_permutation());
let b: &mut[_] = &mut[0, 1, 0, 0];
assert!(v == b);
assert!(v.prev_permutation());
let b: &mut[_] = &mut[0, 0, 1, 0];
assert!(v == b);
assert!(v.prev_permutation());
let b: &mut[_] = &mut[0, 0, 0, 1];
assert!(v == b);
assert!(v.prev_permutation() == false);
} | rust_cleaned_test_functions.jsonl/111399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74547,
292,
12679,
31961,
82141,
368,
341,
286,
1077,
348,
549,
609,
6984,
13496,
60,
284,
609,
6984,
58,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
2060,
10297,
85,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_velocity() {
let times = vec![0.0, 1.0, 3.0, 4.0];
let points = vec![
vec![0.0, -1.0],
vec![2.0, -3.0],
vec![3.0, 3.0],
vec![1.0, 5.0],
];
let ip = CubicSpline::new(times, points).unwrap();
for i in 0..400 {
let t = i as f64 * 0.01f64;
let p = ip.velocity(t).unwrap();
println!("{t} {} {}", p[0], p[1]);
}
} | rust_cleaned_test_functions.jsonl/69109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39666,
368,
341,
286,
1077,
3039,
284,
7486,
20703,
15,
13,
15,
11,
220,
16,
13,
15,
11,
220,
18,
13,
15,
11,
220,
19,
13,
15,
935,
286,
1077,
3501,
284,
7486,
90515,
310,
7486,
20703,
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_lp_matrix_supremum() {
let m = matrix![0.0, -2.0;
3.5, 1.0];
let sup = MatrixNorm::norm(&Lp::Infinity, &m);
assert_eq!(sup, 3.5);
} | rust_cleaned_test_functions.jsonl/6902 | {
"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,
76529,
10193,
23723,
1826,
372,
368,
341,
286,
1077,
296,
284,
6172,
20703,
15,
13,
15,
11,
481,
17,
13,
15,
280,
664,
220,
18,
13,
20,
11,
220,
16,
13,
15,
4821,
286,
1077,
1026,
284,
116... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_test_file() {
let mut file = File::open("tests/js/test.js").unwrap();
let mut s = String::new();
file.read_to_string(&mut s).unwrap();
js_parser_rs::parse(OwningChars::new(s)).unwrap();
} | rust_cleaned_test_functions.jsonl/61528 | {
"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,
21039,
4452,
2458,
368,
341,
262,
1077,
5206,
1034,
284,
2887,
486,
2508,
445,
23841,
9113,
12697,
2857,
1827,
15454,
543,
262,
1077,
5206,
274,
284,
923,
486,
931,
543,
262,
1034,
4125,
2346,
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_simple_url() {
let url = "user/repo";
let config = config::get_config();
let expected_val = Repo {
url: RepoUrl::Short(ShortHandUrl {
is_https: config.get_is_https(),
domain: config.get_domain().clone(),
path: "user/repo".to_string(),
}),
};
assert_eq!(Repo::parse(url), expected_val);
} | rust_cleaned_test_functions.jsonl/31158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
2903,
368,
341,
286,
1077,
2515,
284,
330,
872,
10758,
5368,
876,
286,
1077,
2193,
284,
2193,
486,
455,
5332,
543,
286,
1077,
3601,
6189,
284,
71509,
341,
310,
2515,
25,
71509,
2864,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_dedup_op() {
let prop_id = -10;
let route = Arc::new(build_test_route());
let input_shuffle = StreamShuffleKeyType::exchange(
route,
prop_id);
let dedup_base = OperatorBase::new();
let mut dedup_op = DedupOperator::new(0, 0, input_shuffle, &dedup_base, prop_id);
let mut m1 = RawMessage::new(RawMessageType::VERTEX);
m1.add_label_entity(RawMessage::from_value(ValuePayload::Long(1)), prop_id);
let mut m2 = RawMessage::new(RawMessageType::VERTEX);
m2.add_label_entity(RawMessage::from_value(ValuePayload::Long(2)), prop_id);
let mut m3 = RawMessage::new(RawMessageType::VERTEX);
m3.add_label_entity(RawMessage::from_value(ValuePayload::Long(1)), prop_id);
let mut m4 = RawMessage::new(RawMessageType::VERTEX);
m4.add_label_entity(RawMessage::from_value(ValuePayload::Long(1)), prop_id);
let mut m5 = RawMessage::new(RawMessageType::VERTEX);
m5.add_label_entity(RawMessage::from_value(ValuePayload::Long(2)), prop_id);
let mut m6 = RawMessage::new(RawMessageType::VERTEX);
m6.add_label_entity(RawMessage::from_value(ValuePayload::Long(6)), prop_id);
let mut data1 = vec![];
{
let mut collector1: Box<MessageCollector> = Box::new(MessageLocalCollector::new(&mut data1));
dedup_op.execute(vec![m1], &mut collector1);
}
assert_eq!(true, data1.into_iter().next().is_some());
let mut data2 = vec![];
{
let mut collector2: Box<MessageCollector> = Box::new(MessageLocalCollector::new(&mut data2));
dedup_op.execute(vec![m2], &mut collector2);
}
assert_eq!(true, data2.into_iter().next().is_some());
let mut data3 = vec![];
{
let mut collector3: Box<MessageCollector> = Box::new(MessageLocalCollector::new(&mut data3));
dedup_op.execute(vec![m3], &mut collector3);
}
assert_eq!(true, data3.into_iter().next().is_none());
let mut data4 = vec![];
{
let mut collector4: Box<MessageCollector> = Box::new(MessageLocalCollector::new(&mut data4));
dedup_op.execute(vec![m4], &mut collector4);
}
assert_eq!(true, data4.into_iter().next().is_none());
let mut data5 = vec![];
{
let mut collector5: Box<MessageCollector> = Box::new(MessageLocalCollector::new(&mut data5));
dedup_op.execute(vec![m5], &mut collector5);
}
assert_eq!(true, data5.into_iter().next().is_none());
let mut data6 = vec![];
{
let mut collector6: Box<MessageCollector> = Box::new(MessageLocalCollector::new(&mut data6));
dedup_op.execute(vec![m6], &mut collector6);
}
assert_eq!(true, data6.into_iter().next().is_some());
} | rust_cleaned_test_functions.jsonl/43859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
814,
291,
454,
10287,
368,
341,
286,
1077,
2004,
842,
284,
481,
16,
15,
280,
286,
1077,
6021,
284,
19689,
486,
931,
43333,
4452,
28109,
1423,
286,
1077,
1946,
73484,
284,
9203,
2016,
13208... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_magnitude() {
for (pair, sol) in SAMPLE_MAGNITUDE_DATA
.iter()
.map(|s| s.as_bytes())
.map(|b| Pair::from(b))
.zip(SAMPLE_MAGNITUDE_SOLUTIONS.iter())
{
assert_eq!(pair.eval(), *sol, "{:?} => {}", &pair, sol);
}
} | rust_cleaned_test_functions.jsonl/31388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
34715,
368,
341,
286,
369,
320,
12670,
11,
2048,
8,
304,
62420,
55231,
45,
57999,
7896,
198,
310,
659,
2015,
741,
310,
659,
2186,
22428,
82,
91,
274,
5357,
12524,
2398,
310,
659,
2186,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_current_context_handle() {
let h = Arc::new(AtomicUsize::new(0));
let h2 = Arc::clone(&h);
let m = Arc::new(AtomicUsize::new(0));
let m2 = Arc::clone(&m);
} | rust_cleaned_test_functions.jsonl/35712 | {
"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,
11080,
8467,
10630,
368,
341,
262,
1077,
305,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
1106,
262,
1077,
305,
17,
284,
19689,
486,
19982,
2099,
71,
317,
262,
1077,
296,
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_eval_set_loc_backwards() {
let cie = make_test_cie();
let mut ctx = UnwindContext::new();
ctx.row_mut().start_address = 999;
let expected = ctx.clone();
let instructions = [(
Err(Error::InvalidAddressRange),
CallFrameInstruction::SetLoc { address: 42 },
)];
assert_eval(ctx, expected, cie, None, instructions);
} | rust_cleaned_test_functions.jsonl/9344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
2602,
13400,
3895,
4014,
368,
341,
286,
1077,
272,
645,
284,
1281,
4452,
666,
645,
543,
286,
1077,
5206,
5635,
284,
1230,
19154,
1972,
486,
931,
543,
286,
5635,
11547,
29523,
1005,
2468,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_choice_f64() {
let capacity: usize = 500;
let mut samples: Vec<usize> = Vec::with_capacity(capacity);
let mut weights: Vec<f64> = Vec::with_capacity(capacity);
for i in 0..capacity {
samples.push(i);
weights.push(i as f64);
}
let number_choices = 10000;
let choices = random_choice().random_choice_f64(&samples, &weights, number_choices);
assert!(choices.len() == number_choices);
let mut weight_counter = BTreeMap::new();
for choice in choices {
let counter = weight_counter.entry(choice).or_insert(0);
*counter += 1;
}
let mut last_value: usize = 0;
for (_, value) in &weight_counter {
assert!((last_value as i32 - (*value) as i32).abs() <= 2);
last_value = *value;
}
} | rust_cleaned_test_functions.jsonl/107010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
31936,
761,
21,
19,
368,
341,
286,
1077,
8654,
25,
22301,
284,
220,
20,
15,
15,
280,
286,
1077,
5206,
10469,
25,
11312,
90244,
29,
284,
11312,
486,
4197,
35603,
51386,
4018,
317,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_query_alternative_predicate_prefix() {
allocations::record(|| {
let language = get_language("c");
let query = Query::new(
language,
r#"
((call_expression
function: (identifier) @keyword
arguments: (argument_list
(string_literal) @function))
(.eq? @keyword "DEFUN"))
"#,
)
.unwrap();
let source = r#"
DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
doc: /* Return the argument unchanged. */
attributes: const)
(Lisp_Object arg)
{
return arg;
}
"#;
assert_query_matches(
language,
&query,
source,
&[(0, vec![("keyword", "DEFUN"), ("function", "\"identity\"")])],
);
});
} | rust_cleaned_test_functions.jsonl/25201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 529
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
79728,
1388,
97474,
13974,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
66,
797,
286,
1077,
3239,
284,
11361,
486,
931,
1006,
310,
4128,
345,
310,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_next() {
let mut bb = BollingerBands::new(3, 2.0_f64).unwrap();
let a = bb.nexta(2.0);
let b = bb.nexta(5.0);
let c = bb.nexta(1.0);
let d = bb.nexta(6.25);
assert_eq!(round(a.average), 2.0);
assert_eq!(round(b.average), 3.5);
assert_eq!(round(c.average), 2.667);
assert_eq!(round(d.average), 4.083);
assert_eq!(round(a.upper), 2.0);
assert_eq!(round(b.upper), 6.5);
assert_eq!(round(c.upper), 6.066);
assert_eq!(round(d.upper), 8.562);
assert_eq!(round(a.lower), 2.0);
assert_eq!(round(b.lower), 0.5);
assert_eq!(round(c.lower), -0.733);
assert_eq!(round(d.lower), -0.395);
} | rust_cleaned_test_functions.jsonl/99259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
368,
341,
286,
1077,
5206,
16520,
284,
425,
965,
5137,
33,
2844,
486,
931,
7,
18,
11,
220,
17,
13,
15,
761,
21,
19,
568,
15454,
1428,
286,
1077,
264,
284,
16520,
4529,
64,
7,
17,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mod_int_unsigned() {
let tests = vec![
(
Some(std::u64::MAX as i64),
true,
Some(std::i64::MIN),
false,
Some(std::i64::MAX),
),
(
Some(std::i64::MIN),
false,
Some(std::u64::MAX as i64),
true,
Some(std::i64::MIN),
),
];
for (lhs, lhs_is_unsigned, rhs, rhs_is_unsigned, expected) in tests {
let lhs_field_type = FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.flag(if lhs_is_unsigned {
FieldTypeFlag::UNSIGNED
} else {
FieldTypeFlag::empty()
})
.build();
let rhs_field_type = FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.flag(if rhs_is_unsigned {
FieldTypeFlag::UNSIGNED
} else {
FieldTypeFlag::empty()
})
.build();
let output = RpnFnScalarEvaluator::new()
.push_param_with_field_type(lhs, lhs_field_type)
.push_param_with_field_type(rhs, rhs_field_type)
.evaluate(ScalarFuncSig::ModInt)
.unwrap();
assert_eq!(output, expected, "lhs={:?}, rhs={:?}", lhs, rhs);
}
} | rust_cleaned_test_functions.jsonl/5287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 943
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
4042,
67830,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
2399,
394,
4329,
5194,
486,
84,
21,
19,
486,
10586,
438,
600,
21,
19,
1326,
394,
830,
345,
394,
4329,
5194,
486,
72,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_binary_search_by() {
let deque: VecDeque<_> = vec![(1,), (2,), (3,), (5,), (6,)].into();
assert_eq!(deque.binary_search_by(|&(v,)| v.cmp(&3)), Ok(2));
assert_eq!(deque.binary_search_by(|&(v,)| v.cmp(&4)), Err(3));
} | rust_cleaned_test_functions.jsonl/124942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
10716,
3710,
368,
341,
262,
1077,
41950,
25,
11312,
73891,
32399,
29,
284,
7486,
0,
9697,
16,
59564,
320,
17,
59564,
320,
18,
59564,
320,
20,
59564,
320,
21,
11,
26169,
18122,
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... | 1 |
#[test]
fn test_ssl_options_nonexistent_file() {
assert!(SslOptions::new(
Some(PathBuf::from("/tmp/aaaaa.aa")),
Some("password".to_string()),
Some(PathBuf::from("/tmp/aaaaa.aa")),
Some(PathBuf::from("/tmp/aaaaa.aa")),
Some(PathBuf::from("/tmp/aaaaa.aa")),
false
).is_err());
} | rust_cleaned_test_functions.jsonl/22222 | {
"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,
48210,
8743,
21637,
64085,
2458,
368,
341,
262,
2060,
10297,
50,
3226,
3798,
486,
931,
1006,
286,
4329,
33030,
15064,
486,
1499,
4283,
5173,
14,
28458,
64,
13,
5305,
30154,
286,
4329,
445,
3833,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ceil() {
assert_eq!(d("100.11").ceil(), d("101.00"));
assert_eq!(d("99.0").ceil(), d("99.0"));
assert_eq!(d("-40.1").ceil(), d("-40.0"));
} | rust_cleaned_test_functions.jsonl/1000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
22058,
368,
341,
286,
2060,
10714,
10297,
67,
445,
16,
15,
15,
13,
16,
16,
1827,
22058,
1507,
294,
445,
16,
15,
16,
13,
15,
15,
4010,
286,
2060,
10714,
10297,
67,
445,
24,
24,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ignore_parse_dates() -> Result<()> {
let csv = r#"a,b,c
1,i,16200126
2,j,16250130
3,k,17220012
4,l,17290009"#;
use DataType::*;
let file = Cursor::new(csv);
let df = CsvReader::new(file)
.with_parse_dates(true)
.with_dtypes_slice(Some(&[Utf8, Utf8, Utf8]))
.finish()?;
assert_eq!(df.dtypes(), &[Utf8, Utf8, Utf8]);
Ok(())
} | rust_cleaned_test_functions.jsonl/57586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
21039,
46382,
368,
1464,
5714,
71698,
341,
1789,
286,
1077,
13147,
284,
435,
55543,
64,
8402,
10109,
198,
16,
11286,
11,
16,
21,
17,
15,
15,
16,
17,
21,
198,
17,
10327,
11,
16,
21,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_arguments_default_outputdir() {
let args = stringvec!["-c", "/tmp/foo.c"];
let ParsedArguments { outputs, .. } = match parse_arguments_(args, false) {
CompilerArguments::Ok(args) => args,
o => panic!("Got unexpected parse result: {:?}", o),
};
assert_map_contains!(outputs, ("obj", PathBuf::from("foo.o")));
} | rust_cleaned_test_functions.jsonl/17740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
43433,
9993,
7645,
3741,
368,
341,
286,
1077,
2827,
284,
914,
4083,
0,
1183,
12,
66,
497,
3521,
5173,
60555,
520,
6332,
286,
1077,
393,
18112,
19139,
314,
16275,
11,
5241,
335,
284,
2432,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_increment() {
let mut test_machine = Machine::new(false);
&test_machine.increment(1);
assert_eq!(test_machine.tape[test_machine.index], 1);
} | rust_cleaned_test_functions.jsonl/88369 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51482,
368,
341,
262,
1077,
5206,
1273,
38695,
284,
12960,
486,
931,
3576,
317,
262,
609,
1944,
38695,
56936,
7,
16,
317,
262,
2060,
10714,
10297,
1944,
38695,
734,
2027,
72626,
38695,
5154,
1125,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_build_upload_policy_with_lifetime_overflow() -> Result<(), Box<dyn Error>> {
let future = Duration::from_secs(u64::max_value());
let policy = UploadPolicyBuilder::new_policy_for_bucket("test_bucket", &Config::default())
.token_lifetime(future)
.build();
assert!(
policy
.token_deadline()
.unwrap()
.duration_since(SystemTime::UNIX_EPOCH)?
> SystemTime::now()
.checked_add(Duration::from_secs(50 * 365 * 24 * 60 * 60))
.unwrap()
.duration_since(SystemTime::UNIX_EPOCH)?
);
Ok(())
} | rust_cleaned_test_functions.jsonl/2349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
21691,
22773,
6615,
98827,
79073,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
3853,
284,
21045,
486,
1499,
68718,
8154,
21,
19,
486,
2810,
3142,
1423,
286,
1077,
4842,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dynamic_array_push() {
let data = vec![0x82, 0x01, 0x02];
let mut parsed: ParsedArray<super::ParsedArraySizeDynamic> =
ParsedArray::deserialize_data(&data).expect("Failed to parse");
assert_eq!(parsed.len(), 2);
assert_eq!(parsed.get::<u8>(0).unwrap(), 1);
assert_eq!(parsed.get::<u8>(1).unwrap(), 2);
let serialized = parsed.serialize_data().expect("Failed to serialize");
assert_eq!(serialized, data);
parsed.push(&3).expect("Failed to push");
assert_eq!(parsed.len(), 3);
assert_eq!(parsed.get::<u8>(0).unwrap(), 1);
assert_eq!(parsed.get::<u8>(1).unwrap(), 2);
assert_eq!(parsed.get::<u8>(2).unwrap(), 3);
let serialized = parsed.serialize_data().expect("Failed to serialize");
assert_eq!(serialized, vec![0x83, 0x01, 0x02, 0x03]);
} | rust_cleaned_test_functions.jsonl/10818 | {
"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,
45992,
3858,
14218,
368,
341,
286,
1077,
821,
284,
7486,
20703,
15,
87,
23,
17,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
935,
286,
1077,
5206,
15676,
25,
393,
18112,
1857,
27,
952... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_report_peers() {
let mut report_stats = HashMap::default();
for i in 1..5 {
let mut stat = pdpb::PeerStat::default();
stat.set_region_id(i);
stat.set_read_keys(i);
stat.set_read_bytes(6 - i);
stat.read_keys = i;
stat.read_bytes = 6 - i;
let mut query_stat = QueryStats::default();
if i == 3 {
query_stat.add_query_num(QueryKind::Get, 6);
} else {
query_stat.add_query_num(QueryKind::Get, 0);
}
stat.set_query_stats(query_stat.0);
report_stats.insert(i, stat);
}
let mut store_stats = pdpb::StoreStats::default();
store_stats = collect_report_read_peer_stats(1, report_stats, store_stats);
assert_eq!(store_stats.peer_stats.len(), 3)
} | rust_cleaned_test_functions.jsonl/3879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
14813,
36367,
388,
368,
341,
286,
1077,
5206,
1895,
15381,
284,
10528,
486,
2258,
543,
286,
369,
600,
304,
220,
16,
496,
20,
341,
310,
1077,
5206,
2793,
284,
7744,
16650,
486,
30888,
1587... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_begin_application_on_empty_storage_with_first_blocks() {
init_test_runtime();
// init empty context for test
let (chain_id, genesis_block_header, ..) = init_test_protocol_context(
"test_begin_application_on_empty_storage_with_first_block",
test_data_protocol_v1::tezos_network(),
);
// begin application for first block - level 1
let result = client::begin_application(BeginApplicationRequest {
chain_id: chain_id.clone(),
pred_header: genesis_block_header.clone(),
block_header: BlockHeader::from_bytes(
hex::decode(test_data_protocol_v1::BLOCK_HEADER_LEVEL_1).unwrap(),
)
.unwrap(),
});
assert!(result.is_ok());
let result = client::begin_application(BeginApplicationRequest {
chain_id: chain_id.clone(),
pred_header: genesis_block_header.clone(),
block_header: BlockHeader::from_bytes(
hex::decode(test_data_protocol_v1::BLOCK_HEADER_LEVEL_2).unwrap(),
)
.unwrap(),
});
assert!(result.is_err());
// apply second block - level 1 ok
let apply_block_result = client::apply_block(ApplyBlockRequest {
chain_id: chain_id.clone(),
block_header: BlockHeader::from_bytes(
hex::decode(test_data_protocol_v1::BLOCK_HEADER_LEVEL_1).unwrap(),
)
.unwrap(),
pred_header: genesis_block_header,
operations: ApplyBlockRequest::convert_operations(
test_data_protocol_v1::block_operations_from_hex(
test_data_protocol_v1::BLOCK_HEADER_HASH_LEVEL_1,
test_data_protocol_v1::block_header_level1_operations(),
),
),
max_operations_ttl: 0,
predecessor_block_metadata_hash: None,
predecessor_ops_metadata_hash: None,
});
assert!(apply_block_result.is_ok());
// Ensure that we got the expected constants from the protocol change
let apply_block_result = apply_block_result.unwrap();
assert!(apply_block_result.new_protocol_constants_json.is_some());
let expected_new_constants = serde_json::from_str::<serde_json::Value>(
r#"{
"proof_of_work_nonce_size": 8, "nonce_length": 32,
"max_anon_ops_per_block": 132, "max_operation_data_length": 16384,
"max_proposals_per_delegate": 20, "preserved_cycles": 3,
"blocks_per_cycle": 2048, "blocks_per_commitment": 16,
"blocks_per_roll_snapshot": 128, "blocks_per_voting_period": 2048,
"time_between_blocks": [ "30", "20" ], "endorsers_per_block": 32,
"hard_gas_limit_per_operation": "1040000",
"hard_gas_limit_per_block": "10400000",
"proof_of_work_threshold": "70368744177663",
"tokens_per_roll": "8000000000", "michelson_maximum_type_size": 1000,
"seed_nonce_revelation_tip": "125000", "origination_size": 257,
"block_security_deposit": "512000000",
"endorsement_security_deposit": "64000000",
"baking_reward_per_endorsement": [ "1250000", "187500" ],
"endorsement_reward": [ "1250000", "833333" ], "cost_per_byte": "250",
"hard_storage_limit_per_operation": "60000",
"test_chain_duration": "61440", "quorum_min": 2000, "quorum_max": 7000,
"min_proposal_quorum": 500, "initial_endorsers": 24,
"delay_per_missing_endorsement": "4"
}"#,
)
.unwrap();
let obtained_new_constants = serde_json::from_str::<serde_json::Value>(
&apply_block_result.new_protocol_constants_json.unwrap(),
)
.unwrap();
assert_eq!(expected_new_constants, obtained_new_constants);
// begin application for second block - level 2 - now it should work on first level
let result = client::begin_application(BeginApplicationRequest {
chain_id: chain_id,
pred_header: BlockHeader::from_bytes(
hex::decode(test_data_protocol_v1::BLOCK_HEADER_LEVEL_1).unwrap(),
)
.unwrap(),
block_header: BlockHeader::from_bytes(
hex::decode(test_data_protocol_v1::BLOCK_HEADER_LEVEL_2).unwrap(),
)
.unwrap(),
});
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/8663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1913
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23338,
38721,
4470,
15124,
23310,
6615,
12978,
25201,
368,
341,
262,
2930,
4452,
33232,
1428,
262,
442,
2930,
4287,
2266,
369,
1273,
198,
262,
1077,
320,
8819,
842,
11,
59366,
7113,
8757,
11,
5241... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_88() {
let mut vec1 = vec![1,2,3,0,0,0];
let mut vec2 = vec![2,5,6];
Solution::merge(&mut vec1, 3, &mut vec2, 3);
assert_eq!(
vec1,
vec![1,2,2,3,5,6]
);
let mut vec1 = vec![1,2,3];
let mut vec2 = vec![];
Solution::merge(&mut vec1, 3, &mut vec2, 0);
assert_eq!(
vec1,
vec![1,2,3]
);
let mut vec1 = vec![0,0,0];
let mut vec2 = vec![1,2,3];
Solution::merge(&mut vec1, 0, &mut vec2, 3);
assert_eq!(
vec1,
vec![1,2,3]
);
} | rust_cleaned_test_functions.jsonl/119351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
23,
23,
368,
341,
286,
1077,
5206,
7486,
16,
284,
7486,
20703,
16,
11,
17,
11,
18,
11,
15,
11,
15,
11,
15,
935,
286,
1077,
5206,
7486,
17,
284,
7486,
20703,
17,
11,
20,
11,
21,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_engine_file() {
let temp_dir = TempDir::new("test_engine_file").unwrap();
let uuid = Uuid::new_v4();
let opts = DbConfig::default();
let path = EnginePath {
save: temp_dir.path().join("save"),
temp: temp_dir.path().join("temp"),
};
// Test close.
{
let mut f = EngineFile::new(uuid, path.clone(), opts.clone()).unwrap();
// Cannot create the same file again.
assert!(EngineFile::new(uuid, path.clone(), opts.clone()).is_err());
assert!(path.temp.exists());
assert!(!path.save.exists());
f.close().unwrap();
assert!(!path.temp.exists());
assert!(path.save.exists());
fs::remove_dir_all(&path.save).unwrap();
}
// Test cleanup.
{
let f = EngineFile::new(uuid, path.clone(), opts.clone()).unwrap();
assert!(path.temp.exists());
assert!(!path.save.exists());
drop(f);
assert!(!path.temp.exists());
assert!(!path.save.exists());
}
} | rust_cleaned_test_functions.jsonl/25414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24823,
2458,
368,
341,
286,
1077,
2730,
4334,
284,
19944,
6184,
486,
931,
445,
1944,
24823,
2458,
1827,
15454,
1428,
286,
1077,
16040,
284,
547,
2423,
486,
931,
2273,
19,
543,
286,
1077,
12185,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_const_split() {
let input = vec![
vec!["123456789".to_string()],
vec!["987654321".to_string()],
vec!["312389123".to_string()],
];
let result = vec![
Some("123-456-789".to_string()),
Some("987-654-321".to_string()),
None,
];
let result = run(input, result);
dbg!(&result);
assert_eq!(result[2], "312-389-123".to_string());
} | rust_cleaned_test_functions.jsonl/92580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13610,
17052,
368,
341,
220,
1077,
1946,
284,
7486,
90515,
262,
7486,
0,
1183,
16,
17,
18,
19,
20,
21,
22,
23,
24,
3263,
983,
3904,
73845,
262,
7486,
0,
1183,
24,
23,
22,
21,
20,
19,
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_simple_with_version() {
test_expect(
"tests/support/simple_with_version.json",
r#"{
"tool": "jsonatr",
"version": "0.1",
"stable": false,
"features": [
"read",
"write"
]
}"#,
);
} | rust_cleaned_test_functions.jsonl/36975 | {
"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,
30015,
6615,
9438,
368,
341,
262,
1273,
68918,
1006,
286,
330,
23841,
60370,
67195,
6615,
9438,
4323,
756,
286,
435,
55543,
515,
220,
330,
14172,
788,
330,
2236,
60978,
756,
220,
330,
4366,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_treasury_transaction_payload_bson() {
let payload = get_test_treasury_transaction_payload();
let bson = to_bson(&payload).unwrap();
assert_eq!(payload, from_bson::<TreasuryTransactionPayload>(bson).unwrap());
} | rust_cleaned_test_functions.jsonl/112251 | {
"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,
528,
265,
26102,
28884,
32813,
880,
930,
368,
341,
286,
1077,
7729,
284,
633,
4452,
528,
265,
26102,
28884,
32813,
543,
286,
1077,
50980,
284,
311,
880,
930,
2099,
19427,
568,
15454,
543,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_authorize_url_with_scopes() {
let scopes = vec![
Scope::new("read".to_string()),
Scope::new("write".to_string()),
];
let (url, _) = new_client()
.authorize_url(|| CsrfToken::new("csrf_token".to_string()))
.add_scopes(scopes)
.url();
assert_eq!(
Url::parse(
"https://example.com/auth\
?response_type=code\
&client_id=aaa\
&state=csrf_token\
&scope=read+write"
)
.unwrap(),
url
);
} | rust_cleaned_test_functions.jsonl/18586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
2903,
6615,
13171,
18523,
368,
341,
262,
1077,
50598,
284,
7486,
90515,
286,
34920,
486,
931,
445,
878,
3263,
983,
3904,
14702,
286,
34920,
486,
931,
445,
4934,
3263,
983,
3904,
14702,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_superblock_data() {
let name = "test_name".as_bytes();
let data = vec![1, 2, 3, 4, 5];
let entry = DirectoryEntry { name: name.to_owned(), data: data.clone() };
let metadata_size = entry.metadata_size();
let metadata_blocks = num_blocks(metadata_size);
let factoryfs = FactoryFS {
major_version: FACTORYFS_MAJOR_VERSION,
minor_version: FACTORYFS_MINOR_VERSION,
flags: 0,
block_size: BLOCK_SIZE,
entries: vec![entry],
};
let mut out = vec![];
assert_eq!(
factoryfs.serialize_superblock(&mut out).unwrap(),
(metadata_size, metadata_blocks),
);
assert_eq!(out.len() as u32, SUPERBLOCK_DATA_SIZE);
} | rust_cleaned_test_functions.jsonl/29297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38886,
4574,
1769,
368,
341,
286,
1077,
829,
284,
330,
1944,
1269,
3263,
300,
12524,
543,
286,
1077,
821,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
4821,
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_that_cpp_code_compiles_and_demo_runs() {
let registry = get_diem_registry();
let abis = get_stdlib_script_abis();
let dir = tempdir().unwrap();
let config = serdegen::CodeGeneratorConfig::new("diem_types".to_string())
.with_encodings(vec![serdegen::Encoding::Bcs]);
let bcs_installer = serdegen::cpp::Installer::new(dir.path().to_path_buf());
bcs_installer.install_module(&config, ®istry).unwrap();
bcs_installer.install_serde_runtime().unwrap();
bcs_installer.install_bcs_runtime().unwrap();
let abi_installer = buildgen::cpp::Installer::new(dir.path().to_path_buf());
abi_installer
.install_transaction_builders("diem_framework", &abis)
.unwrap();
std::fs::copy(
"examples/cpp/stdlib_demo.cpp",
dir.path().join("stdlib_demo.cpp"),
)
.unwrap();
let status = Command::new("clang++")
.arg("--std=c++17")
.arg("-g")
.arg(dir.path().join("diem_framework.cpp"))
.arg(dir.path().join("stdlib_demo.cpp"))
.arg("-o")
.arg(dir.path().join("stdlib_demo"))
.status()
.unwrap();
assert!(status.success());
let output = Command::new(dir.path().join("stdlib_demo"))
.output()
.unwrap();
assert!(output.status.success());
assert_eq!(
std::str::from_utf8(&output.stdout).unwrap(),
EXPECTED_OUTPUT
);
} | rust_cleaned_test_functions.jsonl/3891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 651
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70197,
59686,
4136,
18177,
3658,
8378,
47830,
67352,
368,
341,
262,
1077,
19424,
284,
633,
814,
26862,
50650,
543,
262,
1077,
668,
285,
284,
633,
15656,
2740,
14660,
62,
15367,
543,
262,
1077,
541... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_byte_equal_slice_vbuf() {
use impls::ROIobuf;
let bs = [
ROIobuf::from_str("1234"),
ROIobuf::from_str("5678"),
ROIobuf::from_str("9"),
];
assert!(byte_equal_slice_vbuf(&bs, b"123456789"));
assert!(!byte_equal_slice_vbuf(&bs, b"123456780"));
assert!(!byte_equal_slice_vbuf(&bs, b"987654321"));
assert!(!byte_equal_slice_vbuf(&bs, b"12345678"));
assert!(!byte_equal_slice_vbuf(&bs, b"23456789"));
} | rust_cleaned_test_functions.jsonl/5462 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
11478,
26488,
2273,
5909,
368,
341,
220,
990,
11605,
82,
486,
71270,
18464,
401,
220,
1077,
17065,
284,
2278,
262,
50652,
18464,
486,
1499,
2895,
445,
16,
17,
18,
19,
4461,
262,
50652,
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_call_without_args() {
let output = Command::new("./target/release/tio")
.output()
.expect("failed to execute binary");
assert_eq!(String::from_utf8_lossy(&output.stderr), BASE_HELP_INFO)
} | rust_cleaned_test_functions.jsonl/41464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
39904,
8384,
368,
341,
286,
1077,
2550,
284,
7348,
486,
931,
13988,
5657,
88648,
5523,
815,
1138,
310,
659,
3006,
741,
310,
659,
17119,
445,
16091,
311,
9026,
7868,
797,
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 |
#[test]
fn test_find_program_address() {
for _ in 0..1_000 {
let program_id = Pubkey::new_rand();
let (address, nonce) = Pubkey::find_program_address(&[b"Lil'", b"Bits"], &program_id);
assert_eq!(
address,
Pubkey::create_program_address(&[b"Lil'", b"Bits", &[nonce]], &program_id).unwrap()
);
}
} | rust_cleaned_test_functions.jsonl/87855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
25096,
6744,
368,
341,
286,
369,
716,
304,
220,
15,
496,
16,
62,
15,
15,
15,
341,
310,
1077,
2025,
842,
284,
22611,
792,
486,
931,
33864,
543,
310,
1077,
320,
4995,
11,
39676,
8,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_cbor_wallet() {
let wallet: WalletJson = serde_json::from_str("{\"name\":\"w3of5\",\"descriptor_main\":\"wsh(multi(3,tpubD6NzVbkrYhZ4XuzR59W1JHQpXcufQVj64NDa4eiALMJxC2xAwpY7wy2J9RVQ7BHDYK3eWrVRsuMUcdwGn9xVBmC9wfpVawpNGLyrdgAhehd/0/*,tpubD6NzVbkrYhZ4WarEBpY5okLrjRQ8sgfoEsxZfprQDEbAjWM585LhNeT9GuSeFRGL7yLheiRgtCQCBb73y21EsLzRfwdrRmfaAT4yUTEKtu7/0/*,tpubD6NzVbkrYhZ4WRwbTYgdGDMxPUzq5WwX8HwnAR6PYB291uUH63pCU1WFV6RRWGyA2Xy8okiFAqfAXEErx1SVh7mKSVQa34hFaa8GcmuEeds/0/*,tpubD6NzVbkrYhZ4YkVm13NDmMPEHEWXHoqGXBPCrtHbB1hE6GoTjdvXEKrtRBMtSe4gQQUSyvU78jgyrK5AfwLewr1cTkkojQbYTuyNtgQFEDb/0/*,tpubD6NzVbkrYhZ4YGeACdA4t1ZjEfJm8ExF818xG2ndsNoT61PwPnotxVQXDLZAZ5ut7t1iHR2FLEYnTzJTN5DGxQTKgwQpt7ftPzRwjugwuYg/0/*))#we4l0t0l\",\"descriptor_change\":\"wsh(multi(3,tpubD6NzVbkrYhZ4XuzR59W1JHQpXcufQVj64NDa4eiALMJxC2xAwpY7wy2J9RVQ7BHDYK3eWrVRsuMUcdwGn9xVBmC9wfpVawpNGLyrdgAhehd/1/*,tpubD6NzVbkrYhZ4WarEBpY5okLrjRQ8sgfoEsxZfprQDEbAjWM585LhNeT9GuSeFRGL7yLheiRgtCQCBb73y21EsLzRfwdrRmfaAT4yUTEKtu7/1/*,tpubD6NzVbkrYhZ4WRwbTYgdGDMxPUzq5WwX8HwnAR6PYB291uUH63pCU1WFV6RRWGyA2Xy8okiFAqfAXEErx1SVh7mKSVQa34hFaa8GcmuEeds/1/*,tpubD6NzVbkrYhZ4YkVm13NDmMPEHEWXHoqGXBPCrtHbB1hE6GoTjdvXEKrtRBMtSe4gQQUSyvU78jgyrK5AfwLewr1cTkkojQbYTuyNtgQFEDb/1/*,tpubD6NzVbkrYhZ4YGeACdA4t1ZjEfJm8ExF818xG2ndsNoT61PwPnotxVQXDLZAZ5ut7t1iHR2FLEYnTzJTN5DGxQTKgwQpt7ftPzRwjugwuYg/1/*))#5tp6lvkf\",\"fingerprints\":[\"171f9233\",\"37439b38\",\"ab4343d4\",\"deb8f1ba\",\"214c5f36\"],\"required_sig\":3,\"daemon_opts\":{\"url\":\"http://127.0.0.1:18332\",\"cookie_file\":\"/Volumes/Transcend/bitcoin-testnet/testnet3/.cookie\"},\"created_at_height\":1720730}").unwrap();
let vec_json = serde_json::to_vec(&wallet).unwrap();
let vec_cbor = serde_cbor::to_vec(&wallet).unwrap();
assert_eq!(vec_json.len(), 1496);
assert_eq!(vec_cbor.len(), 1437);
} | rust_cleaned_test_functions.jsonl/129403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
9368,
62308,
368,
341,
286,
1077,
15085,
25,
36483,
5014,
284,
61570,
9455,
486,
1499,
2895,
99141,
606,
23488,
86,
18,
1055,
20,
34333,
53132,
11027,
23488,
86,
927,
1255,
7068,
7,
18,
468... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_wildcard_topic() {
assert!(topic!("sport/tennis/#").matches(&Topic::from(vec![
Level::normal("sport"),
Level::normal("tennis"),
Level::MultiWildcard
])));
assert!(topic!("#").matches(&Topic::from(vec![Level::MultiWildcard])));
assert!("sport/tennis#".parse::<Topic>().is_err());
assert!("sport/tennis/#/ranking".parse::<Topic>().is_err());
} | rust_cleaned_test_functions.jsonl/77010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
1670,
695,
4951,
31414,
368,
341,
286,
2060,
10297,
16411,
17223,
60901,
14,
1960,
25151,
26559,
1827,
19914,
2099,
26406,
486,
1499,
25592,
90515,
310,
9395,
486,
8252,
445,
60901,
4461,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_not_parse_on_eof2() {
let data = [65, 1, 3, 0, 3, 0, 3, 0, 4, 0, 4, 0];
let res = parse(&data[..]);
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/109435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
7913,
21039,
4470,
90792,
17,
368,
341,
286,
1077,
821,
284,
508,
21,
20,
11,
220,
16,
11,
220,
18,
11,
220,
15,
11,
220,
18,
11,
220,
15,
11,
220,
18,
11,
220,
15,
11,
220,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_empty() {
let mut m = HashMap::with_capacity(4);
assert!(m.insert(1i, 2i));
assert!(!m.is_empty());
assert!(m.remove(&1));
assert!(m.is_empty());
} | rust_cleaned_test_functions.jsonl/41864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
15124,
368,
341,
286,
1077,
5206,
296,
284,
10528,
486,
4197,
35603,
7,
19,
317,
286,
2060,
10297,
76,
7030,
7,
16,
72,
11,
220,
17,
72,
1106,
286,
2060,
0,
3471,
76,
2079,
15124,
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 |
#[test]
fn test_dual_vec_powi() {
let res = DualVec64::<2>::new(1.2, StaticVec::new_vec([1.0, 1.0])).powi(6);
assert!((res.re - 2.98598400000000).abs() < 1e-12);
assert!((res.eps[0] - 14.9299200000000).abs() < 1e-12);
assert!((res.eps[1] - 14.9299200000000).abs() < 1e-12);
} | rust_cleaned_test_functions.jsonl/28610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96772,
13251,
56183,
72,
368,
341,
262,
1077,
592,
284,
33659,
10050,
21,
19,
27638,
17,
6831,
931,
7,
16,
13,
17,
11,
23105,
10050,
486,
931,
13251,
2561,
16,
13,
15,
11,
220,
16,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append_values() -> Result<()> {
let mut a = Int8Builder::new(0);
a.append_value(1)?;
a.append_null()?;
a.append_value(-2)?;
assert_eq!(a.len(), 3);
// append values
let values = &[1, 2, 3, 4];
let is_valid = &[true, true, false, true];
a.append_values(values, is_valid)?;
assert_eq!(a.len(), 7);
let array = a.finish();
assert_eq!(array.value(0), 1);
assert_eq!(array.is_null(1), true);
assert_eq!(array.value(2), -2);
assert_eq!(array.value(3), 1);
assert_eq!(array.value(4), 2);
assert_eq!(array.is_null(5), true);
assert_eq!(array.value(6), 4);
Ok(())
} | rust_cleaned_test_functions.jsonl/30966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
9146,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
264,
284,
1333,
23,
3297,
486,
931,
7,
15,
317,
286,
264,
2057,
3142,
7,
16,
40007,
286,
264,
2057,
15162,
94136,
286,
264,
2057,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_is_scope_subset() {
let mut needle_scope = String::from("1 2 3");
let mut haystack_scope = String::from("1 2 3 4");
let mut broken_scope = String::from("5 2 4");
assert!(SpotifyOAuth::is_scope_subset(&mut needle_scope, &mut haystack_scope));
assert!(!SpotifyOAuth::is_scope_subset(&mut broken_scope, &mut haystack_scope));
} | rust_cleaned_test_functions.jsonl/10101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
23199,
47532,
368,
341,
286,
1077,
5206,
30309,
23199,
284,
923,
486,
1499,
445,
16,
220,
17,
220,
18,
797,
286,
1077,
5206,
88447,
23199,
284,
923,
486,
1499,
445,
16,
220,
17,
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_function_starts_with() {
assert!(function_starts_with(
"futures::task_impl::std::set",
"futures::"
));
assert!(!function_starts_with(
"futures::task_impl::std::set",
"tokio::"
));
} | rust_cleaned_test_functions.jsonl/46632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
86552,
6615,
368,
341,
286,
2060,
10297,
1688,
86552,
6615,
1006,
310,
330,
69,
74606,
486,
8202,
21007,
486,
1834,
486,
746,
756,
310,
330,
69,
74606,
486,
698,
286,
33351,
286,
2060,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.