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_slugify() {
// slug crate already has tests for general slugification so we just
// check our function works
let tests =
vec![(r#"Hello world"#, r#"hello-world"#), (r#"Hello 世界"#, r#"hello-shi-jie"#)];
for (input, expected) in tests {
let result = slugify(to_value(input).unwrap(), HashMap::new());
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(expected).unwrap());
}
} | rust_cleaned_test_functions.jsonl/49421 | {
"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,
31024,
1437,
368,
341,
286,
442,
24470,
17717,
2669,
702,
7032,
369,
4586,
24470,
2404,
773,
582,
1101,
198,
286,
442,
1779,
1039,
729,
4278,
198,
286,
1077,
7032,
4035,
310,
7486,
0,
9697,
81,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_check_slot_subscribe() {
let exit = Arc::new(AtomicBool::new(false));
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Bank::new_for_tests(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let optimistically_confirmed_bank =
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks);
let subscriptions = Arc::new(RpcSubscriptions::new_for_tests(
&exit,
bank_forks,
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests())),
optimistically_confirmed_bank,
));
let (rpc, mut receiver) = rpc_pubsub_service::test_connection(&subscriptions);
let sub_id = rpc.slot_subscribe().unwrap();
subscriptions
.control
.assert_subscribed(&SubscriptionParams::Slot);
subscriptions.notify_slot(0, 0, 0);
let response = receiver.recv();
let expected_res = SlotInfo {
parent: 0,
slot: 0,
root: 0,
};
let expected_res_str = serde_json::to_string(&expected_res).unwrap();
let expected = format!(
r#"{{"jsonrpc":"2.0","method":"slotNotification","params":{{"result":{},"subscription":0}}}}"#,
expected_res_str
);
assert_eq!(expected, response);
rpc.slot_unsubscribe(sub_id).unwrap();
subscriptions
.control
.assert_unsubscribed(&SubscriptionParams::Slot);
} | rust_cleaned_test_functions.jsonl/14340 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 735
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
27563,
88935,
368,
341,
286,
1077,
4869,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
1106,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_match_indexes() {
let mut pager = Pager::new().unwrap();
pager.set_text(
"\
Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo, quis tempor ligula
erat quis odio. Nunc porta vulputate tellus. Nunc rutrum turpis sed pede. Sed
bibendum. Aliquam posuere. Nunc aliquet, augue nec adipiscing interdum, lacus tellus
malesuada massa, quis varius mi purus non odio. Pellentesque condimentum, magna ut
suscipit hendrerit, ipsum augue ornare nulla, non luctus diam neque sit amet urna.
Curabitur vulputate vestibulum lorem. Fusce sagittis, libero non molestie mollis, magna
orci ultrices dolor, at vulputate neque nulla lacinia eros. Sed id ligula quis est
convallis tempor. Curabitur lacinia pulvinar nibh. Nam a sapien.",
);
pager.search_term = Some(Regex::new(r"\Wa\w+\W").unwrap());
let res = vec![3, 7, 11];
set_match_indices(&mut pager);
assert_eq!(pager.search_idx, res);
} | rust_cleaned_test_functions.jsonl/110569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
10708,
50161,
368,
341,
286,
1077,
5206,
52588,
284,
87308,
486,
931,
1005,
15454,
1428,
286,
52588,
980,
4326,
1006,
310,
93317,
37,
355,
346,
4481,
79657,
275,
11,
289,
13229,
19053,
57324... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long_format_u_default() {
assert_eq!(
parse_format_flags_str(&vec!["od", "--format=u"]).unwrap(),
vec![FORMAT_ITEM_DEC32U]
);
} | rust_cleaned_test_functions.jsonl/112177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
8955,
7300,
9993,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
8955,
14130,
2895,
2099,
4083,
0,
1183,
347,
497,
14482,
2243,
38633,
45014,
15454,
3148,
286,
7486,
20703,
46559,
16461,
23773... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_compare() {
let tests = &[
(Compare::Default, "hoge", "hoge", true),
(Compare::Default, "hoge", "hoge ", true),
(Compare::Default, "hoge", "hoge\n", true),
(Compare::Default, "hoge", " hoge", false),
(Compare::Default, "hoge", "\nhoge", false),
];
for (compare, a, b, expected) in tests {
let actual = compare.compare(a, b);
assert_eq!(actual, *expected);
}
} | rust_cleaned_test_functions.jsonl/29179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32235,
368,
341,
286,
1077,
7032,
284,
609,
9640,
310,
320,
27374,
486,
3675,
11,
330,
71,
40532,
497,
330,
71,
40532,
497,
830,
1326,
310,
320,
27374,
486,
3675,
11,
330,
71,
40532,
497,
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... | 2 |
#[test]
fn test_arch_x86_detail() {
use arch::x86::X86OperandType::*;
use arch::x86::X86Reg::*;
use arch::x86::*;
use capstone_sys::*;
test_arch_mode_endian_insns_detail(
&mut Capstone::new()
.x86()
.mode(x86::ArchMode::Mode16)
.build()
.unwrap(),
Arch::X86,
Mode::Mode16,
None,
&[],
&[
DII::new(
"lea",
b"\x8d\x4c\x32",
&[
X86Operand {
size: 2,
op_type: Reg(RegId(X86_REG_CX as RegIdInt)),
..Default::default()
},
X86Operand {
size: 2,
op_type: Mem(X86OpMem(x86_op_mem {
segment: 0,
base: X86_REG_SI,
index: 0,
scale: 1,
disp: 0x32,
})),
..Default::default()
},
],
),
DII::new(
"or",
b"\x08\x01",
&[
X86Operand {
size: 1,
op_type: Mem(X86OpMem(x86_op_mem {
segment: 0,
base: X86_REG_BX,
index: X86_REG_DI,
scale: 1,
disp: 0,
})),
..Default::default()
},
X86Operand {
size: 1,
op_type: Reg(RegId(X86_REG_AL as RegIdInt)),
..Default::default()
},
],
),
// fadd dword ptr [bx + di + 0x34c6]
DII::new(
"fadd",
b"\xd8\x81\xc6\x34",
&[X86Operand {
size: 4,
op_type: Mem(X86OpMem(x86_op_mem {
segment: 0,
base: X86_REG_BX,
index: X86_REG_DI,
scale: 1,
disp: 0x34c6,
})),
..Default::default()
}],
),
DII::new(
"adc",
b"\x12\x00",
&[
X86Operand {
size: 1,
op_type: Reg(RegId(X86_REG_AL as RegIdInt)),
..Default::default()
},
X86Operand {
size: 1,
op_type: Mem(X86OpMem(x86_op_mem {
segment: 0,
base: X86_REG_BX,
index: X86_REG_SI,
scale: 1,
disp: 0,
})),
..Default::default()
},
],
),
],
);
// X86 32bit
test_arch_mode_endian_insns_detail(
&mut Capstone::new()
.x86()
.mode(x86::ArchMode::Mode32)
.build()
.unwrap(),
Arch::X86,
Mode::Mode32,
None,
&[],
&[
DII::new(
"lea",
b"\x8d\x4c\x32\x08",
&[
X86Operand {
size: 4,
op_type: Reg(RegId(X86_REG_ECX as RegIdInt)),
..Default::default()
},
X86Operand {
size: 4,
op_type: Mem(X86OpMem(x86_op_mem {
segment: 0,
base: X86_REG_EDX,
index: X86_REG_ESI,
scale: 1,
disp: 8,
})),
..Default::default()
},
],
),
DII::new(
"add",
b"\x01\xd8",
&[
X86Operand {
size: 4,
op_type: Reg(RegId(X86_REG_EAX as RegIdInt)),
..Default::default()
},
X86Operand {
size: 4,
op_type: Reg(RegId(X86_REG_EBX as RegIdInt)),
..Default::default()
},
],
),
DII::new(
"add",
b"\x81\xc6\x34\x12\x00\x00",
&[
X86Operand {
size: 4,
op_type: Reg(RegId(X86_REG_ESI as RegIdInt)),
..Default::default()
},
X86Operand {
size: 4,
op_type: Imm(0x1234),
..Default::default()
},
],
),
],
);
// X86 64
test_arch_mode_endian_insns_detail(
&mut Capstone::new()
.x86()
.mode(x86::ArchMode::Mode64)
.build()
.unwrap(),
Arch::X86,
Mode::Mode64,
None,
&[],
&[
// push rbp
DII::new(
"push",
b"\x55",
&[X86Operand {
size: 8,
op_type: Reg(RegId(X86_REG_RBP as RegIdInt)),
..Default::default()
}],
),
DII::new(
"mov",
b"\x48\x8b\x05\xb8\x13\x00\x00",
&[
X86Operand {
size: 8,
op_type: Reg(RegId(X86_REG_RAX as RegIdInt)),
..Default::default()
},
X86Operand {
size: 8,
op_type: Mem(X86OpMem(x86_op_mem {
segment: 0,
base: X86_REG_RIP,
index: 0,
scale: 1,
disp: 0x13b8,
})),
..Default::default()
},
],
),
],
);
} | rust_cleaned_test_functions.jsonl/127442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34330,
3212,
23,
21,
14480,
368,
341,
262,
990,
5325,
486,
87,
23,
21,
486,
55,
23,
21,
29940,
929,
56162,
262,
990,
5325,
486,
87,
23,
21,
486,
55,
23,
21,
3477,
56162,
262,
990,
5325,
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_example() {
let input = "\
start-A
start-b
A-c
A-b
b-d
A-end
b-end
";
assert_eq!(solve(&input), 10);
} | rust_cleaned_test_functions.jsonl/38771 | {
"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,
39304,
368,
341,
256,
1077,
1946,
284,
93317,
2468,
6691,
198,
2468,
1455,
198,
32,
1786,
198,
32,
1455,
198,
65,
1737,
198,
32,
13068,
198,
65,
13068,
198,
876,
256,
2060,
10714,
10297,
59419,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_siphash_2_4_test_vector() {
let k0 = 0x_07_06_05_04_03_02_01_00;
let k1 = 0x_0f_0e_0d_0c_0b_0a_09_08;
let mut input: Vec<u8> = Vec::new();
for i in 0..64 {
let out = hash_with(SipHasher128::new_with_keys(k0, k1), &Bytes(&input[..]));
let expected = (
((TEST_VECTOR[i][0] as u64) << 0)
| ((TEST_VECTOR[i][1] as u64) << 8)
| ((TEST_VECTOR[i][2] as u64) << 16)
| ((TEST_VECTOR[i][3] as u64) << 24)
| ((TEST_VECTOR[i][4] as u64) << 32)
| ((TEST_VECTOR[i][5] as u64) << 40)
| ((TEST_VECTOR[i][6] as u64) << 48)
| ((TEST_VECTOR[i][7] as u64) << 56),
((TEST_VECTOR[i][8] as u64) << 0)
| ((TEST_VECTOR[i][9] as u64) << 8)
| ((TEST_VECTOR[i][10] as u64) << 16)
| ((TEST_VECTOR[i][11] as u64) << 24)
| ((TEST_VECTOR[i][12] as u64) << 32)
| ((TEST_VECTOR[i][13] as u64) << 40)
| ((TEST_VECTOR[i][14] as u64) << 48)
| ((TEST_VECTOR[i][15] as u64) << 56),
);
assert_eq!(out, expected);
input.push(i as u8);
}
} | rust_cleaned_test_functions.jsonl/35424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 892
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
573,
8296,
62,
17,
62,
19,
4452,
12247,
368,
341,
286,
1077,
595,
15,
284,
220,
15,
87,
62,
15,
22,
62,
15,
21,
62,
15,
20,
62,
15,
19,
62,
15,
18,
62,
15,
17,
62,
15,
16,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_to_env_vars() {
let env = Component::from_str(
r#"{
"parameters": [
{
"name": "one",
"type": "string",
"default": "test one"
},
{
"name": "two",
"type": "number",
"default": 2
},
{
"name": "four",
"type": "number",
"default": 4
}
],
"containers": [
{
"name": "container1",
"image": "nginx:latest",
"env": [
{
"name": "VAR_ONE",
"fromParam": "one"
},
{
"name": "VAR_TWO",
"fromParam": "two"
},
{
"name": "VAR_THREE",
"fromParam": "no_such_param",
"value": "3"
},
{
"name": "VAR_FOUR",
"fromParam": "four"
}
]
}
]
}"#,
)
.as_ref()
.expect("component should exist")
.containers[0]
.env
.clone();
let mut valmap = std::collections::BTreeMap::new();
valmap.insert("one".to_string(), serde_json::json!("hello one"));
valmap.insert("two".to_string(), serde_json::json!("2"));
valmap.insert("three".to_string(), serde_json::json!("3"));
let one = env[0].to_env_var(valmap.clone());
let two = env[1].to_env_var(valmap.clone());
let three = env[2].to_env_var(valmap.clone());
let four = env[3].to_env_var(valmap.clone());
assert_eq!("hello one", one.value.expect("found one val").as_str());
assert_eq!("2", two.value.expect("found two val").as_str());
assert_eq!("3", three.value.expect("found three val").as_str());
// This is None because the valmap was never coalesced with the root values.
assert_eq!(None, four.value);
} | rust_cleaned_test_functions.jsonl/98686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
15879,
11168,
368,
341,
262,
1077,
6105,
284,
5578,
486,
1499,
2895,
1006,
286,
435,
55543,
515,
310,
330,
13786,
788,
2278,
394,
341,
503,
330,
606,
788,
330,
603,
756,
503,
330,
1313,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partial_updates() {
let mut hash1 = RistrettoHash::<Sha512>::default();
let mut hash2 = hash1.clone();
hash1.add("the full data", 3);
hash2.update("the");
hash2.update(" full");
hash2.update(" data");
hash2.end_update(3);
let output1 = hash1.finalize();
let output2 = hash2.finalize();
assert_eq!(output1, output2)
} | rust_cleaned_test_functions.jsonl/30201 | {
"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,
52068,
57829,
368,
341,
286,
1077,
5206,
5175,
16,
284,
431,
380,
2122,
983,
6370,
27638,
62316,
20,
16,
17,
6831,
2258,
543,
286,
1077,
5206,
5175,
17,
284,
5175,
16,
15997,
1428,
286,
5175,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_root_ns_meth_ret_pod() {
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 };
assert_eq!(b.daft().a, 12);
};
run_test("", hdr, rs, &[], &["Bob", "B::C"]);
} | rust_cleaned_test_functions.jsonl/9841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12993,
34728,
717,
769,
21695,
85337,
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,
2622,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_crostab_simplified() {
let years = vec!["2004", "1984", "1964"].mapper(|x| x.to_string());
let year_label = "1984";
let year_index = years.iter().index_of(&year_label.to_string());
println!("years.index_of( {} ) = {}", year_label, to_isize(year_index));
let year_label = "2024";
let year_index = index_of(years.iter(), &year_label.to_string());
println!("years.index_of( {} ) = {}", year_label, to_isize(year_index));
let words = vec!["foo", "bar", "zen"].mapper(|x| x.to_string());
let word_label = "voo";
let word_index = words.iter().index_of(&word_label.to_string());
println!("years.index_of( {} ) = {}", word_label, to_isize(word_index));
} | rust_cleaned_test_functions.jsonl/4362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
41502,
370,
643,
73837,
368,
341,
286,
1077,
1635,
284,
7486,
0,
1183,
17,
15,
15,
19,
497,
330,
16,
24,
23,
19,
497,
330,
16,
24,
21,
19,
5521,
38076,
22428,
87,
91,
856,
2389,
3904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cross() {
let v1 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
let v2 = Vec3::new(4.0f64, 5.0f64, 6.0f64);
let v3 = Vec3::new(-3.0f64, 6.0f64, -3.0f64);
assert_eq!(v1.cross(v2), v3);
let v1 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
let v2 = Vec3::new(4.0f64, 5.0f64, 6.0f64);
let v3 = Vec3::new(3.0f64, -6.0f64, 3.0f64);
assert_eq!(v2.cross(v1), v3);
let v1 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
let v2 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
assert_eq!(v1.cross(v2), Vec3::zero());
} | rust_cleaned_test_functions.jsonl/120480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35284,
368,
972,
286,
1077,
348,
16,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
69,
21,
19,
11,
220,
17,
13,
15,
69,
21,
19,
11,
220,
18,
13,
15,
69,
21,
19,
736,
286,
1077,
348,
17,
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_duration_fmt() {
assert_eq!(Duration::zero().to_string(), "PT0S");
assert_eq!(Duration::days(42).to_string(), "P42D");
assert_eq!(Duration::days(-42).to_string(), "-P42D");
assert_eq!(Duration::seconds(42).to_string(), "PT42S");
assert_eq!(Duration::milliseconds(42).to_string(), "PT0.042S");
assert_eq!(Duration::microseconds(42).to_string(), "PT0.000042S");
assert_eq!(Duration::nanoseconds(42).to_string(), "PT0.000000042S");
assert_eq!((Duration::days(7) + Duration::milliseconds(6543)).to_string(),
"P7DT6.543S");
assert_eq!(Duration::seconds(-86401).to_string(), "-P1DT1S");
assert_eq!(Duration::nanoseconds(-1).to_string(), "-PT0.000000001S");
// the format specifier should have no effect on `Duration`
assert_eq!(format!("{:30}", Duration::days(1) + Duration::milliseconds(2345)),
"P1DT2.345S");
} | rust_cleaned_test_functions.jsonl/982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
38128,
368,
341,
286,
2060,
10714,
10297,
12945,
486,
14154,
1005,
983,
3904,
1507,
330,
2828,
15,
50,
797,
286,
2060,
10714,
10297,
12945,
486,
13778,
7,
19,
17,
568,
983,
3904,
1507,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_xor_keystream_block_ignore_counter_when_hchacha() {
let mut chacha_state_hchacha =
ChaCha20::new(&[0u8; CHACHA_KEYSIZE], &[0u8; HCHACHA_NONCESIZE], false).unwrap();
let mut hchacha_keystream_block_zero = [0u8; HCHACHA_OUTSIZE];
let mut hchacha_keystream_block_max = [0u8; HCHACHA_OUTSIZE];
chacha_state_hchacha.keystream_block(0, &mut hchacha_keystream_block_zero);
chacha_state_hchacha
.keystream_block(u32::max_value(), &mut hchacha_keystream_block_max);
assert_eq!(hchacha_keystream_block_zero, hchacha_keystream_block_max);
} | rust_cleaned_test_functions.jsonl/44715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76462,
45476,
597,
1237,
7113,
58493,
15730,
47636,
1523,
331,
51576,
368,
341,
310,
1077,
5206,
521,
51576,
4387,
1523,
331,
51576,
4035,
394,
27721,
95971,
17,
15,
486,
931,
2099,
58,
15,
84,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_shell_config() {
let yaml = "shell: bash";
let expected = TestShellConfig {
shell: Shell::Shell("bash".into())
};
let actual: TestShellConfig = serde_yaml::from_str(yaml).unwrap();
assert!(actual == expected);
} | rust_cleaned_test_functions.jsonl/39015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
48945,
5332,
368,
341,
286,
1077,
32246,
284,
330,
21384,
25,
27023,
876,
286,
1077,
3601,
284,
3393,
25287,
2648,
341,
310,
12528,
25,
29402,
486,
25287,
445,
46216,
3263,
18122,
2398,
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_function_literal_with_name() {
let mut program = parse_statements("let myFunction = fn() {};");
let name = match program.pop() {
Some(Statement::Let { expression, .. }) => match *expression {
Expression::FunctionLiteral { name, .. } => name,
_ => panic!("not a function literal"),
},
_ => panic!("Expected let statement"),
};
assert_eq!(name, Some("myFunction".to_owned()));
} | rust_cleaned_test_functions.jsonl/64083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
34100,
6615,
1269,
368,
341,
286,
1077,
5206,
2025,
284,
4715,
16271,
3723,
445,
1149,
847,
5152,
284,
5168,
368,
4687,
34649,
286,
1077,
829,
284,
2432,
2025,
8288,
368,
341,
310,
4329,
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... | 3 |
#[test]
fn test_args() {
assert_eq!(
args(b"(1,hello,vec3(5))").unwrap().1,
&["1", "hello", "vec3(5)"]
);
assert_eq!(
args(b"(1, hello, vec3(5))").unwrap().1,
&["1", "hello", "vec3(5)"]
);
} | rust_cleaned_test_functions.jsonl/68322 | {
"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,
8384,
368,
341,
286,
2060,
10714,
33673,
310,
2827,
1883,
29209,
16,
11,
14990,
11,
4083,
18,
7,
20,
593,
1827,
15454,
1005,
16,
345,
310,
609,
1183,
16,
497,
330,
14990,
497,
330,
4083,
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_value_nsrange() {
let val = NSValue::new(NSRange::from(1..2));
assert!(NSRange::ENCODING.equivalent_to_str(val.encoding().unwrap()));
let range: NSRange = unsafe { objc2::msg_send![val, rangeValue] };
assert_eq!(range, NSRange::from(1..2));
// NSValue -getValue is broken on GNUStep for some types
#[cfg(not(gnustep))]
assert_eq!(val.get(), NSRange::from(1..2));
} | rust_cleaned_test_functions.jsonl/40287 | {
"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,
3142,
34728,
9669,
368,
341,
286,
1077,
1044,
284,
3043,
1130,
486,
931,
46729,
6046,
486,
1499,
7,
16,
496,
17,
1106,
286,
2060,
10297,
2448,
6046,
486,
16226,
2069,
1718,
97651,
11769,
2346,
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_rand_range() {
let mut rng = task_rng();
for _ in range(0, 10) {
assert_eq!(rng.gen_bigint_range(&FromPrimitive::from_uint(236).unwrap(),
&FromPrimitive::from_uint(237).unwrap()),
FromPrimitive::from_uint(236).unwrap());
}
fn check(l: BigInt, u: BigInt) {
let mut rng = task_rng();
for _ in range(0, 1000) {
let n: BigInt = rng.gen_bigint_range(&l, &u);
assert!(n >= l);
assert!(n < u);
}
}
let l: BigInt = FromPrimitive::from_uint(403469000 + 2352).unwrap();
let u: BigInt = FromPrimitive::from_uint(403469000 + 3513).unwrap();
check( l.clone(), u.clone());
check(-l.clone(), u.clone());
check(-u.clone(), -l.clone());
} | rust_cleaned_test_functions.jsonl/96939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33864,
9698,
368,
341,
286,
1077,
5206,
28422,
284,
3383,
66849,
1428,
286,
369,
716,
304,
2088,
7,
15,
11,
220,
16,
15,
8,
341,
310,
2060,
10714,
10297,
69890,
22822,
36386,
396,
9698,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_canonical_json_lifecycle_event_formatting() {
let json_schema = Data::for_lifecycle_event(
"a/b/c/d",
LifecycleType::DiagnosticsReady,
None,
TEST_URL,
123456u64,
Vec::new(),
);
let result_json =
serde_json::to_value(&json_schema).expect("serialization should succeed.");
let expected_json = json!({
"moniker": "a/b/c/d",
"version": 1,
"data_source": "LifecycleEvent",
"payload": null,
"metadata": {
"component_url": TEST_URL,
"errors": null,
"lifecycle_event_type": "DiagnosticsReady",
"timestamp": 123456,
}
});
pretty_assertions::assert_eq!(result_json, expected_json, "golden diff failed.");
} | rust_cleaned_test_functions.jsonl/71449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
22391,
9455,
907,
19517,
6748,
8955,
1280,
368,
341,
286,
1077,
2951,
25371,
284,
2885,
486,
1958,
907,
19517,
6748,
1006,
310,
330,
64,
3470,
2899,
3446,
756,
310,
74392,
929,
486,
35,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mate_with_partial_state_repeat_move_kinds_no_mate_with_kyou_occupied_self_sente() {
let blank_banmen = Banmen([[Blank; 9]; 9]);
let mut banmen = blank_banmen.clone();
banmen.0[3][4] = GOu;
banmen.0[6][4] = SKin;
let mut state = State::new(banmen);
let mut mc = MochigomaCollections::Empty;
let mv = Move::To(KomaSrcPosition(9-4,3+1),KomaDstToPosition(9-4,4+1,false));
match Rule::apply_move_none_check(&state,Teban::Sente,&mc,mv.to_applied_move()) {
(next,nmc,_) => {
state = next;
mc = nmc;
}
}
let mv = Move::Put(MochigomaKind::Kyou,KomaDstPutPosition(9-4,8+1));
let ps = Rule::apply_move_to_partial_state_none_check(&state,Teban::Sente,&mc,mv.to_applied_move());
assert!(!Rule::is_mate_with_partial_state_repeat_move_kinds(Teban::Sente,&ps),
"assertion failed, move = {:?}, {:?}",mv,state.get_banmen());
} | rust_cleaned_test_functions.jsonl/72975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 434
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
717,
349,
6615,
52068,
4387,
41975,
17134,
4698,
8673,
6536,
717,
349,
6615,
4698,
9330,
62,
40356,
25637,
643,
6817,
368,
972,
10217,
10113,
880,
276,
5676,
284,
22730,
5676,
27119,
22770,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_create_list_table_instance_columns_no_header() {
test_list_table_instance(
&["SOPInstanceUID", "Index in series", "File size"],
&["SOPInstanceUID"],
true,
include_str!("../tests/data/unit/list_instances_columns_no_header").trim_end(),
);
} | rust_cleaned_test_functions.jsonl/76484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
2019,
5237,
11904,
22590,
6536,
8757,
368,
341,
286,
1273,
2019,
5237,
11904,
1006,
310,
609,
1183,
50,
3067,
2523,
6463,
497,
330,
1552,
304,
4013,
497,
330,
1703,
1379,
8097,
310,
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... | 1 |
#[test]
fn test_render() {
let mut confirms = [
confirm(None, "message"),
confirm(Some(true), "message"),
confirm(Some(false), "message"),
];
let size = (50, 20).into();
let base_layout = Layout::new(5, size);
let mut backend = TestBackend::new_with_layout(size, base_layout);
for confirm in confirms.iter_mut() {
let offsets = [21, 22, 22];
let keys = [
KeyEvent::from(KeyCode::Char('y')),
KeyCode::Char('n').into(),
KeyCode::Backspace.into(),
];
let base_name = match confirm.confirm.default {
Some(true) => "default_y",
Some(false) => "default_n",
None => "no_default",
};
for (i, (&line_offset, &key)) in offsets.iter().zip(keys.iter()).enumerate() {
let mut layout = base_layout;
assert!(confirm.render(&mut layout, &mut backend).is_ok());
ui::assert_backend_snapshot!(format!("{}-{}", base_name, i), backend);
assert_eq!(layout, base_layout.with_line_offset(line_offset));
backend.reset_with_layout(base_layout);
confirm.handle_key(key);
}
let mut layout = base_layout;
assert!(confirm.render(&mut layout, &mut backend).is_ok());
ui::assert_backend_snapshot!(format!("{}-{}", base_name, keys.len()), backend);
assert_eq!(layout, base_layout.with_line_offset(21));
backend.reset_with_layout(base_layout);
}
} | rust_cleaned_test_functions.jsonl/10504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 838
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22781,
368,
341,
286,
1077,
5206,
42396,
284,
2278,
310,
7683,
26717,
11,
330,
1994,
4461,
310,
7683,
65405,
3715,
701,
330,
1994,
4461,
310,
7683,
65405,
3576,
701,
330,
1994,
4461,
286,
15424,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vec3_to_from_slice() {
let v = Vec3::new(1.0, 2.0, 3.0);
let mut a = [0.0, 0.0, 0.0];
v.write_to_slice_unaligned(&mut a);
assert_eq!(v, Vec3::from_slice_unaligned(&a));
} | rust_cleaned_test_functions.jsonl/75060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
2346,
5673,
26488,
368,
341,
262,
1077,
348,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
317,
262,
1077,
5206,
264,
284,
508,
15,
13,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_straw_addresses() {
let mut core = tokio_core::reactor::Core::new().unwrap();
let handle = core.handle();
let cfg = Config::new().done();
let router = Router::from_config(&cfg, &handle);
// Read first config from a stream
core.turn(Some(Duration::new(0, 0)));
// Then can query cached hosts immediately
assert_eq!(
core.run(router.resolve_auto("127.0.0.1:1234", 80)).unwrap(),
["127.0.0.1:1234".parse::<SocketAddr>().unwrap()][..].into());
assert_eq!(
core.run(router.resolve_auto("127.0.0.1", 80)).unwrap(),
["127.0.0.1:80".parse::<SocketAddr>().unwrap()][..].into());
assert_eq!(
core.run(router.resolve_auto("[2001:db8::2:1]:8123", 80)).unwrap(),
["[2001:db8::2:1]:8123".parse::<SocketAddr>().unwrap()][..].into());
assert_eq!(
core.run(router.resolve_auto("2001:db8::2:1", 80)).unwrap(),
["[2001:db8::2:1]:80".parse::<SocketAddr>().unwrap()][..].into());
} | rust_cleaned_test_functions.jsonl/30207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
672,
59471,
368,
341,
262,
1077,
5206,
6200,
284,
9628,
815,
15467,
486,
2934,
269,
486,
5386,
486,
931,
1005,
15454,
543,
262,
1077,
3705,
284,
6200,
10132,
1428,
262,
1077,
13286,
284,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shared_buffer_start_too_late() {
paychains_logger::setup();
let (sender, receiver) = unbounded();
let file = SimpleReader::new(receiver);
let shared_buffer = SharedBuffer::new(file);
let mut reader = SharedBufferReader::new(&shared_buffer);
let mut data = Vec::new();
let done_signal = vec![];
let sent = vec![1, 2, 3];
let _ = sender.send((sent, None));
let _ = sender.send((done_signal, None));
assert!(reader.read_to_end(&mut data).is_ok());
SharedBufferReader::new(&shared_buffer); // created after reader already read
} | rust_cleaned_test_functions.jsonl/84065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20405,
7776,
4906,
2346,
78,
907,
349,
368,
341,
286,
2291,
58358,
27413,
486,
15188,
543,
286,
1077,
320,
11644,
11,
13964,
8,
284,
650,
65686,
543,
286,
1077,
1034,
284,
8993,
5062,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_app_name_in_path() {
let executable = extract_path_from_executable(Path::new(
"/Applications/updater-example.app/Contents/MacOS/updater-example",
));
let app_name = macos_app_name_in_path(&executable);
assert!(executable.ends_with("updater-example.app"));
assert_eq!(app_name, "updater-example.app".to_string());
} | rust_cleaned_test_functions.jsonl/15961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8191,
1269,
1243,
2638,
368,
341,
262,
1077,
32156,
284,
8649,
2638,
5673,
18430,
5922,
33030,
486,
931,
1006,
414,
3521,
50359,
71843,
27463,
43430,
1601,
14,
14803,
10270,
580,
3126,
71843,
27463,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_manager_disallow_plaintext_metadata() {
let _guard = LOCK_FOR_GAUGE.lock().unwrap();
let tmp_dir = tempfile::TempDir::new().unwrap();
let manager = new_key_manager(
&tmp_dir,
Some(EncryptionMethod::Aes256Ctr),
Box::new(PlaintextBackend::default()),
new_mock_backend() as Box<dyn Backend>,
);
manager.err().unwrap();
} | rust_cleaned_test_functions.jsonl/22011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
12144,
9932,
7183,
6317,
1641,
427,
22220,
368,
341,
286,
1077,
716,
26098,
284,
49463,
14516,
2646,
32,
47644,
21003,
1005,
15454,
543,
286,
1077,
4174,
4334,
284,
54819,
486,
12151,
6184,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pubkey_from_bad_slice() {
// Bad sizes
assert_eq!(
PublicKey::from_slice(&[0; constants::PUBLIC_KEY_SIZE - 1]),
Err(InvalidPublicKey)
);
assert_eq!(
PublicKey::from_slice(&[0; constants::PUBLIC_KEY_SIZE + 1]),
Err(InvalidPublicKey)
);
assert_eq!(
PublicKey::from_slice(&[0; constants::UNCOMPRESSED_PUBLIC_KEY_SIZE - 1]),
Err(InvalidPublicKey)
);
assert_eq!(
PublicKey::from_slice(&[0; constants::UNCOMPRESSED_PUBLIC_KEY_SIZE + 1]),
Err(InvalidPublicKey)
);
// Bad parse
assert_eq!(
PublicKey::from_slice(&[0xff; constants::UNCOMPRESSED_PUBLIC_KEY_SIZE]),
Err(InvalidPublicKey)
);
assert_eq!(
PublicKey::from_slice(&[0x55; constants::PUBLIC_KEY_SIZE]),
Err(InvalidPublicKey)
);
assert_eq!(PublicKey::from_slice(&[]), Err(InvalidPublicKey));
} | rust_cleaned_test_functions.jsonl/32187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
792,
5673,
34199,
26488,
368,
341,
286,
442,
11461,
12282,
198,
286,
2060,
10714,
33673,
310,
70280,
486,
1499,
26488,
2099,
58,
15,
26,
18021,
486,
59259,
6600,
4098,
481,
220,
16,
17036,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vhost_user_net_tap_multiple_queues() {
test_vhost_user_net(
Some("vunet-tap1"),
4,
&prepare_vhost_user_net_daemon,
false,
false,
)
} | rust_cleaned_test_functions.jsonl/26122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
3790,
3317,
19722,
528,
391,
45233,
82413,
368,
341,
286,
1273,
2273,
3790,
3317,
19722,
1006,
310,
4329,
445,
85,
359,
295,
2385,
391,
16,
4461,
310,
220,
19,
345,
310,
609,
13609,
2273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_date_succ() {
let ymd = NaiveDate::from_ymd;
assert_eq!(ymd(2014, 5, 6).succ_opt(), Some(ymd(2014, 5, 7)));
assert_eq!(ymd(2014, 5, 31).succ_opt(), Some(ymd(2014, 6, 1)));
assert_eq!(ymd(2014, 12, 31).succ_opt(), Some(ymd(2015, 1, 1)));
assert_eq!(ymd(2016, 2, 28).succ_opt(), Some(ymd(2016, 2, 29)));
assert_eq!(ymd(MAX_DATE.year(), 12, 31).succ_opt(), None);
} | rust_cleaned_test_functions.jsonl/29551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
70758,
368,
341,
286,
1077,
379,
2277,
284,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
280,
286,
2060,
10714,
10297,
1600,
67,
7,
17,
15,
16,
19,
11,
220,
20,
11,
220,
21,
568,
64441,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bcs() {
let mut r = Register::new();
r.set_status_carry(true);
bcs(0x10, &mut r);
assert_eq!(r.get_PC(), 0x10);
r.set_status_carry(false);
bcs(0x20, &mut r);
assert_ne!(r.get_PC(), 0x20);
} | rust_cleaned_test_functions.jsonl/14234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
4837,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
435,
980,
4773,
666,
11433,
3715,
317,
262,
293,
4837,
7,
15,
87,
16,
15,
11,
609,
6984,
435,
317,
262,
2060,
10714,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrap_return_type_not_applicable_when_expr_type_does_not_match_ok_type() {
let content = r#"
//- /main.rs
use std::{string::String, result::Result::{self, Ok, Err}};
fn foo() -> Result<String, i32> {
0<|>
}
//- /std/lib.rs
pub mod string {
pub struct String { }
}
pub mod result {
pub enum Result<T, E> { Ok(T), Err(E) }
}
"#;
check_no_diagnostic_for_target_file(content);
} | rust_cleaned_test_functions.jsonl/71650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38550,
12511,
1819,
7913,
8191,
46114,
47636,
21915,
1819,
96374,
7913,
10708,
19817,
1819,
368,
341,
286,
1077,
2213,
284,
435,
2,
698,
310,
78406,
608,
3817,
25638,
198,
310,
990,
1460,
22964,
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... | 1 |
#[test]
fn test_by_result() -> Result<(), &'static str>
{
if 2 + 2 == 4 { Ok(()) } else {
Err("Something wrong")
}
} | rust_cleaned_test_functions.jsonl/50957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 64
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3710,
5287,
368,
1464,
5714,
68843,
30136,
1978,
607,
397,
197,
515,
197,
743,
220,
17,
488,
220,
17,
621,
220,
19,
314,
7622,
7,
2140,
335,
770,
314,
715,
298,
197,
7747,
445,
23087,
4969,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cast_i32_to_list_f64_nullable_sliced() {
let a = Int32Array::from(vec![Some(5), None, Some(7), Some(8), None, Some(10)]);
let array = Arc::new(a) as ArrayRef;
let array = array.slice(2, 4);
let b = cast(&array, &DataType::List(Box::new(DataType::Float64))).unwrap();
assert_eq!(4, b.len());
assert_eq!(1, b.null_count());
let arr = b.as_any().downcast_ref::<ListArray>().unwrap();
assert_eq!(0, arr.value_offset(0));
assert_eq!(1, arr.value_offset(1));
assert_eq!(2, arr.value_offset(2));
assert_eq!(3, arr.value_offset(3));
assert_eq!(1, arr.value_length(0));
assert_eq!(1, arr.value_length(1));
assert_eq!(1, arr.value_length(2));
assert_eq!(1, arr.value_length(3));
let values = arr.values();
let c = values.as_any().downcast_ref::<Float64Array>().unwrap();
assert_eq!(1, c.null_count());
assert!(7.0 - c.value(0) < f64::EPSILON);
assert!(8.0 - c.value(1) < f64::EPSILON);
assert_eq!(false, c.is_valid(2));
assert!(10.0 - c.value(3) < f64::EPSILON);
} | rust_cleaned_test_functions.jsonl/29605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
5318,
18,
17,
2346,
2019,
761,
21,
19,
69743,
643,
74630,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
20,
701,
2240,
11,
4329,
7,
22,
701,
4329... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_8601_6() {
let interval = Interval::from_iso("P1Y1M1DT1H10M15S").unwrap();
let interval_exp = Interval::new(13, 1, 4215000000);
assert_eq!(interval, interval_exp);
} | rust_cleaned_test_functions.jsonl/90525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
62,
23,
21,
15,
16,
62,
21,
368,
341,
286,
1077,
9873,
284,
40584,
486,
1499,
49660,
445,
47,
16,
56,
16,
44,
16,
10599,
16,
39,
16,
15,
44,
16,
20,
50,
1827,
15454,
543,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_arg_matches_never() {
let argv = vec!["lsd", "--icon", "never"];
let matches = app::build().get_matches_from_safe(argv).unwrap();
assert_eq!(
Some(IconOption::Never),
IconOption::from_arg_matches(&matches)
);
} | rust_cleaned_test_functions.jsonl/17356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
6057,
38344,
13925,
423,
368,
341,
286,
1077,
10213,
284,
7486,
0,
1183,
4730,
67,
497,
14482,
1924,
497,
330,
36493,
6332,
286,
1077,
9071,
284,
906,
486,
5834,
1005,
455,
38344,
5673,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_iface_query_fails() {
let mut exec = fasync::TestExecutor::new().expect("Failed to create an executor");
// Boilerplate for adding a new interface.
let iface_map = Arc::new(IfaceMap::new());
let iface_counter = Arc::new(IfaceCounter::new());
let (inspect_tree, _persistence_stream) = test_helper::fake_inspect_tree();
let (sender, _receiver) = mpsc::channel(1);
let cobalt_sender = CobaltSender::new(sender);
let (cobalt_1dot1_proxy, _) =
create_proxy::<fidl_fuchsia_metrics::MetricEventLoggerMarker>()
.expect("failed to create Cobalt 1.1 proxy");
let (dev_monitor_proxy, _) =
create_proxy::<fidl_fuchsia_wlan_device_service::DeviceMonitorMarker>()
.expect("failed to create DeviceMonitor proxy");
let cfg = ServiceCfg { wep_supported: false, wpa1_supported: false };
// Construct the request.
let (mlme_channel, mlme_receiver) =
create_endpoints().expect("failed to create fake MLME proxy");
// Drop the receiver so that the initial device info query fails.
drop(mlme_receiver);
let req =
fidl_svc::AddIfaceRequest { phy_id: 123, assigned_iface_id: 456, iface: mlme_channel };
let fut = add_iface(
req,
&cfg,
&iface_map,
&iface_counter,
&inspect_tree,
&cobalt_sender,
cobalt_1dot1_proxy,
dev_monitor_proxy,
);
pin_mut!(fut);
// The future should have returned bad status here.
assert_variant!(exec.run_until_stalled(&mut fut), Poll::Ready(result) => {
assert!(result.result.is_err());
assert_eq!(result.status, zx::sys::ZX_ERR_PEER_CLOSED);
assert!(result.iface_id.is_none());
});
} | rust_cleaned_test_functions.jsonl/46969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 907
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
67666,
5738,
761,
6209,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
9408,
311,
1855,
458,
31558,
3071,
286,
442,
45665,
1750,
369,
7842,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_arithmetic() {
// transfer amount
let transfer_amount: u64 = 55;
let (amount_lo, amount_hi) = split_u64_into_u32(transfer_amount);
// generate public keys
let source_pk = ElGamalKeypair::default().public;
let dest_pk = ElGamalKeypair::default().public;
let auditor_pk = ElGamalKeypair::default().public;
// commitments associated with TransferRangeProof
let (comm_lo, open_lo) = Pedersen::new(amount_lo);
let (comm_hi, open_hi) = Pedersen::new(amount_hi);
let comm_lo: pod::PedersenCommitment = comm_lo.into();
let comm_hi: pod::PedersenCommitment = comm_hi.into();
// decryption handles associated with TransferValidityProof
let handle_source_lo: pod::PedersenDecryptHandle =
source_pk.decrypt_handle(&open_lo).into();
let handle_dest_lo: pod::PedersenDecryptHandle = dest_pk.decrypt_handle(&open_lo).into();
let _handle_auditor_lo: pod::PedersenDecryptHandle =
auditor_pk.decrypt_handle(&open_lo).into();
let handle_source_hi: pod::PedersenDecryptHandle =
source_pk.decrypt_handle(&open_hi).into();
let handle_dest_hi: pod::PedersenDecryptHandle = dest_pk.decrypt_handle(&open_hi).into();
let _handle_auditor_hi: pod::PedersenDecryptHandle =
auditor_pk.decrypt_handle(&open_hi).into();
// source spendable and recipient pending
let source_open = PedersenOpening::random(&mut OsRng);
let dest_open = PedersenOpening::random(&mut OsRng);
let source_spendable_ct: pod::ElGamalCiphertext =
source_pk.encrypt_with(77_u64, &source_open).into();
let dest_pending_ct: pod::ElGamalCiphertext =
dest_pk.encrypt_with(77_u64, &dest_open).into();
// program arithmetic for the source account
// 1. Combine commitments and handles
let source_lo_ct: pod::ElGamalCiphertext = (comm_lo, handle_source_lo).into();
let source_hi_ct: pod::ElGamalCiphertext = (comm_hi, handle_source_hi).into();
// 2. Combine lo and hi ciphertexts
let source_combined_ct = ops::combine_lo_hi(&source_lo_ct, &source_hi_ct).unwrap();
// 3. Subtract from available balance
let final_source_spendable =
ops::subtract(&source_spendable_ct, &source_combined_ct).unwrap();
// test
let final_source_open =
source_open - (open_lo.clone() + open_hi.clone() * Scalar::from(ops::TWO_32));
let expected_source: pod::ElGamalCiphertext =
source_pk.encrypt_with(22_u64, &final_source_open).into();
assert_eq!(expected_source, final_source_spendable);
// same for the destination account
// 1. Combine commitments and handles
let dest_lo_ct: pod::ElGamalCiphertext = (comm_lo, handle_dest_lo).into();
let dest_hi_ct: pod::ElGamalCiphertext = (comm_hi, handle_dest_hi).into();
// 2. Combine lo and hi ciphertexts
let dest_combined_ct = ops::combine_lo_hi(&dest_lo_ct, &dest_hi_ct).unwrap();
// 3. Add to pending balance
let final_dest_pending = ops::add(&dest_pending_ct, &dest_combined_ct).unwrap();
let final_dest_open = dest_open + (open_lo + open_hi * Scalar::from(ops::TWO_32));
let expected_dest_ct: pod::ElGamalCiphertext =
dest_pk.encrypt_with(132_u64, &final_dest_open).into();
assert_eq!(expected_dest_ct, final_dest_pending);
} | rust_cleaned_test_functions.jsonl/3212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1508
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
25842,
25922,
368,
341,
286,
442,
8317,
3311,
198,
286,
1077,
8317,
13471,
25,
575,
21,
19,
284,
220,
20,
20,
280,
286,
1077,
320,
6045,
5560,
11,
3311,
47225,
8,
284,
6718,
7300,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simplify_simple_and() {
let expr = (col("c2").gt(lit(5))).and(col("c2").gt(lit(5)));
let expected = col("c2").gt(lit(5));
assert_eq!(simplify(&expr), expected);
} | rust_cleaned_test_functions.jsonl/19682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
70206,
30015,
8378,
368,
341,
1789,
286,
1077,
15169,
284,
320,
2074,
445,
66,
17,
1827,
5178,
2333,
275,
7,
20,
36334,
437,
19611,
445,
66,
17,
1827,
5178,
2333,
275,
7,
20,
4945,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytes_cat() {
assert_eq!(bytes_cat!(b"a", b"B"), b"aB");
let v = vec![1, 2, 3u8];
assert_eq!(bytes_cat!(&v, &[4u8, 5, 6]), &[1, 2, 3, 4, 5, 6]);
} | rust_cleaned_test_functions.jsonl/112773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
20825,
368,
341,
286,
2060,
10714,
10297,
9651,
20825,
10297,
65,
56693,
497,
293,
63590,
3975,
293,
56693,
33,
797,
286,
1077,
348,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
84,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitv_set_show() {
let mut s = BitvSet::new();
s.insert(1);
s.insert(10);
s.insert(50);
s.insert(2);
assert_eq!("{1, 2, 10, 50}".to_string(), s.to_str());
} | rust_cleaned_test_functions.jsonl/12164 | {
"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,
13996,
85,
2602,
15267,
368,
341,
286,
1077,
5206,
274,
284,
6495,
85,
1649,
486,
931,
543,
286,
274,
7030,
7,
16,
317,
286,
274,
7030,
7,
16,
15,
317,
286,
274,
7030,
7,
20,
15,
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_make_tail() {
let mut ll = LinkedList::<u8>::with_capacity(4);
let hnd1 = ll.push_tail(1);
let hnd2 = ll.push_tail(2);
let hnd3 = ll.push_tail(3);
assert!(ll.make_tail(&hnd3));
assert_order!(ll, hnd1, 1, hnd2, 2);
assert_order!(ll, hnd2, 2, hnd3, 3);
assert_node!(ll, hnd1, FIRST, 1, 3);
assert_node!(ll, hnd2, MIDDLE, 2, 3);
assert_node!(ll, hnd3, LAST, 3, 3);
assert!(ll.make_tail(&hnd2));
assert_order!(ll, hnd1, 1, hnd3, 3);
assert_order!(ll, hnd3, 3, hnd2, 2);
assert_node!(ll, hnd1, FIRST, 1, 3);
assert_node!(ll, hnd3, MIDDLE, 3, 3);
assert_node!(ll, hnd2, LAST, 2, 3);
assert!(ll.make_tail(&hnd1));
assert_order!(ll, hnd3, 3, hnd2, 2);
assert_order!(ll, hnd2, 2, hnd1, 1);
assert_node!(ll, hnd3, FIRST, 3, 3);
assert_node!(ll, hnd2, MIDDLE, 2, 3);
assert_node!(ll, hnd1, LAST, 1, 3);
} | rust_cleaned_test_functions.jsonl/59899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 570
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
35471,
368,
341,
286,
1077,
5206,
9323,
284,
22917,
27638,
84,
23,
6831,
4197,
35603,
7,
19,
317,
286,
1077,
305,
303,
16,
284,
9323,
2552,
35471,
7,
16,
317,
286,
1077,
305,
303,
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_bank_update_sysvar_account() {
use solana_sdk::bank_hash::BankHash;
use sysvar::clock::Clock;
let dummy_clock_id = Pubkey::new_rand();
let (genesis_config, _mint_keypair) = create_genesis_config(500);
let expected_previous_slot = 3;
let expected_next_slot = expected_previous_slot + 1;
let bank1 = Arc::new(Bank::new(&genesis_config));
bank1.update_sysvar_account(&dummy_clock_id, |optional_account| {
assert!(optional_account.is_none());
Clock {
slot: expected_previous_slot,
..Clock::default()
}
.create_account(1)
});
let current_account = bank1.get_account(&dummy_clock_id).unwrap();
let removed_bank_hash = BankHash::from_hash(¤t_account.hash);
assert_eq!(
expected_previous_slot,
Clock::from_account(¤t_account).unwrap().slot
);
// Updating should increment the clock's slot
let bank2 = Arc::new(Bank::new_from_parent(&bank1, &Pubkey::default(), 1));
let mut expected_bank_hash = bank2.rc.accounts.bank_hash_at(bank2.slot);
bank2.update_sysvar_account(&dummy_clock_id, |optional_account| {
let slot = Clock::from_account(optional_account.as_ref().unwrap())
.unwrap()
.slot
+ 1;
Clock {
slot,
..Clock::default()
}
.create_account(1)
});
let current_account = bank2.get_account(&dummy_clock_id).unwrap();
let added_bank_hash = BankHash::from_hash(¤t_account.hash);
expected_bank_hash.xor(removed_bank_hash);
expected_bank_hash.xor(added_bank_hash);
assert_eq!(
expected_next_slot,
Clock::from_account(¤t_account).unwrap().slot
);
assert_eq!(
expected_bank_hash,
bank2.rc.accounts.bank_hash_at(bank2.slot)
);
// Updating again should give bank1's sysvar to the closure not bank2's.
bank2.update_sysvar_account(&dummy_clock_id, |optional_account| {
let slot = Clock::from_account(optional_account.as_ref().unwrap())
.unwrap()
.slot
+ 1;
Clock {
slot,
..Clock::default()
}
.create_account(1)
});
let current_account = bank2.get_account(&dummy_clock_id).unwrap();
assert_eq!(
expected_next_slot,
Clock::from_account(¤t_account).unwrap().slot
);
assert_eq!(
expected_bank_hash,
bank2.rc.accounts.bank_hash_at(bank2.slot)
);
} | rust_cleaned_test_functions.jsonl/42409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
8882,
20344,
947,
13500,
368,
341,
286,
990,
2048,
3362,
61783,
486,
17033,
8950,
486,
25828,
6370,
280,
286,
990,
5708,
947,
486,
20666,
486,
26104,
401,
286,
1077,
17292,
23062,
842,
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_lcs_add_currency_to_account_transaction_script() {
let coin_ident = std::ffi::CString::new(COIN1_NAME).expect("Invalid ident");
let mut script_buf: *mut u8 = std::ptr::null_mut();
let script_buf_ptr = &mut script_buf;
let mut script_len: usize = 0;
let script_result = unsafe {
libra_TransactionAddCurrencyScript_from(
coin_ident.as_ptr(),
script_buf_ptr,
&mut script_len,
)
};
assert_eq!(script_result, LibraStatus::Ok);
let script_bytes: &[u8] = unsafe { slice::from_raw_parts(script_buf, script_len) };
let deserialized_script: Script =
from_bytes(script_bytes).expect("LCS deserialization failed for Script");
let identifier = from_currency_code_string(
coin_ident
.as_c_str()
.to_string_lossy()
.into_owned()
.as_str(),
)
.unwrap();
if let TypeTag::Struct(struct_tag) = deserialized_script.ty_args()[0].clone() {
assert_eq!(identifier, struct_tag.module);
} else {
unreachable!()
}
unsafe {
libra_free_bytes_buffer(script_buf);
};
} | rust_cleaned_test_functions.jsonl/30042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 661
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
4837,
2891,
34710,
2346,
13500,
28884,
14660,
368,
341,
286,
1077,
16254,
38399,
284,
1460,
486,
53799,
486,
63677,
486,
931,
3025,
46,
687,
16,
4708,
568,
17119,
445,
7928,
3524,
3071,
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_zip321_roundtrip_simple_amounts() {
let amounts = vec![1u64, 1000u64, 100000u64, 100000000u64, 100000000000u64];
for amt_u64 in amounts {
let amt = Amount::from_u64(amt_u64).unwrap();
let amt_str = amount_str(amt).unwrap();
assert_eq!(amt, parse_amount(&amt_str).unwrap().1);
}
} | rust_cleaned_test_functions.jsonl/81780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
18,
17,
16,
29896,
32981,
30015,
13471,
82,
368,
341,
286,
1077,
14713,
284,
7486,
20703,
16,
84,
21,
19,
11,
220,
16,
15,
15,
15,
84,
21,
19,
11,
220,
16,
15,
15,
15,
15,
15,
84,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_simple() {
let s7 = S7(S1(5));
let s7 = &s7 as &dyn Tid;
let s = String::from("test");
let a = S2(&s);
let a = &a as &dyn Tid;
assert_eq!(a.downcast_ref::<S2>().unwrap().0, "test");
} | rust_cleaned_test_functions.jsonl/16592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
262,
1077,
274,
22,
284,
328,
22,
3759,
16,
7,
20,
1106,
262,
1077,
274,
22,
284,
609,
82,
22,
438,
609,
43085,
350,
307,
401,
262,
1077,
274,
284,
923,
486,
1499,
445,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_average_too_low() {
let array = [0u8; 2048];
FastCDC::new(&array, 64, 255, 1024);
} | rust_cleaned_test_functions.jsonl/32053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38594,
2346,
78,
23767,
368,
341,
286,
1077,
1334,
284,
508,
15,
84,
23,
26,
220,
17,
15,
19,
23,
935,
286,
17288,
73458,
486,
931,
2099,
1653,
11,
220,
21,
19,
11,
220,
17,
20,
20,
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 |
#[test]
fn test_fn_signature_with_docs_from_actix() {
let info = call_info(
r#"
struct WriteHandler<E>;
impl<E> WriteHandler<E> {
/// Method is called when writer emits error.
///
/// If this method returns `ErrorAction::Continue` writer processing
/// continues otherwise stream processing stops.
fn error(&mut self, err: E, ctx: &mut Self::Context) -> Running {
Running::Stop
}
/// Method is called when writer finishes.
///
/// By default this method stops actor's `Context`.
fn finished(&mut self, ctx: &mut Self::Context) {
ctx.stop()
}
}
pub fn foo(mut r: WriteHandler<()>) {
r.finished(<|>);
}
"#,
);
assert_eq!(info.parameters(), ["&mut self", "ctx: &mut Self::Context"]);
assert_eq!(info.active_parameter, Some(1));
assert_eq!(
info.doc().map(|it| it.into()),
Some(
r#"Method is called when writer finishes.
By default this method stops actor's `Context`."#
.to_string()
)
);
} | rust_cleaned_test_functions.jsonl/55357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
39859,
6615,
49692,
5673,
29370,
941,
368,
341,
286,
1077,
3546,
284,
1618,
3109,
1006,
310,
435,
2,
698,
1235,
9645,
3050,
23835,
19421,
6383,
23835,
29,
9645,
3050,
23835,
29,
341,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_factorial() {
let mut factorial_worker = FactorialWorker::new();
let n = 5;
factorial_worker.get_factorial(n);
// test
let result = factorial_worker.get_factorial(n);
assert_eq!(result[2], 3);
assert_eq!(result[3], 1);
assert_eq!(result[5], 1);
} | rust_cleaned_test_functions.jsonl/90818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
18588,
530,
368,
341,
286,
1077,
5206,
52962,
40385,
284,
37729,
530,
21936,
486,
931,
543,
286,
1077,
308,
284,
220,
20,
401,
286,
52962,
40385,
670,
18588,
530,
1445,
626,
286,
442,
1273... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ball_ball_toi() {
let b = Ball::new(0.5);
let m1 = Isometry2::identity();
let m2 = Isometry2::translation(0.0, 10.0);
let v1 = Vector2::new(0.0, 10.0);
let v2 = Vector2::zeros();
let cast = query::time_of_impact(&m1, &v1, &b, &m2, &v2, &b, Real::MAX, 0.0).unwrap();
assert_eq!(cast.unwrap().toi, 0.9);
} | rust_cleaned_test_functions.jsonl/126230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55808,
55808,
2346,
72,
368,
341,
262,
1077,
293,
284,
12836,
486,
931,
7,
15,
13,
20,
317,
262,
1077,
296,
16,
284,
2160,
6988,
17,
486,
16912,
543,
262,
1077,
296,
17,
284,
2160,
6988,
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_cost_model_transaction_many_transfer_instructions() {
let (mint_keypair, start_hash) = test_setup();
let key1 = solana_sdk::pubkey::new_rand();
let key2 = solana_sdk::pubkey::new_rand();
let instructions =
system_instruction::transfer_many(&mint_keypair.pubkey(), &[(key1, 1), (key2, 1)]);
let message = Message::new(&instructions, Some(&mint_keypair.pubkey()));
let tx = SanitizedTransaction::from_transaction_for_tests(Transaction::new(
&[&mint_keypair],
message,
start_hash,
));
debug!("many transfer transaction {:?}", tx);
// expected cost for two system transfer instructions
let program_cost = BUILT_IN_INSTRUCTION_COSTS
.get(&system_program::id())
.unwrap();
let expected_cost = program_cost * 2;
let testee = CostModel::default();
let mut tx_cost = TransactionCost::default();
testee.get_transaction_cost(&mut tx_cost, &tx);
assert_eq!(expected_cost, tx_cost.builtins_execution_cost);
assert_eq!(0, tx_cost.bpf_execution_cost);
assert_eq!(1, tx_cost.data_bytes_cost);
} | rust_cleaned_test_functions.jsonl/10426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15890,
5047,
28884,
22101,
35403,
82427,
368,
341,
286,
1077,
320,
67791,
3097,
12670,
11,
1191,
8950,
8,
284,
1273,
21363,
1428,
286,
1077,
1376,
16,
284,
2048,
3362,
61783,
486,
9585,
792,
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_gdbfeaturesupported() {
assert_eq!(
gdbfeaturesupported(&b"multiprocess+"[..]),
Done(
&b""[..],
GDBFeatureSupported(Known::Yes(GDBFeature::multiprocess), FeatureSupported::Yes)
)
);
assert_eq!(
gdbfeaturesupported(&b"xmlRegisters=i386"[..]),
Done(
&b""[..],
GDBFeatureSupported(
Known::Yes(GDBFeature::xmlRegisters),
FeatureSupported::Value("i386")
)
)
);
assert_eq!(
gdbfeaturesupported(&b"qRelocInsn-"[..]),
Done(
&b""[..],
GDBFeatureSupported(Known::Yes(GDBFeature::qRelocInsn), FeatureSupported::No)
)
);
assert_eq!(
gdbfeaturesupported(&b"vfork-events+"[..]),
Done(
&b""[..],
GDBFeatureSupported(Known::Yes(GDBFeature::vfork_events), FeatureSupported::Yes)
)
);
assert_eq!(
gdbfeaturesupported(&b"vfork-events-"[..]),
Done(
&b""[..],
GDBFeatureSupported(Known::Yes(GDBFeature::vfork_events), FeatureSupported::No)
)
);
assert_eq!(
gdbfeaturesupported(&b"unknown-feature+"[..]),
Done(
&b""[..],
GDBFeatureSupported(Known::No("unknown-feature"), FeatureSupported::Yes)
)
);
assert_eq!(
gdbfeaturesupported(&b"unknown-feature-"[..]),
Done(
&b""[..],
GDBFeatureSupported(Known::No("unknown-feature"), FeatureSupported::No)
)
);
} | rust_cleaned_test_functions.jsonl/40105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 839
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
1999,
20304,
12513,
368,
341,
262,
2060,
10714,
33673,
286,
75953,
20304,
12513,
2099,
65,
1,
77976,
40848,
5172,
95874,
17036,
286,
27357,
1006,
310,
609,
65,
3014,
95874,
1259,
310,
479,
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_add_should_add_to_alphabet() {
let mut lsys: LSystem = LSystem::new("A".to_string());
lsys.add('B');
assert!(lsys.alphabet.contains(&'B'));
} | rust_cleaned_test_functions.jsonl/101642 | {
"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,
2891,
43378,
2891,
2346,
8418,
18485,
368,
341,
286,
1077,
5206,
326,
7791,
25,
444,
2320,
284,
444,
2320,
486,
931,
445,
32,
3263,
983,
3904,
1423,
286,
326,
7791,
1364,
492,
33,
1157,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parquet_datetime_round_trip() -> Result<()> {
use std::io::{Cursor, Seek, SeekFrom};
let mut f = Cursor::new(vec![]);
let mut df = df![
"datetime" => [Some(191845729i64), Some(89107598), None, Some(3158971092)]
]?;
df.may_apply("datetime", |s| s.cast(&DataType::Datetime))?;
ParquetWriter::new(&mut f).finish(&df)?;
f.seek(SeekFrom::Start(0))?;
let read = ParquetReader::new(f).finish()?;
assert!(read.frame_equal_missing(&df));
Ok(())
} | rust_cleaned_test_functions.jsonl/111168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22654,
23300,
28943,
29896,
63883,
368,
1464,
5714,
71698,
341,
286,
990,
1460,
486,
815,
22964,
14543,
11,
29739,
11,
29739,
3830,
2315,
286,
1077,
5206,
282,
284,
28067,
486,
931,
25592,
0,
1294... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_stash_pop_no_conflict() {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
write_commit_file(&repo, "test.txt", "test", "c1");
repo_write_file(&repo, "test.txt", "test2").unwrap();
let id =
stash_save(repo_path, Some("foo"), true, false).unwrap();
let res = stash_pop(repo_path, id);
assert!(res.is_ok());
assert_eq!(
repo_read_file(&repo, "test.txt").unwrap(),
"test2"
);
} | rust_cleaned_test_functions.jsonl/20972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
988,
17061,
6536,
16059,
21242,
368,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_example_2() {
let input = r#"{"a":2,"b":4}"#;
let input = parse_inputstring(&input);
let answer = sum_numbers_json(&input, 1);
assert_eq!(answer, 6);
} | rust_cleaned_test_functions.jsonl/97867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
62,
17,
368,
341,
286,
1077,
1946,
284,
435,
55543,
4913,
64,
788,
17,
1335,
65,
788,
19,
9863,
2,
280,
286,
1077,
1946,
284,
4715,
5898,
917,
2099,
1355,
317,
286,
1077,
4226,
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 |
#[test]
fn test_convert_function() {
let b = ast::BaseNode::default();
let pkg = parse_package(
"f = (a, b) => a + b
f(a: 2, b: 3)",
);
let got = test_convert(pkg).unwrap();
let symbols = collect_symbols(&got);
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![
Statement::Variable(Box::new(VariableAssgn::new(
Identifier {
loc: b.location.clone(),
name: symbols["f@main"].clone(),
},
Expression::Function(Box::new(FunctionExpr {
loc: b.location.clone(),
typ: type_info(),
params: vec![
FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: symbols["a"].clone(),
},
default: None,
},
FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: symbols["b"].clone(),
},
default: None,
},
],
body: Block::Return(ReturnStmt {
loc: b.location.clone(),
argument: Expression::Binary(Box::new(BinaryExpr {
loc: b.location.clone(),
typ: type_info(),
operator: ast::Operator::AdditionOperator,
left: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["a"].clone(),
}),
right: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["b"].clone(),
}),
})),
}),
vectorized: None,
})),
b.location.clone(),
))),
Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Call(Box::new(CallExpr {
loc: b.location.clone(),
typ: type_info(),
pipe: None,
callee: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["f@main"].clone(),
}),
arguments: vec![
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: symbols["a"].clone(),
},
value: Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 2,
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: symbols["b"].clone(),
},
value: Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 3,
}),
},
],
})),
}),
],
}],
};
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/131374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
9174,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
4715,
26328,
1006,
310,
330,
69,
284,
320,
64,
11,
293,
8,
589,
264,
488,
293,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exponent_f64() -> SimpleResult<()> {
let data = b"\x40\x09\x1e\xb8\x51\xeb\x85\x1f\x40\x09\x33\x33\x33\x33\x33\x33".to_vec();
let tests = vec![
// index uppercase expected
( 0, false, "3.14e0"),
( 8, false, "3.15e0"),
( 0, true, "3.14E0"),
( 8, true, "3.15E0"),
];
for (index, uppercase, expected) in tests {
let context = Context::new_at(&data, index);
let number = FloatReader::F64(Endian::Big).read(context)?;
assert_eq!(
expected,
ScientificFormatter::new_float(uppercase).render(number),
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/61916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 458
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
1146,
761,
21,
19,
368,
1464,
8993,
2077,
71698,
341,
1789,
286,
1077,
821,
284,
293,
11934,
87,
19,
15,
3462,
15,
24,
3462,
16,
68,
47759,
23,
3462,
20,
16,
3462,
3065,
3462,
23,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_get_routes() {
let parsed_conf = parse_conf(CONF, "valid.conf").unwrap();
let mut expected_map: Vec<(String, HashMap<String, ConfigNode>)> = Vec::new();
let mut static_hashmap: HashMap<String, ConfigNode> = HashMap::new();
static_hashmap.insert("directory".into(), ConfigNode::String("directory".into(), "/var/www".into()));
expected_map.push(("/static/*".into(), static_hashmap));
let mut proxy_hashmap: HashMap<String, ConfigNode> = HashMap::new();
proxy_hashmap.insert("proxy".into(), ConfigNode::String("proxy".into(), "127.0.0.1:8000,127.0.0.1:8080".into()));
proxy_hashmap.insert("load_balancer_mode".into(), ConfigNode::String("load_balancer_mode".into(), "round-robin".into()));
expected_map.push(("/*".into(), proxy_hashmap));
let routes = parsed_conf.get_routes();
assert_eq!(routes, expected_map);
} | rust_cleaned_test_functions.jsonl/124282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
64314,
368,
341,
262,
1077,
15676,
16059,
284,
4715,
16059,
27631,
37,
11,
330,
1891,
13937,
1827,
15454,
1428,
262,
1077,
5206,
3601,
5376,
25,
11312,
28706,
703,
11,
10528,
3464,
11,
5532,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_transactions_returns_unprocessed_txs() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(10_000);
let bank = Arc::new(Bank::new(&genesis_config));
let pubkey = solana_sdk::pubkey::new_rand();
let transactions =
vec![
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_config.hash(),);
3
];
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger");
let (poh_recorder, _entry_receiver) = PohRecorder::new(
bank.tick_height(),
bank.last_blockhash(),
bank.slot(),
Some((4, 4)),
bank.ticks_per_slot(),
&solana_sdk::pubkey::new_rand(),
&Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&Arc::new(PohConfig::default()),
);
// record
let poh_recorder = Arc::new(Mutex::new(poh_recorder));
let (gossip_vote_sender, _gossip_vote_receiver) = unbounded();
let (processed_transactions_count, mut retryable_txs) =
BankingStage::process_transactions(
&bank,
&transactions,
&poh_recorder,
None,
&gossip_vote_sender,
);
assert_eq!(processed_transactions_count, 0,);
retryable_txs.sort_unstable();
let expected: Vec<usize> = (0..transactions.len()).collect();
assert_eq!(retryable_txs, expected);
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/5948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1073
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
68182,
58900,
4907,
34022,
17805,
82,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_malicious_v2_message() {
let fork_context = Arc::new(fork_context());
// 10 byte snappy stream identifier
let stream_identifier: &'static [u8] = b"\xFF\x06\x00\x00sNaPpY";
assert_eq!(stream_identifier.len(), 10);
let malicious_padding: &'static [u8] = b"\xFE\x00\x00\x00";
let block_message_bytes = altair_block().as_ssz_bytes();
assert_eq!(block_message_bytes.len(), 157916);
assert_eq!(
snap::raw::max_compress_len(block_message_bytes.len()),
184267
);
let mut uvi_codec: Uvi<usize> = Uvi::default();
let mut dst = BytesMut::with_capacity(1024);
// Insert context bytes
dst.extend_from_slice(&fork_context.to_context_bytes(ForkName::Altair).unwrap());
// Insert length-prefix
uvi_codec
.encode(block_message_bytes.len(), &mut dst)
.unwrap();
// Insert snappy stream identifier
dst.extend_from_slice(stream_identifier);
// Insert malicious padding of 176156 bytes.
for _ in 0..44039 {
dst.extend_from_slice(malicious_padding);
}
let mut writer = FrameEncoder::new(Vec::new());
writer.write_all(&block_message_bytes).unwrap();
writer.flush().unwrap();
assert_eq!(writer.get_ref().len(), 8103);
dst.extend_from_slice(writer.get_ref());
assert_eq!(
decode(Protocol::BlocksByRange, Version::V2, &mut dst).unwrap_err(),
RPCError::InvalidData
);
} | rust_cleaned_test_functions.jsonl/57909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 789
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
717,
278,
9627,
2273,
17,
6462,
368,
341,
286,
1077,
22435,
8467,
284,
19689,
486,
931,
955,
669,
8467,
5231,
286,
442,
220,
16,
15,
4922,
4131,
11144,
4269,
12816,
198,
286,
1077,
4269,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_consensus_key_rotation() {
let (_env, op_tool, backend, mut storage) = launch_swarm_with_op_tool_and_backend(1, 0);
// Rotate the consensus key
let (txn_ctx, new_consensus_key) = op_tool.rotate_consensus_key(&backend, false).unwrap();
assert_eq!(VMStatusView::Executed, txn_ctx.execution_result.unwrap());
// Verify that the config has been updated correctly with the new consensus key
let validator_account = storage.get::<AccountAddress>(OWNER_ACCOUNT).unwrap().value;
let config_consensus_key = op_tool
.validator_config(validator_account, &backend)
.unwrap()
.consensus_public_key;
assert_eq!(new_consensus_key, config_consensus_key);
// Verify that the validator set info contains the new consensus key
let info_consensus_key = op_tool
.validator_set(Some(validator_account), &backend)
.unwrap()[0]
.consensus_public_key
.clone();
assert_eq!(new_consensus_key, info_consensus_key);
// Rotate the consensus key in storage manually and perform another rotation using the op_tool.
let rotated_consensus_key = storage.rotate_key(CONSENSUS_KEY).unwrap();
let (txn_ctx, new_consensus_key) = op_tool.rotate_consensus_key(&backend, true).unwrap();
assert!(txn_ctx.execution_result.is_none());
assert_eq!(rotated_consensus_key, new_consensus_key);
} | rust_cleaned_test_functions.jsonl/64956 | {
"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,
31971,
13626,
3097,
44813,
368,
341,
262,
1077,
5453,
3160,
11,
1179,
22785,
11,
19163,
11,
5206,
5819,
8,
284,
7050,
32581,
2178,
6615,
10287,
22785,
8378,
40011,
7,
16,
11,
220,
15,
626,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_circular_load() {
let loader = MockLoader::new();
let loads = loader.loads.clone();
let mut runtime = JsRuntime::new(RuntimeOptions {
module_loader: Some(loader),
..Default::default()
});
let fut = async move {
let spec = resolve_url("file:///circular1.js").unwrap();
let result = runtime.load_main_module(&spec, None).await;
assert!(result.is_ok());
let circular1_id = result.unwrap();
let _ = runtime.mod_evaluate(circular1_id);
runtime.run_event_loop(false).await.unwrap();
let l = loads.lock();
assert_eq!(
l.to_vec(),
vec![
"file:///circular1.js",
"file:///circular2.js",
"file:///circular3.js"
]
);
let module_map_rc = JsRuntime::module_map(runtime.v8_isolate());
let modules = module_map_rc.borrow();
assert_eq!(
modules.get_id("file:///circular1.js", ModuleType::JavaScript),
Some(circular1_id)
);
let circular2_id = modules
.get_id("file:///circular2.js", ModuleType::JavaScript)
.unwrap();
assert_eq!(
modules.get_requested_modules(circular1_id),
Some(&vec![ModuleRequest {
specifier: resolve_url("file:///circular2.js").unwrap(),
expected_module_type: ModuleType::JavaScript,
}])
);
assert_eq!(
modules.get_requested_modules(circular2_id),
Some(&vec![ModuleRequest {
specifier: resolve_url("file:///circular3.js").unwrap(),
expected_module_type: ModuleType::JavaScript,
}])
);
assert!(modules
.get_id("file:///circular3.js", ModuleType::JavaScript)
.is_some());
let circular3_id = modules
.get_id("file:///circular3.js", ModuleType::JavaScript)
.unwrap();
assert_eq!(
modules.get_requested_modules(circular3_id),
Some(&vec![
ModuleRequest {
specifier: resolve_url("file:///circular1.js").unwrap(),
expected_module_type: ModuleType::JavaScript,
},
ModuleRequest {
specifier: resolve_url("file:///circular2.js").unwrap(),
expected_module_type: ModuleType::JavaScript,
}
])
);
}
.boxed_local();
futures::executor::block_on(fut);
} | rust_cleaned_test_functions.jsonl/12401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
21472,
12411,
368,
341,
262,
1077,
16047,
284,
14563,
9181,
486,
931,
543,
262,
1077,
20907,
284,
16047,
22961,
15997,
543,
262,
1077,
5206,
15592,
284,
39122,
15123,
486,
931,
52610,
3798,
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_rename_local_for_field_shorthand() {
mark::check!(test_rename_local_for_field_shorthand);
test_rename(
r#"
struct Foo {
i: i32,
}
impl Foo {
fn new(i<|>: i32) -> Self {
Self { i }
}
}
"#,
"j",
r#"
struct Foo {
i: i32,
}
impl Foo {
fn new(j: i32) -> Self {
Self { i: j }
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/58092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79399,
13564,
5478,
5013,
3712,
61679,
368,
341,
286,
1868,
486,
2028,
10297,
1944,
79399,
13564,
5478,
5013,
3712,
61679,
317,
286,
1273,
79399,
1006,
310,
435,
2,
698,
262,
2036,
33428,
341,
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_set_boot_source() {
let tmp_file = TempFile::new().unwrap();
let cmdline = "reboot=k panic=1 pci=off nomodules 8250.nr_uarts=0";
let expected_boot_cfg = BootSourceConfig {
kernel_image_path: String::from(tmp_file.as_path().to_str().unwrap()),
initrd_path: Some(String::from(tmp_file.as_path().to_str().unwrap())),
boot_args: Some(cmdline.to_string()),
};
let mut vm_resources = default_vm_resources();
let boot_cfg = vm_resources.boot_source().unwrap();
let tmp_ino = tmp_file.as_file().metadata().unwrap().st_ino();
assert_ne!(boot_cfg.cmdline.as_str(), cmdline);
assert_ne!(boot_cfg.kernel_file.metadata().unwrap().st_ino(), tmp_ino);
assert_ne!(
boot_cfg
.initrd_file
.as_ref()
.unwrap()
.metadata()
.unwrap()
.st_ino(),
tmp_ino
);
vm_resources.set_boot_source(expected_boot_cfg).unwrap();
let boot_cfg = vm_resources.boot_source().unwrap();
assert_eq!(boot_cfg.cmdline.as_str(), cmdline);
assert_eq!(boot_cfg.kernel_file.metadata().unwrap().st_ino(), tmp_ino);
assert_eq!(
boot_cfg
.initrd_file
.as_ref()
.unwrap()
.metadata()
.unwrap()
.st_ino(),
tmp_ino
);
} | rust_cleaned_test_functions.jsonl/5456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 809
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
52062,
10347,
368,
341,
286,
1077,
4174,
2458,
284,
19944,
1703,
486,
931,
1005,
15454,
543,
286,
1077,
94106,
284,
330,
265,
4619,
45157,
21975,
28,
16,
45471,
28,
1847,
9662,
347,
2425,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_declaration_invalid_fn_name_must_be_name_token() {
let mut p = make_parser_from_tokens(vec![
Token::Literal(String::from("function")),
Token::Whitespace(String::from(" ")),
Token::Literal(String::from("fn_name")),
Token::Whitespace(String::from(" ")),
Token::ParenOpen,
Token::ParenClose,
Token::Whitespace(String::from(" ")),
Token::CurlyOpen,
Token::Whitespace(String::from(" ")),
Token::Literal(String::from("echo")),
Token::Whitespace(String::from(" ")),
Token::Literal(String::from("fn body")),
Token::Semi,
Token::CurlyClose,
]);
assert_eq!(
Err(BadIdent(String::from("fn_name"), src(9, 1, 10))),
p.function_declaration()
);
let mut p = make_parser_from_tokens(vec![
Token::Literal(String::from("function")),
Token::Whitespace(String::from(" ")),
Token::Name(String::from("fn_name")),
Token::Whitespace(String::from(" ")),
Token::ParenOpen,
Token::ParenClose,
Token::Whitespace(String::from(" ")),
Token::CurlyOpen,
Token::Whitespace(String::from(" ")),
Token::Literal(String::from("echo")),
Token::Whitespace(String::from(" ")),
Token::Literal(String::from("fn body")),
Token::Semi,
Token::CurlyClose,
]);
p.function_declaration().unwrap();
} | rust_cleaned_test_functions.jsonl/69873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
77926,
31433,
15246,
1269,
717,
590,
21263,
1269,
6458,
368,
341,
262,
1077,
5206,
281,
284,
1281,
18517,
5673,
28838,
25592,
90515,
286,
9660,
486,
17350,
2242,
486,
1499,
445,
1688,
30154,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_from_header() {
let hex = "#a1ecfb";
let base = hex_to_real_rgba(hex);
println!("base: {}", base);
assert_eq!(base, rgba(161, 236, 251, 1.00));
let lighter = base.lighten(percent(20));
println!("lighter: {}", lighter);
assert_eq!(lighter, rgba(255, 255, 255, 1.00));
let dark = base.darken(percent(20));
println!("dark: {}", dark);
assert_eq!(dark, rgba(63, 216, 247, 1.00));
} | rust_cleaned_test_functions.jsonl/69878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
5673,
8757,
368,
341,
286,
1077,
12371,
284,
5869,
64,
16,
757,
10798,
876,
286,
1077,
2331,
284,
12371,
2346,
15266,
95229,
44660,
317,
286,
13751,
17223,
3152,
25,
24689,
2331,
626,
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_unknown_terminals() {
let input = vec![ABTerminal::B, ABTerminal::End];
let mut lexer = ABLexer::new(&input);
let result = Parser::parse(&mut lexer);
assert_matches!(result, Err(ParseError::Unexpected(ABTerminal::B)));
} | rust_cleaned_test_functions.jsonl/87955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
17464,
23695,
368,
341,
262,
1077,
1946,
284,
7486,
20703,
1867,
47890,
486,
33,
11,
14137,
47890,
486,
3727,
935,
262,
1077,
5206,
53259,
284,
362,
9389,
327,
261,
486,
931,
2099,
1355,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_erase() {
let cache = CacheTest::new(CACHE_SIZE);
cache.erase(200);
assert_eq!(0, cache.deleted_keys.borrow().len());
cache.insert(100, 101);
cache.insert(200, 201);
cache.erase(100);
assert_eq!(None, cache.look_up(100));
assert_eq!(Some(201), cache.look_up(200));
assert_eq!(1, cache.deleted_keys.borrow().len());
cache.assert_deleted_keys_and_values(0, (100, 101));
cache.erase(100);
assert_eq!(None, cache.look_up(100));
assert_eq!(Some(201), cache.look_up(200));
assert_eq!(1, cache.deleted_keys.borrow().len());
} | rust_cleaned_test_functions.jsonl/82676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85516,
368,
341,
286,
1077,
6500,
284,
19479,
2271,
486,
931,
3025,
17810,
4098,
317,
286,
6500,
25391,
7,
17,
15,
15,
317,
286,
2060,
10714,
10297,
15,
11,
6500,
64862,
12631,
83640,
1005,
2892... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_iter() {
let data = vec!(5i, 9, 3);
let iterout = vec!(9i, 5, 3);
let pq = BinaryHeap::from_vec(data);
let v: Vec<int> = pq.into_iter().collect();
assert_eq!(v, iterout);
} | rust_cleaned_test_functions.jsonl/1577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
11723,
368,
341,
286,
1077,
821,
284,
7486,
10297,
20,
72,
11,
220,
24,
11,
220,
18,
317,
286,
1077,
5367,
411,
284,
7486,
10297,
24,
72,
11,
220,
20,
11,
220,
18,
317,
286,
1077,
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_id_list_single() {
let (input, filter) = Filter::parse0(argv!["1"]).unwrap();
assert_eq!(input.len(), 0);
assert_eq!(
filter,
Filter {
conditions: vec![Condition::IdList(vec![TaskId::WorkingSetId(1)])],
}
);
} | rust_cleaned_test_functions.jsonl/115957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
842,
2019,
19487,
368,
341,
286,
1077,
320,
1355,
11,
4051,
8,
284,
12339,
486,
6400,
15,
15329,
0,
1183,
16,
45014,
15454,
543,
286,
2060,
10714,
10297,
1355,
19406,
1507,
220,
15,
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_new() {
assert!(WebSocket::new("ws://localhost").is_ok());
match WebSocket::new("bad url") {
Err(CreationError::SyntaxError(_)) => (),
v => panic!("expected SyntaxError, got {:?}", v),
}
} | rust_cleaned_test_functions.jsonl/115382 | {
"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,
5921,
368,
341,
286,
2060,
10297,
61238,
486,
931,
445,
8915,
1110,
8301,
1827,
285,
19817,
5231,
286,
2432,
47042,
486,
931,
445,
13855,
2515,
899,
341,
310,
15495,
3025,
26453,
1454,
486,
33890,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_quadratics_and_cubics() {
use euclid::approxeq::ApproxEq;
fn do_test(arc: &Arc<f32>, expected_quadratic_count: u32, expected_cubic_count: u32) {
let last = arc.to();
{
let mut prev = arc.from();
let mut count = 0;
arc.for_each_quadratic_bezier(&mut |c| {
assert!(c.from.approx_eq(&prev));
prev = c.to;
count += 1;
});
assert!(prev.approx_eq(&last));
assert_eq!(count, expected_quadratic_count);
}
{
let mut prev = arc.from();
let mut count = 0;
arc.for_each_cubic_bezier(&mut |c| {
assert!(c.from.approx_eq(&prev));
prev = c.to;
count += 1;
});
assert!(prev.approx_eq(&last));
assert_eq!(count, expected_cubic_count);
}
}
do_test(
&Arc {
center: point(2.0, 3.0),
radii: vector(10.0, 3.0),
start_angle: Angle::radians(0.1),
sweep_angle: Angle::radians(3.0),
x_rotation: Angle::radians(0.5),
},
4,
2,
);
do_test(
&Arc {
center: point(4.0, 5.0),
radii: vector(3.0, 5.0),
start_angle: Angle::radians(2.0),
sweep_angle: Angle::radians(-3.0),
x_rotation: Angle::radians(1.3),
},
4,
2,
);
do_test(
&Arc {
center: point(0.0, 0.0),
radii: vector(100.0, 0.01),
start_angle: Angle::radians(-1.0),
sweep_angle: Angle::radians(0.1),
x_rotation: Angle::radians(0.3),
},
1,
1,
);
do_test(
&Arc {
center: point(0.0, 0.0),
radii: vector(1.0, 1.0),
start_angle: Angle::radians(3.0),
sweep_angle: Angle::radians(-0.1),
x_rotation: Angle::radians(-0.3),
},
1,
1,
);
} | rust_cleaned_test_functions.jsonl/18195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
11280,
14666,
28370,
8378,
666,
392,
1211,
368,
341,
262,
990,
15555,
75044,
486,
15707,
8371,
80,
486,
28588,
12606,
80,
401,
262,
5168,
653,
4452,
91958,
25,
609,
36809,
63895,
18,
17,
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_abnormal_transfer_with_error() {
let mut status = MigrationStatus::None;
// None to Active.
if let Err(e) = status.transfer(MigrationStatus::Active) {
assert_eq!(
e.to_string(),
format!(
"Failed to transfer migration status from {} to {}.",
MigrationStatus::None,
MigrationStatus::Active
)
);
} else {
assert!(false)
}
status = status.transfer(MigrationStatus::Setup).unwrap();
// Setup to Complete.
if let Err(e) = status.transfer(MigrationStatus::Completed) {
assert_eq!(
e.to_string(),
format!(
"Failed to transfer migration status from {} to {}.",
MigrationStatus::Setup,
MigrationStatus::Completed
)
);
} else {
assert!(false)
}
status = status.transfer(MigrationStatus::Active).unwrap();
// Active to Setup.
if let Err(e) = status.transfer(MigrationStatus::Setup) {
assert_eq!(
e.to_string(),
format!(
"Failed to transfer migration status from {} to {}.",
MigrationStatus::Active,
MigrationStatus::Setup
)
);
} else {
assert!(false)
}
status = status.transfer(MigrationStatus::Completed).unwrap();
// Completed to Setup.
if let Err(e) = status.transfer(MigrationStatus::Setup) {
assert_eq!(
e.to_string(),
format!(
"Failed to transfer migration status from {} to {}.",
MigrationStatus::Completed,
MigrationStatus::Setup
)
);
} else {
assert!(false)
}
// Complete to failed.
if let Err(e) = status.transfer(MigrationStatus::Failed) {
assert_eq!(
e.to_string(),
format!(
"Failed to transfer migration status from {} to {}.",
MigrationStatus::Completed,
MigrationStatus::Failed
)
);
} else {
assert!(false)
}
} | rust_cleaned_test_functions.jsonl/88596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22885,
8252,
35403,
6615,
4096,
368,
341,
286,
1077,
5206,
2639,
284,
21248,
2522,
486,
4064,
401,
286,
442,
2240,
311,
9905,
624,
286,
421,
1077,
15495,
2026,
8,
284,
2639,
49428,
3189,
5033,
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... | 6 |
#[test]
fn test_clean_accounts_with_last_full_snapshot_slot() {
solana_logger::setup();
let accounts_db = AccountsDb::new_single_for_tests();
let pubkey = solana_sdk::pubkey::new_rand();
let owner = solana_sdk::pubkey::new_rand();
let space = 0;
let slot1 = 1;
let account = AccountSharedData::new(111, space, &owner);
accounts_db.store_cached(slot1, &[(&pubkey, &account)]);
accounts_db.get_accounts_delta_hash(slot1);
accounts_db.add_root(slot1);
let slot2 = 2;
let account = AccountSharedData::new(222, space, &owner);
accounts_db.store_cached(slot2, &[(&pubkey, &account)]);
accounts_db.get_accounts_delta_hash(slot2);
accounts_db.add_root(slot2);
let slot3 = 3;
let account = AccountSharedData::new(0, space, &owner);
accounts_db.store_cached(slot3, &[(&pubkey, &account)]);
accounts_db.get_accounts_delta_hash(slot3);
accounts_db.add_root(slot3);
assert_eq!(accounts_db.ref_count_for_pubkey(&pubkey), 3);
accounts_db.clean_accounts(Some(slot2), false, Some(slot2));
assert_eq!(accounts_db.ref_count_for_pubkey(&pubkey), 2);
accounts_db.clean_accounts(None, false, Some(slot2));
assert_eq!(accounts_db.ref_count_for_pubkey(&pubkey), 1);
accounts_db.clean_accounts(None, false, Some(slot3));
assert_eq!(accounts_db.ref_count_for_pubkey(&pubkey), 0);
} | rust_cleaned_test_functions.jsonl/7057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 686
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19573,
55665,
6615,
12195,
16372,
53265,
27563,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
9618,
8685,
284,
40655,
7994,
486,
931,
19487,
5478,
32509,
543,
286,
1077,
95116,
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_compress() {
let cases = vec![
(
"hello world",
"0B000000789CCB48CDC9C95728CF2FCA4901001A0B045D",
),
("", ""),
// compressed string ends with space
(
"hello wor012",
"0C000000789CCB48CDC9C95728CF2F32303402001D8004202E",
),
];
for (s, exp) in cases {
let s = Datum::Bytes(s.as_bytes().to_vec());
let got = eval_func(ScalarFuncSig::Compress, &[s]).unwrap();
assert_eq!(
got,
Datum::Bytes(hex::decode(exp.as_bytes().to_vec()).unwrap())
);
}
} | rust_cleaned_test_functions.jsonl/104208 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87845,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
330,
14990,
1879,
756,
394,
330,
15,
33,
15,
15,
15,
15,
15,
15,
22,
23,
24,
3706,
33,
19,
23,
73458,
24,
34,
24,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_weak_count() {
let a = Rc::new(0);
assert!(Rc::strong_count(&a) == 1);
assert!(Rc::weak_count(&a) == 0);
let w = Rc::downgrade(&a);
assert!(Rc::strong_count(&a) == 1);
assert!(Rc::weak_count(&a) == 1);
drop(w);
assert!(Rc::strong_count(&a) == 1);
assert!(Rc::weak_count(&a) == 0);
let c = a.clone();
assert!(Rc::strong_count(&a) == 2);
assert!(Rc::weak_count(&a) == 0);
drop(c);
} | rust_cleaned_test_functions.jsonl/4661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86356,
3180,
368,
341,
286,
1077,
264,
284,
81463,
486,
931,
7,
15,
317,
286,
2060,
10297,
49,
66,
486,
4519,
3180,
2099,
64,
8,
621,
220,
16,
317,
286,
2060,
10297,
49,
66,
486,
13150,
3180... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_short_name_collisions_long() {
let mut buf: [u8; SFN_SIZE];
let mut gen = ShortNameGenerator::new("TextFile.Mine.txt");
buf = gen.generate().unwrap();
assert_eq!(&buf, b"TEXTFI~1TXT");
gen.add_existing(&buf);
buf = gen.generate().unwrap();
assert_eq!(&buf, b"TEXTFI~2TXT");
gen.add_existing(&buf);
buf = gen.generate().unwrap();
assert_eq!(&buf, b"TEXTFI~3TXT");
gen.add_existing(&buf);
buf = gen.generate().unwrap();
assert_eq!(&buf, b"TEXTFI~4TXT");
gen.add_existing(&buf);
buf = gen.generate().unwrap();
assert_eq!(&buf, b"TE527D~1TXT");
gen.add_existing(&buf);
buf = gen.generate().unwrap();
assert_eq!(&buf, b"TE527D~2TXT");
for i in 3..10 {
gen.add_existing(&buf);
buf = gen.generate().unwrap();
assert_eq!(&buf, format!("TE527D~{}TXT", i).as_bytes());
}
gen.add_existing(&buf);
assert!(gen.generate().is_err());
gen.next_iteration();
for _i in 0..4 {
buf = gen.generate().unwrap();
gen.add_existing(&buf);
}
buf = gen.generate().unwrap();
assert_eq!(&buf, b"TE527E~1TXT");
} | rust_cleaned_test_functions.jsonl/29721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 689
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
16673,
1269,
43597,
6805,
17799,
368,
341,
286,
1077,
5206,
6607,
25,
508,
84,
23,
26,
23463,
45,
4098,
935,
286,
1077,
5206,
4081,
284,
10698,
675,
12561,
486,
931,
445,
1178,
1703,
1321... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_module_graph_info_display() {
let fixture = get_fixture();
let actual = fixture.to_string();
assert!(actual.contains(" /a/b/c.ts"));
assert!(actual.contains(" 99 unique"));
assert!(actual.contains("(12.06KB)"));
assert!(actual.contains("\n\nhttps://deno.land/x/a/b/c.ts"));
} | rust_cleaned_test_functions.jsonl/70407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
14738,
3109,
14825,
368,
341,
262,
1077,
12507,
284,
633,
74409,
543,
262,
1077,
5042,
284,
12507,
2389,
3904,
543,
262,
2060,
10297,
11944,
8786,
445,
608,
64,
3470,
2899,
21288,
4010,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compose() {
let b1 = Image::new_with_color(4, 2, Rgb::GREEN);
let b2 = Image::new_with_color(2, 5, Rgb::BLUE);
let b3 = Image::new_with_color(2, 2, Rgb::RED);
let result = Image::compose([&b1, &b2, &b3], Rgb::NONE, |_, _, colors| {
colors.iter().fold(Rgb::NONE, |c1, c2| c1.alpha_blend(*c2))
});
assert_eq!(result.width(), 4);
assert_eq!(result.height(), 5);
assert_eq!(result.get_pixel(3, 0), &Rgb::GREEN);
assert_eq!(result.get_pixel(0, 4), &Rgb::BLUE);
assert_eq!(result.get_pixel(1, 1), &Rgb::RED);
assert_eq!(result.get_pixel(3, 4), &Rgb::default());
} | rust_cleaned_test_functions.jsonl/119731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
2900,
368,
341,
310,
1077,
293,
16,
284,
4654,
486,
931,
6615,
6714,
7,
19,
11,
220,
17,
11,
431,
9511,
486,
55954,
317,
310,
1077,
293,
17,
284,
4654,
486,
931,
6615,
6714,
7,
17,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sub_carry_assign_binary()
{
let mut d = BinaryDigit(47u8);
let overflow = d.sub_carry_assign(BinaryDigit(0), false);
assert!(!overflow);
assert_eq!(d, BinaryDigit(47));
let mut d = BinaryDigit(0x80u8);
let overflow = d.sub_carry_assign(BinaryDigit(0x7f), false);
assert!(!overflow);
assert_eq!(d, BinaryDigit(1));
let mut d = BinaryDigit(0x80u8);
let overflow = d.sub_carry_assign(BinaryDigit(0x7f), true);
assert!(!overflow);
assert_eq!(d, BinaryDigit(0));
let mut d = BinaryDigit(0x80u8);
let overflow = d.sub_carry_assign(BinaryDigit(0x80), true);
assert!(overflow);
assert_eq!(d, BinaryDigit(0xff));
let mut d = BinaryDigit(0x7fu8);
let overflow = d.sub_carry_assign(BinaryDigit(0x80), false);
assert!(overflow);
assert_eq!(d, BinaryDigit(0xff));
let mut d = BinaryDigit(0x80u8);
let overflow = d.sub_carry_assign(BinaryDigit(0x85), true);
assert!(overflow);
assert_eq!(d, BinaryDigit(0xfa));
let mut d = BinaryDigit(0xff00u16);
let overflow = d.sub_carry_assign(BinaryDigit(0x80), false);
assert!(!overflow);
assert_eq!(d, BinaryDigit(0xfe80));
let mut d = BinaryDigit(0x8000u16);
let overflow = d.sub_carry_assign(BinaryDigit(0xff00), true);
assert!(overflow);
assert_eq!(d, BinaryDigit(0x80ff));
let mut d = BinaryDigit(0xff001180u32);
let overflow = d.sub_carry_assign(BinaryDigit(0xff001100), false);
assert!(!overflow);
assert_eq!(d, BinaryDigit(0x80));
let mut d = BinaryDigit(0x7fab2468u32);
let overflow = d.sub_carry_assign(BinaryDigit(0xffab1234), true);
assert!(overflow);
assert_eq!(d, BinaryDigit(0x80001233));
} | rust_cleaned_test_functions.jsonl/26391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 940
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
666,
11433,
20688,
31761,
741,
262,
341,
286,
1077,
5206,
294,
284,
17718,
36420,
7,
19,
22,
84,
23,
317,
286,
1077,
16484,
284,
294,
4309,
666,
11433,
20688,
77833,
36420,
7,
15,
701,
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_uncompressed() {
let gt =
pairing(&G1Affine::generator(), &G2Affine::generator()) * Scalar::from_raw([1, 2, 3, 4]);
let buf = gt.to_uncompressed();
let gt2 = Gt::from_uncompressed(&buf).unwrap();
assert_eq!(gt, gt2);
let gt =
pairing(&G1Affine::generator(), &G2Affine::generator()) * Scalar::from_raw([1, 2, 3, 5]);
let buf = gt.to_uncompressed();
let gt2 = Gt::from_uncompressed(&buf).unwrap();
assert_eq!(gt, gt2);
} | rust_cleaned_test_functions.jsonl/30788 | {
"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,
4907,
45703,
368,
341,
262,
1077,
25161,
4035,
286,
47713,
2099,
38,
16,
25841,
482,
486,
35851,
1507,
609,
38,
17,
25841,
482,
486,
35851,
2140,
353,
35176,
486,
1499,
16067,
2561,
16,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_bitcode_to_path() {
let mut path = temp_dir();
path.push("temp.bc");
let context = Context::create();
let module = context.create_module("my_module");
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[], false);
module.add_function("my_fn", fn_type, None);
module.write_bitcode_to_path(&path);
let mut contents = Vec::new();
let mut file = File::open(&path).expect("Could not open temp file");
file.read_to_end(&mut contents).expect("Unable to verify written file");
assert!(!contents.is_empty());
remove_file(&path).unwrap();
} | rust_cleaned_test_functions.jsonl/63532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
13996,
1851,
2346,
2638,
368,
341,
262,
1077,
5206,
1815,
284,
2730,
4334,
1428,
262,
1815,
2552,
445,
3888,
84493,
3071,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
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_denormal_symlink() {
let normal = ["/", "/usr", "../usr/bin/blah"];
let denormal = ["../../usr/sbin//chkconfig", "foo//bar/baz"];
for path in normal {
assert!(!symlink_is_denormal(path));
}
for path in denormal {
assert!(symlink_is_denormal(path));
}
} | rust_cleaned_test_functions.jsonl/42841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49522,
2492,
58530,
44243,
368,
341,
286,
1077,
4622,
284,
508,
3115,
497,
3521,
7063,
497,
7005,
7063,
8749,
14,
70614,
6332,
286,
1077,
3371,
2492,
284,
4383,
2748,
7063,
72435,
322,
35896,
1676... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_identity_vector() {
fn prop_transform(val: Vec<f64>) -> bool {
let t = Identity.transform(Array1::from(val.clone()));
t.into_iter()
.zip(val.into_iter())
.all(|(v1, v2)| (v1 - v2).abs() < 1e-7)
}
fn prop_grad(val: Vec<f64>) -> bool {
let g = Identity.grad(Array1::from(val));
g.into_iter().all(|v| (v - 1.0).abs() < 1e-7)
}
quickcheck(prop_transform as fn(Vec<f64>) -> bool);
quickcheck(prop_grad as fn(Vec<f64>) -> bool);
} | rust_cleaned_test_functions.jsonl/78486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46244,
12247,
368,
341,
286,
5168,
2004,
18449,
9098,
25,
11312,
63895,
21,
19,
9231,
1464,
1807,
341,
310,
1077,
259,
284,
26540,
8134,
38192,
16,
486,
1499,
9098,
15997,
25138,
310,
259,
39860,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fr_pow() {
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
0xe5,
]);
for i in 0u64..1000 {
// Exponentiate by various small numbers and ensure it consists with repeated
// multiplication.
let a = Fr::random(&mut rng);
let target = a.pow_vartime(&[i]);
let mut c = Fr::one();
for _ in 0..i {
c.mul_assign(&a);
}
assert_eq!(c, target);
}
for _ in 0..1000 {
// Exponentiating by the modulus should have no effect in a prime field.
let a = Fr::random(&mut rng);
assert_eq!(a, a.pow_vartime(Fr::char()));
}
} | rust_cleaned_test_functions.jsonl/100654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
56183,
368,
341,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
286,
220,
15,
87,
20,
24,
11,
220,
15,
87,
21,
17,
11,
220,
15,
42459,
11,
220,
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... | 4 |
#[test]
fn test_pattern_matching() {
let hlist_pat!(one1) = hlist!["one"];
assert_eq!(one1, "one");
let hlist_pat!(one2,) = hlist!["one"];
assert_eq!(one2, "one");
let h = hlist![5, 3.2f32, true, "blue".to_owned()];
let hlist_pat!(five, float, right, s) = h;
assert_eq!(five, 5);
assert_eq!(float, 3.2f32);
assert_eq!(right, true);
assert_eq!(s, "blue".to_owned());
let h2 = hlist![13.5f32, "hello", Some(41)];
let hlist_pat![a, b, c,] = h2;
assert_eq!(a, 13.5f32);
assert_eq!(b, "hello");
assert_eq!(c, Some(41));
} | rust_cleaned_test_functions.jsonl/24751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21260,
70763,
368,
341,
286,
1077,
305,
1607,
55824,
10297,
603,
16,
8,
284,
305,
1607,
0,
1183,
603,
6332,
286,
2060,
10714,
10297,
603,
16,
11,
330,
603,
797,
286,
1077,
305,
1607,
55824,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_docker_context_env() -> io::Result<()> {
let cfg_dir = tempfile::tempdir()?;
let actual = ModuleRenderer::new("docker_context")
.env("DOCKER_CONTEXT", "starship")
.config(toml::toml! {
[docker_context]
only_with_files = false
})
.collect();
let expected = Some(format!("via {} ", Color::Blue.bold().paint("🐳 starship")));
assert_eq!(expected, actual);
cfg_dir.close()
} | rust_cleaned_test_functions.jsonl/18774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
13659,
8467,
15879,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
13286,
4334,
284,
54819,
486,
3888,
3741,
368,
69493,
286,
1077,
5042,
284,
13711,
11541,
486,
931,
445,
28648,
8467,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_channel_kind() {
assert_eq!(
Channel::Guild(GuildChannel::Category(guild_category())).kind(),
ChannelType::GuildCategory
);
assert_eq!(
Channel::Guild(GuildChannel::Stage(guild_stage())).kind(),
ChannelType::GuildStageVoice
);
assert_eq!(
Channel::Guild(GuildChannel::Text(guild_text())).kind(),
ChannelType::GuildText
);
assert_eq!(
Channel::Guild(GuildChannel::Stage(guild_voice())).kind(),
ChannelType::GuildVoice
);
assert_eq!(Channel::Group(group()).kind(), ChannelType::Group);
assert_eq!(Channel::Private(private()).kind(), ChannelType::Private);
} | rust_cleaned_test_functions.jsonl/54430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14571,
33162,
368,
341,
286,
2060,
10714,
33673,
310,
13434,
486,
72574,
6699,
1498,
9629,
486,
6746,
92103,
11847,
34670,
15314,
3148,
310,
13434,
929,
486,
72574,
6746,
198,
286,
1439,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec3_hmin_hmax() {
let a = vec3(-1.0, 2.0, -3.0);
assert_eq!(-3.0, a.min_element());
assert_eq!(2.0, a.max_element());
} | rust_cleaned_test_functions.jsonl/48589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
1523,
1065,
1523,
2810,
368,
341,
262,
1077,
264,
284,
7486,
18,
4080,
16,
13,
15,
11,
220,
17,
13,
15,
11,
481,
18,
13,
15,
317,
262,
2060,
10714,
0,
4080,
18,
13,
15,
11,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lockfile_toml() {
let ver_file = VersionFile {
filename: "Cargo.toml".to_string(),
version_value: "0.1.2".to_version().unwrap(),
version_filetype: VersionFiletype::TOML,
lockfile: Some("Cargo.lock".to_string()),
};
assert_eq!(
ver_file.get_tracked_files(),
vec!["Cargo.toml", "Cargo.lock"]
);
} | rust_cleaned_test_functions.jsonl/46668 | {
"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,
3062,
9818,
1192,
528,
316,
75,
368,
341,
286,
1077,
2739,
2458,
284,
6079,
1703,
341,
310,
3899,
25,
330,
98228,
73494,
75,
3263,
983,
3904,
3148,
310,
2319,
3142,
25,
330,
15,
13,
16,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_warn() -> anyhow::Result<()> {
let conf = ConsoleConfig { assume_yes: true };
let mut cnsl = Console::buf(conf);
cnsl.warn("message")?;
let output_str = cnsl.take_output()?;
assert_eq!(output_str, "WARN: message\n");
Ok(())
} | rust_cleaned_test_functions.jsonl/110897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55045,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
2335,
284,
5277,
2648,
314,
9658,
59744,
25,
830,
2605,
286,
1077,
5206,
13665,
3226,
284,
5277,
486,
5909,
29879,
317,
286,
13665,
3226,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_derive_api_version() {
let mut record = TestRequest::default();
record.value2 = 10;
record.value3 = 5;
// version 0 should only encode value
let mut dest = vec![];
record.encode(&mut dest,0).expect("encode");
assert_eq!(dest.len(),1);
let mut dest = vec![];
record.encode(&mut dest,1).expect("encode");
assert_eq!(dest.len(),3);
let mut dest = vec![];
record.encode(&mut dest,2).expect("encode");
assert_eq!(dest.len(),2);
assert_eq!(dest[1],5);
} | rust_cleaned_test_functions.jsonl/39228 | {
"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,
35345,
533,
11697,
9438,
368,
1476,
262,
1077,
5206,
3255,
284,
3393,
1900,
486,
2258,
543,
262,
3255,
2824,
17,
284,
220,
16,
15,
280,
262,
3255,
2824,
18,
284,
220,
20,
401,
262,
442,
2319,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_schema_name() {
// Invalid name "0000" does not match [A-Za-z_][A-Za-z0-9_]*
let schema = Schema::parse_str(
r#"{"type": "enum", "name": "Enum", "symbols": ["0000", "variant"]}"#,
);
assert!(schema.is_err());
} | rust_cleaned_test_functions.jsonl/108442 | {
"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,
31054,
25371,
1269,
368,
341,
286,
442,
13882,
829,
330,
15,
15,
15,
15,
1,
1558,
537,
2432,
508,
32,
39279,
9141,
62,
1457,
32,
39279,
9141,
15,
12,
24,
74827,
5618,
286,
1077,
10802,
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_aes_encrypt_decrypt_correctness() {
let key = AeKey::random(&mut OsRng);
let amount = 55;
let ct = key.encrypt(amount);
let decrypted_amount = ct.decrypt(&key).unwrap();
assert_eq!(amount, decrypted_amount);
} | rust_cleaned_test_functions.jsonl/132685 | {
"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,
90958,
66593,
80764,
31550,
2090,
368,
341,
286,
1077,
1376,
284,
89795,
1592,
486,
11463,
2099,
6984,
15433,
49,
968,
317,
286,
1077,
3311,
284,
220,
20,
20,
401,
286,
1077,
20251,
284,
1376,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_draws_from_input_file() {
let mut bingo_game = BingoGame::new();
bingo_game.read_lines_from_input_file("sample_input.txt");
assert_eq!(bingo_game.draws.len(), 27);
} | rust_cleaned_test_functions.jsonl/107888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
23021,
82,
5673,
5898,
2458,
368,
341,
286,
1077,
5206,
77024,
18547,
284,
92048,
4868,
486,
931,
543,
286,
77024,
18547,
4125,
18323,
5673,
5898,
2458,
445,
13611,
5898,
3909,
3071,
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,
1
] | 1 |
#[test]
fn test_latest_standard_a() {
let bss = fake_bss!(Open,
chan: fidl_common::WlanChan {
primary: 36,
secondary80: 0,
cbw: fidl_common::Cbw::Cbw20,
},
rates: vec![48],
ies_overrides: IesOverrides::new()
.remove(IeType::HT_CAPABILITIES)
.remove(IeType::HT_OPERATION)
.remove(IeType::VHT_CAPABILITIES)
.remove(IeType::VHT_OPERATION),
);
assert_eq!(Standard::Dot11A, bss.latest_standard());
} | rust_cleaned_test_functions.jsonl/60270 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64880,
48688,
4306,
368,
341,
286,
1077,
293,
778,
284,
12418,
880,
778,
10297,
5002,
345,
310,
26023,
25,
32104,
75,
21107,
486,
54,
10715,
46019,
341,
394,
6028,
25,
220,
18,
21,
345,
394,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_partition_size_1_1_4096_1() {
let partition_size = gen_partition_size(1.0, 1, 4096.0, 1);
assert_eq!(1, partition_size);
} | rust_cleaned_test_functions.jsonl/7864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
43840,
2368,
62,
16,
62,
16,
62,
19,
15,
24,
21,
62,
16,
368,
341,
286,
1077,
16658,
2368,
284,
4081,
43840,
2368,
7,
16,
13,
15,
11,
220,
16,
11,
220,
19,
15,
24,
21,
13,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.