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_complete_1() {
let square = Square::try_new(vec![8, 1, 6, 3, 5, 7]).unwrap();
assert!(square.is_magic());
square.render();
} | rust_cleaned_test_functions.jsonl/13908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27675,
62,
16,
368,
341,
262,
1077,
9334,
284,
15619,
486,
1539,
5921,
25592,
20703,
23,
11,
220,
16,
11,
220,
21,
11,
220,
18,
11,
220,
20,
11,
220,
22,
10697,
15454,
543,
262,
2060,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_deserialize_utc_date_time_overflows() {
let _guard = LOCK.run_concurrently();
let t: i64 = 1_530_492_218 * 1_000 + 999;
let mut raw0 = vec![0x09, b'A', 0x00];
raw0.write_all(&t.to_le_bytes()).unwrap();
let mut raw = vec![];
raw.write_all(&((raw0.len() + 4 + 1) as i32).to_le_bytes())
.unwrap();
raw.write_all(&raw0).unwrap();
raw.write_all(&[0]).unwrap();
let deserialized = Document::from_reader(&mut Cursor::new(raw)).unwrap();
let expected = doc! { "A": Utc.timestamp(1_530_492_218, 999 * 1_000_000)};
assert_eq!(deserialized, expected);
} | rust_cleaned_test_functions.jsonl/49154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
84259,
4164,
3009,
15431,
38140,
368,
341,
262,
1077,
716,
26098,
284,
49463,
7634,
3382,
58202,
543,
262,
1077,
259,
25,
600,
21,
19,
284,
220,
16,
62,
20,
18,
15,
62,
19,
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_encode_decode() {
let txn_info = TransactionInfo::new(
HashValue::random(),
HashValue::random(),
HashValue::random(),
7,
StatusCode::EXECUTED,
);
assert_encode_decode::<TransactionInfoSchema>(&0u64, &txn_info);
} | rust_cleaned_test_functions.jsonl/89280 | {
"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,
11224,
15227,
368,
341,
262,
1077,
49721,
3109,
284,
17869,
1731,
486,
931,
1006,
286,
6531,
1130,
486,
11463,
3148,
286,
6531,
1130,
486,
11463,
3148,
286,
6531,
1130,
486,
11463,
3148,
286,
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_request() {
use helix::*;
let req = GetStreamTagsRequest::builder()
.broadcaster_id("198704263".to_string())
.build();
// From twitch docs
let data = "\
{\n\
\"data\": [\n\
{\n\
\"tag_id\": \"621fb5bf-5498-4d8f-b4ac-db4d40d401bf\",\n\
\"is_auto\": false,\n\
\"localization_names\": {\n\
\"bg-bg\": \"Завършване без продължаване\",\n\
\"cs-cz\": \"Na jeden zátah\",\n\
\"da-dk\": \"Continue klaret\"\n\
},\n\
\"localization_descriptions\": {\n\
\"bg-bg\": \"За потоци с акцент върху завършване на аркадна игра с монети, в която не се използва продължаване\",\n\
\"cs-cz\": \"Pro vysílání s důrazem na plnění mincových arkádových her bez použití pokračování.\",\n\
\"da-dk\": \"Til streams med vægt på at gennemføre et arkadespil uden at bruge continues\"\n\
}\n\
},\n\
{\n\
\"tag_id\": \"79977fb9-f106-4a87-a386-f1b0f99783dd\",\n\
\"is_auto\": false,\n\
\"localization_names\": {\n\
\"bg-bg\": \"PvE\",\n\
\"cs-cz\": \"PvE\"\n\
},\n\
\"localization_descriptions\": {\n\
\"bg-bg\": \"За потоци с акцент върху PVE геймплей\",\n\
\"cs-cz\": \"Pro vysílání s důrazem na hratelnost \\\"hráč vs. prostředí\\\".\",\n\
\"da-dk\": \"Til streams med vægt på spil, hvor det er spilleren mod omgivelserne.\"\n\
}\n\
}\n\
]\n\
}\n\
"
.as_bytes().to_vec();
let http_response = http::Response::builder().body(data).unwrap();
let uri = req.get_uri().unwrap();
assert_eq!(
uri.to_string(),
"https://api.twitch.tv/helix/streams/tags?broadcaster_id=198704263"
);
dbg!(GetStreamTagsRequest::parse_response(Some(req), &uri, http_response).unwrap());
} | rust_cleaned_test_functions.jsonl/96077 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
262,
990,
11338,
941,
56162,
262,
1077,
4232,
284,
2126,
3027,
15930,
1900,
486,
17850,
741,
286,
659,
65,
8546,
32020,
842,
445,
16,
24,
23,
22,
15,
19,
17,
21,
18,
3263,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_virtual_alloc_free() {
const SIZE: SIZE_T = 0x1000;
let addr = unsafe {
VirtualAlloc(
std::ptr::null_mut(),
SIZE,
MEM_COMMIT | MEM_RESERVE,
PAGE_READWRITE,
)
};
assert!(addr != std::ptr::null_mut(), "VirtualAlloc failed");
let result = unsafe { VirtualFree(addr, 0, MEM_RELEASE) };
assert!(result != 0, "VirtualFree failed");
} | rust_cleaned_test_functions.jsonl/46650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58730,
14802,
8905,
368,
341,
286,
733,
25341,
25,
25341,
1139,
284,
220,
15,
87,
16,
15,
15,
15,
280,
286,
1077,
10789,
284,
19860,
341,
310,
20721,
25154,
1006,
394,
1460,
486,
3505,
486,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cond_deku() {
let test_data: Vec<u8> = [0x01, 0x02].to_vec();
let ret_read = samples::CondDeku::try_from(test_data.as_ref()).unwrap();
assert_eq!(
samples::CondDeku {
field_a: 0x01,
field_b: Some(0x02),
},
ret_read
);
let ret_write: Vec<u8> = ret_read.try_into().unwrap();
assert_eq!(test_data, ret_write);
} | rust_cleaned_test_functions.jsonl/123233 | {
"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,
24433,
2259,
12133,
368,
341,
262,
1077,
1273,
1769,
25,
11312,
34837,
23,
29,
284,
508,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
936,
983,
13251,
1428,
262,
1077,
2112,
6443,
284,
10469,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_gauge_f64() {
let client = new_nop_client("client.test");
let expected = Gauge::new_f64("client.test.", "gauge.key", 5.5);
assert_eq!(expected, client.gauge("gauge.key", 5.5).unwrap());
} | rust_cleaned_test_functions.jsonl/106613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
1889,
19392,
761,
21,
19,
368,
341,
262,
1077,
2943,
284,
501,
1089,
453,
8179,
445,
2972,
5958,
797,
262,
1077,
3601,
284,
72060,
486,
931,
761,
21,
19,
445,
2972,
5958,
1046... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_point_addition_bad_length() -> std::result::Result<(), PrecompileFailure> {
let input: Vec<u8> = [0u8; 33].to_vec();
let cost: u64 = 1;
match Curve25519Add::execute(&input, cost) {
Ok((_, _out)) => {
panic!("Test not expected to work");
}
Err(e) => {
assert_eq!(
e,
PrecompileFailure::Error {
exit_status: ExitError::Other(
"input must contain multiple of 32 bytes".into()
)
}
);
Ok(())
}
}
} | rust_cleaned_test_functions.jsonl/59618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
2891,
680,
34199,
5118,
368,
1464,
1460,
486,
1382,
486,
2077,
68843,
4968,
20433,
17507,
29,
341,
197,
10217,
1946,
25,
11312,
34837,
23,
29,
284,
508,
15,
84,
23,
26,
220,
18,
18,
936,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_internally_a_roundtrip() {
let v = EnumStructInternally::VariantA {
foo: 1,
bar: 2,
different: 3,
};
test_roundtrip(v);
} | rust_cleaned_test_functions.jsonl/110485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
932,
745,
4306,
29896,
32981,
368,
341,
262,
1077,
348,
284,
14086,
9422,
67916,
745,
486,
20746,
32,
341,
286,
15229,
25,
220,
16,
345,
286,
3619,
25,
220,
17,
345,
286,
2155,
25,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ceil() {
assert_eq!(ceil(0, 1), 0);
assert_eq!(ceil(1, 1), 1);
assert_eq!(ceil(1, 2), 1);
assert_eq!(ceil(1, 8), 1);
assert_eq!(ceil(7, 8), 1);
assert_eq!(ceil(8, 8), 1);
assert_eq!(ceil(9, 8), 2);
assert_eq!(ceil(9, 9), 1);
assert_eq!(ceil(10000000000, 10), 1000000000);
assert_eq!(ceil(10, 10000000000), 1);
assert_eq!(ceil(10000000000, 1000000000), 10);
} | rust_cleaned_test_functions.jsonl/6790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
22058,
368,
341,
286,
2060,
10714,
10297,
22058,
7,
15,
11,
220,
16,
701,
220,
15,
317,
286,
2060,
10714,
10297,
22058,
7,
16,
11,
220,
16,
701,
220,
16,
317,
286,
2060,
10714,
10297,
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_leader_sync_follower_log() {
let l = default_logger();
let ents = vec![
empty_entry(1, 2),
empty_entry(1, 3),
empty_entry(4, 4),
empty_entry(4, 5),
empty_entry(5, 6),
empty_entry(5, 7),
empty_entry(6, 8),
empty_entry(6, 9),
empty_entry(6, 10),
];
let term = 8u64;
let mut tests = vec![
vec![
empty_entry(1, 2),
empty_entry(1, 3),
empty_entry(4, 4),
empty_entry(4, 5),
empty_entry(5, 6),
empty_entry(5, 7),
empty_entry(6, 8),
empty_entry(6, 9),
],
vec![empty_entry(1, 2), empty_entry(1, 3), empty_entry(4, 4)],
vec![
empty_entry(1, 2),
empty_entry(1, 3),
empty_entry(4, 4),
empty_entry(4, 5),
empty_entry(5, 6),
empty_entry(5, 7),
empty_entry(6, 8),
empty_entry(6, 9),
empty_entry(6, 10),
empty_entry(6, 11),
],
vec![
empty_entry(1, 2),
empty_entry(1, 3),
empty_entry(4, 4),
empty_entry(4, 5),
empty_entry(5, 6),
empty_entry(5, 7),
empty_entry(6, 8),
empty_entry(6, 9),
empty_entry(6, 10),
empty_entry(7, 11),
empty_entry(7, 12),
],
vec![
empty_entry(1, 2),
empty_entry(1, 3),
empty_entry(4, 4),
empty_entry(4, 5),
empty_entry(4, 6),
empty_entry(4, 7),
],
vec![
empty_entry(1, 2),
empty_entry(1, 3),
empty_entry(2, 4),
empty_entry(2, 5),
empty_entry(2, 6),
empty_entry(3, 7),
empty_entry(3, 8),
empty_entry(3, 9),
empty_entry(3, 10),
empty_entry(3, 11),
],
];
for (i, tt) in tests.drain(..).enumerate() {
let mut lead = {
let store = MemStorage::new_with_conf_state((vec![1, 2, 3], vec![]));
store.wl().append(&ents).unwrap();
let cfg = new_test_config(1, 10, 1);
new_test_raft_with_config(&cfg, store, &l)
};
let last_index = lead.raft_log.last_index();
lead.load_state(&hard_state(term, last_index, 0));
let mut follower = {
let store = MemStorage::new_with_conf_state((vec![1, 2, 3], vec![]));
store.wl().append(&tt).unwrap();
let cfg = new_test_config(2, 10, 1);
new_test_raft_with_config(&cfg, store, &l)
};
follower.load_state(&hard_state(term - 1, 1, 0));
// It is necessary to have a three-node cluster.
// first node needs the vote from the third node to become the leader.
let mut n = Network::new(vec![Some(lead), Some(follower), NOP_STEPPER], &l);
n.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
// The election occurs in the term after the one we loaded with
let mut m = new_message(3, 1, MessageType::MsgRequestVoteResponse, 0);
m.term = term + 1;
n.send(vec![m]);
let mut m = new_message(1, 1, MessageType::MsgPropose, 0);
m.entries = vec![Entry::default()].into();
n.send(vec![m]);
let lead_str = ltoa(&n.peers[&1].raft_log);
let follower_str = ltoa(&n.peers[&2].raft_log);
if lead_str != follower_str {
panic!(
"#{}: lead str: {}, follower_str: {}",
i, lead_str, follower_str
);
}
}
} | rust_cleaned_test_functions.jsonl/62309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79991,
23008,
761,
29034,
5224,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
36852,
284,
7486,
90515,
286,
4287,
9078,
7,
16,
11,
220,
17,
1326,
286,
4287,
9078,
7,
16,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_perceptron_learn() {
let mut rng = rand::thread_rng();
let random_weights: Vec<f32> = (0..2).map(|_| rng.gen()).collect();
let mut p_and = perceptron::Node {
weights: random_weights,
bias: rng.gen(),
learning_rate: 0.1,
};
let input1 = vec![0.0, 0.0];
let input2 = vec![0.0, 1.0];
let input3 = vec![1.0, 0.0];
let input4 = vec![1.0, 1.0];
let inputs = vec![&input1, &input2, &input3, &input4];
let targets = vec![0., 0., 0., 1.];
for _ in 0..100 {
p_and.epoch(&inputs, &targets);
}
// Test AND Perceptron
assert_eq!(p_and.activate(&input1), 0.);
assert_eq!(p_and.activate(&input2), 0.);
assert_eq!(p_and.activate(&input3), 0.);
assert_eq!(p_and.activate(&input4), 1.);
assert_eq!(p_and.loss(&inputs, &targets), 0.);
} | rust_cleaned_test_functions.jsonl/130159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5678,
346,
94710,
98948,
368,
341,
262,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
262,
1077,
4194,
21114,
25,
11312,
63895,
18,
17,
29,
284,
320,
15,
496,
17,
568,
2186,
22428,
35395... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_call_search_with_args() {
let output = Command::new("./target/release/tio")
.args([
"search",
"830e3f2aeb7409b27683480e6edd0fe6c1f3c503486c31b5df5a0472b395433d",
])
.output()
.expect("failed to search for message");
assert!(String::from_utf8_lossy(&output.stdout).contains(BASE_SEARCH_OUTPUT))
} | rust_cleaned_test_functions.jsonl/41469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
10716,
6615,
8384,
368,
341,
286,
1077,
2550,
284,
7348,
486,
931,
13988,
5657,
88648,
5523,
815,
1138,
310,
659,
2116,
8956,
394,
330,
1836,
756,
394,
330,
23,
18,
15,
68,
18,
69,
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_function_param_anon_lifetime() {
check_assist(
introduce_named_lifetime,
r#"fn my_fun(x: X<'_<|>>)"#,
r#"fn my_fun<'a>(x: X<'a>)"#,
);
} | rust_cleaned_test_functions.jsonl/109558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
4090,
12008,
263,
98827,
368,
341,
286,
1779,
12083,
380,
1006,
310,
19131,
71834,
98827,
345,
310,
435,
55543,
8822,
847,
28315,
2075,
25,
1599,
18291,
41743,
91,
2452,
9940,
2,
345,
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 |
#[test]
fn test_net_hotplug() {
let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest = Guest::new(Box::new(focal));
let kernel_path = direct_kernel_boot_path();
let api_socket = temp_api_path(&guest.tmp_dir);
// Boot without network
let mut child = GuestCommand::new(&guest)
.args(&["--api-socket", &api_socket])
.args(&["--cpus", "boot=1"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", kernel_path.to_str().unwrap()])
.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE])
.default_disks()
.capture_output()
.spawn()
.unwrap();
thread::sleep(std::time::Duration::new(20, 0));
let r = std::panic::catch_unwind(|| {
// Add network
let (cmd_success, cmd_output) = remote_command_w_output(
&api_socket,
"add-net",
Some(guest.default_net_string().as_str()),
);
assert!(cmd_success);
assert!(String::from_utf8_lossy(&cmd_output)
.contains("{\"id\":\"_net2\",\"bdf\":\"0000:00:05.0\"}"));
thread::sleep(std::time::Duration::new(5, 0));
// 1 network interfaces + default localhost ==> 2 interfaces
assert_eq!(
guest
.ssh_command("ip -o link | wc -l")
.unwrap()
.trim()
.parse::<u32>()
.unwrap_or_default(),
2
);
// Remove network
assert!(remote_command(&api_socket, "remove-device", Some("_net2")));
thread::sleep(std::time::Duration::new(5, 0));
// Add network again
let (cmd_success, cmd_output) = remote_command_w_output(
&api_socket,
"add-net",
Some(guest.default_net_string().as_str()),
);
assert!(cmd_success);
assert!(String::from_utf8_lossy(&cmd_output)
.contains("{\"id\":\"_net3\",\"bdf\":\"0000:00:05.0\"}"));
thread::sleep(std::time::Duration::new(5, 0));
// 1 network interfaces + default localhost ==> 2 interfaces
assert_eq!(
guest
.ssh_command("ip -o link | wc -l")
.unwrap()
.trim()
.parse::<u32>()
.unwrap_or_default(),
2
);
guest.reboot_linux(0, None);
// Check still there after reboot
// 1 network interfaces + default localhost ==> 2 interfaces
assert_eq!(
guest
.ssh_command("ip -o link | wc -l")
.unwrap()
.trim()
.parse::<u32>()
.unwrap_or_default(),
2
);
});
let _ = child.kill();
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/29414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2093
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19722,
33433,
47474,
368,
341,
310,
1077,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
310,
1077,
8640,
284,
26215,
486,
931,
67758,
486,
931,
955,
3683... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_generic_i64_get() {
let t1 = Generic { data: 2i64 };
assert_eq!(
rune_n! {
make_native_module().expect("failed making native module"),
(t1, ),
i64 =>
pub fn main(v) { v.data }
},
2
);
} | rust_cleaned_test_functions.jsonl/77914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
5318,
21,
19,
3062,
368,
341,
262,
1077,
259,
16,
284,
21281,
314,
821,
25,
220,
17,
72,
21,
19,
2605,
262,
2060,
10714,
33673,
286,
63499,
1089,
0,
341,
310,
1281,
44494,
10750,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_c_ns_method_calls() {
let unique_ptr = ffi2::ns_c_return_unique_ptr_ns();
let old_value = unique_ptr.get();
assert_eq!(1000, old_value);
} | rust_cleaned_test_functions.jsonl/50902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
34728,
9032,
45636,
368,
341,
262,
1077,
4911,
4348,
284,
76956,
17,
486,
4412,
666,
12511,
21218,
4348,
34728,
1428,
262,
1077,
2310,
3142,
284,
4911,
4348,
670,
543,
262,
2060,
10714,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vec_segment() {
let dat = vec![1u8, 2, 3, 5, 10];
assert_write_check_read(dat, 8);
} | rust_cleaned_test_functions.jsonl/118840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 60
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
28061,
368,
341,
262,
1077,
3258,
284,
7486,
20703,
16,
84,
23,
11,
220,
17,
11,
220,
18,
11,
220,
20,
11,
220,
16,
15,
935,
262,
2060,
9165,
7200,
6443,
44841,
11,
220,
23,
317,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_run_program() {
init();
let mut prog = [1, 0, 0, 0, 99];
run_program(&mut prog, || 42, |_| {});
assert_eq!(prog, [2, 0, 0, 0, 99]);
let mut prog = [2, 3, 0, 3, 99];
run_program(&mut prog, || 42, |_| {});
assert_eq!(prog, [2, 3, 0, 6, 99]);
let mut prog = [2, 4, 4, 5, 99, 0];
run_program(&mut prog, || 42, |_| {});
assert_eq!(prog, [2, 4, 4, 5, 99, 9801]);
let mut prog = [1, 1, 1, 4, 99, 5, 6, 0, 99];
run_program(&mut prog, || 42, |_| {});
assert_eq!(prog, [30, 1, 1, 4, 2, 5, 6, 0, 99]);
} | rust_cleaned_test_functions.jsonl/28216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
25096,
368,
341,
286,
2930,
1428,
286,
1077,
5206,
29271,
284,
508,
16,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
24,
24,
935,
286,
1598,
25096,
2099,
6984,
29271,
11,
1369,
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... | 5 |
#[test]
fn test_hash_ops() {
let ctx = TestContext::new();
let mut con = ctx.connection();
redis::cmd("HSET")
.arg("foo")
.arg("key_1")
.arg(1)
.execute(&mut con);
redis::cmd("HSET")
.arg("foo")
.arg("key_2")
.arg(2)
.execute(&mut con);
let h: HashMap<String, i32> = redis::cmd("HGETALL").arg("foo").query(&mut con).unwrap();
assert_eq!(h.len(), 2);
assert_eq!(h.get("key_1"), Some(&1i32));
assert_eq!(h.get("key_2"), Some(&2i32));
let h: BTreeMap<String, i32> = redis::cmd("HGETALL").arg("foo").query(&mut con).unwrap();
assert_eq!(h.len(), 2);
assert_eq!(h.get("key_1"), Some(&1i32));
assert_eq!(h.get("key_2"), Some(&2i32));
} | rust_cleaned_test_functions.jsonl/108945 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
21959,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
1428,
262,
20870,
486,
8710,
445,
39,
5884,
1138,
286,
659,
858,
445,
7975,
1138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_ack() {
let s = [0x00, 0x04, 0x00, 0x01];
let ack = ACK::parse(&s).unwrap();
assert_eq!(ack.block(), 1);
} | rust_cleaned_test_functions.jsonl/104030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
48447,
368,
341,
286,
1077,
274,
284,
508,
15,
87,
15,
15,
11,
220,
15,
87,
15,
19,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
16,
935,
286,
1077,
10725,
284,
53763,
486,
6400,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ilrawtag_with_value_bad_id() {
const SAMPLE: [u8; 5] = [0, 1, 2, 3, 4];
ILRawTag::with_value(15, &SAMPLE);
} | rust_cleaned_test_functions.jsonl/25713 | {
"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,
26743,
1041,
4578,
6615,
3142,
34199,
842,
368,
341,
262,
733,
62420,
25,
508,
84,
23,
26,
220,
20,
60,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
11344,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cookies_on_redirect() -> Result<(), Error> {
let testserver = TestServer::new(cookie_and_redirect);
let url = format!("http://localhost:{}/first", testserver.port);
let agent = Agent::new();
agent.post(&url).call()?;
let cookies = agent.state.cookie_tin.get_request_cookies(
&format!("https://localhost:{}/", testserver.port)
.parse()
.unwrap(),
);
let mut cookie_names: Vec<String> = cookies.iter().map(|c| c.name().to_string()).collect();
cookie_names.sort();
assert_eq!(cookie_names, vec!["first", "second", "third"]);
Ok(())
} | rust_cleaned_test_functions.jsonl/73114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
94158,
4470,
30043,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
1273,
4030,
284,
3393,
5475,
486,
931,
56351,
8378,
30043,
317,
262,
1077,
2515,
284,
3561,
17223,
1254,
1110,
8301,
12547,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_identifier_json_ser_deser() {
let hex = "942b6c0bd43bdcb24f3edfe7fadbc77054ecc4f2";
let identifier = Identifier::from_hex(hex).unwrap();
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct HasAnIdentifier {
identifier: Identifier,
}
let has_an_identifier = HasAnIdentifier { identifier };
let json = serde_json::to_string(&has_an_identifier).unwrap();
assert_eq!(json, "{\"identifier\":\"942b6c0bd43bdcb24f3e\"}");
let deserialized: HasAnIdentifier = serde_json::from_str(&json).unwrap();
assert_eq!(deserialized, has_an_identifier);
} | rust_cleaned_test_functions.jsonl/60449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33176,
9455,
75861,
15768,
261,
368,
341,
197,
10217,
12371,
284,
330,
24,
19,
17,
65,
21,
66,
15,
8940,
19,
18,
8940,
7221,
17,
19,
69,
18,
291,
1859,
22,
83059,
8904,
22,
22,
15,
20,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_program_address() {
for _ in 0..1_000 {
let program_id = Pubkey::new_unique();
let (address, bump_seed) =
try_find_program_address(&[b"Lil'", b"Bits"], &program_id, 100).unwrap();
assert_eq!(
address,
create_program_address(&[b"Lil'", b"Bits", &[bump_seed]], &program_id, 1).unwrap()
);
}
let program_id = Pubkey::from_str("BPFLoaderUpgradeab1e11111111111111111111111").unwrap();
let max_tries = 256; // one per seed
let seeds: &[&[u8]] = &[b""];
let (_, bump_seed) = try_find_program_address(seeds, &program_id, max_tries).unwrap();
let remaining = 256 - bump_seed as u64;
let _ = try_find_program_address(seeds, &program_id, remaining).unwrap();
assert_eq!(
try_find_program_address(seeds, &program_id, remaining - 1),
Err(
SyscallError::InstructionError(InstructionError::ComputationalBudgetExceeded)
.into()
)
);
let exceeded_seed = &[127; MAX_SEED_LEN + 1];
assert_eq!(
try_find_program_address(&[exceeded_seed], &program_id, max_tries - 1),
Err(SyscallError::BadSeeds(PubkeyError::MaxSeedLengthExceeded).into())
);
let exceeded_seeds: &[&[u8]] = &[
&[1],
&[2],
&[3],
&[4],
&[5],
&[6],
&[7],
&[8],
&[9],
&[10],
&[11],
&[12],
&[13],
&[14],
&[15],
&[16],
&[17],
];
assert_eq!(
try_find_program_address(exceeded_seeds, &program_id, max_tries - 1),
Err(SyscallError::BadSeeds(PubkeyError::MaxSeedLengthExceeded).into())
);
} | rust_cleaned_test_functions.jsonl/35336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1086
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
25096,
6744,
368,
341,
286,
369,
716,
304,
220,
15,
496,
16,
62,
15,
15,
15,
341,
310,
1077,
2025,
842,
284,
22611,
792,
486,
931,
21218,
543,
310,
1077,
320,
4995,
11,
27575,
33809,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_install_copy_file() {
let (at, mut ucmd) = at_and_ucmd!();
let file1 = "source_file";
let file2 = "target_file";
at.touch(file1);
ucmd.arg(file1).arg(file2).succeeds().no_stderr();
assert!(at.file_exists(file1));
assert!(at.file_exists(file2));
} | rust_cleaned_test_functions.jsonl/47030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
16096,
2458,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
16,
284,
330,
2427,
2458,
876,
262,
1077,
1034,
17,
284,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_router_alert() {
let mut buffer: Vec<u8> = vec![148, 4, 0, 0];
let options = Options::<_, Ipv4OptionsImpl>::parse(buffer.as_mut()).unwrap();
let rtralt = options.iter().next().unwrap();
assert!(rtralt.copied);
assert_eq!(rtralt.data, Ipv4OptionData::RouterAlert { data: 0 });
} | rust_cleaned_test_functions.jsonl/31699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
55587,
35717,
368,
341,
310,
1077,
5206,
4147,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
16,
19,
23,
11,
220,
19,
11,
220,
15,
11,
220,
15,
935,
310,
1077,
2606,
284,
14566,
27638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq_repr_num_bits() {
let mut a = BigInteger256::from(0);
assert_eq!(0, a.num_bits());
a = BigInteger256::from(1);
for i in 1..257 {
assert_eq!(i, a.num_bits());
a.mul2();
}
assert_eq!(0, a.num_bits());
} | rust_cleaned_test_functions.jsonl/3541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
68535,
4273,
20034,
368,
341,
262,
1077,
5206,
264,
284,
34042,
17,
20,
21,
486,
1499,
7,
15,
317,
262,
2060,
10714,
10297,
15,
11,
264,
10522,
20034,
1423,
262,
264,
284,
34042,
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... | 2 |
#[test]
fn test_path_element() {
use crate::prelude::*;
let da = crate::create_mocked_drawing_area(300, 300, |m| {
m.check_draw_path(|c, s, path| {
assert_eq!(c, BLUE.to_rgba());
assert_eq!(s, 5);
assert_eq!(path, vec![(100, 101), (105, 107), (150, 157)]);
});
m.drop_check(|b| {
assert_eq!(b.num_draw_path_call, 1);
assert_eq!(b.draw_count, 1);
});
});
da.draw(&Path::new(
vec![(100, 101), (105, 107), (150, 157)],
Into::<ShapeStyle>::into(&BLUE).stroke_width(5),
))
.expect("Drawing Failure");
} | rust_cleaned_test_functions.jsonl/76167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
7894,
368,
341,
262,
990,
17717,
486,
1726,
52538,
56162,
262,
1077,
2994,
284,
17717,
486,
3182,
34134,
291,
814,
1696,
15030,
7,
18,
15,
15,
11,
220,
18,
15,
15,
11,
760,
76,
91,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scans_match_expression() {
let mut scanner = Scanner::new("<?php $a = match ($x) { 2, 1 => 1, default => 0 }; ?>");
scanner.scan().unwrap();
assert_eq!(
token_list!(scanner.tokens),
"<?php $a = match ( $x ) { 2 , 1 => 1 , default => 0 } ; ?>"
);
} | rust_cleaned_test_functions.jsonl/52961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
596,
10708,
28068,
368,
341,
286,
1077,
5206,
20775,
284,
17170,
486,
931,
98276,
1208,
400,
64,
284,
2432,
1711,
87,
8,
314,
220,
17,
11,
220,
16,
589,
220,
16,
11,
1638,
589,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fmindex() {
let text = b"GCCTTAACATTATTACGCCTA$";
let alphabet = dna::n_alphabet();
let sa = suffix_array(text);
let bwt = bwt(text, &sa);
let less = less(&bwt, &alphabet);
let occ = Occ::new(&bwt, 3, &alphabet);
let fm = FMIndex::new(&bwt, &less, &occ);
let pattern = b"TTA";
let sai = fm.backward_search(pattern.iter());
let positions = sai.occ(&sa);
assert_eq!(positions, [3, 12, 9]);
} | rust_cleaned_test_functions.jsonl/18359 | {
"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,
78694,
1252,
368,
341,
286,
1077,
1467,
284,
293,
1,
22863,
1162,
15204,
1706,
21614,
21614,
1706,
22863,
1162,
32,
3,
876,
286,
1077,
27790,
284,
75334,
486,
77,
8418,
18485,
543,
286,
1077,
82... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_day_digit() {
init();
for n in 1..=31 {
if n < 10 {
let s: &str = &n.to_string();
let input = s.chars().collect::<Vec<_>>();
let result: Expr = (day_digit() - end()).parse(&input).to_result().unwrap();
assert_eq!(result, ValueExpr(n));
}
let s: &str = &format!("{:<02}", n);
let input = s.chars().collect::<Vec<_>>();
let result: Expr = (day_digit() - end()).parse(&input).to_result().unwrap();
assert_eq!(result, ValueExpr(n));
}
let input = "32".chars().collect::<Vec<_>>();
let result = (day_digit() - end()).parse(&input).to_result();
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/106895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
48403,
368,
341,
262,
2930,
543,
262,
369,
308,
304,
220,
16,
496,
28,
18,
16,
341,
414,
421,
308,
366,
220,
16,
15,
341,
286,
1077,
274,
25,
609,
495,
284,
609,
77,
2389,
3904,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_realtime_period_not_supported() {
// arrange
let tmp = create_temp_dir("test_realtime_period_not_supported")
.expect("create temp directory for test");
let cpu = LinuxCpuBuilder::new().with_realtime_period(5).build();
// act
let result = Cpu::apply(&tmp, &cpu);
// assert
assert!(
result.is_err(),
"realtime period is not supported and should return an error"
);
} | rust_cleaned_test_functions.jsonl/126565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
1678,
20818,
7913,
57885,
368,
341,
286,
442,
30893,
198,
286,
1077,
4174,
284,
1855,
11771,
4334,
445,
1944,
15266,
1678,
20818,
7913,
57885,
1138,
310,
659,
17119,
445,
3182,
2730,
6220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doesnt_accept_wrong_port() {
let mut s = socket_established();
s.rx_buffer = SocketBuffer::new(vec![0; 6]);
s.assembler = Assembler::new(s.rx_buffer.capacity());
let tcp_repr = TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
dst_port: LOCAL_PORT + 1,
..SEND_TEMPL
};
assert!(!s.accepts(&SEND_IP_TEMPL, &tcp_repr));
let tcp_repr = TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
src_port: REMOTE_PORT + 1,
..SEND_TEMPL
};
assert!(!s.accepts(&SEND_IP_TEMPL, &tcp_repr));
} | rust_cleaned_test_functions.jsonl/1791 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96374,
406,
35728,
75198,
8716,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
274,
45348,
7776,
284,
20954,
4095,
486,
931,
25592,
20703,
15,
26,
220,
21,
2558,
286,
274... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transpile_jsx_pragma() {
let specifier = resolve_url_or_path("https://deno.land/x/mod.ts")
.expect("could not resolve specifier");
let source = r#"
/** @jsx h */
/** @jsxFrag Fragment */
import { h, Fragment } from "https://deno.land/x/mod.ts";
function App() {
return (
<div><></></div>
);
}"#;
let module = parse_module(ParseParams {
specifier: specifier.as_str().to_string(),
source: SourceTextInfo::from_string(source.to_string()),
media_type: deno_ast::MediaType::Jsx,
capture_tokens: false,
maybe_syntax: None,
scope_analysis: true,
})
.unwrap();
let (code, _) = transpile(&module, &EmitOptions::default()).unwrap();
let expected = r#"/** @jsx h */ /** @jsxFrag Fragment */ import { h, Fragment } from "https://deno.land/x/mod.ts";
function App() {
return(/*#__PURE__*/ h("div", null, /*#__PURE__*/ h(Fragment, null)));
}"#;
assert_eq!(&code[..expected.len()], expected);
} | rust_cleaned_test_functions.jsonl/65184 | {
"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,
7965,
12192,
26250,
87,
620,
4101,
1728,
368,
341,
262,
1077,
97616,
284,
8830,
2903,
8734,
2638,
445,
2428,
1110,
5183,
78,
87627,
10776,
38479,
21288,
1138,
414,
659,
17119,
445,
28077,
537,
883... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fn_signature_with_docs_simple() {
let info = call_info(
r#"
/// test
// non-doc-comment
fn foo(j: u32) -> u32 {
j
}
fn bar() {
let _ = foo(<|>);
}
"#,
);
assert_eq!(info.parameters(), ["j: u32"]);
assert_eq!(info.active_parameter, Some(0));
assert_eq!(info.label(), "fn foo(j: u32) -> u32");
assert_eq!(info.doc().map(|it| it.into()), Some("test".to_string()));
} | rust_cleaned_test_functions.jsonl/55354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
39859,
6615,
49692,
30015,
368,
341,
286,
1077,
3546,
284,
1618,
3109,
1006,
310,
435,
2,
698,
2575,
1273,
198,
322,
2477,
11527,
45666,
198,
8822,
15229,
3325,
25,
575,
18,
17,
8,
1464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_array_complex_structure() {
// A made up structure for this test
struct TestStructure {
durp0: u64,
durp1: String,
durp2: f64,
durp3: bool,
}
// Create the map and initialize a vector of TestStructure
let array_size: u64 = 10;
let map: ArrayMap = unsafe {
ArrayMap::new(
"mymap",
std::mem::size_of::<u64>() as u32,
array_size as u32,
)
.expect("Failed to create new map")
};
let data: Vec<TestStructure> = (0..array_size)
.map(|v| TestStructure {
durp0: v,
durp1: format!("Durp {}", v),
durp2: 0.1234,
durp3: v % 2 == 0,
})
.collect();
// Write the test structures to the map
for (i, tmp) in data.iter().enumerate() {
unsafe { map.write(i as u32, tmp).expect("could not write to map") };
}
// Read the test structures from the map and compare with originals
for (i, item) in data.iter().enumerate() {
let val: &TestStructure =
unsafe { map.read(i as u32).expect("Failed to read value from array") };
assert_eq!(val.durp0, item.durp0);
assert_eq!(val.durp1, item.durp1);
assert_eq!(val.durp2, item.durp2);
assert_eq!(val.durp3, item.durp3);
}
} | rust_cleaned_test_functions.jsonl/40487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 830
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
3858,
41522,
38283,
368,
341,
286,
442,
362,
1865,
705,
5944,
369,
419,
1273,
198,
286,
2036,
3393,
22952,
341,
310,
10651,
79,
15,
25,
575,
21,
19,
345,
310,
10651,
79,
16,
25,
923,
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... | 3 |
#[test]
fn test_tuple_struct() {
Python::with_gil(|py| {
let tup = PyTuple::new(py, &[1.into_py(py), "test".into_py(py)]);
let tup = Tuple::extract(tup.as_ref());
assert!(tup.is_err());
let tup = PyTuple::new(py, &["test".into_py(py), 1.into_py(py)]);
let tup = Tuple::extract(tup.as_ref()).expect("Failed to extract Tuple from PyTuple");
assert_eq!(tup.0, "test");
assert_eq!(tup.1, 1);
});
} | rust_cleaned_test_functions.jsonl/59470 | {
"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,
21773,
15126,
368,
341,
262,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
286,
1077,
57385,
284,
80824,
486,
931,
46827,
11,
44590,
16,
39860,
40291,
46827,
701,
330,
1944,
3263,
18122,
4029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_same_merkle_root() {
let dir1 = TempDir::new(super::gen_tempdir_name().as_str()).unwrap();
let path1 = dir1.path();
let db1 = create_database(path1);
let dir2 = TempDir::new(super::gen_tempdir_name().as_str()).unwrap();
let path2 = dir2.path();
let db2 = create_database(path2);
super::same_merkle_root(db1, db2);
} | rust_cleaned_test_functions.jsonl/115567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33574,
717,
16754,
273,
12993,
368,
341,
286,
1077,
5419,
16,
284,
19944,
6184,
486,
931,
56040,
486,
4370,
11771,
3741,
1269,
1005,
300,
2895,
6011,
15454,
543,
286,
1077,
1815,
16,
284,
5419,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_email() {
let email_service = OhMySmtp::new(format!("API_KEY"));
assert_eq!(
email_service.send(&Email::new(
format!("from@email.address"),
format!("test@-iana.org"),
format!("Body text"),
)),
Err(Error::InvalidEmail)
);
} | rust_cleaned_test_functions.jsonl/67588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
9172,
368,
341,
262,
1077,
2551,
12267,
284,
8670,
5050,
10673,
790,
486,
931,
20698,
17223,
7082,
6600,
14929,
262,
2060,
10714,
33673,
286,
2551,
12267,
5219,
2099,
4781,
486,
931,
1006,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_edgengram_tokenizer_max_size() {
let tokenizer = NGramTokenizer::new("hello", 2, 1000, Edge::Left);
let tokens = tokenizer.collect::<Vec<Token>>();
assert_eq!(tokens, vec![
Token { term: Term::from_string("he"), position: 1 },
Token { term: Term::from_string("hel"), position: 1 },
Token { term: Term::from_string("hell"), position: 1 },
Token { term: Term::from_string("hello"), position: 1 },
]);
} | rust_cleaned_test_functions.jsonl/50144 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32370,
70,
826,
2396,
6458,
3135,
6345,
2368,
368,
341,
286,
1077,
45958,
284,
20018,
2396,
37434,
486,
931,
445,
14990,
497,
220,
17,
11,
220,
16,
15,
15,
15,
11,
10349,
486,
5415,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_unaligned_sized() {
// new_unaligned_from_suffix return empty slices. Test that an unaligned
// buffer whose length is a multiple of the element size works for
// memory.
let mut buf = [0u8; 8];
test_new_helper_unaligned(
LayoutVerified::<_, [u8; 8]>::new_unaligned(&mut buf[..]).unwrap(),
);
buf = [0xFFu8; 8];
test_new_helper_unaligned(
LayoutVerified::<_, [u8; 8]>::new_unaligned_zeroed(&mut buf[..]).unwrap(),
);
{
// in a block so that lv and suffix don't live too long
buf = [0u8; 8];
let (lv, suffix) =
LayoutVerified::<_, [u8; 8]>::new_unaligned_from_prefix(&mut buf[..]).unwrap();
assert!(suffix.is_empty());
test_new_helper_unaligned(lv);
}
{
buf = [0xFFu8; 8];
let (lv, suffix) =
LayoutVerified::<_, [u8; 8]>::new_unaligned_from_prefix_zeroed(&mut buf[..])
.unwrap();
assert!(suffix.is_empty());
test_new_helper_unaligned(lv);
}
{
buf = [0u8; 8];
let (prefix, lv) =
LayoutVerified::<_, [u8; 8]>::new_unaligned_from_suffix(&mut buf[..]).unwrap();
assert!(prefix.is_empty());
test_new_helper_unaligned(lv);
}
{
buf = [0xFFu8; 8];
let (prefix, lv) =
LayoutVerified::<_, [u8; 8]>::new_unaligned_from_suffix_zeroed(&mut buf[..])
.unwrap();
assert!(prefix.is_empty());
test_new_helper_unaligned(lv);
}
let mut buf = [0u8; 16];
// buf.buf should be aligned to 8 and have a length which is a multiple
test_new_helper_slice_unaligned(
LayoutVerified::<_, [u8]>::new_slice(&mut buf[..]).unwrap(),
);
buf = [0xFFu8; 16];
test_new_helper_slice_unaligned(
LayoutVerified::<_, [u8]>::new_slice_zeroed(&mut buf[..]).unwrap(),
);
} | rust_cleaned_test_functions.jsonl/18895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
4907,
47142,
643,
1506,
368,
341,
73363,
286,
442,
501,
4907,
47142,
5673,
37151,
470,
4287,
34254,
13,
3393,
429,
458,
650,
47142,
198,
286,
442,
4147,
6693,
3084,
374,
264,
5248,
315,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pop_push() {
let mut c = ContextImpl(vec![]);
c.push(wrap(10i32));
assert_eq!(1, c.len());
assert_eq!(10i32, unwrap::<i32>(c.pop().unwrap()).unwrap());
assert!(c.is_empty());
} | rust_cleaned_test_functions.jsonl/7108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
14218,
368,
341,
286,
1077,
5206,
272,
284,
9608,
9673,
25592,
0,
56703,
286,
272,
2552,
3622,
4611,
7,
16,
15,
72,
18,
17,
1106,
286,
2060,
10714,
10297,
16,
11,
272,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_txs() {
let mut r = Register::new();
r.set_X(0xFF);
txs(&mut r);
assert_eq!(r.get_S(),0xFF)
} | rust_cleaned_test_functions.jsonl/14192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17805,
82,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
435,
980,
6859,
7,
15,
9264,
317,
262,
9854,
82,
2099,
6984,
435,
317,
262,
2060,
10714,
10297,
81,
670,
1098,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_reach_thirteen_height() {
let sandbox = timestamping_sandbox();
let sandbox_state = SandboxState::new();
let target_height = 13;
for height in 2..target_height + 1 {
add_one_height(&sandbox, &sandbox_state);
sandbox.assert_state(Height(height), ROUND_ONE);
}
} | rust_cleaned_test_functions.jsonl/8873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
610,
5854,
44904,
9561,
368,
341,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
543,
262,
1077,
42754,
4387,
284,
96860,
1397,
486,
931,
1428,
262,
1077,
2169,
9561,
284,
220,
16,
18,
401... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_auth_change() {
let mesh = Mesh::new(4, 16);
let network = Network::new(mesh.clone(), 0).unwrap();
let mut transport = MockConnectingTransport::expect_connections(vec![
Ok(Box::new(MockConnection::new())),
Ok(Box::new(MockConnection::new())),
Ok(Box::new(MockConnection::new())),
]);
let orchestrator_connection = transport
.connect("inproc://admin-service")
.expect("failed to create connection");
let orchestrator = ServiceOrchestrator::new(vec![], orchestrator_connection, 1, 1, 1)
.expect("failed to create orchestrator");
let peer_connector = PeerConnector::new(network.clone(), Box::new(transport));
let state = setup_splinter_state();
let key_registry = StorageKeyRegistry::new("memory".to_string()).unwrap();
let mut shared = AdminServiceShared::new(
"my_peer_id".into(),
orchestrator,
peer_connector,
Box::new(MockAuthInquisitor),
state,
Box::new(HashVerifier),
Box::new(key_registry),
Box::new(AllowAllKeyPermissionManager),
"memory",
)
.unwrap();
let mut circuit = admin::Circuit::new();
circuit.set_circuit_id("test_propose_circuit".into());
circuit.set_authorization_type(admin::Circuit_AuthorizationType::TRUST_AUTHORIZATION);
circuit.set_persistence(admin::Circuit_PersistenceType::ANY_PERSISTENCE);
circuit.set_routes(admin::Circuit_RouteType::ANY_ROUTE);
circuit.set_durability(admin::Circuit_DurabilityType::NO_DURABILITY);
circuit.set_circuit_management_type("test app auth handler".into());
circuit.set_members(protobuf::RepeatedField::from_vec(vec![
splinter_node("test-node", "tcp://someplace:8000"),
splinter_node("other-node", "tcp://otherplace:8000"),
]));
circuit.set_roster(protobuf::RepeatedField::from_vec(vec![
splinter_service("service-a", "sabre"),
splinter_service("service-b", "sabre"),
]));
let mut request = admin::CircuitCreateRequest::new();
request.set_circuit(circuit);
let mut header = admin::CircuitManagementPayload_Header::new();
header.set_action(admin::CircuitManagementPayload_Action::CIRCUIT_CREATE_REQUEST);
let mut payload = admin::CircuitManagementPayload::new();
payload.set_signature(Vec::new());
payload.set_header(protobuf::Message::write_to_bytes(&header).unwrap());
payload.set_circuit_create_request(request);
shared
.propose_circuit(payload)
.expect("Proposal not accepted");
// None of the proposed members are peered
assert_eq!(0, shared.pending_circuit_payloads.len());
shared.on_authorization_change("test-node", PeerAuthorizationState::Authorized);
// One node is still unpeered
assert_eq!(0, shared.pending_circuit_payloads.len());
shared.on_authorization_change("other-node", PeerAuthorizationState::Authorized);
assert_eq!(1, shared.pending_circuit_payloads.len());
} | rust_cleaned_test_functions.jsonl/124167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14014,
15947,
368,
341,
286,
1077,
11294,
284,
25122,
486,
931,
7,
19,
11,
220,
16,
21,
317,
286,
1077,
3922,
284,
8141,
486,
931,
46341,
15997,
1507,
220,
15,
568,
15454,
543,
286,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tags() {
let pos_t = get::<Pos>();
let kind = pos_t.get_kind();
let new_pos_t = TaggedType::new(&pos_t, kind, Box::new(42));
assert!(new_pos_t.get_tagged_data() == Some(&42));
assert!(new_pos_t.get_tagged_type() == &*pos_t);
} | rust_cleaned_test_functions.jsonl/101715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16333,
368,
341,
262,
1077,
1133,
528,
284,
633,
27638,
4859,
3913,
262,
1077,
3093,
284,
1133,
528,
670,
33162,
543,
262,
1077,
501,
6479,
528,
284,
12353,
3556,
929,
486,
931,
2099,
966,
528,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_api_server_cert_auth_data_valid() -> Result<()> {
match get_api_server_cert_auth_data(&HeaderValue::from_static(VALID_CERT_BASE64)) {
Ok(data) => {
assert_eq!(data, base64::decode(VALID_CERT_BASE64.as_bytes())?);
Ok(())
}
Err(e) => anyhow::bail!("got {}, want: valid cert data", e),
}
} | rust_cleaned_test_functions.jsonl/125246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
12015,
37097,
14014,
1769,
8337,
368,
1464,
5714,
71698,
341,
286,
2432,
633,
11697,
12015,
37097,
14014,
1769,
2099,
97721,
486,
1499,
25360,
7,
10044,
55298,
11762,
21,
19,
593,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_target_family_shortcut() {
setup_test!("CARGO_CFG_TARGET_FAMILY": "unix");
assert!(build_cfg!(target_family = "unix"));
assert!(!build_cfg!(target_family = "windows"));
assert!(!build_cfg!(target_family = "wasm"));
assert!(build_cfg!(unix));
assert!(!build_cfg!(windows));
assert!(!build_cfg!(wasm));
setup_test!("CARGO_CFG_TARGET_FAMILY": "windows");
assert!(!build_cfg!(target_family = "unix"));
assert!(build_cfg!(target_family = "windows"));
assert!(!build_cfg!(target_family = "wasm"));
assert!(!build_cfg!(unix));
assert!(build_cfg!(windows));
assert!(!build_cfg!(wasm));
setup_test!("CARGO_CFG_TARGET_FAMILY": "wasm");
assert!(!build_cfg!(target_family = "unix"));
assert!(!build_cfg!(target_family = "windows"));
assert!(build_cfg!(target_family = "wasm"));
assert!(!build_cfg!(unix));
assert!(!build_cfg!(windows));
assert!(build_cfg!(wasm));
} | rust_cleaned_test_functions.jsonl/64893 | {
"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,
11123,
26823,
16673,
10242,
368,
341,
84571,
4452,
17223,
34,
7581,
46,
21760,
29299,
80828,
788,
330,
56646,
797,
6948,
10297,
5834,
18343,
10297,
5657,
26823,
284,
330,
56646,
4010,
6948,
0,
3471,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pipe_lit() {
test_walk(
"(a=<-)=>a",
vec![
"File",
"ExprStmt",
"FunctionExpr",
"Property",
"Identifier",
"PipeLit",
"Identifier",
],
)
} | rust_cleaned_test_functions.jsonl/133866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
98399,
368,
341,
262,
1273,
56131,
1006,
286,
11993,
64,
38698,
12,
27166,
64,
756,
286,
7486,
90515,
310,
330,
1703,
756,
310,
330,
16041,
31063,
756,
310,
330,
5152,
16041,
756,
310,
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 |
#[test]
fn test_listen() {
let addr = unused_addr();
let (tx, rx) = mpsc::channel();
let h = thread::spawn(move || {
let sys = scrappy_rt::System::new("test");
let lst = net::TcpListener::bind(addr).unwrap();
Server::build()
.disable_signals()
.workers(1)
.listen("test", lst, move || fn_service(|_| ok::<_, ()>(())))
.unwrap()
.start();
let _ = tx.send(scrappy_rt::System::current());
let _ = sys.run();
});
let sys = rx.recv().unwrap();
thread::sleep(time::Duration::from_millis(500));
assert!(net::TcpStream::connect(addr).is_ok());
let _ = sys.stop();
let _ = h.join();
} | rust_cleaned_test_functions.jsonl/5726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79286,
368,
341,
262,
1077,
10789,
284,
20006,
7387,
543,
262,
1077,
320,
3998,
11,
19111,
8,
284,
296,
81984,
486,
10119,
1428,
262,
1077,
305,
284,
4516,
486,
46087,
34081,
1369,
341,
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... | 3 |
#[test]
fn test_majority_disk_full() {
let mut cluster = new_node_cluster(0, 3);
// To ensure the thread has full store disk usage infomation.
cluster.cfg.raft_store.store_batch_system.pool_size = 1;
cluster.pd_client.disable_default_operator();
cluster.run();
// To ensure all replicas are not pending.
cluster.must_put(b"k1", b"v1");
must_get_equal(&cluster.get_engine(1), b"k1", b"v1");
must_get_equal(&cluster.get_engine(2), b"k1", b"v1");
must_get_equal(&cluster.get_engine(3), b"k1", b"v1");
cluster.must_transfer_leader(1, new_peer(1, 1));
let region = cluster.get_region(b"k1");
let epoch = region.get_region_epoch().clone();
// To ensure followers have reported disk usages to the leader.
for i in 1..3 {
fail::cfg(get_fp(DiskUsage::AlmostFull, i + 1), "return").unwrap();
ensure_disk_usage_is_reported(&mut cluster, i + 1, i + 1, ®ion);
}
// Normal proposals will be rejected because of majority peers' disk full.
let ch = cluster.async_put(b"k2", b"v2").unwrap();
let resp = ch.recv_timeout(Duration::from_secs(1)).unwrap();
assert_eq!(disk_full_stores(&resp), vec![2, 3]);
// Proposals with special `DiskFullOpt`s can be accepted even if all peers are disk full.
fail::cfg(get_fp(DiskUsage::AlmostFull, 1), "return").unwrap();
let reqs = vec![new_put_cmd(b"k3", b"v3")];
let put = new_request(1, epoch.clone(), reqs, false);
let mut opts = RaftCmdExtraOpts::default();
opts.disk_full_opt = DiskFullOpt::AllowedOnAlmostFull;
let ch = cluster.async_request_with_opts(put, opts).unwrap();
let resp = ch.recv_timeout(Duration::from_secs(1)).unwrap();
assert!(!resp.get_header().has_error());
// Reset disk full status for peer 2 and 3. 2 follower reads must success because the leader
// will continue to append entries to followers after the new disk usages are reported.
for i in 1..3 {
fail::remove(get_fp(DiskUsage::AlmostFull, i + 1));
ensure_disk_usage_is_reported(&mut cluster, i + 1, i + 1, ®ion);
must_get_equal(&cluster.get_engine(i + 1), b"k3", b"v3");
}
// To ensure followers have reported disk usages to the leader.
for i in 1..3 {
fail::cfg(get_fp(DiskUsage::AlreadyFull, i + 1), "return").unwrap();
ensure_disk_usage_is_reported(&mut cluster, i + 1, i + 1, ®ion);
}
// Proposals with special `DiskFullOpt`s will still be rejected if majority peers are already
// disk full.
let reqs = vec![new_put_cmd(b"k3", b"v3")];
let put = new_request(1, epoch.clone(), reqs, false);
let mut opts = RaftCmdExtraOpts::default();
opts.disk_full_opt = DiskFullOpt::AllowedOnAlmostFull;
let ch = cluster.async_request_with_opts(put, opts).unwrap();
let resp = ch.recv_timeout(Duration::from_secs(10)).unwrap();
assert_eq!(disk_full_stores(&resp), vec![2, 3]);
// Peer 2 disk usage changes from already full to almost full.
fail::remove(get_fp(DiskUsage::AlreadyFull, 2));
fail::cfg(get_fp(DiskUsage::AlmostFull, 2), "return").unwrap();
ensure_disk_usage_is_reported(&mut cluster, 2, 2, ®ion);
// Configuration change should be alloed.
cluster.pd_client.must_remove_peer(1, new_peer(2, 2));
// should be allowed.
let reqs = vec![new_put_cmd(b"k4", b"v4")];
let put = new_request(1, epoch, reqs, false);
let mut opts = RaftCmdExtraOpts::default();
opts.disk_full_opt = DiskFullOpt::AllowedOnAlmostFull;
let ch = cluster.async_request_with_opts(put, opts).unwrap();
let resp = ch.recv_timeout(Duration::from_secs(1)).unwrap();
assert_eq!(disk_full_stores(&resp), vec![3]);
for i in 0..3 {
fail::remove(get_fp(DiskUsage::AlreadyFull, i + 1));
fail::remove(get_fp(DiskUsage::AlmostFull, i + 1));
}
} | rust_cleaned_test_functions.jsonl/64928 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1522
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47916,
487,
41687,
16372,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
442,
2014,
5978,
279,
4516,
702,
2480,
3553,
13364,
10431,
4132,
316,
367,
624,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_star_network_push_ring_200() {
let mut network = ring_network_create(200);
let thread_pool = build_gossip_thread_pool();
network_simulator(&thread_pool, &mut network, 0.9);
} | rust_cleaned_test_functions.jsonl/2399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31681,
20966,
14218,
34683,
62,
17,
15,
15,
368,
341,
262,
1077,
5206,
3922,
284,
10058,
20966,
8657,
7,
17,
15,
15,
317,
262,
1077,
4516,
15709,
284,
1936,
1889,
41473,
10814,
15709,
543,
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 |
#[test]
fn test_lp_vector_bad_int_p() {
let v: Vector<f64> = Vector::new(vec![]);
VectorNorm::norm(&Lp::Integer(0), &v);
} | rust_cleaned_test_functions.jsonl/6909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76529,
12247,
34199,
4042,
620,
368,
341,
286,
1077,
348,
25,
4196,
63895,
21,
19,
29,
284,
4196,
486,
931,
25592,
0,
56703,
286,
4196,
24993,
486,
20011,
2099,
43,
79,
486,
3486,
7,
15,
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 |
#[test]
fn test_ignore() {
let flag = NumberFormat::IGNORE;
let flag = flag | NumberFormat::from_digit_separator(b'_');
assert_eq!(flag.flags(), NumberFormat::DIGIT_SEPARATOR_FLAG_MASK);
assert_eq!(flag.digit_separator(), b'_');
assert_eq!(flag.decimal_point(), b'.');
assert_eq!(flag.exponent_decimal(), b'e');
assert_eq!(flag.required_integer_digits(), false);
assert_eq!(flag.required_fraction_digits(), false);
assert_eq!(flag.required_exponent_digits(), false);
assert_eq!(flag.required_digits(), false);
assert_eq!(flag.no_positive_mantissa_sign(), false);
assert_eq!(flag.required_mantissa_sign(), false);
assert_eq!(flag.no_exponent_notation(), false);
assert_eq!(flag.no_positive_exponent_sign(), false);
assert_eq!(flag.required_exponent_sign(), false);
assert_eq!(flag.no_exponent_without_fraction(), false);
assert_eq!(flag.no_special(), false);
assert_eq!(flag.case_sensitive_special(), false);
assert_eq!(flag.no_integer_leading_zeros(), false);
assert_eq!(flag.no_float_leading_zeros(), false);
assert_eq!(flag.required_exponent_notation(), false);
assert_eq!(flag.integer_internal_digit_separator(), true);
assert_eq!(flag.fraction_internal_digit_separator(), true);
assert_eq!(flag.exponent_internal_digit_separator(), true);
assert_eq!(flag.internal_digit_separator(), true);
assert_eq!(flag.integer_leading_digit_separator(), true);
assert_eq!(flag.fraction_leading_digit_separator(), true);
assert_eq!(flag.exponent_leading_digit_separator(), true);
assert_eq!(flag.leading_digit_separator(), true);
assert_eq!(flag.integer_trailing_digit_separator(), true);
assert_eq!(flag.fraction_trailing_digit_separator(), true);
assert_eq!(flag.exponent_trailing_digit_separator(), true);
assert_eq!(flag.trailing_digit_separator(), true);
assert_eq!(flag.integer_consecutive_digit_separator(), true);
assert_eq!(flag.fraction_consecutive_digit_separator(), true);
assert_eq!(flag.exponent_consecutive_digit_separator(), true);
assert_eq!(flag.consecutive_digit_separator(), true);
assert_eq!(flag.special_digit_separator(), true);
#[cfg(feature = "power_of_two")]
assert_eq!(flag.exponent_backup(), b'^');
} | rust_cleaned_test_functions.jsonl/70027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1040
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
368,
341,
286,
1077,
5181,
284,
5624,
4061,
486,
35045,
280,
286,
1077,
5181,
284,
5181,
760,
5624,
4061,
486,
1499,
48403,
58204,
1883,
36777,
1157,
286,
2060,
10714,
10297,
9903,
27203,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_whitespace_block() {
let text = "Hello, {{- if name -}} {name} {{- endif -}} , how are you?";
let instructions = compile(text).unwrap();
assert_eq!(6, instructions.len());
assert_eq!(&Literal("Hello,"), &instructions[0]);
assert_eq!(
&Branch(vec![PathStep::Name("name")], true, 5),
&instructions[1]
);
assert_eq!(&Literal(""), &instructions[2]);
assert_eq!(&Value(vec![PathStep::Name("name")]), &instructions[3]);
assert_eq!(&Literal(""), &instructions[4]);
assert_eq!(&Literal(", how are you?"), &instructions[5]);
} | rust_cleaned_test_functions.jsonl/18180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66130,
86175,
7113,
368,
972,
286,
1077,
1467,
284,
330,
9707,
11,
257,
5867,
12,
421,
829,
481,
3417,
262,
314,
606,
92,
262,
5867,
12,
12330,
481,
3417,
256,
1154,
1246,
525,
498,
30,
3534,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_forced_checkout_of_added_blob_with_content_conflict() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
rm!(repo: "foo");
bit_commit_all!(repo);
touch!(repo: "foo" < "new foo contents");
bit_checkout!(repo: --force "HEAD^")?;
assert_eq!(cat!(repo: "foo"), "default foo contents");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
1998,
68186,
3575,
37653,
45908,
6615,
7495,
16059,
21242,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
18998,
10297,
23476,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_check_unique() {
// See https://github.com/clap-rs/clap/issues/2624
new_ucmd!()
.args(&["-c", "-u"])
.pipe_in("A\nA\n")
.fails()
.code_is(1)
.stderr_only("sort: -:2: disorder: A");
} | rust_cleaned_test_functions.jsonl/20528 | {
"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,
7200,
21218,
368,
341,
1066,
262,
442,
3496,
3703,
1110,
5204,
905,
55931,
391,
3795,
82,
55931,
391,
38745,
14,
17,
21,
17,
19,
198,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_group() {
let regex = r"^(?P<foo>\d*)$";
let input = "1";
let output: Result<Test> = from_str(input, regex);
assert!(output.is_err());
} | rust_cleaned_test_functions.jsonl/133417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
6288,
368,
341,
286,
1077,
20180,
284,
435,
1,
13268,
30,
47,
27,
7975,
8449,
67,
3764,
3,
876,
286,
1077,
1946,
284,
330,
16,
876,
286,
1077,
2550,
25,
5714,
71273,
29,
284,
504,
289... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ip_has_changed_with_two_different_ips() {
let mut results = IpResults::new(Some(false));
results.add_result(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), Utc::now());
results.add_result(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 2)), Utc::now());
assert!(results.ip_has_changed() == true);
} | rust_cleaned_test_functions.jsonl/86299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10385,
21778,
25213,
6615,
23241,
82741,
71074,
368,
341,
286,
1077,
5206,
3059,
284,
35033,
9801,
486,
931,
65405,
3576,
1106,
286,
3059,
1364,
5287,
8972,
79,
13986,
486,
53,
19,
8972,
30168,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_linear_gradient_7() {
assert_eq!(
parse_style_background_content(
"linear-gradient(to right, rgba(255,0, 0,1) 0%,rgba(0,0,0, 0) 100%)"
),
Ok(StyleBackgroundContent::LinearGradient(LinearGradient {
direction: Direction::FromTo(DirectionCorner::Left, DirectionCorner::Right),
extend_mode: ExtendMode::Clamp,
stops: vec![
GradientStopPre {
offset: Some(PercentageValue::new(0.0)),
color: ColorU {
r: 255,
g: 0,
b: 0,
a: 255
},
},
GradientStopPre {
offset: Some(PercentageValue::new(100.0)),
color: ColorU {
r: 0,
g: 0,
b: 0,
a: 0
},
}
],
}))
);
} | rust_cleaned_test_functions.jsonl/114009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
40674,
49482,
62,
22,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
15117,
24103,
7495,
1006,
394,
330,
22763,
42738,
12186,
1290,
11,
23524,
7,
17,
20,
20,
11,
15,
11,
220,
15,
11,
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_isaac_clone() {
let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0,
57,48,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0];
let mut rng1 = IsaacRng::from_seed(seed);
let mut rng2 = rng1.clone();
for _ in 0..16 {
assert_eq!(rng1.next_u32(), rng2.next_u32());
}
} | rust_cleaned_test_functions.jsonl/52743 | {
"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,
6892,
64705,
54742,
368,
341,
286,
1077,
10320,
284,
508,
16,
11,
15,
11,
15,
11,
15,
11,
220,
17,
18,
11,
15,
11,
15,
11,
15,
11,
220,
17,
15,
15,
11,
16,
11,
15,
11,
15,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_ansi_term_style_with_special_omit_attribute() {
assert_eq!(
parse_ansi_term_style("omit", None, false),
(ansi_term::Style::new(), true, false, false)
);
assert_eq!(
parse_ansi_term_style("omit syntax italic white hidden", None, false),
(
ansi_term::Style {
background: Some(ansi_term::Color::White),
is_italic: true,
is_hidden: true,
..ansi_term::Style::new()
},
true,
false,
true
)
);
} | rust_cleaned_test_functions.jsonl/129640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
62,
52067,
17464,
15117,
6615,
41629,
62,
77968,
16791,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
62,
52067,
17464,
15117,
445,
77968,
497,
2240,
11,
895,
1326,
310,
320,
52067,
17464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_self_in_path_to_parameter() {
test_rename(
r#"
struct Foo {
i: i32,
}
impl Foo {
fn f(&self) -> i32 {
let self_var = 1;
self<|>.i
}
}
"#,
"foo",
r#"
struct Foo {
i: i32,
}
impl Foo {
fn f(foo: &Foo) -> i32 {
let self_var = 1;
foo.i
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/58103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25637,
1243,
2638,
2346,
24899,
368,
341,
286,
1273,
79399,
1006,
310,
435,
2,
698,
262,
2036,
33428,
341,
286,
600,
25,
600,
18,
17,
345,
262,
555,
262,
11605,
33428,
341,
286,
5168,
282,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fieldtype_from_sample() {
let example_unicode = "abc123!";
let example_int = "123";
let example_float = "1.23";
let example_date = "2019-07-10";
let example_date2 = "7/10/19";
let example_date3 = "7/10/2019";
let example_date4 = "8-Jul-2019";
let example_datetime = "2019-07-10T16:39:57-08:00";
let example_datetime2 = "2019-07-10T16:39:57Z";
let sample_unicode = FieldType::from_sample(example_unicode.as_bytes());
let sample_int = FieldType::from_sample(example_int.as_bytes());
let sample_float = FieldType::from_sample(example_float.as_bytes());
let sample_date = FieldType::from_sample(example_date.as_bytes());
let sample_date2 = FieldType::from_sample(example_date2.as_bytes());
let sample_date3 = FieldType::from_sample(example_date3.as_bytes());
let sample_date4 = FieldType::from_sample(example_date4.as_bytes());
let sample_datetime = FieldType::from_sample(example_datetime.as_bytes());
let sample_datetime2 = FieldType::from_sample(example_datetime2.as_bytes());
assert_eq!(FieldType::TUnicode, sample_unicode);
assert_eq!(FieldType::TInteger, sample_int);
assert_eq!(FieldType::TFloat, sample_float);
assert_eq!(FieldType::TDate, sample_date);
assert_eq!(FieldType::TDate, sample_date2);
assert_eq!(FieldType::TDate, sample_date3);
assert_eq!(FieldType::TDate, sample_date4);
assert_eq!(FieldType::TDateTime, sample_datetime);
assert_eq!(FieldType::TDateTime, sample_datetime2);
} | rust_cleaned_test_functions.jsonl/125469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 708
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
1313,
5673,
17491,
368,
341,
286,
1077,
3110,
54662,
284,
330,
13683,
16,
17,
18,
26782,
286,
1077,
3110,
4042,
284,
330,
16,
17,
18,
876,
286,
1077,
3110,
17586,
284,
330,
16,
13,
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_draw_resource_tabs_block() {
let backend = TestBackend::new(100, 7);
let mut terminal = Terminal::new(backend).unwrap();
terminal
.draw(|f| {
let size = f.size();
let mut app = App::default();
let mut pod = KubePod::default();
pod.name = "pod name test".into();
pod.namespace = "pod namespace test".into();
pod.ready = "0/2".into();
pod.status = "Failed".into();
pod.age = "6h52m".into();
app.data.pods.set_items(vec![pod]);
draw_resource_tabs_block(f, &mut app, size);
})
.unwrap();
let mut expected = Buffer::with_lines(vec![
"┌Resources─────────────────────────────────────────────────────────────────────────────────────────┐",
"│ Pods <1> │ Services <2> │ Nodes <3> │ ConfigMaps <4> │ StatefulSets <5> │ ReplicaSets <6> │ Deplo│",
"│ │",
"│Pods (ns: all) [1] | Containers <enter> | describe <d> | yaml <y>─────────────────────────────────│",
"│ Namespace Name Ready Status Restarts A │",
"│=> pod namespace test pod name test 0/2 Failed 0 6 │",
"└──────────────────────────────────────────────────────────────────────────────────────────────────┘",
]);
// set row styles
// First row heading style
for col in 0..=99 {
match col {
0 | 10..=99 => {
expected
.get_mut(col, 0)
.set_style(Style::default().fg(Color::Yellow));
}
_ => {
expected.get_mut(col, 0).set_style(
Style::default()
.fg(Color::Yellow)
.add_modifier(Modifier::BOLD),
);
}
}
}
// second row tab headings
for co ma 25..=27 | 37..=39 | 54..=56 | 73..=75 | 91..=93 | 99 => {
expected
.get_mut(col, 1)
.set_style(Style::default().fg(Color::Yellow));
}
_ => {
expected
.get_mut(col, 1)
.set_style(Style::default().fg(Color::White));
}
} | rust_cleaned_test_functions.jsonl/66711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23021,
17962,
57953,
7113,
368,
341,
262,
1077,
19163,
284,
3393,
29699,
486,
931,
7,
16,
15,
15,
11,
220,
22,
317,
262,
1077,
5206,
15022,
284,
34090,
486,
931,
7,
20942,
568,
15454,
1428,
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... | 4 |
#[test]
fn test_dec_binary()
{
let mut d = BinaryDigit(1u8);
let underflow = d.dec();
assert!(!underflow);
assert_eq!(d, BinaryDigit(0));
let mut d = BinaryDigit(0xffu8);
let underflow = d.dec();
assert!(!underflow);
assert_eq!(d, BinaryDigit(0xfe));
let mut d = BinaryDigit(0u8);
let underflow = d.dec();
assert!(underflow);
assert_eq!(d, BinaryDigit(0xff));
let mut d = BinaryDigit(0x100u16);
let underflow = d.dec();
assert!(!underflow);
assert_eq!(d, BinaryDigit(0xff));
let mut d = BinaryDigit(0u16);
let underflow = d.dec();
assert!(underflow);
assert_eq!(d, BinaryDigit(0xffff));
let mut d = BinaryDigit(0x100000u32);
let underflow = d.dec();
assert!(!underflow);
assert_eq!(d, BinaryDigit(0xfffff));
let mut d = BinaryDigit(0u32);
let underflow = d.dec();
assert!(underflow);
assert_eq!(d, BinaryDigit(0xffffffff));
} | rust_cleaned_test_functions.jsonl/26387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 547
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
31761,
741,
262,
341,
286,
1077,
5206,
294,
284,
17718,
36420,
7,
16,
84,
23,
317,
286,
1077,
1212,
4965,
284,
294,
28020,
543,
286,
2060,
0,
3471,
7995,
4965,
317,
286,
2060,
10714,
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_iterator_enumerate_fold() {
let xs = [0, 1, 2, 3, 4, 5];
let mut it = xs.iter().enumerate();
// steal a couple to get an interesting offset
assert_eq!(it.next(), Some((0, &0)));
assert_eq!(it.next(), Some((1, &1)));
let i = it.fold(2, |i, (j, &x)| {
assert_eq!(i, j);
assert_eq!(x, xs[j]);
i + 1
});
assert_eq!(i, xs.len());
let mut it = xs.iter().enumerate();
assert_eq!(it.next(), Some((0, &0)));
let i = it.rfold(xs.len() - 1, |i, (j, &x)| {
assert_eq!(i, j);
assert_eq!(x, xs[j]);
i - 1
});
assert_eq!(i, 0);
} | rust_cleaned_test_functions.jsonl/54078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
6205,
3389,
349,
61187,
368,
341,
262,
1077,
11943,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
432,
284,
11943,
19471,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_array_iter_round_trip() {
let array = BinaryArray::from(vec![
Some(b"a" as &[u8]),
None,
Some(b"aaa"),
None,
Some(b"aaaaa"),
]);
// to and from iter
let result: BinaryArray = array.iter().collect();
assert_eq!(result, array);
} | rust_cleaned_test_functions.jsonl/19274 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
3858,
11723,
29896,
63883,
368,
341,
286,
1077,
1334,
284,
17718,
1857,
486,
1499,
25592,
90515,
310,
4329,
1883,
56693,
1,
438,
44590,
84,
23,
17036,
310,
2240,
345,
310,
4329,
1883,
1,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_movegen() {
//TODO Add more tests
let mut game = Game::new();
game.create_piece(0, 0, 8);
game.set_moves();
assert_eq!(
game.square_moves[8][0..2],
[
PieceMove {
start: 8,
end: 16,
special: SpecialMove::None,
},
PieceMove {
start: 8,
end: 24,
special: SpecialMove::None,
}
][..]
)
} | rust_cleaned_test_functions.jsonl/120652 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
4370,
368,
341,
286,
442,
14732,
2691,
803,
7032,
198,
286,
1077,
5206,
1809,
284,
4050,
486,
931,
543,
286,
1809,
2520,
48470,
7,
15,
11,
220,
15,
11,
220,
23,
317,
286,
1809,
980,
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_get_device_global_uid() {
// Input device.
if let Some(input) = test_get_default_device(Scope::Input) {
let uid = get_device_global_uid(input).unwrap();
let uid = uid.into_string();
assert!(!uid.is_empty());
}
// Output device.
if let Some(output) = test_get_default_device(Scope::Output) {
let uid = get_device_global_uid(output).unwrap();
let uid = uid.into_string();
assert!(!uid.is_empty());
}
} | rust_cleaned_test_functions.jsonl/113804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9204,
19296,
25396,
368,
341,
262,
442,
5571,
3671,
624,
262,
421,
1077,
4329,
5384,
8,
284,
1273,
3062,
9993,
9204,
3759,
2417,
486,
2505,
8,
341,
286,
1077,
14617,
284,
633,
9204,
19296,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_status_service() {
let config = TiKvConfig::default();
let mut status_server = StatusServer::new(1, config);
let _ = status_server.start("127.0.0.1:0".to_string());
let client = Client::new();
let uri = Uri::builder()
.scheme("http")
.authority(status_server.listening_addr().to_string().as_str())
.path_and_query("/metrics")
.build()
.unwrap();
let handle = status_server.thread_pool.spawn_handle(lazy(move || {
client
.get(uri)
.map(|res| {
assert_eq!(res.status(), StatusCode::OK);
})
.map_err(|err| {
panic!("response status is not OK: {:?}", err);
})
}));
handle.wait().unwrap();
status_server.stop();
} | rust_cleaned_test_functions.jsonl/47230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
12267,
368,
341,
286,
1077,
2193,
284,
22325,
42,
85,
2648,
486,
2258,
543,
286,
1077,
5206,
2639,
12015,
284,
8104,
5475,
486,
931,
7,
16,
11,
2193,
317,
286,
1077,
716,
284,
2639,
1201... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_batch_discard_random() {
solana_logger::setup();
let mut batch = PacketBatch::default();
batch.resize(1, Packet::default());
let num_batches = 100;
let mut batches = vec![batch; num_batches];
let max = 5;
discard_batches_randomly(&mut batches, max, num_batches);
assert_eq!(batches.len(), max);
} | rust_cleaned_test_functions.jsonl/6923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
37745,
567,
22644,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
5206,
7162,
284,
28889,
21074,
486,
2258,
543,
286,
7162,
17382,
7,
16,
11,
28889,
486,
2258,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_truthy() {
assert_eq!(
true,
Variable::from_json(&"{\"foo\": \"bar\"}")
.unwrap()
.is_truthy()
);
assert_eq!(false, Variable::from_json(&"{}").unwrap().is_truthy());
assert_eq!(true, Variable::from_json(&"[\"foo\"]").unwrap().is_truthy());
assert_eq!(false, Variable::from_json(&"[]").unwrap().is_truthy());
assert_eq!(false, Variable::Null.is_truthy());
assert_eq!(true, Variable::Bool(true).is_truthy());
assert_eq!(false, Variable::Bool(false).is_truthy());
assert_eq!(true, Variable::String("foo".to_string()).is_truthy());
assert_eq!(false, Variable::String("".to_string()).is_truthy());
assert_eq!(
true,
Variable::Number(Number::from_f64(10.0).unwrap()).is_truthy()
);
assert_eq!(
true,
Variable::Number(Number::from_f64(0.0).unwrap()).is_truthy()
);
} | rust_cleaned_test_functions.jsonl/108380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 514
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
49186,
88,
368,
341,
286,
2060,
10714,
33673,
310,
830,
345,
310,
12407,
486,
1499,
9455,
2099,
14129,
2105,
7975,
11693,
7245,
2257,
2105,
14451,
394,
659,
15454,
741,
394,
659,
285,
49186,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_txn_store_gc3() {
let key = "k";
let store = AssertionStorage::default();
store.test_txn_store_gc3(key.as_bytes()[0]);
let (mut cluster, mut raft_store) = AssertionStorage::new_raft_storage_with_store_count(3, key);
raft_store.test_txn_store_gc3_for_cluster(&mut cluster, key.as_bytes()[0]);
} | rust_cleaned_test_functions.jsonl/63407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
49423,
18,
368,
341,
262,
1077,
1376,
284,
330,
74,
876,
262,
1077,
3553,
284,
46730,
5793,
486,
2258,
543,
262,
3553,
5958,
92299,
14809,
49423,
18,
4857,
5357,
12524,
10116,
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_build_payload_adds_the_build_url_if_provided() {
let result = TestResult::Ok;
let payload = super::build_payload(result, "1".to_string(), Some("http://build-url".to_string()));
expect!(payload).to(be_equal_to(json!({
"providerApplicationVersion": "1",
"success": true,
"buildUrl": "http://build-url"
})));
} | rust_cleaned_test_functions.jsonl/67355 | {
"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,
20801,
32813,
2891,
82,
16068,
20801,
2903,
11119,
2540,
42957,
368,
341,
262,
1077,
1102,
284,
3393,
2077,
486,
11578,
280,
262,
1077,
7729,
284,
2256,
486,
5834,
32813,
4456,
11,
330,
16,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq_member() {
let member = Member {
avatar: None,
deaf: false,
guild_id: GuildId::new(3).expect("non zero"),
joined_at: None,
mute: true,
nick: Some("member nick".to_owned()),
pending: false,
premium_since: None,
roles: Vec::new(),
user: user(),
};
assert_eq!(cached_member(), member);
} | rust_cleaned_test_functions.jsonl/100073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
19388,
368,
341,
286,
1077,
4462,
284,
12039,
341,
310,
20701,
25,
2240,
345,
310,
46742,
25,
895,
345,
310,
26411,
842,
25,
32492,
764,
486,
931,
7,
18,
568,
17119,
445,
6280,
7168,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wordinfo_with_longword() {
let lexicon = read_lexicon();
let word_info = lexicon.get_word_info(36);
assert_eq!(300, word_info.surface.chars().count());
assert_eq!(300, word_info.head_word_length);
assert_eq!(300, word_info.normalized_form.chars().count());
assert_eq!(-1, word_info.dictionary_form_word_id);
assert_eq!(300, word_info.dictionary_form.chars().count());
assert_eq!(570, word_info.reading_form.chars().count());
} | rust_cleaned_test_functions.jsonl/113036 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13533,
2733,
6615,
17799,
1158,
368,
341,
262,
1077,
22429,
1924,
284,
1349,
74547,
1924,
543,
262,
1077,
3409,
3109,
284,
22429,
1924,
670,
13533,
3109,
7,
18,
21,
317,
262,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_transactions() {
let mut transactions = Mint::new(100).create_transaction().into_iter();
let tx = transactions.next().unwrap();
assert_eq!(tx.instructions.len(), 1);
assert!(system_program::check_id(tx.program_id(0)));
let instruction: SystemInstruction = deserialize(tx.userdata(0)).unwrap();
if let SystemInstruction::Move { tokens } = instruction {
assert_eq!(tokens, 100);
}
assert_eq!(transactions.next(), None);
} | rust_cleaned_test_functions.jsonl/7365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
68182,
368,
341,
286,
1077,
5206,
14131,
284,
41310,
486,
931,
7,
16,
15,
15,
568,
3182,
28884,
1005,
18122,
11723,
543,
286,
1077,
9854,
284,
14131,
4529,
1005,
15454,
543,
286,
2060,
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... | 2 |
#[test]
fn test_serialization() {
let dt = "2018-02-11T07:09:22.765Z".parse::<DateTime<Utc>>().unwrap();
let proposal = Proposal {
msg_type: Type::Proposal,
height: Height::from(12345_u32),
round: Round::from(23456_u16),
pol_round: None,
block_id: Some(BlockId {
hash: Hash::from_hex_upper(
Algorithm::Sha256,
"DEADBEEFDEADBEEFBAFBAFBAFBAFBAFADEADBEEFDEADBEEFBAFBAFBAFBAFBAFA",
)
.unwrap(),
parts: Header {
total: 65535,
hash: Hash::from_hex_upper(
Algorithm::Sha256,
"0022446688AACCEE1133557799BBDDFF0022446688AACCEE1133557799BBDDFF",
)
.unwrap(),
},
}),
timestamp: Some(dt.into()),
signature: Signature::Ed25519(Ed25519Signature::new([0; ED25519_SIGNATURE_SIZE])),
};
let mut got = vec![];
let request = SignProposalRequest {
proposal,
chain_id: ChainId::from_str("test_chain_id").unwrap(),
};
let _have = request.to_signable_bytes(&mut got);
// the following vector is generated via:
let want = vec![
136, 1, 8, 32, 17, 57, 48, 0, 0, 0, 0, 0, 0, 25, 160, 91, 0, 0, 0, 0, 0, 0, 32, 255,
255, 255, 255, 255, 255, 255, 255, 255, 1, 42, 74, 10, 32, 222, 173, 190, 239, 222,
173, 190, 239, 186, 251, 175, 186, 251, 175, 186, 250, 222, 173, 190, 239, 222, 173,
190, 239, 186, 251, 175, 186, 251, 175, 186, 250, 18, 38, 8, 255, 255, 3, 18, 32, 0,
34, 68, 102, 136, 170, 204, 238, 17, 51, 85, 119, 153, 187, 221, 255, 0, 34, 68, 102,
136, 170, 204, 238, 17, 51, 85, 119, 153, 187, 221, 255, 50, 12, 8, 162, 216, 255, 211,
5, 16, 192, 242, 227, 236, 2, 58, 13, 116, 101, 115, 116, 95, 99, 104, 97, 105, 110,
95, 105, 100,
];
assert_eq!(got, want)
} | rust_cleaned_test_functions.jsonl/90191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
2022,
368,
341,
286,
1077,
7594,
284,
330,
17,
15,
16,
23,
12,
15,
17,
12,
16,
16,
51,
15,
22,
25,
15,
24,
25,
17,
17,
13,
22,
21,
20,
57,
3263,
6400,
27638,
7689,
36397,
10413,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_string() {
let data = "\"/home/nikita/pepe.c\"";
do_test_result!(
data,
parse_string(data),
("", String::from("/home/nikita/pepe.c"))
)
} | rust_cleaned_test_functions.jsonl/74252 | {
"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,
21039,
3904,
368,
341,
286,
1077,
821,
284,
15898,
14,
5117,
9612,
1579,
6255,
14,
375,
375,
520,
95349,
286,
653,
4452,
5287,
33673,
310,
821,
345,
310,
4715,
3904,
2592,
1326,
310,
3489,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vote_unsubscribe() {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Bank::new(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let rpc = RpcSolPubSubImpl::default_with_bank_forks(bank_forks);
let session = create_session();
let (subscriber, _id_receiver, _) = Subscriber::new_test("voteNotification");
rpc.vote_subscribe(session, subscriber);
let session = create_session();
assert!(rpc
.vote_unsubscribe(Some(session), SubscriptionId::Number(42))
.is_err());
let session = create_session();
assert!(rpc
.vote_unsubscribe(Some(session), SubscriptionId::Number(0))
.is_ok());
} | rust_cleaned_test_functions.jsonl/4708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
4907,
9384,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
6073,
284,
8547,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_untagged_newtype_variant_containing_unit_struct_not_map() {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Unit;
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
enum Message {
Unit(Unit),
Map(BTreeMap<String, String>),
}
assert_tokens(
&Message::Map(BTreeMap::new()),
&[Token::Map { len: Some(0) }, Token::MapEnd],
);
} | rust_cleaned_test_functions.jsonl/56450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3850,
96476,
5921,
1313,
46112,
10260,
2056,
14832,
15126,
7913,
5376,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
39900,
11,
48440,
5563,
262,
2036,
7954,
401,
262,
11506,
27098,
42618,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_broker_pod_owner_kind_job() {
let owner_references: Vec<OwnerReference> = vec![OwnerReference {
kind: "Job".to_string(),
controller: Some(true),
..Default::default()
}];
assert_eq!(
get_broker_pod_owner_kind(&make_pod_with_owner_references(owner_references)),
BrokerPodOwnerKind::Job
);
} | rust_cleaned_test_functions.jsonl/55236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
880,
45985,
85337,
29027,
33162,
20298,
368,
341,
286,
1077,
6372,
92702,
25,
11312,
27,
13801,
8856,
29,
284,
7486,
20703,
13801,
8856,
341,
310,
3093,
25,
330,
12245,
3263,
983,
3904,
3148... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_groupby_sort_by() {
let df = df! {
"a" => ["a", "a", "a", "b", "b", "c"],
"b" => [1, 2, 3, 4, 5, 6],
"c" => [6, 1, 4, 3, 2, 1]
}
.unwrap();
let out = df
.lazy()
.groupby(vec![col("a")])
.agg(vec![col("b").sort_by(col("c"), true).first()])
.collect()
.unwrap()
.sort("a", false)
.unwrap();
assert_eq!(
Vec::from(out.column("b_first").unwrap().i32().unwrap()),
[Some(1), Some(4), Some(6)]
);
} | rust_cleaned_test_functions.jsonl/22388 | {
"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,
49646,
6288,
1694,
18435,
3710,
368,
341,
262,
1077,
6764,
284,
6764,
0,
341,
286,
330,
64,
1,
589,
4383,
64,
497,
330,
64,
497,
330,
64,
497,
330,
65,
497,
330,
65,
497,
330,
66,
8097,
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_calls() {
test_roundtrip("f();");
test_roundtrip("f(1);");
test_roundtrip("f(1, 2);");
test_roundtrip("(f?.(1, 2))(3);");
test_roundtrip("f?.(1, 2)?.(3)(5);");
test_roundtrip("new f();");
test_roundtrip("new f(1);");
test_roundtrip("new(a.b);");
test_roundtrip("new(a.b());");
test_roundtrip("new(a.b())();");
test_roundtrip("new(a.b())(c);");
test_roundtrip("new(a?.b())(c);");
test_roundtrip("new(1 + 2);");
test_roundtrip("new(fn(foo)[bar])()");
test_roundtrip("new(fn(foo)[bar])(c)");
test_roundtrip("new(fn(foo).bar)()");
test_roundtrip("new(fn(foo).bar)(c)");
test_roundtrip("import('foo')");
} | rust_cleaned_test_functions.jsonl/102593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45636,
368,
341,
262,
1273,
29896,
32981,
445,
69,
2129,
797,
262,
1273,
29896,
32981,
445,
69,
7,
16,
1215,
797,
262,
1273,
29896,
32981,
445,
69,
7,
16,
11,
220,
17,
1215,
797,
262,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_address_book_init() {
let config = ConfigBuilder::new().with_network(Network::Signet).build();
let result = AddressBook::new(&config, make_logger());
assert!(result.is_err());
let err = result.unwrap_err();
assert!(matches!(err, AddressBookError::NoAddressesFound));
} | rust_cleaned_test_functions.jsonl/10126 | {
"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,
6744,
26421,
6137,
368,
341,
286,
1077,
2193,
284,
5532,
3297,
486,
931,
1005,
4197,
20966,
77623,
486,
7264,
295,
568,
5834,
543,
286,
1077,
1102,
284,
9177,
7134,
486,
931,
2099,
1676,
11,
128... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_runtime_config() {
println!("{:?}", runtime_config::RUNTIME_CONFIG.api_endpoints);
println!("{:?}", runtime_config::RUNTIME_CONFIG.internal_endpoints);
println!("{:?}", runtime_config::RUNTIME_CONFIG.audit);
println!("{:?}", runtime_config::RUNTIME_CONFIG.env);
} | rust_cleaned_test_functions.jsonl/60217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33232,
5332,
368,
341,
286,
13751,
88928,
25,
52652,
15592,
5332,
486,
47390,
18129,
12568,
6183,
6213,
7706,
317,
286,
13751,
88928,
25,
52652,
15592,
5332,
486,
47390,
18129,
12568,
18264,
6213,
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_map_changed() {
let method = method(
("Windows.Foundation.Collections", "IObservableMap`2"),
"map_changed",
);
assert!(method.kind == MethodKind::Add);
assert!(method.params.len() == 1);
let handler = &method.params[0];
assert!(handler.array == false);
assert!(handler.input == true);
assert!(handler.by_ref == false);
let handler = match &handler.kind {
TypeKind::Delegate(delegate) => delegate,
_ => panic!("Wrong type"),
};
assert!(
handler.runtime_name()
== "Windows.Foundation.Collections.MapChangedEventHandler`2<K, V>"
);
let token = method.return_type.as_ref().unwrap();
assert!(token.array == false);
assert!(token.input == false);
assert!(token.by_ref == true);
let token = match &token.kind {
TypeKind::Struct(token) => token,
_ => panic!("Wrong type"),
};
assert!(token.runtime_name() == "Windows.Foundation.EventRegistrationToken");
} | rust_cleaned_test_functions.jsonl/21659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
25213,
368,
341,
286,
1077,
1714,
284,
1714,
1006,
310,
3489,
13164,
75737,
3572,
497,
330,
3810,
8293,
2227,
63,
17,
4461,
310,
330,
2186,
25213,
756,
286,
3475,
286,
2060,
10297,
4393,
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... | 3 |
#[test]
fn test_edges_directed() {
let g: MatrixGraph<char, bool> = MatrixGraph::from_edges(&[
(0, 5),
(0, 2),
(0, 3),
(0, 1),
(1, 3),
(2, 3),
(2, 4),
(4, 0),
(6, 6),
]);
assert_eq!(g.edges_directed(node_index(0), Outgoing).count(), 4);
assert_eq!(g.edges_directed(node_index(1), Outgoing).count(), 1);
assert_eq!(g.edges_directed(node_index(2), Outgoing).count(), 2);
assert_eq!(g.edges_directed(node_index(3), Outgoing).count(), 0);
assert_eq!(g.edges_directed(node_index(4), Outgoing).count(), 1);
assert_eq!(g.edges_directed(node_index(5), Outgoing).count(), 0);
assert_eq!(g.edges_directed(node_index(6), Outgoing).count(), 1);
assert_eq!(g.edges_directed(node_index(0), Incoming).count(), 1);
assert_eq!(g.edges_directed(node_index(1), Incoming).count(), 1);
assert_eq!(g.edges_directed(node_index(2), Incoming).count(), 1);
assert_eq!(g.edges_directed(node_index(3), Incoming).count(), 3);
assert_eq!(g.edges_directed(node_index(4), Incoming).count(), 1);
assert_eq!(g.edges_directed(node_index(5), Incoming).count(), 1);
assert_eq!(g.edges_directed(node_index(6), Incoming).count(), 1);
} | rust_cleaned_test_functions.jsonl/81969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 678
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28026,
32871,
291,
368,
341,
286,
1077,
342,
25,
11631,
11212,
21919,
11,
1807,
29,
284,
11631,
11212,
486,
1499,
28026,
2099,
9640,
310,
320,
15,
11,
220,
20,
1326,
310,
320,
15,
11,
220,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map() {
let mut m = HashMap::new();
m.insert(4u64, "foo".to_string());
m.insert(0u64, "bar".to_string());
the_same(m);
} | rust_cleaned_test_functions.jsonl/6264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
368,
341,
262,
1077,
5206,
296,
284,
10528,
486,
931,
543,
262,
296,
7030,
7,
19,
84,
21,
19,
11,
330,
7975,
3263,
983,
3904,
1423,
262,
296,
7030,
7,
15,
84,
21,
19,
11,
330,
2257,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_min_max() {
let min = |x: Weibull| x.min();
let max = |x: Weibull| x.max();
test_case(1.0, 1.0, 0.0, min);
test_case(1.0, 1.0, f64::INFINITY, max);
} | rust_cleaned_test_functions.jsonl/122501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
6345,
368,
341,
286,
1077,
1308,
284,
760,
87,
25,
1205,
579,
617,
91,
856,
4358,
543,
286,
1077,
1932,
284,
760,
87,
25,
1205,
579,
617,
91,
856,
6678,
543,
286,
1273,
19096,
7,
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_bind() {
let mut cx = Context::new();
let id = ViewId::default();
cx.init_state(id, &MyState::default);
let s = State::new(id);
let b = bind(s, MyLens {});
*b.get_mut(&mut cx) = 42;
assert_eq!(*b.get(&mut cx), 42);
} | rust_cleaned_test_functions.jsonl/100081 | {
"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,
27461,
368,
341,
286,
1077,
5206,
20716,
284,
9608,
486,
931,
543,
286,
1077,
877,
284,
2738,
764,
486,
2258,
543,
286,
20716,
8271,
4387,
3724,
11,
609,
5050,
1397,
486,
2258,
317,
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_f32x4_debug() {
let a = F32x4::new(48.0, -4.0, 200.0, 7.0);
assert_eq!("<48, -4, 200, 7>", format!("{:?}", a));
} | rust_cleaned_test_functions.jsonl/66190 | {
"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,
761,
18,
17,
87,
19,
15446,
368,
341,
262,
1077,
264,
284,
434,
18,
17,
87,
19,
486,
931,
7,
19,
23,
13,
15,
11,
481,
19,
13,
15,
11,
220,
17,
15,
15,
13,
15,
11,
220,
22,
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_limits_no_panic() {
let s = schema(&[
("a", DataType::Int64),
("b", DataType::Int64),
("c", DataType::Int64),
("d", DataType::Int64),
("e", DataType::Int64),
]);
let extract = |sql| PartitionFilter::extract(&s, &[parse(sql, &s)]);
let filter = extract(
"a IN (1,2,3,4,5,6,7,8,9) \
AND b = 1 \
AND c = 1 \
AND d IN (1,2,3,4,5,6,7) \
AND e IN (1, 2)",
);
assert_ne!(filter.min_max.len(), 0);
assert!(filter.can_match(
Some(&vec![TableValue::Int(1); 5]),
Some(&vec![TableValue::Int(1); 5])
));
let max_row = &[9, 1, 1, 7, 2];
assert!(filter.can_match(Some(&vals(max_row)), Some(&vals(max_row))));
// Check we keep information about min and max values for each field.
for i in 0..s.fields().len() {
let mut row_before = vec![1; 5];
row_before[i] -= 1;
assert!(
!filter.can_match(Some(&vals(&row_before)), Some(&vals(&row_before))),
"must not match {:?}",
row_before
);
let mut row_after = max_row.to_vec();
row_after[i] += 1;
assert!(
!filter.can_match(Some(&vals(&row_after)), Some(&vals(&row_after))),
"must not match {:?}",
row_after
);
}
fn vals(is: &[i64]) -> Vec<TableValue> {
is.iter().map(|i| TableValue::Int(*i)).collect()
}
} | rust_cleaned_test_functions.jsonl/65541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 941
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31820,
6536,
620,
31270,
368,
341,
286,
1077,
274,
284,
10802,
2099,
9640,
310,
3489,
64,
497,
33172,
486,
1072,
21,
19,
1326,
310,
3489,
65,
497,
33172,
486,
1072,
21,
19,
1326,
310,
3489,
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_movss_store() {
assert_emit!(0xf3, 0x0f, 0x11, 0x40, 1; movss_store(Mem::Base(RAX, 1), XMM0));
assert_emit!(0xf2, 0x44, 0x0f, 0x11, 0x78, 1; movsd_store(Mem::Base(RAX, 1), XMM15));
} | rust_cleaned_test_functions.jsonl/85506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55798,
778,
14809,
368,
341,
286,
2060,
69082,
10297,
15,
5848,
18,
11,
220,
15,
87,
15,
69,
11,
220,
15,
87,
16,
16,
11,
220,
15,
87,
19,
15,
11,
220,
16,
26,
1974,
778,
14809,
3189,
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_chrono_utc_value() {
let timestamp =
DateTime::<Utc>::from_utc(NaiveDate::from_ymd(2022, 1, 2).and_hms(3, 4, 5), Utc);
let value: Value = timestamp.into();
let out: DateTime<Utc> = value.unwrap();
assert_eq!(out, timestamp);
} | rust_cleaned_test_functions.jsonl/12486 | {
"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,
4138,
2248,
78,
84259,
3142,
368,
341,
286,
1077,
11441,
4035,
310,
6520,
27638,
97768,
6831,
1499,
84259,
8204,
64,
533,
1916,
486,
1499,
62,
1600,
67,
7,
17,
15,
17,
17,
11,
220,
16,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unlink() {
const TMPDIR_POSTFIX: &str = "wslcmd-unlink";
// init tmpdir
let tmpdir = init_tmpdir(TMPDIR_POSTFIX).expect("Tmp dir initialize");
let (bin1, _) = copy_tmpbin(&tmpdir, None).expect("Bin initialize");
// test linking only
let mut wslcmd_list = WslCmdList::new(&bin1).expect("New WslCmdList");
unit_test_mod(&tmpdir, &mut wslcmd_list, "test", false, TestKind::Link)
.expect("Unlink test prepare");
unit_test_mod(&tmpdir, &mut wslcmd_list, "test", false, TestKind::Unlink)
.expect("Test unlink");
// clean tmpdir
clean_tmpdir(TMPDIR_POSTFIX);
} | rust_cleaned_test_functions.jsonl/34191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
2080,
368,
341,
286,
733,
66253,
12251,
20506,
39690,
25,
609,
495,
284,
330,
86,
3226,
8710,
19892,
2080,
3302,
286,
442,
2930,
4174,
3741,
198,
286,
1077,
4174,
3741,
284,
2930,
16125,
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_prop_success() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("jj")?;
let assert = cmd.arg("_.x.y").write_stdin(r#"{"x":{"y":42}}"#).assert();
assert.success().stdout("42\n").stderr("");
Ok(())
} | rust_cleaned_test_functions.jsonl/43233 | {
"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,
21663,
18632,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
5206,
5439,
284,
7348,
486,
66715,
21816,
445,
38811,
899,
37445,
262,
1077,
2060,
284,
5439,
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... | 2 |
#[test]
fn test_ecdsa_adaptor_signature_wrong_proof() {
let msg = msg_from_str("8131e6f4b45754f2c90bd06688ceeabc0c45055460729928b4eecf11026a9e2d");
let pubkey = "035be5e9478209674a96e60f1f037f6176540fd001fa1d64694770c56a7709c42c"
.parse()
.unwrap();
let encryption_key = "0214ccb756249ad6e733c80285ea7ac2ee12ffebbcee4e556e6810793a60c45ad4"
.parse()
.unwrap();
let adaptor_sig: EcdsaAdaptorSignature = "03f94dca206d7582c015fb9bffe4e43b14591b30ef7d2b464d103ec5e116595dba03127f8ac3533d249280332474339000922eb6a58e3b9bf4fc7e01e4b4df2b7a4100a1e089f16e5d70bb89f961516f1de0684cc79db978495df2f399b0d01ed7240fa6e3252aedb58bdc6b5877b0c602628a235dd1ccaebdddcbe96198c0c21bead7b05f423b673d14d206fa1507b2dbe2722af792b8c266fc25a2d901d7e2c335"
.parse()
.unwrap();
adaptor_sig
.verify(&SECP256K1, &msg, &pubkey, &encryption_key)
.expect_err("providing a wrong proof should fail validation");
} | rust_cleaned_test_functions.jsonl/62235 | {
"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,
36844,
96780,
10027,
32657,
39859,
75198,
86757,
368,
341,
286,
1077,
3750,
284,
3750,
5673,
2895,
445,
23,
16,
18,
16,
68,
21,
69,
19,
65,
19,
20,
22,
20,
19,
69,
17,
66,
24,
15,
8940,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.