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_mmap_region_build() {
let a = Arc::new(TempFile::new().unwrap().into_file());
let prot = libc::PROT_READ | libc::PROT_WRITE;
let flags = libc::MAP_NORESERVE | libc::MAP_PRIVATE;
let offset = 4096;
let size = 1000;
// Offset + size will overflow.
let r = MmapRegion::build(
Some(FileOffset::from_arc(a.clone(), std::u64::MAX)),
size,
prot,
flags,
);
assert_eq!(format!("{:?}", r.unwrap_err()), "InvalidOffsetLength");
let r = MmapRegion::build(
Some(FileOffset::from_arc(a.clone(), offset)),
size,
prot,
flags,
);
assert_eq!(format!("{:?}", r.unwrap_err()), "MappingPastEof");
// MAP_FIXED was specified among the flags.
let r = MmapRegion::build(
Some(FileOffset::from_arc(a.clone(), offset)),
size,
prot,
flags | libc::MAP_FIXED,
);
assert_eq!(format!("{:?}", r.unwrap_err()), "MapFixed");
// Let's resize the file.
assert_eq!(unsafe { libc::ftruncate(a.as_raw_fd(), 1024 * 10) }, 0);
// The offset is not properly aligned.
let r = MmapRegion::build(
Some(FileOffset::from_arc(a.clone(), offset - 1)),
size,
prot,
flags,
);
assert_eq!(r.unwrap_err().raw_os_error(), libc::EINVAL);
// The build should be successful now.
let r = MmapRegion::build(
Some(FileOffset::from_arc(a.clone(), offset)),
size,
prot,
flags,
)
.unwrap();
assert_eq!(r.size(), size);
assert_eq!(r.file_offset().unwrap().start(), offset as u64);
assert_eq!(r.prot(), libc::PROT_READ | libc::PROT_WRITE);
assert_eq!(r.flags(), libc::MAP_NORESERVE | libc::MAP_PRIVATE);
} | rust_cleaned_test_functions.jsonl/39 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1024
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
2186,
20627,
20801,
368,
341,
286,
1077,
264,
284,
19689,
486,
931,
75387,
1703,
486,
931,
1005,
15454,
1005,
18122,
2458,
5231,
286,
1077,
1724,
284,
42142,
486,
9117,
51,
13117,
760,
42142,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_pubkey() {
let ElGamalKeypair { public, secret: _ } = ElGamalKeypair::new_rand();
let encoded = bincode::serialize(&public).unwrap();
let decoded: ElGamalPubkey = bincode::deserialize(&encoded).unwrap();
assert_eq!(public, decoded);
} | rust_cleaned_test_functions.jsonl/36655 | {
"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,
75861,
450,
34014,
792,
368,
341,
286,
1077,
3984,
78884,
278,
6608,
1082,
1310,
314,
584,
11,
6234,
25,
716,
335,
284,
3984,
78884,
278,
6608,
1082,
1310,
486,
931,
33864,
1428,
286,
1077,
2049... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_functions() -> TestResult {
let p = polar();
p.load_str(
r#"f(1);
f(2);
g(1);
g(2);
h(2);
k(x) if f(x) and h(x) and g(x);"#,
)?;
qnull(&p, "k(1)");
qeval(&p, "k(2)");
qnull(&p, "k(3)");
qvar(&p, "k(a)", "a", values![2]);
Ok(())
} | rust_cleaned_test_functions.jsonl/68088 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31708,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
543,
262,
281,
5104,
2895,
1006,
286,
435,
55543,
69,
7,
16,
317,
1843,
282,
7,
17,
317,
1843,
342,
7,
16,
317,
1843,
342,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_escaped_backslash_char() {
assert_eq!(
apply(
r#"
'\\' +
"#
.trim()
),
Ok(vec![
Token::Char(span(1, 1, "'\\\\'")),
Token::Symbol(span(1, 6, "+"))
])
)
} | rust_cleaned_test_functions.jsonl/27570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
65826,
3895,
50256,
9232,
368,
341,
286,
2060,
10714,
33673,
310,
3796,
1006,
394,
435,
2,
698,
6,
3422,
6,
3610,
1,
4956,
503,
659,
10666,
741,
310,
2837,
310,
7622,
25592,
90515,
394,
96... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_same() {
let x =
b"ACGTATCATAGACCCTAGATAGGGTTGTGTAGATGATCCACAGACGTATCATAGATTAGATAGGGTTGTGTAGATGATTCC\
ACAG";
let y = *x;
compare_to_full_alignment_local(x, &y);
compare_to_full_alignment_global(x, &y);
compare_to_full_alignment_semiglobal(x, &y);
} | rust_cleaned_test_functions.jsonl/126726 | {
"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,
33574,
368,
341,
286,
1077,
856,
4035,
310,
293,
1,
1706,
25388,
828,
28196,
1890,
29442,
1162,
1890,
828,
1890,
22254,
14903,
25388,
25388,
1890,
828,
38,
828,
3706,
1706,
1890,
1706,
25388,
828,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init_wizard() -> Result<(), Error> {
let server = test::Server::new()?;
assert!(Path::new(&server.wg_conf_path()).exists());
Ok(())
} | rust_cleaned_test_functions.jsonl/15775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
1670,
13722,
368,
1464,
5714,
68843,
4600,
29,
341,
1789,
286,
1077,
3538,
284,
1273,
486,
5475,
486,
931,
368,
69493,
286,
2060,
10297,
1820,
486,
931,
2099,
4030,
1418,
70,
16059,
2638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sg_map_range_mut_panic_1() {
let mut map = SgMap::<usize, usize, DEFAULT_CAPACITY>::new();
map.insert(3, 3);
map.insert(5, 5);
map.insert(8, 8);
let _bad_range = map.range_mut((Included(&8), Included(&3)));
} | rust_cleaned_test_functions.jsonl/18662 | {
"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,
76318,
5376,
9698,
29523,
620,
31270,
62,
16,
368,
341,
262,
1077,
5206,
2415,
284,
328,
70,
2227,
27638,
51878,
11,
22301,
11,
11955,
92153,
6831,
931,
543,
262,
2415,
7030,
7,
18,
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_recover_pk() {
let message = "test message";
let sig = "d9tibmnic9t5y41hg7hkakdcra94akas9ku3rmmj4ag9mritc8ok4p5qzefs78c9pqfhpuftqqzhydbdwfg7u6w6wdxcqpqn4sj4e73e";
let pk = recover_pk(message.as_bytes(), sig);
assert_eq!(pk.unwrap(), PublicKey::from_secret_key(&Secp256k1::signing_only(), &ONE_KEY))
} | rust_cleaned_test_functions.jsonl/74468 | {
"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,
1288,
3688,
33321,
368,
341,
286,
1077,
1943,
284,
330,
1944,
1943,
876,
286,
1077,
8366,
284,
330,
67,
24,
83,
579,
76,
11590,
24,
83,
20,
88,
19,
16,
66602,
22,
85511,
585,
7628,
956,
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... | 1 |
#[test]
fn test_add_stake_dispatch_info_ok() {
new_test_ext().execute_with(|| {
let account_id = 0;
let stake = 5000;
let call = Call::Subtensor(SubtensorCall::add_stake(account_id, stake));
assert_eq!(call.get_dispatch_info(), DispatchInfo {
weight: 0,
class: DispatchClass::Normal,
pays_fee: Pays::Yes
});
});
} | rust_cleaned_test_functions.jsonl/17148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
1261,
726,
42991,
3109,
19817,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
2692,
842,
284,
220,
15,
280,
197,
10217,
18279,
284,
220,
20,
15,
15,
15,
280,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_to_packets() {
let keypair = Keypair::new();
let hash = Hash::new(&[1; 32]);
let tx = Transaction::system_new(&keypair, keypair.pubkey(), 1, hash);
let rv = to_packets(&vec![tx.clone(); 1]);
assert_eq!(rv.len(), 1);
assert_eq!(rv[0].read().unwrap().packets.len(), 1);
let rv = to_packets(&vec![tx.clone(); NUM_PACKETS]);
assert_eq!(rv.len(), 1);
assert_eq!(rv[0].read().unwrap().packets.len(), NUM_PACKETS);
let rv = to_packets(&vec![tx.clone(); NUM_PACKETS + 1]);
assert_eq!(rv.len(), 2);
assert_eq!(rv[0].read().unwrap().packets.len(), NUM_PACKETS);
assert_eq!(rv[1].read().unwrap().packets.len(), 1);
} | rust_cleaned_test_functions.jsonl/89211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
63569,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
5175,
284,
6531,
486,
931,
2099,
58,
16,
26,
220,
18,
17,
2558,
286,
1077,
9854,
284,
17869,
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_parse() {
let expected = vec![
Direction::Forward(5),
Direction::Down(5),
Direction::Forward(8),
Direction::Up(3),
Direction::Down(8),
Direction::Forward(2),
];
let dirs = Direction::from_lines(INPUT);
assert_eq!(dirs, Ok(expected));
} | rust_cleaned_test_functions.jsonl/53309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
3601,
284,
7486,
90515,
310,
18904,
486,
25925,
7,
20,
1326,
310,
18904,
486,
4454,
7,
20,
1326,
310,
18904,
486,
25925,
7,
23,
1326,
310,
18904,
486,
2324,
7,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inline_this() {
test(
concat!(
"/** @constructor */",
"function C() {}",
"",
"C.prototype.m = function() {",
" var self = this;",
" if (true) {",
" alert(self);",
" }",
"};",
),
concat!(
"(/** @constructor */",
"function C() {}).prototype.m = function() {",
" if (true) {",
" alert(this);",
" }",
"};",
),
);
} | rust_cleaned_test_functions.jsonl/27707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
24868,
368,
341,
262,
1273,
1006,
286,
33720,
33673,
310,
3521,
334,
569,
21846,
639,
756,
310,
330,
1688,
356,
368,
4687,
756,
310,
8324,
310,
330,
34,
6003,
744,
284,
729,
368,
314,
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_chain_insert_delete() {
let base_rope: Rope = vec![0, 1, 2, 3].into();
let mut delta_builder = DeltaBuilder::new(base_rope.len());
delta_builder.replace(0..0, Into::<Rope>::into(vec![5, 6, 7]).into_node());
let insertion = delta_builder.build();
let mid_rope = base_rope.apply_delta(&insertion);
let mut delta_builder2 = DeltaBuilder::new(mid_rope.len());
delta_builder2.delete(0..1);
let deletion = delta_builder2.build();
let final_rope = mid_rope.apply_delta(&deletion);
assert_eq!(&final_rope.slice_to_cow(..), &vec![6, 7, 0, 1, 2, 3]);
let chained_subsets =
Action::from_delta(insertion.clone()).subsets_for_chain(deletion.clone());
assert_eq!(&chained_subsets.0.delete_from_string("5670123"), "0123");
assert_eq!(&chained_subsets.1.delete_from_string("5670123"), "670123");
assert_eq!(&chained_subsets.2.delete_from_string("5670123"), "0123");
let chained_delta = Action::from_delta(insertion).chain(&mid_rope, deletion);
let chain_final_rope = base_rope.apply_delta(&chained_delta.delta);
assert_eq!(&chain_final_rope.slice_to_cow(..), &vec![6, 7, 0, 1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/10026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 573
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30583,
17678,
11353,
368,
341,
286,
1077,
2331,
26608,
375,
25,
97896,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
936,
18122,
543,
286,
1077,
5206,
9477,
28532,
284,
24957,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_address_resolution() {
// Test a basic ARP resolution scenario with both sides participating.
// We expect the following steps:
// ARP request and set a request retry timer.
// layer is notified of the resolution.
let local = DummyContext::default();
let mut remote = DummyContext::default();
remote.get_mut().hw_addr = TEST_REMOTE_MAC;
remote.get_mut().proto_addr = Some(TEST_REMOTE_IPV4);
let mut network = DummyNetwork::new(
vec![("local", local), ("remote", remote)],
|ctx, _state: &DummyArpContext, _meta| {
if ctx == "local" {
("remote", (), (), None)
} else {
("local", (), (), None)
}
},
);
// The lookup should fail.
assert!(lookup(network.context("local"), (), TEST_LOCAL_MAC, TEST_REMOTE_IPV4).is_none());
// We should have sent an ARP request.
validate_last_arp_packet(
network.context("local"),
1,
Mac::BROADCAST,
ArpOp::Request,
TEST_LOCAL_IPV4,
TEST_REMOTE_IPV4,
TEST_LOCAL_MAC,
Mac::BROADCAST,
);
// We should have installed a retry timer.
validate_single_retry_timer(
network.context("local"),
DEFAULT_ARP_REQUEST_PERIOD,
TEST_REMOTE_IPV4,
);
// Step once to deliver the ARP request to the remote.
let res = network.step::<ArpTimerFrameHandler<EthernetLinkDevice, Ipv4Addr>>();
assert_eq!(res.timers_fired(), 0);
assert_eq!(res.frames_sent(), 1);
// The remote should have populated its ARP cache with the local's
// information.
assert_eq!(
network.context("remote").get_ref().arp_state.table.lookup(TEST_LOCAL_IPV4).unwrap(),
&TEST_LOCAL_MAC
);
// The remote should have sent an ARP response.
validate_last_arp_packet(
network.context("remote"),
1,
TEST_LOCAL_MAC,
ArpOp::Response,
TEST_REMOTE_IPV4,
TEST_LOCAL_IPV4,
TEST_REMOTE_MAC,
TEST_LOCAL_MAC,
);
// Step once to deliver the ARP response to the local.
let res = network.step::<ArpTimerFrameHandler<EthernetLinkDevice, Ipv4Addr>>();
assert_eq!(res.timers_fired(), 0);
assert_eq!(res.frames_sent(), 1);
// The local should have populated its cache with the remote's
// information.
assert_eq!(
network.context("local").get_ref().arp_state.table.lookup(TEST_REMOTE_IPV4).unwrap(),
&TEST_REMOTE_MAC
);
// expiration timer.
validate_single_entry_timer(
network.context("local"),
DEFAULT_ARP_ENTRY_EXPIRATION_PERIOD,
TEST_REMOTE_IPV4,
);
// The device layer should have been notified.
assert_eq!(
network.context("local").get_ref().addr_resolved.as_slice(),
[(TEST_REMOTE_IPV4, TEST_REMOTE_MAC)]
);
} | rust_cleaned_test_functions.jsonl/16997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1643
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6744,
39849,
368,
341,
286,
442,
3393,
264,
6770,
91337,
10935,
15048,
448,
2176,
11067,
23528,
624,
286,
442,
1205,
1720,
279,
2701,
7354,
510,
1789,
286,
442,
262,
91337,
1681,
323,
738,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lambda() {
let ref a = parse_expr("|a: i32| let a = 1; let b = 1; a").unwrap();
let ref b = parse_expr("|a: i32| let a = 1; let c = 1; a").unwrap();
assert_eq!(ExprHash::from(a).unwrap(), ExprHash::from(b).unwrap());
} | rust_cleaned_test_functions.jsonl/103360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51884,
368,
341,
262,
1077,
2053,
264,
284,
4715,
21915,
38547,
64,
25,
600,
18,
17,
91,
1077,
264,
284,
220,
16,
26,
1077,
293,
284,
220,
16,
26,
264,
1827,
15454,
543,
262,
1077,
2053,
293... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_synth() {
let mut rng = XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
let window_size = 4;
let mut assignment = vec![Fr::zero(); 1 << window_size];
let constants: Vec<_> = (0..(1 << window_size)).map(|_| Fr::rand(&mut rng)).collect();
synth::<Bls12, _>(window_size, &constants, &mut assignment);
for b in 0..(1 << window_size) {
let mut acc = Fr::zero();
for j in 0..(1 << window_size) {
if j & b == j {
acc.add_assign(&assignment[j]);
}
}
assert_eq!(acc, constants[b]);
}
} | rust_cleaned_test_functions.jsonl/66528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
45809,
368,
341,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
15,
87,
18,
83406,
21,
17,
20,
24,
11,
220,
15,
87,
23,
67,
18,
16,
18,
67,
22,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_decode_date_time() {
let buf = [11, 218, 7, 10, 17, 19, 27, 30, 1, 0, 0, 0];
let date1 = <NaiveDateTime as Decode<MySql>>::decode(Some(MySqlValue::Binary(&buf))).unwrap();
assert_eq!(date1.to_string(), "2010-10-17 19:27:30.000001");
let buf = [7, 218, 7, 10, 17, 19, 27, 30];
let date2 = <NaiveDateTime as Decode<MySql>>::decode(Some(MySqlValue::Binary(&buf))).unwrap();
assert_eq!(date2.to_string(), "2010-10-17 19:27:30");
let buf = [4, 218, 7, 10, 17];
let date3 = <NaiveDateTime as Decode<MySql>>::decode(Some(MySqlValue::Binary(&buf))).unwrap();
assert_eq!(date3.to_string(), "2010-10-17 00:00:00");
} | rust_cleaned_test_functions.jsonl/18497 | {
"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,
15227,
4164,
3009,
368,
341,
1066,
262,
1077,
6607,
284,
508,
16,
16,
11,
220,
17,
16,
23,
11,
220,
22,
11,
220,
16,
15,
11,
220,
16,
22,
11,
220,
16,
24,
11,
220,
17,
22,
11,
220,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_method_not_found() {
let io = IoHandler::new();
let request = r#"{"jsonrpc": "2.0", "method": "say_hello", "params": [42, 23], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found"},"id":1}"#;
assert_eq!(io.handle_request_sync(request), Some(response.to_string()));
} | rust_cleaned_test_functions.jsonl/95532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9032,
7913,
21480,
368,
341,
197,
10217,
6399,
284,
29655,
3050,
486,
931,
1428,
197,
10217,
1681,
284,
435,
55543,
4913,
2236,
29414,
788,
330,
17,
13,
15,
497,
330,
4393,
788,
330,
36790,
9672... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_vertex_traversal_with_label_and_has_v2() {
let client = graph_serializer(GraphSON::V2);
drop_vertices(&client, "test_simple_vertex_traversal_with_label_and_has").unwrap();
let vertex = create_vertex_with_label(
&client,
"test_simple_vertex_traversal_with_label_and_has",
"Traversal",
);
let g = traversal().with_remote(client);
let results = g
.v(())
.has_label("test_simple_vertex_traversal_with_label_and_has")
.has(("name", "Traversal"))
.to_list()
.unwrap();
assert_eq!(1, results.len());
assert_eq!(vertex.id(), results[0].id());
// with 3 params
let results = g
.v(())
.has((
"test_simple_vertex_traversal_with_label_and_has",
"name",
"Traversal",
))
.to_list()
.unwrap();
assert_eq!(1, results.len());
assert_eq!(vertex.id(), results[0].id());
// with 1 param
let results = g
.v(())
.has_label("test_simple_vertex_traversal_with_label_and_has")
.has("name")
.to_list()
.unwrap();
assert_eq!(1, results.len());
assert_eq!(vertex.id(), results[0].id());
// hasNot
let results = g
.v(())
.has_label("test_simple_vertex_traversal_with_label_and_has")
.has_not("surname")
.to_list()
.unwrap();
assert_eq!(1, results.len());
assert_eq!(vertex.id(), results[0].id());
} | rust_cleaned_test_functions.jsonl/26272 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 750
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
26611,
3547,
45545,
6615,
6106,
8378,
21778,
2273,
17,
368,
341,
262,
1077,
2943,
284,
4771,
67441,
63779,
2703,
486,
53,
17,
626,
262,
5943,
37720,
2099,
2972,
11,
330,
1944,
30015,
26611,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_sort_overwrite_by_timesort() {
let dir = tempdir();
dir.child("2").touch().unwrap();
dir.child("11").touch().unwrap();
cmd()
.arg("-v")
.arg("-t")
.arg("--ignore-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match("11\n2\n$").unwrap());
} | rust_cleaned_test_functions.jsonl/639 | {
"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,
9438,
18435,
15431,
4934,
3710,
22353,
371,
368,
341,
262,
1077,
5419,
284,
2730,
3741,
543,
262,
5419,
17531,
445,
17,
1827,
22020,
1005,
15454,
543,
262,
5419,
17531,
445,
16,
16,
1827,
22020,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_geq_same_num_digits_gt_true() {
// Given:
let a = Counter::from(vec![0, 1]);
let b = Counter::from(vec![0, 2]);
// Then:
assert!(b >= a);
} | rust_cleaned_test_functions.jsonl/79532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32933,
80,
33574,
4273,
41432,
37479,
16082,
368,
341,
310,
442,
16246,
510,
310,
1077,
264,
284,
19735,
486,
1499,
25592,
20703,
15,
11,
220,
16,
2558,
310,
1077,
293,
284,
19735,
486,
1499,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_to_vec() {
let data = Data {
base: "https://example.com".into(),
client_id: "adbc01234".into(),
client_secret: "0987dcba".into(),
redirect: "urn:ietf:wg:oauth:2.0:oob".into(),
token: "fedc5678".into(),
};
let v = to_vec(&data).expect("Couldn't write to vec");
let desered = from_slice(&v).expect("Couldn't deserialize data");
assert_eq!(data, desered);
} | rust_cleaned_test_functions.jsonl/39222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
13251,
368,
341,
286,
1077,
821,
284,
2885,
341,
310,
2331,
25,
330,
2428,
1110,
8687,
905,
3263,
18122,
3148,
310,
2943,
842,
25,
330,
329,
8904,
15,
16,
17,
18,
19,
3263,
18122,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_short_ascii() {
// always inlined on all archs
let strs = vec!["nyc", "statue", "liberty", "img_1234.png"];
for s in strs {
let compact = CompactString::new(s);
assert_eq!(compact, s);
assert_eq!(s, compact);
assert_eq!(compact.is_heap_allocated(), false);
}
} | rust_cleaned_test_functions.jsonl/2780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
50238,
368,
341,
262,
442,
2677,
304,
15121,
389,
678,
5325,
82,
198,
262,
1077,
57584,
284,
7486,
0,
1183,
77,
3337,
497,
330,
9878,
361,
497,
330,
2740,
1344,
497,
330,
1892,
62,
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... | 2 |
#[test]
fn test_introspection() {
let conn = PgConnection::establish(&TEST_DATABASE_URL)
.expect(&format!("Error connecting to {}", TEST_DATABASE_URL));
let seed_user = seed::user_journey(&conn);
let seed_token = seed::auth_token(&conn, seed_user);
let user = endpoints::introspection(&conn, seed_token.token.to_string().as_str());
assert_eq!(757, user.len());
println!("{}", user);
} | rust_cleaned_test_functions.jsonl/123717 | {
"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,
4042,
3630,
16076,
368,
341,
286,
1077,
4534,
284,
97265,
4526,
486,
33400,
2099,
10033,
45510,
8000,
340,
310,
659,
17119,
2099,
2243,
17223,
1454,
20913,
311,
24689,
13602,
45510,
8000,
1106,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_publicationproperties_depth() {
let mut publication: Publication = Publication {
publication_type: PublicationType::Pdf,
depth_mm: Some(10.0),
..Default::default()
};
assert_eq!(
publication.dimension_error(),
Err(ThothError::DimensionDigitalError)
);
publication.depth_mm = None;
assert_eq!(publication.dimension_error(), Ok(()));
publication.depth_in = Some(3.94);
assert_eq!(
publication.dimension_error(),
Err(ThothError::DimensionDigitalError)
);
publication.publication_type = PublicationType::Paperback;
assert_eq!(
publication.dimension_error(),
Err(ThothError::DepthEmptyError)
);
publication.depth_in = None;
assert_eq!(publication.dimension_error(), Ok(()));
publication.depth_mm = Some(10.0);
assert_eq!(
publication.dimension_error(),
Err(ThothError::DepthEmptyError)
);
publication.depth_in = Some(3.94);
assert_eq!(publication.dimension_error(), Ok(()));
} | rust_cleaned_test_functions.jsonl/46235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
367,
13193,
19061,
368,
341,
262,
1077,
5206,
16599,
25,
56894,
284,
56894,
341,
286,
16599,
1819,
25,
56894,
929,
486,
67596,
345,
286,
7990,
35599,
25,
4329,
7,
16,
15,
13,
15,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_group_shares() {
let share1 = fake_share(1, vec![1]);
let share2 = fake_share(1, vec![2]);
let share3 = fake_share(2, vec![1]);
let grouped_shares = group_shares(Box::new(vec![share1, share2, share3].into_iter()));
assert_eq!(grouped_shares.get(&1).unwrap().len(), 2);
assert_eq!(grouped_shares.get(&2).unwrap().len(), 1);
} | rust_cleaned_test_functions.jsonl/31393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
3712,
5403,
368,
341,
286,
1077,
4332,
16,
284,
12418,
38272,
7,
16,
11,
7486,
20703,
16,
2558,
286,
1077,
4332,
17,
284,
12418,
38272,
7,
16,
11,
7486,
20703,
17,
2558,
286,
1077,
4332,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector_2() {
let address = "DdzFFzCqrht4it4GYgBp4J39FNnKBsPFejSppARXHCf2gGiTJcwXzpRvgDmxPvKQ8aZZmVqcLUz5L66a8Ja46pfKVtFRaKyn9eKdvpaC".parse().unwrap();
let public_key = XPub::from_bytes([
0xff, 0x7b, 0xf1, 0x29, 0x9d, 0xf3, 0xd7, 0x17, 0x98, 0xae, 0xfd, 0xc4, 0xae, 0xa7,
0xdb, 0x2f, 0x8d, 0xb7, 0x60, 0x46, 0x56, 0x94, 0x41, 0xea, 0xe5, 0x8b, 0x72, 0x23,
0xb6, 0x8b, 0x44, 0x04, 0x82, 0x15, 0xcb, 0xac, 0x94, 0xbc, 0xb7, 0xf2, 0xcf, 0x33,
0x6c, 0x6c, 0x18, 0xbc, 0x3e, 0x71, 0x3f, 0xfd, 0x82, 0x67, 0x59, 0x4f, 0xf6, 0x34,
0x93, 0x32, 0xce, 0x4f, 0x98, 0x04, 0xa7, 0xff,
]);
assert_same_address(address, public_key)
} | rust_cleaned_test_functions.jsonl/1894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
62,
17,
368,
341,
286,
1077,
2621,
284,
330,
35,
37877,
1748,
89,
34,
23004,
426,
19,
275,
19,
41470,
70,
33,
79,
19,
41,
18,
24,
41604,
77,
29862,
82,
47,
6123,
73,
50,
602,
934,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_connect() {
let tmpdir = tempfile::tempdir().unwrap();
let path = format!("{}/socket", tmpdir.as_ref().to_str().unwrap());
let path1 = path.clone();
assert!(RemotePublisher::connect("a".repeat(16384)).is_err());
assert!(RemotePublisher::connect(&path).is_err());
let barrier = Arc::new(Barrier::new(2));
let barrier2 = barrier.clone();
let thread = std::thread::spawn(move || {
let listener = UnixListener::bind(&path1).unwrap();
listener.set_nonblocking(true).unwrap();
let t = Arc::new(Box::new(FakeServer {}) as Box<dyn Events + Send + Sync>);
let service = client::create_events(t);
let mut server = Server::new()
.add_listener(listener.as_raw_fd())
.unwrap()
.register_service(service);
std::mem::forget(listener);
server.start().unwrap();
barrier2.wait();
barrier2.wait();
server.shutdown();
});
barrier.wait();
let client = RemotePublisher::new(&path).unwrap();
let mut msg = TaskOOM::new();
msg.set_container_id("test".to_string());
client
.publish(Context::default(), "/tasks/oom", "ns1", msg)
.unwrap();
barrier.wait();
thread.join().unwrap();
} | rust_cleaned_test_functions.jsonl/14259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 663
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
368,
341,
286,
1077,
4174,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
1815,
284,
3561,
88928,
4472,
9556,
497,
4174,
3741,
5357,
7793,
1005,
983,
2895,
1005,
15454,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_device_name() {
if let Some(device) = test_get_default_device(Scope::Input) {
let name = get_device_name(device, DeviceType::INPUT).unwrap();
println!("input device name: {}", name.into_string());
} else {
println!("No input device.");
}
if let Some(device) = test_get_default_device(Scope::Output) {
let name = get_device_name(device, DeviceType::OUTPUT).unwrap();
println!("output device name: {}", name.into_string());
} else {
println!("No output device.");
}
} | rust_cleaned_test_functions.jsonl/113812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9204,
1269,
368,
341,
262,
421,
1077,
4329,
17848,
8,
284,
1273,
3062,
9993,
9204,
3759,
2417,
486,
2505,
8,
341,
286,
1077,
829,
284,
633,
9204,
1269,
17848,
11,
13903,
929,
486,
29421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_slice_2() {
let ss = "中华Việt Nam";
assert_eq!("华", ss.slice(3u, 6u));
assert_eq!("Việt Nam", ss.slice(6u, 16u));
assert_eq!("ab", "abc".slice(0u, 2u));
assert_eq!("bc", "abc".slice(1u, 3u));
assert_eq!("", "abc".slice(1u, 1u));
assert_eq!("中", ss.slice(0u, 3u));
assert_eq!("华V", ss.slice(3u, 7u));
assert_eq!("", ss.slice(3u, 3u));
/*0: 中
3: 华
6: V
7: i
8: ệ
11: t
12:
13: N
14: a
15: m */
} | rust_cleaned_test_functions.jsonl/2437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
62,
17,
368,
341,
286,
1077,
10870,
284,
330,
100849,
35544,
124382,
29974,
3302,
286,
2060,
10714,
17223,
85361,
497,
10870,
14530,
7,
18,
84,
11,
220,
21,
84,
1106,
286,
2060,
10714,
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_root_ns_meth_ret_nonpod() {
let hdr = indoc! {"
#include <cstdint>
#include <memory>
struct Bob {
uint32_t a;
};
namespace B {
struct C {
uint32_t a;
Bob daft() const { Bob bob; bob.a = 12; return bob; }
};
}
"};
let rs = quote! {
let b = ffi::B::C { a: 12 };
b.daft().as_ref().unwrap();
};
run_test("", hdr, rs, &["Bob"], &["B::C"]);
} | rust_cleaned_test_functions.jsonl/9842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12993,
34728,
717,
769,
21695,
21637,
39073,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
96975,
397,
286,
671,
997,
366,
17269,
397,
286,
2036,
14261,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_take_0() {
let input = [].as_ref();
let count = 0usize;
assert_eq!(count, 0usize);
let offset = 0usize;
let result: crate::IResult<(&[u8], usize), usize> = take(count)((input, offset));
assert_eq!(result, Ok(((input, offset), 0)));
} | rust_cleaned_test_functions.jsonl/41245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
62,
15,
368,
341,
262,
1077,
1946,
284,
72375,
300,
7793,
543,
262,
1077,
1760,
284,
220,
15,
51878,
280,
262,
2060,
10714,
10297,
1830,
11,
220,
15,
51878,
317,
262,
1077,
4347,
284,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ln_pdf() {
let ln_pdf = |arg: DVector<_>| move |x: MultivariateNormal| x.ln_pdf(&arg);
test_case(vec![0., 0.], vec![1., 0., 0., 1.], (0.05854983152431917f64).ln(), ln_pdf(dvec![1., 1.]));
test_almost(vec![0., 0.], vec![1., 0., 0., 1.], (0.013064233284684921f64).ln(), 1e-15, ln_pdf(dvec![1., 2.]));
test_almost(vec![0., 0.], vec![1., 0., 0., 1.], (1.8618676045881531e-23f64).ln(), 1e-15, ln_pdf(dvec![1., 10.]));
test_almost(vec![0., 0.], vec![1., 0., 0., 1.], (5.920684802611216e-45f64).ln(), 1e-15, ln_pdf(dvec![10., 10.]));
test_almost(vec![0., 0.], vec![1., 0.9, 0.9, 1.], (1.6576716577547003e-05f64).ln(), 1e-14, ln_pdf(dvec![1., -1.]));
test_almost(vec![0., 0.], vec![1., 0.99, 0.99, 1.], (4.1970621773477824e-44f64).ln(), 1e-12, ln_pdf(dvec![1., -1.]));
test_almost(vec![0.5, -0.2], vec![2.0, 0.3, 0.3, 0.5], (0.0013075203140666656f64).ln(), 1e-15, ln_pdf(dvec![2., 2.]));
test_case(vec![0., 0.], vec![f64::INFINITY, 0., 0., f64::INFINITY], f64::NEG_INFINITY, ln_pdf(dvec![10., 10.]));
test_case(vec![0., 0.], vec![f64::INFINITY, 0., 0., f64::INFINITY], f64::NEG_INFINITY, ln_pdf(dvec![100., 100.]));
} | rust_cleaned_test_functions.jsonl/106558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 684
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60401,
39948,
368,
341,
286,
1077,
29390,
39948,
284,
760,
858,
25,
422,
3781,
32399,
69844,
3271,
760,
87,
25,
22162,
55422,
12206,
91,
856,
918,
77,
39948,
2099,
858,
317,
286,
1273,
19096,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bare_variant() {
// "TestUnit"
let bser_v2 = b"\x00\x02\x00\x00\x00\x00\x05\x0b\x00\x00\x00\x02\x03\x08TestUnit";
let decoded = from_slice::<BytestringVariant>(bser_v2).unwrap();
assert_eq!(decoded, BytestringVariant::TestUnit);
} | rust_cleaned_test_functions.jsonl/34066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
546,
46112,
368,
341,
262,
442,
330,
2271,
4562,
698,
262,
1077,
293,
799,
2273,
17,
284,
293,
11934,
87,
15,
15,
3462,
15,
17,
3462,
15,
15,
3462,
15,
15,
3462,
15,
15,
3462,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_node_and_edges_undirected() {
let mut g = UnMatrix::new_undirected();
let a = g.add_node('a');
let b = g.add_node('b');
let c = g.add_node('c');
g.add_edge(a, b, ());
g.add_edge(b, c, ());
g.add_edge(c, a, ());
// removing a should break the `a - b` and `a - c` edges
g.remove_node(a);
assert_eq!(g.node_count(), 2);
let b_neighbors = g.neighbors(b).into_sorted_vec();
assert_eq!(b_neighbors, vec![c]);
let c_neighbors = g.neighbors(c).into_sorted_vec();
assert_eq!(c_neighbors, vec![b]);
} | rust_cleaned_test_functions.jsonl/81967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
5084,
8378,
28026,
62,
1241,
74612,
368,
341,
286,
1077,
5206,
342,
284,
1230,
6689,
486,
931,
62,
1241,
74612,
543,
286,
1077,
264,
284,
342,
1364,
5084,
492,
64,
1157,
286,
1077,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_transaction_with_a_write_set_canonical_serialization_example() {
let input = RawTransaction::new_write_set(
AccountAddress::new([
0xc3, 0x39, 0x8a, 0x59, 0x9a, 0x6f, 0x3b, 0x9f, 0x30, 0xb6, 0x35, 0xaf, 0x29, 0xf2,
0xba, 0x04,
]),
32,
get_common_write_set(),
);
let expected_output = vec![
195, 57, 138, 89, 154, 111, 59, 159, 48, 182, 53, 175, 41, 242, 186, 4, 32, 0, 0, 0, 0, 0,
0, 0, 1, 2, 167, 29, 118, 250, 162, 210, 213, 195, 34, 78, 195, 212, 29, 235, 41, 57, 33,
1, 33, 125, 166, 198, 179, 225, 159, 24, 37, 207, 178, 103, 109, 174, 204, 227, 191, 61,
224, 60, 242, 102, 71, 199, 141, 240, 11, 55, 27, 37, 204, 151, 0, 196, 198, 63, 128, 199,
75, 17, 38, 62, 66, 30, 191, 132, 134, 164, 227, 9, 1, 33, 125, 166, 198, 179, 225, 159,
24, 1, 4, 202, 254, 208, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 76, 66,
82, 255, 255, 255, 255, 255, 255, 255, 255,
];
let actual_output = to_bytes(&input).unwrap();
assert_eq!(expected_output, actual_output);
} | rust_cleaned_test_functions.jsonl/8054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 585
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
28884,
6615,
4306,
9165,
2602,
27421,
22391,
25602,
2022,
39304,
368,
341,
262,
1077,
1946,
284,
23022,
8070,
486,
931,
9165,
2602,
1006,
286,
8615,
4286,
486,
931,
8956,
310,
220,
15,
8148... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range() {
let engine = TestEngineBuilder::new().build().unwrap();
for i in 1..7 {
// ts = 1: value = []
must_prewrite_put(&engine, &[i], &[], &[i], 1);
must_commit(&engine, &[i], 1, 1);
// ts = 7: value = [ts]
must_prewrite_put(&engine, &[i], &[i], &[i], 7);
must_commit(&engine, &[i], 7, 7);
// ts = 14: value = []
must_prewrite_put(&engine, &[i], &[], &[i], 14);
must_commit(&engine, &[i], 14, 14);
}
let snapshot = engine.snapshot(&Context::default()).unwrap();
// Test both bound specified.
let mut scanner = ScannerBuilder::new(snapshot.clone(), 10, true)
.range(Some(Key::from_raw(&[3u8])), Some(Key::from_raw(&[5u8])))
.build()
.unwrap();
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[4u8]), vec![4u8]))
);
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[3u8]), vec![3u8]))
);
assert_eq!(scanner.next().unwrap(), None);
// Test left bound not specified.
let mut scanner = ScannerBuilder::new(snapshot.clone(), 10, true)
.range(None, Some(Key::from_raw(&[3u8])))
.build()
.unwrap();
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[2u8]), vec![2u8]))
);
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[1u8]), vec![1u8]))
);
assert_eq!(scanner.next().unwrap(), None);
// Test right bound not specified.
let mut scanner = ScannerBuilder::new(snapshot.clone(), 10, true)
.range(Some(Key::from_raw(&[5u8])), None)
.build()
.unwrap();
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[6u8]), vec![6u8]))
);
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[5u8]), vec![5u8]))
);
assert_eq!(scanner.next().unwrap(), None);
// Test both bound not specified.
let mut scanner = ScannerBuilder::new(snapshot.clone(), 10, true)
.range(None, None)
.build()
.unwrap();
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[6u8]), vec![6u8]))
);
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[5u8]), vec![5u8]))
);
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[4u8]), vec![4u8]))
);
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[3u8]), vec![3u8]))
);
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[2u8]), vec![2u8]))
);
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(&[1u8]), vec![1u8]))
);
assert_eq!(scanner.next().unwrap(), None);
} | rust_cleaned_test_functions.jsonl/36639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1742
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
1428,
1789,
286,
369,
600,
304,
220,
16,
496,
22,
341,
310,
442,
10591,
284,
220,
16,
25,
897,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_pass_doesnt_produce_invalid_code1() {
test_same(concat!(
"function f(x = void 0) {",
" var z;",
" {",
" const y = {};",
" x && (y['x'] = x);",
" z = y;",
" }",
" return z;",
"}",
));
} | rust_cleaned_test_functions.jsonl/27592 | {
"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,
15464,
96374,
406,
2540,
13373,
31433,
4136,
16,
368,
341,
262,
1273,
33574,
96360,
33673,
286,
330,
1688,
282,
2075,
284,
737,
220,
15,
8,
314,
756,
286,
330,
220,
762,
1147,
64497,
286,
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_poc050_burn_from() {
let mut t = Token::deployed();
let amount = 5_000_000.into();
t.mint(t.bro, amount, Sender(t.futjin));
t.increase_allowance(t.futjin, 1.into(), Sender(t.bro));
t.burn_from(t.bro, 1.into(), Sender(t.futjin));
assert_eq!(t.balance_of(t.bro), 4_999_999.into());
} | rust_cleaned_test_functions.jsonl/39706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
509,
15,
20,
15,
880,
399,
5673,
368,
341,
262,
1077,
5206,
259,
284,
9660,
486,
35794,
291,
543,
262,
1077,
3311,
284,
220,
20,
62,
15,
15,
15,
62,
15,
15,
15,
39860,
1428,
262,
259,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_configure_system() {
let mut vmm = create_vmm_object(InstanceState::Uninitialized);
assert!(vmm.init_guest_memory().is_ok());
// test that we can do this any number of times we want.
assert!(vmm.init_guest_memory().is_ok());
assert!(vmm.vm.memory().is_some());
assert_eq!(
vmm.configure_system(&Vec::new()).unwrap_err().to_string(),
"Cannot start microvm without kernel configuration."
);
vmm.default_kernel_config(None);
// We need this so that configure_system finds a properly setup GIC device
#[cfg(target_arch = "aarch64")]
assert!(vmm.vm.setup_irqchip(1).is_ok());
assert!(vmm.configure_system(&Vec::new()).is_ok());
vmm.stdin_handle.lock().set_canon_mode().unwrap();
} | rust_cleaned_test_functions.jsonl/28158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75887,
17687,
368,
341,
286,
1077,
5206,
348,
3821,
284,
1855,
2273,
3821,
5314,
7,
8846,
486,
1806,
36161,
626,
286,
2060,
10297,
85,
3821,
8271,
62739,
19195,
1005,
285,
19817,
5231,
286,
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_concat_str() {
let a = "Hello";
let b = "World";
let c = format!("{} {}", a, b);
assert_eq!(c, "Hello World")
} | rust_cleaned_test_functions.jsonl/24893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57478,
2895,
368,
341,
286,
1077,
264,
284,
330,
9707,
876,
286,
1077,
293,
284,
330,
10134,
876,
286,
1077,
272,
284,
3561,
17223,
6257,
24689,
264,
11,
293,
317,
286,
2060,
10714,
10297,
66,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_invert() {
assert!(Matrix4::<f64>::identity().invert().unwrap().is_identity());
assert!(C.invert().unwrap().approx_eq(&(
Matrix4::new( 5.0f64, -4.0f64, 1.0f64, 0.0f64,
-4.0f64, 8.0f64, -4.0f64, 0.0f64,
4.0f64, -8.0f64, 4.0f64, 8.0f64,
-3.0f64, 4.0f64, 1.0f64, -8.0f64) * 0.125f64)));
let mat_c = Matrix4::new(-0.131917f64, -0.76871f64, 0.625846f64, 0.0f64,
-0., 0.631364f64, 0.775487f64, 0.0f64,
-0.991261f64, 0.1023f64, -0.083287f64, 0.0f64,
0., -1.262728f64, -1.550973f64, 1.0f64);
assert!((mat_c.invert().unwrap() * mat_c).is_identity());
let mat_d = Matrix4::new( 0.065455f64, -0.720002f64, 0.690879f64, 0.0f64,
-0., 0.692364f64, 0.721549f64, 0.0f64,
-0.997856f64, -0.047229f64, 0.045318f64, 0.0f64,
0., -1.384727f64, -1.443098f64, 1.0f64);
assert!((mat_d.invert().unwrap() * mat_d).is_identity());
let mat_e = Matrix4::new( 0.409936f64, 0.683812f64, -0.603617f64, 0.0f64,
0., 0.661778f64, 0.7497f64, 0.0f64,
0.912114f64, -0.307329f64, 0.271286f64, 0.0f64,
-0., -1.323555f64, -1.499401f64, 1.0f64);
assert!((mat_e.invert().unwrap() * mat_e).is_identity());
let mat_f = Matrix4::new(-0.160691f64, -0.772608f64, 0.614211f64, 0.0f64,
-0., 0.622298f64, 0.78278f64, 0.0f64,
-0.987005f64, 0.125786f64, -0.099998f64, 0.0f64,
0., -1.244597f64, -1.565561f64, 1.0f64);
assert!((mat_f.invert().unwrap() * mat_f).is_identity());
} | rust_cleaned_test_functions.jsonl/30172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
1621,
368,
341,
286,
2060,
10297,
6689,
19,
27638,
69,
21,
19,
6831,
16912,
1005,
83729,
1005,
15454,
1005,
285,
46244,
5231,
286,
2060,
10297,
34,
1858,
1621,
1005,
15454,
1005,
48053,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_root_grpc_to_oci() {
#[derive(Debug)]
struct TestData {
grpcroot: grpc::Root,
result: oci::Root,
}
let tests = &[
TestData {
// Default fields
grpcroot: grpc::Root {
..Default::default()
},
result: oci::Root {
..Default::default()
},
},
TestData {
grpcroot: grpc::Root {
Path: String::from("path"),
Readonly: false,
..Default::default()
},
result: oci::Root {
path: String::from("path"),
readonly: false,
..Default::default()
},
},
TestData {
grpcroot: grpc::Root {
Path: String::from("path"),
Readonly: true,
..Default::default()
},
result: oci::Root {
path: String::from("path"),
readonly: true,
..Default::default()
},
},
];
for (i, d) in tests.iter().enumerate() {
let msg = format!("test[{}]: {:?}", i, d);
let result = root_grpc_to_oci(&d.grpcroot);
let msg = format!("{}, result: {:?}", msg, result);
assert_eq!(d.result, result, "{}", msg);
}
} | rust_cleaned_test_functions.jsonl/89912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1024
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12993,
15682,
3992,
2346,
62,
2119,
368,
341,
286,
11506,
27098,
42618,
5563,
286,
2036,
93200,
341,
310,
47900,
2888,
25,
47900,
486,
8439,
345,
310,
1102,
25,
93975,
486,
8439,
345,
286,
555,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_put_u8() {
let mut buf = Vec::with_capacity(8);
buf.put_u8(33);
assert_eq!(b"\x21", &buf[..]);
} | rust_cleaned_test_functions.jsonl/51219 | {
"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,
15557,
7300,
23,
368,
341,
262,
1077,
5206,
6607,
284,
11312,
486,
4197,
35603,
7,
23,
317,
262,
6607,
3597,
7300,
23,
7,
18,
18,
317,
262,
2060,
10714,
10297,
65,
11934,
87,
17,
16,
497,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_failing_loader() {
let dir = create_dir_and_file("fake.fail");
let asset_server = setup(dir.path());
asset_server.add_loader(FailingLoader);
let path: AssetPath = "fake.fail".into();
let handle = asset_server.get_handle_untyped(path.get_id());
let err = futures_lite::future::block_on(asset_server.load_async(path.clone(), true))
.unwrap_err();
assert!(matches!(err, AssetServerError::AssetLoaderError(_)));
assert_eq!(asset_server.get_load_state(handle), LoadState::Failed);
} | rust_cleaned_test_functions.jsonl/3153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
14277,
22139,
368,
341,
286,
1077,
5419,
284,
1855,
4334,
8378,
2458,
445,
30570,
26738,
797,
286,
1077,
9329,
12015,
284,
6505,
14161,
3875,
1423,
286,
9329,
12015,
1364,
22139,
7832,
14277,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_augmentation_parse_just_signal_trampoline() {
let aug_str = &mut EndianSlice::new(b"S", LittleEndian);
let bases = Default::default();
let address_size = 8;
let section = EhFrame::new(&[], LittleEndian);
let input = &mut EndianSlice::new(&[], LittleEndian);
let mut augmentation = Augmentation::default();
augmentation.is_signal_trampoline = true;
assert_eq!(
Augmentation::parse(aug_str, &bases, address_size, §ion, input),
Ok(augmentation)
);
} | rust_cleaned_test_functions.jsonl/9388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60411,
31099,
21039,
62,
4250,
21137,
92942,
368,
341,
286,
1077,
19303,
2895,
284,
609,
6984,
3972,
1103,
33236,
486,
931,
1883,
66310,
497,
14671,
43231,
317,
286,
1077,
23092,
284,
7899,
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... | 1 |
#[test]
fn test_virtio_write_config() {
let mut block = default_block();
let expected_config_space: [u8; CONFIG_SPACE_SIZE] =
[0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
block.write_config(0, &expected_config_space);
let mut actual_config_space = [0u8; CONFIG_SPACE_SIZE];
block.read_config(0, &mut actual_config_space);
assert_eq!(actual_config_space, expected_config_space);
let expected_config_space = [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x00, 0x11];
for i in 0..expected_config_space.len() {
block.write_config(i as u64, &expected_config_space[i..=i]);
}
block.read_config(0, &mut actual_config_space);
assert_eq!(actual_config_space, expected_config_space);
// Invalid write.
let new_config_space = [0xd, 0xe, 0xa, 0xd, 0xb, 0xe, 0xe, 0xf];
block.write_config(5, &new_config_space);
// Make sure nothing got written.
block.read_config(0, &mut actual_config_space);
assert_eq!(actual_config_space, expected_config_space);
} | rust_cleaned_test_functions.jsonl/73916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 526
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
9165,
5332,
368,
341,
286,
1077,
5206,
2504,
284,
1638,
7113,
1428,
286,
1077,
3601,
5332,
14663,
25,
508,
84,
23,
26,
13202,
38404,
4098,
60,
4035,
310,
508,
15,
87,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_insert_learner_that_is_voter() -> Result<()> {
let mut set = ProgressSet::new(default_logger());
let default_progress = Progress::new(0, 256);
let mut canary_progress = Progress::new(0, 256);
canary_progress.matched = CANARY;
set.insert_voter(1, default_progress.clone())?;
assert!(
set.insert_learner(1, canary_progress).is_err(),
"Should return an error on invalid learner insert."
);
assert_eq!(
*set.get(1).expect("Should be inserted."),
default_progress,
"The ProgressSet was mutated in a `insert_learner` that returned error."
);
Ok(())
} | rust_cleaned_test_functions.jsonl/48660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
62,
93595,
70197,
6892,
2273,
25392,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
738,
284,
16033,
1649,
486,
931,
18978,
27413,
1423,
286,
1077,
1638,
27200,
284,
16033,
486,
931,
7,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_keyfile_name_succeeded() {
let mut path = dirs::home_dir().unwrap();
path.push(BLOCK_KEYPAIR_FILENAME);
assert_eq!(
path.into_os_string().into_string().unwrap(),
get_keyfile_name()
);
} | rust_cleaned_test_functions.jsonl/71225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3097,
1192,
1269,
643,
43805,
368,
341,
286,
1077,
5206,
1815,
284,
42248,
486,
5117,
4334,
1005,
15454,
1428,
286,
1815,
2552,
5349,
8044,
6600,
82966,
45005,
317,
286,
2060,
10714,
33673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_init_sanity() {
let (init_result, deps) = init_helper(vec![InitialBalance {
address: HumanAddr("lebron".to_string()),
amount: Uint128(5000),
}]);
assert_eq!(init_result.unwrap(), InitResponse::default());
let config = ReadonlyConfig::from_storage(&deps.storage);
let constants = config.constants().unwrap();
assert_eq!(config.total_supply(), 5000);
assert_eq!(config.contract_status(), ContractStatusLevel::NormalRun);
assert_eq!(constants.name, "sec-sec".to_string());
assert_eq!(constants.admin, HumanAddr("admin".to_string()));
assert_eq!(constants.symbol, "SECSEC".to_string());
assert_eq!(constants.decimals, 8);
assert_eq!(
constants.prng_seed,
sha_256("lolz fun yay".to_owned().as_bytes())
);
assert_eq!(constants.total_supply_is_public, false);
} | rust_cleaned_test_functions.jsonl/69599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
643,
38270,
368,
341,
286,
1077,
320,
2327,
5287,
11,
48178,
8,
284,
2930,
10418,
25592,
20703,
6341,
21190,
341,
310,
2621,
25,
11097,
13986,
445,
273,
67457,
3263,
983,
3904,
14702,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_panic_good_message() {
fn f() {
panic!("an error message");
}
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
ignore: false,
should_panic: ShouldPanic::YesWithMessage("error message"),
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, tx);
let (_, res, _) = rx.recv().unwrap();
assert!(res == TrOk);
} | rust_cleaned_test_functions.jsonl/3485 | {
"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,
43378,
620,
31270,
44781,
6462,
368,
341,
286,
5168,
282,
368,
341,
310,
21975,
17223,
276,
1465,
1943,
797,
286,
456,
286,
1077,
6560,
284,
3393,
11065,
3036,
24911,
341,
310,
6560,
25,
3393,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_op_parse_deref_type() {
// Doesn't matter for this test.
let encoding = encoding4();
check_op_parse(
|s| s.D8(constants::DW_OP_deref_type.0).D8(8).uleb(100),
&Operation::Deref {
base_type: UnitOffset(100),
size: 8,
space: false,
},
encoding,
);
check_op_parse(
|s| s.D8(constants::DW_OP_GNU_deref_type.0).D8(8).uleb(100),
&Operation::Deref {
base_type: UnitOffset(100),
size: 8,
space: false,
},
encoding,
);
check_op_parse(
|s| s.D8(constants::DW_OP_xderef_type.0).D8(8).uleb(100),
&Operation::Deref {
base_type: UnitOffset(100),
size: 8,
space: true,
},
encoding,
);
} | rust_cleaned_test_functions.jsonl/45758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 600
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
21039,
814,
43970,
1819,
368,
341,
286,
442,
48832,
944,
4925,
369,
419,
1273,
624,
286,
1077,
11170,
284,
11170,
19,
1428,
286,
1779,
10287,
21039,
1006,
310,
760,
82,
91,
274,
909,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_complex() {
let mut list = List::new(FooAdaptor);
list.push_back(Rc::new(Foo::new(1)));
list.push_back(Rc::new(Foo::new(2)));
list.push_back(Rc::new(Foo::new(3)));
list.push_back(Rc::new(Foo::new(4)));
assert_eq!(list.pop_front().unwrap().value, 1);
list.push_back(Rc::new(Foo::new(5)));
assert_eq!(list.pop_front().unwrap().value, 2);
assert_eq!(list.pop_front().unwrap().value, 3);
assert_eq!(list.pop_front().unwrap().value, 4);
list.push_back(Rc::new(Foo::new(6)));
assert_eq!(list.pop_front().unwrap().value, 5);
assert_eq!(list.pop_front().unwrap().value, 6);
assert!(list.pop_front().is_none());
} | rust_cleaned_test_functions.jsonl/68046 | {
"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,
41522,
368,
341,
286,
1077,
5206,
1140,
284,
1759,
486,
931,
7832,
2624,
2589,
32657,
626,
286,
1140,
2552,
3895,
2785,
66,
486,
931,
7832,
2624,
486,
931,
7,
16,
4945,
286,
1140,
2552,
3895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_allow_invalid_timestamp() -> Result<()> {
let mut ctx = EvalContext::from(TimeEnv {
allow_invalid_date: true,
..TimeEnv::default()
});
let ok_cases = vec![
"2019-9-31 11:11:11",
"2019-0-1 11:11:11",
"2013-2-29 11:11:11",
];
for case in ok_cases {
assert_eq!(
"0000-00-00 00:00:00",
Time::parse_timestamp(&mut ctx, case, 0, false)?.to_string()
);
}
let dsts = vec![
("2019-03-10 02:00:00", "America/New_York"),
("2022-04-01 02:00:00", "America/Monterrey"),
];
for (timestamp, time_zone) in dsts {
let mut ctx = EvalContext::from(TimeEnv {
allow_invalid_date: true,
time_zone: Tz::from_tz_name(time_zone),
..TimeEnv::default()
});
assert_eq!(
"0000-00-00 00:00:00",
Time::parse_timestamp(&mut ctx, timestamp, 0, false)?.to_string()
)
}
Ok(())
} | rust_cleaned_test_functions.jsonl/40461 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 665
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55731,
31433,
23073,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
1499,
36968,
14359,
341,
310,
2138,
31433,
4164,
25,
830,
345,
310,
5241,
1462,
14359,
486,
2258,
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... | 7 |
#[test]
fn test_set_properties() {
let obj = Object::with_type(
SimpleObject::static_type(),
&[("construct-name", &"meh"), ("name", &"initial")],
)
.expect("Object::new failed");
assert_eq!(
obj.property::<String>("construct-name"),
String::from("meh")
);
assert_eq!(
obj.try_set_property("construct-name", &"test")
.err()
.expect("Failed to set 'construct-name' property")
.to_string(),
"property 'construct-name' of type 'SimpleObject' is not writable",
);
assert_eq!(
obj.property::<String>("construct-name"),
String::from("meh")
);
assert_eq!(obj.property::<String>("name"), String::from("initial"));
assert!(obj.try_set_property("name", &"test").is_ok());
assert_eq!(obj.property::<String>("name"), String::from("test"));
assert_eq!(
obj.try_set_property("test", &true)
.err()
.expect("set_property failed")
.to_string(),
"property 'test' of type 'SimpleObject' not found",
);
assert_eq!(
obj.try_set_property("constructed", &false)
.err()
.expect("Failed to set 'constructed' property")
.to_string(),
"property 'constructed' of type 'SimpleObject' is not writable",
);
assert_eq!(
obj.try_set_property("name", &false)
.err()
.expect("Failed to set 'name' property")
.to_string(),
"property 'name' of type 'SimpleObject' can't be set from the given type (expected: 'gchararray', got: 'gboolean')",
);
let other_obj =
Object::with_type(SimpleObject::static_type(), &[]).expect("Object::new failed");
assert_eq!(
obj.try_set_property("child", &other_obj)
.err()
.expect("Failed to set 'child' property")
.to_string(),
"property 'child' of type 'SimpleObject' can't be set from the given type (expected: 'ChildObject', got: 'SimpleObject')",
);
let child = Object::with_type(ChildObject::static_type(), &[]).expect("Object::new failed");
assert!(obj.try_set_property("child", &child).is_ok());
} | rust_cleaned_test_functions.jsonl/9012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
25158,
368,
341,
286,
1077,
2839,
284,
3002,
486,
4197,
1819,
1006,
310,
8993,
1190,
486,
1978,
1819,
3148,
310,
44590,
445,
7596,
11494,
497,
609,
1,
76,
2636,
3975,
3489,
606,
497,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scope_variable_segment() {
let app = App::new()
.scope("/ab-{project}", |scope| {
scope.resource("/path1", |r| {
r.f(|r| {
HttpResponse::Ok()
.body(format!("project: {}", &r.match_info()["project"]))
})
})
})
.finish();
let req = TestRequest::with_uri("/ab-project1/path1").request();
let resp = app.run(req);
assert_eq!(resp.as_msg().status(), StatusCode::OK);
match resp.as_msg().body() {
&Body::Binary(ref b) => {
let bytes: Bytes = b.clone().into();
assert_eq!(bytes, Bytes::from_static(b"project: project1"));
}
_ => panic!(),
}
let req = TestRequest::with_uri("/aa-project1/path1").request();
let resp = app.run(req);
assert_eq!(resp.as_msg().status(), StatusCode::NOT_FOUND);
} | rust_cleaned_test_functions.jsonl/22444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 563
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23199,
14635,
28061,
368,
341,
286,
1077,
906,
284,
1845,
486,
931,
741,
310,
659,
4186,
4283,
370,
63347,
4987,
9545,
760,
4186,
91,
341,
394,
6891,
24013,
4283,
2343,
16,
497,
760,
81,
91,
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_parsing_bitmasks_requiring_params_mem_access_no_param() {
let mut v = ZERO_BOUND_HEADER.to_vec();
v.append(&mut vec![0x3e, 0x00, 0x04, 0x00]); // OpStore
v.append(&mut vec![0x01, 0x00, 0x00, 0x00]); // pointer: 1
v.append(&mut vec![0x02, 0x00, 0x00, 0x00]); // object: 2
v.append(&mut vec![0x01, 0x00, 0x00, 0x00]); // Volatile
let mut c = RetainingConsumer::new();
{
let p = Parser::new(&v, &mut c);
assert_matches!(p.parse(), Ok(()));
}
assert_eq!(1, c.insts.len());
let inst = &c.insts[0];
assert_eq!("Store", inst.class.opname);
assert_eq!(None, inst.result_type);
assert_eq!(None, inst.result_id);
assert_eq!(vec![dr::Operand::IdRef(1),
dr::Operand::IdRef(2),
dr::Operand::MemoryAccess(spirv::MemoryAccess::VOLATILE)],
inst.operands);
} | rust_cleaned_test_functions.jsonl/85755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 529
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
13996,
76,
4604,
1288,
70094,
6745,
12976,
12759,
6536,
4090,
368,
341,
286,
1077,
5206,
348,
284,
54593,
73644,
20330,
2389,
13251,
543,
286,
348,
2057,
2099,
6984,
7486,
20703,
15,
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... | 1 |
#[test]
fn test_multidim() {
let mut mat = ArcArray::zeros(2 * 3 * 4 * 5 * 6).reshape((2, 3, 4, 5, 6));
mat[(0, 0, 0, 0, 0)] = 22u8;
{
for (i, elt) in mat.iter_mut().enumerate() {
*elt = i as u8;
}
}
assert_eq!(mat.shape(), &[2, 3, 4, 5, 6]);
} | rust_cleaned_test_functions.jsonl/92612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
307,
318,
368,
341,
262,
1077,
5206,
5517,
284,
19689,
1857,
486,
35716,
7,
17,
353,
220,
18,
353,
220,
19,
353,
220,
20,
353,
220,
21,
568,
16137,
1188,
17,
11,
220,
18,
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... | 2 |
#[test]
fn test_payload_too_big() {
let p256dh = base64::decode_config(
"BLMaF9ffKBiWQLCKvTHb6LO8Nb6dcUh6TItC455vu2kElga6PQvUmaFyCdykxY2nOSSL3yKgfbmFLRTUaGv4yV8",
URL_SAFE,
)
.unwrap();
let auth = base64::decode_config("xS03Fj5ErfTNH_l9WHE9Ig", URL_SAFE).unwrap();
let http_ece = HttpEce::new(ContentEncoding::Aes128Gcm, &p256dh, &auth, None);
//This content is one above limit.
let content = [0u8; 3801];
assert_eq!(Err(WebPushError::PayloadTooLarge), http_ece.encrypt(&content));
} | rust_cleaned_test_functions.jsonl/94468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32813,
2346,
78,
36386,
368,
341,
286,
1077,
281,
17,
20,
21,
30621,
284,
2331,
21,
19,
486,
18196,
5332,
1006,
310,
330,
9389,
29535,
37,
24,
542,
29862,
72,
54,
3588,
3021,
85,
3617,
65,
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_parse_concat_transform() {
let transform = match parse_concat_transform(FileSpan::new(Rc::new(String::from("ConcatTransform 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16")), Rc::new(String::from("input")))).unwrap().1 {
Transformation::ConcatTransform(t) => t,
_ => panic!()
};
assert_eq!(transform.m00.value, 1.0);
assert_eq!(transform.m01.value, 2.0);
assert_eq!(transform.m02.value, 3.0);
assert_eq!(transform.m03.value, 4.0);
assert_eq!(transform.m10.value, 5.0);
assert_eq!(transform.m11.value, 6.0);
assert_eq!(transform.m12.value, 7.0);
assert_eq!(transform.m13.value, 8.0);
assert_eq!(transform.m20.value, 9.0);
assert_eq!(transform.m21.value, 10.0);
assert_eq!(transform.m22.value, 11.0);
assert_eq!(transform.m23.value, 12.0);
assert_eq!(transform.m30.value, 13.0);
assert_eq!(transform.m31.value, 14.0);
assert_eq!(transform.m32.value, 15.0);
assert_eq!(transform.m33.value, 16.0);
} | rust_cleaned_test_functions.jsonl/68354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
57478,
18449,
368,
341,
262,
1077,
5165,
284,
2432,
4715,
57478,
18449,
19821,
12485,
486,
931,
2785,
66,
486,
931,
2242,
486,
1499,
445,
78440,
8963,
220,
16,
220,
17,
220,
18,
220,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_nodes_to_subnet_succeeds() {
local_test_on_nns_subnet(|runtime| {
async move {
let num_nodes_in_subnet = 4 as usize;
let num_unassigned_nodes = 4 as usize;
let (init_mutate, subnet_id, unassigned_node_ids, _) =
common::prepare_registry(num_nodes_in_subnet, num_unassigned_nodes);
// registry so it would allow mutation by the subnet handler.
let registry = set_up_registry_canister(
&runtime,
RegistryCanisterInitPayloadBuilder::new()
.push_init_mutate_request(init_mutate)
.build(),
)
.await;
// Install the universal canister in place of the proposals canister
let fake_proposal_canister = set_up_universal_canister(&runtime).await;
// it
assert_eq!(
fake_proposal_canister.canister_id(),
ic_nns_constants::GOVERNANCE_CANISTER_ID
);
// Ensure that the subnet record is there
let subnet_list_record =
get_value::<SubnetListRecord>(®istry, SUBNET_LIST_KEY.as_bytes()).await;
// one
assert_eq!(subnet_list_record.subnets.len(), 2);
assert_eq!(subnet_list_record.subnets[1], subnet_id.get().to_vec());
let subnet_record =
get_value::<SubnetRecord>(®istry, &make_subnet_record_key(subnet_id).as_bytes())
.await;
assert_eq!(subnet_record.membership.len(), num_nodes_in_subnet as usize);
let payload = AddNodesToSubnetPayload {
subnet_id: subnet_id.get(),
node_ids: unassigned_node_ids.clone(),
};
assert!(
forward_call_via_universal_canister(
&fake_proposal_canister,
®istry,
"add_nodes_to_subnet",
Encode!(&payload).unwrap()
)
.await
);
let subnet_list_record =
get_value::<SubnetListRecord>(®istry, SUBNET_LIST_KEY.as_bytes()).await;
// one
assert_eq!(subnet_list_record.subnets.len(), 2);
assert_eq!(subnet_list_record.subnets[1], subnet_id.get().to_vec());
let subnet_record =
get_value::<SubnetRecord>(®istry, &make_subnet_record_key(subnet_id).as_bytes())
.await;
// the number of nodes doubled
assert_eq!(
subnet_record.membership.len(),
num_nodes_in_subnet + num_unassigned_nodes
);
for node_id in unassigned_node_ids {
let node_id = node_id.get().to_vec();
assert!(subnet_record.membership.iter().any(|x| *x == node_id));
}
Ok(())
}
});
} | rust_cleaned_test_functions.jsonl/128506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1710
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
14896,
2346,
95681,
643,
29264,
82,
368,
341,
262,
2205,
4452,
4470,
1089,
4412,
95681,
22428,
22255,
91,
341,
286,
3312,
3271,
341,
310,
1077,
1629,
14896,
1243,
95681,
284,
220,
19,
438,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vcx_credential_update_state() {
settings::set_defaults();
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE,"true");
let cxn = ::connection::build_connection("test_credential_update_state").unwrap();
let handle = credential::from_string(DEFAULT_SERIALIZED_CREDENTIAL).unwrap();
::utils::httpclient::set_next_u8_response(::utils::constants::NEW_CREDENTIAL_OFFER_RESPONSE.to_vec());
assert_eq!(vcx_credential_update_state(0, handle, Some(get_state_cb)), error::SUCCESS.code_num);
thread::sleep(Duration::from_millis(300));
assert_eq!(vcx_credential_send_request(0, handle, cxn,0, Some(send_offer_cb)), error::SUCCESS.code_num);
thread::sleep(Duration::from_millis(200));
} | rust_cleaned_test_functions.jsonl/7551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
666,
30320,
8882,
4387,
368,
341,
286,
5003,
486,
746,
42290,
543,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
1335,
1866,
797,
286,
1077,
20716,
77,
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_rotate_line_around_point() {
let line0 = Line::new(Point::new(0., 0.), Point::new(0., 2.));
let line1 = Line::new(Point::new(0., 0.), Point::new(-2., 0.));
assert_relative_eq!(line0.rotate_around_point(90., Point::new(0., 0.)), line1);
} | rust_cleaned_test_functions.jsonl/49666 | {
"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,
60834,
6528,
62,
19454,
6085,
368,
341,
286,
1077,
1555,
15,
284,
7083,
486,
931,
32737,
486,
931,
7,
15,
2572,
220,
15,
24389,
5126,
486,
931,
7,
15,
2572,
220,
17,
13,
1106,
286,
1077,
155... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fail_adding_more_cycles_when_not_enough_balance() {
let cycles_amount = 1_000_000_000_000;
let max_num_instructions = NumInstructions::from(1 << 30);
let cycles_account_manager = CyclesAccountManagerBuilder::new()
.with_max_num_instructions(max_num_instructions)
.build();
let system_state =
get_new_running_system_state(Cycles::from(cycles_amount), SubnetType::Application);
let mut api = get_system_api(get_update_api_type(), system_state, cycles_account_manager);
// Check ic0_canister_cycle_balance after first ic0_call_new.
assert_eq!(api.ic0_call_new(0, 0, 0, 0, 0, 0, 0, 0, &[]), Ok(()));
// Check cycles balance.
assert_eq!(
api.ic0_canister_cycle_balance().unwrap() as u128,
cycles_amount
);
// Add cycles to call.
let amount = cycles_amount / 2 + 1;
assert_eq!(
api.ic0_call_cycles_add128(amount.try_into().unwrap()),
Ok(())
);
// Check cycles balance after call_add_cycles.
assert_eq!(
api.ic0_canister_cycle_balance().unwrap() as u128,
cycles_amount - amount
);
// Adding more cycles fails because not enough balance left.
assert_eq!(
api.ic0_call_cycles_add128(amount.try_into().unwrap())
.unwrap_err(),
HypervisorError::InsufficientCyclesBalance {
available: Cycles::from(cycles_amount - amount),
requested: Cycles::from(amount),
}
);
// Balance unchanged after the second call_add_cycles.
assert_eq!(
api.ic0_canister_cycle_balance().unwrap() as u128,
cycles_amount - amount
);
} | rust_cleaned_test_functions.jsonl/109060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 863
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22121,
2891,
287,
36664,
68970,
47636,
7913,
6205,
1384,
29396,
368,
341,
286,
1077,
24484,
13471,
284,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
280,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum_node() {
assert_ne!(Node::Num(0).clone(), Node::Var.clone());
assert_eq!(format!("{:?}", Node::Var), String::from("Var"));
assert_eq!(format!("{:?}", Node::Num(0)), String::from("Num(0)"));
let mut n: Node;
n = Node::UnOp {
op: UnOp::Not,
rhs: Box::new(Node::Var),
};
assert_ne!(n.clone(), Node::Var);
assert_eq!(format!("{:?}", n), String::from("UnOp { op: Not, rhs: Var }"));
n = Node::BinOp {
op: BinOp::Add,
lhs: Box::new(Node::Var),
rhs: Box::new(Node::Var),
};
assert_ne!(n.clone(), Node::Var);
assert_eq!(
format!("{:?}", n),
String::from("BinOp { op: Add, lhs: Var, rhs: Var }")
);
n = Node::Cond {
test: Box::new(Node::Var),
if_true: Box::new(Node::Var),
if_false: Box::new(Node::Var),
};
assert_ne!(n.clone(), Node::Var);
assert_eq!(
format!("{:?}", n),
String::from("Cond { test: Var, if_true: Var, if_false: Var }")
);
} | rust_cleaned_test_functions.jsonl/95575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 645
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
5084,
368,
341,
286,
2060,
13925,
10297,
1955,
486,
4651,
7,
15,
568,
19982,
1507,
6018,
486,
3962,
15997,
1423,
286,
2060,
10714,
10297,
2243,
88928,
25,
52652,
6018,
486,
3962,
701,
923,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dns_name_parsing() {
// Make sure `dns::Name`'s validation isn't too strict. It is
// implemented in terms of `webpki::DNSName` which has many more tests
struct Case {
input: &'static str,
output: &'static str,
}
static VALID: &[Case] = &[
Case {
input: "1.2.3.x",
output: "1.2.3.x",
},
Case {
input: "1.2.3.x",
output: "1.2.3.x",
},
Case {
input: "1.2.3.4A",
output: "1.2.3.4a",
},
Case {
input: "a.b.c.d",
output: "a.b.c.d",
},
// Uppercase letters in labels
Case {
input: "A.b.c.d",
output: "a.b.c.d",
},
Case {
input: "a.mIddle.c",
output: "a.middle.c",
},
Case {
input: "a.b.c.D",
output: "a.b.c.d",
},
// Absolute
Case {
input: "a.b.c.d.",
output: "a.b.c.d.",
},
];
for case in VALID {
let name = Name::from_str(&case.input);
assert_eq!(name.as_ref().map(|x| x.as_ref()), Ok(case.output));
}
static INVALID: &[&str] = &[
// These are not in the "preferred name syntax" as defined by
// the last label only has digits.
"1.2.3.4", "a.1.2.3", "1.2.x.3",
];
for case in INVALID {
assert!(Name::from_str(case).is_err());
}
} | rust_cleaned_test_functions.jsonl/106474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71125,
1269,
620,
28598,
368,
341,
286,
442,
7405,
2704,
1565,
45226,
486,
675,
63,
6,
82,
10519,
4436,
944,
2238,
7304,
13,
1084,
374,
198,
286,
442,
11537,
304,
3793,
315,
1565,
2911,
79,
66... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_layer_env_delta_fs_read_write() {
let mut original_delta = LayerEnvDelta::new();
original_delta.insert(ModificationBehavior::Default, "FOO", "BAR");
original_delta.insert(ModificationBehavior::Append, "APPEND_TO_ME", "NEW_VALUE");
let temp_dir = tempdir().unwrap();
original_delta.write_to_env_dir(&temp_dir.path()).unwrap();
let disk_delta = LayerEnvDelta::read_from_env_dir(&temp_dir.path()).unwrap();
assert_eq!(original_delta, disk_delta);
} | rust_cleaned_test_functions.jsonl/36432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12680,
15879,
26710,
34470,
6443,
9165,
368,
341,
286,
1077,
5206,
4024,
26710,
284,
22735,
14359,
20277,
486,
931,
543,
286,
4024,
26710,
7030,
71956,
2404,
22753,
486,
3675,
11,
330,
3788,
46,
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_add_derive() {
check_action(
"struct Foo { a: i32, <|>}",
"#[derive(<|>)]\nstruct Foo { a: i32, }",
|file, off| add_derive(file, off).map(|f| f()),
);
check_action(
"struct Foo { <|> a: i32, }",
"#[derive(<|>)]\nstruct Foo { a: i32, }",
|file, off| add_derive(file, off).map(|f| f()),
);
check_action(
"#[derive(Clone)]\nstruct Foo { a: i32<|>, }",
"#[derive(Clone<|>)]\nstruct Foo { a: i32, }",
|file, off| add_derive(file, off).map(|f| f()),
);
} | rust_cleaned_test_functions.jsonl/100435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
35345,
533,
368,
341,
286,
1779,
7931,
1006,
310,
330,
1235,
33428,
314,
264,
25,
600,
18,
17,
11,
82639,
29,
24375,
310,
5869,
58,
27098,
22726,
91,
29,
7252,
59,
77,
1235,
33428,
314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_mac_ipv6_undersize() {
let event = DhcpEvent::LeaseAdded {
event_timestamp: DateTime::<FixedOffset>::from(Local::now()),
lease_info: full_lease_info_v6(),
};
let mut result_command = Command::new(namib_dnsmasq_hook_exe());
let (args, mut envs) = create_args_and_env_map_from_event(&event);
envs.insert("DNSMASQ_MAC".to_string(), "aa".to_string());
assert_eq!(
6,
result_command
.args(args)
.env_clear()
.envs(envs)
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
.expect("Error while running command.")
.code()
.expect("Command was terminated by a signal.")
);
} | rust_cleaned_test_functions.jsonl/48456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
22802,
49378,
21,
62,
31009,
551,
368,
341,
286,
1077,
1538,
284,
43227,
4672,
1556,
486,
2304,
519,
19337,
341,
310,
1538,
23073,
25,
6520,
27638,
13520,
6446,
6831,
1499,
42718,
486,
3328... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_str_input() {
let mut input = "test".as_input();
assert_eq!(input.head(), In('t'));
input.step();
assert_eq!(input.head(), In('e'));
input.step();
assert_eq!(input.head(), In('s'));
input.step();
assert_eq!(input.head(), In('t'));
input.step();
assert_eq!(input.head(), Out);
} | rust_cleaned_test_functions.jsonl/32347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
5898,
368,
341,
286,
1077,
5206,
1946,
284,
330,
1944,
3263,
300,
5898,
543,
286,
2060,
10714,
10297,
1355,
16042,
1507,
758,
492,
83,
6336,
286,
1946,
21465,
543,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_phi_values() {
let context = Context::create();
let builder = context.create_builder();
let module = context.create_module("my_mod");
let void_type = context.void_type();
let bool_type = context.bool_type();
let fn_type = void_type.fn_type(&[bool_type.into()], false);
let fn_value = module.add_function("my_func", fn_type, None);
assert!(fn_value.as_global_value().is_declaration());
let entry_block = fn_value.append_basic_block("entry");
let then_block = fn_value.append_basic_block("then");
let else_block = fn_value.append_basic_block("else");
assert!(!fn_value.as_global_value().is_declaration());
builder.position_at_end(&entry_block);
let false_val = bool_type.const_int(0, false);
let true_val = bool_type.const_int(1, false);
let phi = builder.build_phi(bool_type, "if");
assert!(!phi.is_null());
assert!(!phi.is_undef());
assert!(phi.as_basic_value().is_int_value());
assert_eq!(phi.as_instruction().get_opcode(), Phi);
assert_eq!(phi.count_incoming(), 0);
assert_eq!(*phi.print_to_string(), *CString::new(" %if = phi i1 ").unwrap());
phi.add_incoming(&[
(&false_val, &then_block),
(&true_val, &else_block),
]);
assert_eq!(phi.count_incoming(), 2);
assert_eq!(*phi.print_to_string(), *CString::new(" %if = phi i1 [ false, %then ], [ true, %else ]").unwrap());
let (then_val, then_bb) = phi.get_incoming(0).unwrap();
let (else_val, else_bb) = phi.get_incoming(1).unwrap();
assert_eq!(then_val.into_int_value(), false_val);
assert_eq!(else_val.into_int_value(), true_val);
assert_eq!(then_bb, then_block);
assert_eq!(else_bb, else_block);
assert!(phi.get_incoming(2).is_none());
} | rust_cleaned_test_functions.jsonl/122311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 734
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42009,
9146,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
7363,
284,
2266,
2520,
28532,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
2408,
7480,
797,
262,
1077,
737,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normalize_attr() {
// See comment on xml_doc::parser::DocumentParser::normalize_attr_value
let xml = "<?xml version=\"1.0\"?>
<root attr=\" \r\t
ab
 c
\" />";
let doc = Document::parse_str(xml).unwrap();
let root = doc.root_element().unwrap();
let val = root.attribute(&doc, "attr").unwrap();
assert_eq!(val, "ab\r c");
} | rust_cleaned_test_functions.jsonl/74415 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80807,
10422,
368,
341,
262,
442,
3496,
3980,
389,
8396,
18869,
486,
9657,
486,
7524,
6570,
486,
30590,
10422,
3142,
198,
262,
1077,
8396,
284,
40271,
6455,
2319,
4070,
16,
13,
15,
2105,
5993,
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_op_parse_regval_type() {
// Doesn't matter for this test.
let encoding = encoding4();
check_op_parse(
|s| s.D8(constants::DW_OP_regval_type.0).uleb(1).uleb(100),
&Operation::RegisterOffset {
register: Register(1),
offset: 0,
base_type: UnitOffset(100),
},
encoding,
);
check_op_parse(
|s| s.D8(constants::DW_OP_GNU_regval_type.0).uleb(1).uleb(100),
&Operation::RegisterOffset {
register: Register(1),
offset: 0,
base_type: UnitOffset(100),
},
encoding,
);
} | rust_cleaned_test_functions.jsonl/45757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
21039,
4920,
831,
1819,
368,
341,
286,
442,
48832,
944,
4925,
369,
419,
1273,
624,
286,
1077,
11170,
284,
11170,
19,
1428,
286,
1779,
10287,
21039,
1006,
310,
760,
82,
91,
274,
909,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cdc_write_rollback_when_no_lock() {
let mut suite = TestSuite::new(1);
let mut req = suite.new_changedata_request(1);
req.set_extra_op(ExtraOp::ReadOldValue);
let (mut req_tx, _, receive_event) = new_event_feed(suite.get_region_cdc_client(1));
let _req_tx = block_on(req_tx.send((req, WriteFlags::default()))).unwrap();
// Txn1 commit_ts = 15
let mut m1 = Mutation::default();
let k1 = b"k1".to_vec();
m1.set_op(Op::Put);
m1.key = k1.clone();
m1.value = b"v1".to_vec();
suite.must_kv_prewrite(1, vec![m1], k1.clone(), 10.into());
// Wait until resolved_ts advanced to 10
loop {
let event = receive_event(true);
if let Some(resolved_ts) = event.resolved_ts.as_ref() {
if resolved_ts.ts == 10 {
break;
}
}
}
suite.must_kv_rollback(1, vec![k1.clone()], 5.into());
// resolved_ts shouldn't be advanced beyond 10
for _ in 0..10 {
let event = receive_event(true);
if let Some(resolved_ts) = event.resolved_ts.as_ref() {
if resolved_ts.ts > 10 {
panic!("resolved_ts shouldn't be advanced beyond 10");
}
}
}
suite.must_kv_commit(1, vec![k1], 10.into(), 15.into());
let mut advance_cnt = 0;
loop {
let event = receive_event(true);
if let Some(resolved_ts) = event.resolved_ts.as_ref() {
advance_cnt += 1;
if resolved_ts.ts > 15 {
break;
}
if advance_cnt > 10 {
panic!("resolved_ts is not advanced, stuck at {}", resolved_ts.ts);
}
}
}
suite.stop();
} | rust_cleaned_test_functions.jsonl/13020 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 853
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
7628,
9165,
62,
33559,
47636,
6536,
9818,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
16,
317,
262,
1077,
5206,
4232,
284,
16182,
4618,
25213,
459,
7893,
7,
16,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_mutex_arc_nested() {
// Tests nested mutexes and access
// to underlying data.
let arc = Arc::new(Mutex::new(1));
let arc2 = Arc::new(Mutex::new(arc));
let (tx, rx) = channel();
let _t = thread::spawn(move || {
let lock = arc2.lock().unwrap();
let lock2 = lock.lock().unwrap();
assert_eq!(*lock2, 1);
tx.send(()).unwrap();
});
rx.recv().unwrap();
} | rust_cleaned_test_functions.jsonl/8920 | {
"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,
14204,
62914,
66279,
368,
341,
286,
442,
20150,
24034,
30863,
288,
323,
2615,
198,
286,
442,
311,
16533,
821,
624,
286,
1077,
15580,
284,
19689,
486,
931,
3189,
9371,
486,
931,
7,
16,
1106,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_result_with_list() {
assert_eq!(format!("{:?}", result_with_list()), "Ok([1, 11, 1426, 3])");
} | rust_cleaned_test_functions.jsonl/3827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5287,
6615,
2019,
368,
341,
286,
2060,
10714,
10297,
2243,
88928,
25,
52652,
1102,
6615,
2019,
11858,
330,
11578,
2561,
16,
11,
220,
16,
16,
11,
220,
16,
19,
17,
21,
11,
220,
18,
2467,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_is_valid_number() {
let list = [35, 20, 15, 25, 47];
assert_eq!(is_valid_number(40, &list), true);
assert_eq!(is_valid_number(50, &list), true);
assert_eq!(is_valid_number(102, &list), false);
assert_eq!(is_valid_number(10, &list), false);
} | rust_cleaned_test_functions.jsonl/54490 | {
"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,
6892,
8337,
5500,
368,
341,
262,
1077,
1140,
284,
508,
18,
20,
11,
220,
17,
15,
11,
220,
16,
20,
11,
220,
17,
20,
11,
220,
19,
22,
935,
262,
2060,
10714,
10297,
285,
8337,
5500,
7,
19,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bn128_mul_ethereum() {
let x = FromHex::from_hex(
"2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb7"
).unwrap();
let y = FromHex::from_hex(
"21611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb204"
).unwrap();
let scalar = FromHex::from_hex(
"00000000000000000000000000000000000000000000000011138ce750fa15c2"
).unwrap();
let mut output = [0u8; 64];
let expected = FromHex::from_hex(
"\
070a8d6a982153cae4be29d434e8faef8a47b274a053f5a4ee2a6c9c13c31e5c\
031b8ce914eba3a9ffb989f9cdd5b0f01943074bf4f0f315690ec3cec6981afc",
)
.unwrap();
bn128_mul(&x, &y, &scalar, &mut output).expect("Builtin should not fail");
assert_eq!(output.to_vec(), expected);
} | rust_cleaned_test_functions.jsonl/103162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 544
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58112,
16,
17,
23,
24944,
57757,
23923,
368,
341,
286,
1077,
856,
284,
5542,
20335,
486,
1499,
32655,
1006,
394,
330,
17,
8940,
18,
68,
21,
67,
15,
69,
18,
65,
16,
19,
17,
24,
17,
19,
69,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ntp_time_offset() {
let s = r#"synchronised to NTP server (10.73.10.10) at stratum 12
time correct to within 949 ms
polling server every 64 s"#;
assert_eq!(parse_ntp_time_offset(s), Some("949 ms".to_string().into()));
} | rust_cleaned_test_functions.jsonl/14477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
38945,
79,
3009,
6917,
368,
341,
286,
1077,
274,
284,
435,
55543,
82,
14113,
4056,
311,
451,
4239,
3538,
320,
16,
15,
13,
22,
18,
13,
16,
15,
13,
16,
15,
8,
518,
607,
26253,
220,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_and3() {
let compiled = compile("SET A 255\nAND A A");
let out_cpu = test_program(compiled);
assert_eq!(out_cpu.a.value, 255);
assert_eq!(out_cpu.f.value, 0);
} | rust_cleaned_test_functions.jsonl/63158 | {
"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,
8378,
18,
368,
341,
262,
1077,
19697,
284,
19192,
445,
5884,
362,
220,
17,
20,
20,
1699,
3976,
362,
362,
797,
262,
1077,
700,
21795,
284,
1273,
25096,
30008,
2181,
626,
262,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_group_with_multichar_sep() {
check(
r#"
macro_rules! m {
(fn $name:ident { $($i:literal)* }) => ( fn $name() -> bool { $($i)&&* } );
}
m! (fn baz { true false } );
"#,
expect![[r#"
macro_rules! m {
(fn $name:ident { $($i:literal)* }) => ( fn $name() -> bool { $($i)&&* } );
}
fn baz() -> bool {
true && false
}
"#]],
);
check(
r#"
macro_rules! m {
(fn $name:ident { $($i:literal)&&* }) => ( fn $name() -> bool { $($i)&&* } );
}
m! (fn baz { true && false } );
"#,
expect![[r#"
macro_rules! m {
(fn $name:ident { $($i:literal)&&* }) => ( fn $name() -> bool { $($i)&&* } );
}
fn baz() -> bool {
true && false
}
"#]],
);
} | rust_cleaned_test_functions.jsonl/85211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
6288,
6615,
26290,
713,
277,
54775,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
341,
262,
320,
8822,
400,
606,
25,
1713,
314,
93977,
72,
25,
35785,
4806,
6413,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delta_bit_packed_int32_repeat() {
let block_data = vec![
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2,
3, 4, 5, 6, 7, 8,
];
test_delta_bit_packed_decode::<Int32Type>(vec![block_data]);
} | rust_cleaned_test_functions.jsonl/38519 | {
"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,
26710,
13996,
620,
11191,
4042,
18,
17,
41975,
368,
341,
286,
1077,
2504,
1769,
284,
7486,
90515,
310,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prf_know_plaintext_sound() {
let mut rng = rand::thread_rng();
let x = Scalar::random(&mut rng);
let pk = PublicKey::new(GENERATOR.scaled(&x));
let m = CurveElem::random(&mut rng);
let r = Scalar::random(&mut rng);
let enc = pk.encrypt(&m, &r);
let mut proof = PrfKnowPlaintext::new(&mut rng, enc, r);
proof.r.0 += &rust_elgamal::Scalar::one();
assert!(!proof.verify());
} | rust_cleaned_test_functions.jsonl/84420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
69,
4698,
3328,
6317,
1641,
427,
37676,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
1428,
286,
1077,
856,
284,
35176,
486,
11463,
2099,
6984,
28422,
317,
286,
1077,
22458... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shift() {
let ca = Int32Chunked::new_from_slice("", &[1, 2, 3]);
let shifted = ca.shift(1, &Some(0)).unwrap();
assert_eq!(shifted.cont_slice().unwrap(), &[0, 1, 2]);
let shifted = ca.shift(1, &None).unwrap();
assert_eq!(Vec::from(&shifted), &[None, Some(1), Some(2)]);
let shifted = ca.shift(-1, &None).unwrap();
assert_eq!(Vec::from(&shifted), &[Some(2), Some(3), None]);
assert!(ca.shift(3, &None).is_err());
let s = Series::new("a", ["a", "b", "c"]);
let shifted = s.shift(-1).unwrap();
assert_eq!(
Vec::from(shifted.utf8().unwrap()),
&[Some("b"), Some("c"), None]
);
} | rust_cleaned_test_functions.jsonl/57987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22230,
368,
341,
286,
1077,
2162,
284,
1333,
18,
17,
28304,
291,
486,
931,
5673,
26488,
19814,
44590,
16,
11,
220,
17,
11,
220,
18,
2558,
286,
1077,
28973,
284,
2162,
29154,
7,
16,
11,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_actuals() {
let addresses = [
// Elements
("2dxmEBXc2qMYcLSKiDBxdEePY3Ytixmnh4E", false, AddressParams::ELEMENTS),
("CTEo6VKG8xbe7HnfVW9mQoWTgtgeRSPktwTLbELzGw5tV8Ngzu53EBiasFMQKVbWmKWWTAdN5AUf4M6Y", true, AddressParams::ELEMENTS),
("ert1qwhh2n5qypypm0eufahm2pvj8raj9zq5c27cysu", false, AddressParams::ELEMENTS),
("el1qq0umk3pez693jrrlxz9ndlkuwne93gdu9g83mhhzuyf46e3mdzfpva0w48gqgzgrklncnm0k5zeyw8my2ypfsmxh4xcjh2rse", true, AddressParams::ELEMENTS),
// Liquid
("GqiQRsPEyJLAsEBFB5R34KHuqxDNkG3zur", false, AddressParams::LIQUID),
("VJLDwMVWXg8RKq4mRe3YFNTAEykVN6V8x5MRUKKoC3nfRnbpnZeiG3jygMC6A4Gw967GY5EotJ4Rau2F", true, AddressParams::LIQUID),
("ex1q7gkeyjut0mrxc3j0kjlt7rmcnvsh0gt45d3fud", false, AddressParams::LIQUID),
("lq1qqf8er278e6nyvuwtgf39e6ewvdcnjupn9a86rzpx655y5lhkt0walu3djf9cklkxd3ryld97hu8h3xepw7sh2rlu7q45dcew5", true, AddressParams::LIQUID),
];
for &(a, blinded, ref params) in &addresses {
let result = a.parse();
assert!(result.is_ok(), "vector: {}, err: \"{}\"", a, result.unwrap_err());
let addr: Address = result.unwrap();
assert_eq!(a, &addr.to_string(), "vector: {}", a);
assert_eq!(blinded, addr.is_blinded());
assert_eq!(params, addr.params);
roundtrips(&addr);
}
} | rust_cleaned_test_functions.jsonl/64316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 863
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40149,
82,
368,
341,
1789,
286,
1077,
14230,
284,
2278,
310,
442,
34157,
198,
310,
3489,
17,
12719,
76,
8264,
55,
66,
17,
80,
19159,
66,
7268,
72572,
3506,
9703,
36,
68,
37881,
18,
56,
83,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_stream_lookup() {
let spec = "output a: UInt8 := 3\n output b: UInt8 := a[0]";
assert_eq!(0, num_type_errors(spec));
assert_eq!(get_type(spec), ValueTy::UInt(UIntTy::U8));
} | rust_cleaned_test_functions.jsonl/110671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
27464,
368,
341,
286,
1077,
1398,
284,
330,
3006,
264,
25,
22275,
23,
1669,
220,
18,
1699,
2550,
293,
25,
22275,
23,
1669,
264,
58,
15,
59757,
286,
2060,
10714,
10297,
15,
11,
1629,
181... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum() {
#[derive(Deserialize, PartialEq, Debug)]
enum E {
Unit,
Newtype(u32),
Tuple(u32, u32),
Struct { a: u32 },
}
let lua = Lua::new();
lua.context(|lua| {
let expected = E::Unit;
let value = lua.load(
r#"
return "Unit"
"#).eval().unwrap();
let got = from_value(value).unwrap();
assert_eq!(expected, got);
let expected = E::Newtype(1);
let value = lua.load(
r#"
a = {}
a["Newtype"] = 1
return a
"#).eval().unwrap();
let got = from_value(value).unwrap();
assert_eq!(expected, got);
let expected = E::Tuple(1, 2);
let value = lua.load(
r#"
a = {}
a["Tuple"] = {1, 2}
return a
"#).eval().unwrap();
let got = from_value(value).unwrap();
assert_eq!(expected, got);
let expected = E::Struct { a: 1 };
let value = lua.load(
r#"
a = {}
a["Struct"] = {}
a["Struct"]["a"] = 1
return a
"#).eval().unwrap();
let got = from_value(value).unwrap();
assert_eq!(expected, got);
});
} | rust_cleaned_test_functions.jsonl/15900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 909
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
368,
341,
286,
11506,
27098,
7,
64465,
11,
55039,
11,
11091,
5563,
286,
7618,
468,
341,
310,
7954,
345,
310,
1532,
1313,
8154,
18,
17,
1326,
310,
24622,
8154,
18,
17,
11,
575,
18,
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_obj_lit_with_trailing_comma() {
assert_json_snapshot!(parse_literal(r#"{ abc: "foo", }"#.into()).unwrap().1);
assert_json_snapshot!(
parse_literal(r#"{ abc: 123, def: { foo: "bar", }, }"#.into())
.unwrap()
.1
);
parse_literal(r#"{,}"#.into()).unwrap_err();
parse_literal(r#"{ , }"#.into()).unwrap_err();
} | rust_cleaned_test_functions.jsonl/77773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7328,
98399,
6615,
3547,
14277,
2965,
1728,
368,
341,
286,
2060,
9455,
53265,
10297,
6400,
34100,
2601,
2,
14129,
39022,
25,
330,
7975,
497,
335,
57676,
13,
18122,
6011,
15454,
1005,
16,
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_string_array() {
let result = linear_search(
&vec![
String::from("test"),
String::from("this"),
String::from("array"),
],
String::from("this"),
);
assert_eq!(result, Some(1));
} | rust_cleaned_test_functions.jsonl/50283 | {
"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,
3904,
3858,
368,
341,
286,
1077,
1102,
284,
13482,
10716,
1006,
310,
609,
4083,
90515,
394,
923,
486,
1499,
445,
1944,
4461,
394,
923,
486,
1499,
445,
574,
4461,
394,
923,
486,
1499,
445,
1653,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merkle_tree_insert() {
let mut tree = TestSMT::new(3);
assert_eq!(tree.capacity(), 8);
tree.insert(0, TestLeaf(1));
assert_eq!(tree.root_hash(), 697_516_875);
tree.insert(0, TestLeaf(2));
assert_eq!(tree.root_hash(), 741_131_083);
tree.insert(3, TestLeaf(2));
assert_eq!(tree.root_hash(), 793_215_819);
} | rust_cleaned_test_functions.jsonl/35063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
16754,
273,
11663,
17678,
368,
341,
286,
1077,
5206,
4916,
284,
3393,
50,
8505,
486,
931,
7,
18,
626,
286,
2060,
10714,
10297,
9344,
59168,
1507,
220,
23,
626,
286,
4916,
7030,
7,
15,
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_as_ref_reader() {
let buf = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let mut rd = ReadRefReader::new(&buf);
assert_eq!(rd.read_slice(1).unwrap(), Reference::Borrowed(&[0][..]));
assert_eq!(rd.read_slice(6).unwrap(), Reference::Borrowed(&[1, 2, 3, 4, 5, 6][..]));
assert!(rd.read_slice(5).is_err());
assert_eq!(rd.read_slice(4).unwrap(), Reference::Borrowed(&[7, 8, 9, 10][..]));
} | rust_cleaned_test_functions.jsonl/106803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
7793,
22306,
368,
341,
262,
1077,
6607,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_enc() {
let sk_bob: SecretKey = random();
let sk_eve: SecretKey = random();
let pk_bob = sk_bob.public_key();
let msg = b"Muffins in the canteen today! Don't tell Eve!";
let ciphertext = pk_bob.encrypt(&msg[..]);
assert!(ciphertext.verify());
// Bob can decrypt the message.
let decrypted = sk_bob.decrypt(&ciphertext).expect("invalid ciphertext");
assert_eq!(msg[..], decrypted[..]);
// Eve can't.
let decrypted_eve = sk_eve.decrypt(&ciphertext).expect("invalid ciphertext");
assert_ne!(msg[..], decrypted_eve[..]);
let Ciphertext(u, v, w) = ciphertext;
let fake_ciphertext = Ciphertext(u, vec![0; v.len()], w);
assert!(!fake_ciphertext.verify());
assert_eq!(None, sk_bob.decrypt(&fake_ciphertext));
} | rust_cleaned_test_functions.jsonl/30566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
13781,
368,
341,
286,
1077,
1901,
880,
674,
25,
8599,
1592,
284,
4194,
543,
286,
1077,
1901,
2204,
586,
25,
8599,
1592,
284,
4194,
543,
286,
1077,
22458,
880,
674,
284,
1901,
880,
674,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_start() {
let mut u = Ukkonen::with_capacity(10, unit_cost);
let pattern = b"ACCGT";
// hit begins at 1st position
let text1 = b"ACCGTGGATGAGCGCCATAG";
// hit begins at 2nd position
let text2 = b"AACCGTGGATGAGCGCCATAG";
let occ: Vec<(usize, usize)> = u.find_all_end(pattern, text1, 1).collect();
assert_eq!(occ, [(3, 1), (4, 0), (5, 1)]);
let occ: Vec<(usize, usize)> = u.find_all_end(pattern, text2, 1).collect();
assert_eq!(occ, [(4, 1), (5, 0), (6, 1)]);
} | rust_cleaned_test_functions.jsonl/10298 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
4906,
368,
341,
286,
1077,
5206,
575,
284,
547,
19196,
41928,
486,
4197,
35603,
7,
16,
15,
11,
4982,
15890,
626,
286,
1077,
5383,
284,
293,
1,
1706,
8798,
51,
876,
286,
442,
4201,
12033... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate_into_string() {
let words = vec!["hello", " ", "world"];
let capitalized_words: String = capitalize_words(words).join("");
assert_eq!(capitalized_words, "Hello World");
} | rust_cleaned_test_functions.jsonl/4276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
45514,
3904,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
3670,
330,
14615,
6332,
286,
1077,
97321,
18981,
25,
923,
284,
52725,
18981,
36289,
568,
5987,
13056,
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 |
#[test]
fn test_merge_types_via_tvar()
{
let mut t = Inferator::new("burritos");
let intlist = Type::StrictList(Box::new(Type::Int));
let unknownlist = Type::StrictList(Box::new(Type::Unknown));
let tvar = Type::Var(Lstr::Sref("Taco"));
let mtype0 = t.merge_types(&unknownlist, &tvar);
assert_eq!(Ok(unknownlist), mtype0);
let mtype1 = t.merge_types(&intlist, &tvar);
assert_eq!(Ok(intlist), mtype1);
} | rust_cleaned_test_functions.jsonl/15071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
9763,
80710,
528,
947,
741,
262,
341,
286,
1077,
5206,
259,
284,
62658,
850,
486,
931,
445,
11240,
94012,
797,
286,
1077,
526,
1607,
284,
3990,
486,
41857,
852,
67758,
486,
931,
22498,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_ext_html_jinja_and_ext_txt() {
let t = PathHtmlJinjaAndExtTxt;
assert_eq!(t.render().unwrap(), "foo.html.jinja");
assert_eq!(PathHtmlJinjaAndExtTxt::EXTENSION, Some("txt"));
} | rust_cleaned_test_functions.jsonl/133246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
9927,
9564,
5374,
41420,
8378,
9927,
22436,
368,
341,
262,
1077,
259,
284,
7933,
13591,
41,
41420,
3036,
6756,
35629,
280,
262,
2060,
10714,
10297,
83,
8740,
1005,
15454,
1507,
330,
7975,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_day2_part1() {
let mut cpu = IntcodeEmulator::default();
let program = Program::from_file("../day02/input.txt").expect("Failed to read input");
cpu.load_program(&program);
cpu.mem_mut()[1] = 12;
cpu.mem_mut()[2] = 2;
assert!(cpu.run().is_ok());
assert!(cpu.is_halted());
assert_eq!(cpu.mem()[0], 4714701);
} | rust_cleaned_test_functions.jsonl/119108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
17,
10495,
16,
368,
341,
286,
1077,
5206,
17319,
284,
1333,
1851,
2269,
10511,
486,
2258,
543,
286,
1077,
2025,
284,
6687,
486,
1499,
2458,
17409,
1292,
15,
17,
39990,
3909,
1827,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bpf_loader_check_load_dw() {
let prog = &[
0x18, 0x00, 0x00, 0x00, 0x88, 0x77, 0x66, 0x55, // first half of lddw
];
verifier::check(prog, &Config::default()).unwrap();
} | rust_cleaned_test_functions.jsonl/3069 | {
"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,
880,
15897,
22139,
7200,
12411,
79503,
368,
341,
286,
1077,
29271,
284,
609,
9640,
310,
220,
15,
87,
16,
23,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
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_primitive_by_itself() {
let bvc = ByValueChecker::new();
let t_id = QualifiedName::new_from_cpp_name("u32");
assert!(bvc.is_pod(&t_id));
} | rust_cleaned_test_functions.jsonl/93407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3710,
14631,
721,
368,
341,
286,
1077,
293,
7362,
284,
3216,
1130,
35188,
486,
931,
543,
286,
1077,
259,
842,
284,
60306,
675,
486,
931,
5673,
59686,
1269,
445,
84,
18,
17,
797,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_query_state_hash() {
let sandbox = timestamping_sandbox();
let sandbox_state = SandboxState::new();
// We do not change the state hash in between blocks for TimestampingService for now
for _ in 0..2 {
let state_hash = sandbox.last_state_hash();
let configs_rh = sandbox.get_configs_merkle_root();
let proof = sandbox.get_proof_to_index("core.consensus_config");
let proof = proof.check_against_hash(state_hash).unwrap();
assert_ne!(configs_rh, Hash::zero());
assert_eq!(
proof
.entries()
.map(|(k, v)| (k.as_str(), v))
.collect::<Vec<_>>(),
vec![("core.consensus_config", &configs_rh)]
);
let proof = sandbox.get_proof_to_index("timestamping.first");
let proof = proof.check_against_hash(state_hash).unwrap();
assert_eq!(
proof
.entries()
.map(|(k, v)| (k.as_str(), v))
.collect::<Vec<_>>(),
vec![("timestamping.first", &Hash::new([127; HASH_SIZE]))]
);
let proof = sandbox.get_proof_to_index("timestamping.second");
let proof = proof.check_against_hash(state_hash).unwrap();
assert_eq!(
proof
.entries()
.map(|(k, v)| (k.as_str(), v))
.collect::<Vec<_>>(),
vec![("timestamping.second", &Hash::new([128; HASH_SIZE]))]
);
add_one_height(&sandbox, &sandbox_state)
}
} | rust_cleaned_test_functions.jsonl/83612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 788
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
4387,
8950,
368,
341,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
543,
262,
1077,
42754,
4387,
284,
96860,
1397,
486,
931,
543,
262,
442,
1205,
653,
537,
2297,
279,
1584,
5175,
304,
194... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.