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_query_matches_capturing_error_nodes() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(
language,
"
(ERROR (identifier) @the-error-identifier) @the-error
",
)
.unwrap();
assert_query_matches(
language,
&query,
"function a(b,, c, d :e:) {}",
&[(0, vec![("the-error", ":e:"), ("the-error-identifier", "e")])],
);
});
} | rust_cleaned_test_functions.jsonl/25153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
666,
2689,
1677,
4096,
14896,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
797,
286,
1077,
3239,
284,
11361,
486,
931,
1006,
310,
4128,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_shasher() {
test_struct!([shasher="SimpleHasher"]
{ [] x: u64 = 0x12345678 }
[(SimpleHasher, Djb2Hasher, 0x12345678_u64)]);
} | rust_cleaned_test_functions.jsonl/43897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
33767,
368,
341,
262,
1273,
15126,
0,
2561,
927,
33767,
428,
16374,
6370,
261,
7026,
338,
314,
3056,
856,
25,
575,
21,
19,
284,
220,
15,
87,
16,
17,
18,
19,
20,
21,
22,
23,
456,
338,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_safe_checkout_typechange_tree_to_blob_with_conflicting() -> BitResult<()> {
BitRepo::with_sample_repo_no_sym(|repo| {
let target = commit! {
foo
bar
dir < "changed to a file"
};
rmdir!(repo: "dir");
touch!(repo: "dir" < "changed to a different file");
bit_checkout!(repo: &rev!(target)).unwrap_err().try_into_checkout_conflict()?;
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62985 | {
"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,
34067,
68186,
1819,
3373,
11663,
2346,
45908,
6615,
16059,
78208,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
17491,
37784,
6536,
26825,
22428,
23476,
91,
341,
286,
1077,
2169,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_sss() {
let s1 = String::from("hello");
let s2 = &s1;
, 3, 4, 5];
let slice = &a[1..3];
println!("{:?}", slice);
} | rust_cleaned_test_functions.jsonl/51242 | {
"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,
643,
778,
368,
341,
286,
1077,
274,
16,
284,
923,
486,
1499,
445,
14990,
797,
286,
1077,
274,
17,
284,
609,
82,
16,
280,
286,
1154,
220,
18,
11,
220,
19,
11,
220,
20,
935,
2303,
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 |
#[test]
fn test_fn_signature_no_params() {
let info = call_info(
r#"fn foo<T>() -> T where T: Copy + Display {}
fn bar() { foo(<|>); }"#,
);
assert!(info.parameters().is_empty());
assert_eq!(
info.label(),
r#"
fn foo<T>() -> T
where T: Copy + Display
"#
.trim()
);
assert!(info.active_parameter.is_none());
} | rust_cleaned_test_functions.jsonl/55350 | {
"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,
15246,
39859,
6536,
6745,
368,
341,
286,
1077,
3546,
284,
1618,
3109,
1006,
310,
435,
55543,
8822,
15229,
3125,
13555,
1464,
350,
1380,
350,
25,
14540,
488,
10623,
5613,
8822,
3619,
368,
314,
1522... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_variable_with_positive_integer_value() {
#[derive(serde_derive::Serialize)]
struct Map {
num: usize,
};
let map = Map { num: 231 };
let var = Variable::from_serializable(&map).unwrap();
let json_string = serde_json::to_string(&var).unwrap();
assert_eq!(r#"{"num":231}"#, json_string);
} | rust_cleaned_test_functions.jsonl/108396 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
14635,
6615,
54160,
31725,
3142,
368,
341,
286,
11506,
27098,
7,
47024,
35345,
533,
486,
15680,
5563,
286,
2036,
5027,
341,
310,
1629,
25,
22301,
345,
286,
3634,
286,
1077,
2415,
284,
5027,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_esc_key() {
assert_eq!(
parse_event(b"\x1B", false).unwrap(),
Some(InternalEvent::Event(Event::Key(KeyCode::Esc.into()))),
);
} | rust_cleaned_test_functions.jsonl/21318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92196,
3097,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
6748,
1883,
11934,
87,
16,
33,
497,
895,
568,
15454,
3148,
310,
4329,
7,
11569,
1556,
486,
1556,
30469,
486,
1592,
41040,
486,
36121,
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 |
#[test]
fn test_runtime() {
let code = vec![
Inst::PushArg(MemRef::PrimFunc(PrimFuncPtr::new("+", &PRIM_ADD))),
Inst::PushArg(MemRef::Const(SimpleDatum::Num(Number::new_int(1, 0)))),
Inst::PushArg(MemRef::Const(SimpleDatum::Num(Number::new_int(2, 0)))),
Inst::Call(2),
Inst::Return
];
let mut runtime = Runtime::new(libbase(), HashMap::new());
runtime.load_main(code, None);
assert_eq!(runtime.run(), Ok(Datum::Num(Number::new_int(3, 0))));
} | rust_cleaned_test_functions.jsonl/82076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33232,
368,
341,
286,
1077,
2038,
284,
7486,
90515,
310,
5984,
486,
16644,
2735,
3189,
336,
3945,
486,
66191,
9626,
7,
66191,
9626,
5348,
486,
931,
34973,
497,
609,
6480,
1791,
8581,
41749,
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_typed_arena_drop_count() {
let counter = Cell::new(0);
{
let arena: TypedArena<DropCounter<'_>> = TypedArena::default();
for _ in 0..100 {
// Allocate something with drop glue to make sure it doesn't leak.
arena.alloc(DropCounter { count: &counter });
}
};
assert_eq!(counter.get(), 100);
} | rust_cleaned_test_functions.jsonl/41100 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
32501,
62,
30527,
29584,
3180,
368,
341,
262,
1077,
5546,
284,
13972,
486,
931,
7,
15,
317,
262,
341,
286,
1077,
24902,
25,
50554,
93937,
27,
19871,
14099,
18291,
62,
2452,
284,
50554,
9393... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dfinance_executor_allows_0x0() {
let _pool = ConstPool::new();
let text = r"
script {
fun main() {}
}";
execute_script(
MoveFile::with_content(script_path(), text),
vec![],
"dfinance",
"0x0",
vec![],
)
.unwrap();
execute_script(
MoveFile::with_content(script_path(), text),
vec![],
"dfinance",
"0x1",
vec![],
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/43921 | {
"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,
814,
62675,
81207,
5705,
4241,
62,
15,
87,
15,
368,
341,
262,
1077,
716,
10285,
284,
24522,
10551,
486,
931,
1428,
262,
1077,
1467,
284,
435,
698,
262,
5316,
341,
286,
2464,
1887,
368,
5613,
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_template_with_decltype_and_with_auto() -> Result<()> {
let ir = ir_from_cc(
r#" #pragma clang lifetime_elision
template <typename T1, typename T2>
struct MyTemplate {
static decltype(auto) TemplatedAdd(T1 a, T2 b) { return a + b; }
};
using MyAlias = MyTemplate<unsigned int, long long>; "#,
)?;
assert_ir_matches!(
ir,
quote! {
Func {
name: "TemplatedAdd", ...
return_type: MappedType {
rs_type: RsType { name: Some("i64"), ... },
cc_type: CcType { name: Some("long long"), ... },
}, ...
}
}
);
Ok(())
} | rust_cleaned_test_functions.jsonl/37179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8693,
6615,
35814,
1313,
8378,
6615,
27740,
368,
1464,
5714,
71698,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
1006,
286,
435,
55543,
671,
6015,
18260,
19031,
21602,
1816,
198,
310,
3811,
366,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_local_in_wide_port_is_synthesizable() {
let mut dev = MISOWidePort::<64, 16>::default();
dev.bus.from_controller.connect();
dev.bus.select.connect();
dev.bus.strobe.connect();
dev.bus.clock.connect();
dev.port_in.connect();
dev.strobe_in.connect();
dev.connect_all();
let vlog = generate_verilog(&dev);
println!("{}", vlog);
yosys_validate("local_wide_in", &vlog).unwrap();
} | rust_cleaned_test_functions.jsonl/124344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
1243,
1670,
577,
8716,
6892,
51393,
6375,
8335,
368,
341,
262,
1077,
5206,
3483,
284,
67025,
3307,
577,
7084,
27638,
21,
19,
11,
220,
16,
21,
6831,
2258,
543,
262,
3483,
48067,
6387,
2160... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_offset_calculation() {
assert_eq!(calculate_offsets(128, 8, 15, 1, 4, 4 ), (8, 0, 128, 144, 148));
assert_eq!(calculate_offsets(3, 1, 2, 1, 1, 1 ), (1, 0, 3, 5, 6));
assert_eq!(calculate_offsets(6, 2, 12, 4, 24, 8), (8, 0, 8, 24, 48));
} | rust_cleaned_test_functions.jsonl/120906 | {
"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,
6917,
38241,
2914,
368,
341,
286,
2060,
10714,
10297,
35597,
56924,
7,
16,
17,
23,
11,
220,
23,
11,
220,
16,
20,
11,
220,
16,
11,
220,
19,
11,
220,
19,
6882,
320,
23,
11,
220,
15,
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_add_trans_listener() -> Result<(), String> {
let keypair = identity::ed25519::Keypair::generate();
let local_id = Address::from(identity::PublicKey::Ed25519(keypair.public()));
let mut chain = Blockchain::new(&keypair);
let transaction = Transaction::new(
TransactionType::Create,
local_id,
"some transaction".as_bytes().to_vec(),
&keypair,
);
let called = Rc::new(Cell::new(false));
chain
.submit_transaction(transaction.clone(), {
let called = called.clone();
let transaction = transaction.clone();
move |t: Transaction| {
assert_eq!(transaction, t);
called.set(true)
}
})
.notify_transaction_settled(transaction);
assert!(called.get());
Ok(())
} | rust_cleaned_test_functions.jsonl/47213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 467
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
7965,
46493,
368,
1464,
5714,
68843,
923,
29,
341,
286,
1077,
1376,
12670,
284,
9569,
486,
291,
17,
20,
20,
16,
24,
486,
6608,
1082,
1310,
486,
19366,
543,
286,
1077,
2205,
842,
284,
917... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part1() {
let lines = vec![
"1-3 a: abcde".to_owned(),
"1-3 b: cdefg".to_owned(),
"2-9 c: ccccccccc".to_owned(),
];
assert_eq!(part1(&lines), 2);
} | rust_cleaned_test_functions.jsonl/32253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
16,
368,
341,
286,
1077,
5128,
284,
7486,
90515,
310,
330,
16,
12,
18,
264,
25,
39022,
450,
3263,
983,
51973,
3148,
310,
330,
16,
12,
18,
293,
25,
272,
750,
70,
3263,
983,
51973,
3148... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log() {
let handle = super::init_for_test();
debug!("debug message2.");
info!("info message.");
warn!("warn message.");
error!("error message.");
let handle2 = super::init_for_test();
assert_eq!(handle.level(), handle2.level());
assert_eq!(handle.log_path(), handle2.log_path());
assert_eq!(handle.stderr(), handle2.stderr());
let origin_level = handle.level();
handle.update_level(LevelFilter::Off);
assert_eq!(handle.level(), LevelFilter::Off);
assert_eq!(handle.level(), handle2.level());
handle.update_level(origin_level);
} | rust_cleaned_test_functions.jsonl/49017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
368,
341,
286,
1077,
3705,
284,
2256,
486,
2327,
5478,
4452,
543,
286,
7390,
17223,
8349,
1943,
17,
7320,
286,
3546,
17223,
2733,
1943,
7320,
286,
8809,
17223,
33481,
1943,
7320,
286,
1465,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run_fonts_hi_ansi_build() {
let c = RunFonts::new().hi_ansi("Arial");
let b = c.build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:rFonts w:hAnsi="Arial" />"#
);
} | rust_cleaned_test_functions.jsonl/117550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
71502,
47225,
62,
52067,
20801,
368,
341,
286,
1077,
272,
284,
6452,
55369,
486,
931,
1005,
6023,
62,
52067,
445,
24555,
797,
286,
1077,
293,
284,
272,
13239,
543,
286,
2060,
10714,
33673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_break_lines_long() {
let mut test_string = String::with_capacity(100);
for _ in 0..200 {
test_string.push('#');
}
let lines = break_line(&test_string, 80);
let widths: Vec<usize> = lines
.iter()
.map(|s| UnicodeWidthStr::width(&s[..]))
.collect();
assert_eq!((80, 80, 40), (widths[0], widths[1], widths[2]));
} | rust_cleaned_test_functions.jsonl/109672 | {
"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,
39494,
18323,
17799,
368,
341,
286,
1077,
5206,
1273,
3904,
284,
923,
486,
4197,
35603,
7,
16,
15,
15,
317,
286,
369,
716,
304,
220,
15,
496,
17,
15,
15,
341,
310,
1273,
3904,
2552,
3515,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_trait() {
ok("trait Foo {}");
err(
"trait Foo {} struct Foo {}",
pos(1, 14),
Msg::ShadowTrait("Foo".into()),
);
err(
"trait Foo {} class Foo {}",
pos(1, 14),
Msg::ShadowTrait("Foo".into()),
);
err(
"trait Foo {} fun Foo() {}",
pos(1, 14),
Msg::ShadowTrait("Foo".into()),
);
} | rust_cleaned_test_functions.jsonl/45237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78491,
368,
341,
286,
5394,
445,
29432,
33428,
4687,
797,
286,
1848,
1006,
310,
330,
29432,
33428,
4687,
2036,
33428,
4687,
756,
310,
1133,
7,
16,
11,
220,
16,
19,
1326,
310,
24205,
486,
23667,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_width_align_unicode() {
assert_eq!(string_width_align("äste", 3), "ä..");
assert_eq!(
string_width_align("wüsten äste", 10),
"wüsten ä.."
);
assert_eq!(
string_width_align("Jon Grythe Stødle", 19),
"Jon Grythe Stødle "
);
} | rust_cleaned_test_functions.jsonl/49111 | {
"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,
3904,
7927,
37015,
54662,
368,
341,
286,
2060,
10714,
10297,
917,
7927,
37015,
445,
2305,
5342,
497,
220,
18,
701,
330,
2305,
496,
797,
286,
2060,
10714,
33673,
310,
914,
7927,
37015,
445,
86,
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_dispatch_sync() {
let state = IsolateState::mock();
let snapshot = libdeno::deno_buf::empty();
let isolate = Isolate::new(snapshot, state, dispatch_sync);
tokio_util::init(|| {
isolate
.execute(
r#"
const m = new Uint8Array([4, 5, 6]);
let n = libdeno.send(m);
if (!(n.byteLength === 3 &&
n[0] === 1 &&
n[1] === 2 &&
n[2] === 3)) {
throw Error("assert error");
}
"#,
).expect("execute error");
isolate.event_loop().ok();
});
} | rust_cleaned_test_functions.jsonl/16974 | {
"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,
42991,
23008,
368,
341,
262,
1077,
1584,
284,
2160,
33066,
1397,
486,
16712,
543,
262,
1077,
16295,
284,
3051,
5183,
78,
486,
5183,
78,
10363,
486,
3194,
543,
262,
1077,
42123,
284,
2160,
33066,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_out() {
let mem = &create_anon_guest_memory(&[(GuestAddress(0), 0x10000)], false).unwrap();
let mut queue = RequestVirtQueue::new(GuestAddress(0), &mem);
let request_header = RequestHeader::new(VIRTIO_BLK_T_OUT, 100);
queue.set_hdr_desc(0x1000, 0x1000, VIRTQ_DESC_F_NEXT, request_header);
// Write only data descriptor for OUT.
queue.set_data_desc(0x2000, 0x1000, VIRTQ_DESC_F_NEXT | VIRTQ_DESC_F_WRITE);
queue.check_parse_err(Error::UnexpectedWriteOnlyDescriptor);
// data_len is not multiple of 512 for IN.
queue.mut_data_desc().flags.set(VIRTQ_DESC_F_NEXT);
queue.mut_data_desc().len.set(1000);
queue.check_parse_err(Error::InvalidDataLength);
// sector is to big.
queue.mut_data_desc().len.set(1024);
queue.mut_hdr().sector = NUM_DISK_SECTORS - 1;
queue.check_parse_err(Error::InvalidOffset);
// Fix data descriptor.
queue.mut_hdr().sector = NUM_DISK_SECTORS - 2;
queue.set_status_desc(0x3000, 0x1000, VIRTQ_DESC_F_WRITE);
queue.check_parse(true);
} | rust_cleaned_test_functions.jsonl/84868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 525
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6068,
368,
341,
286,
1077,
1833,
284,
609,
3182,
12008,
263,
62739,
19195,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
15,
25035,
895,
568,
15454,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_msg_format() {
use slog::Level;
let result = DefaultMsgFormat.to_string(
&record!(
Level::Info,
"",
&format_args!("Hello, world!"),
b!("key1" => "value1")
),
&o!("key2" => "value2").into(),
).expect("formatting failed");
assert!(
result == "Hello, world! [key1=\"value1\" key2=\"value2\"]" ||
result == "Hello, world! [key2=\"value2\" key1=\"value1\"]"
);
} | rust_cleaned_test_functions.jsonl/134066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
6483,
8955,
368,
341,
262,
990,
34949,
486,
4449,
401,
262,
1077,
1102,
284,
7899,
6611,
4061,
2389,
3904,
1006,
286,
609,
8548,
33673,
310,
9395,
486,
1731,
345,
310,
8324,
310,
609,
2243... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_epoch_stale() {
let mut epoch = metapb::RegionEpoch::default();
epoch.set_version(10);
epoch.set_conf_ver(10);
let tbl = vec![
(11, 10, true),
(10, 11, true),
(10, 10, false),
(10, 9, false),
];
for (version, conf_version, is_stale) in tbl {
let mut check_epoch = metapb::RegionEpoch::default();
check_epoch.set_version(version);
check_epoch.set_conf_ver(conf_version);
assert_eq!(is_epoch_stale(&epoch, &check_epoch), is_stale);
}
} | rust_cleaned_test_functions.jsonl/6854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20682,
1261,
1574,
368,
341,
286,
1077,
5206,
16342,
284,
2270,
391,
65,
486,
14091,
44338,
486,
2258,
543,
286,
16342,
980,
9438,
7,
16,
15,
317,
286,
16342,
980,
16059,
26042,
7,
16,
15,
626... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dead_fork_invalid_last_tick() {
let res = check_dead_fork(|_keypair, bank| {
let blockhash = bank.last_blockhash();
let slot = bank.slot();
let hashes_per_tick = bank.hashes_per_tick().unwrap_or(0);
entries_to_test_shreds(
entry::create_ticks(bank.ticks_per_slot(), hashes_per_tick, blockhash),
slot,
slot.saturating_sub(1),
false,
0,
)
});
if let Err(BlockstoreProcessorError::InvalidBlock(block_error)) = res {
assert_eq!(block_error, BlockError::InvalidLastTick);
} else {
panic!();
}
} | rust_cleaned_test_functions.jsonl/11050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53427,
761,
669,
31433,
12195,
43612,
368,
341,
286,
1077,
592,
284,
1779,
53427,
761,
669,
22428,
62,
792,
12670,
11,
6073,
91,
341,
310,
1077,
2504,
8296,
284,
6073,
9110,
7113,
8296,
543,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_u16() {
for l in 0..100 {
for r in 0..=core::u16::MAX {
assert_eq!(r.wrapping_offset(l.diff(&r).expect("u16 addresses always have valid diffs")), l);
}
}
} | rust_cleaned_test_functions.jsonl/83549 | {
"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,
7300,
16,
21,
368,
341,
262,
369,
326,
304,
220,
15,
496,
16,
15,
15,
341,
286,
369,
435,
304,
220,
15,
496,
28,
2153,
486,
84,
16,
21,
486,
10586,
341,
310,
2060,
10714,
10297,
81,
81293,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_roundtrip_ppm() {
// 3x3 image that tries all the 0/255 RGB combinations
let buf: [u8; 27] = [
0, 0, 0,
0, 0, 255,
0, 255, 0,
0, 255, 255,
255, 0, 0,
255, 0, 255,
255, 255, 0,
255, 255, 255,
255, 255, 255,
];
let mut stream = Vec::<u8>::new();
{
let mut encoder = super::PPMEncoder::new(&mut stream);
match encoder.encode(&buf, 3, 3, ColorType::RGB(8)) {
Ok(_) => {},
Err(_) => panic!("PPM encoder failed"),
};
}
let mut decoder = match super::PPMDecoder::new(&stream[..]) {
Ok(img) => img,
Err(e) => panic!("PPM decoder failed with {}", e),
};
match decoder.read_image() {
Ok(DecodingResult::U8(vec)) => {
assert_eq!(&buf[..], &vec[..]);
},
r => {
panic!("PPM: Got a strange image result {:?}", r);
}
}
} | rust_cleaned_test_functions.jsonl/115605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 668
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
32981,
31600,
76,
368,
341,
286,
442,
220,
18,
87,
18,
2168,
429,
16297,
678,
279,
220,
15,
14,
17,
20,
20,
20978,
27459,
198,
286,
1077,
6607,
25,
508,
84,
23,
26,
220,
17,
22,
60,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cast_real_as_json() {
let mut ctx = EvalContext::new(Arc::new(EvalConfig::default_for_test()));
let cases = vec![
(vec![Datum::F64(32.0001)], Some(Json::Double(32.0001))),
(vec![Datum::Null], None),
];
for (cols, exp) in cases {
let col_expr = col_expr(0, FieldTypeTp::Double);
let ex = scalar_func_expr(ScalarFuncSig::CastRealAsJson, &[col_expr]);
let e = Expression::build(&ctx, ex).unwrap();
let res = e.eval_json(&mut ctx, &cols).unwrap();
if exp.is_none() {
assert!(res.is_none());
continue;
}
assert_eq!(res.unwrap().into_owned(), exp.unwrap());
}
} | rust_cleaned_test_functions.jsonl/2966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
15266,
11898,
9455,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
931,
4346,
1287,
486,
931,
10722,
831,
2648,
486,
2258,
5478,
4452,
7392,
286,
1077,
5048,
284,
7486,
90515,
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... | 3 |
#[test]
fn test_should_fail() {
fn f() { fail!(); }
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
ignore: false,
should_fail: true
},
testfn: DynTestFn(|| f()),
};
let (p, ch) = stream();
let ch = SharedChan::new(ch);
run_test(false, desc, ch);
let (_, res) = p.recv();
assert_eq!(res, TrOk);
} | rust_cleaned_test_functions.jsonl/61409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
22121,
368,
341,
286,
5168,
282,
368,
314,
3690,
0,
2129,
456,
286,
1077,
6560,
284,
3393,
11065,
3036,
24911,
341,
310,
6560,
25,
3393,
11065,
341,
394,
829,
25,
23105,
2271,
675,
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_datetime_parse_from_str() {
let ymdhms = |y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s);
assert_eq!(NaiveDateTime::parse_from_str("2014-5-7T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
Ok(ymdhms(2014, 5, 7, 12, 34, 56))); // ignore offset
assert_eq!(NaiveDateTime::parse_from_str("2015-W06-1 000000", "%G-W%V-%u%H%M%S"),
Ok(ymdhms(2015, 2, 2, 0, 0, 0)));
assert_eq!(NaiveDateTime::parse_from_str("Fri, 09 Aug 2013 23:54:35 GMT",
"%a, %d %b %Y %H:%M:%S GMT"),
Ok(ymdhms(2013, 8, 9, 23, 54, 35)));
assert!(NaiveDateTime::parse_from_str("Sat, 09 Aug 2013 23:54:35 GMT",
"%a, %d %b %Y %H:%M:%S GMT").is_err());
assert!(NaiveDateTime::parse_from_str("2014-5-7 12:3456", "%Y-%m-%d %H:%M:%S").is_err());
assert!(NaiveDateTime::parse_from_str("12:34:56", "%H:%M:%S").is_err()); // insufficient
} | rust_cleaned_test_functions.jsonl/99636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 610
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28943,
21039,
5673,
2895,
368,
341,
286,
1077,
379,
2277,
71,
1011,
284,
760,
88,
13086,
11991,
19806,
10128,
10671,
91,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7021,
13086,
11991,
568,
437,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_body_len() {
// Test that padding is added after the body of the packet whose minimum
// body length constraint requires it. A previous version of this code
// had a bug where padding was always added after the innermost body.
let body = &[1, 2];
// 4 bytes of header and footer for a total of 6 bytes (including the
let inner = DummyPacketBuilder::new(2, 2, 0, MAX_USIZE);
// Minimum body length of 8 will require 2 bytes of padding.
let outer = DummyPacketBuilder::new(2, 2, 8, MAX_USIZE);
let buf = body
.into_serializer()
.into_verifying(false)
.encapsulate_verifying(inner, false)
.encapsulate_verifying(outer, false)
.serialize_vec_outer()
.unwrap();
assert_eq!(
buf.as_ref(),
&[
0xFF, 0xFF, // Outer header
0xFF, 0xFF, // Inner header
1, 2, // Inner body
0xFE, 0xFE, // Inner footer
0, 0, // Padding to satisfy outer minimum body length requirement
0xFE, 0xFE // Outer footer
]
);
} | rust_cleaned_test_functions.jsonl/131782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
14114,
6043,
368,
341,
286,
442,
3393,
429,
5300,
374,
3694,
1283,
279,
2487,
315,
279,
10151,
6693,
8028,
198,
286,
442,
2487,
3084,
21568,
7460,
432,
13,
362,
3681,
2319,
315,
419,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type_question() {
compare(
r#"
grammar;
extern { enum Tok { "Hi" => Hi(..) } }
X = Y?;
Y = "Hi";
"#,
vec![("X", "::std::option::Option<Tok>"), ("Y", "Tok")],
)
} | rust_cleaned_test_functions.jsonl/50469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
28915,
368,
341,
262,
9429,
1006,
286,
435,
2,
698,
41094,
280,
262,
15637,
314,
7618,
21447,
314,
330,
13048,
1,
589,
21018,
56422,
8,
335,
456,
262,
1599,
284,
809,
37445,
262,
809,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_split_not_uninitialized() {
let stake_lamports = 42;
let stake_address = solana_sdk::pubkey::new_rand();
let stake_account = AccountSharedData::new_data_with_space(
stake_lamports,
&just_stake(Meta::auto(&stake_address), stake_lamports),
StakeState::size_of(),
&id(),
)
.unwrap();
let split_to_address = solana_sdk::pubkey::new_rand();
let instruction_accounts = vec![
AccountMeta {
pubkey: stake_address,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
},
];
for split_to_state in &[
StakeState::Initialized(Meta::default()),
StakeState::Stake(Meta::default(), Stake::default()),
StakeState::RewardsPool,
] {
let split_to_account = AccountSharedData::new_data_with_space(
0,
split_to_state,
StakeState::size_of(),
&id(),
)
.unwrap();
process_instruction(
&serialize(&StakeInstruction::Split(stake_lamports / 2)).unwrap(),
vec![
(stake_address, stake_account.clone()),
(split_to_address, split_to_account),
],
instruction_accounts.clone(),
Err(InstructionError::InvalidAccountData),
);
}
} | rust_cleaned_test_functions.jsonl/31656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 921
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
17052,
7913,
4907,
36161,
368,
341,
286,
1077,
18279,
907,
309,
3394,
284,
220,
19,
17,
280,
286,
1077,
18279,
6744,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_format_args_expand() {
check_expansion(
r#"
#[rustc_builtin_macro]
macro_rules! format_args {
($fmt:expr) => ({ /* compiler built-in */ });
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })
}
format_args!("{} {:?}", arg1(a, b, c), arg2);
"#,
expect![[
r#"std::fmt::Arguments::new_v1(&[], &[std::fmt::ArgumentV1::new(&(arg1(a,b,c)),std::fmt::Display::fmt),std::fmt::ArgumentV1::new(&(arg2),std::fmt::Display::fmt),])"#
]],
);
} | rust_cleaned_test_functions.jsonl/112676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
8384,
67875,
368,
341,
286,
1779,
14214,
10501,
1006,
310,
435,
2,
698,
310,
11506,
35788,
66,
73829,
58810,
921,
310,
18072,
21407,
0,
3561,
8384,
341,
394,
1711,
12501,
96011,
8,
589,
94... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_func_evaluation() {
let x = 2.0;
let x_name = Expr::symbol("x");
let y = 3.0;
let y_name = Expr::symbol("y");
let fn_name = Expr::symbol("test-func");
let fn_def = Expr::list(&[
Expr::symbol("fn"),
fn_name.clone(),
Expr::list(&[x_name.clone(), y_name.clone()]),
Expr::list(&[Expr::symbol("+"), x_name.clone(), y_name.clone()]),
]);
let mut env = Environment::empty();
env.push_context();
let r = eval(fn_def, &mut env);
assert_eq!(EvalResult::Unit, r);
let fn_eval = Expr::list(&[
fn_name.clone(),
Expr::list(&[Expr::symbol("+"), Expr::fnum(x), Expr::fnum(y)]),
Expr::fnum(1.0),
]);
let r2 = eval(fn_eval, &mut env);
if let EvalResult::Expr(e) = r2 {
if let Expr::FNum(n) = *e {
assert_eq!(n, x + y + 1.0);
} else {
assert!(false, format!("Expected FNum(6.0), got {:?}", e));
}
} else {
assert!(false, format!("Expected Expr::fnum(6.0), got {:?}", r2));
}
} | rust_cleaned_test_functions.jsonl/55387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 688
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9596,
86505,
368,
341,
286,
1077,
856,
284,
220,
17,
13,
15,
280,
286,
1077,
856,
1269,
284,
28819,
486,
18785,
445,
87,
797,
286,
1077,
379,
284,
220,
18,
13,
15,
280,
286,
1077,
379,
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... | 3 |
#[test]
fn test_encrypt_decrypt() {
let plaintext = b"The quick brown fox was annoying".to_vec();
let key = GenericArray::from_slice(b"an example very very secret key.");
let cipher = Aes256Gcm::new(key);
let cipher_text = encrypt_bytes_integral_nonce(&cipher, plaintext.clone()).unwrap();
let decrypted_text = decrypt_bytes_integral_nonce(&cipher, cipher_text).unwrap();
assert_eq!(decrypted_text, plaintext);
} | rust_cleaned_test_functions.jsonl/5394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66593,
80764,
368,
341,
286,
1077,
60847,
284,
293,
10022,
3974,
13876,
38835,
572,
29831,
3263,
983,
13251,
543,
286,
1077,
1376,
284,
21281,
1857,
486,
1499,
26488,
1883,
1,
276,
3110,
1602,
160... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_consensus_key_rotation() {
let mut swarm = TestEnvironment::new(5);
swarm.validator_swarm.launch();
// Load the node configs
let node_configs: Vec<_> = swarm
.validator_swarm
.config
.config_files
.iter()
.map(|config_path| NodeConfig::load(config_path).unwrap())
.collect();
let libra_interfaces: Vec<_> = (&node_configs)
.iter()
.map(|node_config| get_libra_interface(node_config))
.collect();
// Connect the operator tool to the first node's JSON RPC API
let node_config = (&node_configs).first().unwrap();
let op_tool = OperationalTool::new(
format!("http://127.0.0.1:{}", node_config.rpc.address.port()),
ChainId::test(),
);
// Load validator's on disk storage
let backend = load_backend_storage(&node_config);
// Setup an RPC endpoint so we can talk to the node
let validator_account = node_config.validator_network.as_ref().unwrap().peer_id();
let libra = (&libra_interfaces).first().unwrap();
// Rotate the consensus key
let (txn_ctx, new_consensus_key) = op_tool.rotate_consensus_key(&backend).unwrap();
let mut client = swarm.get_validator_client(0, None);
client
.wait_for_transaction(txn_ctx.address, txn_ctx.sequence_number + 1)
.unwrap();
// Verify that the config has been updated correctly with the new consensus key
let actual_key = libra
.retrieve_validator_config(validator_account)
.unwrap()
.consensus_public_key;
assert_eq!(new_consensus_key, actual_key);
} | rust_cleaned_test_functions.jsonl/62887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 654
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31971,
13626,
3097,
44813,
368,
341,
262,
1077,
5206,
60841,
284,
3393,
12723,
486,
931,
7,
20,
317,
262,
60841,
55110,
32581,
2178,
36452,
1428,
262,
442,
8893,
279,
2436,
42309,
198,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_install_nested_paths_copy_file() {
let (at, mut ucmd) = at_and_ucmd!();
let file1 = "source_file";
let dir1 = "source_dir";
let dir2 = "target_dir";
at.mkdir(dir1);
at.mkdir(dir2);
at.touch(&format!("{}/{}", dir1, file1));
ucmd.arg(format!("{}/{}", dir1, file1))
.arg(dir2)
.succeeds()
.no_stderr();
assert!(at.file_exists(&format!("{}/{}", dir2, file1)));
} | rust_cleaned_test_functions.jsonl/47032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
66279,
24152,
16096,
2458,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
16,
284,
330,
2427,
2458,
876,
262,
1077,
5419,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_suggestion_with_transpositions() {
assert_eq!(
suggestion_list("agr".intern(), &["arg".intern()], 5),
vec!["arg".intern()]
);
assert_eq!(
suggestion_list("214365879".intern(), &["123456789".intern()], 5),
vec!["123456789".intern()]
);
} | rust_cleaned_test_functions.jsonl/83030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
42116,
6615,
7965,
27436,
368,
341,
286,
2060,
10714,
33673,
310,
23776,
2019,
445,
68305,
3263,
55444,
1507,
609,
1183,
858,
3263,
55444,
79558,
220,
20,
1326,
310,
7486,
0,
1183,
858,
3263,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arithmetic_precedence_examples() {
assert_eq!(eval("1+3-2"), Ok(Value::Int(2)));
assert_eq!(eval("3+1*5"), Ok(Value::Int(8)));
assert_eq!(eval("2*3-5"), Ok(Value::Int(1)));
assert_eq!(eval("5-3/3"), Ok(Value::Int(4)));
assert_eq!(eval("5 / 4*2"), Ok(Value::Int(2)));
assert_eq!(eval("1-5 *3/15"), Ok(Value::Int(0)));
assert_eq!(eval("15/7/2.0"), Ok(Value::Float(1.0)));
assert_eq!(eval("15.0/7/2"), Ok(Value::Float(15.0 / 7.0 / 2.0)));
assert_eq!(eval("15.0/-7/2"), Ok(Value::Float(15.0 / -7.0 / 2.0)));
assert_eq!(eval("-15.0/7/2"), Ok(Value::Float(-15.0 / 7.0 / 2.0)));
assert_eq!(eval("-15.0/7/-2"), Ok(Value::Float(-15.0 / 7.0 / -2.0)));
} | rust_cleaned_test_functions.jsonl/105339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25842,
25922,
10442,
1998,
763,
45279,
368,
341,
262,
2060,
10714,
10297,
14170,
445,
16,
10,
18,
12,
17,
3975,
7622,
25346,
486,
1072,
7,
17,
4945,
262,
2060,
10714,
10297,
14170,
445,
18,
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_kubeconfig_path() {
let kubeconfig_location: PathBuf = kubeconfig_location_panic();
let kubeconfig_location: &str = kubeconfig_location.to_str().unwrap();
// Existing kubeconfig
let app: App = super::build_app();
let args_with_kubeconfig: Vec<&str> = vec![
"h2ok",
"deploy",
"--kubeconfig",
kubeconfig_location,
"--cluster_size",
"1",
"--version",
"latest",
];
let matches: ArgMatches = app.get_matches_from(args_with_kubeconfig);
let deploy: &ArgMatches = matches.subcommand_matches("deploy").unwrap();
assert!(deploy.is_present("kubeconfig"));
// No kubeconfig provided - default value provided
let app: App = super::build_app();
let args_no_kubeconfig: Vec<&str> = vec![
"h2ok",
"deploy",
"--cluster_size",
"1",
"--version",
"latest",
];
let matches: ArgMatches = app.get_matches_from(args_no_kubeconfig);
let deploy: &ArgMatches = matches.subcommand_matches("deploy").unwrap();
assert!(!deploy.is_present("kubeconfig"));
} | rust_cleaned_test_functions.jsonl/122954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
3760,
1676,
2638,
368,
341,
286,
1077,
80958,
1676,
13126,
25,
7933,
15064,
284,
80958,
1676,
13126,
620,
31270,
543,
286,
1077,
80958,
1676,
13126,
25,
609,
495,
284,
80958,
1676,
13126,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_g2() {
let mut rng = rand::thread_rng();
let msg: Vec<u8> = rng.sample_iter(&Standard).take(1000).collect();
let msg_end0: Vec<u8> = msg.iter().chain(b"end0").cloned().collect();
let msg_end1: Vec<u8> = msg.iter().chain(b"end1").cloned().collect();
assert_eq!(hash_g2(&msg), hash_g2(&msg));
assert_ne!(hash_g2(&msg), hash_g2(&msg_end0));
assert_ne!(hash_g2(&msg_end0), hash_g2(&msg_end1));
} | rust_cleaned_test_functions.jsonl/30569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
1889,
17,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
3750,
25,
11312,
34837,
23,
29,
284,
28422,
23882,
11723,
2099,
19781,
568,
22769,
7,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_utf_16_decode() {
decode_utf_16le(b"", "");
decode_utf_16be(b"", "");
decode_utf_16le(b"\x61\x00\x62\x00", "\u{0061}\u{0062}");
decode_utf_16be(b"\x00\x61\x00\x62", "\u{0061}\u{0062}");
decode_utf_16le(b"\xFE\xFF\x00\x61\x00\x62", "\u{0061}\u{0062}");
decode_utf_16be(b"\xFF\xFE\x61\x00\x62\x00", "\u{0061}\u{0062}");
decode_utf_16le(b"\x61\x00\x62", "\u{0061}\u{FFFD}");
decode_utf_16be(b"\x00\x61\x00", "\u{0061}\u{FFFD}");
decode_utf_16le(b"\x3D\xD8\xA9", "\u{FFFD}");
decode_utf_16be(b"\xD8\x3D\xDC", "\u{FFFD}");
decode_utf_16le(b"\x3D\xD8\xA9\xDC\x03\x26", "\u{1F4A9}\u{2603}");
decode_utf_16be(b"\xD8\x3D\xDC\xA9\x26\x03", "\u{1F4A9}\u{2603}");
decode_utf_16le(b"\xA9\xDC\x03\x26", "\u{FFFD}\u{2603}");
decode_utf_16be(b"\xDC\xA9\x26\x03", "\u{FFFD}\u{2603}");
decode_utf_16le(b"\x3D\xD8\x03\x26", "\u{FFFD}\u{2603}");
decode_utf_16be(b"\xD8\x3D\x26\x03", "\u{FFFD}\u{2603}");
// The \xFF makes sure that the parts before and after have different alignment
let long_le = b"\x00\x00\x00\x00\x00\x00\x00\x00\x3D\xD8\xA9\xDC\x00\x00\x00\x00\x00\x00\x00\x00\x3D\xD8\x00\x00\x00\x00\x00\x00\x00\x00\xA9\xDC\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3D\xD8\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x3D\xD8\xA9\xDC\x00\x00\x00\x00\x00\x00\x00\x00\x3D\xD8\x00\x00\x00\x00\x00\x00\x00\x00\xA9\xDC\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3D\xD8";
let long_be = b"\x00\x00\x00\x00\x00\x00\x00\x00\xD8\x3D\xDC\xA9\x00\x00\x00\x00\x00\x00\x00\x00\xD8\x3D\x00\x00\x00\x00\x00\x00\x00\x00\xDC\xA9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xD8\x3D\xFF\x00\x00\x00\x00\x00\x00\x00\x00\xD8\x3D\xDC\xA9\x00\x00\x00\x00\x00\x00\x00\x00\xD8\x3D\x00\x00\x00\x00\x00\x00\x00\x00\xDC\xA9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xD8\x3D";
let long_expect = "\x00\x00\x00\x00\u{1F4A9}\x00\x00\x00\x00\u{FFFD}\x00\x00\x00\x00\u{FFFD}\x00\x00\x00\x00\x00\x00\x00\x00\u{FFFD}";
decode_utf_16le(&long_le[..long_le.len() / 2], long_expect);
decode_utf_16be(&long_be[..long_be.len() / 2], long_expect);
decode_utf_16le(&long_le[long_le.len() / 2 + 1..], long_expect);
decode_utf_16be(&long_be[long_be.len() / 2 + 1..], long_expect);
} | rust_cleaned_test_functions.jsonl/86892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1613
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
62,
16,
21,
15227,
368,
341,
286,
16895,
39453,
62,
16,
21,
273,
1883,
56323,
14498,
286,
16895,
39453,
62,
16,
21,
1371,
1883,
56323,
50970,
286,
16895,
39453,
62,
16,
21,
273,
1883,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stdin_stdout_count() {
let input = build_ascii_block(521);
let mut output = String::from_utf8(input.clone()).unwrap();
output.truncate(256);
new_ucmd!()
.args(&["status=none", "count=2", "ibs=128"])
.pipe_in(input)
.run()
.no_stderr()
.stdout_only(output);
} | rust_cleaned_test_functions.jsonl/59377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
67416,
3180,
368,
341,
262,
1077,
1946,
284,
1936,
50238,
7113,
7,
20,
17,
16,
317,
262,
1077,
5206,
2550,
284,
923,
486,
1499,
39453,
23,
5384,
15997,
6011,
15454,
543,
262,
2550,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_pool_pop_client_and_take_database_and_collection() {
let uri = Uri::new("mongodb://localhost:27017/").unwrap();
let pool = ClientPool::new(uri.clone(), None);
assert_eq!(pool.get_uri(), &uri);
// Pop a client and take database and collection
let client = pool.pop();
let database = client.take_database("rust_test");
assert_eq!("rust_test", database.get_name().to_mut());
let collection = database.take_collection("items");
assert_eq!("items", collection.get_name().to_mut());
} | rust_cleaned_test_functions.jsonl/22217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
15709,
17061,
8179,
8378,
73261,
27341,
8378,
25019,
368,
341,
262,
1077,
13071,
284,
17226,
486,
931,
445,
37197,
1110,
8301,
25,
17,
22,
15,
16,
22,
14,
1827,
15454,
543,
262,
1077,
7314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_array_agg() -> Result<()> {
let array = DFBooleanArray::new_from_slice(&vec![true, false, true]);
let value = [
array.sum()?,
array.max()?,
array.min()?,
array.arg_min()?,
array.arg_max()?,
];
let expected = [
DataValue::UInt32(Some(2)),
DataValue::UInt32(Some(1)),
DataValue::UInt32(Some(0)),
DataValue::Struct(vec![
DataValue::UInt64(Some(1)),
DataValue::Boolean(Some(false)),
]),
DataValue::Struct(vec![
DataValue::UInt64(Some(0)),
DataValue::Boolean(Some(true)),
]),
];
let len = value.len();
for i in 0..len {
assert_eq!(value[i], expected[i]);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/19222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
3858,
83534,
368,
1464,
5714,
71698,
341,
262,
1077,
1334,
284,
43376,
6890,
1857,
486,
931,
5673,
26488,
2099,
4083,
20703,
1866,
11,
895,
11,
830,
10149,
262,
1077,
897,
284,
2278,
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... | 7 |
#[test]
fn test_set_mmio_bus() {
let (_, mut vcpu, _) = setup_vcpu(0x1000);
assert!(vcpu.mmio_bus.is_none());
vcpu.set_mmio_bus(devices::Bus::new());
assert!(vcpu.mmio_bus.is_some());
} | rust_cleaned_test_functions.jsonl/99240 | {
"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,
2602,
35599,
815,
25418,
368,
341,
286,
1077,
39464,
5206,
348,
16475,
11,
27439,
284,
6505,
2273,
16475,
7,
15,
87,
16,
15,
15,
15,
317,
286,
2060,
10297,
85,
16475,
37008,
815,
25418,
2079,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_publish() {
let packet = Publish {
dup: false,
qospid: QosPid::from_u8u16(2, 10),
retain: true,
topic_name: "asdf",
payload: &['h' as u8, 'e' as u8, 'l' as u8, 'l' as u8, 'o' as u8],
}
.into();
assert_decode_slice!(Packet::Publish(_), &packet, 15);
} | rust_cleaned_test_functions.jsonl/59348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58779,
368,
341,
262,
1077,
10151,
284,
23499,
341,
286,
22737,
25,
895,
345,
286,
2804,
4785,
307,
25,
1207,
436,
32339,
486,
1499,
7300,
23,
84,
16,
21,
7,
17,
11,
220,
16,
15,
1326,
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_replace() {
use crate::hash;
#[derive(Debug)]
struct Foo(&'static str, i32);
impl PartialEq for Foo {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
impl Eq for Foo {}
impl hash::Hash for Foo {
fn hash<H: hash::Hasher>(&self, h: &mut H) {
self.0.hash(h);
}
}
let mut s = HashSet::new();
assert_eq!(s.replace(Foo("a", 1)), None);
assert_eq!(s.len(), 1);
assert_eq!(s.replace(Foo("a", 2)), Some(Foo("a", 1)));
assert_eq!(s.len(), 1);
let mut it = s.iter();
assert_eq!(it.next(), Some(&Foo("a", 2)));
assert_eq!(it.next(), None);
} | rust_cleaned_test_functions.jsonl/24145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
368,
341,
286,
990,
17717,
486,
8296,
401,
286,
11506,
27098,
42618,
5563,
286,
2036,
33428,
2099,
6,
1978,
607,
11,
600,
18,
17,
626,
286,
11605,
55039,
369,
33428,
341,
310,
5168,
8939,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum() {
#[derive(Debug, PartialEq, Valuable, Serialize)]
enum E {
Unit,
Newtype(u8),
Tuple(u8, u8),
Struct { f: u8 },
}
// TODO:
// - valuable treats unit variant as an empty tuple variant
// - serde treats unit variant as unit variant
assert_ser_tokens(
&Serializable::new(E::Unit),
&[
Token::Enum { name: "E" },
Token::Str("Unit"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
],
);
assert_ser_tokens(
&E::Unit,
&[Token::Enum { name: "E" }, Token::Str("Unit"), Token::Unit],
);
assert_ser_eq!(
E::Newtype(0),
&[
Token::Enum { name: "E" },
Token::Str("Newtype"),
Token::U8(0),
],
);
assert_ser_eq!(
E::Tuple(0, 0),
&[
Token::Enum { name: "E" },
Token::Str("Tuple"),
Token::Seq { len: Some(2) },
Token::U8(0),
Token::U8(0),
Token::SeqEnd,
],
);
assert_ser_eq!(
E::Struct { f: 0 },
&[
Token::Enum { name: "E" },
Token::Str("Struct"),
Token::Map { len: Some(1) },
Token::Str("f"),
Token::U8(0),
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/44221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 797
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
4104,
13128,
11,
39900,
5563,
262,
7618,
468,
341,
286,
7954,
345,
286,
1532,
1313,
8154,
23,
1326,
286,
24622,
8154,
23,
11,
575,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sine_large_buffer() {
let mut signal = Sine::new(2.0, 8);
let mut buffer = vec![0.0;10];
let _ = signal.write_buffer(&mut buffer);
let _ = signal.write_buffer(&mut buffer);
assert_approx_eq!(buffer[0], 0.0, 1e-5f32);
assert_approx_eq!(buffer[1], -1.0, 1e-5f32);
assert_approx_eq!(buffer[2], 0.0, 1e-5f32);
assert_approx_eq!(buffer[3], 1.0, 1e-5f32);
} | rust_cleaned_test_functions.jsonl/93722 | {
"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,
643,
482,
45228,
7776,
368,
341,
286,
1077,
5206,
8286,
284,
328,
482,
486,
931,
7,
17,
13,
15,
11,
220,
23,
317,
286,
1077,
5206,
4147,
284,
7486,
20703,
15,
13,
15,
26,
16,
15,
935,
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_check_payer_balances_distribute_stakes_single_payer() {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees, None);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
let sender_keypair_file = tmp_file_path("keypair_file", &alice.pubkey());
write_keypair_file(&alice, &sender_keypair_file).unwrap();
let allocation_amount = 1000.0;
let unlocked_sol = 1.0;
let stake_args = initialize_stake_account(
sol_to_lamports(allocation_amount),
sol_to_lamports(unlocked_sol),
&alice,
&client,
);
let (allocations, mut args) = initialize_check_payer_balances_inputs(
sol_to_lamports(allocation_amount),
&sender_keypair_file,
&sender_keypair_file,
Some(stake_args),
);
check_payer_balances(1, &allocations, &client, &args).unwrap();
// Underfunded stake-account
let expensive_allocation_amount = 5000.0;
let expensive_allocations = vec![Allocation {
recipient: solana_sdk::pubkey::new_rand().to_string(),
amount: sol_to_lamports(expensive_allocation_amount),
lockup_date: "".to_string(),
}];
let err_result =
check_payer_balances(1, &expensive_allocations, &client, &args).unwrap_err();
if let Error::InsufficientFunds(sources, amount) = err_result {
assert_eq!(sources, vec![FundingSource::StakeAccount].into());
assert_eq!(
amount,
(expensive_allocation_amount - unlocked_sol).to_string()
);
} else {
panic!("check_payer_balances should have errored");
}
// Unfunded payer
let unfunded_payer = Keypair::new();
let unfunded_payer_keypair_file = tmp_file_path("keypair_file", &unfunded_payer.pubkey());
write_keypair_file(&unfunded_payer, &unfunded_payer_keypair_file).unwrap();
args.sender_keypair = read_keypair_file(&unfunded_payer_keypair_file)
.unwrap()
.into();
args.fee_payer = read_keypair_file(&unfunded_payer_keypair_file)
.unwrap()
.into();
let err_result = check_payer_balances(1, &allocations, &client, &args).unwrap_err();
if let Error::InsufficientFunds(sources, amount) = err_result {
assert_eq!(
sources,
vec![FundingSource::SystemAccount, FundingSource::FeePayer].into()
);
assert_eq!(amount, (unlocked_sol + fees_in_sol).to_string());
} else {
panic!("check_payer_balances should have errored");
}
// Payer funded enough for distribution only
let partially_funded_payer = Keypair::new();
let partially_funded_payer_keypair_file =
tmp_file_path("keypair_file", &partially_funded_payer.pubkey());
write_keypair_file(
&partially_funded_payer,
&partially_funded_payer_keypair_file,
)
.unwrap();
let transaction = transfer(
&client,
sol_to_lamports(unlocked_sol),
&alice,
&partially_funded_payer.pubkey(),
)
.unwrap();
client
.send_and_confirm_transaction_with_spinner(&transaction)
.unwrap();
args.sender_keypair = read_keypair_file(&partially_funded_payer_keypair_file)
.unwrap()
.into();
args.fee_payer = read_keypair_file(&partially_funded_payer_keypair_file)
.unwrap()
.into();
let err_result = check_payer_balances(1, &allocations, &client, &args).unwrap_err();
if let Error::InsufficientFunds(sources, amount) = err_result {
assert_eq!(
sources,
vec![FundingSource::SystemAccount, FundingSource::FeePayer].into()
);
assert_eq!(amount, (unlocked_sol + fees_in_sol).to_string());
} else {
panic!("check_payer_balances should have errored");
}
} | rust_cleaned_test_functions.jsonl/50197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2091
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
620,
1135,
56441,
3020,
814,
80133,
1261,
2050,
19487,
620,
1135,
368,
341,
286,
1077,
12436,
284,
220,
16,
15,
62,
15,
15,
15,
280,
286,
1077,
12436,
1243,
53668,
284,
31603,
3394,
2346,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_retain() {
let mut v = ArrayVec::from([0; 8]);
for (i, elt) in v.iter_mut().enumerate() {
*elt = i;
}
v.retain(|_| true);
assert_eq!(&v[..], &[0, 1, 2, 3, 4, 5, 6, 7]);
v.retain(|elt| {
*elt /= 2;
*elt % 2 == 0
});
assert_eq!(&v[..], &[0, 0, 2, 2]);
v.retain(|_| false);
assert_eq!(&v[..], &[]);
} | rust_cleaned_test_functions.jsonl/36773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21695,
466,
368,
341,
262,
1077,
5206,
348,
284,
2910,
10050,
486,
1499,
2561,
15,
26,
220,
23,
2558,
262,
369,
320,
72,
11,
54139,
8,
304,
348,
19471,
29523,
1005,
76569,
368,
341,
286,
353,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_try_from_alogithm_id() {
assert_eq!(
HashingAlgorithm::try_from(TPM2_ALG_SHA1).unwrap(),
HashingAlgorithm::Sha1
);
assert_eq!(
HashingAlgorithm::try_from(TPM2_ALG_SHA256).unwrap(),
HashingAlgorithm::Sha256
);
assert_eq!(
HashingAlgorithm::try_from(TPM2_ALG_SHA384).unwrap(),
HashingAlgorithm::Sha384
);
assert_eq!(
HashingAlgorithm::try_from(TPM2_ALG_SHA512).unwrap(),
HashingAlgorithm::Sha512
);
assert_eq!(
HashingAlgorithm::try_from(TPM2_ALG_SM3_256).unwrap(),
HashingAlgorithm::Sm3_256
);
assert_eq!(
HashingAlgorithm::try_from(TPM2_ALG_SHA3_256).unwrap(),
HashingAlgorithm::Sha3_256
);
assert_eq!(
HashingAlgorithm::try_from(TPM2_ALG_SHA3_384).unwrap(),
HashingAlgorithm::Sha3_384
);
assert_eq!(
HashingAlgorithm::try_from(TPM2_ALG_SHA3_512).unwrap(),
HashingAlgorithm::Sha3_512
);
assert!(
HashingAlgorithm::try_from(TPM2_ALG_ERROR).is_err(),
"Error should not exist in HashingAlgorithm"
);
} | rust_cleaned_test_functions.jsonl/41502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 730
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
6531,
287,
27847,
486,
1539,
5673,
4140,
8795,
17,
8912,
38,
38096,
16,
568,
15454,
3148,
310,
6531,
287,
27847,
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_real_any_value() {
let test_cases = vec![
(vec![], None),
(vec![Real::from(1.2_f64)], Some(Real::from(1.2_f64))),
(
vec![Real::from(1.2_f64), Real::from(2.3_f64)],
Some(Real::from(1.2_f64)),
),
(
vec![Real::from(1.2_f64), Real::from(2.3_f64), Real::from(3_f64)],
Some(Real::from(1.2_f64)),
),
];
for (args, expect_output) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_params(args)
.evaluate::<Real>(ScalarFuncSig::RealAnyValue)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/59408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
37248,
3142,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
4083,
0,
12995,
2240,
1326,
310,
320,
4083,
20703,
12768,
486,
1499,
7,
16,
13,
17,
761,
21,
19,
25035,
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... | 2 |
#[test]
fn test_take_nonpod_by_ptr_in_method() {
let hdr = indoc! {"
#include <cstdint>
#include <memory>
struct Bob {
uint32_t a;
};
#include <cstdint>
class A {
public:
A() {};
uint32_t take_bob(const Bob* a) const {
return a->a;
}
std::unique_ptr<Bob> make_bob(uint32_t a) const {
auto b = std::make_unique<Bob>();
b->a = a;
return b;
}
uint16_t a;
};
"};
let rs = quote! {
let a = ffi::A::make_unique();
let b = a.as_ref().unwrap().make_bob(12);
let b_ptr = b.into_raw();
assert_eq!(unsafe { a.as_ref().unwrap().take_bob(b_ptr) }, 12);
unsafe { cxx::UniquePtr::from_raw(b_ptr) }; // so we drop
};
run_test("", hdr, rs, &["A", "Bob"], &[]);
} | rust_cleaned_test_functions.jsonl/9743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
21637,
39073,
3710,
4348,
1243,
9032,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
96975,
397,
286,
671,
997,
366,
17269,
397,
286,
2036,
14261,
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_encoder_valid() {
let mut e = UTF_16BE.encoder();
assert_feed_ok!(e, "\u0000\
\u0001\u0002\u0004\u0008\
\u0010\u0020\u0040\u0080\
\u0100\u0200\u0400\u0800\
\u1000\u2000\u4000\u8000\
\uffff", "",
[0x00, 0x00,
0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08,
0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80,
0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00,
0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00,
0xff, 0xff]);
assert_feed_ok!(e, "\U00010000\
\U00010001\U00010002\
\U00010004\U00010008\
\U00010010\U00010020\
\U00010040\U00010080\
\U00010100\U00010200\
\U00010400\U00010800\
\U00011000\U00012000\
\U00014000\U00018000\
\U00020000\U00030000\
\U00050000\U00090000\
\U0010FFFF", "",
[0xd8, 0x00, 0xdc, 0x00,
0xd8, 0x00, 0xdc, 0x01, 0xd8, 0x00, 0xdc, 0x02,
0xd8, 0x00, 0xdc, 0x04, 0xd8, 0x00, 0xdc, 0x08,
0xd8, 0x00, 0xdc, 0x10, 0xd8, 0x00, 0xdc, 0x20,
0xd8, 0x00, 0xdc, 0x40, 0xd8, 0x00, 0xdc, 0x80,
0xd8, 0x00, 0xdd, 0x00, 0xd8, 0x00, 0xde, 0x00,
0xd8, 0x01, 0xdc, 0x00, 0xd8, 0x02, 0xdc, 0x00,
0xd8, 0x04, 0xdc, 0x00, 0xd8, 0x08, 0xdc, 0x00,
0xd8, 0x10, 0xdc, 0x00, 0xd8, 0x20, 0xdc, 0x00,
0xd8, 0x40, 0xdc, 0x00, 0xd8, 0x80, 0xdc, 0x00,
0xd9, 0x00, 0xdc, 0x00, 0xda, 0x00, 0xdc, 0x00,
0xdb, 0xff, 0xdf, 0xff]);
assert_finish_ok!(e, []);
} | rust_cleaned_test_functions.jsonl/15675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1671
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39068,
8337,
368,
341,
286,
1077,
5206,
384,
284,
20076,
62,
16,
21,
11594,
69042,
543,
286,
2060,
42390,
19817,
10297,
68,
11,
2917,
84,
15,
15,
15,
15,
5661,
999,
1124,
84,
15,
15,
15,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assembler_flag_ops() {
test_case(&["ADX B, A"], &[0x003a]);
test_case(&["SBX B, A"], &[0x003b]);
test_case(&["STI B, A"], &[0x003e]);
test_case(&["STD B, A"], &[0x003f]);
} | rust_cleaned_test_functions.jsonl/44762 | {
"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,
11898,
35401,
10933,
21959,
368,
341,
262,
1273,
19096,
2099,
1183,
83172,
425,
11,
362,
7914,
44590,
15,
87,
15,
15,
18,
64,
2558,
262,
1273,
19096,
2099,
1183,
16680,
55,
425,
11,
362,
7914,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_field_clear() {
assert_eq!(bit_field_clear(0xFFFF_FFFF, 0, 0), 0xFFFF_FFFE);
assert_eq!(bit_field_clear(0xFFFF_FFFF, 31, 31), 0x7FFF_FFFF);
assert_eq!(bit_field_clear(0xFFFF_FFFF, 31, 0), 0x0000_0000);
assert_eq!(bit_field_clear(0xFFFF_FFFF, 10, 8), 0xFFFF_F8FF);
} | rust_cleaned_test_functions.jsonl/50754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
5013,
21811,
368,
341,
286,
2060,
10714,
10297,
4489,
5013,
21811,
7,
15,
14384,
1400,
31203,
11,
220,
15,
11,
220,
15,
701,
220,
15,
14384,
1400,
79094,
317,
286,
2060,
10714,
10297,
448... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_field_type() {
let test = Foo;
let _: AtomicUsize = test.field1();
let _: AtomicUsize = test.field2();
let _: AtomicUsize = test.field3();
let _: AtomicUsize = test.field4();
let _: AtomicUsize = test.field5();
let _: AtomicUsize = test.field6();
let _: AtomicUsize = test.field7();
let _: AtomicUsize = test.field8();
let _: Vec<AtomicUsize> = test.field9();
let _: Vec<AtomicUsize> = test.field10();
let _: Vec<AtomicUsize> = test.field11();
let _: Vec<AtomicUsize> = test.field12();
let _: Vec<AtomicUsize> = test.field13();
let _: Vec<AtomicUsize> = test.field14();
let _: Vec<AtomicUsize> = test.field15();
let _: Vec<AtomicUsize> = test.field16();
let _: &str = test.field17();
let _: &str = test.field18();
let _: &'static str = test.field19();
let _: &'static str = test.field20();
} | rust_cleaned_test_functions.jsonl/2279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
1819,
368,
341,
286,
1077,
1273,
284,
33428,
280,
286,
1077,
58536,
30316,
52,
2141,
284,
1273,
16454,
16,
543,
286,
1077,
58536,
30316,
52,
2141,
284,
1273,
16454,
17,
543,
286,
1077,
585... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escaping() {
let query = Timestamp::Hours(11)
.into_query("wea, ther=")
.add_field("temperature", 82)
.add_field("\"temp=era,t ure\"", r#"too"\\hot"#)
.add_field("float", 82.0)
.add_tag("location", "us-midwest")
.add_tag("loc, =\"ation", r#"us, "mid=west"#)
.build();
assert!(query.is_ok(), "Query was empty");
let query_res = query.unwrap().get();
assert_eq!(
query_res,
r#"wea\,\ ther=,location=us-midwest,loc\,\ \="ation=us\,\ \"mid\=west temperature=82i,"temp\=era\,t\ ure"="too\"\\\\hot",float=82 11"#
);
} | rust_cleaned_test_functions.jsonl/40010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
42480,
368,
341,
286,
1077,
3239,
284,
32758,
486,
23235,
7,
16,
16,
340,
310,
659,
18122,
5738,
445,
896,
64,
11,
8962,
428,
340,
310,
659,
718,
5013,
445,
34558,
497,
220,
23,
17,
340,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mock_vm_different_senders() {
let amount = 100;
let mut txns = vec![];
for i in 0..10 {
txns.push(encode_mint_transaction(gen_address(i), amount));
}
let outputs = MockVM::execute_block(txns.clone(), &MockStateView)
.expect("MockVM should not fail to start");
for (output, txn) in itertools::zip_eq(outputs.iter(), txns.iter()) {
let sender = txn.as_signed_user_txn().unwrap().sender();
assert_eq!(
output.write_set().iter().cloned().collect::<Vec<_>>(),
vec![
(
balance_ap(sender),
WriteOp::Value(amount.to_le_bytes().to_vec())
),
(
seqnum_ap(sender),
WriteOp::Value(1u64.to_le_bytes().to_vec())
),
]
);
}
} | rust_cleaned_test_functions.jsonl/99279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34134,
39008,
82741,
13565,
388,
368,
341,
262,
1077,
3311,
284,
220,
16,
15,
15,
280,
262,
1077,
5206,
9854,
4412,
284,
7486,
0,
15078,
262,
369,
600,
304,
220,
15,
496,
16,
15,
341,
286,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_flattening() {
check_highlighting(
r##"
fn fixture(ra_fixture: &str) {}
fn main() {
fixture(r#"
trait Foo {
fn foo() {
println!("2 + 2 = {}", 4);
}
}"#
);
}"##
.trim(),
expect_file!["./test_data/highlight_injection.html"],
false,
);
} | rust_cleaned_test_functions.jsonl/5122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5081,
1587,
6019,
368,
341,
262,
1779,
74546,
287,
1006,
286,
435,
565,
698,
8822,
12507,
82034,
74409,
25,
609,
495,
8,
10086,
8822,
1887,
368,
341,
262,
12507,
2601,
2,
698,
286,
17567,
33428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_twos_comp_apd_primitive() {
fn inner_inner<P>(i: P, i_be_bytes: &mut [u8])
where
P: Into<Numeric> + TryFrom<Numeric> + Eq + PartialEq + std::fmt::Debug + Copy,
{
use std::convert::TryInto;
let mut e = [0; Numeric::TWOS_COMPLEMENT_BYTE_WIDTH];
e[Numeric::TWOS_COMPLEMENT_BYTE_WIDTH - i_be_bytes.len()..].copy_from_slice(&i_be_bytes);
let mut w = [0; NumericAgg::TWOS_COMPLEMENT_BYTE_WIDTH];
w[NumericAgg::TWOS_COMPLEMENT_BYTE_WIDTH - i_be_bytes.len()..].copy_from_slice(&i_be_bytes);
let d: Numeric = i.into();
// Extend negative sign into most-significant bits
if d.is_negative() {
for i in e[..Numeric::TWOS_COMPLEMENT_BYTE_WIDTH - i_be_bytes.len()].iter_mut() {
*i = 0xFF;
}
for i in w[..NumericAgg::TWOS_COMPLEMENT_BYTE_WIDTH - i_be_bytes.len()].iter_mut() {
*i = 0xFF;
}
}
// Ensure decimal value's two's complement representation matches an
// extended version of `to_be_bytes`.
let d_be_bytes = numeric_to_twos_complement_be(d);
assert_eq!(
e, d_be_bytes,
"expected repr of {:?}, got {:?}",
e, d_be_bytes
);
// Ensure extended version of `to_be_bytes` generates same `i128`.
let e_numeric = twos_complement_be_to_numeric(&mut e, 0).unwrap();
let e_p: P = match e_numeric.try_into() {
Ok(e_p) => e_p,
Err(_) => panic!(),
};
assert_eq!(i, e_p, "expected val of {:?}, got {:?}", i, e_p);
// Wide representation produces same result.
let w_numeric = twos_complement_be_to_numeric(&mut w, 0).unwrap();
let w_p: P = match w_numeric.try_into() {
Ok(w_p) => w_p,
Err(_) => panic!(),
};
assert_eq!(i, w_p, "expected val of {:?}, got {:?}", i, e_p);
// Bytes do not need to be in `Numeric`-specific format
let p_numeric = twos_complement_be_to_numeric(i_be_bytes, 0).unwrap();
let p_p: P = match p_numeric.try_into() {
Ok(p_p) => p_p,
Err(_) => panic!(),
};
assert_eq!(i, p_p, "expected val of {:?}, got {:?}", i, p_p);
}
fn inner_i32(i: i32) {
inner_inner(i, &mut i.to_be_bytes());
}
fn inner_i64(i: i64) {
inner_inner(i, &mut i.to_be_bytes());
}
// We need a wrapper around i128 to implement the same traits as the other
// primitive types. This is less code than a second implementation of the
// same test that takes unwrapped i128s.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
struct FromableI128 {
i: i128,
}
impl From<i128> for FromableI128 {
fn from(i: i128) -> FromableI128 {
FromableI128 { i }
}
}
impl From<FromableI128> for Numeric {
fn from(n: FromableI128) -> Numeric {
Numeric::try_from(n.i).unwrap()
}
}
impl TryFrom<Numeric> for FromableI128 {
type Error = ();
fn try_from(n: Numeric) -> Result<FromableI128, Self::Error> {
match i128::try_from(n) {
Ok(i) => Ok(FromableI128 { i }),
Err(_) => Err(()),
}
}
}
fn inner_i128(i: i128) {
inner_inner(FromableI128::from(i), &mut i.to_be_bytes());
}
inner_i32(0);
inner_i32(1);
inner_i32(2);
inner_i32(-1);
inner_i32(-2);
inner_i32(i32::MAX);
inner_i32(i32::MIN);
inner_i32(i32::MAX / 7 + 7);
inner_i32(i32::MIN / 7 + 7);
inner_i64(0);
inner_i64(1);
inner_i64(2);
inner_i64(-1);
inner_i64(-2);
inner_i64(i64::MAX);
inner_i64(i64::MIN);
inner_i64(i64::MAX / 7 + 7);
inner_i64(i64::MIN / 7 + 7);
inner_i128(0);
inner_i128(1);
inner_i128(2);
inner_i128(-1);
inner_i128(-2);
inner_i128(i64::MAX as i128);
inner_i128(i64::MIN as i128);
inner_i128(i128::MAX);
inner_i128(i128::MIN);
inner_i128(i128::MAX / 7 + 7);
inner_i128(i128::MIN / 7 + 7);
} | rust_cleaned_test_functions.jsonl/22110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54178,
436,
18177,
21093,
67,
84087,
368,
341,
262,
5168,
9179,
34345,
21604,
2235,
72,
25,
393,
11,
600,
21263,
12524,
25,
609,
6984,
508,
84,
23,
2546,
262,
1380,
198,
286,
393,
25,
31645,
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... | 8 |
#[test]
fn test_update_old() {
let mut crds = Crds::default();
let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default()));
assert_eq!(crds.insert(val.clone(), 0), Ok(None));
assert_eq!(crds.insert(val.clone(), 1), Err(CrdsError::InsertFailed));
assert_eq!(crds.table[&val.label()].local_timestamp, 0);
} | rust_cleaned_test_functions.jsonl/94330 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
21108,
368,
341,
286,
1077,
5206,
1560,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
1044,
284,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
8732,
1731,
99102,
1731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ani() {
let mut state = State8080::empty_state();
state.memory = vec![0xe6, 0x0f];
state.a = 0x3a;
emulate_8080_op(&mut state);
assert_eq!(state.a, 0x0a);
} | rust_cleaned_test_functions.jsonl/7785 | {
"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,
62,
5559,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
8371,
21,
11,
220,
15,
87,
15,
69,
935,
286,
1584,
5849,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_strings() {
let parsed_data = common::get_file_content_parsed(PARENT_FOLDER, "literal.ura").unwrap();
assert_eq!(parsed_data, get_expected_literal());
} | rust_cleaned_test_functions.jsonl/11163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34100,
33500,
368,
341,
262,
1077,
15676,
1769,
284,
4185,
486,
455,
2458,
7495,
75788,
5304,
28155,
33637,
11,
330,
35785,
13,
5690,
1827,
15454,
543,
262,
2060,
10714,
10297,
41030,
1769,
11,
63... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_source_distribution() {
let metadata =
get_metadata_for_distribution(Path::new("test-data/pyo3_mixed-2.1.1.tar.gz")).unwrap();
let expected: Vec<_> = [
("Metadata-Version", "2.1"),
("Name", "pyo3-mixed"),
("Version", "2.1.1"),
("Summary", "Implements a dummy function combining rust and python"),
("Author", "konstin <konstin@mailbox.org>"),
("Author-Email", "konstin <konstin@mailbox.org>"),
("Description-Content-Type", "text/markdown; charset=UTF-8; variant=GFM"),
("Description", "# pyo3-mixed\n\nA package for testing maturin with a mixed pyo3/python project.\n\n"),
].iter().map(|(k,v)| (k.to_string(), v.to_string())).collect();
assert_eq!(metadata, expected);
} | rust_cleaned_test_functions.jsonl/76448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10347,
41465,
368,
341,
286,
1077,
11160,
4035,
310,
633,
22220,
5478,
41465,
33030,
486,
931,
445,
1944,
13945,
90834,
78,
18,
717,
3286,
12,
17,
13,
16,
13,
16,
28048,
20963,
15197,
15454,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_column_writer_check_metadata() {
let page_writer = get_test_page_writer();
let props = Arc::new(WriterProperties::builder().build());
let mut writer = get_test_column_writer::<Int32Type>(page_writer, 0, 0, props);
writer.write_batch(&[1, 2, 3, 4], None, None).unwrap();
let (bytes_written, rows_written, metadata) = writer.close().unwrap();
assert_eq!(bytes_written, 20);
assert_eq!(rows_written, 4);
assert_eq!(
metadata.encodings(),
&vec![Encoding::PLAIN, Encoding::RLE_DICTIONARY, Encoding::RLE]
);
assert_eq!(metadata.num_values(), 8); // dictionary + value indexes
assert_eq!(metadata.compressed_size(), 20);
assert_eq!(metadata.uncompressed_size(), 20);
assert_eq!(metadata.data_page_offset(), 0);
assert_eq!(metadata.dictionary_page_offset(), Some(0));
if let Some(stats) = metadata.statistics() {
assert!(stats.has_min_max_set());
assert_eq!(stats.null_count(), 0);
assert_eq!(stats.distinct_count(), None);
if let Statistics::Int32(stats) = stats {
assert_eq!(stats.min(), &1);
assert_eq!(stats.max(), &4);
} else {
panic!("expecting Statistics::Int32");
}
} else {
panic!("metadata missing statistics");
}
} | rust_cleaned_test_functions.jsonl/54356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 672
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
28908,
7200,
22220,
368,
341,
286,
1077,
2150,
28908,
284,
633,
4452,
6129,
28908,
543,
286,
1077,
6914,
284,
19689,
486,
931,
7,
6492,
7903,
486,
17850,
1005,
5834,
1423,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_with_vars_unset_set() {
env::set_var("MY_VAR", "my_var");
let my_var_is_set = env::var("MY_VAR").unwrap();
assert_eq!(
my_var_is_set, "my_var",
"`MY_VAR` must be set to \"my_var`\"."
);
crate::with_vars(
vec![("MY_VAR", None::<&str>), ("MY_VAR", Some("new value"))],
|| {
let my_var_is_set_new = env::var("MY_VAR").unwrap();
assert_eq!(
my_var_is_set_new, "new value",
"`MY_VAR` must be set to \"new value\"."
);
},
);
let my_var_is_set_after = env::var("MY_VAR").unwrap();
assert_eq!(
my_var_is_set_after, "my_var",
"`MY_VAR` must be set to \"my_var\"."
);
} | rust_cleaned_test_functions.jsonl/49890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 507
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
11168,
98109,
2602,
368,
341,
286,
6105,
486,
746,
4612,
445,
19159,
25750,
497,
330,
2408,
4612,
797,
286,
1077,
847,
4612,
6892,
2602,
284,
6105,
486,
947,
445,
19159,
25750,
1827,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_user_find_by_id() {
let pool = BDPool::new().unwrap();
let con = pool.get().unwrap();
let result = User::find_by_id(&con, 1).unwrap();
let expected = User {
id: 1,
email: "user_a@email.com".to_string(),
name: "user_a".to_string(),
password: "1464ACD6765F91FCCD3F5BF4F14EBB7CA69F53AF91B0A5790C2BBA9D8819417B".to_string(),
create_time: SystemTime::now(),
update_time: SystemTime::now(),
};
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/32733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
21814,
3710,
842,
368,
341,
262,
1077,
7314,
284,
425,
10298,
1749,
486,
931,
1005,
15454,
543,
262,
1077,
390,
284,
7314,
670,
1005,
15454,
1428,
262,
1077,
1102,
284,
2657,
486,
3903,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_and_from_bytes_with_additional_bytes() -> Result<(), Error> {
let kp = SampiKeyPair::new();
let data = SampiData::String("Hello, World".to_string());
let s = kp.new_sampi().build(vec![data.clone()])?;
assert_eq!(s.data(), &vec![data]);
let mut bytes = s.to_bytes();
let original_bytes_length = bytes.len();
bytes.extend_from_slice(&[2, 18, 33, 55]);
assert_eq!(
&Sampi::from_bytes(&bytes)?.to_bytes()[..],
&bytes[..original_bytes_length]
);
let s_from_bytes = Sampi::from_bytes(&bytes)?;
assert_eq!(s.data(), s_from_bytes.data());
Ok(())
} | rust_cleaned_test_functions.jsonl/67860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
8378,
5673,
12524,
6615,
81742,
12524,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
60319,
284,
90174,
72,
1592,
12443,
486,
931,
543,
262,
1077,
821,
284,
90174,
72,
1043,
486,
703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_validate_dynamic_offers_okay() {
assert_eq!(
validate_dynamic_offers(&vec![
fdecl::Offer::Protocol(fdecl::OfferProtocol {
dependency_type: Some(fdecl::DependencyType::Strong),
source: Some(fdecl::Ref::Self_(fdecl::SelfRef)),
source_name: Some("thing".to_string()),
target_name: Some("thing".to_string()),
..fdecl::OfferProtocol::EMPTY
}),
fdecl::Offer::Service(fdecl::OfferService {
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
source_name: Some("thang".to_string()),
target_name: Some("thang".to_string()),
..fdecl::OfferService::EMPTY
}),
fdecl::Offer::Directory(fdecl::OfferDirectory {
dependency_type: Some(fdecl::DependencyType::Strong),
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
source_name: Some("thung1".to_string()),
target_name: Some("thung1".to_string()),
..fdecl::OfferDirectory::EMPTY
}),
fdecl::Offer::Storage(fdecl::OfferStorage {
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
source_name: Some("thung2".to_string()),
target_name: Some("thung2".to_string()),
..fdecl::OfferStorage::EMPTY
}),
fdecl::Offer::Runner(fdecl::OfferRunner {
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
source_name: Some("thung3".to_string()),
target_name: Some("thung3".to_string()),
..fdecl::OfferRunner::EMPTY
}),
fdecl::Offer::Resolver(fdecl::OfferResolver {
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
source_name: Some("thung4".to_string()),
target_name: Some("thung4".to_string()),
..fdecl::OfferResolver::EMPTY
}),
fdecl::Offer::Event(fdecl::OfferEvent {
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
source_name: Some("thung5".to_string()),
target_name: Some("thung5".to_string()),
mode: Some(fdecl::EventMode::Async),
..fdecl::OfferEvent::EMPTY
}),
]),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/82026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1512
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
45992,
13651,
388,
19817,
352,
368,
341,
286,
2060,
10714,
33673,
310,
9593,
45992,
13651,
388,
2099,
4083,
90515,
394,
282,
10005,
486,
39462,
486,
20689,
955,
10005,
486,
39462,
20689,
341,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_batch_values_only() {
test_read_batch_int32(16, &mut vec![0; 10], None, None); // < batch_size
test_read_batch_int32(16, &mut vec![0; 16], None, None); // == batch_size
test_read_batch_int32(16, &mut vec![0; 51], None, None); // > batch_size
} | rust_cleaned_test_functions.jsonl/64660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
14534,
9146,
18410,
368,
341,
286,
1273,
6443,
14534,
4042,
18,
17,
7,
16,
21,
11,
609,
6984,
7486,
20703,
15,
26,
220,
16,
15,
1125,
2240,
11,
2240,
1215,
442,
366,
7162,
2368,
198,
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_app_builder_all_methods() {
let mut builder = AppBuilder::new();
builder.client_name("foo-test");
builder.redirect_uris("http://example.com");
builder.scopes(Scopes::read_all() | Scopes::write_all());
builder.website("https://example.com");
let app = builder.build().expect("Couldn't build App");
assert_eq!(
app,
App {
client_name: "foo-test".to_string(),
redirect_uris: "http://example.com".to_string(),
scopes: Scopes::read_all() | Scopes::write_all(),
website: Some("https://example.com".to_string()),
}
);
} | rust_cleaned_test_functions.jsonl/51206 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8191,
28532,
5705,
36084,
368,
341,
286,
1077,
5206,
7363,
284,
1845,
3297,
486,
931,
543,
286,
7363,
6581,
1269,
445,
7975,
16839,
797,
286,
7363,
24100,
64879,
285,
445,
1254,
1110,
8687,
905,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_first_write_commits_immediately() {
let written_value = VALUE2;
let mut executor = Executor::new_with_fake_time().expect("Failed to create executor");
let (stash_proxy, mut stash_stream) =
fidl::endpoints::create_proxy_and_stream::<StoreAccessorMarker>().unwrap();
let storage: DeviceStorage<TestStruct> = DeviceStorage::new(stash_proxy, None);
// Write to device storage.
let value_to_write = TestStruct { value: written_value };
let write_future = storage.write(&value_to_write, false);
futures::pin_mut!(write_future);
// Write request finishes immediately.
matches!(executor.run_until_stalled(&mut write_future), Poll::Ready(Result::Ok(_)));
// Set request is received immediately on write.
{
let set_value_future = verify_stash_set(&mut stash_stream, written_value);
futures::pin_mut!(set_value_future);
advance_executor(&mut executor, &mut set_value_future);
}
// Start listening for the commit request.
let commit_future = verify_stash_commit(&mut stash_stream);
futures::pin_mut!(commit_future);
advance_executor(&mut executor, &mut commit_future);
} | rust_cleaned_test_functions.jsonl/73802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 526
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
9165,
25149,
1199,
17895,
43187,
368,
341,
286,
1077,
5326,
3142,
284,
26827,
17,
280,
286,
1077,
5206,
31558,
284,
56032,
486,
931,
6615,
56881,
3009,
1005,
17119,
445,
9408,
311,
1855,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_link_file_with_backup() {
with_test_directories("unstow_test_valid_link_file_with_backup".as_ref(), |source: &PathBuf, target: &PathBuf| {
let source_file = add_file_to("file.txt", source.as_path()).unwrap();
let target_file = target.join("file.txt");
let backup_target_file = add_file_to("file.txt.backup", target.as_path()).unwrap();
create_symlink(source_file.as_path(), target_file.as_path()).unwrap();
let mut operations: Vector<FSOperation> = Vector::new();
let result = unstow_path(source_file.as_path(), target_file.as_path(), operations.borrow_mut());
assert!(result.is_ok());
assert_eq!(result.unwrap(), TraversOperation::Continue);
let mut iter = operations.iter();
assert_eq!(iter.next().unwrap(), &FSOperation::Delete(target_file.to_path_buf()));
assert_eq!(iter.next().unwrap(), &FSOperation::Restore {backup: backup_target_file.to_path_buf(), target: target_file.to_path_buf()});
assert_eq!(iter.next(), None);
});
} | rust_cleaned_test_functions.jsonl/32413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
7233,
2458,
6615,
44710,
368,
341,
286,
448,
4452,
32871,
2433,
445,
359,
267,
363,
4452,
8337,
7233,
2458,
6615,
44710,
3263,
300,
7793,
1507,
760,
2427,
25,
609,
1820,
15064,
11,
2169,
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_dyn_keypairs_by_ref_compile() {
let foo = Foo {};
let bar = Bar {};
let xs: Vec<&dyn Signer> = vec![&foo, &bar];
assert_eq!(
xs.sign_message(b""),
vec![Signature::default(), Signature::default()],
);
let xs_ref: &[&dyn Signer] = &xs;
assert_eq!(
Signers::sign_message(xs_ref, b""),
vec![Signature::default(), Signature::default()],
);
} | rust_cleaned_test_functions.jsonl/57152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69213,
3097,
77256,
3710,
7793,
74170,
368,
341,
286,
1077,
15229,
284,
33428,
9321,
286,
1077,
3619,
284,
4716,
9321,
286,
1077,
11943,
25,
11312,
52244,
43085,
7075,
261,
29,
284,
7486,
20703,
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_request_response() {
let f = RequestResponse::builder(1234, 0)
.set_data(Bytes::from("Hello World"))
.set_metadata(Bytes::from("Foobar"))
.build();
try_codec(f);
} | rust_cleaned_test_functions.jsonl/41411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
9655,
368,
341,
262,
1077,
282,
284,
6145,
2582,
486,
17850,
7,
16,
17,
18,
19,
11,
220,
15,
340,
286,
659,
746,
1769,
76423,
486,
1499,
445,
9707,
4337,
5455,
286,
659,
746,
22220,
76... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unsubscribe() {
// Unsubscribe should:
// - Remove the mesh entry for topic
// - Send UNSUBSCRIBE to all known peers
// - Call Leave
let topic_strings = vec![String::from("topic1"), String::from("topic2")];
let topics = topic_strings
.iter()
.map(|t| Topic::new(t.clone()))
.collect::<Vec<Topic>>();
// subscribe to topic_strings
let (mut gs, _, topic_hashes) = inject_nodes1()
.peer_no(20)
.topics(topic_strings)
.to_subscribe(true)
.create_network();
for topic_hash in &topic_hashes {
assert!(
gs.topic_peers.get(&topic_hash).is_some(),
"Topic_peers contain a topic entry"
);
assert!(
gs.mesh.get(&topic_hash).is_some(),
"mesh should contain a topic entry"
);
}
// unsubscribe from both topics
assert!(
gs.unsubscribe(&topics[0]).unwrap(),
"should be able to unsubscribe successfully from each topic",
);
assert!(
gs.unsubscribe(&topics[1]).unwrap(),
"should be able to unsubscribe successfully from each topic",
);
let subscriptions =
gs.events
.iter()
.fold(vec![], |mut collected_subscriptions, e| match e {
NetworkBehaviourAction::NotifyHandler { event, .. } => {
for s in &event.subscriptions {
match s.subscribe {
Some(false) => collected_subscriptions.push(s.clone()),
_ => {}
};
}
collected_subscriptions
}
_ => collected_subscriptions,
});
assert!(
subscriptions.len() == 40,
"Should send an unsubscribe event to all known peers"
);
// check we clean up internal structures
for topic_hash in &topic_hashes {
assert!(
gs.mesh.get(&topic_hash).is_none(),
"All topics should have been removed from the mesh"
);
}
} | rust_cleaned_test_functions.jsonl/66879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
9384,
368,
341,
286,
442,
1230,
9384,
1265,
510,
286,
442,
481,
10783,
279,
11294,
4343,
369,
8544,
198,
286,
442,
481,
11000,
45983,
4493,
64640,
311,
678,
3881,
25029,
198,
286,
442,
481... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_gt_diff_num_digits_true() {
// Given:
let a = Counter::from(vec![9]);
let b = Counter::from(vec![0, 1]);
// Then:
assert!(b > a);
} | rust_cleaned_test_functions.jsonl/79529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37479,
15850,
4273,
41432,
16082,
368,
341,
310,
442,
16246,
510,
310,
1077,
264,
284,
19735,
486,
1499,
25592,
20703,
24,
2558,
310,
1077,
293,
284,
19735,
486,
1499,
25592,
20703,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_string_to_repo() {
let json = r#"["dam","website"]"#;
let repos: Repos = new(json).unwrap();
assert_eq!(repos, vec![
Repo{ repo_type: RepoType::Dam, sites: None },
Repo{ repo_type: RepoType::Website, sites: None },
]);
} | rust_cleaned_test_functions.jsonl/71245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
2346,
37784,
368,
341,
286,
1077,
2951,
284,
435,
55543,
1183,
15408,
2198,
19485,
1341,
57676,
280,
286,
1077,
45774,
25,
24286,
284,
501,
9304,
568,
15454,
543,
286,
2060,
10714,
10297,
68... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_which_relative_extension() {
// so test a relative path with an extension here.
let f = TestFixture::new();
let b = Path::new("b/bin").with_extension(env::consts::EXE_EXTENSION);
assert_eq!(_which(&f, &b).unwrap(), f.bins[3].canonicalize().unwrap());
} | rust_cleaned_test_functions.jsonl/13409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
8206,
29286,
31035,
368,
341,
1066,
262,
442,
773,
1273,
264,
8674,
1815,
448,
458,
8894,
1588,
624,
262,
1077,
282,
284,
3393,
18930,
486,
931,
543,
262,
1077,
293,
284,
7933,
486,
931,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_array_param() {
assert_eq!(Reader::read("address[]").unwrap(), ParamType::Array(Box::new(ParamType::Address)));
assert_eq!(Reader::read("uint[]").unwrap(), ParamType::Array(Box::new(ParamType::Uint(256))));
assert_eq!(Reader::read("bytes[]").unwrap(), ParamType::Array(Box::new(ParamType::Bytes)));
assert_eq!(
Reader::read("bool[][]").unwrap(),
ParamType::Array(Box::new(ParamType::Array(Box::new(ParamType::Bool))))
);
} | rust_cleaned_test_functions.jsonl/110634 | {
"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,
6443,
3858,
4090,
368,
341,
197,
6948,
10714,
10297,
5062,
486,
878,
445,
4995,
1294,
1827,
15454,
1507,
6991,
929,
486,
1857,
67758,
486,
931,
7,
2001,
929,
486,
4286,
4945,
197,
6948,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scans_boolean_operators() {
let mut scanner = Scanner::new(
"<?php
true ||
false &&
1 === 1 &&
$a <=> $b &&
2 !== 1;
2 <= 1;
2 >= 1;
2 ?? 1;
2 == 1;
2 != 1;
2 <> 1;
2 > 1;
2 < 1;
2 % 1 == 1;
",
);
scanner.scan().unwrap();
assert_eq!(
token_list!(scanner.tokens),
"<?php true || false && 1 === 1 && $a <=> $b && 2 !== 1 ; \
2 <= 1 ; 2 >= 1 ; 2 ?? 1 ; 2 == 1 ; 2 != 1 ; 2 <> 1 ; \
2 > 1 ; 2 < 1 ; 2 % 1 == 1 ; "
);
} | rust_cleaned_test_functions.jsonl/52933 | {
"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,
13171,
596,
46642,
25634,
2973,
368,
341,
286,
1077,
5206,
20775,
284,
17170,
486,
931,
1006,
310,
40271,
1208,
198,
310,
830,
8244,
310,
895,
6561,
310,
220,
16,
2049,
220,
16,
6561,
310,
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_typo_len_offset() {
let data = vec![1, 2, 3, 4, 5, 6, 7, 8];
// half of the size of `data`
let half_size = data.len() / 2;
let slice = GrpcSlice::from(data.clone());
let buffer = GrpcByteBuffer::from(&slice);
let mut reader = GrpcByteBufferReader::new(buffer);
assert_eq!(reader.len(), data.len());
// first 3 elements of `data`
let mut buf = vec![0; half_size];
reader.read(buf.as_mut_slice()).unwrap();
assert_eq!(data[..half_size], *buf.as_slice());
assert_eq!(reader.len(), data.len() - half_size);
assert!(!reader.is_empty());
reader.read(&mut buf).unwrap();
assert_eq!(data[half_size..], *buf.as_slice());
assert_eq!(reader.len(), 0);
assert!(reader.is_empty());
} | rust_cleaned_test_functions.jsonl/50384 | {
"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,
42111,
78,
6043,
6917,
368,
341,
286,
1077,
821,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
935,
286,
442,
4279,
315... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_audio_param_graph() {
let mut context = OfflineAudioContext::new(
1,
RENDER_QUANTUM_SIZE,
SampleRate(RENDER_QUANTUM_SIZE as u32),
);
{
let gain = context.create_gain();
gain.gain().set_value(0.5); // intrinsic value
gain.connect(&context.destination());
let source = context.create_constant_source();
source.offset().set_value(0.8);
source.connect(&gain);
let param_input1 = context.create_constant_source();
param_input1.offset().set_value(0.1);
param_input1.connect(gain.gain());
let param_input2 = context.create_constant_source();
param_input2.offset().set_value(0.3);
param_input2.connect(gain.gain());
source.start();
param_input1.start();
param_input2.start();
}
let output = context.start_rendering();
assert_eq!(output.number_of_channels(), 1);
assert_eq!(output.length(), RENDER_QUANTUM_SIZE);
let channel_data = output.get_channel_data(0);
let expected = vec![0.8 * 0.9; RENDER_QUANTUM_SIZE];
assert_eq!(channel_data, expected.as_slice());
} | rust_cleaned_test_functions.jsonl/95486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29688,
4090,
14738,
368,
341,
262,
1077,
5206,
2266,
284,
66370,
14755,
1972,
486,
931,
1006,
286,
220,
16,
345,
286,
91788,
16332,
2821,
2794,
4098,
345,
286,
19143,
11564,
43202,
35689,
16332,
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_iseq_action_around_closed_interval() {
for t in &[(1, 2), (-2, -1)] {
let mut seq = Seq::new();
println!("\nTesting {:?}", &t);
let (b1, b2): &(i32, i32) = t;
seq.open_interval(b1);
seq.close_interval(b2);
seq.check_invariants();
seq.open_interval(&-3);
seq.check_invariants();
seq.close_interval(&3);
seq.check_invariants();
}
} | rust_cleaned_test_functions.jsonl/112645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
1064,
80,
7931,
62,
19454,
44697,
20541,
368,
341,
310,
369,
259,
304,
609,
9697,
16,
11,
220,
17,
701,
10293,
17,
11,
481,
16,
7252,
341,
394,
1077,
5206,
12981,
284,
23744,
486,
931,
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... | 2 |
#[test]
fn test_tuple_vec() {
test_serialize(vec![
(123u64, 234u32, 999u16),
(123u64, 234u32, 999u16),
(123u64, 234u32, 999u16),
]);
} | rust_cleaned_test_functions.jsonl/73642 | {
"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,
21773,
13251,
368,
341,
286,
1273,
88686,
25592,
90515,
310,
320,
16,
17,
18,
84,
21,
19,
11,
220,
17,
18,
19,
84,
18,
17,
11,
220,
24,
24,
24,
84,
16,
21,
1326,
310,
320,
16,
17,
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_eth_transfer_insufficient_balance_sim() {
let (aurora, mut signer, address) = initialize_evm_sim();
let nonce = signer.use_nonce();
let tx = test_utils::transfer(
Address([1; 20]),
INITIAL_BALANCE + INITIAL_BALANCE,
nonce.into(),
);
let signed_tx = test_utils::sign_transaction(
tx,
Some(test_utils::AuroraRunner::default().chain_id),
&signer.secret_key,
);
let call_result = aurora.call("submit", rlp::encode(&signed_tx).as_ref());
let result: SubmitResult = call_result.unwrap_borsh();
assert_eq!(result.status, TransactionStatus::OutOfFund);
// validate post-state
assert_eq!(
query_address_sim(&address, "get_nonce", &aurora),
U256::from(INITIAL_NONCE + 1),
);
assert_eq!(
query_address_sim(&address, "get_balance", &aurora),
INITIAL_BALANCE.raw(),
);
} | rust_cleaned_test_functions.jsonl/131053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57757,
35403,
34386,
26683,
29396,
18314,
368,
341,
262,
1077,
320,
4110,
6215,
11,
5206,
70039,
11,
2621,
8,
284,
9468,
2204,
7338,
18314,
1428,
1066,
262,
1077,
39676,
284,
70039,
7397,
48508,
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_illegal_request() {
let expr = ExprDefBuilder::aggr_func(ExprType::Avg, FieldTypeTp::Double) // Expect NewDecimal but give Real
.push_child(ExprDefBuilder::column_ref(0, FieldTypeTp::LongLong)) // FIXME: This type can be incorrect as well
.build();
AggrFnDefinitionParserAvg.check_supported(&expr).unwrap();
let src_schema = [FieldTypeTp::LongLong.into()];
let mut schema = vec![];
let mut exp = vec![];
let mut ctx = EvalContext::default();
AggrFnDefinitionParserAvg
.parse(expr, &mut ctx, &src_schema, &mut schema, &mut exp)
.unwrap_err();
} | rust_cleaned_test_functions.jsonl/86707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26743,
6428,
7893,
368,
341,
286,
1077,
15169,
284,
28819,
2620,
3297,
486,
351,
901,
9596,
7,
16041,
929,
486,
39447,
11,
84614,
62241,
486,
7378,
8,
442,
32085,
1532,
11269,
714,
2968,
8800,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delimiter_must_not_be_more_than_one_character() {
new_ucmd!()
.args(&["--delimiter", "sad"])
.fails()
.stderr_is("numfmt: the delimiter must be a single character");
} | rust_cleaned_test_functions.jsonl/46024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18029,
17700,
717,
590,
7913,
21263,
36664,
51613,
11667,
40988,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
58116,
497,
330,
82114,
14108,
286,
659,
59631,
741,
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 |
#[test]
fn test_in_network_region() {
let mut peer_storage = PeerStorage::new_indexed(HashmapDatabase::new()).unwrap();
let mut nodes = repeat_with(|| create_test_peer(PeerFeatures::COMMUNICATION_NODE, false, false))
.take(5)
.chain(repeat_with(|| create_test_peer(PeerFeatures::COMMUNICATION_CLIENT, false, false)).take(4))
.collect::<Vec<_>>();
for p in &nodes {
peer_storage.add_peer(p.clone()).unwrap();
}
let main_peer_node_id = create_test_peer(PeerFeatures::COMMUNICATION_NODE, false, false).node_id;
nodes.sort_by(|a, b| {
a.node_id
.distance(&main_peer_node_id)
.cmp(&b.node_id.distance(&main_peer_node_id))
});
let close_node = &nodes.first().unwrap().node_id;
let far_node = &nodes.last().unwrap().node_id;
let is_in_region = peer_storage
.in_network_region(&main_peer_node_id, &main_peer_node_id, 1)
.unwrap();
assert!(is_in_region);
let is_in_region = peer_storage
.in_network_region(close_node, &main_peer_node_id, 1)
.unwrap();
assert!(is_in_region);
let is_in_region = peer_storage.in_network_region(far_node, &main_peer_node_id, 9).unwrap();
assert!(is_in_region);
let is_in_region = peer_storage.in_network_region(far_node, &main_peer_node_id, 3).unwrap();
assert!(!is_in_region);
} | rust_cleaned_test_functions.jsonl/84197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 735
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
20966,
20627,
368,
341,
286,
1077,
5206,
14397,
23310,
284,
45147,
5793,
486,
931,
3560,
291,
7,
6370,
2186,
5988,
486,
931,
6011,
15454,
1428,
286,
1077,
5206,
7798,
284,
13153,
6615,
79453... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parsing_operand_parameters() {
let mut v = ZERO_BOUND_HEADER.to_vec();
v.append(&mut vec![0x47, 0x00, 0x04, 0x00]); // OpDecorate
v.append(&mut vec![0x05, 0x00, 0x00, 0x00]); // id 5
v.append(&mut vec![0x0b, 0x00, 0x00, 0x00]); // BuiltIn
v.append(&mut vec![0x06, 0x00, 0x00, 0x00]); // InstanceId
let mut c = RetainingConsumer::new();
{
let p = Parser::new(&v, &mut c);
assert_matches!(p.parse(), Ok(()));
}
assert_eq!(1, c.insts.len());
let inst = &c.insts[0];
assert_eq!("Decorate", inst.class.opname);
assert_eq!(None, inst.result_type);
assert_eq!(None, inst.result_id);
assert_eq!(vec![dr::Operand::IdRef(5),
dr::Operand::Decoration(spirv::Decoration::BuiltIn),
dr::Operand::BuiltIn(spirv::BuiltIn::InstanceId)],
inst.operands);
} | rust_cleaned_test_functions.jsonl/85739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 525
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
69259,
18263,
368,
341,
286,
1077,
5206,
348,
284,
54593,
73644,
20330,
2389,
13251,
543,
286,
348,
2057,
2099,
6984,
7486,
20703,
15,
87,
19,
22,
11,
220,
15,
87,
15,
15,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_map_bad_index() {
let map: BpfHashMap = unsafe {
BpfHashMap::new(
"mymap",
std::mem::size_of::<u32>() as u32,
std::mem::size_of::<u64>() as u32,
1024,
)
.expect("Failed to create new map")
};
let _ = unsafe { map.write(1234, 1234) };
let should_fail: Result<u64, OxidebpfError> = unsafe { map.read(4321) };
assert!(should_fail.is_err());
match should_fail {
Err(OxidebpfError::LinuxError(_, errno)) => {
assert_eq!(errno, Errno::ENOENT)
}
_ => {
panic!("invalid OxidebpfError: {:?}", should_fail);
}
}
} | rust_cleaned_test_functions.jsonl/40489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 452
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
5376,
34199,
3560,
368,
341,
286,
1077,
2415,
25,
425,
15897,
18497,
284,
19860,
341,
310,
425,
15897,
18497,
486,
931,
1006,
394,
330,
76,
1600,
391,
756,
394,
1460,
486,
10536,
486,
2141... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_all_parse0() {
let (input, _) = Filter::parse0(argv!["all"]).unwrap();
assert_eq!(input.len(), 1); // did not parse "all"
} | rust_cleaned_test_functions.jsonl/115954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
21039,
15,
368,
341,
286,
1077,
320,
1355,
11,
27439,
284,
12339,
486,
6400,
15,
15329,
0,
1183,
541,
45014,
15454,
543,
286,
2060,
10714,
10297,
1355,
19406,
1507,
220,
16,
1215,
442,
152... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hashmap_with_enum_key() {
use std::collections::HashMap;
use json;
#[derive(RustcEncodable, Eq, Hash, PartialEq, RustcDecodable, Debug)]
enum Enum {
Foo,
#[allow(dead_code)]
Bar,
}
let mut map = HashMap::new();
map.insert(Enum::Foo, 0);
let result = json::encode(&map).unwrap();
assert_eq!(result, r#"{"Foo":0}"#);
let decoded: HashMap<Enum, _> = json::decode(&result).unwrap();
assert_eq!(map, decoded);
} | rust_cleaned_test_functions.jsonl/22761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
2186,
6615,
31054,
3097,
368,
341,
286,
990,
1460,
486,
51137,
486,
18497,
280,
286,
990,
2951,
280,
286,
11506,
27098,
2785,
590,
66,
7408,
69129,
11,
33122,
11,
6531,
11,
55039,
11,
3378... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_ip_to_cache() {
let keypair = Keypair::new();
let mut faucet = Faucet::new(keypair, None, None, None);
let ip = "127.0.0.1".parse().expect("create IpAddr from string");
assert_eq!(faucet.ip_cache.len(), 0);
faucet.add_ip_to_cache(ip);
assert_eq!(faucet.ip_cache.len(), 1);
assert!(faucet.ip_cache.contains(&ip));
} | rust_cleaned_test_functions.jsonl/117722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
10385,
2346,
11529,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
5206,
71453,
284,
96362,
295,
486,
931,
4857,
12670,
11,
2240,
11,
2240,
11,
2240,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction_exonum_field_invalid_segwit_flag() {
let hex_tx = "6600000000101b651818fe3855d0d5d74de1cf72b56503c16f808519440e842b6a\
dc2dd570c4930100000000feffffff02deaa7b0000000000160014923904449829\
cd865cdfb72abdba0806ce9e48911027000000000000220020e9bb049fdff8f8d3\
b33b7335978b1dbb268833a32a69906f9e500e4103151bef02483045022100ddc7\
eb1193529a8d0e48cf24f536d5fbb5de3b67d2f56c98190ea8585d58a156022075\
e33981f1a7d78ce2915402d4b9b38b8d5311e0aef2e3ccf9284d2ce602968d0121\
021d0478acd223fb9b2ad7485f06f12914a1b7effc78390a08c50bfe53b3b24815\
062c1400";
let tx_raw = Vec::<u8>::from_hex(hex_tx).unwrap();
let _ = <Transaction as BinaryValue>::from_bytes(Cow::Borrowed(&tx_raw)).unwrap();
} | rust_cleaned_test_functions.jsonl/61859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
2702,
263,
372,
5013,
31433,
35325,
88519,
10933,
368,
341,
286,
1077,
12371,
17805,
284,
330,
21,
21,
15,
15,
15,
15,
15,
15,
15,
15,
16,
15,
16,
65,
21,
20,
16,
23,
16,
23,
1859,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dot_lookup_with_partial_as_field() -> TestResult {
let p = Polar::new();
p.load_str("f(x, y) if {a: y, b: y}.(x) > 0;")?;
p.register_constant(sym!("x"), term!(value!(op!(And))))?;
let mut q = p.new_query_from_term(term!(call!("f", [sym!("x"), sym!("y")])), false);
let next = next_binding(&mut q)?;
assert_eq!(next[&sym!("x")], term!("a"));
assert_partial_expression!(next, "y", "_this > 0");
let next = next_binding(&mut q)?;
assert_eq!(next[&sym!("x")], term!("b"));
assert_partial_expression!(next, "y", "_this > 0");
Ok(())
} | rust_cleaned_test_functions.jsonl/63023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30941,
27464,
6615,
52068,
11898,
5013,
368,
1464,
3393,
2077,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
5104,
2895,
445,
69,
2075,
11,
379,
8,
421,
314,
64,
25,
379,
11,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.