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_read_interested() {
let mut r = Reader::new();
r.state = State::Len;
let data = vec![0u8, 0, 0, 1, 2];
test_message(data, Message::Interested);
} | rust_cleaned_test_functions.jsonl/46446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
15318,
9980,
368,
341,
286,
1077,
5206,
435,
284,
25166,
486,
931,
543,
286,
435,
3467,
284,
3234,
486,
11271,
280,
286,
1077,
821,
284,
7486,
20703,
15,
84,
23,
11,
220,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_set() {
assert_eq!(0xFFu8.with_bits(4..8, 2), 0x2F);
assert_eq!(0xFFu8.with_bits(4.., 2), 0x2F);
assert_eq!(0xFFu8.with_bits(0..4, 2), 0xF2);
assert_eq!(0xFFu8.with_bits(..4, 2), 0xF2);
assert_eq!(0xFFu8.with_bits(8..8, 0), 0xFF);
assert_eq!(0xFFu8.with_bits(8.., 0), 0xFF);
assert_eq!(0u32.with_bits(5..9, 0xF), 0b111100000);
assert_eq!(
0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAu128
.with_bit(127, false)
.with_bit(126, true),
0x6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
);
assert_eq!(
0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAu128.with_bits(126..128, 1),
0x6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
);
} | rust_cleaned_test_functions.jsonl/52223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
368,
341,
6948,
10714,
10297,
15,
9264,
84,
23,
18164,
20034,
7,
19,
496,
23,
11,
220,
17,
701,
220,
15,
87,
17,
37,
317,
6948,
10714,
10297,
15,
9264,
84,
23,
18164,
20034,
7,
19,
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_generic_argument() {
ok("class A[T](val: T)");
ok("class A[T](var val: T)");
ok("class A[T](let val: T)");
} | rust_cleaned_test_functions.jsonl/84185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
9025,
368,
341,
286,
5394,
445,
1040,
362,
20340,
9533,
831,
25,
350,
20996,
286,
5394,
445,
1040,
362,
20340,
9533,
947,
1044,
25,
350,
20996,
286,
5394,
445,
1040,
362,
20340,
9533,
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 |
#[test]
fn test_weighted_choice() {
// this makes assumptions about the internal implementation of
macro_rules! t {
($items:expr, $expected:expr) => {{
let mut items = $items;
let wc = WeightedChoice::new(&mut items);
let expected = $expected;
let mut rng = CountingRng { i: 0 };
for &val in expected.iter() {
assert_eq!(wc.ind_sample(&mut rng), val)
}
}}
}
t!(vec!(Weighted { weight: 1, item: 10}), [10]);
// skip some
t!(vec!(Weighted { weight: 0, item: 20},
Weighted { weight: 2, item: 21},
Weighted { weight: 0, item: 22},
Weighted { weight: 1, item: 23}),
[21,21, 23]);
// different weights
t!(vec!(Weighted { weight: 4, item: 30},
Weighted { weight: 3, item: 31}),
[30,30,30,30, 31,31,31]);
// check that we're binary searching
// correctly with some vectors of odd
// length.
t!(vec!(Weighted { weight: 1, item: 40},
Weighted { weight: 1, item: 41},
Weighted { weight: 1, item: 42},
Weighted { weight: 1, item: 43},
Weighted { weight: 1, item: 44}),
[40, 41, 42, 43, 44]);
t!(vec!(Weighted { weight: 1, item: 50},
Weighted { weight: 1, item: 51},
Weighted { weight: 1, item: 52},
Weighted { weight: 1, item: 53},
Weighted { weight: 1, item: 54},
Weighted { weight: 1, item: 55},
Weighted { weight: 1, item: 56}),
[50, 51, 52, 53, 54, 55, 56]);
} | rust_cleaned_test_functions.jsonl/34897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 979
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15876,
291,
31936,
368,
341,
286,
442,
419,
3643,
31846,
911,
279,
5306,
8129,
315,
79133,
23459,
286,
18072,
21407,
0,
259,
341,
310,
1711,
3615,
96011,
11,
400,
7325,
96011,
8,
589,
80505,
394... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_mut_slice_from() {
let mut values = Vec::from_slice([1u8,2,3,4,5]);
{
let slice = values.mut_slice_from(2);
assert!(slice == [3, 4, 5]);
for p in slice.mut_iter() {
*p += 2;
}
}
assert!(values.as_slice() == [1, 2, 5, 6, 7]);
} | rust_cleaned_test_functions.jsonl/58449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
26488,
5673,
368,
341,
286,
1077,
5206,
2750,
284,
11312,
486,
1499,
26488,
2561,
16,
84,
23,
11,
17,
11,
18,
11,
19,
11,
20,
2558,
286,
341,
310,
1077,
15983,
284,
2750,
744,
332,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_int_decimal_strings() {
let tests: Vec<(&str, i64)> = vec![
("0", 0),
("-5", -5),
("9223372036854775807", i64::max_value()),
("0b1010", 0),
("1.23", 1),
];
for (input, expected) in tests {
let args = HashMap::new();
let result = int(&to_value(input).unwrap(), &args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(expected).unwrap());
}
} | rust_cleaned_test_functions.jsonl/119660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
74429,
33500,
368,
341,
286,
1077,
7032,
25,
11312,
27,
2099,
495,
11,
600,
21,
19,
16018,
284,
7486,
90515,
310,
3489,
15,
497,
220,
15,
1326,
310,
98670,
20,
497,
481,
20,
1326,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_diagnostic_timer_format() {
let mut profile_timer = DiagnosticTimer::now();
println!("Debug Format: ");
for _ in 0..20 {
std::thread::spawn(move || {
println!("{:?}", profile_timer);
});
profile_timer.start_record();
std::thread::sleep(Duration::from_millis(10));
profile_timer.stop_record();
}
println!("Display Format: ");
for _ in 0..20 {
std::thread::spawn(move || {
println!("{}", profile_timer);
});
profile_timer.start_record();
std::thread::sleep(Duration::from_millis(10));
profile_timer.stop_record();
}
} | rust_cleaned_test_functions.jsonl/46223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29477,
11953,
16255,
8955,
368,
341,
286,
1077,
5206,
5526,
16255,
284,
49988,
10105,
486,
3328,
1428,
286,
13751,
17223,
7939,
15042,
25,
7318,
286,
369,
716,
304,
220,
15,
496,
17,
15,
341,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_create_without_indexes() {
let tmp_dir = tempfile::tempdir().unwrap();
let path = tmp_dir.path().join("test_create_without_indexes");
let name = path.to_str().unwrap();
assert!(
DocumentStore::open(name, vec![]).is_err(),
"should not have been created"
);
} | rust_cleaned_test_functions.jsonl/110730 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
39904,
50161,
368,
341,
286,
1077,
4174,
4334,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
1815,
284,
4174,
4334,
3875,
1005,
5987,
445,
1944,
8657,
39904,
50161,
797,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rsquared() {
let rng = &mut ::rand::thread_rng();
for _ in 0..1000 {
let a = Fr::random(rng);
let b: U256 = a.into();
let c = Fr::new(b).unwrap();
assert_eq!(a, c);
}
for _ in 0..1000 {
let a = Fq::random(rng);
let b: U256 = a.into();
let c = Fq::new(b).unwrap();
assert_eq!(a, c);
}
} | rust_cleaned_test_functions.jsonl/64633 | {
"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,
47115,
34249,
368,
341,
262,
1077,
28422,
284,
609,
6984,
3504,
11335,
486,
4528,
66849,
1428,
262,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
286,
1077,
264,
284,
2869,
486,
11463,
875... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_broadcast_dependencies() {
let (mut smp, peers) =
SharedMempoolNetwork::bootstrap_validator_network(2, 1, None, None, false);
let (peer_a, peer_b) = (peers.get(0).unwrap(), peers.get(1).unwrap());
// Peer A has transactions with sequence numbers 0 and 2
smp.add_txns(
&peer_a,
vec![TestTransaction::new(0, 0, 1), TestTransaction::new(0, 2, 1)],
);
// Peer B has txn1
smp.add_txns(&peer_b, vec![TestTransaction::new(0, 1, 1)]);
// A and B discover each other
smp.send_new_peer_event(peer_a, peer_b, true);
smp.send_new_peer_event(peer_b, peer_a, false);
// B receives 0
smp.deliver_message(&peer_a, 1, true, true, false);
// now B can broadcast 1
let txn = smp.deliver_message(&peer_b, 1, true, true, false).0;
assert_eq!(txn.get(0).unwrap().sequence_number(), 1);
// now A can broadcast 2
let txn = smp.deliver_message(&peer_a, 1, true, true, false).0;
assert_eq!(txn.get(0).unwrap().sequence_number(), 2);
} | rust_cleaned_test_functions.jsonl/54558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74923,
71841,
368,
341,
262,
1077,
320,
6984,
274,
1307,
11,
25029,
8,
4035,
286,
16990,
44,
3262,
1749,
12320,
486,
6281,
64959,
20966,
7,
17,
11,
220,
16,
11,
2240,
11,
2240,
11,
895,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zinc_symbol_encode() {
let value: Value = Value::make_symbol("test");
assert_eq!(value, Value::make_symbol("test"));
assert_eq!(value.to_zinc_string(), Ok("^test".into()));
} | rust_cleaned_test_functions.jsonl/77328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
2840,
21179,
11224,
368,
341,
262,
1077,
897,
25,
5162,
284,
5162,
486,
6927,
21179,
445,
1944,
797,
262,
2060,
10714,
10297,
957,
11,
5162,
486,
6927,
21179,
445,
1944,
14929,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_zipmap_compress() {
struct TestRdbHandler {
map: HashMap<String, String>,
}
impl EventHandler for TestRdbHandler {
fn handle(&mut self, data: Event) {
match data {
Event::RDB(rdb) => match rdb {
Object::Hash(hash) => {
assert_eq!("zipmap_compresses_easily", String::from_utf8_lossy(hash.key));
for field in hash.fields {
let name = String::from_utf8_lossy(&field.name).to_string();
let val = String::from_utf8_lossy(&field.value).to_string();
self.map.insert(name, val);
}
}
Object::EOR => {
assert_eq!("aa", self.map.get("a").unwrap());
assert_eq!("aaaa", self.map.get("aa").unwrap());
assert_eq!("aaaaaaaaaaaaaa", self.map.get("aaaaa").unwrap());
}
_ => {}
},
Event::AOF(_) => {}
}
}
}
start_redis_test(
"zipmap_that_compresses_easily.rdb",
10013,
Rc::new(RefCell::new(TestRdbHandler { map: HashMap::new() })),
);
} | rust_cleaned_test_functions.jsonl/93097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 774
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
2186,
87845,
368,
341,
262,
2036,
3393,
49,
1999,
3050,
341,
286,
2415,
25,
10528,
3464,
11,
923,
12520,
262,
555,
262,
11605,
31957,
369,
3393,
49,
1999,
3050,
341,
286,
5168,
3705,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_call_giver() -> Result<(), Box<dyn std::error::Error>> {
let giver_abi_name = "tests/samples/giver.abi.json";
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("config")
.arg("--url")
.arg(&*NETWORK)
.assert()
.success();
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("call")
.arg("0:841288ed3b55d9cdafa806807f02a0ae0c169aa5edfe88a789a6482429756a94")
.arg("sendGrams")
.arg(r#"{"dest":"0:841288ed3b55d9cdafa806807f02a0ae0c169aa5edfe88a789a6482429756a94","amount":1000000000}"#)
.arg("--abi")
.arg(giver_abi_name)
.assert()
.success()
.stdout(predicate::str::contains("Succeeded"));
Ok(())
} | rust_cleaned_test_functions.jsonl/118312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
1889,
1524,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
94515,
22885,
72,
1269,
284,
330,
23841,
2687,
4023,
4846,
1524,
22048,
72,
4323,
876,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_and() {
let compiled = compile("SET B 255\nSET C 345\nAND B C");
let out_cpu = test_program(compiled);
assert_eq!(out_cpu.a.value, 0);
assert_eq!(out_cpu.b.value, 89);
assert_eq!(out_cpu.c.value, 345);
assert_eq!(out_cpu.f.value, 0);
} | rust_cleaned_test_functions.jsonl/63156 | {
"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,
8378,
368,
341,
262,
1077,
19697,
284,
19192,
445,
5884,
425,
220,
17,
20,
20,
1699,
5884,
356,
220,
18,
19,
20,
1699,
3976,
425,
356,
797,
262,
1077,
700,
21795,
284,
1273,
25096,
30008,
2181... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default() {
let c = TableCellProperty::new();
let b = c.build();
assert_eq!(str::from_utf8(&b).unwrap(), r#"<w:tcPr />"#);
} | rust_cleaned_test_functions.jsonl/22959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
368,
341,
286,
1077,
272,
284,
84370,
3052,
486,
931,
543,
286,
1077,
293,
284,
272,
13239,
543,
286,
2060,
10714,
10297,
495,
486,
1499,
39453,
23,
2099,
65,
568,
15454,
1507,
435,
2,
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 |
#[test]
fn test_gen_compact_code_blocks() -> io::Result<()> {
let entities = setup();
const ENTITY_FILES: [&str; 6] = [
include_str!("../../tests/compact/cake.rs"),
include_str!("../../tests/compact/cake_filling.rs"),
include_str!("../../tests/compact/filling.rs"),
include_str!("../../tests/compact/fruit.rs"),
include_str!("../../tests/compact/vendor.rs"),
include_str!("../../tests/compact/rust_keyword.rs"),
];
assert_eq!(entities.len(), ENTITY_FILES.len());
for (i, entity) in entities.iter().enumerate() {
let mut reader = BufReader::new(ENTITY_FILES[i].as_bytes());
let mut lines: Vec<String> = Vec::new();
reader.read_until(b';', &mut Vec::new())?;
let mut line = String::new();
while reader.read_line(&mut line)? > 0 {
lines.push(line.to_owned());
line.clear();
}
let content = lines.join("");
let expected: TokenStream = content.parse().unwrap();
let generated = EntityWriter::gen_compact_code_blocks(entity, &crate::WithSerde::None)
.into_iter()
.skip(1)
.fold(TokenStream::new(), |mut acc, tok| {
acc.extend(tok);
acc
});
assert_eq!(expected.to_string(), generated.to_string());
}
Ok(())
} | rust_cleaned_test_functions.jsonl/76351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 771
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
18177,
531,
4136,
25201,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
14744,
284,
6505,
543,
286,
733,
73871,
48010,
25,
34336,
495,
26,
220,
21,
60,
284,
2278,
310,
2924,
2895,
172... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_text() {
let mut schema_builder = Schema::builder();
let name = schema_builder.add_text_field("name", TEXT);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
{
let mut index_writer = index.writer_for_tests().unwrap();
index_writer.add_document(doc!(name => "hi"));
index_writer.add_document(doc!(name => "this is a test"));
index_writer.add_document(
doc!(name => "some more documents with some word overlap with the other test"),
);
index_writer.add_document(doc!(name => "hello hi goodbye"));
index_writer.commit().unwrap();
}
let searcher = index.searcher().unwrap();
let searcher_space_usage = searcher.space_usage().unwrap();
assert!(searcher_space_usage.total() > 0);
assert_eq!(1, searcher_space_usage.segments().len());
let segment = &searcher_space_usage.segments()[0];
assert!(segment.total() > 0);
assert_eq!(4, segment.num_docs());
expect_single_field(segment.termdict(), &name, 1, 512);
expect_single_field(segment.postings(), &name, 1, 512);
expect_single_field(segment.positions(), &name, 1, 512);
assert_eq!(0, segment.fast_fields().total());
expect_single_field(segment.fieldnorms(), &name, 1, 512);
// TODO: understand why the following fails
assert_eq!(0, segment.deletes());
} | rust_cleaned_test_functions.jsonl/62189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
829,
284,
10802,
28532,
1364,
4326,
5013,
445,
606,
497,
15762,
317,
286,
1077,
10802,
284,
10802,
28532,
132... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filling() {
let drawing_area = create_mocked_drawing_area(1024, 768, |m| {
m.check_draw_rect(|c, _, f, u, d| {
assert_eq!(c, WHITE.to_rgba());
assert_eq!(f, true);
assert_eq!(u, (0, 0));
assert_eq!(d, (1023, 767));
});
m.drop_check(|b| {
assert_eq!(b.num_draw_rect_call, 1);
assert_eq!(b.draw_count, 1);
});
});
drawing_area.fill(&WHITE).expect("Drawing Failure");
} | rust_cleaned_test_functions.jsonl/81492 | {
"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,
761,
9400,
368,
341,
286,
1077,
13330,
15030,
284,
1855,
34134,
291,
814,
1696,
15030,
7,
16,
15,
17,
19,
11,
220,
22,
21,
23,
11,
760,
76,
91,
341,
310,
296,
9093,
23021,
16979,
22428,
66,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aes256_ccm_verify_fail() {
let key = "7f4af6765cad1d511db07e33aaafd57646ec279db629048aa6770af24849aa0d";
let nonce = "dde2a362ce81b2b6913abc3095";
let aad = "404f5df97ece7431987bc098cce994fc3c063b519ffa47b0365226a0015ef695";
let ct = "353022db9c568bd7183a13c40b1ba30fcc768c54264aa2cd";
let tag = "0000a053c9244d3217a7ad05";
let out = decrypt_aead(
Cipher::aes_256_ccm(),
&Vec::from_hex(key).unwrap(),
Some(&Vec::from_hex(nonce).unwrap()),
&Vec::from_hex(aad).unwrap(),
&Vec::from_hex(ct).unwrap(),
&Vec::from_hex(tag).unwrap(),
);
assert!(out.is_err());
} | rust_cleaned_test_functions.jsonl/110562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90958,
17,
20,
21,
28955,
76,
35638,
22121,
368,
341,
286,
1077,
1376,
284,
330,
22,
69,
19,
2577,
21,
22,
21,
20,
34455,
16,
67,
20,
16,
16,
1999,
15,
22,
68,
18,
18,
5305,
92139,
20,
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_selector_pseudo_nth_of_type() -> Result {
let html = r#"
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>:nth-of-type</title>
</head>
<body>
<dl>
<dt>dt1</dt>
<dd>dd1</dd>
<dd>dd2</dd>
<dd>dd3</dd>
<dt>dt2</dt>
<dd>dd4</dd>
<dt>dt3</dt>
<dd>dd5</dd>
<dd>dd6</dd>
</dl>
</body>
</html>
"#;
let root = Vis::load(html)?;
let dl = root.find("dl");
let type_child = dl.children(":nth-of-type(0)");
assert_eq!(type_child.length(), 0);
let type_child = dl.find(":nth-of-type(1)");
assert_eq!(type_child.length(), 2);
assert_eq!(type_child.text(), "dt1dd1");
let odd_type_childs = dl.find(":nth-of-type(odd)");
assert_eq!(odd_type_childs.length(), 5);
assert_eq!(odd_type_childs.text(), "dt1dd1dd3dt3dd5");
let childs_type_3n = dl.find(":nth-of-type(3n)");
assert_eq!(childs_type_3n.length(), 3);
assert_eq!(childs_type_3n.text(), "dd3dt3dd6");
let childs_type_3n_2n = childs_type_3n.filter(":nth-of-type(2n)");
assert_eq!(childs_type_3n_2n.length(), 1);
assert_eq!(childs_type_3n_2n.text(), "dd6");
// prevs
let childs_type_3n_2n_prevs = childs_type_3n_2n.prev_all(":nth-of-type(3n)");
assert_eq!(childs_type_3n_2n_prevs.length(), 2);
assert_eq!(childs_type_3n_2n_prevs.text(), "dd3dt3");
Ok(())
} | rust_cleaned_test_functions.jsonl/58029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 778
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28890,
620,
21952,
78342,
3575,
1819,
368,
1464,
5714,
341,
10217,
5272,
284,
435,
2,
698,
262,
71341,
50139,
5272,
397,
262,
366,
1551,
8688,
428,
268,
881,
414,
366,
1983,
397,
286,
366,
5490,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_program_little_endian() {
const NUM: u32 = 0x12345678;
const LE_BYTES: [u8; 4] = [0x78, 0x56, 0x34, 0x12];
let mut mem = Memory::new(1024);
mem.program_le_bytes(&LE_BYTES).unwrap();
assert_eq!(NUM, mem.read_word(0).unwrap());
} | rust_cleaned_test_functions.jsonl/92785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
907,
2377,
87193,
368,
341,
286,
733,
15943,
25,
575,
18,
17,
284,
220,
15,
87,
16,
17,
18,
19,
20,
21,
22,
23,
280,
286,
733,
11148,
40705,
25,
508,
84,
23,
26,
220,
19,
60,
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_multipart_type_type_parsing() {
let tests = vec![
MultipartParseTest {
mime_type: ("multipart", "mixed"),
result: Some(MimeMultipartType::Mixed),
},
MultipartParseTest {
mime_type: ("multipart", "alternative"),
result: Some(MimeMultipartType::Alternative),
},
MultipartParseTest {
mime_type: ("multipart", "digest"),
result: Some(MimeMultipartType::Digest),
},
MultipartParseTest {
mime_type: ("multipart", "encrypted"),
result: Some(MimeMultipartType::Encrypted),
},
MultipartParseTest {
mime_type: ("multipart", "parallel"),
result: Some(MimeMultipartType::Parallel),
},
// Test fallback on multipart/mixed
MultipartParseTest {
mime_type: ("multipart", "potato"),
result: Some(MimeMultipartType::Mixed),
},
MultipartParseTest {
mime_type: ("multipart", "signed"),
result: Some(MimeMultipartType::Signed),
},
// Test failure state
MultipartParseTest {
mime_type: ("text", "plain"),
result: None,
},
];
for test in tests.into_iter() {
let (major_type, minor_type) = test.mime_type;
assert_eq!(
MimeMultipartType::from_content_type((major_type.to_string(), minor_type.to_string())),
test.result
);
}
} | rust_cleaned_test_functions.jsonl/112547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 965
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
18204,
1819,
1819,
620,
28598,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
386,
18204,
14463,
2271,
341,
394,
45270,
1819,
25,
3489,
29542,
497,
330,
56685,
4461,
394,
1102,
25,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_map_append() {
let mut a = SgMap::new();
a.insert(1, "1");
a.insert(2, "2");
a.insert(3, "3");
let mut b = SgMap::<_, _, DEFAULT_CAPACITY>::new();
b.insert(4, "4");
b.insert(5, "5");
b.insert(6, "6");
a.append(&mut b);
assert!(b.is_empty());
assert_eq!(a.len(), 6);
assert_eq!(
a.into_iter().collect::<Vec<(usize, &str)>>(),
vec![(1, "1"), (2, "2"), (3, "3"), (4, "4"), (5, "5"), (6, "6")]
);
} | rust_cleaned_test_functions.jsonl/18651 | {
"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,
5376,
26041,
368,
341,
262,
1077,
5206,
264,
284,
328,
70,
2227,
486,
931,
1428,
262,
264,
7030,
7,
16,
11,
330,
16,
797,
262,
264,
7030,
7,
17,
11,
330,
17,
797,
262,
264,
7030,
7,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fp2_mul() {
let mut a = Fp2::new(
Fp::from_u64s_le(&[
0x85c9f989e1461f03,
0xa2e33c333449a1d6,
0x41e461154a7354a3,
0x9ee53e7e84d7532e,
0x1c202d8ed97afb45,
0x51d3f9253e2516f,
])
.unwrap(),
Fp::from_u64s_le(&[
0xa7348a8b511aedcf,
0x143c215d8176b319,
0x4cc48081c09b8903,
0x9533e4a9a5158be,
0x7a5e1ecb676d65f9,
0x180c3ee46656b008,
])
.unwrap(),
);
a *= &Fp2::new(
Fp::from_u64s_le(&[
0xe21f9169805f537e,
0xfc87e62e179c285d,
0x27ece175be07a531,
0xcd460f9f0c23e430,
0x6c9110292bfa409,
0x2c93a72eb8af83e,
])
.unwrap(),
Fp::from_u64s_le(&[
0x4b1c3f936d8992d4,
0x1d2a72916dba4c8a,
0x8871c508658d1e5f,
0x57a06d3135a752ae,
0x634cd3c6c565096d,
0x19e17334d4e93558,
])
.unwrap(),
);
assert_eq!(
a,
Fp2::new(
Fp::from_u64s_le(&[
0x95b5127e6360c7e4,
0xde29c31a19a6937e,
0xf61a96dacf5a39bc,
0x5511fe4d84ee5f78,
0x5310a202d92f9963,
0x1751afbe166e5399
])
.unwrap(),
Fp::from_u64s_le(&[
0x84af0e1bd630117a,
0x6c63cd4da2c2aa7,
0x5ba6e5430e883d40,
0xc975106579c275ee,
0x33a9ac82ce4c5083,
0x1ef1a36c201589d
])
.unwrap(),
)
);
} | rust_cleaned_test_functions.jsonl/62481 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1569
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34160,
17,
24944,
368,
341,
286,
1077,
5206,
264,
284,
434,
79,
17,
486,
931,
1006,
310,
434,
79,
486,
1499,
7300,
21,
19,
82,
11751,
2099,
9640,
394,
220,
15,
87,
23,
20,
66,
24,
69,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pod_spec_creation_with_multiple_containers() {
let mut placeholder_limits1: ResourceQuantityType = BTreeMap::new();
placeholder_limits1.insert(RESOURCE_REQUIREMENTS_KEY.to_string(), Default::default());
placeholder_limits1.insert("do-not-change-this".to_string(), Default::default());
let placeholder_requests1 = placeholder_limits1.clone();
let mut placeholder_limits2: ResourceQuantityType = BTreeMap::new();
placeholder_limits2.insert(RESOURCE_REQUIREMENTS_KEY.to_string(), Default::default());
placeholder_limits2.insert("do-not-change-this".to_string(), Default::default());
let placeholder_requests2 = placeholder_limits2.clone();
do_pod_spec_creation_test(
vec!["image1".to_string(), "image2".to_string()],
vec![
Container {
image: Some("image1".to_string()),
resources: Some(ResourceRequirements {
limits: Some(placeholder_limits1),
requests: Some(placeholder_requests1),
}),
..Default::default()
},
Container {
image: Some("image2".to_string()),
resources: Some(ResourceRequirements {
limits: Some(placeholder_limits2),
requests: Some(placeholder_requests2),
}),
..Default::default()
},
],
);
} | rust_cleaned_test_functions.jsonl/1226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85337,
13594,
46163,
6615,
45233,
10260,
20568,
368,
341,
286,
1077,
5206,
5878,
31820,
16,
25,
11765,
17342,
929,
284,
425,
6533,
2227,
486,
931,
543,
286,
5878,
31820,
16,
7030,
7,
54260,
53927,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let dir = TempDir::new("storage_dir").unwrap();
let mut id_tracker = SimpleIdTracker::open(dir.path()).unwrap();
id_tracker.set_link(200.into(), 0).unwrap();
id_tracker.set_link(100.into(), 1).unwrap();
id_tracker.set_link(150.into(), 2).unwrap();
id_tracker.set_link(120.into(), 3).unwrap();
id_tracker.set_link(180.into(), 4).unwrap();
id_tracker.set_link(110.into(), 5).unwrap();
id_tracker.set_link(115.into(), 6).unwrap();
id_tracker.set_link(190.into(), 7).unwrap();
id_tracker.set_link(177.into(), 8).unwrap();
id_tracker.set_link(118.into(), 9).unwrap();
let first_four = id_tracker.iter_from(None).take(4).collect_vec();
assert_eq!(first_four.len(), 4);
assert_eq!(first_four[0].0, 100.into());
let last = id_tracker.iter_from(Some(first_four[3].0)).collect_vec();
assert_eq!(last.len(), 7);
} | rust_cleaned_test_functions.jsonl/2114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
368,
341,
286,
1077,
5419,
284,
19944,
6184,
486,
931,
445,
16172,
4334,
1827,
15454,
1428,
286,
1077,
5206,
877,
50264,
284,
8993,
764,
31133,
486,
2508,
14161,
3875,
6011,
15454,
1428,
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_dh_generate_key_compute_key() {
let dh1 = Dh::get_2048_224().unwrap().generate_key().unwrap();
let dh2 = Dh::get_2048_224().unwrap().generate_key().unwrap();
let shared_a = dh1.compute_key(dh2.public_key()).unwrap();
let shared_b = dh2.compute_key(dh1.public_key()).unwrap();
assert_eq!(shared_a, shared_b);
} | rust_cleaned_test_functions.jsonl/54787 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
71,
48851,
3097,
57028,
3097,
368,
341,
286,
1077,
34096,
16,
284,
43227,
486,
455,
62,
17,
15,
19,
23,
62,
17,
17,
19,
1005,
15454,
1005,
19366,
3097,
1005,
15454,
543,
286,
1077,
34096,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raycast() {
use crate::geom::euclid::approxeq::ApproxEq;
use crate::path::Path;
let mut builder = Path::builder();
builder.move_to(point(0.0, 0.0));
builder.line_to(point(1.0, 0.0));
builder.line_to(point(1.0, 1.0));
builder.line_to(point(0.0, 1.0));
builder.close();
let path = builder.build();
assert!(raycast_path(
&Ray {
origin: point(-1.0, 2.0),
direction: vector(1.0, 0.0)
},
path.iter(),
0.1
)
.is_none());
let hit = raycast_path(
&Ray {
origin: point(-1.0, 0.5),
direction: vector(1.0, 0.0),
},
path.iter(),
0.1,
)
.unwrap();
assert!(hit.position.approx_eq(&point(0.0, 0.5)));
assert!(hit.normal.approx_eq(&vector(-1.0, 0.0)));
let hit = raycast_path(
&Ray {
origin: point(-1.0, 0.0),
direction: vector(1.0, 0.0),
},
path.iter(),
0.1,
)
.unwrap();
assert!(hit.position.approx_eq(&point(0.0, 0.0)));
let hit = raycast_path(
&Ray {
origin: point(0.5, 0.5),
direction: vector(1.0, 0.0),
},
path.iter(),
0.1,
)
.unwrap();
assert!(hit.position.approx_eq(&point(1.0, 0.5)));
assert!(hit.normal.approx_eq(&vector(-1.0, 0.0)));
let hit = raycast_path(
&Ray {
origin: point(0.0, -1.0),
direction: vector(1.0, 1.0),
},
path.iter(),
0.1,
)
.unwrap();
assert!(hit.position.approx_eq(&point(1.0, 0.0)));
} | rust_cleaned_test_functions.jsonl/128686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 913
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
51287,
368,
341,
262,
990,
17717,
486,
41916,
486,
20128,
75044,
486,
15707,
8371,
80,
486,
28588,
12606,
80,
280,
262,
990,
17717,
486,
2343,
486,
1820,
401,
262,
1077,
5206,
7363,
284,
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_mount_does_not_upgrade() -> anyhow::Result<()> {
let (_kernel, current_task) = create_kernel_and_task();
let root_fs = TmpFs::new();
let root_node = Arc::clone(root_fs.root());
let _dev_node = root_node.create_dir(b"dev").expect("failed to mkdir dev");
let dev_fs = TmpFs::new();
let dev_root_node = Arc::clone(dev_fs.root());
let _dev_pts_node = dev_root_node.create_dir(b"pts").expect("failed to mkdir pts");
let ns = Namespace::new(root_fs.clone());
let mut context = LookupContext::default();
let dev = ns
.root()
.lookup_child(¤t_task, &mut context, b"dev")
.expect("failed to lookup dev");
dev.mount(WhatToMount::Fs(dev_fs), MountFlags::empty())
.expect("failed to mount dev root node");
let mut context = LookupContext::default();
let new_dev = ns
.root()
.lookup_child(¤t_task, &mut context, b"dev")
.expect("failed to lookup dev again");
assert!(!Arc::ptr_eq(&dev.entry, &new_dev.entry));
assert_ne!(&dev, &new_dev);
let mut context = LookupContext::default();
let _new_pts = new_dev
.lookup_child(¤t_task, &mut context, b"pts")
.expect("failed to lookup pts");
let mut context = LookupContext::default();
assert!(dev.lookup_child(¤t_task, &mut context, b"pts").is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/80 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 692
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57593,
96374,
7913,
67794,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
5453,
23248,
11,
1482,
12184,
8,
284,
1855,
26876,
8378,
12184,
543,
286,
1077,
3704,
34470,
284,
350,
1307,
48300,
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_scalar_multiplication() {
let result: Matrix4x4<f64> = (1_f64 / 32_f64) * Matrix4x4::new(
7_f64, -1_f64, -1_f64, -1_f64,
-1_f64, 7_f64, -1_f64, -1_f64,
-1_f64, -1_f64, 7_f64, -1_f64,
-1_f64, -1_f64, -1_f64, 7_f64
);
let expected: Matrix4x4<f64> = Matrix4x4::new(
(1_f64 / 32_f64) * 7_f64, (1_f64 / 32_f64) * -1_f64, (1_f64 / 32_f64) * -1_f64, (1_f64 / 32_f64) * -1_f64,
(1_f64 / 32_f64) * -1_f64, (1_f64 / 32_f64) * 7_f64, (1_f64 / 32_f64) * -1_f64, (1_f64 / 32_f64) * -1_f64,
(1_f64 / 32_f64) * -1_f64, (1_f64 / 32_f64) * -1_f64, (1_f64 / 32_f64) * 7_f64, (1_f64 / 32_f64) * -1_f64,
(1_f64 / 32_f64) * -1_f64, (1_f64 / 32_f64) * -1_f64, (1_f64 / 32_f64) * -1_f64, (1_f64 / 32_f64) * 7_f64
);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
91802,
1693,
368,
341,
286,
1077,
1102,
25,
11631,
19,
87,
19,
63895,
21,
19,
29,
284,
320,
16,
761,
21,
19,
608,
220,
18,
17,
761,
21,
19,
8,
353,
11631,
19,
87,
19,
486,
931,
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_is_ascii_success() {
let mut src: Vec<u8> = Vec::with_capacity(128);
src.resize(128, 0);
for i in 0..src.len() {
src[i] = i as u8;
}
for i in 0..src.len() {
assert!(is_ascii(&src[i..]));
}
} | rust_cleaned_test_functions.jsonl/27296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
50238,
18632,
368,
341,
286,
1077,
5206,
2286,
25,
11312,
34837,
23,
29,
284,
11312,
486,
4197,
35603,
7,
16,
17,
23,
317,
286,
2286,
17382,
7,
16,
17,
23,
11,
220,
15,
317,
286,
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... | 3 |
#[test]
fn test_service_config_discard_single_apply_panic() {
let mut testkit = testkit_with_supervisor_and_service(1);
let initiator_id = testkit.network().us().validator_id().unwrap();
let params = "apply_panic".to_owned();
let propose = ConfigProposeBuilder::new(CFG_CHANGE_HEIGHT)
.extend_service_config_propose(params)
.build();
testkit
.create_block_with_transaction(sign_config_propose_transaction(
&testkit,
propose,
initiator_id,
))
.transactions[0]
.status()
.expect("Transaction with change propose discarded.");
testkit.create_blocks_until(CFG_CHANGE_HEIGHT);
let snapshot = testkit.snapshot();
let err = snapshot
.for_core()
.call_errors(testkit.height())
.get(&CallInBlock::after_transactions(SUPERVISOR_INSTANCE_ID))
.unwrap();
assert!(err.description().contains("Configure panic"));
// Create one more block for supervisor to remove failed config.
testkit.create_block();
assert_eq!(config_propose_entry(&testkit), None);
check_service_actual_param(&testkit, None);
} | rust_cleaned_test_functions.jsonl/93845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12267,
5332,
37745,
567,
19487,
36551,
620,
31270,
368,
341,
262,
1077,
5206,
1273,
8226,
284,
1273,
8226,
6615,
23723,
31396,
8378,
12267,
7,
16,
317,
262,
1077,
98040,
842,
284,
1273,
8226,
2057... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_filetype_from_str() {
assert_eq!(
VersionFiletype::from_str("package.json").unwrap(),
VersionFiletype::JSON
);
assert_eq!(
VersionFiletype::from_str("version.json").unwrap(),
VersionFiletype::JSON
);
assert_eq!(
VersionFiletype::from_str("Cargo.toml").unwrap(),
VersionFiletype::TOML
);
assert_eq!(
VersionFiletype::from_str("version.toml").unwrap(),
VersionFiletype::TOML
);
assert!(VersionFiletype::from_str("version.txt").is_err(),);
} | rust_cleaned_test_functions.jsonl/46661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
2458,
1313,
5673,
2895,
368,
341,
286,
2060,
10714,
33673,
310,
6079,
1703,
1313,
486,
1499,
2895,
445,
1722,
4323,
1827,
15454,
3148,
310,
6079,
1703,
1313,
486,
5370,
198,
286,
1439,
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_logging_statistics() {
let mut runner = Runner::new();
let _query = runner.proxy.start_logging(
"test",
&mut vec![&mut Metric::Temperature(Temperature {
sampling_interval_ms: 100,
statistics_args: Some(Box::new(StatisticsArgs { statistics_interval_ms: 300 })),
})]
.into_iter(),
1_000,
false,
false,
);
runner.run_server_task_until_stalled();
for i in 0..9 {
runner.cpu_temperature.set(30.0 + i as f32);
runner.gpu_temperature.set(40.0 + i as f32);
runner.iterate_logging_task();
if i < 2 {
// Check statistics data is not available for the first 200 ms.
assert_data_tree!(
runner.inspector,
root: {
MetricsLogger: {
test: {
TemperatureLogger: {
"elapsed time (ms)": 100 * (1 + i as i64),
"cpu": {
"data (°C)": runner.cpu_temperature.get() as f64,
"statistics": {
"(start ms, end ms]":
vec![std::i64::MIN, std::i64::MIN],
"max (°C)": f64::MIN,
"min (°C)": f64::MIN,
"average (°C)": f64::MIN,
}
},
"/dev/fake/gpu_temperature": {
"data (°C)": runner.gpu_temperature.get() as f64,
"statistics": {
"(start ms, end ms]":
vec![std::i64::MIN, std::i64::MIN],
"max (°C)": f64::MIN,
"min (°C)": f64::MIN,
"average (°C)": f64::MIN,
}
}
}
}
}
}
);
} else {
// Check statistics data is updated every 300 ms.
assert_data_tree!(
runner.inspector,
root: {
MetricsLogger: {
test: {
TemperatureLogger: {
"elapsed time (ms)": 100 * (i + 1 as i64),
"cpu": {
"data (°C)": (30 + i) as f64,
"statistics": {
"(start ms, end ms]":
vec![100 * (i - 2 - (i + 1) % 3 as i64),
100 * (i + 1 - (i + 1) % 3 as i64)],
"max (°C)": (30 + i - (i + 1) % 3) as f64,
"min (°C)": (28 + i - (i + 1) % 3) as f64,
"average (°C)": (29 + i - (i + 1) % 3) as f64,
}
},
"/dev/fake/gpu_temperature": {
"data (°C)": (40 + i) as f64,
"statistics": {
"(start ms, end ms]":
vec![100 * (i - 2 - (i + 1) % 3 as i64),
100 * (i + 1 - (i + 1) % 3 as i64)],
"max (°C)": (40 + i - (i + 1) % 3) as f64,
"min (°C)": (38 + i - (i + 1) % 3) as f64,
"average (°C)": (39 + i - (i + 1) % 3) as f64,
}
}
}
}
}
}
);
}
}
// With one moreect.
runner.iterate_logging_task();
assert_data_tree!(
runner.inspector,
root: {
MetricsLogger: {}
}
);
} | rust_cleaned_test_functions.jsonl/66709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3563
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59982,
49569,
368,
341,
286,
1077,
5206,
22259,
284,
44946,
486,
931,
1428,
286,
1077,
716,
1631,
284,
22259,
41103,
4962,
59982,
1006,
310,
330,
1944,
756,
310,
609,
6984,
7486,
20703,
5,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let memo_instruction = CompiledInstruction {
program_id_index: 0,
accounts: vec![],
data: vec![240, 159, 166, 150],
};
let expected_json = json!({
"spl-memo": "🦖"
});
assert_eq!(
parse(&MEMO_PROGRAM_ID, &memo_instruction),
Some(expected_json)
);
let non_parsable_program_id = Pubkey::new(&[1; 32]);
assert_eq!(parse(&non_parsable_program_id, &memo_instruction), None);
} | rust_cleaned_test_functions.jsonl/121422 | {
"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,
21039,
368,
341,
286,
1077,
21438,
54923,
284,
96471,
16664,
341,
310,
2025,
842,
3560,
25,
220,
15,
345,
310,
9618,
25,
7486,
20703,
1259,
310,
821,
25,
7486,
20703,
17,
19,
15,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_only_clips() {
let x = b"GGAAAAAAAAAAAAA";
let y = b"TTTTAATTTGTGTAAAAAATAATA";
let base_score = Scoring::from_scores(-4, -4, 4, -7);
let scoring = Scoring {
xclip_prefix: 0,
xclip_suffix: 0,
yclip_suffix: 0,
..base_score
};
let mut al = Aligner::with_scoring(scoring);
let alignment = al.custom(x, y);
assert_eq!(alignment.score, 0);
} | rust_cleaned_test_functions.jsonl/16856 | {
"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,
18410,
6794,
3077,
368,
341,
286,
1077,
856,
284,
293,
1,
22254,
57905,
25699,
32,
876,
286,
1077,
379,
284,
293,
1,
14903,
14903,
32,
828,
14903,
25388,
25388,
25699,
32,
4485,
4485,
876,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_base_gaussian() -> Fallible<()> {
let measurement = Result::from(opendp_meas__make_base_gaussian(
util::into_raw(0.0) as *const c_void, "AllDomain<f64>".to_char_p()))?;
let arg = AnyObject::new_raw(1.0);
let res = core::opendp_core__measurement_invoke(&measurement, arg);
let res: f64 = Fallible::from(res)?.downcast()?;
assert_eq!(res, 1.0);
Ok(())
} | rust_cleaned_test_functions.jsonl/80688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
7651,
1889,
46972,
368,
1464,
14785,
1238,
71698,
341,
286,
1077,
18662,
284,
5714,
486,
1499,
17096,
408,
79,
95786,
563,
6927,
7651,
1889,
46972,
1006,
310,
4094,
486,
18122,
16067,
7,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_concatenation()
{
let a0 = DecimationNode::new(Complex::from(0.0), 1, 0, false);
let a4 = DecimationNode::new(Complex::from(4.0), 1, 1, true);
let a2 = DecimationNode::new(Complex::from(2.0), 1, 0, false);
let a6 = DecimationNode::new(Complex::from(6.0), 1, 1, true);
let a1 = DecimationNode::new(Complex::from(1.0), 1, 0, false);
let a5 = DecimationNode::new(Complex::from(5.0), 1, 1, true);
let a3 = DecimationNode::new(Complex::from(3.0), 1, 0, false);
let a7 = DecimationNode::new(Complex::from(7.0), 1, 1, true);
let concat = DecimationLeaf::generate_parent(
DecimationLeaf::new(vec![a0, a4], vec![a2, a6], 1),
DecimationLeaf::new(vec![a1, a5], vec![a3, a7], 1)
);
let exp = DecimationLeaf::new(vec![a0, a4, a2, a6], vec![a1, a5, a3, a7], 2);
let conc_lhs = concat.lhs
.into_iter()
.map(|node| node.element)
.collect::<Vec<_>>();
let conc_rhs = concat.rhs
.into_iter()
.map(|node| node.element)
.collect::<Vec<_>>();
let exp_lhs = exp.lhs
.into_iter()
.map(|node| node.element)
.collect::<Vec<_>>();
let exp_rhs = exp.rhs
.into_iter()
.map(|node| node.element)
.collect::<Vec<_>>();
assert_eq!(exp_lhs, conc_lhs);
assert_eq!(exp_rhs, conc_rhs);
} | rust_cleaned_test_functions.jsonl/586 | {
"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,
57478,
268,
367,
741,
262,
341,
286,
1077,
264,
15,
284,
3714,
5465,
1955,
486,
931,
7,
31137,
486,
1499,
7,
15,
13,
15,
701,
220,
16,
11,
220,
15,
11,
895,
317,
286,
1077,
264,
19,
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_cp_arg_symlink() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("--symbolic-link")
.arg(TEST_HELLO_WORLD_DEST)
.succeeds();
assert!(at.is_symlink(TEST_HELLO_WORLD_DEST));
} | rust_cleaned_test_functions.jsonl/21242 | {
"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,
39811,
6057,
58530,
44243,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
575,
8710,
21186,
50320,
69235,
1593,
38913,
25430,
340,
286,
659,
858... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_commands() {
let td: Vec<String> = vec![
"nop +0".to_string(),
"acc +1".to_string(),
"jmp -4".to_string(),
];
let commands = read_commands(&td).unwrap();
assert_eq!(commands[0], Command::Nop(0));
assert_eq!(commands[1], Command::Acc(1));
assert_eq!(commands[2], Command::Jmp(-4));
} | rust_cleaned_test_functions.jsonl/50506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
44151,
368,
341,
286,
1077,
17941,
25,
11312,
3464,
29,
284,
7486,
90515,
310,
330,
62813,
488,
15,
3263,
983,
3904,
3148,
310,
330,
4475,
488,
16,
3263,
983,
3904,
3148,
310,
330,
61055,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_root_error_is_not_swallowed_on_parse_error() -> Result<(), String> {
init();
let raw_schema = r#"/not/a/real/file"#;
let error = Schema::parse_str(raw_schema).unwrap_err();
if let Error::ParseSchemaJson(e) = error {
assert!(
e.to_string().contains("expected value at line 1 column 1"),
"{}",
e
);
Ok(())
} else {
Err(format!(
"Expected serde_json::error::Error, got {:?}",
error
))
}
} | rust_cleaned_test_functions.jsonl/69042 | {
"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,
12993,
4096,
6892,
7913,
32581,
20967,
4470,
21039,
4096,
368,
1464,
5714,
68843,
923,
29,
341,
262,
2930,
1428,
262,
1077,
7112,
25371,
284,
435,
2,
3115,
1921,
14186,
14,
7951,
23903,
57676,
280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty_can_be_expanded() {
let mut r = Reader::from_str("<a />");
r.trim_text(true).expand_empty_elements(true);
next_eq!(r, Start, b"a", End, b"a");
} | rust_cleaned_test_functions.jsonl/42067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
27421,
21263,
14214,
6465,
368,
341,
262,
1077,
5206,
435,
284,
25166,
486,
1499,
2895,
9639,
64,
6206,
797,
262,
435,
16419,
4326,
3715,
568,
32317,
15124,
22801,
3715,
317,
262,
1790,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_handle_burn_from() {
let (init_result, mut deps) = init_helper_with_config(
vec![InitialBalance {
address: HumanAddr("bob".to_string()),
amount: Uint128(10000),
}],
false,
false,
false,
true,
0,
);
assert!(
init_result.is_ok(),
"Init failed: {}",
init_result.err().unwrap()
);
let (init_result_for_failure, mut deps_for_failure) = init_helper(vec![InitialBalance {
address: HumanAddr("bob".to_string()),
amount: Uint128(10000),
}]);
assert!(
init_result_for_failure.is_ok(),
"Init failed: {}",
init_result_for_failure.err().unwrap()
);
// test when burn disabled
let handle_msg = HandleMsg::BurnFrom {
owner: HumanAddr("bob".to_string()),
amount: Uint128(2500),
memo: None,
padding: None,
};
let handle_result = handle(&mut deps_for_failure, mock_env("alice", &[]), handle_msg);
let error = extract_error_msg(handle_result);
assert!(error.contains("Burn functionality is not enabled for this token."));
// Burn before allowance
let handle_msg = HandleMsg::BurnFrom {
owner: HumanAddr("bob".to_string()),
amount: Uint128(2500),
memo: None,
padding: None,
};
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
let error = extract_error_msg(handle_result);
assert!(error.contains("insufficient allowance"));
// Burn more than allowance
let handle_msg = HandleMsg::IncreaseAllowance {
spender: HumanAddr("alice".to_string()),
amount: Uint128(2000),
padding: None,
expiration: None,
};
let handle_result = handle(&mut deps, mock_env("bob", &[]), handle_msg);
assert!(
handle_result.is_ok(),
"handle() failed: {}",
handle_result.err().unwrap()
);
let handle_msg = HandleMsg::BurnFrom {
owner: HumanAddr("bob".to_string()),
amount: Uint128(2500),
memo: None,
padding: None,
};
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
let error = extract_error_msg(handle_result);
assert!(error.contains("insufficient allowance"));
// Sanity check
let handle_msg = HandleMsg::BurnFrom {
owner: HumanAddr("bob".to_string()),
amount: Uint128(2000),
memo: None,
padding: None,
};
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
assert!(
handle_result.is_ok(),
"handle() failed: {}",
handle_result.err().unwrap()
);
let bob_canonical = deps
.api
.canonical_address(&HumanAddr("bob".to_string()))
.unwrap();
let bob_balance = crate::state::ReadonlyBalances::from_storage(&deps.storage)
.account_amount(&bob_canonical);
assert_eq!(bob_balance, 10000 - 2000);
let total_supply = ReadonlyConfig::from_storage(&deps.storage).total_supply();
assert_eq!(total_supply, 10000 - 2000);
// Second burn more than allowance
let handle_msg = HandleMsg::BurnFrom {
owner: HumanAddr("bob".to_string()),
amount: Uint128(1),
memo: None,
padding: None,
};
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
let error = extract_error_msg(handle_result);
assert!(error.contains("insufficient allowance"));
} | rust_cleaned_test_functions.jsonl/69609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1927
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
880,
399,
5673,
368,
341,
286,
1077,
320,
2327,
5287,
11,
5206,
48178,
8,
284,
2930,
10418,
6615,
5332,
1006,
310,
7486,
20703,
6341,
21190,
341,
394,
2621,
25,
11097,
13986,
445,
47086,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_undefined_default_parameter_removed() {
test(
"function f(x=undefined,y) { }",
"function f(x,y) { }",
);
test(
"function f(x,y=undefined,z) { }",
"function f(x,y ,z) { }",
);
test(
"function f(x=undefined,y=undefined,z=undefined) { }",
"function f(x, y, z) { }",
);
} | rust_cleaned_test_functions.jsonl/484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
9614,
9993,
24899,
68248,
368,
341,
262,
1273,
1006,
286,
330,
1688,
282,
2075,
28,
9614,
7358,
8,
314,
220,
335,
497,
715,
286,
330,
1688,
282,
2075,
7358,
8,
1797,
314,
220,
335,
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_strict_mode_dup_func_parameters() {
// Checks that a function cannot contain duplicate parameter
let scenario = r#"
'use strict';
function f(a, b, b) {}
"#;
check_output(&[TestAction::TestStartsWith(
scenario,
"Uncaught \"SyntaxError\": ",
)]);
} | rust_cleaned_test_functions.jsonl/42876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
849,
7302,
51932,
9596,
18263,
368,
341,
262,
442,
24843,
429,
264,
729,
4157,
6644,
22513,
5733,
87079,
262,
1077,
15048,
284,
435,
2,
698,
262,
364,
810,
7304,
1010,
262,
729,
282,
2877,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_interaction_response() {
let value = InteractionResponse {
kind: InteractionResponseType::ChannelMessageWithSource,
data: Some(InteractionResponseData {
allowed_mentions: None,
attachments: None,
choices: None,
components: None,
content: Some("test".into()),
custom_id: None,
embeds: None,
flags: Some(MessageFlags::EPHEMERAL),
title: None,
tts: None,
}),
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "InteractionResponse",
len: 2,
},
Token::Str("type"),
Token::U8(4),
Token::Str("data"),
Token::Some,
Token::Struct {
name: "InteractionResponseData",
len: 2,
},
Token::Str("content"),
Token::Some,
Token::Str("test"),
Token::Str("flags"),
Token::Some,
Token::U64(64),
Token::StructEnd,
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/9464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 833
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97394,
9655,
368,
341,
286,
1077,
897,
284,
42707,
2582,
341,
310,
3093,
25,
42707,
53388,
486,
9629,
2052,
2354,
3608,
345,
310,
821,
25,
4329,
7,
31311,
2582,
1043,
341,
394,
5420,
30063,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_priority_ord() {
// sorting makes sense from a "greater than" generation perspective:
assert!(Version::Stable(2).priority() > Version::Stable(1).priority());
assert!(Version::Stable(1).priority() > Version::Beta(1, None).priority());
assert!(Version::Stable(1).priority() > Version::Beta(2, None).priority());
assert!(Version::Stable(2).priority() > Version::Alpha(1, Some(2)).priority());
assert!(Version::Stable(1).priority() > Version::Alpha(2, Some(2)).priority());
assert!(Version::Beta(1, None).priority() > Version::Nonconformant("ver3".into()).priority());
assert!(Version::Stable(2).priority() > Version::Stable(1).priority());
assert!(Version::Stable(1).priority() > Version::Beta(2, None).priority());
assert!(Version::Stable(1).priority() > Version::Beta(2, Some(2)).priority());
assert!(Version::Stable(1).priority() > Version::Alpha(2, None).priority());
assert!(Version::Stable(1).priority() > Version::Alpha(2, Some(3)).priority());
assert!(Version::Stable(1).priority() > Version::Nonconformant("foo".to_string()).priority());
assert!(Version::Beta(1, Some(1)).priority() > Version::Beta(1, None).priority());
assert!(Version::Beta(1, Some(2)).priority() > Version::Beta(1, Some(1)).priority());
assert!(Version::Beta(1, None).priority() > Version::Alpha(1, None).priority());
assert!(Version::Beta(1, None).priority() > Version::Alpha(1, Some(3)).priority());
assert!(Version::Beta(1, None).priority() > Version::Nonconformant("foo".to_string()).priority());
assert!(Version::Beta(1, Some(2)).priority() > Version::Nonconformant("foo".to_string()).priority());
assert!(Version::Alpha(1, Some(1)).priority() > Version::Alpha(1, None).priority());
assert!(Version::Alpha(1, Some(2)).priority() > Version::Alpha(1, Some(1)).priority());
assert!(Version::Alpha(1, None).priority() > Version::Nonconformant("foo".to_string()).priority());
assert!(Version::Alpha(1, Some(2)).priority() > Version::Nonconformant("foo".to_string()).priority());
assert!(
Version::Nonconformant("bar".to_string()).priority()
> Version::Nonconformant("foo".to_string()).priority()
);
assert!(
Version::Nonconformant("foo1".to_string()).priority()
> Version::Nonconformant("foo10".to_string()).priority()
);
// sort orders by default are ascending
// sorting with std::cmp::Reverse on priority gives you the highest priority first
let mut vers = vec![
Version::Beta(2, Some(2)),
Version::Stable(1),
Version::Nonconformant("hi".into()),
Version::Alpha(3, Some(2)),
Version::Stable(2),
Version::Beta(2, Some(3)),
];
vers.sort_by_cached_key(|x| Reverse(x.priority()));
assert_eq!(vers, vec![
Version::Stable(2),
Version::Stable(1),
Version::Beta(2, Some(3)),
Version::Beta(2, Some(2)),
Version::Alpha(3, Some(2)),
Version::Nonconformant("hi".into()),
]);
} | rust_cleaned_test_functions.jsonl/116491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
38161,
67324,
368,
341,
286,
442,
28273,
3643,
5530,
504,
264,
330,
65235,
1091,
1,
9471,
13057,
510,
286,
2060,
10297,
5637,
486,
623,
480,
7,
17,
568,
23582,
368,
861,
6079,
486,
623,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_moduleinfo_from_json() {
let info = super::ModuleInfo::try_from(MODULE_FOO_JSON).unwrap();
assert_eq!(info.module_name, "foo");
assert_eq!(info.path.len(), 1);
assert_eq!(info.installed.len(), 2);
} | rust_cleaned_test_functions.jsonl/18375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
2733,
5673,
9455,
368,
341,
286,
1077,
3546,
284,
2256,
486,
3332,
1731,
486,
1539,
5673,
3189,
9648,
1400,
19499,
25356,
568,
15454,
543,
286,
2060,
10714,
10297,
2733,
10076,
1269,
11,
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_binary_expr_operator_precedence(
) -> std::result::Result<(), nom::Err<ParseError<'static>>> {
#[rustfmt::skip]
let tests = [
("42 + bar", vec![BinaryOp::Add]),
("42.42 + bar", vec![BinaryOp::Add]),
("42.42 + bar % 9000", vec![BinaryOp::Mod, BinaryOp::Add]),
("-42.42 + -bar % 9000", vec![BinaryOp::Mod, BinaryOp::Add]),
("foo + bar", vec![BinaryOp::Add]),
("foo + bar - baz", vec![BinaryOp::Add, BinaryOp::Sub]),
("foo + bar * baz", vec![BinaryOp::Mul, BinaryOp::Add]),
("foo * bar + baz", vec![BinaryOp::Mul, BinaryOp::Add]),
("foo * bar ^ baz", vec![BinaryOp::Pow, BinaryOp::Mul]),
("foo * bar ^ baz - qux / abc", vec![BinaryOp::Pow, BinaryOp::Mul, BinaryOp::Div, BinaryOp::Sub]),
];
fn extract_operators(expr: &Expr) -> Vec<BinaryOp> {
match expr {
Expr::BinaryOperation(e) => extract_operators(e.lhs())
.into_iter()
.chain(extract_operators(e.rhs()).into_iter())
.chain(vec![e.op()].into_iter())
.collect(),
Expr::UnaryOperation(_, e) => extract_operators(e.as_ref()),
_ => vec![],
}
}
for (input, expected_ops) in &tests {
let (_, ex) = expr(None)(Span::new(input))?;
assert_eq!(expected_ops, &extract_operators(&ex));
}
Ok(())
} | rust_cleaned_test_functions.jsonl/879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 821
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
21915,
40594,
10442,
1998,
763,
1006,
262,
873,
1464,
1460,
486,
1382,
486,
2077,
68843,
9662,
486,
7747,
27,
14463,
1454,
18291,
1978,
20154,
341,
286,
11506,
35788,
12501,
486,
20599,
921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_coalesce_none() {
let mut v = vec![(1, 1), (3, 3)];
v.coalesce(1, (2, 2));
assert_eq!(v, [(1, 1), (2, 2), (3, 3)])
} | rust_cleaned_test_functions.jsonl/57406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11393,
73250,
31488,
368,
341,
262,
1077,
5206,
348,
284,
7486,
0,
9697,
16,
11,
220,
16,
701,
320,
18,
11,
220,
18,
12587,
262,
348,
6830,
73250,
7,
16,
11,
320,
17,
11,
220,
17,
1106,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_get_machine_config() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
sender
.write_all(b"GET /machine-config HTTP/1.1\r\n\r\n")
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
} | rust_cleaned_test_functions.jsonl/43141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
3062,
38695,
5332,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_v1() -> Result<(), Error> {
let buffer = ByteView::open(fixture("symcache/compat/v1.symc"))?;
let symcache = SymCache::parse(&buffer)?;
// The symcache ID has changed from UUID to DebugId
assert_eq!(
symcache.debug_id(),
"67e9247c-814e-392b-a027-dbde6748fcbf".parse().unwrap()
);
let function = symcache
.functions()
.next()
.expect("no functions in symcache")?;
assert_eq!("_mh_execute_header", function.name().as_str());
Ok(())
} | rust_cleaned_test_functions.jsonl/16065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
16,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
4147,
284,
10906,
851,
486,
2508,
94886,
445,
23802,
9360,
14,
18331,
5457,
16,
50901,
66,
2761,
37445,
262,
1077,
7886,
9360,
284,
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... | 4 |
#[test]
fn test_verify_bank_hash() {
use BankHashVerificationError::*;
solana_logger::setup();
let db = AccountsDb::new(Vec::new(), &ClusterType::Development);
let key = solana_sdk::pubkey::new_rand();
let some_data_len = 0;
let some_slot: Slot = 0;
let account = AccountSharedData::new(1, some_data_len, &key);
let ancestors = vec![(some_slot, 0)].into_iter().collect();
db.store_uncached(some_slot, &[(&key, &account)]);
db.add_root(some_slot);
db.update_accounts_hash_test(some_slot, &ancestors);
assert_matches!(
db.verify_bank_hash_and_lamports(some_slot, &ancestors, 1, true),
Ok(_)
);
db.bank_hashes.write().unwrap().remove(&some_slot).unwrap();
assert_matches!(
db.verify_bank_hash_and_lamports(some_slot, &ancestors, 1, true),
Err(MissingBankHash)
);
let some_bank_hash = Hash::new(&[0xca; HASH_BYTES]);
let bank_hash_info = BankHashInfo {
hash: some_bank_hash,
snapshot_hash: Hash::new(&[0xca; HASH_BYTES]),
stats: BankHashStats::default(),
};
db.bank_hashes
.write()
.unwrap()
.insert(some_slot, bank_hash_info);
assert_matches!(
db.verify_bank_hash_and_lamports(some_slot, &ancestors, 1, true),
Err(MismatchedBankHash)
);
} | rust_cleaned_test_functions.jsonl/1379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 745
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
35733,
8950,
368,
341,
286,
990,
8547,
6370,
62339,
1454,
56162,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2927,
284,
40655,
7994,
486,
931,
49923,
486,
931,
1507,
609,
28678,
929... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_gtk_too_small_buffer() {
Writer::new(FixedSizedTestBuffer::new(10))
.write_gtk(&Gtk::new(2, GtkInfoTx::BothRxTx, &vec![24; 5]))
.expect_err("expected failure writing GTK KDE");
} | rust_cleaned_test_functions.jsonl/52434 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
1889,
6242,
2346,
78,
31966,
7776,
368,
341,
286,
29404,
486,
931,
7832,
3286,
50,
1506,
2271,
4095,
486,
931,
7,
16,
15,
1171,
310,
659,
4934,
1889,
6242,
2099,
45103,
486,
931,
7,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode() {
let input = "Hello, World!";
new_ucmd!()
.pipe_in(input)
.succeeds()
.stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); // spell-checker:disable-line
// Using '-' as our file
new_ucmd!()
.arg("-")
.pipe_in(input)
.succeeds()
.stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); // spell-checker:disable-line
} | rust_cleaned_test_functions.jsonl/23687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
368,
341,
262,
1077,
1946,
284,
330,
9707,
11,
4337,
26782,
262,
501,
68887,
2277,
0,
741,
286,
659,
13768,
1243,
5384,
340,
286,
659,
82,
29264,
82,
741,
286,
659,
36358,
18410,
445,
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_matrix_transpose() {
let matrix = Matrix2x3::new(
1_i32, 2_i32,
3_i32, 4_i32,
5_i32, 6_i32
);
let expected = Matrix3x2::new(
1_i32, 3_i32, 5_i32,
2_i32, 4_i32, 6_i32
);
let result = matrix.transpose();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129208 | {
"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,
10193,
7965,
2900,
368,
341,
286,
1077,
6172,
284,
11631,
17,
87,
18,
486,
931,
1006,
310,
220,
16,
5318,
18,
17,
11,
220,
17,
5318,
18,
17,
11,
715,
310,
220,
18,
5318,
18,
17,
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_update() {
let db = &Database::new(Config::default()).unwrap();
let result = db.update(|txn| -> Result<()> {
assert!(txn.update("1", Data::Int(1)).is_none());
assert_eq!(&Data::Int(1), txn.get("1").unwrap());
Ok(())
});
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/86758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
368,
341,
262,
1077,
2927,
284,
609,
5988,
486,
931,
33687,
486,
2258,
6011,
15454,
543,
262,
1077,
1102,
284,
2927,
5317,
22428,
73370,
91,
1464,
5714,
71698,
341,
7561,
2060,
10297,
73370,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate_into_string() {
let words = vec!["hello", " ", "world"];
let capitalized_words = words.iter().fold(String::default(), |acc, word| {
format!("{}{}", acc, capitalize_first(word))
});
assert_eq!(capitalized_words, "Hello World");
} | rust_cleaned_test_functions.jsonl/80479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
45514,
3904,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
3670,
330,
14615,
6332,
286,
1077,
97321,
18981,
284,
4244,
19471,
1005,
19961,
2242,
486,
2258,
1507,
760,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fail_struct_too_big() {
let src_data = b"(test) a {a 1 b 2 c 3}";
let mut limits = yass_parser::ParserLimits::unlimited();
limits.max_struct_size = 2;
let expected_error = yass_parser::ParserError::StructTooBig { pos: yass::Pos::new(0, 18) };
assert_eq!(yass_parser::parse(limits, src_data).unwrap_err(), expected_error);
} | rust_cleaned_test_functions.jsonl/126512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22121,
15126,
2346,
78,
36386,
368,
341,
262,
1077,
2286,
1769,
284,
293,
29209,
1944,
8,
264,
314,
64,
220,
16,
293,
220,
17,
272,
220,
18,
26259,
262,
1077,
5206,
13388,
284,
379,
395,
18517... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_locked_out_root_slot_child_pass() {
let mut tower = Tower::new_for_tests(0, 0.67);
let ancestors = vec![(1, vec![0].into_iter().collect())]
.into_iter()
.collect();
tower.lockouts.root_slot = Some(0);
assert!(!tower.is_locked_out(1, &ancestors));
} | rust_cleaned_test_functions.jsonl/77027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
60271,
6068,
12993,
27563,
17268,
15464,
368,
341,
286,
1077,
5206,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
15,
11,
220,
15,
13,
21,
22,
317,
286,
1077,
37518,
284,
7486,
0,
9697,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timer_no_binding() {
let (met_tx, met_rx) = mpsc::channel();
let mut rec = MetricsRecorder::new(met_tx, true);
// use Timer to make one timing
let _rv = {
// no binding means Timer does not live past the first line
Timer::new(&mut rec, "cmd");
sleep_secs(0.25);
()
};
// flush the metrics so we can see them
rec.flush_metrics();
// receive the metrics
let metrics = met_rx.recv().unwrap();
// verify that the timing is correct
let dur = metrics.first().get_timing().duration;
assert!(eq_f64(0.0, dur, 0.01));
} | rust_cleaned_test_functions.jsonl/122145 | {
"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,
16255,
6536,
60815,
368,
341,
262,
1077,
320,
4059,
17805,
11,
2270,
24330,
8,
284,
296,
81984,
486,
10119,
543,
262,
1077,
5206,
1395,
284,
54190,
47023,
486,
931,
1255,
295,
17805,
11,
830,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_upfront_shutdown_script() {
// enforce it at shutdown message
let mut config = UserConfig::default();
config.channel_options.announced_channel = true;
config.peer_channel_config_limits.force_announced_channel_preference = false;
config.channel_options.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &user_cfgs);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let flags = InitFeatures::supported();
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 2, 1000000, 1000000, flags.clone(), flags.clone());
nodes[0].node.close_channel(&OutPoint::new(chan.3.txid(), 0).to_channel_id()).unwrap();
let mut node_0_shutdown = get_event_msg!(nodes[0], MessageSendEvent::SendShutdown, nodes[2].node.get_our_node_id());
node_0_shutdown.scriptpubkey = Builder::new().push_opcode(opcodes::all::OP_RETURN).into_script().to_p2sh();
// Test we enforce upfront_scriptpbukey if by providing a diffrent one at closing that we disconnect peer
nodes[2].node.handle_shutdown(&nodes[0].node.get_our_node_id(), &node_0_shutdown);
let events = nodes[2].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 2);
match events[0] {
MessageSendEvent::BroadcastChannelUpdate { .. } => {},
_ => panic!("Unexpected event"),
}
if let MessageSendEvent::HandleError { ref action, .. } = events[1] {
match action {
&ErrorAction::SendErrorMessage { ref msg } => {
assert_eq!(msg.data,"Got shutdown request with a scriptpubkey which did not match their previous scriptpubkey");
},
_ => { assert!(false); }
}
} else { assert!(false); }
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 2, 1000000, 1000000, flags.clone(), flags.clone());
nodes[0].node.close_channel(&OutPoint::new(chan.3.txid(), 0).to_channel_id()).unwrap();
let node_0_shutdown = get_event_msg!(nodes[0], MessageSendEvent::SendShutdown, nodes[2].node.get_our_node_id());
nodes[2].node.handle_shutdown(&nodes[0].node.get_our_node_id(), &node_0_shutdown);
let events = nodes[2].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
match events[0] {
MessageSendEvent::SendShutdown { node_id, .. } => { assert_eq!(node_id, nodes[0].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
// We test that if case of peer non-signaling we don't enforce committed script at channel opening
let mut flags_no = InitFeatures::supported();
flags_no.unset_upfront_shutdown_script();
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 1000000, flags_no, flags.clone());
nodes[0].node.close_channel(&OutPoint::new(chan.3.txid(), 0).to_channel_id()).unwrap();
let mut node_1_shutdown = get_event_msg!(nodes[0], MessageSendEvent::SendShutdown, nodes[1].node.get_our_node_id());
node_1_shutdown.scriptpubkey = Builder::new().push_opcode(opcodes::all::OP_RETURN).into_script().to_p2sh();
nodes[1].node.handle_shutdown(&nodes[0].node.get_our_node_id(), &node_1_shutdown);
let events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
match events[0] {
MessageSendEvent::SendShutdown { node_id, .. } => { assert_eq!(node_id, nodes[0].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
let chan = create_announced_chan_between_nodes_with_value(&nodes, 1, 0, 1000000, 1000000, flags.clone(), flags.clone());
nodes[1].node.close_channel(&OutPoint::new(chan.3.txid(), 0).to_channel_id()).unwrap();
let mut node_0_shutdown = get_event_msg!(nodes[1], MessageSendEvent::SendShutdown, nodes[0].node.get_our_node_id());
node_0_shutdown.scriptpubkey = Builder::new().push_opcode(opcodes::all::OP_RETURN).into_script().to_p2sh();
nodes[0].node.handle_shutdown(&nodes[1].node.get_our_node_id(), &node_0_shutdown);
let events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
match events[0] {
MessageSendEvent::SendShutdown { node_id, .. } => { assert_eq!(node_id, nodes[1].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
//// channel smoothly
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 1000000, flags.clone(), flags.clone());
nodes[1].node.close_channel(&OutPoint::new(chan.3.txid(), 0).to_channel_id()).unwrap();
let mut node_0_shutdown = get_event_msg!(nodes[1], MessageSendEvent::SendShutdown, nodes[0].node.get_our_node_id());
node_0_shutdown.scriptpubkey = Builder::new().push_opcode(opcodes::all::OP_RETURN).into_script().to_p2sh();
nodes[0].node.handle_shutdown(&nodes[1].node.get_our_node_id(), &node_0_shutdown);
let events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 2);
match events[0] {
MessageSendEvent::SendShutdown { node_id, .. } => { assert_eq!(node_id, nodes[1].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
match events[1] {
MessageSendEvent::SendClosingSigned { node_id, .. } => { assert_eq!(node_id, nodes[1].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
} | rust_cleaned_test_functions.jsonl/28342 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1968
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8237,
6951,
54804,
14660,
368,
341,
1572,
197,
322,
28162,
432,
518,
23766,
1943,
271,
10217,
5206,
2193,
284,
2657,
2648,
486,
2258,
543,
25873,
16195,
8743,
13,
1020,
19453,
14571,
284,
830,
280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_remove_line_continuations_empty() {
let example: Vec<char> = "".to_string().chars().collect();
let without_comments = chars_to_string(&remove_line_continuations(&example));
assert_eq!("", without_comments);
} | rust_cleaned_test_functions.jsonl/126892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
6528,
68948,
37070,
15124,
368,
341,
286,
1077,
3110,
25,
11312,
21919,
29,
284,
44907,
983,
3904,
1005,
19255,
1005,
17384,
543,
286,
1077,
2041,
30359,
284,
23000,
2346,
3904,
2099,
5399,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_ref_to_fixed_array() {
let ary : &[u8; 32] = &[
1,0,1,2,1,0,1,2,
3,0,3,4,3,0,3,4,
5,0,5,6,5,0,5,6,
7,0,7,8,7,0,7,8
];
let big : U256 = ary.into();
// the numbers are each row of 8 bytes reversed and cast to u64
assert_eq!(big, U256([504410889324070664, 360293493601469702, 216176097878868740, 72058702156267778u64]));
} | rust_cleaned_test_functions.jsonl/45780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
7793,
2346,
37839,
3858,
368,
341,
10217,
72921,
549,
44590,
84,
23,
26,
220,
18,
17,
60,
284,
609,
9640,
197,
197,
16,
11,
15,
11,
16,
11,
17,
11,
16,
11,
15,
11,
16,
11,
17,
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_read_position() {
let data = BaseEntityData {
position: [1.0, 2.0, 3.0].into(),
rotation: [4.0, 5.0].into(),
velocity: [6.0, 7.0, 8.0].into(),
};
let pos = data.read_position().unwrap();
assert!(pos.x - 1.0 < std::f64::EPSILON);
assert!(pos.y - 2.0 < std::f64::EPSILON);
assert!(pos.z - 3.0 < std::f64::EPSILON);
assert!(pos.yaw - 4.0 < std::f32::EPSILON);
assert!(pos.pitch - 5.0 < std::f32::EPSILON);
} | rust_cleaned_test_functions.jsonl/50447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9661,
368,
341,
286,
1077,
821,
284,
74082,
1043,
341,
310,
2309,
25,
508,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
936,
18122,
3148,
310,
12695,
25,
508,
19,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_ban() {
let route = Route::GetBan {
guild_id: GUILD_ID,
user_id: USER_ID,
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/bans/{user_id}",
guild_id = GUILD_ID,
user_id = USER_ID
)
);
} | rust_cleaned_test_functions.jsonl/119880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
880,
276,
368,
341,
286,
1077,
6021,
284,
9572,
486,
1949,
50241,
341,
310,
26411,
842,
25,
479,
18023,
3450,
345,
310,
1196,
842,
25,
13872,
3450,
345,
286,
2605,
286,
2060,
10714,
33673,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_data_loss_protect() {
// We want to be sure that :
// * we don't broadcast our Local Commitment Tx in case of fallen behind
// * we close channel in case of detecting other being fallen behind
// * we are able to claim our own outputs thanks to to_remote being static
// TODO: this test is incomplete and the data_loss_protect implementation is incomplete - see issue #775
let persister;
let logger;
let fee_estimator;
let tx_broadcaster;
let chain_source;
let mut chanmon_cfgs = create_chanmon_cfgs(2);
// during signing due to revoked tx
chanmon_cfgs[0].keys_manager.disable_revocation_policy_check = true;
let keys_manager = &chanmon_cfgs[0].keys_manager;
let monitor;
let node_state_0;
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 1000000, InitFeatures::known(), InitFeatures::known());
// Cache node A state before any channel update
let previous_node_state = nodes[0].node.encode();
let mut previous_chain_monitor_state = test_utils::TestVecWriter(Vec::new());
nodes[0].chain_monitor.chain_monitor.monitors.read().unwrap().iter().next().unwrap().1.write(&mut previous_chain_monitor_state).unwrap();
send_payment(&nodes[0], &vec!(&nodes[1])[..], 8000000);
send_payment(&nodes[0], &vec!(&nodes[1])[..], 8000000);
nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id(), false);
nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
// Restore node A from previous state
logger = test_utils::TestLogger::with_id(format!("node {}", 0));
let mut chain_monitor = <(BlockHash, ChannelMonitor<EnforcingSigner>)>::read(&mut io::Cursor::new(previous_chain_monitor_state.0), keys_manager).unwrap().1;
chain_source = test_utils::TestChainSource::new(Network::Testnet);
tx_broadcaster = test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new()), blocks: Arc::new(Mutex::new(Vec::new()))};
fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) };
persister = test_utils::TestPersister::new();
monitor = test_utils::TestChainMonitor::new(Some(&chain_source), &tx_broadcaster, &logger, &fee_estimator, &persister, keys_manager);
node_state_0 = {
let mut channel_monitors = HashMap::new();
channel_monitors.insert(OutPoint { txid: chan.3.txid(), index: 0 }, &mut chain_monitor);
<(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(&mut io::Cursor::new(previous_node_state), ChannelManagerReadArgs {
keys_manager: keys_manager,
fee_estimator: &fee_estimator,
chain_monitor: &monitor,
logger: &logger,
tx_broadcaster: &tx_broadcaster,
default_config: UserConfig::default(),
channel_monitors,
}).unwrap().1
};
nodes[0].node = &node_state_0;
assert!(monitor.watch_channel(OutPoint { txid: chan.3.txid(), index: 0 }, chain_monitor).is_ok());
nodes[0].chain_monitor = &monitor;
nodes[0].chain_source = &chain_source;
check_added_monitors!(nodes[0], 1);
nodes[0].node.peer_connected(&nodes[1].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty() });
nodes[1].node.peer_connected(&nodes[0].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty() });
let reestablish_0 = get_chan_reestablish_msgs!(nodes[1], nodes[0]);
// Check we don't broadcast any transactions following learning of per_commitment_point from B
nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &reestablish_0[0]);
check_added_monitors!(nodes[0], 1);
{
let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().clone();
assert_eq!(node_txn.len(), 0);
}
let mut reestablish_1 = Vec::with_capacity(1);
for msg in nodes[0].node.get_and_clear_pending_msg_events() {
if let MessageSendEvent::SendChannelReestablish { ref node_id, ref msg } = msg {
assert_eq!(*node_id, nodes[1].node.get_our_node_id());
reestablish_1.push(msg.clone());
} else if let MessageSendEvent::BroadcastChannelUpdate { .. } = msg {
} else if let MessageSendEvent::HandleError { ref action, .. } = msg {
match action {
&ErrorAction::SendErrorMessage { ref msg } => {
assert_eq!(msg.data, "We have fallen behind - we have received proof that if we broadcast remote is going to claim our funds - we can't do any automated broadcasting");
},
_ => panic!("Unexpected event!"),
}
} else {
panic!("Unexpected event")
}
}
// Check we close channel detecting A is fallen-behind
nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &reestablish_1[0]);
check_closed_event!(nodes[1], 1, ClosureReason::ProcessingError { err: "Peer attempted to reestablish channel with a very old local commitment transaction".to_string() });
assert_eq!(check_closed_broadcast!(nodes[1], true).unwrap().data, "Peer attempted to reestablish channel with a very old local commitment transaction");
check_added_monitors!(nodes[1], 1);
// Check A is able to claim to_remote output
let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().clone();
assert_eq!(node_txn.len(), 1);
check_spends!(node_txn[0], chan.3);
assert_eq!(node_txn[0].output.len(), 2);
mine_transaction(&nodes[0], &node_txn[0]);
connect_blocks(&nodes[0], ANTI_REORG_DELAY - 1);
check_closed_event!(nodes[0], 1, ClosureReason::ProcessingError { err: "We have fallen behind - we have received proof that if we broadcast remote is going to claim our funds - we can\'t do any automated broadcasting".to_string() });
let spend_txn = check_spendable_outputs!(nodes[0], node_cfgs[0].keys_manager);
assert_eq!(spend_txn.len(), 1);
check_spends!(spend_txn[0], node_txn[0]);
} | rust_cleaned_test_functions.jsonl/16941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1769,
11193,
22357,
439,
368,
341,
197,
322,
1205,
1366,
311,
387,
2704,
429,
6260,
197,
322,
353,
582,
1513,
944,
12899,
1039,
8774,
9205,
478,
39850,
304,
1142,
315,
20866,
4815,
17642,
197,
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... | 6 |
#[test]
fn test_separable_filter_integer_kernel() {
let image = gray_image!(
1, 2, 3;
4, 5, 6;
7, 8, 9);
let expected = gray_image!(
21, 27, 33;
39, 45, 51;
57, 63, 69);
let kernel = vec![1i32; 3];
let filtered = separable_filter_equal(&image, &kernel);
assert_pixels_eq!(filtered, expected);
} | rust_cleaned_test_functions.jsonl/35603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3453,
49156,
8727,
31725,
26876,
368,
341,
286,
1077,
2168,
284,
17545,
4954,
33673,
310,
220,
16,
11,
220,
17,
11,
220,
18,
280,
310,
220,
19,
11,
220,
20,
11,
220,
21,
280,
310,
220,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_column_name_in_error() -> Result<()> {
use crate::{types::Type, Error};
let db = Connection::open_in_memory()?;
db.execute_batch(
"BEGIN;
CREATE TABLE foo(x INTEGER, y TEXT);
INSERT INTO foo VALUES(4, NULL);
END;",
)?;
let mut stmt = db.prepare("SELECT x as renamed, y FROM foo")?;
let mut rows = stmt.query([])?;
let row = rows.next()?.unwrap();
match row.get::<_, String>(0).unwrap_err() {
Error::InvalidColumnType(idx, name, ty) => {
assert_eq!(idx, 0);
assert_eq!(name, "renamed");
assert_eq!(ty, Type::Integer);
}
e => {
panic!("Unexpected error type: {:?}", e);
}
}
match row.get::<_, String>("y").unwrap_err() {
Error::InvalidColumnType(idx, name, ty) => {
assert_eq!(idx, 1);
assert_eq!(name, "y");
assert_eq!(ty, Type::Null);
}
e => {
panic!("Unexpected error type: {:?}", e);
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/96472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 685
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
1269,
1243,
4096,
368,
1464,
5714,
71698,
341,
286,
990,
17717,
22964,
9242,
486,
929,
11,
4600,
2440,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
94136,
286,
2927,
7769,
14534,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_update_nft_state_with_issuer_success() {
let (mut context, tx) =
create_test_context(Action::Update(UpdateCase::UpdateStateWithIssuer), NftError::NoError);
let tx = context.complete_tx(tx);
// run
let cycles = context
.verify_tx(&tx, MAX_CYCLES)
.expect("pass verification");
println!("consume cycles: {}", cycles);
} | rust_cleaned_test_functions.jsonl/33580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
1089,
723,
4387,
6615,
62,
66817,
18632,
368,
341,
262,
1077,
320,
6984,
2266,
11,
9854,
8,
4035,
286,
1855,
4452,
8467,
21905,
486,
4289,
7,
4289,
4207,
486,
4289,
1397,
2354,
98902,
701,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_w1_1() {
let mut scheduler = WorkstealingScheduler::default();
submit_graph_simple(&mut scheduler);
connect_workers(&mut scheduler, 1, 1);
scheduler.sanity_check();
let n = run_schedule_get_task_ids(&mut scheduler);
assert_eq!(n.len(), 1);
assert!(n.contains(&1));
scheduler.sanity_check();
let w = assigned_worker(&scheduler.graph, 1);
finish_task(&mut scheduler, 1, w, 1);
let n = run_schedule_get_task_ids(&mut scheduler);
assert_eq!(n.len(), 2);
assert!(n.contains(&2));
assert!(n.contains(&3));
let _t2 = scheduler.graph.tasks.get(&2).unwrap();
let _t3 = scheduler.graph.tasks.get(&3).unwrap();
assert_eq!(assigned_worker(&scheduler.graph, 2), 100);
assert_eq!(assigned_worker(&scheduler.graph, 3), 100);
scheduler.sanity_check();
} | rust_cleaned_test_functions.jsonl/27851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
1670,
16,
62,
16,
368,
341,
286,
1077,
5206,
28809,
284,
5547,
5342,
6132,
38878,
486,
2258,
543,
286,
9318,
14738,
30015,
2099,
6984,
28809,
317,
286,
4564,
43557,
2099,
6984,
28809,
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_read_request_header() {
let mem = create_anon_guest_memory(&[(GuestAddress(0), 0x1000)], false).unwrap();
let addr = GuestAddress(0);
let sector = 123_454_321;
// Test that all supported request types are read correctly from memory.
let supported_request_types = vec![
VIRTIO_BLK_T_IN,
VIRTIO_BLK_T_OUT,
VIRTIO_BLK_T_FLUSH,
VIRTIO_BLK_T_GET_ID,
];
for request_type in supported_request_types {
let expected_header = RequestHeader::new(request_type, sector);
mem.write_obj::<RequestHeader>(expected_header, addr)
.unwrap();
let actual_header = RequestHeader::read_from(&mem, addr).unwrap();
assert_eq!(actual_header.request_type, expected_header.request_type);
assert_eq!(actual_header.sector, expected_header.sector);
}
// Test that trying to read a request header that goes outside of the
// memory boundary fails.
assert!(RequestHeader::read_from(&mem, GuestAddress(0x1000)).is_err());
} | rust_cleaned_test_functions.jsonl/84864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
7893,
8757,
368,
341,
286,
1077,
1833,
284,
1855,
12008,
263,
62739,
19195,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
25035,
895,
568,
15454,
543,
286,
1077,
1078... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_debug() {
assert_eq!(
format!("{:?}", Scalar::zero()),
"0x0000000000000000000000000000000000000000000000000000000000000000"
);
assert_eq!(
format!("{:?}", Scalar::one()),
"0x0000000000000000000000000000000000000000000000000000000000000001"
);
} | rust_cleaned_test_functions.jsonl/14273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
88928,
25,
52652,
35176,
486,
14154,
14702,
310,
330,
15,
87,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proccess_op_or_with_nested_and() {
let filter = filter();
let mut op = Operator::Or(vec![
Operator::And(vec![
Operator::Eq(schema_id_tag(), unencrypted_target("Not Here".to_string())),
Operator::Eq(cred_def_id_tag(), unencrypted_target("Not Here".to_string()))
]),
Operator::And(vec![
Operator::Eq(schema_issuer_did_tag(), unencrypted_target("Not Here".to_string())),
Operator::Eq(schema_name_tag(), unencrypted_target("Not Here".to_string()))
]),
Operator::And(vec![
Operator::Eq(schema_name_tag(), unencrypted_target("Not Here".to_string())),
Operator::Eq(issuer_did_tag(), unencrypted_target("Not Here".to_string()))
]),
]);
assert!(Verifier::_process_operator("zip", &op, &filter).is_err());
op = Operator::Or(vec![
Operator::And(vec![
Operator::Eq(schema_id_tag(), unencrypted_target(SCHEMA_ID.to_string())),
Operator::Eq(cred_def_id_tag(), unencrypted_target("Not Here".to_string()))
]),
Operator::And(vec![
Operator::Eq(schema_issuer_did_tag(), unencrypted_target("Not Here".to_string())),
Operator::Eq(schema_name_tag(), unencrypted_target("Not Here".to_string()))
]),
Operator::And(vec![
Operator::Eq(schema_name_tag(), unencrypted_target("Not Here".to_string())),
Operator::Eq(issuer_did_tag(), unencrypted_target("Not Here".to_string()))
]),
]);
assert!(Verifier::_process_operator("zip", &op, &filter).is_err());
op = Operator::Or(vec![
Operator::And(vec![
Operator::Eq(schema_id_tag(), unencrypted_target(SCHEMA_ID.to_string())),
Operator::Eq(cred_def_id_tag(), unencrypted_target(CRED_DEF_ID.to_string()))
]),
Operator::And(vec![
Operator::Eq(schema_issuer_did_tag(), unencrypted_target("Not Here".to_string())),
Operator::Eq(schema_name_tag(), unencrypted_target("Not Here".to_string()))
]),
Operator::And(vec![
Operator::Eq(schema_name_tag(), unencrypted_target("Not Here".to_string())),
Operator::Eq(issuer_did_tag(), unencrypted_target("Not Here".to_string()))
]),
]);
Verifier::_process_operator("zip", &op, &filter).unwrap()
} | rust_cleaned_test_functions.jsonl/71872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2540,
1322,
10287,
8734,
6615,
66279,
8378,
368,
341,
286,
1077,
4051,
284,
4051,
543,
286,
1077,
5206,
1179,
284,
28498,
486,
2195,
25592,
90515,
310,
28498,
486,
3036,
25592,
90515,
394,
28498,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scan_start_stop() {
let table_id = 1;
let pks = vec![1, 2, 3, 4, 5, 7, 10, 15, 20, 25, 26, 27];
let values: Vec<_> = pks
.iter()
.map(|pk| format!("value{}", pk).into_bytes())
.collect();
let test_data: Vec<_> = pks
.into_iter()
.map(|pk| table::encode_row_key(table_id, pk))
.zip(values.into_iter())
.collect();
let mut test_store = TestStore::new(&test_data);
let (snapshot, start_ts) = test_store.get_snapshot();
let store = SnapshotStore::new(snapshot, start_ts, IsolationLevel::SI, true);
// `test_take` is used to take `count` keys from the scanner. It calls `start_scan` at
let test_take = |scanner: &mut Scanner<_>, count, expect_start_pk, expect_end_pk| {
let mut range = KeyRange::new();
scanner.start_scan(&mut range);
let mut keys = Vec::new();
for _ in 0..count {
if let Some((key, _)) = scanner.next_row().unwrap() {
keys.push(key);
} else {
break;
}
}
let has_more = scanner.stop_scan(&mut range);
if has_more || scanner.scan_mode == ScanMode::Forward {
assert_eq!(
range.get_start(),
table::encode_row_key(table_id, expect_start_pk).as_slice()
);
} else {
assert_eq!(expect_start_pk, -1);
}
if has_more || scanner.scan_mode == ScanMode::Backward {
assert_eq!(
range.get_end(),
table::encode_row_key(table_id, expect_end_pk).as_slice()
);
} else {
assert_eq!(expect_end_pk, -1);
}
keys
};
let range = get_range(table_id, 1, 26);
let mut scanner = Scanner::new(&store, ScanOn::Table, false, true, range.clone()).unwrap();
let mut res = test_take(&mut scanner, 3, 1, 4);
res.append(&mut test_take(&mut scanner, 3, 4, 8));
res.append(&mut test_take(&mut scanner, 3, 8, 21));
res.append(&mut test_take(&mut scanner, 10, 21, -1));
let expect_keys: Vec<_> = [1, 2, 3, 4, 5, 7, 10, 15, 20, 25]
.iter()
.map(|pk| table::encode_row_key(table_id, *pk))
.collect();
assert_eq!(res, expect_keys);
let mut scanner = Scanner::new(&store, ScanOn::Table, true, true, range).unwrap();
let mut res = test_take(&mut scanner, 3, 15, 26);
res.append(&mut test_take(&mut scanner, 3, 5, 15));
res.append(&mut test_take(&mut scanner, 10, -1, 5));
assert_eq!(res, expect_keys.into_iter().rev().collect::<Vec<_>>());
} | rust_cleaned_test_functions.jsonl/121697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1527
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
4906,
19039,
368,
341,
286,
1077,
1965,
842,
284,
220,
16,
280,
286,
1077,
281,
2787,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
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... | 7 |
#[test]
fn test_metrics_report_update_check_failure_reason_omaha() {
block_on(async {
let config = config_generator();
let mut state_machine = StateMachineBuilder::new(
StubPolicyEngine,
StubHttpRequest,
StubInstaller::default(),
StubTimer,
MockMetricsReporter::new(false),
Rc::new(Mutex::new(StubStorage)),
config,
make_test_app_set(),
)
.build()
.await;
state_machine.run_once().await;
assert!(state_machine
.metrics_reporter
.metrics
.contains(&Metrics::UpdateCheckFailureReason(UpdateCheckFailureReason::Omaha)));
});
} | rust_cleaned_test_functions.jsonl/126407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37686,
14813,
8882,
7200,
43618,
38229,
62,
316,
13546,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2193,
284,
2193,
25813,
543,
310,
1077,
5206,
1584,
38695,
284,
3234,
21605,
3297,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_t202() {
init();
let result = t202(&WIFI_BSSID, &WIFI_SSID);
println!("{}", result.len());
println!("{:?}", result);
} | rust_cleaned_test_functions.jsonl/104749 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
17,
15,
17,
368,
341,
286,
2930,
543,
286,
1077,
1102,
284,
259,
17,
15,
17,
2099,
54,
33988,
1668,
75100,
11,
609,
54,
33988,
1098,
36499,
317,
286,
13751,
79878,
1102,
19406,
1423,
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 |
#[test]
fn test_parser_invalid_signature() {
let signature = "()Ljava/lang/List"; // no semicolon
let res = JavaType::from_str(signature);
match res {
Ok(any) => {
panic!("Unexpected result: {}", any);
}
Err(err) => {
let error_message = err.to_string();
assert!(error_message.contains("Input: ()Ljava/lang/List"));
}
}
} | rust_cleaned_test_functions.jsonl/100802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
31433,
39859,
368,
341,
286,
1077,
11957,
284,
67411,
37924,
25253,
76397,
5123,
442,
902,
5234,
38517,
198,
286,
1077,
592,
284,
7943,
929,
486,
1499,
2895,
92650,
626,
286,
2432,
592,
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... | 2 |
#[test]
fn test_next_token() {
let input = "let five = 5;
let ten = 10;
let add = fn(x, y) {
x + y;
};
let result = add(five, ten);
";
let tests = [
token::Token{ ttype: token::LET, literal: String::from("let") },
token::Token{ ttype: token::IDENT, literal: String::from("five") },
token::Token{ ttype: token::ASSIGN, literal: String::from("=") },
token::Token{ ttype: token::INT, literal: String::from("5") },
token::Token{ ttype: token::SEMICOLON, literal: String::from(";") },
token::Token{ ttype: token::LET, literal: String::from("let") },
token::Token{ ttype: token::IDENT, literal: String::from("ten") },
token::Token{ ttype: token::ASSIGN, literal: String::from("=") },
token::Token{ ttype: token::INT, literal: String::from("10") },
token::Token{ ttype: token::SEMICOLON, literal: String::from(";") },
token::Token{ ttype: token::LET, literal: String::from("let") },
token::Token{ ttype: token::IDENT, literal: String::from("add") },
token::Token{ ttype: token::ASSIGN, literal: String::from("=") },
token::Token{ ttype: token::FUNCTION, literal: String::from("fn") },
token::Token{ ttype: token::LPAREN, literal: String::from("(") },
token::Token{ ttype: token::IDENT, literal: String::from("x") },
token::Token{ ttype: token::COMMA, literal: String::from(",") },
token::Token{ ttype: token::IDENT, literal: String::from("y") },
token::Token{ ttype: token::RPAREN, literal: String::from(")") },
token::Token{ ttype: token::LBRACE, literal: String::from("{") },
token::Token{ ttype: token::IDENT, literal: String::from("x") },
token::Token{ ttype: token::PLUS, literal: String::from("+") },
token::Token{ ttype: token::IDENT, literal: String::from("y") },
token::Token{ ttype: token::SEMICOLON, literal: String::from(";") },
token::Token{ ttype: token::RBRACE, literal: String::from("}") },
token::Token{ ttype: token::SEMICOLON, literal: String::from(";") },
token::Token{ ttype: token::LET, literal: String::from("let") },
token::Token{ ttype: token::IDENT, literal: String::from("result") },
token::Token{ ttype: token::ASSIGN, literal: String::from("=") },
token::Token{ ttype: token::IDENT, literal: String::from("add") },
token::Token{ ttype: token::LPAREN, literal: String::from("(") },
token::Token{ ttype: token::IDENT, literal: String::from("five") },
token::Token{ ttype: token::COMMA, literal: String::from(",") },
token::Token{ ttype: token::IDENT, literal: String::from("ten") },
token::Token{ ttype: token::RPAREN, literal: String::from(")") },
token::Token{ ttype: token::SEMICOLON, literal: String::from(";") },
token::Token{ ttype: token::EOF, literal: String::from("\0") },
];
let mut l = Lexer::new(&input);
let mut i = 0;
for test in tests.iter() {
match l.next_token() {
Some(tok) => assert_eq!(&tok, test, "tests[{}]", i),
None => assert!(false),
}
i += 1;
}
} | rust_cleaned_test_functions.jsonl/17194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
6458,
368,
341,
286,
1077,
1946,
284,
330,
1149,
4236,
284,
220,
20,
280,
1149,
5779,
284,
220,
16,
15,
401,
1149,
912,
284,
5168,
2075,
11,
379,
8,
341,
262,
856,
488,
379,
280,
2315... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_get_rooted_block() {
let slot = 10;
let entries = make_slot_entries_with_transactions(100);
let blockhash = get_last_hash(entries.iter()).unwrap();
let shreds = entries_to_test_shreds(entries.clone(), slot, slot - 1, true, 0);
let more_shreds = entries_to_test_shreds(entries.clone(), slot + 1, slot, true, 0);
let unrooted_shreds = entries_to_test_shreds(entries.clone(), slot + 2, slot + 1, true, 0);
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
blockstore.insert_shreds(shreds, None, false).unwrap();
blockstore.insert_shreds(more_shreds, None, false).unwrap();
blockstore
.insert_shreds(unrooted_shreds, None, false)
.unwrap();
blockstore
.set_roots(vec![slot - 1, slot, slot + 1].iter())
.unwrap();
let parent_meta = SlotMeta {
parent_slot: std::u64::MAX,
..SlotMeta::default()
};
blockstore
.put_meta_bytes(slot - 1, &serialize(&parent_meta).unwrap())
.unwrap();
let expected_transactions: Vec<TransactionWithStatusMeta> = entries
.iter()
.cloned()
.filter(|entry| !entry.is_tick())
.flat_map(|entry| entry.transactions)
.map(|transaction| {
transaction
.into_legacy_transaction()
.expect("versioned transactions not supported")
})
.map(|transaction| {
let mut pre_balances: Vec<u64> = vec![];
let mut post_balances: Vec<u64> = vec![];
for (i, _account_key) in transaction.message.account_keys.iter().enumerate() {
pre_balances.push(i as u64 * 10);
post_balances.push(i as u64 * 11);
}
let signature = transaction.signatures[0];
let status = TransactionStatusMeta {
status: Ok(()),
fee: 42,
pre_balances: pre_balances.clone(),
post_balances: post_balances.clone(),
inner_instructions: Some(vec![]),
log_messages: Some(vec![]),
pre_token_balances: Some(vec![]),
post_token_balances: Some(vec![]),
rewards: Some(vec![]),
}
.into();
blockstore
.transaction_status_cf
.put_protobuf((0, signature, slot), &status)
.unwrap();
let status = TransactionStatusMeta {
status: Ok(()),
fee: 42,
pre_balances: pre_balances.clone(),
post_balances: post_balances.clone(),
inner_instructions: Some(vec![]),
log_messages: Some(vec![]),
pre_token_balances: Some(vec![]),
post_token_balances: Some(vec![]),
rewards: Some(vec![]),
}
.into();
blockstore
.transaction_status_cf
.put_protobuf((0, signature, slot + 1), &status)
.unwrap();
let status = TransactionStatusMeta {
status: Ok(()),
fee: 42,
pre_balances: pre_balances.clone(),
post_balances: post_balances.clone(),
inner_instructions: Some(vec![]),
log_messages: Some(vec![]),
pre_token_balances: Some(vec![]),
post_token_balances: Some(vec![]),
rewards: Some(vec![]),
}
.into();
blockstore
.transaction_status_cf
.put_protobuf((0, signature, slot + 2), &status)
.unwrap();
TransactionWithStatusMeta {
transaction,
meta: Some(TransactionStatusMeta {
status: Ok(()),
fee: 42,
pre_balances,
post_balances,
inner_instructions: Some(vec![]),
log_messages: Some(vec![]),
pre_token_balances: Some(vec![]),
post_token_balances: Some(vec![]),
rewards: Some(vec![]),
}),
}
})
.collect();
let confirmed_block_err = blockstore.get_rooted_block(slot - 1, true).unwrap_err();
assert_matches!(confirmed_block_err, BlockstoreError::SlotUnavailable);
let confirmed_block_err = blockstore.get_rooted_block(slot, true).unwrap_err();
assert_matches!(
confirmed_block_err,
BlockstoreError::ParentEntriesUnavailable
);
// Test if require_previous_blockhash is false
let confirmed_block = blockstore.get_rooted_block(slot, false).unwrap();
assert_eq!(confirmed_block.transactions.len(), 100);
let expected_block = ConfirmedBlock {
transactions: expected_transactions.clone(),
parent_slot: slot - 1,
blockhash: blockhash.to_string(),
previous_blockhash: Hash::default().to_string(),
rewards: vec![],
block_time: None,
block_height: None,
};
assert_eq!(confirmed_block, expected_block);
let confirmed_block = blockstore.get_rooted_block(slot + 1, true).unwrap();
assert_eq!(confirmed_block.transactions.len(), 100);
let mut expected_block = ConfirmedBlock {
transactions: expected_transactions.clone(),
parent_slot: slot,
blockhash: blockhash.to_string(),
previous_blockhash: blockhash.to_string(),
rewards: vec![],
block_time: None,
block_height: None,
};
assert_eq!(confirmed_block, expected_block);
let not_root = blockstore.get_rooted_block(slot + 2, true).unwrap_err();
assert_matches!(not_root, BlockstoreError::SlotNotRooted);
let complete_block = blockstore.get_complete_block(slot + 2, true).unwrap();
assert_eq!(complete_block.transactions.len(), 100);
let mut expected_complete_block = ConfirmedBlock {
transactions: expected_transactions,
parent_slot: slot + 1,
blockhash: blockhash.to_string(),
previous_blockhash: blockhash.to_string(),
rewards: vec![],
block_time: None,
block_height: None,
};
assert_eq!(complete_block, expected_complete_block);
let timestamp = 1_576_183_541;
blockstore.blocktime_cf.put(slot + 1, ×tamp).unwrap();
expected_block.block_time = Some(timestamp);
let block_height = slot - 2;
blockstore
.block_height_cf
.put(slot + 1, &block_height)
.unwrap();
expected_block.block_height = Some(block_height);
let confirmed_block = blockstore.get_rooted_block(slot + 1, true).unwrap();
assert_eq!(confirmed_block, expected_block);
let timestamp = 1_576_183_542;
blockstore.blocktime_cf.put(slot + 2, ×tamp).unwrap();
expected_complete_block.block_time = Some(timestamp);
let block_height = slot - 1;
blockstore
.block_height_cf
.put(slot + 2, &block_height)
.unwrap();
expected_complete_block.block_height = Some(block_height);
let complete_block = blockstore.get_complete_block(slot + 2, true).unwrap();
assert_eq!(complete_block, expected_complete_block);
} | rust_cleaned_test_functions.jsonl/9556 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12993,
291,
7113,
368,
341,
286,
1077,
9446,
284,
220,
16,
15,
280,
286,
1077,
10695,
284,
1281,
27563,
26092,
6615,
68182,
7,
16,
15,
15,
317,
286,
1077,
2504,
8296,
284,
633,
12195,
89... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nfd_chars() {
macro_rules! t {
($input: expr, $expected: expr) => {
assert_eq!($input.nfd_chars().collect::<String>(), $expected.into_string());
}
}
t!("abc", "abc");
t!("\u1e0b\u01c4", "d\u0307\u01c4");
t!("\u2026", "\u2026");
t!("\u2126", "\u03a9");
t!("\u1e0b\u0323", "d\u0323\u0307");
t!("\u1e0d\u0307", "d\u0323\u0307");
t!("a\u0301", "a\u0301");
t!("\u0301a", "\u0301a");
t!("\ud4db", "\u1111\u1171\u11b6");
t!("\uac1c", "\u1100\u1162");
} | rust_cleaned_test_functions.jsonl/56855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
6902,
37418,
368,
341,
286,
18072,
21407,
0,
259,
341,
310,
1711,
1355,
25,
15169,
11,
400,
7325,
25,
15169,
8,
589,
341,
394,
2060,
10714,
0,
699,
1355,
1253,
6902,
37418,
1005,
17384,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_difference_bv1_longer() {
let mut bv1: BitVec<usize> = BitVec::new();
let mut bv2: BitVec<usize> = BitVec::new();
bv1.set(8, true);
bv2.set(0, true);
bv1.difference(&bv2);
assert!(!bv1.get(0));
assert!(bv1.get(8));
} | rust_cleaned_test_functions.jsonl/204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47525,
880,
85,
16,
17799,
261,
368,
341,
286,
1077,
5206,
56937,
16,
25,
6495,
10050,
90244,
29,
284,
6495,
10050,
486,
931,
543,
286,
1077,
5206,
56937,
17,
25,
6495,
10050,
90244,
29,
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_cmp() {
let data: Vec<BigUint> = [ &[], &[1], &[2], &[-1], &[0, 1], &[2, 1], &[1, 1, 1] ]
.iter().map(|v| BigUint::from_slice(*v)).collect();
for (i, ni) in data.iter().enumerate() {
for (j0, nj) in data.slice(i, data.len()).iter().enumerate() {
let j = j0 + i;
if i == j {
assert_eq!(ni.cmp(nj), Equal);
assert_eq!(nj.cmp(ni), Equal);
assert_eq!(ni, nj);
assert!(!(ni != nj));
assert!(ni <= nj);
assert!(ni >= nj);
assert!(!(ni < nj));
assert!(!(ni > nj));
} else {
assert_eq!(ni.cmp(nj), Less);
assert_eq!(nj.cmp(ni), Greater);
assert!(!(ni == nj));
assert!(ni != nj);
assert!(ni <= nj);
assert!(!(ni >= nj));
assert!(ni < nj);
assert!(!(ni > nj));
assert!(!(nj <= ni));
assert!(nj >= ni);
assert!(!(nj < ni));
assert!(nj > ni);
}
}
}
} | rust_cleaned_test_functions.jsonl/96889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 879
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35193,
368,
341,
286,
1077,
821,
25,
11312,
27,
15636,
21570,
29,
284,
508,
609,
12995,
44590,
16,
1125,
44590,
17,
1125,
609,
7609,
16,
1125,
44590,
15,
11,
220,
16,
1125,
44590,
17,
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... | 4 |
#[test]
fn test_verify() {
let secp256k1 = Secp256k1::new();
let message_arr = [5u8; 32];
let (privkey, pubkey) = secp256k1.generate_keypair(&mut thread_rng()).unwrap();
let message = SecpMessage::from_slice(&message_arr).unwrap();
let signature = secp256k1.sign(&message, &privkey).unwrap();
let pubkey_arr = pubkey.serialize_vec(&secp256k1, false);
assert_eq!(pubkey_arr.len(), 65);
let mut pubkey_a = [0u8; 65];
for i in 0..65 {
pubkey_a[i] = pubkey_arr[i];
}
let ctx_pubkey = PublicKey::parse(&pubkey_a).unwrap();
let ctx_message = Message::parse(&message_arr);
let signature_arr = signature.serialize_compact(&secp256k1);
assert_eq!(signature_arr.len(), 64);
let mut signature_a = [0u8; 64];
for i in 0..64 {
signature_a[i] = signature_arr[i];
}
let ctx_sig = Signature::parse(&signature_a);
secp256k1.verify(&message, &signature, &pubkey).unwrap();
assert!(verify(&ctx_message, &ctx_sig, &ctx_pubkey));
let mut f_ctx_sig = ctx_sig.clone();
f_ctx_sig.r.set_int(0);
if f_ctx_sig.r != ctx_sig.r {
assert!(!ECMULT_CONTEXT.verify_raw(&f_ctx_sig.r, &ctx_sig.s, &ctx_pubkey.clone().into(), &ctx_message.0));
}
f_ctx_sig.r.set_int(1);
if f_ctx_sig.r != ctx_sig.r {
assert!(!ECMULT_CONTEXT.verify_raw(&f_ctx_sig.r, &ctx_sig.s, &ctx_pubkey.clone().into(), &ctx_message.0));
}
} | rust_cleaned_test_functions.jsonl/129806 | {
"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,
35638,
368,
341,
262,
1077,
511,
4672,
17,
20,
21,
74,
16,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
1428,
262,
1077,
1943,
11210,
284,
508,
20,
84,
23,
26,
220,
18,
17,
935,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_enum_conversion() {
test_file! {
#[diplomat::bridge]
mod ffi {
enum MyEnum {
A, B, C
}
struct MyStruct {
a: u8,
b: MyEnum,
}
#[diplomat::opaque]
struct Foo(Box<u8>);
impl Foo {
pub fn get_struct(&self) -> MyStruct {
MyStruct { a: 1, b: MyEnum::A }
}
}
}
}
} | rust_cleaned_test_functions.jsonl/80567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
64132,
368,
341,
286,
1273,
2458,
0,
341,
310,
11506,
8579,
500,
80768,
486,
13709,
921,
310,
1463,
76956,
341,
394,
7618,
3017,
10766,
341,
503,
362,
11,
425,
11,
356,
198,
394,
456,
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_status_ping_request_decode() {
let mut cursor =
Cursor::new(include_bytes!("../test/packet/status/ping_request.dat").to_vec());
let ping_request = PingRequest::decode(&mut cursor).unwrap();
assert_eq!(ping_request.time, 1577735845610);
} | rust_cleaned_test_functions.jsonl/84709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
71661,
7893,
15227,
368,
341,
286,
1077,
5206,
8128,
4035,
310,
28067,
486,
931,
77863,
12524,
17223,
1244,
1944,
4322,
5709,
32518,
4322,
287,
7893,
9915,
1827,
983,
13251,
1423,
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_costoflife() {
let txs = vec![
// insert one entry
TxRecord::new("Test#1", "10.2311321").unwrap(),
TxRecord::new("Test#2", "10.5441231").unwrap(),
TxRecord::new("Test#3", "70.199231321").unwrap(),
];
// simple insert
assert_eq!(
cost_of_life(txs.iter(), &today()),
parse_amount("90.97").unwrap()
);
} | rust_cleaned_test_functions.jsonl/60254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15890,
1055,
14450,
368,
341,
286,
1077,
9854,
82,
284,
7486,
90515,
310,
442,
5656,
825,
4343,
198,
310,
39850,
6471,
486,
931,
445,
2271,
2,
16,
497,
330,
16,
15,
13,
17,
18,
16,
16,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_char() {
let mut rng = crate::new();
// Any failures manifest as a panic when debug assertions are enabled
for _ in 0..9000 {
let _: char = Standard.sample(&mut rng);
}
} | rust_cleaned_test_functions.jsonl/85583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9232,
368,
341,
10217,
5206,
28422,
284,
17717,
486,
931,
1428,
197,
322,
5765,
27850,
14455,
438,
264,
21975,
979,
7390,
54836,
525,
8970,
198,
2023,
716,
304,
220,
15,
496,
24,
15,
15,
15,
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
] | 2 |
#[test]
fn test_search(){
let json_value = from_str("{\"dog\":{\"cat\": {\"mouse\" : \"cheese\"}}}").unwrap();
let found_str = json_value.search("mouse").and_then(|j| j.as_string());
assert!(found_str.unwrap() == "cheese");
} | rust_cleaned_test_functions.jsonl/6563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
3032,
286,
1077,
2951,
3142,
284,
504,
2895,
99141,
18457,
92729,
4616,
11693,
314,
2105,
13237,
2105,
549,
7245,
1528,
2367,
2105,
75542,
1827,
15454,
543,
286,
1077,
1730,
2895,
284,
2951,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_message_specific_reaction() {
let emoji = emoji();
let route = Route::DeleteMessageSpecificReaction {
channel_id: CHANNEL_ID,
message_id: MESSAGE_ID,
emoji: &emoji,
};
assert_eq!(
route.to_string(),
format!(
"channels/{channel_id}/messages/{message_id}/reactions/{emoji}",
channel_id = CHANNEL_ID,
emoji = emoji,
message_id = MESSAGE_ID
)
);
} | rust_cleaned_test_functions.jsonl/119902 | {
"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,
11353,
6462,
56592,
96631,
368,
341,
286,
1077,
42365,
284,
42365,
1428,
286,
1077,
6021,
284,
9572,
486,
6435,
2052,
47514,
87236,
341,
310,
5496,
842,
25,
58756,
3450,
345,
310,
1943,
842,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_digest_of_canonical_request() {
let creq = test_canonical_request("get-vanilla-query-order-key-case");
let expected = "816cd5b414d056048ba4f7c5386d6e0533120fb1fcfa93762cf0fc39e2cf19e0";
let actual = sha256_hex_string(creq.as_bytes());
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/83741 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52994,
3575,
27421,
22391,
7893,
368,
341,
286,
1077,
1884,
80,
284,
1273,
27421,
22391,
7893,
445,
455,
8273,
276,
6241,
65489,
23810,
16173,
38485,
797,
286,
1077,
3601,
284,
330,
23,
16,
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_program_entry_debug() {
#[allow(clippy::unnecessary_wraps)]
fn mock_process_instruction(
_first_instruction_account: usize,
_data: &[u8],
_invoke_context: &mut InvokeContext,
) -> Result<(), InstructionError> {
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn mock_ix_processor(
_first_instruction_account: usize,
_data: &[u8],
_context: &mut InvokeContext,
) -> Result<(), InstructionError> {
Ok(())
}
let builtin_programs = &[
BuiltinProgram {
program_id: solana_sdk::pubkey::new_rand(),
process_instruction: mock_process_instruction,
},
BuiltinProgram {
program_id: solana_sdk::pubkey::new_rand(),
process_instruction: mock_ix_processor,
},
];
assert!(!format!("{:?}", builtin_programs).is_empty());
} | rust_cleaned_test_functions.jsonl/14507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 546
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
9078,
15446,
368,
341,
286,
11506,
7183,
9849,
45749,
486,
14931,
20122,
44074,
2625,
5563,
286,
5168,
7860,
11305,
54923,
1006,
310,
716,
3896,
54923,
13500,
25,
22301,
345,
310,
716,
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... | 1 |
#[test]
fn test_proof_failure() -> Result<(), HwError> {
let value = BigUint::from_u32(378).unwrap();
let threshold = BigUint::from_u32(402).unwrap();
assert_eq!(true, prove_and_verify(4, 32, &value, &threshold).is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/32788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86757,
43618,
368,
1464,
5714,
68843,
472,
86,
1454,
29,
341,
286,
1077,
897,
284,
6164,
21570,
486,
1499,
7300,
18,
17,
7,
18,
22,
23,
568,
15454,
543,
286,
1077,
12171,
284,
6164,
21570,
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_strip_accents() {
let test_tuples = [
("No accent here", "No accent here"),
("çà", "ca"),
("àgbọ̀n", "agbon"),
("cùis", "cuis"),
("Tiếng Việt", "Tieng Viet"),
("château", "chateau"),
("München", "Munchen"),
];
// Whe(source_text, expected_result) in test_tuples.iter() {
let mut source_token = Token::new(source_text.to_string());
strip_accents(&mut source_token);
assert_eq!(source_token.text, String::from(*expected_result));
} | rust_cleaned_test_functions.jsonl/13632 | {
"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,
66130,
17737,
805,
368,
341,
286,
1077,
1273,
89269,
284,
2278,
310,
3489,
2753,
29100,
1588,
497,
330,
2753,
29100,
1588,
4461,
310,
3489,
3131,
6362,
497,
330,
924,
4461,
310,
3489,
6362,
9511,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_operator_lt_plaintext_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let query = Operator::Lt(
TagName::PlainTagName(name1.clone()),
TargetValue::Unencrypted(value1.clone())
);
let json = query.to_string();
let expected = format!(r#"{{"~{}":{{"$lt":"{}"}}}}"#, base64::encode(&name1), value1);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
40594,
39164,
6317,
1641,
427,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
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_0459_example_2() {
let s = "aba".to_string();
let result = false;
assert_eq!(Solution::repeated_substring_pattern(s), result);
} | rust_cleaned_test_functions.jsonl/91321 | {
"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,
62,
15,
19,
20,
24,
39304,
62,
17,
368,
341,
286,
1077,
274,
284,
330,
12004,
3263,
983,
3904,
543,
286,
1077,
1102,
284,
895,
401,
286,
2060,
10714,
10297,
36842,
486,
265,
41954,
5228,
917,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_is_str_latin1_fail() {
let len = if cfg!(miri) { 32 } else { 256 }; // Miri is too slow
let mut src: Vec<u16> = Vec::with_capacity(len);
src.resize(len, 0);
for i in 0..src.len() {
src[i] = i as u16;
}
for i in 0..src.len() {
let tail = &mut src[i..];
for j in 0..tail.len() {
tail[j] = 0x100 + j as u16;
let s = String::from_utf16(tail).unwrap();
assert!(!is_str_latin1(&s[..]));
assert_ne!(check_str_for_latin1_and_bidi(&s[..]), Latin1Bidi::Latin1);
}
}
} | rust_cleaned_test_functions.jsonl/27303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
2895,
907,
14768,
16,
22121,
368,
341,
286,
1077,
2422,
284,
421,
13286,
10297,
19936,
72,
8,
314,
220,
18,
17,
335,
770,
314,
220,
17,
20,
21,
20066,
442,
14268,
72,
374,
2238,
6301,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_util_read_float() {
let mut p = Tokenizer::new("abc");
assert_eq!(None, read_float(&mut p));
assert_eq!(Some('a'), p.peek());
let mut p = Tokenizer::new("-abc");
assert_eq!(None, read_float(&mut p));
assert_eq!(Some('-'), p.peek());
let mut p = Tokenizer::new("+abc");
assert_eq!(None, read_float(&mut p));
assert_eq!(Some('+'), p.peek());
let mut p = Tokenizer::new("123");
assert_eq!(Some("123".into()), read_float(&mut p));
assert_eq!(None, p.peek());
let mut p = Tokenizer::new("123abc");
assert_eq!(Some("123".into()), read_float(&mut p));
assert_eq!(Some('a'), p.peek());
let mut p = Tokenizer::new("123.");
assert_eq!(Some("123.".into()), read_float(&mut p));
assert_eq!(None, p.peek());
let mut p = Tokenizer::new(".123");
assert_eq!(Some(".123".into()), read_float(&mut p));
assert_eq!(None, p.peek());
let mut p = Tokenizer::new("123.123");
assert_eq!(Some("123.123".into()), read_float(&mut p));
assert_eq!(None, p.peek());
let mut p = Tokenizer::new("1e5");
assert_eq!(Some("1e5".into()), read_float(&mut p));
assert_eq!(None, p.peek());
let mut p = Tokenizer::new("1e+5");
assert_eq!(Some("1e+5".into()), read_float(&mut p));
assert_eq!(None, p.peek());
let mut p = Tokenizer::new("1e-5");
assert_eq!(Some("1e-5".into()), read_float(&mut p));
assert_eq!(None, p.peek());
let mut p = Tokenizer::new("1.1e1a");
assert_eq!(Some("1.1e1".into()), read_float(&mut p));
assert_eq!(Some('a'), p.peek());
let mut p = Tokenizer::new("+123abc");
assert_eq!(Some("+123".into()), read_float(&mut p));
assert_eq!(Some('a'), p.peek());
let mut p = Tokenizer::new("-123abc");
assert_eq!(Some("-123".into()), read_float(&mut p));
assert_eq!(Some('a'), p.peek());
} | rust_cleaned_test_functions.jsonl/274 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 991
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18974,
6443,
17586,
368,
341,
286,
1077,
5206,
281,
284,
9660,
3135,
486,
931,
445,
13683,
797,
286,
2060,
10714,
10297,
4064,
11,
1349,
17586,
2099,
6984,
281,
1106,
286,
2060,
10714,
10297,
8373... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_externally_tagged_enum_containing_flatten() {
#[derive(Serialize, Deserialize, PartialEq, Debug)]
enum Data {
A {
a: i32,
#[serde(flatten)]
flat: Flat,
},
}
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct Flat {
b: i32,
}
let data = Data::A {
a: 0,
flat: Flat { b: 0 },
};
assert_tokens(
&data,
&[
Token::NewtypeVariant {
name: "Data",
variant: "A",
},
Token::Map { len: None },
Token::Str("a"),
Token::I32(0),
Token::Str("b"),
Token::I32(0),
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/59169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4301,
745,
9372,
3556,
31054,
10260,
2056,
5081,
14456,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
55039,
11,
11091,
5563,
262,
7618,
2885,
341,
286,
362,
341,
310,
264,
25,
600... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mgp_copy() {
mock_mgp_once!(mgp_path_copy_context, |_, _, _| {
mgp_error::MGP_ERROR_UNABLE_TO_ALLOCATE
});
with_dummy!(|memgraph: &Memgraph| {
unsafe {
let path = Path::mgp_copy(std::ptr::null_mut(), &memgraph);
assert!(path.is_err());
}
});
} | rust_cleaned_test_functions.jsonl/101741 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
21888,
16096,
368,
341,
262,
7860,
717,
21888,
7630,
10297,
12311,
79,
2638,
16096,
8467,
11,
760,
6878,
8358,
85137,
341,
286,
13742,
79,
4096,
486,
44,
24430,
5414,
6735,
3494,
8650,
39333,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.