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_unexpected_token() {
match Json::from_str("{\"\":\"\",\"\":{\"\":\"\",\"\":[{\"\":\"\",}}}") {
Err(e) => assert_eq!(e, SyntaxError(InvalidSyntax, 1, 32)),
_ => ()
};
} | rust_cleaned_test_functions.jsonl/22770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
7325,
6458,
368,
341,
286,
2432,
8308,
486,
1499,
2895,
99141,
23488,
34333,
92729,
23488,
16215,
22245,
8899,
64238,
23488,
16215,
3417,
55961,
341,
310,
15495,
2026,
8,
589,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_msi_interrupt_group() {
let vmfd = Arc::new(create_vm_fd());
vmfd.create_irq_chip().unwrap();
let rounting = Arc::new(KvmIrqRouting::new(vmfd.clone()));
rounting.initialize().unwrap();
let base = 168;
let count = 32;
let group = MsiIrq::new(
base,
count,
DEFAULT_MAX_MSI_IRQS_PER_DEVICE,
vmfd.clone(),
rounting.clone(),
)
.unwrap();
let mut msi_fds = Vec::with_capacity(count as usize);
match group.interrupt_type() {
InterruptSourceType::MsiIrq => {}
_ => {
panic!();
}
}
for _ in 0..count {
let msi_source_config = MsiIrqSourceConfig {
high_addr: 0x1234,
low_addr: 0x5678,
data: 0x9876,
msg_ctl: 0x6789,
device_id: None,
};
msi_fds.push(InterruptSourceConfig::MsiIrq(msi_source_config));
}
group.enable(&msi_fds).unwrap();
assert_eq!(group.len(), count);
assert_eq!(group.base(), base);
for i in 0..count {
let msi_source_config = MsiIrqSourceConfig {
high_addr: i + 0x1234,
low_addr: i + 0x5678,
data: i + 0x9876,
msg_ctl: i + 0x6789,
device_id: None,
};
group.notifier(i).unwrap().write(1).unwrap();
group.trigger(i).unwrap();
group
.update(0, &InterruptSourceConfig::MsiIrq(msi_source_config))
.unwrap();
}
assert!(group.trigger(33).is_err());
group.disable().unwrap();
assert!(MsiIrq::new(
base,
DEFAULT_MAX_MSI_IRQS_PER_DEVICE + 1,
DEFAULT_MAX_MSI_IRQS_PER_DEVICE,
vmfd.clone(),
rounting.clone()
)
.is_err());
assert!(MsiIrq::new(1100, 1, DEFAULT_MAX_MSI_IRQS_PER_DEVICE, vmfd, rounting).is_err());
} | rust_cleaned_test_functions.jsonl/106064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
6321,
42606,
6288,
368,
341,
286,
1077,
10995,
6902,
284,
19689,
486,
931,
32602,
39008,
17676,
1423,
286,
10995,
6902,
2520,
22623,
49514,
1005,
15454,
1428,
286,
1077,
435,
629,
287,
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... | 4 |
#[test]
fn test_try_recv() {
let data = data_lots_of_data().take(100).collect::<Vec<_>>();
// Populate a queue:
let mut sender = SenderBuilder::new()
.segment_size(512)
.open("data/try-recv")
.unwrap();
sender.try_send_batch(&data[..25]).unwrap();
let mut receiver = Receiver::open("data/try-recv").unwrap();
let mut count = 0;
loop {
match receiver.try_recv() {
Ok(item) => {
assert_eq!(&*item, &data[count]);
item.commit().unwrap();
count += 1;
}
Err(TryRecvError::Io(err)) => Err(err).unwrap(),
Err(TryRecvError::QueueEmpty) => break,
}
}
assert_eq!(count, 25);
} | rust_cleaned_test_functions.jsonl/95836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
36118,
368,
341,
286,
1077,
821,
284,
821,
907,
2412,
3575,
1769,
1005,
22769,
7,
16,
15,
15,
568,
17384,
27638,
10050,
32399,
79279,
286,
442,
70938,
264,
7177,
510,
286,
1077,
5206,
464... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_service() {
#[derive(Serialize, Deserialize, Debug)]
struct TestServicePayload {
name: String,
age: u64,
sex: bool,
}
#[derive(Serialize, Deserialize, Debug, Default)]
struct TestServiceResponse {
pub message: String,
}
struct Tests<SDK: ServiceSDK> {
_sdk: SDK,
genesis_data: String,
hook_before: bool,
hook_after: bool,
}
#[service]
impl<SDK: ServiceSDK> Tests<SDK> {
#[genesis]
fn init_genesis(&mut self) {
self.genesis_data = "genesis".to_owned();
}
#[hook_before]
fn custom_hook_before(&mut self, _params: &ExecutorParams) {
self.hook_before = true;
}
#[hook_after]
fn custom_hook_after(&mut self, _params: &ExecutorParams) {
self.hook_after = true;
}
#[read]
fn test_read(
&self,
_ctx: ServiceContext,
_payload: TestServicePayload,
) -> ServiceResponse<TestServiceResponse> {
let res = TestServiceResponse {
message: "read ok".to_owned(),
};
ServiceResponse::<TestServiceResponse>::from_succeed(res)
}
#[write]
fn test_write(
&mut self,
_ctx: ServiceContext,
_payload: TestServicePayload,
) -> ServiceResponse<TestServiceResponse> {
let res = TestServiceResponse {
message: "write ok".to_owned(),
};
ServiceResponse::<TestServiceResponse>::from_succeed(res)
}
}
let payload = TestServicePayload {
name: "test".to_owned(),
age: 10,
sex: false,
};
let payload_str = serde_json::to_string(&payload).unwrap();
let sdk = MockServiceSDK {};
let mut test_service = Tests {
_sdk: sdk,
genesis_data: "".to_owned(),
hook_after: false,
hook_before: false,
};
test_service.genesis_("".to_owned());
assert_eq!(test_service.genesis_data, "genesis");
let context = get_context(1024 * 1024, "", "test_write", &payload_str);
let write_res = test_service.write_(context).succeed_data;
assert_eq!(write_res, r#"{"message":"write ok"}"#);
let context = get_context(1024 * 1024, "", "test_read", &payload_str);
let read_res = test_service.read_(context).succeed_data;
assert_eq!(read_res, r#"{"message":"read ok"}"#);
let context = get_context(1024 * 1024, "", "test_notfound", &payload_str);
let read_res = panic::catch_unwind(AssertUnwindSafe(|| test_service.read_(context.clone())));
assert_eq!(read_res.unwrap().is_error(), true);
let write_res = panic::catch_unwind(AssertUnwindSafe(|| test_service.write_(context)));
assert_eq!(write_res.unwrap().is_error(), true);
test_service.hook_before_(&mock_executor_params());
assert_eq!(test_service.hook_before, true);
test_service.hook_after_(&mock_executor_params());
assert_eq!(test_service.hook_after, true);
} | rust_cleaned_test_functions.jsonl/11475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1451
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12267,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
11091,
5563,
262,
2036,
3393,
1860,
29683,
341,
286,
829,
25,
923,
345,
286,
4231,
25,
220,
575,
21,
19,
345,
286,
1839,
25,
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_latest_entry_check_gc_fence() {
let engine = TestEngineBuilder::new().build().unwrap();
let (read_ts, expected_result) = prepare_test_data_for_check_gc_fence(&engine);
let expected_result: Vec<_> = expected_result
.into_iter()
.filter_map(|(key, value)| value.map(|v| (key, v)))
.collect();
let snapshot = engine.snapshot(Default::default()).unwrap();
let mut scanner = ScannerBuilder::new(snapshot, read_ts, false)
.range(None, None)
.build_entry_scanner(0.into(), false)
.unwrap();
let mut result = EntryBatch::with_capacity(20);
scanner.scan_entries(&mut result).unwrap();
let result: Vec<_> = result
.drain()
.map(|entry| entry.into_kvpair().unwrap())
.collect();
assert_eq!(result, expected_result);
} | rust_cleaned_test_functions.jsonl/88841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64880,
9078,
7200,
49423,
81073,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
1428,
286,
1077,
320,
878,
25023,
11,
3601,
5287,
8,
284,
10549,
4452,
1769,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
assert_eq!(
Ok(Date::YMD {
year: 2015,
month: 6,
day: 26,
}),
date("2015-06-26")
);
assert_eq!(
Ok(Date::YMD {
year: -333,
month: 7,
day: 11,
}),
date("-0333-07-11")
);
} | rust_cleaned_test_functions.jsonl/16736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
368,
341,
262,
2060,
10714,
33673,
286,
7622,
19987,
486,
56,
6076,
341,
310,
1042,
25,
220,
17,
15,
16,
20,
345,
310,
2254,
25,
220,
21,
345,
310,
1899,
25,
220,
17,
21,
345,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intervals_firstwords_bold() {
let words = vec!["a", "b", "c", "d", "e"]
.iter()
.map(|x| x.to_string())
.collect();
let intervals = vec![(0, 1)].to_interval_set();
assert_eq!(
get_boldtext_segments_from_intervals(&words, &intervals),
vec![
TextMaybeBold {
text: "a b".to_string(),
is_bold: true
},
TextMaybeBold {
text: "c d e".to_string(),
is_bold: false
}
]
);
} | rust_cleaned_test_functions.jsonl/119099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90807,
12978,
5761,
95677,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
64,
497,
330,
65,
497,
330,
66,
497,
330,
67,
497,
330,
68,
7026,
310,
659,
2015,
741,
310,
659,
2186,
22428,
87,
91... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_strh_reg_w() {
assert_eq!(
decode_32(0xf826c019),
Instruction::STRH_reg {
params: Reg3FullParams {
rt: Reg::R12,
rn: Reg::R6,
rm: Reg::R9,
index: true,
add: true,
wback: false,
shift_n: 1,
shift_t: SRType::LSL,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64831 | {
"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,
15227,
2895,
71,
4920,
1670,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
5848,
23,
17,
21,
66,
15,
16,
24,
1326,
286,
29051,
486,
6666,
39,
4920,
341,
310,
3628,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tokenizer_empty() {
let test_str = "";
let tokens: Vec<Token> = Tokens::from_str(test_str).collect();
assert_eq!(tokens, vec![]);
} | rust_cleaned_test_functions.jsonl/109313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
3135,
15124,
368,
341,
262,
1077,
1273,
2895,
284,
5438,
262,
1077,
11211,
25,
11312,
83416,
29,
284,
58166,
486,
1499,
2895,
8623,
2895,
568,
17384,
543,
262,
2060,
10714,
10297,
30566,
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 |
#[test]
fn test_no_options_big_input() {
for &n in &[
0,
1,
42,
16 * 1024 - 7,
16 * 1024 - 1,
16 * 1024,
16 * 1024 + 1,
16 * 1024 + 3,
32 * 1024,
64 * 1024,
80 * 1024,
96 * 1024,
112 * 1024,
128 * 1024,
] {
let data = vec_of_size(n);
let data2 = data.clone();
assert_eq!(data.len(), data2.len());
new_ucmd!().pipe_in(data).succeeds().stdout_is_bytes(&data2);
}
} | rust_cleaned_test_functions.jsonl/90925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
8743,
36386,
5898,
368,
341,
262,
369,
609,
77,
304,
609,
9640,
286,
220,
15,
345,
286,
220,
16,
345,
286,
220,
19,
17,
345,
286,
220,
16,
21,
353,
220,
16,
15,
17,
19,
481,
220,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_extract_fields() {
let rec = StringRecord::from(vec!["Captain", "Sham", "12345"]);
assert_eq!(extract_fields(&rec, &[0..1]), &["Captain"]);
assert_eq!(extract_fields(&rec, &[1..2]), &["Sham"]);
assert_eq!(
extract_fields(&rec, &[0..1, 2..3]),
&["Captain", "12345"]
);
assert_eq!(extract_fields(&rec, &[0..1, 3..4]), &["Captain"]);
assert_eq!(extract_fields(&rec, &[1..2, 0..1]), &["Sham", "Captain"]);
} | rust_cleaned_test_functions.jsonl/34699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
12132,
368,
341,
286,
1077,
1395,
284,
923,
6471,
486,
1499,
25592,
0,
1183,
61058,
497,
330,
2016,
309,
497,
330,
16,
17,
18,
19,
20,
15049,
286,
2060,
10714,
10297,
23493,
12132,
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... | 1 |
#[test]
fn test_eth_offset() {
let offsets = SecpSignatureOffsets {
eth_address_offset: std::u16::MAX,
..SecpSignatureOffsets::default()
};
assert_eq!(
test_case(1, &offsets),
Err(Secp256k1Error::InvalidSignature)
);
let offsets = SecpSignatureOffsets {
eth_address_offset: 100 - HASHED_PUBKEY_SERIALIZED_SIZE as u16 + 1,
..SecpSignatureOffsets::default()
};
assert_eq!(
test_case(1, &offsets),
Err(Secp256k1Error::InvalidSignature)
);
} | rust_cleaned_test_functions.jsonl/47859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57757,
6917,
368,
341,
286,
1077,
35046,
284,
4520,
79,
25088,
81095,
341,
310,
8372,
6744,
6917,
25,
1460,
486,
84,
16,
21,
486,
10586,
345,
310,
5241,
8430,
79,
25088,
81095,
486,
2258,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contains_failing() {
let mut output = String::new();
let method = StringMethod {
method: "contains",
variable: "$FOO",
pattern: "\"OBI\"",
selection: Select::All,
};
method.handle(&mut output, &VariableExpander);
assert_eq!(output, "0");
} | rust_cleaned_test_functions.jsonl/85270 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
761,
14277,
368,
341,
286,
1077,
5206,
2550,
284,
923,
486,
931,
543,
286,
1077,
1714,
284,
923,
3523,
341,
310,
1714,
25,
262,
330,
13372,
756,
310,
3890,
25,
220,
5201,
3788,
46,
756,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_vrq_f2_00_02() {
#[cfg(feature = "v3")]
init_psa_crypto();
assert!(Voucher::try_from(VRQ_F2_00_02)
.unwrap()
.validate(Some(DEVICE_CRT_F2_00_02))
.is_ok());
} | rust_cleaned_test_functions.jsonl/81743 | {
"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,
42681,
2273,
52189,
761,
17,
62,
15,
15,
62,
15,
17,
368,
341,
262,
11506,
14072,
27062,
284,
330,
85,
18,
5422,
262,
2930,
620,
9081,
78298,
1428,
262,
2060,
10297,
53,
23937,
486,
1539,
5673... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_add_columns() {
let values = vec![Array::new(vec![1, 2, 3]), Array::new(vec![4., 5., 6.])];
let mut df = DataFrame::from_vec(values, vec!["A", "BB", "CC"], vec!["X", "Y"]);
assert_eq!(df.len(), 3);
df.insert(Array::new(vec![10, 11, 12]), "Z");
let exp_values = vec![
Array::new(vec![1, 2, 3]),
Array::new(vec![4., 5., 6.]),
Array::new(vec![10, 11, 12]),
];
let exp = DataFrame::from_vec(exp_values, vec!["A", "BB", "CC"], vec!["X", "Y", "Z"]);
assert_eq!(df.values, exp.values);
assert_eq!(df.index, exp.index);
assert_eq!(df.columns, exp.columns);
} | rust_cleaned_test_functions.jsonl/33493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
2891,
22590,
368,
341,
286,
1077,
2750,
284,
7486,
20703,
1857,
486,
931,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
9719,
2910,
486,
931,
25592,
20703,
19,
2572,
220,
20,
2572,
220,
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_read_name() -> io::Result<()> {
let mut buf = Vec::new();
let data = b"@r0\n";
let mut reader = &data[..];
buf.clear();
read_name(&mut reader, &mut buf)?;
assert_eq!(buf, b"r0");
let data = b"r0\n";
let mut reader = &data[..];
buf.clear();
assert!(matches!(
read_name(&mut reader, &mut buf),
Err(ref e) if e.kind() == io::ErrorKind::InvalidData
));
Ok(())
} | rust_cleaned_test_functions.jsonl/28635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
1269,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
5206,
6607,
284,
11312,
486,
931,
1428,
286,
1077,
821,
284,
293,
96270,
81,
15,
1699,
876,
286,
1077,
5206,
6604,
284,
609,
691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_dep_info_abs_paths() {
let deps = "/foo/foo: /foo/baz.rs /foo/abc.rs /foo/bar.rs
/foo/baz.rs:
/foo/abc.rs:
/foo/bar.rs:
";
assert_eq!(
pathvec!["/foo/abc.rs", "/foo/bar.rs", "/foo/baz.rs"],
parse_dep_info(&deps, "/bar/")
);
} | rust_cleaned_test_functions.jsonl/8168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
49258,
3109,
31170,
24152,
368,
341,
286,
1077,
48178,
284,
3521,
7975,
60555,
25,
608,
7975,
3470,
1370,
25638,
608,
7975,
14,
13683,
25638,
608,
7975,
49513,
25638,
271,
60555,
3470,
1370,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gcd() {
assert_eq!(0, 0u8.gcd(0));
assert_eq!(10, 10u8.gcd(0));
assert_eq!(10, 0u8.gcd(10));
assert_eq!(10, 10u8.gcd(20));
assert_eq!(44, 2024u32.gcd(748));
} | rust_cleaned_test_functions.jsonl/106055 | {
"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,
1889,
4385,
368,
341,
286,
2060,
10714,
10297,
15,
11,
220,
15,
84,
23,
1302,
4385,
7,
15,
1106,
286,
2060,
10714,
10297,
16,
15,
11,
220,
16,
15,
84,
23,
1302,
4385,
7,
15,
1106,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call_hierarchy_outgoing_in_different_files() {
check_hierarchy(
r#"
//- /lib.rs
mod foo;
use foo::callee;
fn call$0er() {
callee();
}
//- /foo/mod.rs
pub fn callee() {}
"#,
expect![["caller Function FileId(0) 27..56 30..36"]],
expect![[]],
expect![["callee Function FileId(1) 0..18 7..13 : [45..51]"]],
);
} | rust_cleaned_test_functions.jsonl/38291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
95043,
6068,
9546,
1243,
82741,
10931,
368,
341,
286,
1779,
95043,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
280,
810,
15229,
486,
86476,
401,
8822,
1618,
3,
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_snmp_v1_trap_coldstart() {
let bytes = SNMPV1_TRAP_COLDSTART;
match parse_snmp_v1(bytes) {
Ok((rem,pdu)) => {
assert!(rem.is_empty());
assert_eq!(pdu.version, 0);
assert_eq!(&pdu.community as &str, "public");
assert_eq!(pdu.pdu_type(), PduType::TrapV1);
match pdu.pdu {
SnmpPdu::TrapV1(trap) => {
assert_eq!(trap.enterprise, Oid::from(&[1, 3, 6, 1, 4, 1, 4, 1, 2, 21]));
assert_eq!(trap.agent_addr, NetworkAddress::IPv4(Ipv4Addr::new(127,0,0,1)));
}
_ => assert!(false),
}
},
e => { eprintln!("Error: {:?}",e); assert!(false);}
}
} | rust_cleaned_test_functions.jsonl/46706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28022,
1307,
2273,
16,
88536,
666,
813,
2468,
368,
341,
262,
1077,
5820,
284,
88133,
53,
16,
6410,
2537,
920,
7863,
22564,
280,
262,
2432,
4715,
28022,
1307,
2273,
16,
23158,
8,
341,
286,
7622,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_to_ndarray_rgb() {
let test_file = dicom_test_files::path("pydicom/SC_rgb_16bit.dcm").unwrap();
let obj = open_file(test_file).unwrap();
let ndarray = obj
.decode_pixel_data()
.unwrap()
.to_ndarray::<u16>()
.unwrap();
assert_eq!(ndarray.shape(), &[1, 100, 100, 3]);
assert_eq!(ndarray.len(), 30000);
assert_eq!(ndarray[[0, 50, 80, 1]], 32896);
} | rust_cleaned_test_functions.jsonl/22480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
43544,
1653,
37407,
368,
341,
286,
1077,
1273,
2458,
284,
21249,
316,
4452,
10931,
486,
2343,
445,
3288,
29680,
316,
14,
3540,
37407,
62,
16,
21,
4489,
950,
6226,
1827,
15454,
543,
286,
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_extract_username_from_url() {
assert_eq!(
extract_cred_from_url("https://user@github.com"),
BasicAuthCredential::new(Some("user".to_owned()), None)
);
} | rust_cleaned_test_functions.jsonl/101750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
21588,
5673,
2903,
368,
341,
197,
6948,
10714,
33673,
298,
8122,
2144,
73475,
5673,
2903,
445,
2428,
1110,
872,
31,
5204,
905,
4461,
298,
12791,
5971,
5087,
48265,
486,
931,
65405,
445,
872... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_splice() {
const CONTENTS: &[u8] = b"abcdef123456";
let mut tmp = tempfile().unwrap();
tmp.write_all(CONTENTS).unwrap();
let (rd, wr) = pipe().unwrap();
let mut offset: loff_t = 5;
let res = splice(tmp.as_raw_fd(), Some(&mut offset),
wr, None, 2, SpliceFFlags::empty()).unwrap();
assert_eq!(2, res);
let mut buf = [0u8; 1024];
assert_eq!(2, read(rd, &mut buf).unwrap());
assert_eq!(b"f1", &buf[0..2]);
assert_eq!(7, offset);
close(rd).unwrap();
close(wr).unwrap();
} | rust_cleaned_test_functions.jsonl/91358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
4754,
368,
341,
286,
733,
35768,
50,
25,
44590,
84,
23,
60,
284,
293,
1,
41202,
16,
17,
18,
19,
20,
21,
876,
286,
1077,
5206,
4174,
284,
54819,
1005,
15454,
543,
286,
4174,
3836,
5705... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_state_with_pending_credential_request() {
init!("true");
let connection_handle = build_test_connection();
let credential_req:CredentialRequest = CredentialRequest::from_str(CREDENTIAL_REQ_STRING).unwrap();
let (credential_offer, _) = ::credential::parse_json_offer(CREDENTIAL_OFFER_JSON).unwrap();
let mut credential = IssuerCredential {
source_id: "test_has_pending_credential_request".to_owned(),
schema_seq_no: 32,
msg_uid: "1234".to_owned(),
credential_attributes: "nothing".to_owned(),
issuer_did: "QTrbV4raAcND4DWWzBmdsh".to_owned(),
issued_did: "8XFh8yBzrpJQmNyZzgoTqB".to_owned(),
issued_vk: VERKEY.to_string(),
state: VcxStateType::VcxStateOfferSent,
credential_request: Some(credential_req.to_owned()),
credential_offer: Some(credential_offer.to_owned()),
credential_name: DEFAULT_CREDENTIAL_NAME.to_owned(),
credential_id: String::from(DEFAULT_CREDENTIAL_ID),
cred_def_id: CRED_DEF_ID.to_string(),
cred_def_handle: 1,
ref_msg_id: None,
rev_reg_id: None,
cred_rev_id: None,
rev_cred_payment_txn: None,
rev_reg_def_json: None,
tails_file: None,
price: 0,
payment_address: None,
remote_did: DID.to_string(),
remote_vk: VERKEY.to_string(),
agent_did: DID.to_string(),
agent_vk: VERKEY.to_string(),
};
::utils::httpclient::set_next_u8_response(CREDENTIAL_REQ_RESPONSE.to_vec());
::utils::httpclient::set_next_u8_response(UPDATE_CREDENTIAL_RESPONSE.to_vec());
credential.update_state().unwrap();
assert_eq!(credential.get_state(), VcxStateType::VcxStateRequestReceived as u32);
} | rust_cleaned_test_functions.jsonl/104599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 963
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
4387,
6615,
37861,
666,
30320,
7893,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3633,
10630,
284,
1936,
4452,
15866,
543,
286,
1077,
40207,
17644,
25,
48265,
1900,
284,
93379,
1900,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sha256_with_empty_context_and_nonempty_input() {
let context = TestContext::new(&[]);
let data = b"data";
let mut state = Sha256::new_with_context(&context);
state.write(data);
let digest = state.finish();
assert_eq!(
digest,
[
0x3a, 0x6e, 0xb0, 0x79, 0xf, 0x39, 0xac, 0x87, 0xc9, 0x4f, 0x38, 0x56, 0xb2, 0xdd,
0x2c, 0x5d, 0x11, 0xe, 0x68, 0x11, 0x60, 0x22, 0x61, 0xa9, 0xa9, 0x23, 0xd3, 0xbb,
0x23, 0xad, 0xc8, 0xb7,
]
);
} | rust_cleaned_test_functions.jsonl/10227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48836,
17,
20,
21,
6615,
15124,
8467,
8378,
21637,
3194,
5898,
368,
341,
262,
1077,
2266,
284,
3393,
1972,
486,
931,
2099,
56703,
262,
1077,
821,
284,
293,
97115,
3302,
262,
1077,
5206,
1584,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_push_request_new() {
let endpoint = "https://example.com/push/endpoint";
let keys = Keys::new("anetohias===", "oeatssah=");
let req = AddPushRequest::new(endpoint, &keys);
assert_eq!(
req,
AddPushRequest {
endpoint: "https://example.com/push/endpoint".to_string(),
p256dh: "anetohias===".to_string(),
auth: "oeatssah=".to_string(),
follow: None,
favourite: None,
reblog: None,
mention: None,
}
);
} | rust_cleaned_test_functions.jsonl/116572 | {
"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,
2891,
14218,
7893,
5921,
368,
341,
286,
1077,
14887,
284,
330,
2428,
1110,
8687,
905,
4322,
1116,
14,
32540,
876,
286,
1077,
6894,
284,
24133,
486,
931,
445,
276,
295,
2267,
3473,
418,
21369,
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_carry_into_fractional_with_digits_to_right() {
assert_eq!(decimal("0.0901") + decimal("0.01"), decimal("0.1001"))
} | rust_cleaned_test_functions.jsonl/58128 | {
"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,
666,
11433,
45514,
59023,
278,
6615,
41432,
2346,
10539,
368,
341,
262,
2060,
10714,
10297,
23289,
445,
15,
13,
15,
24,
15,
16,
899,
488,
12122,
445,
15,
13,
15,
16,
3975,
12122,
445,
15,
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 |
#[test]
fn test_integration_with_table_map() {
let mut rt = Runtime::new().unwrap();
let config = ClientConfigBuilder::default()
.connection_type(ConnectionType::Mock(MockType::Happy))
.mock(true)
.controller_uri(PravegaNodeUri::from("127.0.0.2:9091".to_string()))
.build()
.unwrap();
let factory = ClientFactory::new(config);
let mut sync = rt.block_on(factory.create_table_synchronizer("sync".to_string()));
rt.block_on(sync.insert(|table| {
table.insert(
"outer_key".to_owned(),
"inner_key".to_owned(),
"i32".to_owned(),
Box::new(1),
);
Ok(None)
}))
.unwrap();
let value_option = sync.get("outer_key", "inner_key");
assert!(value_option.is_some());
rt.block_on(sync.remove(|table| {
table.insert_tombstone("outer_key".to_owned(), "inner_key".to_owned())?;
Ok(None)
}))
.unwrap();
let value_option = sync.get("outer_key", "inner_key");
assert!(value_option.is_none());
} | rust_cleaned_test_functions.jsonl/90784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 617
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90250,
6615,
5237,
5376,
368,
341,
286,
1077,
5206,
16677,
284,
10954,
486,
931,
1005,
15454,
543,
286,
1077,
2193,
284,
8423,
2648,
3297,
486,
2258,
741,
310,
659,
7742,
1819,
47218,
929,
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... | 2 |
#[test]
fn test_do_not_import_static_member_functions_when_record_not_supported_yet() {
// only using nested struct as an example of a record we cannot import yet.
let ir = ir_from_cc(
"
struct SomeStruct {
struct NestedStruct {
static void StaticMemberFunction();
};
};",
)
.unwrap();
assert_ir_matches!(
ir,
quote! { UnsupportedItem {
name: "SomeStruct::NestedStruct::StaticMemberFunction" ...
}}
);
} | rust_cleaned_test_functions.jsonl/37200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26309,
7913,
18434,
25360,
19388,
31708,
47636,
14192,
7913,
57885,
4178,
295,
368,
341,
262,
442,
1172,
1667,
24034,
2036,
438,
458,
3110,
315,
264,
3255,
582,
4157,
1159,
3602,
624,
262,
1077,
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_hash_less_values_than_block_size() {
hash_less_values_than_block_size(Sha256::new(), INPUT_BLOCK_SIZE_SHA256);
hash_less_values_than_block_size(Sha512::new(), INPUT_BLOCK_SIZE_SHA512);
hash_less_values_than_block_size(Sha384::new(), INPUT_BLOCK_SIZE_SHA384);
} | rust_cleaned_test_functions.jsonl/23444 | {
"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,
8950,
50747,
9146,
51613,
7113,
2368,
368,
341,
286,
5175,
50747,
9146,
51613,
7113,
2368,
7,
62316,
17,
20,
21,
486,
931,
1507,
26149,
18756,
4098,
38096,
17,
20,
21,
317,
286,
5175,
50747,
914... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proof_path_is_branch() {
let b = ProofPath::from_raw(*b"\x00qwertyuiopasdfghjklzxcvbnm123456\xFF");
assert_eq!(b.len(), 255);
assert_eq!(b.is_leaf(), false);
} | rust_cleaned_test_functions.jsonl/25544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86757,
2638,
6892,
28031,
368,
341,
262,
1077,
293,
284,
36991,
1820,
486,
1499,
16067,
4071,
65,
11934,
87,
15,
15,
69291,
1344,
1963,
453,
76615,
866,
73,
10561,
89,
8148,
85,
11081,
76,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ptrace_setoptions() {
require_capability!("test_ptrace_setoptions", CAP_SYS_PTRACE);
let err = ptrace::setoptions(getpid(), Options::PTRACE_O_TRACESYSGOOD).unwrap_err();
assert!(err != Errno::EOPNOTSUPP);
} | rust_cleaned_test_functions.jsonl/33734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4348,
578,
2602,
2875,
368,
341,
262,
1373,
89686,
17223,
1944,
4348,
578,
2602,
2875,
497,
26101,
26783,
20657,
5576,
317,
262,
1077,
1848,
284,
10087,
578,
486,
746,
2875,
5433,
10412,
1507,
145... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_relative_shrink() {
let drawing_area = create_mocked_drawing_area(1000, 1200, |m| {
m.check_draw_rect(move |_, _, _, u, d| {
assert_eq!((100, 100), u);
assert_eq!((300 - 1, 700 - 1), d);
});
m.drop_check(|b| {
assert_eq!(b.num_draw_rect_call, 1);
assert_eq!(b.draw_count, 1);
});
})
.shrink(((10).percent_width(), 100), (200, (50).percent_height()));
drawing_area.fill(&RED).unwrap();
} | rust_cleaned_test_functions.jsonl/81502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29286,
3712,
34365,
368,
341,
286,
1077,
13330,
15030,
284,
1855,
34134,
291,
814,
1696,
15030,
7,
16,
15,
15,
15,
11,
220,
16,
17,
15,
15,
11,
760,
76,
91,
341,
310,
296,
9093,
23021,
16979... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_content_type_media_type_with_no_extension() {
// Media Type
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/typescript")),
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("text/typescript")),
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("video/vnd.dlna.mpeg-tts")),
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("video/mp2t")),
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/x-typescript")),
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/javascript")),
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("text/javascript")),
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/ecmascript")),
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("text/ecmascript")),
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/x-javascript")),
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/json")),
msg::MediaType::Json
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("text/json")),
msg::MediaType::Json
);
} | rust_cleaned_test_functions.jsonl/16768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 715
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
7495,
1819,
29173,
1819,
6615,
6536,
31035,
368,
341,
262,
442,
7816,
3990,
198,
262,
2060,
10714,
33673,
414,
2415,
7495,
1819,
33030,
486,
931,
445,
7975,
49513,
3975,
4329,
445,
5132,
203... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aggsig_fuzz() {
let secp = Secp256k1::with_caps(ContextFlag::Full);
let (sk, pk) = secp.generate_keypair(&mut thread_rng()).unwrap();
println!(
"Performing aggsig single context with seckey, pubkey: {:?},{:?}",
sk, pk
);
let mut msg = [0u8; 32];
thread_rng().fill(&mut msg);
let msg = Message::from_slice(&msg).unwrap();
let sig = sign_single(&secp, &msg, &sk, None, None, None, None, None).unwrap();
let corrupted = &mut [0u8; 64];
let mut i = 0;
for elem in corrupted[..32].iter_mut() {
*elem = sig.0[i];
i += 1;
}
let corrupted_sig: Signature = Signature {
0: ffi::Signature(*corrupted),
};
println!(
"Verifying aggsig single: {:?}, msg: {:?}, pk:{:?}",
corrupted_sig, msg, pk
);
let result = verify_single(&secp, &corrupted_sig, &msg, None, &pk, None, None, false);
println!("Signature verification single (correct): {}", result);
assert!(result == false);
let corrupted = &mut [0u8; 64];
let mut i = 32;
for elem in corrupted[32..].iter_mut() {
*elem = sig.0[i];
i += 1;
}
let corrupted_sig: Signature = Signature {
0: ffi::Signature(*corrupted),
};
println!(
"Verifying aggsig single: {:?}, msg: {:?}, pk:{:?}",
corrupted_sig, msg, pk
);
let result = verify_single(&secp, &corrupted_sig, &msg, None, &pk, None, None, false);
println!("Signature verification single (correct): {}", result);
assert!(result == false);
// force pk as 0 to simulate Fuzz test
let zero_pk = PublicKey::new();
println!(
"Verifying aggsig single: {:?}, msg: {:?}, pk:{:?}",
sig, msg, zero_pk
);
let result = verify_single(&secp, &sig, &msg, None, &zero_pk, None, None, false);
println!("Signature verification single (correct): {}", result);
assert!(result == false);
let mut sigs: Vec<Signature> = vec![];
sigs.push(sig);
let mut msgs: Vec<Message> = vec![];
msgs.push(msg);
let mut pub_keys: Vec<PublicKey> = vec![];
pub_keys.push(zero_pk);
println!(
"Verifying aggsig batch: {:?}, msg: {:?}, pk:{:?}",
sig, msg, zero_pk
);
let result = verify_batch(&secp, &sigs, &msgs, &pub_keys);
println!("Signature verification batch: {}", result);
assert!(result == false);
let corrupted = &mut [0u8; 64];
let mut i = 32;
for elem in corrupted[32..].iter_mut() {
*elem = pk.0[i];
i += 1;
}
let corrupted_pk: PublicKey = PublicKey {
0: ffi::PublicKey(*corrupted),
};
println!(
"Verifying aggsig single: {:?}, msg: {:?}, pk:{:?}",
sig, msg, corrupted_pk
);
let result = verify_single(&secp, &sig, &msg, None, &corrupted_pk, None, None, false);
println!("Signature verification single (correct): {}", result);
assert!(result == false);
// more tests on other parameters
let zero_pk = PublicKey::new();
let result = verify_single(
&secp,
&sig,
&msg,
Some(&zero_pk),
&zero_pk,
Some(&zero_pk),
Some(&zero_pk),
false,
);
assert!(result == false);
let mut msg = [0u8; 32];
thread_rng().fill(&mut msg);
let msg = Message::from_slice(&msg).unwrap();
if sign_single(
&secp,
&msg,
&sk,
None,
None,
Some(&zero_pk),
Some(&zero_pk),
Some(&zero_pk),
).is_ok()
{
panic!("sign_single should fail on zero public key, but not!");
}
} | rust_cleaned_test_functions.jsonl/15036 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
5857,
343,
761,
8889,
368,
341,
197,
10217,
511,
4672,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
4197,
52955,
14001,
12135,
486,
9432,
317,
197,
10217,
320,
4886,
11,
22458,
8,
284,
511,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_prepare_sst_for_ingestion_titan() {
let mut db_opts = DBOptions::new();
let mut titan_opts = TitanDBOptions::new();
// Force all values write out to blob files.
titan_opts.set_min_blob_size(0);
db_opts.set_titandb_options(&titan_opts);
let mut cf_opts = ColumnFamilyOptions::new();
cf_opts.set_titandb_options(&titan_opts);
check_prepare_sst_for_ingestion(
Some(db_opts),
Some(vec![CFOptions::new("default", cf_opts)]),
);
} | rust_cleaned_test_functions.jsonl/111083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47460,
643,
267,
5478,
59112,
42498,
528,
12849,
368,
341,
286,
1077,
5206,
2927,
32354,
284,
5952,
3798,
486,
931,
543,
286,
1077,
5206,
85512,
32354,
284,
27447,
3506,
3798,
486,
931,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_override_dep() {
Package::new("bar", "0.1.0").publish();
let bar = git::repo(&paths::root().join("override"))
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
.file("src/lib.rs", "pub fn bar() {}")
.build();
let p = project()
.file(
"Cargo.toml",
&format!(
r#"
[package]
name = "foo"
version = "0.0.1"
authors = []
[dependencies]
bar = "0.1.0"
[replace]
"bar:0.1.0" = {{ git = '{0}' }}
"#,
bar.url()
),
)
.file("src/lib.rs", "")
.build();
p.cargo("test -p bar")
.with_status(101)
.with_stderr_contains(
"\
error: There are multiple `bar` packages in your project, and the [..]
Please re-run this command with [..]
[..]#bar:0.1.0
[..]#bar:0.1.0
",
)
.run();
} | rust_cleaned_test_functions.jsonl/81998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48576,
49258,
368,
341,
262,
16906,
486,
931,
445,
2257,
497,
330,
15,
13,
16,
13,
15,
1827,
27502,
1428,
262,
1077,
3619,
284,
16345,
486,
23476,
2099,
21623,
486,
2888,
1005,
5987,
445,
9199,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bool() {
#[derive(Deserialize)]
struct TestBool {
v: bool,
}
let regex = r"^(?P<v>(?i)(true|false))$";
assert!(from_str::<TestBool>("true", regex).unwrap().v);
assert!(!from_str::<TestBool>("false", regex).unwrap().v);
assert!(from_str::<TestBool>("TRUE", regex).unwrap().v);
assert!(!from_str::<TestBool>("FALSE", regex).unwrap().v);
assert!(from_str::<TestBool>("trUE", regex).unwrap().v);
assert!(!from_str::<TestBool>("FAlse", regex).unwrap().v);
let regex = r"^(?P<v>\w*)$";
assert!(from_str::<TestBool>("SOMETHING ELSE", regex).is_err());
assert!(from_str::<TestBool>("", regex).is_err());
} | rust_cleaned_test_functions.jsonl/133422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
368,
341,
286,
11506,
27098,
7,
64465,
5563,
286,
2036,
3393,
11233,
341,
310,
348,
25,
1807,
345,
286,
555,
286,
1077,
20180,
284,
435,
1,
13268,
30,
47,
39297,
2235,
30,
72,
2376,
186... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_has_extra() {
let deserialized: Value = serde_json::from_str(r#"{ "a": 1, "b": { "c": 2 } }"#).unwrap();
let v: Value = serde_json::from_str(r#"{ "a": 1, "b": { "c": 2, "d": "hi" } }"#).unwrap();
assert!(check(&v, &deserialized).is_err());
} | rust_cleaned_test_functions.jsonl/52333 | {
"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,
3142,
21778,
31858,
368,
341,
286,
1077,
939,
67577,
25,
5162,
284,
61570,
9455,
486,
1499,
2895,
2601,
2,
14129,
330,
64,
788,
220,
16,
11,
330,
65,
788,
314,
330,
66,
788,
220,
17,
335,
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_col_concat() {
let mat1 = m!(1, 2; 3, 4);
let mat2 = m!(5, 6; 7, 8);
let mat3 = mat1.col_concat(mat2);
assert_eq!(mat3, m!(1, 2, 5, 6; 3, 4, 7, 8));
} | rust_cleaned_test_functions.jsonl/61508 | {
"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,
10211,
57478,
368,
341,
286,
1077,
5517,
16,
284,
296,
10297,
16,
11,
220,
17,
26,
220,
18,
11,
220,
19,
317,
286,
1077,
5517,
17,
284,
296,
10297,
20,
11,
220,
21,
26,
220,
22,
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_load_functions_macos() -> Result<(), Error> {
let buffer = ByteView::open("../testutils/fixtures/symcache/current/macos.symc")?;
let symcache = SymCache::parse(&buffer)?;
insta::assert_debug_snapshot_matches!("functions_macos", FunctionsDebug(&symcache));
Ok(())
} | rust_cleaned_test_functions.jsonl/30030 | {
"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,
12411,
31708,
22802,
436,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
4147,
284,
10906,
851,
486,
2508,
17409,
1944,
6031,
94275,
2687,
1600,
9360,
74053,
3183,
41647,
50901,
66,
899,
37445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_db_vector() {
use std::mem;
let len: size_t = 4;
let data: *mut u8 = unsafe { libc::calloc(len, mem::size_of::<u8>()) as *mut u8 };
let v = unsafe { DBVector::from_c(data, len) };
let ctrl = [0u8, 0, 0, 0];
assert_eq!(&*v, &ctrl[..]);
} | rust_cleaned_test_functions.jsonl/36612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8685,
12247,
368,
341,
262,
990,
1460,
486,
10536,
280,
262,
1077,
2422,
25,
1379,
528,
284,
220,
19,
280,
262,
1077,
821,
25,
353,
6984,
575,
23,
284,
19860,
314,
42142,
486,
65488,
6901,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_optional() {
assert_parses_cb(
&[
(Ok((Some(true), None)), b"\x01\x01\xff"),
(Ok((Some(false), None)), b"\x01\x01\x00"),
(Ok((None, Some(18))), b"\x02\x01\x12"),
(Ok((Some(true), Some(18))), b"\x01\x01\xff\x02\x01\x12"),
(Ok((None, None)), b""),
(Err(ParseError::new(ParseErrorKind::ShortData)), b"\x01"),
(Err(ParseError::new(ParseErrorKind::ShortData)), b"\x02"),
],
|p| {
Ok((
p.read_element::<Option<bool>>()?,
p.read_element::<Option<i64>>()?,
))
},
);
assert_parses::<Option<Tlv>>(&[
(
Ok(Some(Tlv {
tag: 0x4,
data: b"abc",
full_data: b"\x04\x03abc",
})),
b"\x04\x03abc",
),
(Ok(None), b""),
(Err(ParseError::new(ParseErrorKind::ShortData)), b"\x04"),
]);
assert_parses::<Option<Choice2<u64, bool>>>(&[
(Ok(None), b""),
(Ok(Some(Choice2::ChoiceA(17))), b"\x02\x01\x11"),
(Ok(Some(Choice2::ChoiceB(true))), b"\x01\x01\xff"),
]);
} | rust_cleaned_test_functions.jsonl/40841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 871
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
74644,
368,
341,
286,
2060,
77113,
288,
16450,
1006,
310,
609,
9640,
394,
320,
11578,
1188,
8373,
3715,
701,
2240,
5731,
293,
11934,
87,
15,
16,
3462,
15,
16,
86977,
4461,
394,
320,
11578... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_batch_values_def_levels() {
test_read_batch_int32(16, &mut vec![0; 10], Some(&mut vec![0; 10]), None);
test_read_batch_int32(16, &mut vec![0; 16], Some(&mut vec![0; 16]), None);
test_read_batch_int32(16, &mut vec![0; 51], Some(&mut vec![0; 51]), None);
} | rust_cleaned_test_functions.jsonl/64661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
14534,
9146,
7844,
37819,
368,
341,
286,
1273,
6443,
14534,
4042,
18,
17,
7,
16,
21,
11,
609,
6984,
7486,
20703,
15,
26,
220,
16,
15,
1125,
4329,
2099,
6984,
7486,
20703,
15,
26,
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_de() {
let json = r#"
{
"field": "story_insights",
"value": {
"media_id": "17887498072083520",
"impressions": 444,
"reach": 44,
"taps_forward": 4,
"taps_back": 3,
"exits": 3,
"replies": 0
}
}
"#;
match serde_json::from_str::<Instagram>(json) {
Ok(Instagram::StoryInsights(v)) => {
println!("{:?}", v);
assert_eq!(v.media_id, 17887498072083520);
assert_eq!(v.metrics.impressions, 444);
}
Ok(v) => panic!("{:?}", v),
Err(err) => panic!("{}", err),
}
let json = r#"
{
"field": "comments",
"value": {
"id": "17865799348089039",
"text": "This is an example."
}
}
"#;
match serde_json::from_str::<Instagram>(json) {
Ok(Instagram::Comments(v)) => {
println!("{:?}", v);
assert_eq!(v.id, 17865799348089039);
}
Ok(v) => panic!("{:?}", v),
Err(err) => panic!("{}", err),
}
} | rust_cleaned_test_functions.jsonl/35690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 819
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
368,
341,
286,
1077,
2951,
284,
435,
2,
698,
286,
341,
310,
330,
2566,
788,
330,
26485,
34386,
2796,
756,
310,
330,
957,
788,
341,
394,
330,
7399,
842,
788,
330,
16,
22,
23,
23,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_csp_tags_stripe() {
// This is a regression test for potential PII in stripe URLs. PII stripping used to skip
let json = r#"{
"csp-report": {
"document-uri": "https://example.com",
"blocked-uri": "https://api.stripe.com/v1/tokens?card[number]=xxx",
"effective-directive": "script-src"
}
}"#;
let mut event = Event::default();
Csp::apply_to_event(json.as_bytes(), &mut event).unwrap();
insta::assert_debug_snapshot!(event.tags, @r###"
Tags(
PairList(
[
TagEntry(
"effective-directive",
"script-src",
),
TagEntry(
"blocked-uri",
"https://api.stripe.com/v1/tokens",
),
],
),
)
"###);
} | rust_cleaned_test_functions.jsonl/4026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 607
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2154,
16333,
1261,
51091,
368,
341,
286,
442,
1096,
374,
264,
30549,
1273,
369,
4650,
393,
5543,
304,
45542,
35006,
13,
393,
5543,
66670,
1483,
311,
10706,
198,
23459,
286,
1077,
2951,
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_units_minute() {
let vm = &mut VM::new();
vm.set_source("1.0E minute");
vm.evaluate_input();
assert_eq!(vm.last_error(), None);
assert_eq!(vm.f_stack().len(), 1);
let t = vm.f_stack().pop();
assert!(double_value_check(t, 60.0));
} | rust_cleaned_test_functions.jsonl/29591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28345,
76944,
368,
341,
286,
1077,
10995,
284,
609,
6984,
17792,
486,
931,
543,
286,
10995,
980,
10347,
445,
16,
13,
15,
36,
9383,
797,
286,
10995,
36036,
5898,
543,
286,
2060,
10714,
10297,
733... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_scan() {
// test the type inference
fn add(old: &mut isize, new: &usize) -> Option<f64> {
*old += *new as isize;
Some(*old as f64)
}
let xs = [0, 1, 2, 3, 4];
let ys = [0f64, 1.0, 3.0, 6.0, 10.0];
let it = xs.iter().scan(0, add);
let mut i = 0;
for x in it {
assert_eq!(x, ys[i]);
i += 1;
}
assert_eq!(i, ys.len());
} | rust_cleaned_test_functions.jsonl/25915 | {
"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,
13491,
28857,
368,
341,
262,
442,
1273,
279,
943,
44378,
198,
262,
5168,
912,
21972,
25,
609,
6984,
91373,
11,
501,
25,
609,
51878,
8,
1464,
6959,
63895,
21,
19,
29,
341,
286,
353,
813,
1421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_within() {
fn t(s: &str, i: uint, u: &[String]) {
let mut v = Vec::new();
each_split_within(s, i, |s| { v.push(s.to_string()); true });
assert!(v.iter().zip(u.iter()).all(|(a,b)| a == b));
}
t("", 0, &[]);
t("", 15, &[]);
t("hello", 15, &["hello".to_string()]);
t("\nMary had a little lamb\nLittle lamb\n", 15, &[
"Mary had a".to_string(),
"little lamb".to_string(),
"Little lamb".to_string()
]);
t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::MAX,
&["Mary had a little lamb\nLittle lamb".to_string()]);
} | rust_cleaned_test_functions.jsonl/11174 | {
"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,
17052,
72385,
368,
341,
262,
5168,
259,
1141,
25,
609,
495,
11,
600,
25,
2622,
11,
575,
25,
44590,
703,
2467,
341,
286,
1077,
5206,
348,
284,
11312,
486,
931,
543,
286,
1817,
17052,
72385,
114... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dft_assoc() -> Result<(), Box<dyn Error>> {
let parameters = GcPcSaftFunctionalParameters::from_json_segments(
&["1-pentanol"],
"parameters/gc_substances.json",
"parameters/sauer2014_hetero.json",
None,
IdentifierOption::Name,
)
.unwrap();
let func = Rc::new(GcPcSaftFunctional::new(Rc::new(parameters)));
let t = 300.0 * KELVIN;
let w = 100.0 * ANGSTROM;
let points = 4096;
let vle = PhaseEquilibrium::pure(&func, t, None, Default::default())?;
let profile = PlanarInterface::from_tanh(&vle, points, w, 600.0 * KELVIN)?.solve(None)?;
println!(
"hetero {} {} {}",
profile.surface_tension.unwrap(),
vle.vapor().density,
vle.liquid().density,
);
let solver = DFTSolver::new(Verbosity::Iter)
.picard_iteration(None)
.beta(0.05)
.tol(1e-5)
.anderson_mixing(None);
let bulk = StateBuilder::new(&func)
.temperature(t)
.pressure(5.0 * BAR)
.build()?;
Pore1D::new(
Geometry::Cartesian,
20.0 * ANGSTROM,
ExternalPotential::LJ93 {
epsilon_k_ss: 10.0,
sigma_ss: 3.0,
rho_s: 0.08,
},
None,
None,
)
.initialize(&bulk, None, None)?
.solve(Some(&solver))?;
Ok(())
} | rust_cleaned_test_functions.jsonl/61407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 701
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
723,
18891,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
262,
1077,
5029,
284,
479,
66,
47,
66,
52279,
723,
71271,
9706,
486,
1499,
9455,
55735,
1006,
286,
609,
1183,
16,
2268,
306... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_human_block_sizes2() {
for human_numeric_sort_param in &["-h", "--human-numeric-sort", "--sort=human-numeric"] {
let input = "8981K\n909991M\n-8T\n21G\n0.8M";
new_ucmd!()
.arg(human_numeric_sort_param)
.pipe_in(input)
.succeeds()
.stdout_only("-8T\n0.8M\n8981K\n21G\n909991M\n");
}
} | rust_cleaned_test_functions.jsonl/131589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86247,
7113,
32159,
17,
368,
341,
262,
369,
3738,
29418,
18435,
4090,
304,
609,
1183,
12,
71,
497,
14482,
25312,
12,
19600,
46540,
497,
14482,
6860,
28,
25312,
12,
19600,
1341,
341,
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... | 2 |
#[test]
fn test_none_or_up_to_none_large() {
let occurence: Occurrences = Occurrences::NoneOrMore;
occurence.check(core::u16::MAX).unwrap();
} | rust_cleaned_test_functions.jsonl/45934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31488,
8734,
8237,
2346,
31488,
45228,
368,
341,
286,
1077,
2983,
86937,
25,
19927,
33246,
284,
19927,
33246,
486,
4064,
2195,
7661,
280,
286,
2983,
86937,
9093,
47867,
486,
84,
16,
21,
486,
10586... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_polar() {
const N: usize = 10000;
let mut polar = Polar::new(MT19937::new(Some(77027465)));
let v = polar.get_n(N);
println!("{} {}", N, v.iter().sum::<f64>());
assert!(v.iter().sum::<f64>() < (N as f64).sqrt());
} | rust_cleaned_test_functions.jsonl/46979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
7417,
368,
341,
262,
733,
451,
25,
22301,
284,
220,
16,
15,
15,
15,
15,
280,
30779,
30779,
18611,
262,
1077,
5206,
24660,
284,
55896,
486,
931,
3189,
51,
16,
24,
24,
18,
22,
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_transfer_lamports() {
let from = Pubkey::new_unique();
let from_account = AccountSharedData::new(100, 0, &Pubkey::new(&[2; 32])); // account owner should not matter
let to = Pubkey::new(&[3; 32]);
let to_account = AccountSharedData::new(1, 0, &to); // account owner should not matter
let transaction_accounts = vec![(from, from_account), (to, to_account)];
let instruction_accounts = vec![
AccountMeta {
pubkey: from,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: to,
is_signer: false,
is_writable: false,
},
];
// Success case
let accounts = process_instruction(
&bincode::serialize(&SystemInstruction::Transfer { lamports: 50 }).unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Ok(()),
super::process_instruction,
);
assert_eq!(accounts[0].lamports(), 50);
assert_eq!(accounts[1].lamports(), 51);
// Attempt to move more lamports than from_account has
let accounts = process_instruction(
&bincode::serialize(&SystemInstruction::Transfer { lamports: 101 }).unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Err(SystemError::ResultWithNegativeLamports.into()),
super::process_instruction,
);
assert_eq!(accounts[0].lamports(), 100);
assert_eq!(accounts[1].lamports(), 1);
// test signed transfer of zero
let accounts = process_instruction(
&bincode::serialize(&SystemInstruction::Transfer { lamports: 0 }).unwrap(),
transaction_accounts.clone(),
instruction_accounts,
Ok(()),
super::process_instruction,
);
assert_eq!(accounts[0].lamports(), 100);
assert_eq!(accounts[1].lamports(), 1);
// test unsigned transfer of zero
let accounts = process_instruction(
&bincode::serialize(&SystemInstruction::Transfer { lamports: 0 }).unwrap(),
transaction_accounts,
vec![
AccountMeta {
pubkey: from,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: to,
is_signer: false,
is_writable: false,
},
],
Err(InstructionError::MissingRequiredSignature),
super::process_instruction,
);
assert_eq!(accounts[0].lamports(), 100);
assert_eq!(accounts[1].lamports(), 1);
} | rust_cleaned_test_functions.jsonl/95883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
907,
309,
3394,
368,
341,
286,
1077,
504,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
504,
13500,
284,
8615,
16997,
1043,
486,
931,
7,
16,
15,
15,
11,
220,
15,
11,
609,
29162,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_visibility_general_other() {
let user = test_model::new_general_user();
let other = test_model::new_general_user();
let (file, _) = test_model::new_file(other.id().clone());
assert!(!file.is_visible_to(&user));
} | rust_cleaned_test_functions.jsonl/5056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71256,
39177,
30456,
368,
341,
286,
1077,
1196,
284,
1273,
5047,
486,
931,
39177,
3317,
543,
286,
1077,
1008,
284,
1273,
5047,
486,
931,
39177,
3317,
543,
286,
1077,
320,
1192,
11,
27439,
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... | 1 |
#[test]
fn test_create_program_address() {
// These tests duplicate the direct tests in solana_program::pubkey
prepare_mockup!(
invoke_context,
transaction_context,
program_id,
bpf_loader::id(),
);
let address = bpf_loader_upgradeable::id();
let exceeded_seed = &[127; MAX_SEED_LEN + 1];
let result = create_program_address(&mut invoke_context, &[exceeded_seed], &address);
assert_eq!(
result,
Err(SyscallError::BadSeeds(PubkeyError::MaxSeedLengthExceeded).into())
);
assert_eq!(
create_program_address(
&mut invoke_context,
&[b"short_seed", exceeded_seed],
&address,
),
Err(SyscallError::BadSeeds(PubkeyError::MaxSeedLengthExceeded).into())
);
let max_seed = &[0; MAX_SEED_LEN];
assert!(create_program_address(&mut invoke_context, &[max_seed], &address).is_ok());
let exceeded_seeds: &[&[u8]] = &[
&[1],
&[2],
&[3],
&[4],
&[5],
&[6],
&[7],
&[8],
&[9],
&[10],
&[11],
&[12],
&[13],
&[14],
&[15],
&[16],
];
assert!(create_program_address(&mut invoke_context, exceeded_seeds, &address).is_ok());
let max_seeds: &[&[u8]] = &[
&[1],
&[2],
&[3],
&[4],
&[5],
&[6],
&[7],
&[8],
&[9],
&[10],
&[11],
&[12],
&[13],
&[14],
&[15],
&[16],
&[17],
];
assert_eq!(
create_program_address(&mut invoke_context, max_seeds, &address),
Err(SyscallError::BadSeeds(PubkeyError::MaxSeedLengthExceeded).into())
);
assert_eq!(
create_program_address(&mut invoke_context, &[b"", &[1]], &address),
Ok("BwqrghZA2htAcqq8dzP1WDAhTXYTYWj7CHxF5j7TDBAe"
.parse()
.unwrap())
);
assert_eq!(
create_program_address(&mut invoke_context, &["☉".as_ref(), &[0]], &address),
Ok("13yWmRpaTR4r5nAktwLqMpRNr28tnVUZw26rTvPSSB19"
.parse()
.unwrap())
);
assert_eq!(
create_program_address(&mut invoke_context, &[b"Talking", b"Squirrels"], &address),
Ok("2fnQrngrQT4SeLcdToJAD96phoEjNL2man2kfRLCASVk"
.parse()
.unwrap())
);
let public_key = Pubkey::from_str("SeedPubey1111111111111111111111111111111111").unwrap();
assert_eq!(
create_program_address(&mut invoke_context, &[public_key.as_ref(), &[1]], &address),
Ok("976ymqVnfE32QFe6NfGDctSvVa36LWnvYxhU6G2232YL"
.parse()
.unwrap())
);
assert_ne!(
create_program_address(&mut invoke_context, &[b"Talking", b"Squirrels"], &address)
.unwrap(),
create_program_address(&mut invoke_context, &[b"Talking"], &address).unwrap(),
);
invoke_context
.get_compute_meter()
.borrow_mut()
.mock_set_remaining(0);
assert_eq!(
create_program_address(&mut invoke_context, &[b"", &[1]], &address),
Err(
SyscallError::InstructionError(InstructionError::ComputationalBudgetExceeded)
.into()
)
);
} | rust_cleaned_test_functions.jsonl/69894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25096,
6744,
368,
341,
286,
442,
4220,
7032,
22513,
279,
2118,
7032,
304,
2048,
3362,
25096,
486,
9585,
792,
271,
286,
10549,
34134,
454,
33673,
310,
19873,
8467,
345,
310,
7745,
8467,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zlib_flate() {
let bytes = vec!(1, 2, 3, 4, 5);
let deflated = deflate_bytes(bytes.as_slice()).expect("deflation failed");
let inflated = inflate_bytes(deflated.as_slice()).expect("inflation failed");
assert_eq!(inflated.as_slice(), bytes.as_slice());
} | rust_cleaned_test_functions.jsonl/13030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
2740,
761,
5075,
368,
341,
286,
1077,
5820,
284,
7486,
10297,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
317,
286,
1077,
707,
22076,
284,
92689,
12524,
23158,
5357,
26488,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rfold() {
{
let mut a = Array1::<i32>::default(256);
a += 1;
let mut iter = a.iter();
iter.next();
assert_eq!(iter.rfold(0, |acc, &x| acc + x), a.sum() - 1);
}
// Test strided arrays
{
let mut a = Array1::<i32>::default(256);
a.slice_axis_inplace(Axis(0), Slice::new(0, None, 2));
a += 1;
let mut iter = a.iter();
iter.next();
assert_eq!(iter.rfold(0, |acc, &x| acc + x), a.sum() - 1);
}
{
let mut a = Array1::<i32>::default(256);
a.slice_axis_inplace(Axis(0), Slice::new(0, None, -2));
a += 1;
let mut iter = a.iter();
iter.next();
assert_eq!(iter.rfold(0, |acc, &x| acc + x), a.sum() - 1);
}
// Test order
{
let mut a = Array1::from_iter(0..20);
a.slice_axis_inplace(Axis(0), Slice::new(0, None, 2));
let mut iter = a.iter();
iter.next();
let output = iter.rfold(Vec::new(), |mut acc, elt| {
acc.push(*elt);
acc
});
assert_eq!(
Array1::from_vec(output),
Array::from_iter((1..10).rev().map(|i| i * 2))
);
}
} | rust_cleaned_test_functions.jsonl/63383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 675
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
19961,
368,
341,
262,
341,
286,
1077,
5206,
264,
284,
2910,
16,
27638,
72,
18,
17,
6831,
2258,
7,
17,
20,
21,
317,
286,
264,
1421,
220,
16,
280,
286,
1077,
5206,
5367,
284,
264,
19471,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intersection() {
let mut a = HashSet::new();
let mut b = HashSet::new();
assert!(a.intersection(&b).next().is_none());
assert!(a.insert(11));
assert!(a.insert(1));
assert!(a.insert(3));
assert!(a.insert(77));
assert!(a.insert(103));
assert!(a.insert(5));
assert!(a.insert(-5));
assert!(b.insert(2));
assert!(b.insert(11));
assert!(b.insert(77));
assert!(b.insert(-9));
assert!(b.insert(-42));
assert!(b.insert(5));
assert!(b.insert(3));
let mut i = 0;
let expected = [3, 5, 11, 77];
for x in a.intersection(&b) {
assert!(expected.contains(x));
i += 1
}
assert_eq!(i, expected.len());
assert!(a.insert(9)); // make a bigger than b
i = 0;
for x in a.intersection(&b) {
assert!(expected.contains(x));
i += 1
}
assert_eq!(i, expected.len());
i = 0;
for x in b.intersection(&a) {
assert!(expected.contains(x));
i += 1
}
assert_eq!(i, expected.len());
} | rust_cleaned_test_functions.jsonl/24135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 652
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82558,
368,
341,
286,
1077,
5206,
264,
284,
18931,
486,
931,
543,
286,
1077,
5206,
293,
284,
18931,
486,
931,
543,
286,
2060,
10297,
64,
97075,
2099,
65,
568,
3600,
1005,
285,
31488,
5231,
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... | 4 |
#[test]
fn test_bool_from_str() {
assert_eq!(from_str::<bool>("true"), Some(true));
assert_eq!(from_str::<bool>("false"), Some(false));
assert_eq!(from_str::<bool>("not even a boolean"), None);
} | rust_cleaned_test_functions.jsonl/35009 | {
"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,
22159,
5673,
2895,
368,
341,
286,
2060,
10714,
10297,
1499,
2895,
27638,
2641,
13211,
1866,
3975,
4329,
3715,
1106,
286,
2060,
10714,
10297,
1499,
2895,
27638,
2641,
13211,
3849,
3975,
4329,
3576,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_multi_return_func() {
let isa = lookup(triple!("x86_64"))
.expect("expect x86 ISA")
.as_builder()
.finish(Flags::new(builder()));
let mut context = Context::for_function(create_multi_return_function(CallConv::SystemV));
context.func.collect_frame_layout_info();
context.compile(&*isa).expect("expected compilation");
let mut sink = SimpleUnwindSink(Vec::new(), 0, Vec::new());
emit_fde(&context.func, &*isa, &mut sink);
assert_eq!(
sink.0,
vec![
20, 0, 0, 0, // CIE len
0, 0, 0, 0, // CIE marker
1, // version
0, // augmentation string
1, // code aligment = 1
120, // data alignment = -8
16, // RA = r16
0x0c, 0x07, 0x08,
0x90, 0x01,
0, 0, 0, 0, 0, 0, // padding
36, 0, 0, 0, // FDE len
28, 0, 0, 0, // CIE offset
0, 0, 0, 0, 0, 0, 0, 0, // addr reloc
15, 0, 0, 0, 0, 0, 0, 0, // function length
0x42, // DW_CFA_advance_loc 2
0x0e, 0x10, // DW_CFA_def_cfa_offset 16
0x86, 0x02,
0x43, // DW_CFA_advance_loc 3
0x0d, 0x06, // DW_CFA_def_cfa_register
0x47, // DW_CFA_advance_loc 10
0x0a, // DW_CFA_preserve_state
0x0c, 0x07, 0x08,
0x41, // DW_CFA_advance_loc 1
0x0b, // DW_CFA_restore_state
// NOTE: no additional CFA directives -- DW_CFA_restore_state
// is done before trap and it is last instruction in the function.
0, // padding
0, 0, 0, 0, // End of FDEs
]
);
assert_eq!(sink.1, 24);
assert_eq!(sink.2.len(), 1);
} | rust_cleaned_test_functions.jsonl/103558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
12511,
9596,
368,
341,
286,
1077,
51335,
284,
18615,
7624,
3778,
17223,
87,
23,
21,
62,
21,
19,
5455,
310,
659,
17119,
445,
17119,
856,
23,
21,
84290,
1138,
310,
659,
300,
28532,
741,
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_next_random_socket() {
// use env_logger;
let mut io_loop = Runtime::new().unwrap();
let (stream, _) = MdnsStream::new(
SocketAddr::new(*TEST_MDNS_IPV4, BASE_TEST_PORT),
MdnsQueryType::OneShot,
Some(1),
None,
None,
);
let result = io_loop.block_on(stream);
if let Err(error) = result {
println!("Random address error: {:#?}", error);
panic!("failed to get next random address");
}
} | rust_cleaned_test_functions.jsonl/23776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
22644,
19555,
368,
341,
286,
442,
990,
6105,
27413,
280,
23459,
286,
1077,
5206,
6399,
17198,
284,
10954,
486,
931,
1005,
15454,
543,
286,
1077,
320,
4027,
11,
27439,
284,
386,
45226,
3027,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_checksum_in_address() {
let verkey = gen_random_base58_verkey();
let address = unqualified_address_from_verkey(&verkey).unwrap();
let addr_len = address.len();
// Mess up the checksum
let mut bad_addr = replace_char_at(&address, addr_len-1, 'a');
bad_addr = replace_char_at(&bad_addr, addr_len-2, 'b');
let fq_address = format!("{}{}", PAYMENT_ADDRESS_QUALIFIER, bad_addr);
let error = validate_address(&fq_address).unwrap_err();
assert_eq!(ErrorCode::CommonInvalidStructure, error);
} | rust_cleaned_test_functions.jsonl/72544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
64038,
1243,
6744,
368,
341,
286,
1077,
2739,
792,
284,
4081,
22644,
7651,
20,
23,
26042,
792,
543,
286,
1077,
2621,
284,
650,
36335,
6744,
5673,
26042,
792,
2099,
423,
792,
568,
15454,
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_memory_export_nonexistent() {
let wasm: Vec<u8> = vec![
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x04, 0x01, 0x60, 0x00, 0x00,
0x03, 0x02, 0x01, 0x00, 0x07, 0x08, 0x01, 0x04, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00,
0x0a, 0x04, 0x01, 0x02, 0x00, 0x0b,
];
let mut checker = EcicChecker::default(&wasm);
assert_eq!(
checker.checks.get_check_status("export-memory"),
CheckStatus::Unknown
);
checker.fire();
assert_eq!(
checker.checks.get_check_status("export-memory"),
CheckStatus::Nonexistent
);
} | rust_cleaned_test_functions.jsonl/10746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19195,
27114,
21637,
64085,
368,
341,
286,
1077,
98263,
25,
11312,
34837,
23,
29,
284,
7486,
90515,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
21,
16,
11,
220,
15,
87,
22,
18,
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... | 1 |
#[test]
fn test_install_target_new_file_with_group() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "file";
let dir = "target_dir";
let gid = get_effective_gid();
at.touch(file);
at.mkdir(dir);
let result = ucmd
.arg(file)
.arg("--group")
.arg(gid.to_string())
.arg(format!("{}/{}", dir, file))
.run();
if is_ci() && result.stderr_str().contains("no such group:") {
return;
}
result.success();
assert!(at.file_exists(file));
assert!(at.file_exists(&format!("{}/{}", dir, file)));
} | rust_cleaned_test_functions.jsonl/47026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
11123,
5921,
2458,
6615,
6288,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
284,
330,
1192,
876,
262,
1077,
5419,
284,
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... | 3 |
#[test]
fn test_invalid_value_type() {
let mut bytecode: Vec<u8> = BIND_HEADER.to_vec();
append_section_header(&mut bytecode, SYMB_MAGIC_NUM, 0);
let instructions = [0x01, 0x01, 0, 0, 0, 0x05, 0x10, 0, 0, 0, 0];
append_section_header(&mut bytecode, INSTRUCTION_MAGIC_NUM, instructions.len() as u32);
bytecode.extend_from_slice(&instructions);
assert_eq!(Err(BytecodeError::InvalidValueType(0x10)), DecodedRules::new(bytecode));
} | rust_cleaned_test_functions.jsonl/24034 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
3142,
1819,
368,
341,
286,
1077,
5206,
75129,
25,
11312,
34837,
23,
29,
284,
91370,
20330,
2389,
13251,
543,
286,
8737,
16221,
8757,
2099,
6984,
75129,
11,
16079,
8412,
49194,
9631,
11,
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_stacked_porep_resume_seal() {
type Tree = DiskTree<PoseidonHasher, U8, U8, U2>;
let rng = &mut XorShiftRng::from_seed(TEST_SEED);
let replica_id = <PoseidonHasher as Hasher>::Domain::random(rng);
let nodes = 64 * get_base_tree_count::<Tree>();
let data: Vec<u8> = (0..nodes)
.flat_map(|_| {
let v = <PoseidonHasher as Hasher>::Domain::random(rng);
v.into_bytes()
})
.collect();
// referenced later in the process as such.
let cache_dir = tempdir().expect("tempdir failure");
let config = StoreConfig::new(
cache_dir.path(),
CacheKey::CommDTree.to_string(),
default_rows_to_discard(nodes, BINARY_ARITY),
);
// Generate a replica path.
let replica_path1 = cache_dir.path().join("replica-path-1");
let replica_path2 = cache_dir.path().join("replica-path-2");
let replica_path3 = cache_dir.path().join("replica-path-3");
let mut mmapped_data1 = setup_replica(&data, &replica_path1);
let mut mmapped_data2 = setup_replica(&data, &replica_path2);
let mut mmapped_data3 = setup_replica(&data, &replica_path3);
let layer_challenges = LayerChallenges::new(DEFAULT_STACKED_LAYERS, 5);
let sp = SetupParams {
nodes,
degree: BASE_DEGREE,
expansion_degree: EXP_DEGREE,
porep_id: [32; 32],
layer_challenges: layer_challenges.clone(),
api_version: ApiVersion::V1_1_0,
};
let pp = StackedDrg::<Tree, Blake2sHasher>::setup(&sp).expect("setup failed");
let clear_temp = || {
for entry in glob(&(cache_dir.path().to_string_lossy() + "/*.dat")).unwrap() {
let entry = entry.unwrap();
if entry.is_file() {
// delete everything except the data-layers
if !entry.to_string_lossy().contains("data-layer") {
remove_file(entry).unwrap();
}
}
}
};
// first replicaton
StackedDrg::<Tree, Blake2sHasher>::replicate(
&pp,
&replica_id,
(mmapped_data1.as_mut()).into(),
None,
config.clone(),
replica_path1,
)
.expect("replication failed 1");
clear_temp();
// replicate a second time
StackedDrg::<Tree, Blake2sHasher>::replicate(
&pp,
&replica_id,
(mmapped_data2.as_mut()).into(),
None,
config.clone(),
replica_path2,
)
.expect("replication failed 2");
clear_temp();
// delete last 2 layers
let (_, label_states) = StackedDrg::<Tree, Blake2sHasher>::generate_labels_for_encoding(
&pp.graph,
&layer_challenges,
&replica_id,
config.clone(),
)
.expect("label generation failed");
let off = label_states.len() - 3;
for label_state in &label_states[off..] {
let config = &label_state.config;
let data_path = StoreConfig::data_path(&config.path, &config.id);
remove_file(data_path).expect("failed to delete layer cache");
}
// replicate a third time
StackedDrg::<Tree, Blake2sHasher>::replicate(
&pp,
&replica_id,
(mmapped_data3.as_mut()).into(),
None,
config.clone(),
replica_path3,
)
.expect("replication failed 3");
clear_temp();
assert_ne!(data, &mmapped_data1[..], "replication did not change data");
assert_eq!(&mmapped_data1[..], &mmapped_data2[..]);
assert_eq!(&mmapped_data2[..], &mmapped_data3[..]);
StackedDrg::<Tree, Blake2sHasher>::extract_all(
&pp,
&replica_id,
mmapped_data1.as_mut(),
Some(config),
)
.expect("failed to extract data");
assert_eq!(data, mmapped_data1.as_ref());
cache_dir.close().expect("Failed to remove cache dir");
} | rust_cleaned_test_functions.jsonl/56522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1787
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
11191,
620,
460,
79,
58132,
3453,
278,
368,
341,
14808,
262,
943,
8942,
284,
38868,
6533,
21604,
960,
90456,
6370,
261,
11,
547,
23,
11,
547,
23,
11,
547,
17,
19421,
262,
1077,
28422,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_superset() {
let mut e1: EnumSet<Foo> = EnumSet::new();
e1.insert(A);
let mut e2: EnumSet<Foo> = EnumSet::new();
e2.insert(A);
e2.insert(B);
let mut e3: EnumSet<Foo> = EnumSet::new();
e3.insert(C);
assert!(e1.is_subset(&e2));
assert!(e2.is_superset(&e1));
assert!(!e3.is_superset(&e2));
assert!(!e2.is_superset(&e3));
} | rust_cleaned_test_functions.jsonl/2755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
44146,
368,
341,
286,
1077,
5206,
384,
16,
25,
14086,
1649,
30499,
2624,
29,
284,
14086,
1649,
486,
931,
543,
286,
384,
16,
7030,
4346,
626,
286,
1077,
5206,
384,
17,
25,
14086,
1649,
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_init_can_be_called_with_no_pool_config() {
vcx_shutdown(true);
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE,"false");
settings::set_config_value(settings::CONFIG_WALLET_KEY,settings::TEST_WALLET_KEY);
let wallet_name = "test_init_with_config";
wallet::init_wallet(wallet_name).unwrap();
wallet::close_wallet().unwrap();
let content = json!({
"wallet_name": wallet_name,
"wallet_key": settings::TEST_WALLET_KEY
}).to_string();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
// assert that pool was never initialized
assert!(get_pool_handle().is_err());
wallet::delete_wallet(wallet_name).unwrap();
} | rust_cleaned_test_functions.jsonl/19798 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
27421,
21263,
27859,
6615,
6536,
15709,
5332,
368,
341,
286,
24553,
87,
54804,
3715,
317,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
1335,
3849,
797,
286,
5003,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_audio_mode_connection() {
let mut exec = fasync::TestExecutor::new().expect("executor should build");
let (peers, _profile_stream) = setup_connected_peers();
let (proxy, stream) = create_proxy_and_stream::<a2dp::AudioModeMarker>()
.expect("AudioMode proxy should be created");
handle_audio_mode_connection(peers.clone(), stream);
exec.run_singlethreaded(proxy.set_role(a2dp::Role::Sink)).expect("set role response");
assert_eq!(avdtp::EndpointType::Source, peers.lock().preferred_direction());
exec.run_singlethreaded(proxy.set_role(a2dp::Role::Source)).expect("set role response");
assert_eq!(avdtp::EndpointType::Sink, peers.lock().preferred_direction());
} | rust_cleaned_test_functions.jsonl/69382 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29688,
7302,
15866,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
80787,
1265,
1936,
797,
286,
1077,
320,
375,
388,
11,
716,
5365,
12673,
8,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_genesis_storage(){
new_test_ext().execute_with(||{
let native_asset = <NativeAssetId<Test>>::get();
let asset_info: AssetInfo<Test> = <Assets<Test>>::get(native_asset);
assert_eq!(asset_info.total_issuance,FixedU128::from(3000_000_000_000));
let test_acc1: AccountData = <Balance<Test>>::get(native_asset,0);
let test_acc2: AccountData = <Balance<Test>>::get(native_asset,1);
let test_acc3: AccountData = <Balance<Test>>::get(native_asset,2);
assert_eq!(test_acc1.free_balance,FixedU128::from(1000_000_000_000));
assert_eq!(test_acc2.free_balance,FixedU128::from(1000_000_000_000));
assert_eq!(test_acc3.free_balance,FixedU128::from(1000_000_000_000));
})
} | rust_cleaned_test_functions.jsonl/100188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
13774,
23310,
3032,
262,
501,
4452,
9927,
1005,
10257,
6615,
79453,
515,
286,
1077,
9867,
42299,
284,
366,
20800,
16604,
764,
71273,
77595,
455,
543,
286,
1077,
9329,
3109,
25,
22605,
1731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_cast_date32_to_date64() {
let a = Date32Array::from(vec![10000, 17890]);
let array = Arc::new(a) as ArrayRef;
let b = cast(&array, &DataType::Date64).unwrap();
let c = b.as_any().downcast_ref::<Date64Array>().unwrap();
assert_eq!(864000000000, c.value(0));
assert_eq!(1545696000000, c.value(1));
} | rust_cleaned_test_functions.jsonl/45415 | {
"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,
5303,
4164,
18,
17,
2346,
4164,
21,
19,
368,
341,
286,
1077,
264,
284,
2631,
18,
17,
1857,
486,
1499,
25592,
20703,
16,
15,
15,
15,
15,
11,
220,
16,
22,
23,
24,
15,
2558,
286,
1077,
1334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replace_add_use_other_anchor_indent() {
check_assist(
replace_qualified_name_with_use,
"
impl std::fmt::Debug<|> for Foo {
}
",
"
use std::fmt::Debug;
impl Debug<|> for Foo {
}
",
);
} | rust_cleaned_test_functions.jsonl/19566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
2891,
15951,
30456,
56532,
69045,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8290,
62,
36335,
1269,
6615,
15951,
345,
310,
6228,
262,
11605,
1460,
486,
12501,
486,
7939,
27,
91,
29,
369,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_char_iterator_no_trailing() {
let data = "\nMäry häd ä little lämb\nLittle lämb\n";
let split: Vec<&str> = data.split('\n').collect();
assert_eq!(split, ["", "Märy häd ä little lämb", "Little lämb", ""]);
let split: Vec<&str> = data.split_terminator('\n').collect();
assert_eq!(split, ["", "Märy häd ä little lämb", "Little lämb"]);
} | rust_cleaned_test_functions.jsonl/11133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
9232,
13491,
6536,
3547,
14277,
368,
341,
262,
1077,
821,
284,
2917,
77,
44,
2305,
884,
305,
30875,
12709,
2632,
30005,
3096,
1699,
38103,
30005,
3096,
1699,
3302,
262,
1077,
6718,
25,
1131... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recovery() {
// test that this message can be inserted
let conn = Connection::open_in_memory().expect("could not create in memory DB");
let mut journal = Journal::new(conn).unwrap();
journal.schema_up().unwrap();
let mut authority = create_example();
authority.set_journal(journal);
authority.persist_to_journal().unwrap();
let journal = authority.journal().unwrap();
let in_memory =
InMemoryAuthority::empty(authority.origin().clone().into(), ZoneType::Master, false);
let mut recovered_authority = SqliteAuthority::new(in_memory, false, false);
recovered_authority
.recover_with_journal(journal)
.expect("recovery");
assert_eq!(
recovered_authority.records().len(),
authority.records().len()
);
assert!(recovered_authority
.soa()
.wait()
.unwrap()
.iter()
.zip(authority.soa().wait().unwrap().iter())
.all(|(r1, r2)| r1 == r2));
assert!(recovered_authority
.records()
.iter()
.all(|(rr_key, rr_set)| {
let other_rr_set = authority
.records()
.get(rr_key)
.unwrap_or_else(|| panic!("key doesn't exist: {:?}", rr_key));
rr_set
.records_without_rrsigs()
.zip(other_rr_set.records_without_rrsigs())
.all(|(record, other_record)| {
record.ttl() == other_record.ttl() && record.rdata() == other_record.rdata()
})
},));
assert!(authority.records().iter().all(|(rr_key, rr_set)| {
let other_rr_set = recovered_authority
.records()
.get(rr_key)
.unwrap_or_else(|| panic!("key doesn't exist: {:?}", rr_key));
rr_set
.records_without_rrsigs()
.zip(other_rr_set.records_without_rrsigs())
.all(|(record, other_record)| {
record.ttl() == other_record.ttl() && record.rdata() == other_record.rdata()
})
}));
} | rust_cleaned_test_functions.jsonl/48173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1018
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91475,
368,
341,
262,
442,
1273,
429,
419,
1943,
646,
387,
21578,
198,
262,
1077,
4534,
284,
11032,
486,
2508,
1243,
19195,
1005,
17119,
445,
28077,
537,
1855,
304,
4938,
5952,
797,
262,
1077,
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... | 5 |
#[test]
fn test_stream_round_trip_import() -> Result<()> {
let array = Int32Array::from(vec![Some(2), None, Some(1), None]);
let array: Arc<dyn Array> = Arc::new(array);
_test_round_trip_import(vec![array.clone(), array.clone(), array])
} | rust_cleaned_test_functions.jsonl/107884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
29896,
63883,
18434,
368,
1464,
5714,
71698,
341,
286,
1077,
1334,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
17,
701,
2240,
11,
4329,
7,
16,
701,
2240,
2558,
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_mv_multiple_folders() {
let (at, mut ucmd) = at_and_ucmd!();
let target_dir = "test_mv_multiple_dirs_dir";
let dir_a = "test_mv_multiple_dir_a";
let dir_b = "test_mv_multiple_dir_b";
at.mkdir(target_dir);
at.mkdir(dir_a);
at.mkdir(dir_b);
ucmd.arg(dir_a)
.arg(dir_b)
.arg(target_dir)
.succeeds()
.no_stderr();
assert!(at.dir_exists(&format!("{}/{}", target_dir, dir_a)));
assert!(at.dir_exists(&format!("{}/{}", target_dir, dir_b)));
} | rust_cleaned_test_functions.jsonl/41609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
45233,
83928,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
2169,
4334,
284,
330,
1944,
73187,
45233,
44869,
4334,
876,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shutdown_drop() {
let (_tx_initiate_shutdown, rx_initiate_shutdown) = oneshot::channel();
let (tx_shutdown_event, rx_shutdown_event) = oneshot::channel();
let shutdown = ShutdownHandler::new(rx_initiate_shutdown, tx_shutdown_event);
assert_eq!(shutdown.state(), ShutdownState::Running);
mem::drop(shutdown);
assert!(current_thread::block_on_all(rx_shutdown_event).is_ok());
} | rust_cleaned_test_functions.jsonl/36422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54804,
29584,
368,
341,
286,
1077,
5453,
3998,
6137,
6493,
54804,
11,
19111,
6137,
6493,
54804,
8,
284,
389,
4288,
354,
486,
10119,
543,
286,
1077,
320,
3998,
54804,
6748,
11,
19111,
54804,
6748,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_color_processing() {
use color_processing::Color;
let hex = "#26dafd";
let base = Color::new_string(hex).unwrap();
println!("base: {}", base.to_rgb_string());
assert_eq!(base.to_rgb_string(), "rgb(38, 218, 253)");
let brighten = base.brighten(0.2);
println!("brighten: {}", brighten.to_rgb_string());
assert_eq!(brighten.to_rgb_string(), "rgb(59, 228, 255)");
let darken = base.darken(0.2);
println!("darken: {}", darken.to_rgb_string());
assert_eq!(darken.to_rgb_string(), "rgb(0, 208, 243)");
} | rust_cleaned_test_functions.jsonl/69880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6714,
58209,
368,
341,
286,
990,
1894,
58209,
486,
1636,
280,
286,
1077,
12371,
284,
5869,
17,
21,
85733,
67,
876,
286,
1077,
2331,
284,
3478,
486,
931,
3904,
44660,
568,
15454,
1428,
286,
13751... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_forbid_response_with_whitespace_between_header_name_and_colon() {
let mut headers = [EMPTY_HEADER; 1];
let mut response = Response::new(&mut headers[..]);
let result = response.parse(RESPONSE_WITH_WHITESPACE_BETWEEN_HEADER_NAME_AND_COLON);
assert_eq!(result, Err(::Error::HeaderName));
} | rust_cleaned_test_functions.jsonl/125612 | {
"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,
5478,
20648,
9655,
6615,
86175,
48302,
8757,
1269,
8378,
10211,
263,
368,
341,
286,
1077,
5206,
7102,
284,
508,
32858,
20330,
26,
220,
16,
935,
286,
1077,
5206,
2033,
284,
5949,
486,
931,
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... | 1 |
#[test]
fn test_simple_application() {
let app = glib::Object::new::<SimpleApplication>(&[
("application-id", &"org.gtk-rs.SimpleApplication"),
("flags", &crate::ApplicationFlags::empty()),
])
.unwrap()
.upcast::<crate::Application>();
app.set_inactivity_timeout(10000);
assert!(app.run(&["--local".to_string()]) == EXIT_STATUS);
} | rust_cleaned_test_functions.jsonl/77198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
38721,
368,
341,
286,
1077,
906,
284,
342,
2740,
486,
1190,
486,
931,
27638,
16374,
4988,
44784,
9640,
310,
3489,
5132,
12897,
497,
609,
1,
1775,
1302,
6242,
3795,
82,
24252,
4988,
4461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_struct_fields_default() {
check_fix(
r#"
//- minicore: default
struct TestWithDefault(usize);
impl Default for TestWithDefault {
pub fn default() -> Self {
Self(0)
}
}
struct TestStruct { one: i32, two: TestWithDefault }
fn test_fn() {
let s = TestStruct{ $0 };
}
"#,
r"
struct TestWithDefault(usize);
impl Default for TestWithDefault {
pub fn default() -> Self {
Self(0)
}
}
struct TestStruct { one: i32, two: TestWithDefault }
fn test_fn() {
let s = TestStruct{ one: 0, two: TestWithDefault::default() };
}
",
);
} | rust_cleaned_test_functions.jsonl/127193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
15126,
12132,
9993,
368,
341,
286,
1779,
36060,
1006,
310,
435,
2,
698,
61463,
1308,
292,
460,
25,
1638,
198,
1235,
3393,
2354,
3675,
7,
51878,
317,
6383,
7899,
369,
3393,
2354,
3675,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decoding_luma_op() {
let mut state = State::new();
let pixel_a = Pixel { r: 100, g: 100, b: 100, a: 255 };
let pixel_b = Pixel { r: 100, g: 108, b: 100, a: 255 };
let mut source = Vec::new();
state.prev_pixel = pixel_a;
match pixel_b.diff(&pixel_a) {
Some(PixelDiff::Luma(diff_g, diff_rg, diff_bg)) => {
Op::Luma(diff_g, diff_rg, diff_bg)
.into_bytes(&mut source)
.expect("Failed to write op");
}
_ => {
panic!("Expected luma diff");
}
};
assert_eq!(
decode_pixel(&mut state, &mut source.as_slice().bytes()),
Ok(pixel_b)
);
} | rust_cleaned_test_functions.jsonl/69402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
3700,
907,
13416,
10287,
368,
341,
262,
1077,
5206,
1584,
284,
3234,
486,
931,
543,
262,
1077,
12955,
4306,
284,
27469,
314,
435,
25,
220,
16,
15,
15,
11,
342,
25,
220,
16,
15,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_root_branch() {
let template = compile("{{ if @root }}Hello World!{{ endif }}");
let context = true;
let context = ::serde_json::to_value(&context).unwrap();
let template_registry = other_templates();
let formatter_registry = formatters();
let string = template
.render(&context, &template_registry, &formatter_registry)
.unwrap();
assert_eq!("Hello World!", &string);
} | rust_cleaned_test_functions.jsonl/76687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12993,
28031,
368,
341,
286,
1077,
3811,
284,
19192,
445,
2979,
421,
569,
2888,
3869,
9707,
4337,
0,
2979,
12330,
3869,
797,
286,
1077,
2266,
284,
830,
280,
286,
1077,
2266,
284,
3504,
47024,
94... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eh_frame_fde_out_of_bounds() {
let mut cie = make_test_cie();
cie.version = 1;
let end_of_cie = Label::new();
let mut fde = FrameDescriptionEntry {
offset: 0,
length: 0,
format: Format::Dwarf64,
cie: cie.clone(),
initial_segment: 0,
initial_address: 0xfeed_beef,
address_range: 999,
augmentation: None,
instructions: EndianSlice::new(&[], LittleEndian),
};
let kind = eh_frame_le();
let section = Section::with_endian(kind.endian())
.cie(kind, None, &mut cie)
.mark(&end_of_cie)
.fde(kind, 99_999_999_999_999, &mut fde);
section.start().set_const(0);
let section = section.get_contents().unwrap();
let eh_frame = kind.section(§ion);
let section = EndianSlice::new(§ion, LittleEndian);
let result = parse_fde(
eh_frame,
&mut section.range_from(end_of_cie.value().unwrap() as usize..),
UnwindSection::cie_from_offset,
);
assert_eq!(result, Err(Error::OffsetOutOfBounds));
} | rust_cleaned_test_functions.jsonl/9386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 620
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
71,
8929,
761,
450,
6068,
3575,
36878,
368,
341,
286,
1077,
5206,
272,
645,
284,
1281,
4452,
666,
645,
543,
286,
272,
645,
19484,
284,
220,
16,
401,
286,
1077,
835,
3575,
666,
645,
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_tags_python() {
let language = get_language("python");
let tags_config = TagsConfiguration::new(language, PYTHON_TAG_QUERY, "").unwrap();
let mut tag_context = TagsContext::new();
let source = br#"
class Customer:
"""
Data about a customer
"""
def age(self):
'''
Get the customer's age
'''
compute_age(self.id)
}
"#;
let tags = tag_context
.generate_tags(&tags_config, source, None)
.unwrap()
.0
.collect::<Result<Vec<_>, _>>()
.unwrap();
assert_eq!(
tags.iter()
.map(|t| (
substr(source, &t.name_range),
tags_config.syntax_type_name(t.syntax_type_id)
))
.collect::<Vec<_>>(),
&[
("Customer", "class"),
("age", "function"),
("compute_age", "call"),
]
);
assert_eq!(substr(source, &tags[0].line_range), "class Customer:");
assert_eq!(substr(source, &tags[1].line_range), "def age(self):");
assert_eq!(tags[0].docs.as_ref().unwrap(), "Data about a customer");
assert_eq!(tags[1].docs.as_ref().unwrap(), "Get the customer's age");
} | rust_cleaned_test_functions.jsonl/66035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16333,
55869,
368,
341,
262,
1077,
4128,
284,
633,
29021,
445,
12669,
797,
262,
1077,
9492,
5332,
284,
27683,
7688,
486,
931,
60740,
11,
76678,
16592,
31585,
11,
35229,
15454,
543,
262,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_bytes() {
assert_eq!(FeatureProposal::Expired.try_to_vec().unwrap(), vec![3]);
assert_eq!(
FeatureProposal::Pending(AcceptanceCriteria {
tokens_required: 0xdeadbeefdeadbeef,
deadline: -1,
})
.try_to_vec()
.unwrap(),
vec![1, 239, 190, 173, 222, 239, 190, 173, 222, 255, 255, 255, 255, 255, 255, 255, 255],
);
} | rust_cleaned_test_functions.jsonl/52892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
12524,
368,
341,
286,
2060,
10714,
10297,
13859,
98637,
486,
54349,
48779,
2346,
13251,
1005,
15454,
1507,
7486,
20703,
18,
10149,
286,
2060,
10714,
33673,
310,
19998,
98637,
486,
32027,
4346,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_owned_nested() {
let gil = Python::acquire_gil();
let py = gil.python();
let obj = get_object(py);
// Ensure that obj does not get freed
let _ref = obj.clone_ref(py);
let obj_ptr = obj.as_ptr();
unsafe {
{
let _pool = py.new_pool();
assert_eq!(owned_object_count(), 0);
gil::register_owned(py, NonNull::new_unchecked(obj.into_ptr()));
assert_eq!(owned_object_count(), 1);
assert_eq!(ffi::Py_REFCNT(obj_ptr), 2);
{
let _pool = py.new_pool();
let obj = get_object(py);
gil::register_owned(py, NonNull::new_unchecked(obj.into_ptr()));
assert_eq!(owned_object_count(), 2);
}
assert_eq!(owned_object_count(), 1);
}
{
assert_eq!(owned_object_count(), 0);
assert_eq!(ffi::Py_REFCNT(obj_ptr), 1);
}
}
} | rust_cleaned_test_functions.jsonl/25426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51973,
66279,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
2839,
284,
633,
5314,
46827,
317,
286,
442,
29279,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_module_export() {
let path = std::path::PathBuf::from(env!("WASMEDGE_DIR"))
.join("bindings/rust/wasmedge-sys/tests/data/import.wasm");
let result = Config::create();
assert!(result.is_ok());
let mut config = result.unwrap();
config.bulk_memory_operations(true);
assert!(config.bulk_memory_operations_enabled());
// load module from file
let result = Loader::create(Some(config));
assert!(result.is_ok());
let loader = result.unwrap();
let result = loader.from_file(path);
assert!(result.is_ok());
let module = result.unwrap();
assert!(!module.inner.0.is_null());
// check exports
assert_eq!(module.count_of_exports(), 16);
let exports = module.exports_iter().collect::<Vec<_>>();
// check the ty and name functions
assert_eq!(exports[0].ty(), ExternalType::Function);
assert_eq!(exports[0].name(), "func-1");
assert_eq!(exports[1].ty(), ExternalType::Function);
assert_eq!(exports[1].name(), "func-2");
assert_eq!(exports[2].ty(), ExternalType::Function);
assert_eq!(exports[2].name(), "func-3");
assert_eq!(exports[3].ty(), ExternalType::Function);
assert_eq!(exports[3].name(), "func-4");
assert_eq!(module.count_of_exports(), 16);
assert_eq!(exports[4].ty(), ExternalType::Function);
assert_eq!(exports[4].name(), "func-add");
assert_eq!(exports[5].ty(), ExternalType::Function);
assert_eq!(exports[5].name(), "func-mul-2");
assert_eq!(exports[6].ty(), ExternalType::Function);
assert_eq!(exports[6].name(), "func-call-indirect");
assert_eq!(exports[7].ty(), ExternalType::Function);
assert_eq!(exports[7].name(), "func-host-add");
assert_eq!(exports[8].ty(), ExternalType::Function);
assert_eq!(exports[8].name(), "func-host-sub");
assert_eq!(exports[9].ty(), ExternalType::Function);
assert_eq!(exports[9].name(), "func-host-mul");
assert_eq!(exports[10].ty(), ExternalType::Function);
assert_eq!(exports[10].name(), "func-host-div");
assert_eq!(exports[11].ty(), ExternalType::Table);
assert_eq!(exports[11].name(), "tab-func");
assert_eq!(exports[12].ty(), ExternalType::Table);
assert_eq!(exports[12].name(), "tab-ext");
assert_eq!(exports[13].ty(), ExternalType::Memory);
assert_eq!(exports[13].name(), "mem");
assert_eq!(exports[14].ty(), ExternalType::Global);
assert_eq!(exports[14].name(), "glob-mut-i32");
assert_eq!(exports[15].ty(), ExternalType::Global);
assert_eq!(exports[15].name(), "glob-const-f32");
// check the function_type function
let result = exports[15].function_type(&module);
assert!(result.is_err());
assert_eq!(
result.unwrap_err(),
WasmEdgeError::Export(ExportError::Type {
expected: ExternalType::Function,
actual: ExternalType::Global,
})
);
let result = exports[4].function_type(&module);
assert!(result.is_ok());
let func_ty = result.unwrap();
assert_eq!(func_ty.params_len(), 2);
assert_eq!(func_ty.returns_len(), 1);
// check the table_type function
let result = exports[0].table_type(&module);
assert!(result.is_err());
assert_eq!(
result.unwrap_err(),
WasmEdgeError::Export(ExportError::Type {
expected: ExternalType::Table,
actual: ExternalType::Function,
})
);
let result = exports[12].table_type(&module);
assert!(result.is_ok());
let table_ty = result.unwrap();
assert_eq!(table_ty.elem_ty(), RefType::ExternRef);
assert_eq!(table_ty.limit(), 10..=10);
// check the memory_type function
let result = exports[0].memory_type(&module);
assert!(result.is_err());
assert_eq!(
result.unwrap_err(),
WasmEdgeError::Export(ExportError::Type {
expected: ExternalType::Memory,
actual: ExternalType::Function,
})
);
let result = exports[13].memory_type(&module);
assert!(result.is_ok());
let mem_ty = result.unwrap();
assert_eq!(mem_ty.limit(), 1..=3);
// check the global_type function
let result = exports[0].global_type(&module);
assert!(result.is_err());
assert_eq!(
result.unwrap_err(),
WasmEdgeError::Export(ExportError::Type {
expected: ExternalType::Global,
actual: ExternalType::Function,
})
);
let result = exports[15].global_type(&module);
assert!(result.is_ok());
let global_ty = result.unwrap();
assert_eq!(global_ty.value_type(), ValType::F32);
assert_eq!(global_ty.mutability(), Mutability::Const);
} | rust_cleaned_test_functions.jsonl/62634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
27114,
368,
341,
286,
1077,
1815,
284,
1460,
486,
2343,
486,
1820,
15064,
486,
1499,
16978,
17223,
54,
52584,
83693,
8291,
5455,
310,
659,
5987,
445,
65495,
7382,
590,
6324,
300,
2061,
709,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_timeout() {
let addr = next_test_ip4();
let listener = t!(TcpListener::bind(&addr));
let mut stream = t!(TcpStream::connect(&("localhost", addr.port())));
t!(stream.set_read_timeout(Some(Duration::from_millis(1000))));
let mut buf = [0; 10];
let wait = Duration::span(|| {
let kind = stream.read(&mut buf).err().expect("expected error").kind();
assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
});
assert!(wait > Duration::from_millis(400));
assert!(wait < Duration::from_millis(1600));
} | rust_cleaned_test_functions.jsonl/26646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
20537,
368,
341,
286,
1077,
10789,
284,
1790,
4452,
10385,
19,
543,
286,
1077,
11446,
284,
259,
10297,
77536,
2743,
486,
7666,
2099,
6214,
3237,
286,
1077,
5206,
4269,
284,
259,
10297,
77536... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_join_for_different_types() {
test_join!("a-b", ["a", "b"], "-");
let hyphen = "-".to_string();
test_join!("a-b", [s("a"), s("b")], &*hyphen);
test_join!("a-b", vec!["a", "b"], &*hyphen);
test_join!("a-b", &*vec!["a", "b"], "-");
test_join!("a-b", vec![s("a"), s("b")], "-");
} | rust_cleaned_test_functions.jsonl/17589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
5478,
82741,
9763,
368,
341,
262,
1273,
31017,
17223,
64,
1455,
497,
4383,
64,
497,
330,
65,
7914,
6523,
797,
262,
1077,
6275,
14769,
284,
6523,
3263,
983,
3904,
543,
262,
1273,
31017,
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_full_date() {
let p = Parser::new();
assert_eq!(p.date("1942-12-07").1,
Done("", Date::new_str("1942", "12", "07"))
);
} | rust_cleaned_test_functions.jsonl/27417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
4164,
368,
341,
262,
1077,
281,
284,
21102,
486,
931,
543,
262,
2060,
10714,
10297,
79,
9907,
445,
16,
24,
19,
17,
12,
16,
17,
12,
15,
22,
1827,
16,
345,
414,
27357,
19814,
2631,
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_device_token_access_denied() {
let details = new_device_auth_details(2);
assert_eq!("12345", details.device_code().secret());
assert_eq!("https://verify/here", details.verification_uri().as_str());
assert_eq!("abcde", details.user_code().secret().as_str());
assert_eq!(
"https://verify/here?abcde",
details
.verification_uri_complete()
.unwrap()
.secret()
.as_str()
);
assert_eq!(Duration::from_secs(2), details.expires_in());
assert_eq!(Duration::from_secs(1), details.interval());
let token = new_client()
.exchange_device_access_token(&details)
.set_time_fn(mock_time_fn())
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
(AUTHORIZATION, "Basic YWFhOmJiYg=="),
],
"grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Adevice_code&device_code=12345",
None,
HttpResponse {
status_code: StatusCode::from_u16(400).unwrap(),
headers: vec![(
CONTENT_TYPE,
HeaderValue::from_str("application/json").unwrap(),
)]
.into_iter()
.collect(),
body: "{\
\"error\": \"access_denied\", \
\"error_description\": \"Access Denied\"\
}"
.to_string()
.into_bytes(),
},
),
mock_sleep_fn,
None)
.err()
.unwrap();
match token {
RequestTokenError::ServerResponse(msg) => {
assert_eq!(msg.error(), &DeviceCodeErrorResponseType::AccessDenied)
}
_ => unreachable!("Error should be Access Denied"),
}
} | rust_cleaned_test_functions.jsonl/18631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1030
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9204,
6458,
12759,
49522,
1122,
368,
341,
262,
1077,
3565,
284,
501,
9204,
14014,
13260,
7,
17,
317,
262,
2060,
10714,
17223,
16,
17,
18,
19,
20,
497,
3565,
18355,
4136,
1005,
20474,
1423,
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... | 2 |
#[test]
fn test_extract_too_many_parts() {
let mut map: HashMap<String, String> = HashMap::new();
map.set(
JAEGER_HEADER,
format!("{}:{}:0:1:aa", LONG_TRACE_ID_STR, SPAN_ID_STR),
);
let propagator = Propagator::new();
let context = propagator.extract(&map);
assert_eq!(
context.remote_span_context(),
Some(&SpanContext::empty_context())
);
} | rust_cleaned_test_functions.jsonl/62660 | {
"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,
39123,
2346,
78,
22101,
33217,
368,
341,
310,
1077,
5206,
2415,
25,
10528,
3464,
11,
923,
29,
284,
10528,
486,
931,
543,
310,
2415,
980,
1006,
394,
619,
13669,
8738,
20330,
345,
394,
3561,
17223... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_euc_kr_decode() {
// Empty
decode_euc_kr(b"", &"");
// ASCII
decode_euc_kr(b"\x61\x62", "\u{0061}\u{0062}");
decode_euc_kr(b"\x81\x41", "\u{AC02}");
decode_euc_kr(b"\x81\x5B", "\u{FFFD}\x5B");
decode_euc_kr(b"\xFD\xFE", "\u{8A70}");
decode_euc_kr(b"\xFE\x41", "\u{FFFD}\x41");
decode_euc_kr(b"\xFF\x41", "\u{FFFD}\x41");
decode_euc_kr(b"\x80\x41", "\u{FFFD}\x41");
decode_euc_kr(b"\xA1\xFF", "\u{FFFD}");
decode_euc_kr(b"\x81\xFF", "\u{FFFD}");
} | rust_cleaned_test_functions.jsonl/65317 | {
"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,
2204,
1754,
4698,
81,
15227,
368,
341,
286,
442,
22228,
198,
286,
16895,
2204,
1754,
4698,
81,
1883,
56323,
609,
3014,
626,
286,
442,
39316,
198,
286,
16895,
2204,
1754,
4698,
81,
1883,
11934,
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_buffer_and_range_extend_backwards() {
let buf = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
let mut buf = BufferAndRange::new_from(&buf, 2..8);
assert_eq!(buf.range(), 2..8);
assert_eq!(buf.as_ref(), [2, 3, 4, 5, 6, 7]);
buf.extend_backwards(1);
assert_eq!(buf.range(), 1..8);
assert_eq!(buf.as_ref(), [1, 2, 3, 4, 5, 6, 7]);
buf.extend_backwards(1);
assert_eq!(buf.range(), 0..8);
assert_eq!(buf.as_ref(), [0, 1, 2, 3, 4, 5, 6, 7]);
} | rust_cleaned_test_functions.jsonl/15738 | {
"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,
7776,
8378,
9698,
70265,
3895,
4014,
368,
341,
310,
1077,
6607,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strengthen_four_elem_arr() {
let to_test = vec![0, 1, 2, 3];
let expected = [0, 1, 2, 3, 0, 0, 0, 0];
assert_eq!(strengthen(to_test), expected);
} | rust_cleaned_test_functions.jsonl/54013 | {
"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,
1261,
265,
18465,
56142,
28179,
11210,
368,
341,
286,
1077,
311,
4452,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
3601,
284,
508,
15,
11,
220,
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_range_includes() {
let range = Range {
specifier: ModuleSpecifier::parse("file:///a.ts").unwrap(),
start: Position {
line: 1,
character: 20,
},
end: Position {
line: 1,
character: 30,
},
};
assert!(range.includes(&Position {
line: 1,
character: 20
}));
assert!(range.includes(&Position {
line: 1,
character: 25
}));
assert!(range.includes(&Position {
line: 1,
character: 30
}));
assert!(!range.includes(&Position {
line: 0,
character: 25
}));
assert!(!range.includes(&Position {
line: 2,
character: 25
}));
} | rust_cleaned_test_functions.jsonl/26848 | {
"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,
9698,
1243,
7396,
368,
341,
262,
1077,
2088,
284,
16437,
341,
414,
97616,
25,
13711,
87297,
486,
6400,
445,
1192,
60896,
64,
21288,
1827,
15454,
3148,
414,
1191,
25,
12380,
341,
286,
1555,
25,
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_vec3_fmt() {
let a = Vec3::new(1.0, 2.0, 3.0);
assert_eq!(format!("{:?}", a), "Vec3(1.0, 2.0, 3.0)");
assert_eq!(format!("{}", a), "[1, 2, 3]");
} | rust_cleaned_test_functions.jsonl/75029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
38128,
368,
341,
262,
1077,
264,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
317,
262,
2060,
10714,
10297,
2243,
88928,
25,
52652,
264,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_table_comment() {
let p = TOMLParser::new();
assert_eq!(p.table_comment(" [table.\"ƭáβℓè\"] #úñïçôřñřôβôƭ\n").1,
Done("\n",
Expression::new(WSSep::new_str(" ", " "), None, Some(Rc::new(TableType::Standard(Table::new_str(
WSSep::new_str("", ""), "table", vec![
WSKeySep::new_str(WSSep::new_str("", ""), "\"ƭáβℓè\"")
]
)))),
Some(Comment::new_str("úñïçôřñřôβôƭ"))
)
));
} | rust_cleaned_test_functions.jsonl/95654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5237,
17638,
368,
341,
262,
1077,
281,
284,
82465,
43,
6570,
486,
931,
543,
262,
2060,
10714,
10297,
79,
10336,
17638,
445,
508,
2005,
86865,
130,
255,
1953,
51255,
145033,
4458,
75104,
671,
6654,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.