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_inversion() {
assert_eq!(Scalar::zero().invert().is_none().unwrap_u8(), 1);
assert_eq!(Scalar::one().invert().unwrap(), Scalar::one());
assert_eq!((-&Scalar::one()).invert().unwrap(), -&Scalar::one());
let mut tmp = R2;
for _ in 0..100 {
let mut tmp2 = tmp.invert().unwrap();
tmp2.mul_assign(&tmp);
assert_eq!(tmp2, Scalar::one());
tmp.add_assign(&R2);
}
} | rust_cleaned_test_functions.jsonl/42756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
4366,
368,
341,
262,
2060,
10714,
10297,
20639,
486,
14154,
1005,
83729,
1005,
285,
31488,
1005,
15454,
7300,
23,
1507,
220,
16,
317,
262,
2060,
10714,
10297,
20639,
486,
603,
1005,
83729,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_image_in_image_outside_of_bounds() {
let mut target = ImageBuffer::new(32, 32);
let source = ImageBuffer::from_pixel(32, 32, Rgb([255u8, 0, 0]));
overlay(&mut target, &source, 1, 1);
assert!(*target.get_pixel(0, 0) == Rgb([0, 0, 0]));
assert!(*target.get_pixel(1, 1) == Rgb([255u8, 0, 0]));
assert!(*target.get_pixel(31, 31) == Rgb([255u8, 0, 0]));
} | rust_cleaned_test_functions.jsonl/121627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
1243,
4954,
6068,
2929,
3575,
36878,
368,
341,
286,
1077,
5206,
2169,
284,
4654,
4095,
486,
931,
7,
18,
17,
11,
220,
18,
17,
317,
286,
1077,
2530,
284,
4654,
4095,
486,
1499,
29760,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vlq_decode() {
use sourcemap::internals::parse_vlq_segment;
let rv = parse_vlq_segment("AAAA").unwrap();
assert_eq!(rv, vec![0, 0, 0, 0]);
let rv = parse_vlq_segment("GAAIA").unwrap();
assert_eq!(rv, vec![3, 0, 0, 4, 0]);
} | rust_cleaned_test_functions.jsonl/4079 | {
"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,
2273,
75,
80,
15227,
368,
341,
262,
990,
20282,
66,
42040,
486,
55444,
1127,
486,
6400,
2273,
75,
80,
28061,
280,
262,
1077,
17570,
284,
4715,
2273,
75,
80,
28061,
445,
25699,
1827,
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_api_deposit_invalid_denomination() {
let mut mock = mock::Mock::default();
let mut ctx = mock.create_ctx();
let mut meta = Metadata {
..Default::default()
};
let genesis = Default::default();
Module::<Accounts, Consensus>::init_or_migrate(&mut ctx, &mut meta, genesis);
let tx = transaction::Transaction {
version: 1,
call: transaction::Call {
format: transaction::CallFormat::Plain,
method: "consensus.Deposit".to_owned(),
body: cbor::to_value(Deposit {
// separate `to` account to make sure everything is hooked up to the right places.
to: Some(keys::bob::address()),
amount: BaseUnits::new(1_000, Denomination::NATIVE),
}),
},
auth_info: transaction::AuthInfo {
signer_info: vec![transaction::SignerInfo::new_sigspec(
keys::alice::sigspec(),
0,
)],
fee: transaction::Fee {
amount: Default::default(),
gas: 1000,
consensus_messages: 1,
},
},
};
ctx.with_tx(0, tx, |mut tx_ctx, call| {
let result = Module::<Accounts, Consensus>::tx_deposit(
&mut tx_ctx,
cbor::from_value(call.body).unwrap(),
)
.unwrap_err();
assert!(matches!(
result,
Error::Consensus(ConsensusError::InvalidDenomination)
));
});
} | rust_cleaned_test_functions.jsonl/52593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 776
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
85798,
31433,
49522,
80380,
368,
341,
262,
1077,
5206,
7860,
284,
7860,
486,
11571,
486,
2258,
543,
262,
1077,
5206,
5635,
284,
7860,
2520,
15147,
543,
262,
1077,
5206,
8823,
284,
33589,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert() {
let mut s = InlineString::new();
for _ in 0..INLINE_STRING_CAPACITY {
assert!(s.insert(0, 'a').is_ok());
}
assert_eq!(s.insert(0, 'a'), Err(NotEnoughSpaceError));
} | rust_cleaned_test_functions.jsonl/64505 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
286,
1077,
5206,
274,
284,
54235,
703,
486,
931,
1428,
286,
369,
716,
304,
220,
15,
496,
55737,
12283,
92153,
341,
310,
2060,
10297,
82,
7030,
7,
15,
11,
364,
64,
1823,
285,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_debug_impl() {
let initial_state = Sha384::new();
let debug = format!("{:?}", initial_state);
let expected = "Sha384 { _state: State { working_state: [***OMITTED***], buffer: [***OMITTED***], leftover: 0, message_len: [WordU64(0), WordU64(0)], is_finalized: false } }";
assert_eq!(debug, expected);
} | rust_cleaned_test_functions.jsonl/46934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
21007,
368,
341,
286,
1077,
2856,
4387,
284,
27970,
18,
23,
19,
486,
931,
543,
286,
1077,
7390,
284,
3561,
88928,
25,
52652,
2856,
4387,
317,
286,
1077,
3601,
284,
330,
62316,
18,
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... | 1 |
#[test]
fn test_instance() {
let proc = TestProcess::new(
env::current_dir().unwrap(),
&["foo", "bar", "baz"],
HashMap::default(),
"",
);
with(Box::new(proc.clone()), || {
assert_eq!(proc.id(), process().id(), "{:?} != {:?}", proc, process())
});
} | rust_cleaned_test_functions.jsonl/33634 | {
"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,
11904,
368,
341,
286,
1077,
13674,
284,
3393,
7423,
486,
931,
1006,
310,
6105,
486,
3231,
4334,
1005,
15454,
3148,
310,
609,
1183,
7975,
497,
330,
2257,
497,
330,
42573,
8097,
310,
10528,
486,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_check_vote_threshold_above_threshold_after_pop() {
let mut tower = Tower::new_for_tests(1, 0.67);
let stakes = vec![(0, 2)].into_iter().collect();
tower.record_vote(0, Hash::default());
tower.record_vote(1, Hash::default());
tower.record_vote(2, Hash::default());
assert!(tower.check_vote_stake_threshold(6, &stakes, 2));
} | rust_cleaned_test_functions.jsonl/61141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
54360,
21858,
77315,
21858,
19844,
17061,
368,
341,
286,
1077,
5206,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
16,
11,
220,
15,
13,
21,
22,
317,
286,
1077,
44425,
284,
7486,
0,
9697,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_retrieve_credentials_fails_with_no_proof_req() {
init!("false");
let proof: DisclosedProof = Default::default();
assert_eq!(proof.retrieve_credentials().unwrap_err().kind(), VcxErrorKind::NotReady);
} | rust_cleaned_test_functions.jsonl/106025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
34216,
47396,
761,
6209,
6615,
6536,
86757,
17644,
368,
341,
286,
2930,
17223,
3849,
3071,
286,
1077,
11064,
25,
11735,
9259,
31076,
284,
7899,
486,
2258,
543,
286,
2060,
10714,
10297,
15780,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_should_not_add_newline_when_line_equal_to_fold() {
new_ucmd!()
.arg("-w1")
.pipe_in(" ")
.succeeds()
.stdout_is(" ");
} | rust_cleaned_test_functions.jsonl/23271 | {
"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,
43378,
7913,
2891,
5921,
1056,
47636,
6528,
11478,
2346,
61187,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
86,
16,
1138,
286,
659,
13768,
1243,
445,
14167,
286,
659,
82,
2926... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_complex_call_expr() {
use pgs::parser::ast::Expression;
let code = String::from("
add(5, 5) + 5;
");
let mut lexer = Token::lexer(code.as_str());
let parser = Parser::new(code.clone());
let expr_res = parser.parse_expr(&mut lexer, &[
Token::Semicolon
]);
assert!(expr_res.is_ok());
let expr = expr_res.unwrap();
match expr {
Expression::Addition(lhs, rhs) => {
match *lhs {
Expression::Call(fn_name, args) => {
assert_eq!(fn_name, String::from("add"));
assert_eq!(args.len(), 2);
},
_ => {
panic!("Wrong expression! Should be Call.");
}
};
match *rhs {
Expression::IntLiteral(int) => {
assert_eq!(int, 5);
},
_ => {
panic!("Wrong expression! Should be IntLiteral.");
}
};
},
_ => {
panic!("Wrong expression! Should be Addition.");
}
}
} | rust_cleaned_test_functions.jsonl/43212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 650
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
41522,
13429,
21915,
368,
341,
262,
990,
281,
5857,
486,
9657,
486,
559,
486,
9595,
401,
262,
1077,
2038,
284,
923,
486,
1499,
70576,
286,
912,
7,
20,
11,
220,
20,
8,
488,
220,
20,
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... | 4 |
#[test]
fn test_move_iter_reverse() {
let data = vec![5, 9, 3];
let iterout = vec![3, 5, 9];
let pq = BinaryHeap::from(data);
let v: Vec<_> = pq.into_iter().rev().collect();
assert_eq!(v, iterout);
} | rust_cleaned_test_functions.jsonl/83202 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
11723,
43277,
368,
341,
262,
1077,
821,
284,
7486,
20703,
20,
11,
220,
24,
11,
220,
18,
935,
262,
1077,
5367,
411,
284,
7486,
20703,
18,
11,
220,
20,
11,
220,
24,
935,
262,
1077,
3963... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hover_dyn_return_has_goto_type_action() {
check_actions(
r#"
trait Foo {}
struct S;
impl Foo for S {}
struct B<T>{}
fn foo() -> B<dyn Foo> {}
fn main() { let s<|>t = foo(); }
"#,
expect![[r#"
[
GoToType(
[
HoverGotoTypeData {
mod_path: "test::B",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 42..55,
focus_range: Some(
49..50,
),
name: "B",
kind: STRUCT,
container_name: None,
description: Some(
"struct B",
),
docs: None,
},
},
HoverGotoTypeData {
mod_path: "test::Foo",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 0..12,
focus_range: Some(
6..9,
),
name: "Foo",
kind: TRAIT,
container_name: None,
description: Some(
"trait Foo",
),
docs: None,
},
},
],
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1789
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
69213,
12511,
21778,
97732,
1819,
7931,
368,
341,
286,
1779,
25368,
1006,
310,
435,
2,
698,
29432,
33428,
5613,
1235,
328,
280,
6383,
33428,
369,
328,
10086,
1235,
425,
3125,
7309,
532,
882... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_oranges_rotting() {
{
let grid: Vec<Vec<i32>> = vec![vec![2, 1, 1], vec![1, 1, 0], vec![0, 1, 1]];
assert_eq!(oranges_rotting(grid), 4);
}
{
let grid: Vec<Vec<i32>> = vec![vec![2, 1, 1], vec![0, 1, 1], vec![1, 0, 1]];
assert_eq!(oranges_rotting(grid), -1);
}
{
let grid: Vec<Vec<i32>> = vec![vec![0, 2]];
assert_eq!(oranges_rotting(grid), 0);
}
} | rust_cleaned_test_functions.jsonl/20096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
5520,
38256,
1280,
368,
341,
262,
341,
286,
1077,
5827,
25,
11312,
50439,
21897,
18,
17,
2452,
284,
7486,
20703,
4083,
20703,
17,
11,
220,
16,
11,
220,
16,
1125,
7486,
20703,
16,
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_copy_sync() {
let tmp = tempfile::tempdir().unwrap();
let dir = tmp.path();
let dest = dir.join("data");
crate::write_sync(&dir, "my-key", b"hello world").unwrap();
crate::copy_sync(&dir, "my-key", &dest).unwrap();
let data = fs::read(&dest).unwrap();
assert_eq!(data, b"hello world");
} | rust_cleaned_test_functions.jsonl/64597 | {
"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,
16096,
23008,
368,
341,
286,
1077,
4174,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
5419,
284,
4174,
3875,
543,
286,
1077,
3201,
284,
5419,
5446,
445,
691,
797,
286,
17717,
486,
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_key() {
let mut cs_rng = CsRng::default();
let key_1 = cs_rng.generate_key();
assert_eq!(KEY_LENGTH, key_1.0.len());
let key_2 = cs_rng.generate_key();
assert_eq!(KEY_LENGTH, key_2.0.len());
assert_ne!(key_1, key_2);
} | rust_cleaned_test_functions.jsonl/132748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
368,
341,
286,
1077,
5206,
10532,
66849,
284,
67332,
49,
968,
486,
2258,
543,
286,
1077,
1376,
62,
16,
284,
10532,
66849,
22019,
3097,
543,
286,
2060,
10714,
10297,
4784,
15023,
11,
1376,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keywords_inside_block() {
check(
r"fn quux() { if true { <|> } }",
expect![[r#"
kw const
kw extern
kw fn
kw if
kw if let
kw impl
kw let
kw loop
kw match
kw mod
kw return
kw static
kw trait
kw type
kw unsafe
kw use
kw while
"#]],
);
} | rust_cleaned_test_functions.jsonl/99573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 432
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
72860,
7113,
368,
341,
286,
1779,
1006,
310,
435,
1,
8822,
922,
2200,
368,
314,
421,
830,
314,
82639,
29,
335,
335,
756,
310,
1720,
0,
15505,
81,
2,
698,
394,
29525,
733,
198,
394,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunk_codec() {
let cases = vec![
("2012-12-31 11:30:45.123456", 4),
("2012-12-31 11:30:45.123456", 6),
("2012-12-31 11:30:45.123456", 0),
("2012-12-31 11:30:45.999999", 0),
("2017-01-05 08:40:59.575601", 0),
("2017-01-05 23:59:59.575601", 0),
("0000-00-00 00:00:00", 6),
];
for (s, fsp) in cases {
let t = Time::parse_utc_datetime(s, fsp).unwrap();
let mut buf = vec![];
buf.encode_time(&t).unwrap();
let got = Time::decode(&mut buf.as_slice()).unwrap();
assert_eq!(got, t);
}
} | rust_cleaned_test_functions.jsonl/93964 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30539,
51084,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
15,
16,
17,
12,
16,
17,
12,
18,
16,
220,
16,
16,
25,
18,
15,
25,
19,
20,
13,
16,
17,
18,
19,
20,
21,
497,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_anchoring_tx_metadata() {
let tx: Transaction = Transaction::from_hex(
"01000000000101348ead2317da8c6ae12305af07e33b8c0320c9319f21007a704e44f32e7a75500000000\
000ffffffff0250ec0e00000000002200200f2602a87bbdb59fdf4babfffd568ef39a85cf2f08858c8847\
d70f27894b68840000000000000000326a3045584f4e554d0100085200000000000085f467f2bad583dbb\
08f84a47e817d8293fb8c70d033604f441f53a6cc092f180500473044022003334a325c7c382aca17c9c0\
790d3e2a48fbc99fcc34eb6f73ac4386fcca290602206508789e66f246fc496784df97b0b9e895ae93948\
cf6a3a1ca2603d02a462c050148304502210081cadbe7c21e9e030b8ed9e3d084595833351284ce26d79d\
ad889ffdab73bfc402205dd359f19b6871f3e21b9b9c2a57aabd2ce64a0631a136fe4028dabd96fa89a20\
147304402200dc7a83d7064f74e2e7a90fdfab6b41ab8663b8151ae4e313bf29ee9c7c9f38e022043ca73\
74050f1f3e321fe686f6858f94b8d8d130e73b61a74e6200f75452edf30169532103f0c44bc5cd2747ac3\
4380e84ac4e78fac684848d32198bac5985d116c74ae6862103d9d4eb85dad869dc54a65f77a7e81eea0e\
a5d81129928d6d5b6dcb7b57c8991b21033ea315ab975c6424740c305db3f07b62b1121e27d3052b9a30d\
b56a8b504713c53ae00000000",
)
.unwrap();
let (script_pubkey, payload) = tx.anchoring_metadata().unwrap();
assert_eq!(payload.block_height, Height(21000));
assert_eq!(
payload.block_hash,
Hash::from_hex("85f467f2bad583dbb08f84a47e817d8293fb8c70d033604f441f53a6cc092f18")
.unwrap()
);
assert_eq!(payload.prev_tx_chain, None);
assert_eq!(
Address::p2wsh(script_pubkey, Network::Testnet).to_string(),
"tb1qgjg3s5u93cuvf5y8pc2aw259gf7spj7x3a4k09lc6a4gtnhg8l0su4axp4"
);
} | rust_cleaned_test_functions.jsonl/61858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1083
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3497,
5503,
17805,
22220,
368,
341,
286,
1077,
9854,
25,
17869,
284,
17869,
486,
1499,
32655,
1006,
310,
330,
15,
16,
15,
15,
15,
15,
15,
15,
15,
15,
15,
16,
15,
16,
18,
19,
23,
3149,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_test_case_2() {
let key = "Jefe".as_bytes();
let data = "what do ya want for nothing?".as_bytes();
let expected = "750c783e6ab0b503eaa86e310a5db738";
run_test_case(key, data, expected);
} | rust_cleaned_test_functions.jsonl/17339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4452,
19096,
62,
17,
368,
341,
286,
1077,
1376,
284,
330,
41,
44953,
3263,
300,
12524,
543,
286,
1077,
821,
284,
330,
12555,
653,
13526,
1366,
369,
4302,
30,
3263,
300,
12524,
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_for_loop_with_zero_step() {
let input = "
FOR i% = 7 TO -6 STEP 0
PRINT i%
NEXT
";
assert_eq!(
interpret_err(input),
ErrorEnvelope::Pos(QError::ForLoopZeroStep, Location::new(2, 27))
);
} | rust_cleaned_test_functions.jsonl/64158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
17198,
6615,
19359,
11946,
368,
341,
262,
1077,
1946,
284,
6228,
262,
4613,
600,
4,
284,
220,
22,
5146,
481,
21,
48356,
220,
15,
198,
286,
35893,
600,
13744,
262,
45011,
198,
262,
7620,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_doc() {
let src = "
// Package foo does a thing.
package foo
// f is a function.
//
// More specifically f is the identity function, it returns any value it is passed as a
// parameter.
//
// ## Parameters
// - x: is any value.
//
// More description after the parameter list.
f = (x) => x
";
let loc = Locator::new(&src[..]);
assert_docs_full(
src,
PackageDoc {
path: "path".to_string(),
name: "foo".to_string(),
headline: "Package foo does a thing.".to_string(),
description: None,
members: map![
"f" => Doc::Function(Box::new(FunctionDoc{
name: "f".to_string(),
headline: "f is a function.".to_string(),
description: Some("More specifically f is the identity function, it returns any value it is passed as a\nparameter.\n\nMore description after the parameter list.".to_string()),
parameters: vec![ParameterDoc{
name: "x".to_string(),
headline: "x: is any value.".to_string(),
description: None,
required: true,
}],
flux_type: "(x:A) => A".to_string(),
is_option: false,
source_location: loc.get(14,9,14,21),
examples: vec![],
metadata: None,
})),
],
examples: Vec::new(),
metadata: None,
},
vec![],
);
} | rust_cleaned_test_functions.jsonl/9992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1051
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
18869,
368,
341,
286,
1077,
2286,
284,
6228,
286,
442,
16906,
15229,
1558,
264,
3166,
624,
286,
6328,
15229,
271,
286,
442,
282,
374,
264,
729,
624,
286,
6475,
286,
442,
4398,
11689,
282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cef_fixed_headers() {
let sh = SingleHeader {};
assert_eq!(sh.cef_header_version().unwrap(), "4234");
let ma = MultipleAttrs {};
assert_eq!(ma.cef_header_version().unwrap(), "3424");
assert_eq!(ma.cef_header_name().unwrap(), "name1");
let mh = MultipleHeaders {};
assert_eq!(mh.cef_header_version().unwrap(), "3235");
assert_eq!(mh.cef_header_name().unwrap(), "name2");
} | rust_cleaned_test_functions.jsonl/3451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50727,
69,
37839,
26719,
368,
341,
262,
1077,
557,
284,
11327,
4047,
9321,
262,
2060,
10714,
10297,
927,
13,
65041,
8757,
9438,
1005,
15454,
1507,
330,
19,
17,
18,
19,
3071,
262,
1077,
7491,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_spearman() {
let a: Vec<f64> = vec![1.0,2.0,3.0,4.0,5.0];
let b: Vec<f64> = vec![1.0,2.0,3.0,4.0,5.0];
let p = spearman(&a,&b).unwrap();
assert!((p - 1.0).abs() < 0.0001);
let c: Vec<f64> = vec![1.0,5.0,6.0,6.5,6.6];
let p = spearman(&a,&c).unwrap();
assert!((p - 1.0).abs() < 0.0001);
} | rust_cleaned_test_functions.jsonl/132712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
8015,
1515,
368,
341,
286,
1077,
264,
25,
11312,
63895,
21,
19,
29,
284,
7486,
20703,
16,
13,
15,
11,
17,
13,
15,
11,
18,
13,
15,
11,
19,
13,
15,
11,
20,
13,
15,
935,
286,
1077,
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_timestamp_range_contains_opt() {
let range = TimestampRange::new(100, 200);
assert!(!range.contains_opt(Some(99)));
assert!(range.contains_opt(Some(100)));
assert!(range.contains_opt(Some(101)));
assert!(range.contains_opt(Some(199)));
assert!(!range.contains_opt(Some(200)));
assert!(!range.contains_opt(Some(201)));
assert!(!range.contains_opt(None));
} | rust_cleaned_test_functions.jsonl/113334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
9698,
63598,
15032,
368,
341,
286,
1077,
2088,
284,
32758,
6046,
486,
931,
7,
16,
15,
15,
11,
220,
17,
15,
15,
317,
286,
2060,
0,
3471,
9669,
8786,
15032,
65405,
7,
24,
24,
4945,
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_path_verify_good() {
let mt = MerkleTree::new(TEST);
for (i, s) in TEST.iter().enumerate() {
let hash = hash_leaf!(s);
let path = mt.find_path(i).unwrap();
assert!(path.verify(hash));
}
} | rust_cleaned_test_functions.jsonl/112983 | {
"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,
2638,
35638,
44781,
368,
341,
286,
1077,
11965,
284,
8755,
23089,
6533,
486,
931,
50320,
317,
286,
369,
320,
72,
11,
274,
8,
304,
13602,
19471,
1005,
76569,
368,
341,
310,
1077,
5175,
284,
5175,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iterator_chain() {
let xs = [0, 1, 2, 3, 4, 5];
let ys = [30, 40, 50, 60];
let expected = [0, 1, 2, 3, 4, 5, 30, 40, 50, 60];
let it = xs.iter().chain(&ys);
let mut i = 0;
for &x in it {
assert_eq!(x, expected[i]);
i += 1;
}
assert_eq!(i, expected.len());
let ys = (30..).step_by(10).take(4);
let it = xs.iter().cloned().chain(ys);
let mut i = 0;
for x in it {
assert_eq!(x, expected[i]);
i += 1;
}
assert_eq!(i, expected.len());
} | rust_cleaned_test_functions.jsonl/25888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
30583,
368,
341,
262,
1077,
11943,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
31810,
284,
508,
18,
15,
11,
220,
19,
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... | 3 |
#[test]
fn test_part2_b() {
let input =
"#######
#E..EG#
#.#G.E#
#E.##E#
#G..#.#
#..E#.#
#######";
assert_eq!(part2(&as_input(input)), 31284);
} | rust_cleaned_test_functions.jsonl/13278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
17,
880,
368,
341,
286,
1077,
1946,
4035,
310,
330,
82024,
1797,
671,
36,
496,
9376,
4956,
1797,
671,
43326,
38,
5142,
4956,
1797,
671,
36,
13,
565,
36,
4956,
1797,
671,
38,
496,
87846,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stacked_porep_extract_all_sha256_top_8_8_2() {
test_extract_all::<DiskTree<Sha256Hasher, U8, U8, U2>>();
} | rust_cleaned_test_functions.jsonl/56515 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
11191,
620,
460,
79,
39123,
5705,
48836,
17,
20,
21,
10426,
62,
23,
62,
23,
62,
17,
368,
341,
262,
1273,
39123,
5705,
27638,
47583,
6533,
27,
62316,
17,
20,
21,
6370,
261,
11,
547,
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 |
#[test]
fn test_build_empty_table_with_meta_block() {
let s = MemStorage::default();
let mut o = Options::<BytewiseComparator>::default();
let bf = BloomFilter::new(16);
o.filter_policy = Some(Arc::new(bf));
let opt = Arc::new(o);
let new_file = s.create("test").unwrap();
let cmp = BytewiseComparator::default();
let mut tb = TableBuilder::new(new_file, cmp, &opt);
tb.finish(false).unwrap();
let file = s.open("test").unwrap();
let file_len = file.len().unwrap();
let table = Table::open(file, 0, file_len, opt.clone(), cmp).unwrap();
assert!(table.filter_reader.is_some());
assert!(table.meta_block_handle.is_some());
} | rust_cleaned_test_functions.jsonl/64692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
15124,
5237,
6615,
13381,
7113,
368,
341,
286,
1077,
274,
284,
13550,
5793,
486,
2258,
543,
286,
1077,
5206,
297,
284,
14566,
27638,
1359,
83,
24350,
38658,
6831,
2258,
543,
286,
1077,
3909... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_weird_text() -> Result<()> {
// See the `weirdText` test in cpp_compat_test
let mut sub = SubStruct {
optDef: Some("stuff\twith\nescape\\characters'...\"lots{of}fun</xml>".to_string()),
bin: "1234".as_bytes().to_vec(),
..Default::default()
};
let s = String::from_utf8(serialize(&sub).to_vec()).unwrap();
let expected_string = r#"{
"optDef":"stuff\twith\nescape\\characters'...\"lots{of}fun</xml>",
"req_def":"IAMREQ",
"bin":"MTIzNA"
}"#
.replace(" ", "")
.replace("\n", "");
assert_eq!(expected_string, s);
// Make sure its equal
assert_eq!(sub, deserialize(s).unwrap());
// Unicode escaping
sub.optDef = Some("UNICODE\u{1F60A}UH OH".to_string());
let s = String::from_utf8(serialize(&sub).to_vec()).unwrap();
let expected_string = r#"{
"optDef":"UNICODE😊UH OH",
"req_def":"IAMREQ",
"bin":"MTIzNA"
}"#
// Double-space to deal with "tabs"
.replace(" ", "")
.replace("\n", "");
assert_eq!(expected_string, s);
// Make sure its equal
assert_eq!(sub, deserialize(s).unwrap());
Ok(())
} | rust_cleaned_test_functions.jsonl/122575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45922,
2603,
4326,
368,
1464,
5714,
71698,
341,
262,
442,
3496,
279,
1565,
896,
2603,
1178,
63,
1273,
304,
46824,
89602,
4452,
271,
262,
1077,
5206,
1186,
284,
3719,
9422,
341,
286,
3387,
2620,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_rpn_invalid_buf() {
let buf = [0x00, 0x01, 0x02];
assert_matches!(
RemotePortNegotiationParams::decode(&buf[..]),
Err(FrameParseError::InvalidBufferLength(REMOTE_PORT_NEGOTIATION_SHORT_LENGTH, 3))
);
} | rust_cleaned_test_functions.jsonl/29042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
1710,
19958,
31433,
10363,
368,
341,
286,
1077,
6607,
284,
508,
15,
87,
15,
15,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
5265,
715,
286,
2060,
38344,
33673,
310,
20738,
7084,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_failure_github_404_no_token() {
let mut cmd = main_command();
let test_github_404_path = fixtures_path().join("TEST_GITHUB_404.md");
cmd.arg(test_github_404_path)
.env_clear()
.assert()
.failure()
.code(2)
.stdout(contains("https://github.com/mre/idiomatic-rust-doesnt-exist-man \
(GitHub token not specified. To check GitHub links reliably, use `--github-token` flag / `GITHUB_TOKEN` env var.)"));
} | rust_cleaned_test_functions.jsonl/134339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43618,
1889,
3827,
62,
19,
15,
19,
6536,
6458,
368,
341,
286,
1077,
5206,
5439,
284,
1887,
10811,
543,
286,
1077,
1273,
1889,
3827,
62,
19,
15,
19,
2638,
284,
37664,
2638,
1005,
5987,
445,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_rule_inspect_state_passes_through_fields() {
let inspector = inspect::Inspector::new();
let node = inspector.root().create_child("rule_node");
let rule = rule!("fuchsia.com" => "example.com", "/foo" => "/bar");
let _state = create_rule_inspect_state(&rule, node);
assert_data_tree!(
inspector,
root: {
rule_node: {
host_match: rule.host_match().to_string(),
host_replacement: rule.host_replacement().to_string(),
path_prefix_match: rule.path_prefix_match().to_string(),
path_prefix_replacement: rule.path_prefix_replacement().to_string(),
}
}
);
} | rust_cleaned_test_functions.jsonl/46510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
21124,
34386,
987,
4387,
15464,
288,
87399,
12132,
368,
341,
286,
1077,
44725,
284,
24085,
486,
46230,
486,
931,
543,
286,
1077,
2436,
284,
44725,
12576,
1005,
3182,
17268,
445,
12937,
5084,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flatten() {
let c1 = XyY::new(0.5, 0.3, 0.8);
assert_eq!(c1.as_slice(), &[0.5, 0.3, 0.8]);
assert_relative_eq!(XyY::from_slice(c1.as_slice()), c1);
} | rust_cleaned_test_functions.jsonl/67705 | {
"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,
5081,
14456,
368,
341,
286,
1077,
272,
16,
284,
1599,
88,
56,
486,
931,
7,
15,
13,
20,
11,
220,
15,
13,
18,
11,
220,
15,
13,
23,
317,
286,
2060,
10714,
10297,
66,
16,
5357,
26488,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_refill_empty() {
assert_eq!(&[""], refill("", 0).as_slice());
assert_eq!(&[""], refill("", 10).as_slice());
} | rust_cleaned_test_functions.jsonl/1849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
483,
15124,
368,
341,
286,
2060,
10714,
0,
2099,
1183,
7914,
73715,
19814,
220,
15,
568,
300,
26488,
1423,
286,
2060,
10714,
0,
2099,
1183,
7914,
73715,
19814,
220,
16,
15,
568,
300,
26488... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_str_radix_fail() {
fn test(s: &str) {
let radix: Option<Rational> = FromStrRadix::from_str_radix(s, 3);
assert_eq!(radix, None);
}
let xs = ["0 /1", "abc", "", "1/", "--1/2","3/2/1", "3/2"];
for &s in xs.iter() {
test(s);
}
} | rust_cleaned_test_functions.jsonl/80851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
39764,
941,
22121,
368,
341,
286,
5168,
1273,
1141,
25,
609,
495,
8,
341,
310,
1077,
75658,
25,
6959,
23370,
1663,
29,
284,
5542,
2580,
41931,
941,
486,
1499,
2895,
39764,
941,
1141,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fieldless() {
let empty: &[u8] = b"";
assert_eq!(U6::parse(b"\x00"), Ok((empty, U6::A)));
assert!(U6::parse(b"\x01").is_err());
assert_eq!(U6::parse(b"\x02"), Ok((empty, U6::B)));
} | rust_cleaned_test_functions.jsonl/96092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
5013,
1717,
368,
341,
262,
1077,
4287,
25,
44590,
84,
23,
60,
284,
293,
1,
876,
262,
2060,
10714,
10297,
52,
21,
486,
6400,
1883,
11934,
87,
15,
15,
3975,
7622,
1188,
3194,
11,
547,
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_0310_example_1() {
let n = 4;
let edges = vec![vec![1, 0], vec![1, 2], vec![1, 3]];
let result = vec![1];
assert_eq!(Solution::find_min_height_trees(n, edges), result);
} | rust_cleaned_test_functions.jsonl/33325 | {
"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,
15,
18,
16,
15,
39304,
62,
16,
368,
341,
286,
1077,
308,
284,
220,
19,
280,
286,
1077,
12822,
284,
7486,
20703,
4083,
20703,
16,
11,
220,
15,
1125,
7486,
20703,
16,
11,
220,
17,
1125,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_integer() {
struct TestRdbHandler {
map: HashMap<String, String>,
}
impl EventHandler for TestRdbHandler {
fn handle(&mut self, data: Event) {
match data {
Event::RDB(rdb) => match rdb {
Object::String(kv) => {
self.map.insert(
String::from_utf8_lossy(kv.key).to_string(),
String::from_utf8_lossy(kv.value).to_string(),
);
}
Object::EOR => {
assert_eq!(self.map.get("125").unwrap(), "Positive 8 bit integer");
assert_eq!(self.map.get("43947").unwrap(), "Positive 16 bit integer");
assert_eq!(self.map.get("183358245").unwrap(), "Positive 32 bit integer");
assert_eq!(self.map.get("-123").unwrap(), "Negative 8 bit integer");
assert_eq!(self.map.get("-29477").unwrap(), "Negative 16 bit integer");
assert_eq!(self.map.get("-183358245").unwrap(), "Negative 32 bit integer");
}
_ => {}
},
Event::AOF(_) => {}
}
}
}
start_redis_test(
"integer_keys.rdb",
10003,
Rc::new(RefCell::new(TestRdbHandler { map: HashMap::new() })),
);
} | rust_cleaned_test_functions.jsonl/93087 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 832
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31725,
368,
341,
262,
2036,
3393,
49,
1999,
3050,
341,
286,
2415,
25,
10528,
3464,
11,
923,
12520,
262,
555,
262,
11605,
31957,
369,
3393,
49,
1999,
3050,
341,
286,
5168,
3705,
2099,
6984,
656,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_output_ordering_bip69() {
use std::str::FromStr;
let original_tx = ordering_test_tx!();
let mut tx = original_tx;
TxOrdering::Bip69Lexicographic.sort_tx(&mut tx);
assert_eq!(
tx.input[0].previous_output,
bitcoin::OutPoint::from_str(
"0e53ec5dfb2cb8a71fec32dc9a634a35b7e24799295ddd5278217822e0b31f57:5"
)
.unwrap()
);
assert_eq!(
tx.input[1].previous_output,
bitcoin::OutPoint::from_str(
"0f60fdd185542f2c6ea19030b0796051e7772b6026dd5ddccd7a2f93b73e6fc2:0"
)
.unwrap()
);
assert_eq!(
tx.input[2].previous_output,
bitcoin::OutPoint::from_str(
"0f60fdd185542f2c6ea19030b0796051e7772b6026dd5ddccd7a2f93b73e6fc2:1"
)
.unwrap()
);
assert_eq!(tx.output[0].value, 800);
assert_eq!(tx.output[1].script_pubkey, From::from(vec![0xAA]));
assert_eq!(tx.output[2].script_pubkey, From::from(vec![0xAA, 0xEE]));
} | rust_cleaned_test_functions.jsonl/5557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
7869,
287,
880,
573,
21,
24,
368,
341,
286,
990,
1460,
486,
495,
486,
3830,
2580,
401,
286,
1077,
4024,
17805,
284,
21391,
4452,
17805,
0,
543,
286,
1077,
5206,
9854,
284,
4024,
17805,
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_create_wallet() {
let (mut testkit, api) = create_testkit();
// Create and send a transaction via API
let (tx, _) = api.create_wallet(ALICE_NAME);
testkit.create_block();
api.assert_tx_status(&tx.hash(), &json!({ "type": "success" }));
// Check that the user indeed is persisted by the service.
let wallet = api.get_wallet(tx.pub_key());
assert_eq!(wallet.pub_key(), tx.pub_key());
assert_eq!(wallet.name(), tx.name());
assert_eq!(wallet.balance(), 100);
} | rust_cleaned_test_functions.jsonl/12384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
62308,
368,
341,
262,
1077,
320,
6984,
1273,
8226,
11,
6330,
8,
284,
1855,
4452,
8226,
543,
262,
442,
4230,
323,
3624,
264,
7745,
4566,
5333,
198,
262,
1077,
320,
3998,
11,
27439,
284,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assembler_registry_literal_addition() {
test_case(&["SET A, [I + 0x1000]"], &[0x5801, 0x1000]);
test_case(&["SET A, [0x1000 + I]"], &[0x5801, 0x1000]);
test_case(&["SET A, [J+1]"], &[0x5c01, 0x0001]);
} | rust_cleaned_test_functions.jsonl/44769 | {
"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,
11898,
35401,
50650,
34100,
2891,
680,
368,
341,
262,
1273,
19096,
2099,
1183,
5884,
362,
11,
508,
40,
488,
220,
15,
87,
16,
15,
15,
15,
60,
7914,
44590,
15,
87,
20,
23,
15,
16,
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... | 1 |
#[test]
fn test_blockhash_query_new_from_matches_with_nonce_fail() {
let test_commands = App::new("blockhash_query_test")
.arg(blockhash_arg())
// We can really only hit this case if the arg requirements
.arg(sign_only_arg().requires(""));
let nonce_pubkey = Pubkey::new(&[1u8; 32]);
let nonce_string = nonce_pubkey.to_string();
let matches = test_commands.clone().get_matches_from(vec![
"blockhash_query_test",
"--sign-only",
"--nonce",
&nonce_string,
]);
BlockhashQuery::new_from_matches(&matches);
} | rust_cleaned_test_functions.jsonl/16480 | {
"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,
7113,
8296,
5738,
5921,
5673,
38344,
6615,
48508,
22121,
368,
341,
286,
1077,
1273,
44151,
284,
1845,
486,
931,
445,
4574,
8296,
5738,
4452,
1138,
310,
659,
858,
18682,
8296,
6057,
2398,
310,
442,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unsized_unique() {
let xs: &mut [i32] = &mut [1, 2, 3];
let ptr = unsafe { Unique::new(xs as *mut [i32]) };
let ys = unsafe { &mut **ptr };
let zs: &mut [i32] = &mut [1, 2, 3];
assert!(ys == zs);
} | rust_cleaned_test_functions.jsonl/5897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
82,
1506,
21218,
368,
341,
262,
1077,
11943,
25,
609,
6984,
508,
72,
18,
17,
60,
284,
609,
6984,
508,
16,
11,
220,
17,
11,
220,
18,
935,
262,
1077,
10087,
284,
19860,
314,
28650,
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_resolve_vars() {
let d = Dockerfile::parse(indoc!(r#"
ARG image=alpine:3.12
FROM $image
"#)).unwrap();
let from: &FromInstruction = d.instructions
.get(1).unwrap()
.try_into().unwrap();
assert_eq!(
from.image_parsed.resolve_vars(&d),
Some(ImageRef::parse("alpine:3.12"))
);
} | rust_cleaned_test_functions.jsonl/17934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
11168,
368,
341,
262,
1077,
294,
284,
40549,
1192,
486,
6400,
23884,
509,
10297,
81,
2,
698,
414,
32746,
2168,
28,
278,
38038,
25,
18,
13,
16,
17,
198,
414,
4295,
400,
1805,
198,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repo_as_arg_parsing() {
let github_url = "https://github.com/killercup/cargo-edit/";
let args_github = Args {
crates: vec![github_url.to_owned()],
..Args::default()
};
assert_eq!(
args_github.parse_dependencies().unwrap(),
vec![Dependency::new("cargo-edit").set_git(github_url, None)]
);
let gitlab_url = "https://gitlab.com/Polly-lang/Polly.git";
let args_gitlab = Args {
crates: vec![gitlab_url.to_owned()],
..Args::default()
};
assert_eq!(
args_gitlab.parse_dependencies().unwrap(),
vec![Dependency::new("polly").set_git(gitlab_url, None)]
);
} | rust_cleaned_test_functions.jsonl/88108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37784,
11898,
6057,
620,
28598,
368,
341,
286,
1077,
31004,
2903,
284,
330,
2428,
1110,
5204,
905,
14,
10851,
2962,
454,
2899,
12088,
22142,
37254,
286,
1077,
2827,
1889,
3827,
284,
17693,
341,
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_try_predicate() {
let mut reader = Reader::init("hi");
assert!(reader.try_literal("hi"));
assert_eq!(reader.state.cursor, 2);
let mut reader = Reader::init("hello");
assert!(!reader.try_literal("hi"));
assert_eq!(reader.state.cursor, 0);
} | rust_cleaned_test_functions.jsonl/96392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
97474,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
445,
6023,
797,
286,
2060,
10297,
11149,
48779,
34100,
445,
6023,
4010,
286,
2060,
10714,
10297,
11149,
3467,
20702,
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_channel_get_freq_100() {
let chan = Channel(100);
assert_eq!(473.0f32, chan.get_freq_mhz());
} | rust_cleaned_test_functions.jsonl/110246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14571,
3062,
21790,
62,
16,
15,
15,
368,
341,
286,
1077,
26023,
284,
13434,
7,
16,
15,
15,
317,
286,
2060,
10714,
10297,
19,
22,
18,
13,
15,
69,
18,
17,
11,
26023,
670,
21790,
717,
37259,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_string_foo() -> IonResult<()> {
let mut cursor = ion_cursor_for(&[0x83, 0x66, 0x6f, 0x6f]);
assert_eq!(cursor.next()?, Some(Value(IonType::String, false)));
assert_eq!(cursor.read_string()?, Some(String::from("foo")));
Ok(())
} | rust_cleaned_test_functions.jsonl/82743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
3904,
761,
2624,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
5206,
8128,
284,
27672,
28601,
5478,
2099,
58,
15,
87,
23,
18,
11,
220,
15,
87,
21,
21,
11,
220,
15,
87,
21,
69,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_contains() {
let bm = Bitmask::Flag4 | Bitmask::Flag6;
assert_eq!(bm.contains(Bitmask::Flag4), true);
assert_eq!(bm.contains(Bitmask::Flag4 | Bitmask::Flag6), true);
assert_eq!(bm.contains(Bitmask::Flag1), false);
assert_eq!(bm.contains(Bitmask::Flag4 | Bitmask::Flag1), false);
} | rust_cleaned_test_functions.jsonl/52486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
368,
341,
286,
1077,
34868,
284,
6495,
11258,
486,
12135,
19,
760,
6495,
11258,
486,
12135,
21,
280,
286,
2060,
10714,
10297,
29307,
8786,
68653,
11258,
486,
12135,
19,
701,
830,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flush_accounts_cache_if_needed() {
run_test_flush_accounts_cache_if_needed(0, 2 * MAX_CACHE_SLOTS);
run_test_flush_accounts_cache_if_needed(2 * MAX_CACHE_SLOTS, 0);
run_test_flush_accounts_cache_if_needed(MAX_CACHE_SLOTS - 1, 0);
run_test_flush_accounts_cache_if_needed(0, MAX_CACHE_SLOTS - 1);
run_test_flush_accounts_cache_if_needed(MAX_CACHE_SLOTS, 0);
run_test_flush_accounts_cache_if_needed(0, MAX_CACHE_SLOTS);
run_test_flush_accounts_cache_if_needed(2 * MAX_CACHE_SLOTS, 2 * MAX_CACHE_SLOTS);
run_test_flush_accounts_cache_if_needed(MAX_CACHE_SLOTS - 1, MAX_CACHE_SLOTS - 1);
run_test_flush_accounts_cache_if_needed(MAX_CACHE_SLOTS, MAX_CACHE_SLOTS);
} | rust_cleaned_test_functions.jsonl/1413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39213,
55665,
11529,
11119,
57426,
368,
341,
286,
1598,
4452,
39213,
55665,
11529,
11119,
57426,
7,
15,
11,
220,
17,
353,
8334,
29138,
1098,
74602,
317,
286,
1598,
4452,
39213,
55665,
11529,
11119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_range_i64_max() {
assert_eq!(i64::max_value.to_i8(), None);
assert_eq!(i64::max_value.to_i16(), None);
assert_eq!(i64::max_value.to_i32(), None);
assert_eq!(i64::max_value.to_i64(), Some(i64::max_value as i64));
assert_eq!(i64::max_value.to_u8(), None);
assert_eq!(i64::max_value.to_u16(), None);
assert_eq!(i64::max_value.to_u32(), None);
assert_eq!(i64::max_value.to_u64(), Some(i64::max_value as u64));
#[cfg(target_word_size = "32")]
fn check_word_size() {
assert_eq!(i64::max_value.to_int(), None);
assert_eq!(i64::max_value.to_uint(), None);
}
#[cfg(target_word_size = "64")]
fn check_word_size() {
assert_eq!(i64::max_value.to_int(), Some(i64::max_value as int));
assert_eq!(i64::max_value.to_uint(), Some(i64::max_value as uint));
}
check_word_size();
} | rust_cleaned_test_functions.jsonl/12454 | {
"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,
5303,
9698,
5318,
21,
19,
6345,
368,
341,
1789,
286,
2060,
10714,
10297,
72,
21,
19,
486,
2810,
3142,
2389,
5318,
23,
1507,
256,
2240,
317,
286,
2060,
10714,
10297,
72,
21,
19,
486,
2810,
3142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simd_is_ascii_failure() {
let input: [u8; 16] = [
0x61, 0x62, 0x63, 0x64, 0x81, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74,
0x75, 0x76,
];
let simd = unsafe { load16_unaligned(input.as_ptr()) };
assert!(!simd_is_ascii(simd));
} | rust_cleaned_test_functions.jsonl/30499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18314,
67,
6892,
50238,
43618,
368,
341,
286,
1077,
1946,
25,
508,
84,
23,
26,
220,
16,
21,
60,
284,
2278,
310,
220,
15,
87,
21,
16,
11,
220,
15,
87,
21,
17,
11,
220,
15,
87,
21,
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... | 1 |
#[test]
fn test_two_paths() {
check(
r#"
macro_rules! m {
($i:path, $j:path) => { fn foo() { let a = $ i; let b = $j; } }
}
m! { foo, bar }
"#,
expect![[r#"
macro_rules! m {
($i:path, $j:path) => { fn foo() { let a = $ i; let b = $j; } }
}
fn foo() {
let a = foo;
let b = bar;
}
"#]],
);
} | rust_cleaned_test_functions.jsonl/85222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
24152,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
341,
262,
1711,
72,
71796,
11,
400,
73,
71796,
8,
589,
314,
5168,
15229,
368,
314,
1077,
264,
284,
400,
600,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chan_reserve_dust_inbound_htlcs_inbound_chan() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 98000000, InitFeatures::known(), InitFeatures::known());
let payment_amt = 46000; // Dust amount
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
// Then these next 5 would be interpreted by nodes[1] as violating the fee spike buffer.
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
// And this last payment previously resulted in nodes[1] closing on its inbound-channel
// transaction fee and therefore perceived this next payment as a channel reserve violation.
let (_, _, _) = route_payment(&nodes[0], &[&nodes[1]], payment_amt);
} | rust_cleaned_test_functions.jsonl/16874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45552,
89591,
814,
590,
1243,
10891,
49086,
75,
4837,
1243,
10891,
45552,
368,
341,
11120,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reconnect() {
struct MockClient {
reconnect_count: Mutex<usize>,
cluster: RwLock<((), Instant)>,
}
#[async_trait]
impl Reconnect for MockClient {
type Cl = ();
async fn reconnect(&self, _: u64) -> Result<()> {
*self.reconnect_count.lock().unwrap() += 1;
Err(Error::Unimplemented)
}
}
async fn retry_err(client: Arc<MockClient>) -> Result<()> {
retry!(client, "test", |_c| ready(Err(internal_err!("whoops"))))
}
async fn retry_ok(client: Arc<MockClient>) -> Result<()> {
retry!(client, "test", |_c| ready(Ok::<_, Error>(())))
}
executor::block_on(async {
let client = Arc::new(MockClient {
reconnect_count: Mutex::new(0),
cluster: RwLock::new(((), Instant::now())),
});
assert!(retry_err(client.clone()).await.is_err());
assert_eq!(*client.reconnect_count.lock().unwrap(), MAX_REQUEST_COUNT);
*client.reconnect_count.lock().unwrap() = 0;
assert!(retry_ok(client.clone()).await.is_ok());
assert_eq!(*client.reconnect_count.lock().unwrap(), 0);
})
} | rust_cleaned_test_functions.jsonl/9519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 690
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
6459,
368,
341,
286,
2036,
14563,
2959,
341,
310,
50036,
3180,
25,
66215,
90244,
12520,
310,
10652,
25,
55294,
11989,
28706,
1507,
18058,
8,
12520,
286,
555,
286,
11506,
7692,
78491,
921,
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_monad_laws_right_identity() {
assert_eq!((0..10).flat_map(|x| once(x)).sum::<usize>(), (0..10).sum());
} | rust_cleaned_test_functions.jsonl/54201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20737,
329,
907,
8635,
10539,
46244,
368,
341,
262,
2060,
10714,
0,
1188,
15,
496,
16,
15,
568,
26229,
5376,
22428,
87,
91,
3055,
2075,
4579,
1242,
27638,
51878,
39019,
320,
15,
496,
16,
15,
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 |
#[test]
fn test_end_session_event() {
new_test_ext().execute_with(|| {
advance_session();
advance_session();
advance_session();
advance_session();
advance_session();
advance_session();
advance_session();
advance_session();
advance_session();
});
} | rust_cleaned_test_functions.jsonl/35136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6213,
12316,
6748,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
197,
59320,
12316,
543,
197,
197,
59320,
12316,
543,
197,
197,
59320,
12316,
543,
197,
197,
59320,
12316,
543,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_precedence() {
use crate::{Precedence, Token};
macro_rules! equal_precedence {
($token: expr, $expected: expr) => {
let from_token = Precedence::from_token($token);
if from_token != $expected {
panic!("The precedences are not equal:\nToken Precedence: {}\nExpected Precedence: {}", from_token, $expected);
}
};
}
// Lowest
equal_precedence!(
Token::Identifier(String::from("identifier")),
Precedence::Lowest
);
equal_precedence!(Token::Str(String::from("'string'")), Precedence::Lowest);
equal_precedence!(Token::Num(1.0), Precedence::Lowest);
equal_precedence!(Token::True, Precedence::Lowest);
equal_precedence!(Token::False, Precedence::Lowest);
equal_precedence!(Token::Let, Precedence::Lowest);
equal_precedence!(Token::Const, Precedence::Lowest);
equal_precedence!(Token::Func, Precedence::Lowest);
equal_precedence!(Token::Return, Precedence::Lowest);
equal_precedence!(Token::If, Precedence::Lowest);
equal_precedence!(Token::Else, Precedence::Lowest);
equal_precedence!(Token::Interface, Precedence::Lowest);
equal_precedence!(Token::Boolean, Precedence::Lowest);
equal_precedence!(Token::String, Precedence::Lowest);
equal_precedence!(Token::Number, Precedence::Lowest);
equal_precedence!(Token::Void, Precedence::Lowest);
equal_precedence!(Token::Comma, Precedence::Lowest);
equal_precedence!(Token::Colon, Precedence::Lowest);
equal_precedence!(Token::Semicolon, Precedence::Lowest);
equal_precedence!(Token::EqualGreater, Precedence::Lowest);
equal_precedence!(Token::RightParentheses, Precedence::Lowest);
equal_precedence!(Token::LeftBrace, Precedence::Lowest);
equal_precedence!(Token::RightBrace, Precedence::Lowest);
equal_precedence!(Token::RightBracket, Precedence::Lowest);
equal_precedence!(Token::DoubleVBar, Precedence::Lowest);
equal_precedence!(Token::DoubleAmper, Precedence::Lowest);
equal_precedence!(Token::EndOfLine, Precedence::Lowest);
equal_precedence!(Token::EndOfFile, Precedence::Lowest);
// Assignment
equal_precedence!(Token::Equal, Precedence::Assignment);
equal_precedence!(Token::PlusEqual, Precedence::Assignment);
equal_precedence!(Token::MinusEqual, Precedence::Assignment);
equal_precedence!(Token::StarEqual, Precedence::Assignment);
equal_precedence!(Token::SlashEqual, Precedence::Assignment);
equal_precedence!(Token::PercentEqual, Precedence::Assignment);
equal_precedence!(Token::DoubleStarEqual, Precedence::Assignment);
// Equals
equal_precedence!(Token::DoubleEqual, Precedence::Equals);
equal_precedence!(Token::NotEqual, Precedence::Equals);
equal_precedence!(Token::LessEqual, Precedence::Equals);
equal_precedence!(Token::GreaterEqual, Precedence::Equals);
// LessGreater
equal_precedence!(Token::Less, Precedence::LessGreater);
equal_precedence!(Token::Greater, Precedence::LessGreater);
// Sum
equal_precedence!(Token::Plus, Precedence::Sum);
equal_precedence!(Token::Minus, Precedence::Sum);
// Product
equal_precedence!(Token::Star, Precedence::Product);
equal_precedence!(Token::Slash, Precedence::Product);
equal_precedence!(Token::Percent, Precedence::Product);
// Exponent
equal_precedence!(Token::DoubleStar, Precedence::Exponent);
// Call
equal_precedence!(Token::LeftParentheses, Precedence::Call);
// Index
equal_precedence!(Token::LeftBracket, Precedence::Index);
// Method
equal_precedence!(Token::Dot, Precedence::Method);
} | rust_cleaned_test_functions.jsonl/126456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
1998,
763,
368,
341,
262,
990,
17717,
22964,
4703,
1998,
763,
11,
9660,
2315,
262,
18072,
21407,
0,
6144,
10442,
1998,
763,
341,
286,
1711,
5839,
25,
15169,
11,
400,
7325,
25,
15169,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iter_role_ids() {
let mut iter = Id::<RoleMarker>::iter("some <@&123> roles <@&456>");
assert_eq!(Id::new(123), iter.next().unwrap().0);
assert_eq!(Id::new(456), iter.next().unwrap().0);
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/99687 | {
"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,
11723,
19792,
8077,
368,
341,
286,
1077,
5206,
5367,
284,
5223,
27638,
9030,
20613,
6831,
2015,
445,
14689,
366,
31,
5,
16,
17,
18,
29,
12783,
366,
31,
5,
19,
20,
21,
15084,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_resource_blocks_missing_has_permission_clean() {
let mut kb = KnowledgeBase::new();
kb.resource_blocks
.resources
.insert(term!(sym!("Organization")));
kb.add_rule(rule!("f", [sym!("x")] => call!("has_permission", [sym!("y")])));
assert!(check_resource_blocks_missing_has_permission(&kb).is_none());
} | rust_cleaned_test_functions.jsonl/102137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
17962,
25201,
40447,
21778,
37971,
19573,
368,
341,
286,
1077,
5206,
38653,
284,
31925,
3978,
486,
931,
543,
286,
38653,
24013,
25201,
198,
310,
659,
12745,
198,
310,
659,
4208,
44654,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_seat() {
assert_eq!(find_seat_id("BFFFBBFRRR"), 567);
assert_eq!(find_seat_id("FFFBBBFRRR"), 119);
assert_eq!(find_seat_id("BBFFBBFRLL"), 820);
} | rust_cleaned_test_functions.jsonl/67399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
91381,
368,
341,
286,
2060,
10714,
10297,
3903,
91381,
842,
445,
33,
31203,
10098,
37,
8106,
49,
3975,
220,
20,
21,
22,
317,
286,
2060,
10714,
10297,
3903,
91381,
842,
445,
31203,
10098,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_overwrite_and_extend_buffer() {
let mut t = spooled_tempfile(100);
assert_eq!(t.write(b"abcdefghijklmnopqrstuvwxyz").unwrap(), 26);
assert_eq!(t.seek(SeekFrom::End(-5)).unwrap(), 21);
assert_eq!(t.write(b"0123456789").unwrap(), 10);
assert_eq!(t.seek(SeekFrom::Start(0)).unwrap(), 0);
let mut buf = Vec::new();
assert_eq!(t.read_to_end(&mut buf).unwrap(), 31);
assert_eq!(buf.as_slice(), b"abcdefghijklmnopqrstu0123456789");
assert!(!t.is_rolled());
} | rust_cleaned_test_functions.jsonl/115759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15431,
4934,
8378,
70265,
7776,
368,
341,
262,
1077,
5206,
259,
284,
978,
45073,
11771,
1192,
7,
16,
15,
15,
317,
262,
2060,
10714,
10297,
83,
3836,
1883,
1,
67512,
1827,
15454,
1507,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_schema_ref() -> Result<()> {
let file = PathBuf::from(VMWARE_SPEC);
let spec = &Spec::read_files(&[&file])?;
spec.resolve_schema_ref(&file, Reference::parse("#/definitions/OperationList").unwrap())?;
spec.resolve_schema_ref(
&file,
Reference::parse("../../../../../common-types/resource-management/v1/types.json#/definitions/ErrorResponse").unwrap(),
)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/45098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
25371,
7793,
368,
1464,
5714,
71698,
341,
262,
1077,
1034,
284,
7933,
15064,
486,
1499,
7,
11187,
7663,
36436,
317,
262,
1077,
1398,
284,
609,
8327,
486,
878,
10931,
2099,
58,
5,
1192,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_column_u64() {
let mut fields: Vec<FieldType> = vec![
FieldTypeTp::Tiny.into(),
FieldTypeTp::Short.into(),
FieldTypeTp::Int24.into(),
FieldTypeTp::Long.into(),
FieldTypeTp::LongLong.into(),
FieldTypeTp::Year.into(),
];
for field in &mut fields {
field.set_flag(FieldTypeFlag::UNSIGNED.bits());
}
let data = vec![
Datum::Null,
Datum::U64(1),
Datum::U64(u64::MIN),
Datum::U64(u64::MAX),
];
test_colum_datum(fields, data);
} | rust_cleaned_test_functions.jsonl/80491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
7300,
21,
19,
368,
341,
286,
1077,
5206,
5043,
25,
11312,
27,
63733,
29,
284,
7486,
90515,
310,
84614,
62241,
486,
85693,
39860,
3148,
310,
84614,
62241,
486,
12472,
39860,
3148,
310,
84614,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dlt_zero_terminated_string_early_terminated() {
let mut buf = BytesMut::with_capacity(4);
buf.extend_from_slice(b"id4\0somethingelse");
let res: IResult<&[u8], &str> = dlt_zero_terminated_string(&buf, 4);
println!("res : {:?}", res);
let expected: IResult<&[u8], &str> = Ok((b"somethingelse", "id4"));
assert_eq!(expected, res);
} | rust_cleaned_test_functions.jsonl/73195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
4832,
19359,
62,
68659,
3904,
62,
22140,
62,
68659,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
4197,
35603,
7,
19,
317,
286,
6607,
15831,
5673,
26488,
1883,
28700,
19,
59,
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_door() {
let door = 0;
let mut room = Room::new(vec![of_type("door"), I]);
assert!(!room.objects[door].matches(&Open.into()));
assert!(!room.objects[door].matches(&Closed.into()));
room.action(&I.opens(of_type("door"))).unwrap();
assert!(room.objects[door].matches(&Open.into()));
assert!(!room.objects[door].matches(&Closed.into()));
room.action(&I.closes(of_type("door"))).unwrap();
assert!(room.objects[door].matches(&Closed.into()));
assert!(!room.objects[door].matches(&Open.into()));
// Can not walk through door because it is closed.
assert!(room.action(&I.walks_through(of_type("door"))).is_err());
room.action(&I.opens(of_type("door"))).unwrap();
room.action(&I.walks_through(of_type("door"))).unwrap();
let mut room = Room::new(vec![of_type("door"), I, key_to(of_type("door"))]);
room.action(&I.closes(of_type("door"))).unwrap();
room.action(&I.locks(of_type("door"))).unwrap();
// Can not open door because it is locked.
assert!(room.action(&I.opens(of_type("door"))).is_err());
// Can not unlock door because I do not have the key.
assert!(room.action(&I.unlocks(of_type("door"))).is_err());
room.action(&I.picks_up(key_to(of_type("door")))).unwrap();
room.action(&I.unlocks(of_type("door"))).unwrap();
room.action(&I.opens(of_type("door"))).unwrap();
let mut room = Room::new(vec![
And(vec![He, has_not(key_to(of_type("door")))]),
She,
key_to(of_type("door"))
]);
assert!(room.action(&He.gives_item(She, key_to(of_type("door")))).is_err());
room.action(&He.picks_up(key_to(of_type("door")))).unwrap();
room.action(&He.gives_item(She, key_to(of_type("door")))).unwrap();
let i = 0;
let door = 1;
let mut room = Room::new(vec![I, of_type("door")]);
assert!(!room.objects[door].matches(&Locked.into()));
assert!(!room.objects[door].matches(&Closed.into()));
room.action(&I.locks(of_type("door"))).unwrap();
assert!(room.objects[door].matches(&Locked.into()));
// Assume door is closed when it gets locked.
assert!(room.objects[door].matches(&Closed.into()));
assert!(room.objects[i].locked(of_type("door")));
assert!(!room.objects[i].closed(of_type("door")));
} | rust_cleaned_test_functions.jsonl/38386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78962,
368,
341,
286,
1077,
6006,
284,
220,
15,
280,
286,
1077,
5206,
3054,
284,
10420,
486,
931,
25592,
20703,
1055,
1819,
445,
10787,
3975,
358,
2558,
286,
2060,
0,
3471,
2966,
8383,
58,
10787... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rng() {
let rng = botan::RandomNumberGenerator::new_system().unwrap();
let read1 = rng.read(10).unwrap();
let read2 = rng.read(10).unwrap();
assert!(read1 != read2);
} | rust_cleaned_test_functions.jsonl/95297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66849,
368,
341,
262,
1077,
28422,
284,
10924,
276,
486,
13999,
2833,
12561,
486,
931,
17687,
1005,
15454,
1428,
262,
1077,
1349,
16,
284,
28422,
4125,
7,
16,
15,
568,
15454,
543,
262,
1077,
134... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_many_times_same_text() {
let mut v = Vec::with_capacity(1000);
for _ in 0..1000 {
v.push("abc");
}
let mut hm = HashMap::new();
hm.insert('a', 1000);
hm.insert('b', 1000);
hm.insert('c', 1000);
assert_eq!(frequency::frequency(&v[..], 4), hm);
} | rust_cleaned_test_functions.jsonl/13547 | {
"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,
22101,
22353,
33574,
4326,
368,
341,
262,
1077,
5206,
348,
284,
11312,
486,
4197,
35603,
7,
16,
15,
15,
15,
317,
262,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
286,
348,
2552,
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... | 2 |
#[test]
fn test_mouse_button_primitives() {
for i in 0u32..9 {
let button: MouseButton = i.into();
let j: u32 = button.into();
assert_eq!(i, j);
}
} | rust_cleaned_test_functions.jsonl/54695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39203,
8487,
5294,
35209,
368,
341,
286,
369,
600,
304,
220,
15,
84,
18,
17,
496,
24,
341,
310,
1077,
3137,
25,
91203,
284,
600,
39860,
543,
310,
1077,
502,
25,
575,
18,
17,
284,
3137,
39860... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_path_paused_mpp() {
// Simple test of sending a multi-part payment where one path is currently blocked awaiting
// monitor update
let chanmon_cfgs = create_chanmon_cfgs(4);
let node_cfgs = create_node_cfgs(4, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs, &[None, None, None, None]);
let mut nodes = create_network(4, &node_cfgs, &node_chanmgrs);
let chan_1_id = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
let (chan_2_ann, _, chan_2_id, _) = create_announced_chan_between_nodes(&nodes, 0, 2, InitFeatures::known(), InitFeatures::known());
let chan_3_id = create_announced_chan_between_nodes(&nodes, 1, 3, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
let chan_4_id = create_announced_chan_between_nodes(&nodes, 2, 3, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
let logger = test_utils::TestLogger::new();
let (payment_preimage, payment_hash, payment_secret) = get_payment_preimage_hash!(&nodes[3]);
let mut route = get_route(&nodes[0].node.get_our_node_id(), &nodes[0].net_graph_msg_handler.network_graph.read().unwrap(), &nodes[3].node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &[], 100000, TEST_FINAL_CLTV, &logger).unwrap();
let path = route.paths[0].clone();
route.paths.push(path);
route.paths[0][0].pubkey = nodes[1].node.get_our_node_id();
route.paths[0][0].short_channel_id = chan_1_id;
route.paths[0][1].short_channel_id = chan_3_id;
route.paths[1][0].pubkey = nodes[2].node.get_our_node_id();
route.paths[1][0].short_channel_id = chan_2_ann.contents.short_channel_id;
route.paths[1][1].short_channel_id = chan_4_id;
*nodes[0].chain_monitor.update_ret.lock().unwrap() = Some(Ok(()));
*nodes[0].chain_monitor.next_update_ret.lock().unwrap() = Some(Err(ChannelMonitorUpdateErr::TemporaryFailure));
// the second got a MonitorUpdateFailed err. This implies PaymentSendFailure::PartialFailure as
if let Err(PaymentSendFailure::PartialFailure(results)) = nodes[0].node.send_payment(&route, payment_hash, &Some(payment_secret)) {
assert_eq!(results.len(), 2);
if let Ok(()) = results[0] {} else { panic!(); }
if let Err(APIError::MonitorUpdateFailed) = results[1] {} else { panic!(); }
} else { panic!(); }
check_added_monitors!(nodes[0], 2);
*nodes[0].chain_monitor.update_ret.lock().unwrap() = Some(Ok(()));
// Pass the first HTLC of the payment along to nodes[3].
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
pass_along_path(&nodes[0], &[&nodes[1], &nodes[3]], 0, payment_hash.clone(), payment_secret, events.pop().unwrap(), false);
// HTLC along to nodes[3] and claim the whole payment back to nodes[0].
let (outpoint, latest_update) = nodes[0].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_2_id).unwrap().clone();
nodes[0].node.channel_monitor_updated(&outpoint, latest_update);
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
pass_along_path(&nodes[0], &[&nodes[2], &nodes[3]], 200_000, payment_hash.clone(), payment_secret, events.pop().unwrap(), true);
claim_payment_along_route(&nodes[0], &[&[&nodes[1], &nodes[3]], &[&nodes[2], &nodes[3]]], false, payment_preimage);
} | rust_cleaned_test_functions.jsonl/120463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
55475,
2591,
717,
602,
368,
341,
197,
322,
8993,
1273,
315,
11628,
264,
7299,
28037,
8160,
1380,
825,
1815,
374,
5023,
19299,
43988,
198,
197,
322,
8718,
2647,
198,
10217,
26023,
1645,
18343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_faulty_component() {
assert_parser!(
component,
"BEGIN:FOO\nEND:F0O",
Component {
name: "FOO".into(),
properties: vec![],
components: vec![]
}
);
} | rust_cleaned_test_functions.jsonl/34980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70097,
88,
23406,
368,
341,
262,
2060,
18517,
33673,
286,
3692,
345,
286,
330,
37588,
25,
3788,
46,
1699,
4689,
69856,
15,
46,
756,
286,
5578,
341,
310,
829,
25,
330,
3788,
46,
3263,
18122,
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 |
#[test]
fn test_eq() {
let mut a = TrieMap::new();
let mut b = TrieMap::new();
assert!(a == b);
assert!(a.insert(0, 5i));
assert!(a != b);
assert!(b.insert(0, 4i));
assert!(a != b);
assert!(a.insert(5, 19));
assert!(a != b);
assert!(!b.insert(0, 5));
assert!(a != b);
assert!(b.insert(5, 19));
assert!(a == b);
} | rust_cleaned_test_functions.jsonl/7303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
368,
341,
286,
1077,
5206,
264,
284,
62783,
2227,
486,
931,
543,
286,
1077,
5206,
293,
284,
62783,
2227,
486,
931,
1428,
286,
2060,
10297,
64,
621,
293,
317,
286,
2060,
10297,
64,
7030,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_syscall_from_name() {
let num = get_syscall_from_name("open", None).unwrap();
println!(
"test_get_syscall_from_name: Got syscall number of open on native arch as {}",
num
);
let num = get_syscall_from_name("open", Some(ScmpArch::Arm)).unwrap();
println!(
"test_get_syscall_from_name: Got syscall number of open on ARM arch as {}",
num
);
} | rust_cleaned_test_functions.jsonl/66423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
20344,
6659,
5673,
1269,
368,
341,
286,
1077,
1629,
284,
633,
20344,
6659,
5673,
1269,
445,
2508,
497,
2240,
568,
15454,
543,
286,
13751,
33673,
310,
330,
1944,
3062,
20344,
6659,
5673,
1269... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_genotype_genotype_field_values() {
assert_eq!(parse_genotype_genotype_field_values(&[0x02, 0x02]), "0/0");
assert_eq!(parse_genotype_genotype_field_values(&[0x02, 0x04]), "0/1");
assert_eq!(parse_genotype_genotype_field_values(&[0x04, 0x04]), "1/1");
assert_eq!(parse_genotype_genotype_field_values(&[0x02, 0x05]), "0|1");
assert_eq!(parse_genotype_genotype_field_values(&[0x00, 0x00]), "./.");
assert_eq!(parse_genotype_genotype_field_values(&[0x02]), "0");
assert_eq!(parse_genotype_genotype_field_values(&[0x04]), "1");
assert_eq!(
parse_genotype_genotype_field_values(&[0x02, 0x04, 0x06]),
"0/1/2"
);
assert_eq!(
parse_genotype_genotype_field_values(&[0x02, 0x04, 0x07]),
"0/1|2"
);
assert_eq!(
parse_genotype_genotype_field_values(&[0x02, i8::from(Int8::EndOfVector)]),
"0"
);
} | rust_cleaned_test_functions.jsonl/52819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 536
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16322,
4156,
16322,
4156,
5013,
9146,
368,
341,
1789,
286,
2060,
10714,
10297,
6400,
16322,
4156,
16322,
4156,
5013,
9146,
2099,
58,
15,
87,
15,
17,
11,
220,
15,
87,
15,
17,
9719,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_body_with_args() {
let message = Message {
properties: MessageProperties {
correlation_id: "aaa".into(),
content_type: "application/json".into(),
content_encoding: "utf-8".into(),
reply_to: None,
},
headers: MessageHeaders {
id: "aaa".into(),
task: "TestTask".into(),
..Default::default()
},
raw_body: Vec::from(JSON),
};
let body = message.body::<TestTask>().unwrap();
assert_eq!(body.1.a, 4);
} | rust_cleaned_test_functions.jsonl/97956 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
14114,
6615,
8384,
368,
341,
262,
1077,
1943,
284,
4856,
341,
286,
5888,
25,
4856,
7903,
341,
310,
25588,
842,
25,
330,
32646,
3263,
18122,
3148,
310,
2213,
1819,
25,
330,
5132,
893... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_as_counted() {
let client: Box<dyn Counted<i64>> = Box::new(StatsdClient::from_sink("prefix", NopMetricSink));
client.count("some.counter", 5).unwrap();
} | rust_cleaned_test_functions.jsonl/10612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
11898,
3180,
291,
368,
341,
286,
1077,
2943,
25,
8261,
92846,
4504,
291,
21897,
21,
19,
2452,
284,
8261,
486,
931,
7,
16635,
67,
2959,
486,
1499,
51567,
445,
11849,
497,
451,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_clear() {
let mut map = VecMap::new();
assert!(map.insert(5, 20).is_none());
assert!(map.insert(11, 12).is_none());
assert!(map.insert(14, 22).is_none());
map.clear();
assert!(map.is_empty());
assert!(map.get(&5).is_none());
assert!(map.get(&11).is_none());
assert!(map.get(&14).is_none());
} | rust_cleaned_test_functions.jsonl/53265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21811,
368,
341,
286,
1077,
5206,
2415,
284,
11312,
2227,
486,
931,
543,
286,
2060,
10297,
2186,
7030,
7,
20,
11,
220,
17,
15,
568,
285,
31488,
1423,
286,
2060,
10297,
2186,
7030,
7,
16,
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_dtls_transport_state_string() {
let tests = vec![
(DTLSTransportState::Unspecified, "Unspecified"),
(DTLSTransportState::New, "New"),
(DTLSTransportState::Connecting, "Connecting"),
(DTLSTransportState::Connected, "Connected"),
(DTLSTransportState::Closed, "Closed"),
(DTLSTransportState::Failed, "Failed"),
];
for (state, expected_string) in tests {
assert_eq!(expected_string, state.to_string(),)
}
} | rust_cleaned_test_functions.jsonl/16302 | {
"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,
27516,
4730,
46398,
4387,
3904,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
10599,
43,
784,
33389,
403,
1397,
486,
1806,
53434,
11,
330,
1806,
53434,
4461,
310,
320,
10599,
43,
784,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_create_schema_fails() {
let _setup = SetupDefaults::init();
let err = create_and_publish_schema("1", "VsKV7grR1BUE29mG2Fm2kX".to_string(),
"name".to_string(),
"1.0".to_string(),
"".to_string()).unwrap_err();
assert_eq!(err.kind(), VcxErrorKind::InvalidLibindyParam)
} | rust_cleaned_test_functions.jsonl/33232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25371,
761,
6209,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16273,
486,
2327,
1428,
286,
1077,
1848,
284,
1855,
8378,
58779,
25371,
445,
16,
497,
330,
51737,
82707,
22,
901,
49,
16,
33,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_restart_with_invalid_cfg_on_pd() {
let pd_client = Arc::new(MockPdClient::new());
let id = "localhost:1080";
let mut cfg = TiKvConfig::default();
let temp_dir = Builder::new().prefix("config_test").tempdir().unwrap();
cfg.storage.data_dir = format!("{}", temp_dir.path().display());
// register config
let mut cfg_handler = pd_client.clone().register(id, cfg, true);
// update config on pd side and refresh local config
pd_client.update_cfg(id, |cfg| {
cfg.raft_store.raft_log_gc_threshold = 100;
});
cfg_handler.refresh_config(pd_client.as_ref()).unwrap();
let valid_cfg = cfg_handler.get_config().clone();
// update to invalid config on pd side
pd_client.update_cfg(id, |cfg| {
cfg.raft_store.raft_log_gc_threshold = 0;
});
// restart config handler
let cfg_handler = pd_client.register(id, valid_cfg.clone(), true);
// should use last valid config
assert_eq!(
cfg_handler.get_config().raft_store.raft_log_gc_threshold,
100
);
assert_eq!(cfg_handler.get_config(), &valid_cfg)
} | rust_cleaned_test_functions.jsonl/103838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69392,
6615,
31433,
18343,
4470,
31322,
368,
341,
262,
1077,
7744,
8179,
284,
19689,
486,
931,
66436,
47,
67,
2959,
486,
931,
1423,
262,
1077,
877,
284,
330,
8301,
25,
16,
15,
23,
15,
876,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_symbol_table() {
let mut symbol_table: SymbolTable = HashMap::new();
symbol_table
.insert(make_identifier!("aglaeactis"), Symbol::StringValue("sunbeam".to_string()));
symbol_table
.insert(make_identifier!("eriocnemis"), Symbol::StringValue("puffleg".to_string()));
symbol_table
.insert(make_identifier!("heliangelus"), Symbol::StringValue("sunangel".to_string()));
let bind_program = BindProgram {
instructions: vec![],
symbol_table: symbol_table.clone(),
use_new_bytecode: true,
};
let bytecode = encode_to_bytecode_v2(bind_program).unwrap();
let bind_program = DecodedProgram::new(bytecode).unwrap();
let expected_symbols = vec!["sunbeam", "puffleg", "sunangel"];
let decoded_symbols = bind_program
.symbol_table
.values()
.map(|symbol| symbol.clone())
.collect::<Vec<String>>();
for symbol in expected_symbols {
assert!(decoded_symbols.contains(&symbol.to_string()));
}
} | rust_cleaned_test_functions.jsonl/67984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 523
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21179,
5237,
368,
341,
286,
1077,
5206,
7735,
5237,
25,
19612,
2556,
284,
10528,
486,
931,
543,
286,
7735,
5237,
198,
310,
659,
4208,
36944,
33176,
17223,
351,
4260,
68,
531,
285,
3975,
19612,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_query_all_subspaces() {
let desmos_cli = DesmosCli::default();
let contract_address = desmos_cli.get_contract_by_code(1);
let query = DesmosChain {
request: SubspacesQuery::Subspaces { pagination: None }.into(),
};
let response: QuerySubspacesResponse =
desmos_cli.wasm_query(&contract_address, &query).to_object();
let test_subspace = response.subspaces.first().unwrap();
assert_eq!("Test subspace", test_subspace.name.as_str());
assert_eq!("", test_subspace.description.as_str());
assert_eq!(&contract_address, test_subspace.treasury.as_str());
assert_eq!(&contract_address, test_subspace.owner.as_str());
assert_eq!(&contract_address, test_subspace.creator.as_str());
} | rust_cleaned_test_functions.jsonl/93733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
5705,
5228,
44285,
368,
341,
286,
1077,
939,
8631,
47147,
284,
3874,
8631,
87014,
486,
2258,
543,
286,
1077,
5116,
6744,
284,
939,
8631,
47147,
670,
51499,
3710,
4136,
7,
16,
626,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invocation_flag() {
info("fun f() { g(); } fun g() { }", |_, jit_info| {
assert!(!jit_info.leaf);
});
info("fun f() { }", |_, jit_info| {
assert!(jit_info.leaf);
});
} | rust_cleaned_test_functions.jsonl/73140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19996,
2276,
10933,
368,
341,
286,
3546,
445,
11894,
282,
368,
314,
342,
2129,
335,
2464,
342,
368,
314,
335,
497,
760,
6878,
84573,
3109,
91,
341,
310,
2060,
0,
3471,
58809,
3109,
13,
24153,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_local() {
let vi = get_version_info!();
assert_eq!(vi.major, 0);
assert_eq!(vi.minor, 2);
assert_eq!(vi.patch, 0);
assert_eq!(vi.crate_name, "rustc_tools_util");
// hard to make positive tests for these since they will always change
assert!(vi.commit_hash.is_none());
assert!(vi.commit_date.is_none());
} | rust_cleaned_test_functions.jsonl/19651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
13564,
368,
341,
286,
1077,
3275,
284,
633,
9438,
3109,
0,
543,
286,
2060,
10714,
10297,
9971,
75412,
11,
220,
15,
317,
286,
2060,
10714,
10297,
9971,
4358,
269,
11,
220,
17,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scrub_mem() {
let mut v = vec![1,2,3];
botan::scrub_mem(&mut v);
assert_eq!(v, vec![0,0,0]);
let mut a = [1u32, 2u32, 3u32, 2049903u32];
botan::scrub_mem(&mut a);
assert_eq!(a, [0,0,0,0]);
} | rust_cleaned_test_functions.jsonl/95312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59728,
392,
12976,
368,
341,
262,
1077,
5206,
348,
284,
7486,
20703,
16,
11,
17,
11,
18,
935,
262,
10924,
276,
486,
25065,
392,
12976,
2099,
6984,
348,
317,
262,
2060,
10714,
10297,
85,
11,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrap_return_type_option() {
check_fix(
r#"
//- /main.rs crate:main deps:core
use core::option::Option::{self, Some, None};
fn div(x: i32, y: i32) -> Option<i32> {
if y == 0 {
return None;
}
x / y$0
}
//- /core/lib.rs crate:core
pub mod result {
pub enum Result<T, E> { Ok(T), Err(E) }
}
pub mod option {
pub enum Option<T> { Some(T), None }
}
"#,
r#"
use core::option::Option::{self, Some, None};
fn div(x: i32, y: i32) -> Option<i32> {
if y == 0 {
return None;
}
Some(x / y)
}
"#,
);
} | rust_cleaned_test_functions.jsonl/34380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38550,
12511,
1819,
9672,
368,
341,
286,
1779,
36060,
1006,
310,
435,
2,
698,
61463,
608,
3817,
25638,
17717,
25,
3817,
48178,
25,
2153,
198,
810,
6200,
486,
2047,
486,
5341,
22964,
721,
11,
432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_logical_count() {
let syntax = logical_count("Entries".to_string(), "created_at".to_string());
let actual = LogicalCountCommand::new("Entries".to_string(), "created_at".to_string());
assert_eq!(syntax, actual);
} | rust_cleaned_test_functions.jsonl/23150 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86484,
3180,
368,
341,
286,
1077,
19482,
284,
19819,
3180,
445,
24533,
3263,
983,
3904,
1507,
330,
7120,
3752,
3263,
983,
3904,
1423,
286,
1077,
5042,
284,
62069,
2507,
4062,
486,
931,
445,
24533,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_access_array_concurrently() {
let a = PrimitiveArray::from(Buffer::from(vec![5, 6, 7, 8, 9]));
let ret = thread::spawn(move || a.iter().collect::<Vec<i32>>()).join();
assert!(ret.is_ok());
assert_eq!(vec![5, 6, 7, 8, 9], ret.ok().unwrap());
} | rust_cleaned_test_functions.jsonl/32617 | {
"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,
12759,
3858,
3382,
58202,
368,
341,
286,
1077,
264,
284,
51460,
1857,
486,
1499,
55574,
486,
1499,
25592,
20703,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
58157,
286,
1077,
2112,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_init_with_config() {
let wallet_name = "test_init_with_config";
::utils::devsetup::tests::setup_ledger_env(wallet_name);
wallet::close_wallet().unwrap();
pool::close().unwrap();
let content = create_config_util(wallet_name, settings::TEST_WALLET_KEY);
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
// Assert pool was initialized
assert_ne!(get_pool_handle().unwrap(), 0);
::utils::devsetup::tests::cleanup_dev_env(wallet_name);
} | rust_cleaned_test_functions.jsonl/19796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
6615,
5332,
368,
341,
286,
1077,
15085,
1269,
284,
330,
1944,
6137,
6615,
5332,
876,
286,
3504,
6031,
486,
3583,
15188,
486,
23841,
486,
15188,
38367,
1389,
15879,
95586,
1269,
317,
286,
150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_not_supported_command_response() {
let buf = [
0b00010001,
0b00000011,
0b00000001,
];
let expected = MuxCommand {
params: MuxCommandParams::NonSupported(NonSupportedCommandParams {
cr_bit: false,
non_supported_command: 0,
}),
command_response: CommandResponse::Response,
};
assert_eq!(MuxCommand::decode(&buf[..]).unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/107777 | {
"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,
15227,
7913,
57885,
10811,
9655,
368,
341,
286,
1077,
6607,
284,
2278,
310,
220,
15,
65,
15,
15,
15,
16,
15,
15,
15,
16,
11,
715,
310,
220,
15,
65,
15,
15,
15,
15,
15,
15,
16,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build() {
let c = BasedOn::new("Normal");
let b = c.build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:basedOn w:val="Normal" />"#
);
} | rust_cleaned_test_functions.jsonl/130122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
368,
341,
286,
1077,
272,
284,
20205,
1925,
486,
931,
445,
12206,
797,
286,
1077,
293,
284,
272,
13239,
543,
286,
2060,
10714,
33673,
310,
607,
486,
1499,
39453,
23,
2099,
65,
568,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_from_nonexisting_wallet() {
let (mut testkit, api) = create_testkit();
let (tx_alice, key_alice) = api.create_wallet(ALICE_NAME);
let (tx_bob, _) = api.create_wallet(BOB_NAME);
// when a transfer occurs.
testkit.create_block_with_tx_hashes(&[tx_bob.hash()]);
api.assert_no_wallet(tx_alice.pub_key());
let wallet = api.get_wallet(tx_bob.pub_key());
assert_eq!(wallet.balance(), 100);
let tx = TxTransfer::new(
tx_alice.pub_key(),
tx_bob.pub_key(),
10, // transfer amount
0, // seed
&key_alice,
);
api.transfer(&tx);
testkit.create_block_with_tx_hashes(&[tx.hash()]);
api.assert_tx_status(
&tx.hash(),
&json!({ "type": "error", "code": 1, "description": "Sender doesn't exist" }),
);
// Check that Bob's balance doesn't change.
let wallet = api.get_wallet(tx_bob.pub_key());
assert_eq!(wallet.balance(), 100);
} | rust_cleaned_test_functions.jsonl/12386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
5673,
21637,
36895,
62308,
368,
341,
262,
1077,
320,
6984,
1273,
8226,
11,
6330,
8,
284,
1855,
4452,
8226,
1428,
262,
1077,
320,
3998,
8418,
558,
11,
1376,
8418,
558,
8,
284,
6330,
2520,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ping_response_encode() {
let ping_response = PingResponse {
time: 1577735845610,
};
let mut vec = Vec::new();
ping_response.encode(&mut vec).unwrap();
assert_eq!(
vec,
include_bytes!("../test/packet/status/ping_response.dat").to_vec()
);
} | rust_cleaned_test_functions.jsonl/84710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71661,
9655,
11224,
368,
341,
286,
1077,
29998,
9655,
284,
48657,
2582,
341,
310,
882,
25,
220,
16,
20,
22,
22,
22,
18,
20,
23,
19,
20,
21,
16,
15,
345,
286,
3634,
286,
1077,
5206,
7486,
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_unnamed_unix_datagram() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
let sock1 = or_panic!(UnixDatagram::bind(&path1));
let sock2 = or_panic!(UnixDatagram::unbound());
let msg = b"hello world";
or_panic!(sock2.send_to(msg, &path1));
let mut buf = [0; 11];
let (usize, addr) = or_panic!(sock1.recv_from(&mut buf));
assert_eq!(usize, 11);
assert!(addr.is_unnamed());
assert_eq!(msg, &buf[..]);
} | rust_cleaned_test_functions.jsonl/13726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
30245,
80572,
15353,
5745,
368,
341,
286,
1077,
5419,
284,
4174,
3741,
543,
286,
1077,
1815,
16,
284,
5419,
3875,
1005,
5987,
445,
13199,
16,
3071,
286,
1077,
11087,
16,
284,
476,
620,
312... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bundle_outputs() {
let bun: Bundle = r#"{
"name": "aristotle",
"invocationImages": [],
"schemaVersion": "1.0.0",
"version": "1.0.0",
"outputs": {
"first": {
"applyTo": ["example"],
"definition": "somedef",
"description": "does stuff",
"path": "/var/run/hello"
},
"second": {
"path": "/var/run/empty",
"definition": "somedef"
}
},
"definitions": {
"somedef": {
"type": "string"
}
}
}"#
.parse()
.expect("bundle parsed");
assert_that(&bun.outputs.as_ref().expect("outputs").len()).is_equal_to(2);
let first = bun
.outputs
.as_ref()
.expect("outputs")
.get("first")
.expect("first");
assert_that(&first.apply_to.as_ref().expect("applyTo")[0]).is_equal_to(&"example".to_string());
assert_that(&first.definition).is_equal_to(&"somedef".to_string());
assert_that(&first.path.as_ref().expect("path buffer"))
.is_equal_to(&PathBuf::from("/var/run/hello"));
assert_that(&first.description.as_ref().expect("description"))
.is_equal_to(&"does stuff".to_string());
} | rust_cleaned_test_functions.jsonl/112263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60986,
35189,
368,
341,
262,
1077,
44821,
25,
13182,
284,
435,
55543,
515,
286,
330,
606,
788,
330,
277,
380,
50526,
756,
286,
330,
14057,
2276,
14228,
788,
10239,
286,
330,
17349,
5637,
788,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_features() {
let (mut master, mut peer) = create_pair(UNIX_SOCKET_MASTER3);
master.set_owner().unwrap();
let (hdr, rfds) = peer.recv_header().unwrap();
assert_eq!(hdr.get_code(), MasterReq::SET_OWNER);
assert_eq!(hdr.get_size(), 0);
assert_eq!(hdr.get_version(), 0x1);
assert!(rfds.is_none());
let hdr = VhostUserMsgHeader::new(MasterReq::GET_FEATURES, 0x4, 8);
let msg = VhostUserU64::new(0x15);
peer.send_message(&hdr, &msg, None).unwrap();
let features = master.get_features().unwrap();
assert_eq!(features, 0x15u64);
let (_hdr, rfds) = peer.recv_header().unwrap();
assert!(rfds.is_none());
master.set_features(0x15).unwrap();
let (_hdr, msg, rfds) = peer.recv_body::<VhostUserU64>().unwrap();
assert!(rfds.is_none());
let val = msg.value;
assert_eq!(val, 0x15);
let hdr = VhostUserMsgHeader::new(MasterReq::GET_FEATURES, 0x4, 8);
let msg = 0x15u32;
peer.send_message(&hdr, &msg, None).unwrap();
assert!(master.get_features().is_err());
} | rust_cleaned_test_functions.jsonl/23890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 571
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14965,
368,
341,
286,
1077,
320,
6984,
7341,
11,
5206,
14397,
8,
284,
1855,
14445,
7,
99089,
39736,
47068,
18,
626,
286,
7341,
980,
29027,
1005,
15454,
543,
286,
1077,
320,
28785,
11,
36026,
535... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_8XY7() {
// 0x8XY7 - Set register VX to the value of VY minus VX
// Set VF to 00 if a borrow occurs
// Set VF to 01 if a borrow does not occur
let opcode = 0x89A7;
let mut vm = get_vm();
// without borrow
vm.v[0x9] = 0x02;
vm.v[0xA] = 0x08;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.v[0x9], 0x06);
assert_eq!(vm.v[0xF], 0x1);
// with borrow
vm.v[0x9] = 0x04;
vm.v[0xA] = 0x02;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.v[0x9], 0xFE);
assert_eq!(vm.v[0xF], 0x0);
} | rust_cleaned_test_functions.jsonl/255 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
23,
16356,
22,
368,
341,
262,
442,
220,
15,
87,
23,
16356,
22,
481,
2573,
4161,
78177,
311,
279,
897,
315,
647,
56,
27283,
78177,
198,
262,
442,
286,
2573,
72892,
311,
220,
15,
15,
421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_panic() {
fn f() {
panic!();
}
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
ignore: false,
#[cfg(not(bootstrap))]
ignore_message: None,
should_panic: ShouldPanic::Yes,
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, TestId(0), desc, RunStrategy::InProcess, tx, Concurrent::No);
let result = rx.recv().unwrap().result;
assert_eq!(result, TrOk);
} | rust_cleaned_test_functions.jsonl/122410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
620,
31270,
368,
341,
262,
5168,
282,
368,
341,
286,
21975,
0,
543,
262,
456,
262,
1077,
6560,
284,
3393,
11065,
3036,
24911,
341,
286,
6560,
25,
3393,
11065,
341,
310,
829,
25,
23105,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.