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_vec3mask_any() {
assert_eq!(Vec3Mask::new(false, false, false).any(), false);
assert_eq!(Vec3Mask::new(true, false, false).any(), true);
assert_eq!(Vec3Mask::new(false, true, false).any(), true);
assert_eq!(Vec3Mask::new(false, false, true).any(), true);
} | rust_cleaned_test_functions.jsonl/48595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
11258,
37248,
368,
341,
262,
2060,
10714,
10297,
10050,
18,
12686,
486,
931,
3576,
11,
895,
11,
895,
568,
3767,
1507,
895,
317,
262,
2060,
10714,
10297,
10050,
18,
12686,
486,
931,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_all_at_start() {
let text = b"dhjalkjwqnnnannanaflkjdklfj";
let pattern = b"dhjalk";
let bndm = BNDM::new(pattern);
assert_eq!(bndm.find_all(text).collect_vec(), [0]);
} | rust_cleaned_test_functions.jsonl/37845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
3752,
4906,
368,
341,
286,
1077,
1467,
284,
293,
1,
30621,
73,
1692,
73,
86,
80,
7370,
77,
1020,
3362,
1489,
74,
88851,
11008,
73,
876,
286,
1077,
5383,
284,
293,
1,
30621,
73,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_slices() {
let mut ring: RingBuf<int> = RingBuf::with_capacity(127);
let cap = ring.capacity() as int;
let first = cap/2;
let last = cap - first;
for i in range(0, first) {
ring.push_back(i);
let (left, right) = ring.as_slices();
let expected: Vec<_> = range(0, i+1).collect();
assert_eq!(left, expected);
assert_eq!(right, []);
}
for j in range(-last, 0) {
ring.push_front(j);
let (left, right) = ring.as_slices();
let expected_left: Vec<_> = range(-last, j+1).rev().collect();
let expected_right: Vec<_> = range(0, first).collect();
assert_eq!(left, expected_left);
assert_eq!(right, expected_right);
}
assert_eq!(ring.len() as int, cap);
assert_eq!(ring.capacity() as int, cap);
} | rust_cleaned_test_functions.jsonl/39516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
87288,
368,
341,
286,
1077,
5206,
10058,
25,
21525,
15064,
4159,
29,
284,
21525,
15064,
486,
4197,
35603,
7,
16,
17,
22,
317,
286,
1077,
2062,
284,
10058,
59168,
368,
438,
526,
280,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_vcx_credential_create_with_offer_success() {
settings::set_defaults();
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE,"true");
let cb = return_types_u32::Return_U32_U32::new().unwrap();
assert_eq!(vcx_credential_create_with_offer(cb.command_handle,
CString::new("test_create").unwrap().into_raw(),
CString::new(::utils::constants::CREDENTIAL_OFFER_JSON).unwrap().into_raw(),
Some(cb.get_callback())), error::SUCCESS.code_num);
assert!(cb.receive(Some(Duration::from_secs(10))).unwrap() > 0);
} | rust_cleaned_test_functions.jsonl/58632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
666,
30320,
8657,
6615,
67814,
18632,
368,
341,
286,
5003,
486,
746,
42290,
543,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
1335,
1866,
797,
286,
1077,
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_scanning() {
let ctx = TestContext::new();
let mut con = ctx.connection();
let mut unseen = HashSet::new();
for x in 0..1000 {
redis::cmd("SADD").arg("foo").arg(x).execute(&mut con);
unseen.insert(x);
}
let iter = redis::cmd("SSCAN")
.arg("foo")
.cursor_arg(0)
.clone()
.iter(&mut con)
.unwrap();
for x in iter {
// type inference limitations
let x: usize = x;
unseen.remove(&x);
}
assert_eq!(unseen.len(), 0);
} | rust_cleaned_test_functions.jsonl/108949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
5947,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
543,
262,
1077,
5206,
63133,
284,
18931,
486,
931,
1428,
262,
369,
856,
304,
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_is_locked_out_last_vote_expired() {
let mut locktower = Locktower::new(EpochStakes::new_for_tests(2), 0, 0.67);
let descendants = vec![(0, vec![1, 4].into_iter().collect()), (1, HashSet::new())]
.into_iter()
.collect();
locktower.record_vote(0);
locktower.record_vote(1);
assert!(!locktower.is_locked_out(4, &descendants));
locktower.record_vote(4);
assert_eq!(locktower.lockouts.votes[0].slot, 0);
assert_eq!(locktower.lockouts.votes[0].confirmation_count, 2);
assert_eq!(locktower.lockouts.votes[1].slot, 4);
assert_eq!(locktower.lockouts.votes[1].confirmation_count, 1);
} | rust_cleaned_test_functions.jsonl/25570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
60271,
6068,
12195,
54360,
80221,
368,
341,
286,
1077,
5206,
5296,
77578,
284,
15701,
77578,
486,
931,
10722,
79,
4953,
623,
2050,
486,
931,
5478,
32509,
7,
17,
701,
220,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reader_small_input() {
let mut mgr = bookmark_manager();
let str = "a.b^c! #𤭢界んにち𤭢#𤭢";
let mut reader = Reader::new(str.as_bytes(), DecoderUTF8());
let mut result = String::from("");
while let Ok(char) = reader.next_char(&mut mgr) {
result.push(char);
}
assert_eq!(&result, str);
} | rust_cleaned_test_functions.jsonl/17188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22306,
31966,
5898,
368,
341,
286,
1077,
5206,
57897,
284,
35149,
12144,
543,
286,
1077,
607,
284,
330,
64,
948,
61,
66,
0,
671,
101877,
255,
95,
97120,
24791,
19655,
42414,
101877,
255,
95,
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_parse_single() {
let range = LineRange::from("40").expect("Shouldn't fail on test!");
assert_eq!(40, range.lower);
assert_eq!(40, range.upper);
} | rust_cleaned_test_functions.jsonl/35926 | {
"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,
21039,
19487,
368,
341,
262,
1077,
2088,
284,
7083,
6046,
486,
1499,
445,
19,
15,
1827,
17119,
445,
14996,
77,
944,
3690,
389,
1273,
11142,
262,
2060,
10714,
10297,
19,
15,
11,
2088,
18073,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_resume() {
let f = Resume::builder(0, Frame::FLAG_RESUME)
.set_last_received_server_position(123)
.set_first_available_client_position(22)
.set_token(Bytes::from("this is a token"))
.build();
try_codec(f);
} | rust_cleaned_test_functions.jsonl/41420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58132,
368,
341,
262,
1077,
282,
284,
33398,
486,
17850,
7,
15,
11,
16321,
486,
22542,
10983,
33893,
340,
286,
659,
746,
12195,
40783,
12015,
9661,
7,
16,
17,
18,
340,
286,
659,
746,
12978,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_found_version() {
let config = FrumConfig {
base_dir: Some(tempdir().unwrap().path().to_path_buf()),
frum_path: Some(std::env::temp_dir().join(format!(
"frum_{}_{}",
std::process::id(),
chrono::Utc::now().timestamp_millis(),
))),
..FrumConfig::default()
};
let result = Local {
version: Some(InputVersion::Full(Version::Semver(
semver::Version::parse("2.6.4").unwrap(),
))),
}
.apply(&config);
assert!(matches!(result, Err(FrumError::VersionNotFound { .. })));
} | rust_cleaned_test_functions.jsonl/18006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
21480,
9438,
368,
341,
286,
1077,
2193,
284,
2869,
372,
2648,
341,
310,
2331,
4334,
25,
4329,
9758,
3741,
1005,
15454,
1005,
2343,
1005,
983,
2638,
10363,
14702,
310,
1422,
372,
2638,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_coordinate_to_grid() {
let coord = Coordinate(100.0, 100.0);
let grid = coordinate_to_grid(coord);
assert!(grid.0 == GridDimension(3) && grid.1 == GridDimension(3));
} | rust_cleaned_test_functions.jsonl/81056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68649,
2346,
15604,
368,
341,
286,
1077,
16489,
284,
41035,
7,
16,
15,
15,
13,
15,
11,
220,
16,
15,
15,
13,
15,
317,
286,
1077,
5827,
284,
16184,
2346,
15604,
65037,
317,
286,
2060,
10297,
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... | 2 |
#[test]
fn test_absolute_offset_am() {
let mut cpu = setup(0x00, true, 0x3D, Some(0x0210));
*cpu.regset_mut().y_index_mut() = 0xA;
cpu.writ_byte(0x0210 + 0xA, 0x10);
let result = absolute_y_am(&mut cpu);
assert_eq!(
result.ok(),
Some(Fetched {
value: 0x10,
address: 0x210 + 0xA,
})
);
} | rust_cleaned_test_functions.jsonl/26578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50874,
6917,
22880,
368,
341,
286,
1077,
5206,
17319,
284,
6505,
7,
15,
87,
15,
15,
11,
830,
11,
220,
15,
87,
18,
35,
11,
4329,
7,
15,
87,
15,
17,
16,
15,
1106,
286,
353,
16475,
7031,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_get_fee_calculator_for_blockhash() {
let rpc = RpcHandler::start();
let bank = rpc.working_bank();
let recent_blockhash = bank.confirmed_last_blockhash();
let RpcHandler { meta, io, .. } = rpc;
let lamports_per_signature = bank.get_lamports_per_signature();
let fee_calculator = RpcFeeCalculator {
fee_calculator: FeeCalculator::new(lamports_per_signature),
};
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getFeeCalculatorForBlockhash","params":["{:?}"]}}"#,
recent_blockhash
);
let res = io.handle_request_sync(&req, meta.clone());
let expected = json!({
"jsonrpc": "2.0",
"result": {
"context":{"slot":0},
"value":fee_calculator,
},
"id": 1
});
let expected: Response =
serde_json::from_value(expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(result, expected);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getFeeCalculatorForBlockhash","params":["{:?}"]}}"#,
Hash::default()
);
let res = io.handle_request_sync(&req, meta);
let expected = json!({
"jsonrpc": "2.0",
"result": {
"context":{"slot":0},
"value":Value::Null,
},
"id": 1
});
let expected: Response =
serde_json::from_value(expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/6314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 953
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
34305,
24005,
20022,
5478,
7113,
8296,
368,
341,
286,
1077,
35596,
284,
79961,
3050,
486,
2468,
543,
286,
1077,
6073,
284,
35596,
18282,
287,
35733,
543,
286,
1077,
3213,
7113,
8296,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_timeout_cancel() {
System::run(|| {
let _addr = MyActor { op: Op::Cancel }.start();
actix_rt::spawn(async move {
delay_for(Duration::new(0, 1000)).await;
System::current().stop();
});
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/94376 | {
"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,
2891,
20537,
28895,
368,
341,
262,
739,
486,
6108,
79453,
341,
286,
1077,
716,
6214,
284,
3017,
18870,
314,
1179,
25,
10672,
486,
9269,
16908,
2468,
1428,
286,
1160,
941,
40169,
486,
46087,
18285,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_timed_faster() {
let spec = "output o1: Bool @20Hz := false\noutput o2: Bool @10Hz:= o1";
assert_eq!(0, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29087,
291,
761,
2300,
368,
341,
286,
1077,
1398,
284,
330,
3006,
297,
16,
25,
12608,
569,
17,
15,
11475,
1669,
895,
1699,
3006,
297,
17,
25,
12608,
569,
16,
15,
11475,
14209,
297,
16,
876,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_module_dunder_all() {
let gil = Python::acquire_gil();
let py = gil.python();
let module = pyo3::wrap_pymodule!(foobar_module)(py);
py_assert!(py, module, "module.__all__ == ['foobar']");
} | rust_cleaned_test_functions.jsonl/22687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
814,
7995,
5705,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
543,
262,
1077,
4688,
284,
4510,
78,
18,
486,
10097,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_palindrome() {
let mut list1 = LinkedList::<i32>::new();
list1.append(1);
list1.append(2);
list1.append(3);
list1.append(2);
list1.append(1);
assert_eq!(list1.is_palindrome(), true);
let mut list2 = LinkedList::<i32>::new();
list2.append(1);
list2.append(2);
list2.append(3);
list2.append(2);
list2.append(1);
list2.append(1);
assert_eq!(list2.is_palindrome(), false);
let mut list3 = LinkedList::<i32>::new();
list3.append(1);
list3.append(2);
list3.append(2);
list3.append(1);
assert_eq!(list3.is_palindrome(), true);
let mut list4 = LinkedList::<i32>::new();
list4.append(1);
list4.append(1);
list4.append(2);
list4.append(2);
assert_eq!(list4.is_palindrome(), false);
} | rust_cleaned_test_functions.jsonl/73469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
73310,
36058,
368,
341,
286,
1077,
5206,
1140,
16,
284,
22917,
27638,
72,
18,
17,
6831,
931,
543,
286,
1140,
16,
2057,
7,
16,
317,
286,
1140,
16,
2057,
7,
17,
317,
286,
1140,
16,
2057,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_parameter_ref() -> Result<()> {
let file = VMWARE_SPEC;
let spec = &Spec::read_files(&[&file])?;
spec.resolve_parameter_ref(
&file,
Reference::parse("../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter").unwrap(),
)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/45099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
24899,
7793,
368,
1464,
5714,
71698,
341,
262,
1077,
1034,
284,
17792,
7663,
36436,
280,
262,
1077,
1398,
284,
609,
8327,
486,
878,
10931,
2099,
58,
5,
1192,
2467,
37445,
262,
1398,
14691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_check_len() {
let bytes = [0u8];
// zero byte buffer
assert_eq!(Err(Error::Truncated),
Ipv6Option::new_unchecked(&bytes[..0]).check_len());
// pad1
assert_eq!(Ok(()),
Ipv6Option::new_unchecked(&IPV6OPTION_BYTES_PAD1).check_len());
// padn with truncated data
assert_eq!(Err(Error::Truncated),
Ipv6Option::new_unchecked(&IPV6OPTION_BYTES_PADN[..2]).check_len());
// padn
assert_eq!(Ok(()),
Ipv6Option::new_unchecked(&IPV6OPTION_BYTES_PADN).check_len());
// unknown option type with truncated data
assert_eq!(Err(Error::Truncated),
Ipv6Option::new_unchecked(&IPV6OPTION_BYTES_UNKNOWN[..4]).check_len());
assert_eq!(Err(Error::Truncated),
Ipv6Option::new_unchecked(&IPV6OPTION_BYTES_UNKNOWN[..1]).check_len());
// unknown type
assert_eq!(Ok(()),
Ipv6Option::new_unchecked(&IPV6OPTION_BYTES_UNKNOWN).check_len());
} | rust_cleaned_test_functions.jsonl/130718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 588
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
6043,
368,
341,
286,
1077,
5820,
284,
508,
15,
84,
23,
935,
286,
442,
7168,
4922,
4147,
198,
286,
2060,
10714,
10297,
7747,
37396,
486,
1282,
38007,
1326,
4293,
358,
30168,
21,
5341,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_err() {
// the length byte is too short
let bytes = [2, 1];
assert_eq!(
Options::<_, DummyOptionImpl>::parse(&bytes[..]).unwrap_err(),
OptionParseErr::Internal
);
// explicitly testing since this was a bug in the Linux kernel:
let bytes = [2, 0];
assert_eq!(
Options::<_, DummyOptionImpl>::parse(&bytes[..]).unwrap_err(),
OptionParseErr::Internal
);
// the length byte is too long
let bytes = [2, 3];
assert_eq!(
Options::<_, DummyOptionImpl>::parse(&bytes[..]).unwrap_err(),
OptionParseErr::Internal
);
let bytes = [2, 2];
assert_eq!(
Options::<_, AlwaysErrOptionImpl>::parse(&bytes[..]).unwrap_err(),
OptionParseErr::External(())
);
} | rust_cleaned_test_functions.jsonl/15736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9266,
368,
341,
310,
442,
279,
3084,
4922,
374,
2238,
2805,
198,
310,
1077,
5820,
284,
508,
17,
11,
220,
16,
935,
310,
2060,
10714,
33673,
394,
14566,
27638,
6878,
50567,
5341,
9673,
6831... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slicebox_serialize() {
let slice = [1u32, 2, 3, 4, 5];
let serialized = serialize(&Cow::Borrowed(&slice[..])).unwrap();
println!("{:?}", serialized);
let deserialized: Cow<'static, Vec<u32>> = deserialize_from(&mut &serialized[..]).unwrap();
{
let sb: &[u32] = &deserialized;
assert!(slice == sb);
}
let vecx: Vec<u32> = deserialized.into_owned();
assert!(slice == &vecx[..]);
} | rust_cleaned_test_functions.jsonl/6272 | {
"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,
26488,
2011,
88686,
368,
341,
262,
1077,
15983,
284,
508,
16,
84,
18,
17,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
32916,
284,
24235,
2099,
89915,
486,
33,
7768,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_chain_size_hint() {
struct Iter {
is_empty: bool,
}
impl Iterator for Iter {
type Item = ();
fn next(&mut self) -> Option<Self::Item> {
if self.is_empty {
self.is_empty = false;
None
} else {
self.is_empty = true;
Some(())
}
}
fn size_hint(&self) -> (usize, Option<usize>) {
if self.is_empty { (0, Some(0)) } else { (1, Some(1)) }
}
}
impl DoubleEndedIterator for Iter {
fn next_back(&mut self) -> Option<Self::Item> {
self.next()
}
}
// the size hint of the left iterator
let mut iter = Iter { is_empty: true }.chain(once(()));
assert_eq!(iter.next(), Some(()));
assert_eq!(iter.size_hint(), (0, Some(0)));
let mut iter = once(()).chain(Iter { is_empty: true });
assert_eq!(iter.next_back(), Some(()));
assert_eq!(iter.size_hint(), (0, Some(0)));
} | rust_cleaned_test_functions.jsonl/70136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 545
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
30583,
2368,
45825,
368,
341,
262,
2036,
13704,
341,
286,
374,
15124,
25,
1807,
345,
262,
555,
262,
11605,
23023,
369,
13704,
341,
286,
943,
5739,
284,
25162,
1789,
286,
5168,
1790,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_used_in_match_expr() {
check_assist(
inline_local_varialbe,
"
fn foo() {
let a<|> = 1 > 0;
match a {}
}",
"
fn foo() {
<|>match 1 > 0 {}
}",
);
} | rust_cleaned_test_functions.jsonl/128657 | {
"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,
27803,
1243,
10708,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
4612,
530,
1371,
345,
310,
6228,
8822,
15229,
368,
341,
262,
1077,
264,
27,
91,
29,
284,
220,
16,
861,
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_call_hierarchy_in_same_fn() {
check_hierarchy(
r#"
//- /lib.rs
fn callee() {}
fn caller() {
call$0ee();
callee();
}
"#,
expect![["callee Function FileId(0) 0..14 3..9"]],
expect![["caller Function FileId(0) 15..58 18..24 : [33..39, 47..53]"]],
expect![[]],
);
} | rust_cleaned_test_functions.jsonl/38286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
95043,
1243,
33574,
15246,
368,
341,
286,
1779,
95043,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
8822,
94800,
368,
5613,
8822,
19865,
368,
341,
262,
1618,
3,
15,
2127,
543,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jubjub_bn256() {
let params = JubjubBn256::new();
tests::test_suite::<Bn256>(¶ms);
} | rust_cleaned_test_functions.jsonl/112609 | {
"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,
5374,
392,
73,
392,
58112,
17,
20,
21,
368,
341,
262,
1077,
3628,
284,
79280,
73,
392,
33,
77,
17,
20,
21,
486,
931,
543,
262,
7032,
486,
1944,
57239,
27638,
33,
77,
17,
20,
21,
44784,
351... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_doc_to_opstamp_mapping_complex() {
{
let doc_to_opstamp_mapping = DocToOpstampMapping::from(&[][..]);
assert_eq!(doc_to_opstamp_mapping.compute_doc_limit(0u64), 0);
assert_eq!(doc_to_opstamp_mapping.compute_doc_limit(2u64), 0);
}
{
let doc_to_opstamp_mapping = DocToOpstampMapping::from(&[1u64][..]);
assert_eq!(doc_to_opstamp_mapping.compute_doc_limit(0u64), 0);
assert_eq!(doc_to_opstamp_mapping.compute_doc_limit(2u64), 1);
}
{
let doc_to_opstamp_mapping =
DocToOpstampMapping::from(&[1u64, 12u64, 17u64, 23u64][..]);
assert_eq!(doc_to_opstamp_mapping.compute_doc_limit(0u64), 0);
for i in 2u64..13u64 {
assert_eq!(doc_to_opstamp_mapping.compute_doc_limit(i), 1);
}
for i in 13u64..18u64 {
assert_eq!(doc_to_opstamp_mapping.compute_doc_limit(i), 2);
}
for i in 18u64..24u64 {
assert_eq!(doc_to_opstamp_mapping.compute_doc_limit(i), 3);
}
for i in 24u64..30u64 {
assert_eq!(doc_to_opstamp_mapping.compute_doc_limit(i), 4);
}
}
} | rust_cleaned_test_functions.jsonl/51358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 756
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
2346,
10287,
49113,
26930,
41522,
368,
341,
286,
341,
310,
1077,
4629,
2346,
10287,
49113,
26930,
284,
21709,
1249,
7125,
49113,
6807,
486,
1499,
2099,
63449,
496,
2558,
310,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_lohit() {
run_test(
&TEST_DATA,
"harfbuzz/good-lohit.bn",
"bengali/Lohit-Bengali.ttf",
&[JOINER_GLYPH_INDEX],
23,
);
} | rust_cleaned_test_functions.jsonl/91149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5560,
22492,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
12982,
10798,
8889,
4846,
1386,
26480,
22492,
60862,
756,
503,
330,
65,
826,
7956,
7434,
2267,
275,
7671,
826,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_update_return_weight_transition() {
let destinations = vec![1, 2, 3, 4, 4, 4, 5, 6, 100];
let mut transitions = (0..destinations.len())
.map(|_| 1.0)
.collect::<Vec<WeightT>>();
update_return_weight_transition(&mut transitions, &destinations, 6, 2, 2.0, true);
assert_eq!(
transitions,
vec![1.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 1.0]
)
} | rust_cleaned_test_functions.jsonl/131099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
12511,
15876,
53593,
368,
341,
286,
1077,
33105,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
19,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
16,
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... | 1 |
#[test]
fn test_behavior_withdrawal_then_redelegate_with_less_than_minimum_stake_delegation() {
let rent = Rent::default();
let rent_exempt_reserve = rent.minimum_balance(std::mem::size_of::<StakeState>());
let stake_pubkey = Pubkey::new_unique();
let signers = HashSet::from([stake_pubkey]);
let stake_account = AccountSharedData::new_ref(
rent_exempt_reserve + MINIMUM_STAKE_DELEGATION,
std::mem::size_of::<StakeState>(),
&id(),
);
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
stake_keyed_account
.initialize(&Authorized::auto(&stake_pubkey), &Lockup::default(), &rent)
.unwrap();
let vote_pubkey = Pubkey::new_unique();
let vote_account = RefCell::new(vote_state::create_account(
&vote_pubkey,
&Pubkey::new_unique(),
0,
100,
));
let vote_keyed_account = KeyedAccount::new(&vote_pubkey, false, &vote_account);
let mut clock = Clock::default();
stake_keyed_account
.delegate(
&vote_keyed_account,
&clock,
&StakeHistory::default(),
&Config::default(),
&signers,
)
.unwrap();
clock.epoch += 1;
stake_keyed_account.deactivate(&clock, &signers).unwrap();
clock.epoch += 1;
let withdraw_amount = stake_keyed_account.lamports().unwrap()
- (rent_exempt_reserve + MINIMUM_STAKE_DELEGATION - 1);
let withdraw_pubkey = Pubkey::new_unique();
let withdraw_account =
AccountSharedData::new_ref(rent_exempt_reserve, 0, &system_program::id());
let withdraw_keyed_account = KeyedAccount::new(&withdraw_pubkey, false, &withdraw_account);
stake_keyed_account
.withdraw(
withdraw_amount,
&withdraw_keyed_account,
&clock,
&StakeHistory::default(),
&stake_keyed_account,
None,
)
.unwrap();
assert!(stake_keyed_account
.delegate(
&vote_keyed_account,
&clock,
&StakeHistory::default(),
&Config::default(),
&signers,
)
.is_ok());
} | rust_cleaned_test_functions.jsonl/87044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74540,
6615,
7633,
278,
68367,
1288,
28227,
6615,
50747,
51613,
84855,
1261,
726,
2259,
87566,
368,
341,
286,
1077,
8016,
284,
29737,
486,
2258,
543,
286,
1077,
8016,
95736,
89591,
284,
8016,
57790,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_connect_with_srtp_ctx() {
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let addr = listener.local_addr().unwrap();
let guard = thread::spawn(move || {
let stream = listener.accept().unwrap().0;
let mut ctx = SslContext::builder(SslMethod::dtls()).unwrap();
ctx.set_tlsext_use_srtp("SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32")
.unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), SslFiletype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), SslFiletype::PEM)
.unwrap();
let mut ssl = Ssl::new(&ctx.build()).unwrap();
ssl.set_mtu(1500).unwrap();
let mut stream = ssl.accept(stream).unwrap();
let mut buf = [0; 60];
stream
.ssl()
.export_keying_material(&mut buf, "EXTRACTOR-dtls_srtp", None)
.unwrap();
stream.write_all(&[0]).unwrap();
buf
});
let stream = TcpStream::connect(addr).unwrap();
let mut ctx = SslContext::builder(SslMethod::dtls()).unwrap();
ctx.set_tlsext_use_srtp("SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32")
.unwrap();
let mut ssl = Ssl::new(&ctx.build()).unwrap();
ssl.set_mtu(1500).unwrap();
let mut stream = ssl.connect(stream).unwrap();
let mut buf = [1; 60];
{
let srtp_profile = stream.ssl().selected_srtp_profile().unwrap();
assert_eq!("SRTP_AES128_CM_SHA1_80", srtp_profile.name());
assert_eq!(SrtpProfileId::SRTP_AES128_CM_SHA1_80, srtp_profile.id());
}
stream
.ssl()
.export_keying_material(&mut buf, "EXTRACTOR-dtls_srtp", None)
.expect("extract");
stream.read_exact(&mut [0]).unwrap();
let buf2 = guard.join().unwrap();
assert_eq!(buf[..], buf2[..]);
} | rust_cleaned_test_functions.jsonl/40290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 910
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
6615,
61248,
790,
15147,
368,
341,
262,
1077,
11446,
284,
64876,
2743,
486,
7666,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
15,
1827,
15454,
543,
262,
1077,
10789,
284,
11446,
11033,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_consecutive_fns() {
let context = Context::create();
let module = context.create_module("fns");
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[], false);
let function = module.add_function("fn", fn_type, None);
assert!(function.get_previous_function().is_none());
assert!(function.get_next_function().is_none());
let function2 = module.add_function("fn2", fn_type, None);
assert_ne!(function, function2);
assert!(function.get_previous_function().is_none());
assert_eq!(function.get_next_function().unwrap(), function2);
assert_eq!(function2.get_previous_function().unwrap(), function);
assert!(function2.get_next_function().is_none());
} | rust_cleaned_test_functions.jsonl/122302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
85780,
761,
4412,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
69,
4412,
3071,
262,
1077,
737,
1819,
284,
2266,
13,
1004,
1819,
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... | 1 |
#[test]
fn test_small_hamming_distance_in_the_middle_somewhere() {
assert_eq!(hamming::hamming_distance("GGACG", "GGTCG").unwrap(), 1);
} | rust_cleaned_test_functions.jsonl/90392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
1523,
309,
5311,
19464,
1243,
16068,
62580,
643,
316,
60652,
368,
341,
262,
2060,
10714,
10297,
5604,
5311,
486,
5604,
5311,
19464,
445,
22254,
1706,
38,
497,
330,
22254,
7749,
38,
1827,
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 |
#[test]
fn test_from_state() {
let schema = Schema::from_string("
| |
| @ |
| @@@ |
------------
");
let (field, mut block) = schema.to_state(rotation_system::new("srs").unwrap());
block.shift(&field, Direction::Left);
assert_eq!(Schema::from_state(&field, &block),
Schema::from_string("
| |
| @ |
|@@@ |
------------
"));
} | rust_cleaned_test_functions.jsonl/10061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
4387,
368,
341,
286,
1077,
10802,
284,
12539,
486,
1499,
3904,
70576,
394,
760,
688,
9248,
394,
760,
220,
569,
981,
9248,
394,
760,
569,
19191,
414,
9248,
394,
32558,
198,
310,
39887,
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_batch_commands() {
let mut cluster = new_server_cluster(0, 1);
cluster.run();
let leader = cluster.get_region(b"").get_peers()[0].clone();
let addr = cluster.sim.rl().get_addr(leader.get_store_id()).to_owned();
let env = Arc::new(Environment::new(1));
let channel = ChannelBuilder::new(env).connect(&addr);
let client = TikvClient::new(channel);
let (mut sender, receiver) = client.batch_commands().unwrap();
for _ in 0..1000 {
let mut batch_req = BatchCommandsRequest::default();
for i in 0..10 {
batch_req.mut_requests().push(Default::default());
batch_req.mut_request_ids().push(i);
}
match sender.send((batch_req, WriteFlags::default())).wait() {
Ok(s) => sender = s,
Err(e) => panic!("tikv cilent send fail: {:?}", e),
}
}
let (tx, rx) = mpsc::sync_channel(1);
thread::spawn(move || {
let mut count = 0;
for x in receiver
.wait()
.map(move |b| b.unwrap().get_responses().len())
{
count += x;
if count == 10000 {
tx.send(1).unwrap();
return;
}
}
});
rx.recv_timeout(Duration::from_secs(1)).unwrap();
} | rust_cleaned_test_functions.jsonl/78664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 632
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
44151,
368,
341,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
220,
16,
317,
262,
10652,
7634,
1428,
262,
1077,
7653,
284,
10652,
670,
20627,
1883,
1,
1827,
455,
36367,
388,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_no_aggr_fn() {
let group_by_exp = || {
RpnExpressionBuilder::new_for_test()
.push_column_ref_for_test(0)
.build_for_test()
};
let exec_fast = |src_exec| {
Box::new(BatchFastHashAggregationExecutor::new_for_test(
src_exec,
group_by_exp(),
vec![],
AllAggrDefinitionParser,
)) as Box<dyn BatchExecutor<StorageStats = ()>>
};
let exec_slow = |src_exec| {
Box::new(BatchSlowHashAggregationExecutor::new_for_test(
src_exec,
vec![group_by_exp()],
vec![],
AllAggrDefinitionParser,
)) as Box<dyn BatchExecutor<StorageStats = ()>>
};
let executor_builders: Vec<Box<dyn FnOnce(MockExecutor) -> _>> =
vec![Box::new(exec_fast), Box::new(exec_slow)];
for exec_builder in executor_builders {
let src_exec = make_src_executor_1();
let mut exec = exec_builder(src_exec);
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert_eq!(r.physical_columns.rows_len(), 0);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert_eq!(r.physical_columns.rows_len(), 0);
assert!(!r.is_drained.unwrap());
let mut r = exec.next_batch(1);
assert_eq!(&r.logical_rows, &[0, 1, 2]);
assert_eq!(r.physical_columns.rows_len(), 3);
assert_eq!(r.physical_columns.columns_len(), 1);
r.physical_columns[0]
.ensure_all_decoded_for_test(&mut EvalContext::default(), &exec.schema()[0])
.unwrap();
let mut sort_column: Vec<(usize, _)> = r.physical_columns[0]
.decoded()
.as_real_slice()
.iter()
.map(|v| {
use std::hash::{Hash, Hasher};
let mut s = std::collections::hash_map::DefaultHasher::new();
v.hash(&mut s);
s.finish()
})
.enumerate()
.collect();
sort_column.sort_by(|a, b| a.1.cmp(&b.1));
let ordered_column: Vec<_> = sort_column
.iter()
.map(|(idx, _)| r.physical_columns[0].decoded().as_real_slice()[*idx])
.collect();
assert_eq!(
&ordered_column,
&[Real::new(1.5).ok(), None, Real::new(7.0).ok()]
);
}
} | rust_cleaned_test_functions.jsonl/15839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1568
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
20587,
901,
15246,
368,
341,
286,
1077,
1874,
3710,
14214,
284,
1369,
341,
310,
431,
19958,
9595,
3297,
486,
931,
5478,
4452,
741,
394,
659,
9077,
8744,
7793,
5478,
4452,
7,
15,
340,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_not_enough_arguments() {
let event = DhcpEvent::LeaseAdded {
event_timestamp: DateTime::<FixedOffset>::from(Local::now()),
lease_info: full_lease_info_v4(),
};
let mut result_command = Command::new(namib_dnsmasq_hook_exe());
let (mut args, envs) = create_args_and_env_map_from_event(&event);
args.remove(3);
args.remove(2);
result_command
.args(args)
.envs(envs)
.stdout(Stdio::null())
.stderr(Stdio::null());
// Removing a command line argument will make the program assume something else is the missing argument.
assert_eq!(
2,
result_command
.status()
.expect("Error while running command.")
.code()
.expect("Command was terminated by a signal.")
);
} | rust_cleaned_test_functions.jsonl/48444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
6205,
1384,
43433,
368,
341,
286,
1077,
1538,
284,
43227,
4672,
1556,
486,
2304,
519,
19337,
341,
310,
1538,
23073,
25,
6520,
27638,
13520,
6446,
6831,
1499,
42718,
486,
3328,
14702,
310,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_str() {
assert_eq!("A".parse(), Ok(Type::Char));
assert_eq!("i".parse(), Ok(Type::Int));
assert_eq!("f".parse(), Ok(Type::Float));
assert_eq!("Z".parse(), Ok(Type::String));
assert_eq!("H".parse(), Ok(Type::Hex));
assert_eq!("B".parse(), Ok(Type::Array));
assert_eq!("".parse::<Type>(), Err(ParseError(String::from(""))));
assert_eq!("n".parse::<Type>(), Err(ParseError(String::from("n"))));
assert_eq!(
"noodles".parse::<Type>(),
Err(ParseError(String::from("noodles")))
);
} | rust_cleaned_test_functions.jsonl/546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
368,
341,
286,
2060,
10714,
17223,
32,
3263,
6400,
1507,
7622,
22498,
486,
4768,
1106,
286,
2060,
10714,
17223,
72,
3263,
6400,
1507,
7622,
22498,
486,
1072,
1106,
286,
2060,
10714,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_e2e_reconfiguration() {
let (env, mut client_proxy_1) = setup_swarm_and_client_proxy(3, 1);
// retrieving the 0-th validator private key
let config_path = env.validator_swarm.config.config_files.get(0).unwrap();
let config = NodeConfig::load(&config_path).unwrap();
let operator_private_str = config
.test
.unwrap()
.operator_keypair
.unwrap()
.take_private()
.unwrap()
.to_encoded_string()
.unwrap();
// the client connected to the removed validator
let mut client_proxy_0 = env.get_validator_ac_client(0, None);
client_proxy_1.create_next_account(false).unwrap();
client_proxy_0.set_accounts(client_proxy_1.copy_all_accounts());
client_proxy_1
.mint_coins(&["mintb", "0", "10", "LBR"], true)
.unwrap();
assert!(compare_balances(
vec![(10.0, "LBR".to_string())],
client_proxy_1.get_balances(&["b", "0"]).unwrap()
));
// wait for the mint txn in node 0
client_proxy_0
.wait_for_transaction(treasury_compliance_account_address(), 1)
.unwrap();
assert!(compare_balances(
vec![(10.0, "LBR".to_string())],
client_proxy_0.get_balances(&["b", "0"]).unwrap()
));
let peer_id = env
.get_validator(0)
.unwrap()
.validator_peer_id()
.unwrap()
.to_string();
client_proxy_1
.remove_validator(&["remove_validator", &peer_id, &operator_private_str], true)
.unwrap();
// mint another 10 coins after remove node 0
client_proxy_1
.mint_coins(&["mintb", "0", "10", "LBR"], true)
.unwrap();
assert!(compare_balances(
vec![(20.0, "LBR".to_string())],
client_proxy_1.get_balances(&["b", "0"]).unwrap()
));
// client connected to removed validator can not see the update
assert!(compare_balances(
vec![(10.0, "LBR".to_string())],
client_proxy_0.get_balances(&["b", "0"]).unwrap()
));
// Add the node back
client_proxy_1
.add_validator(&["add_validator", &peer_id, &operator_private_str], true)
.unwrap();
client_proxy_0
.wait_for_transaction(treasury_compliance_account_address(), 2)
.unwrap();
assert!(compare_balances(
vec![(20.0, "LBR".to_string())],
client_proxy_0.get_balances(&["b", "0"]).unwrap()
));
} | rust_cleaned_test_functions.jsonl/79700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
17,
68,
1288,
21138,
368,
341,
262,
1077,
320,
3160,
11,
5206,
2943,
29712,
62,
16,
8,
284,
6505,
32581,
2178,
8378,
8179,
29712,
7,
18,
11,
220,
16,
317,
262,
442,
48224,
279,
220,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_each_node_config_file_dependency_ordering() -> Result<(), anyhow::Error> {
fn to_string(v: &serde_json::Value) -> String {
v.as_str().unwrap().to_string()
}
// Flattens the provided JSON value to extract all child strings. This is used to extract
// node dependency names from a node config's "dependencies" object even for nodes with a
// more complex format.
fn flatten_node_names(obj: &serde_json::Value) -> Vec<String> {
use serde_json::Value;
match obj {
Value::String(s) => vec![s.to_string()],
Value::Array(arr) => arr.iter().map(|v| flatten_node_names(v)).flatten().collect(),
Value::Object(obj) => {
obj.values().map(|v| flatten_node_names(v)).flatten().collect()
}
e => panic!("Invalid JSON type in dependency object: {:?}", e),
}
}
crate::utils::test_each_node_config_file(|config_file| {
for (dependent_idx, dependent_node) in config_file.iter().enumerate() {
if let Some(dependencies_obj) = dependent_node.get("dependencies") {
for required_node_name in flatten_node_names(dependencies_obj) {
let dependent_node_name = to_string(&dependent_node["name"]);
let required_node_index = config_file
.iter()
.position(|n| to_string(&n["name"]) == required_node_name);
match required_node_index {
Some(found_at_index) if found_at_index > dependent_idx => {
return Err(anyhow::format_err!(
"Dependency {} must be specified before node {}",
required_node_name,
dependent_node_name
));
}
Some(found_at_index) if found_at_index == dependent_idx => {
return Err(anyhow::format_err!(
"Invalid to specify self as dependency for node {}",
dependent_node_name
));
}
None => {
return Err(anyhow::format_err!(
"Missing dependency {} for node {}",
required_node_name,
dependent_node_name
));
}
_ => {}
}
}
}
}
Ok(())
})
} | rust_cleaned_test_functions.jsonl/70780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1703
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32046,
5084,
5332,
2458,
62387,
7869,
287,
368,
1464,
5714,
68843,
88964,
486,
1454,
29,
341,
286,
5168,
311,
3904,
3747,
25,
609,
47024,
9455,
486,
1130,
8,
1464,
923,
341,
310,
348,
5357,
2895... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_int_div_no_panic() {
assert_eq!(Int256::from(6) / Int256::from(2), Int256::from(3));
} | rust_cleaned_test_functions.jsonl/47750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 63
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
16237,
6536,
620,
31270,
368,
341,
286,
2060,
10714,
10297,
1072,
17,
20,
21,
486,
1499,
7,
21,
8,
608,
1333,
17,
20,
21,
486,
1499,
7,
17,
701,
1333,
17,
20,
21,
486,
1499,
7,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_compaction_filter_basic() {
let engine = TestEngineBuilder::new().build().unwrap();
let raw_engine = engine.get_rocksdb();
let value = vec![b'v'; 512];
let mut gc_runner = TestGCRunner::new(0);
// GC can't delete keys after the given safe point.
must_prewrite_put(&engine, b"zkey", &value, b"zkey", 100);
must_commit(&engine, b"zkey", 100, 110);
gc_runner.safe_point(50).gc(&raw_engine);
must_get(&engine, b"zkey", 110, &value);
// GC can't delete keys before the safe ponit if they are latest versions.
gc_runner.safe_point(200).gc(&raw_engine);
must_get(&engine, b"zkey", 110, &value);
must_prewrite_put(&engine, b"zkey", &value, b"zkey", 120);
must_commit(&engine, b"zkey", 120, 130);
// GC can't delete the latest version before the safe ponit.
gc_runner.safe_point(115).gc(&raw_engine);
must_get(&engine, b"zkey", 110, &value);
// GC a version will also delete the key on default CF.
gc_runner.safe_point(200).gc(&raw_engine);
must_get_none(&engine, b"zkey", 110);
let default_key = Key::from_encoded_slice(b"zkey").append_ts(100.into());
let default_key = default_key.into_encoded();
assert!(raw_engine.get_value(&default_key).unwrap().is_none());
} | rust_cleaned_test_functions.jsonl/120953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
1311,
8727,
34729,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
7112,
24823,
284,
4712,
670,
26608,
14553,
1999,
543,
286,
1077,
897,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_months() -> Result<()> {
assert_eq!(true, Months(0).even_freq(&Frequency::Monthly));
assert_eq!(true, Months(0).even_freq(&Frequency::Quarterly));
assert_eq!(true, Months(0).even_freq(&Frequency::Yearly));
assert_eq!(true, Months(1).even_freq(&Frequency::Monthly));
assert_eq!(false, Months(1).even_freq(&Frequency::Quarterly));
assert_eq!(false, Months(1).even_freq(&Frequency::Yearly));
assert_eq!(true, Months(3).even_freq(&Frequency::Monthly));
assert_eq!(true, Months(3).even_freq(&Frequency::Quarterly));
assert_eq!(false, Months(3).even_freq(&Frequency::Yearly));
assert_eq!(true, Months(12).even_freq(&Frequency::Monthly));
assert_eq!(true, Months(12).even_freq(&Frequency::Quarterly));
assert_eq!(true, Months(12).even_freq(&Frequency::Yearly));
Ok(())
} | rust_cleaned_test_functions.jsonl/50948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88462,
368,
1464,
5714,
71698,
341,
286,
2060,
10714,
10297,
1866,
11,
51346,
7,
15,
568,
16788,
21790,
2099,
38614,
486,
72007,
1106,
286,
2060,
10714,
10297,
1866,
11,
51346,
7,
15,
568,
16788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_safe_checkout_updated_blob_with_untracked_tree() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let target = commit! {
foo < "updated foo contents"
};
rm!(repo: "foo");
mkdir!(repo: "foo");
touch!(repo: "foo/bar");
bit_checkout!(repo: &rev!(target)).unwrap_err().try_into_checkout_conflict()?;
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34067,
68186,
33492,
45908,
6615,
4907,
58381,
11663,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
2169,
284,
5266,
0,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ss58hash() {
let msg = b"hello, world!";
let hash = ss58hash(msg).as_bytes().to_vec();
assert_eq!("656facfcf4f90cce9ec9b65c9185ea75346507c67e25133f5809b442487468a674973f9167193e86bee0c706f6766f7edf638ed3e21ad12c2908ea62924af4d7", hex::encode(hash));
} | rust_cleaned_test_functions.jsonl/42281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41848,
20,
23,
8296,
368,
341,
286,
1077,
3750,
284,
293,
1,
14990,
11,
1879,
26782,
286,
1077,
5175,
284,
10870,
20,
23,
8296,
8119,
568,
300,
12524,
1005,
983,
13251,
1428,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_constrain_intervals() {
let constraint: Box<dyn SinglePartConstraint> = Box::new(ConstrainIntervals(vec![
ChromaticInterval(8, Quality::Perfect),
ChromaticInterval(3, Quality::Major),
]));
assert!(!constraint.is_active(&vec![], 10));
//TODO
} | rust_cleaned_test_functions.jsonl/74365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
77626,
90807,
368,
341,
286,
1077,
21568,
25,
8261,
92846,
11327,
5800,
17890,
29,
284,
8261,
486,
931,
7,
1109,
77626,
1072,
42198,
25592,
90515,
310,
34218,
774,
10256,
7,
23,
11,
17927,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aliased_class_template_instantiated_in_header() -> Result<()> {
// This aliased class template specialization is instantiated due to the code
// that is present in the header. We should not corrupt the AST by
// instantiating again.
let ir = ir_from_cc(
r#" #pragma clang lifetime_elision
template <typename T>
struct MyTemplate {
const T& GetValue() { return field; }
T field;
};
inline void my_full_instantiation() {
MyTemplate<int> t;
t.field = 123;
t.field = t.GetValue() * 123;
}
using MyAlias = MyTemplate<int>; "#,
)?;
assert_ir_matches!(
ir,
quote! {
Record {
rs_name: "__CcTemplateInst10MyTemplateIiE", ...
cc_name: "MyTemplate<int>", ...
fields: [Field { identifier: Some("field"), ... }], ...
}
}
);
assert_ir_matches!(ir, quote! { Func { name: "GetValue", ... } });
Ok(())
} | rust_cleaned_test_functions.jsonl/37175 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
7956,
1475,
4790,
8693,
1243,
4706,
10029,
1243,
8757,
368,
1464,
5714,
71698,
341,
262,
442,
1096,
18991,
1475,
536,
3811,
65879,
374,
54586,
4152,
311,
279,
2038,
198,
262,
442,
429,
374,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_wrap_alignment() {
// so we should make sure it works.
let includes: [PathBuf; 0] = [];
let defines: [(String, String); 0] = [];
let (comp, _) = compile(
None,
&Path::new(""),
"
#version 450
struct Vec3Wrap {
vec3 v;
};
struct MyStruct {
Vec3Wrap vs[2];
};
layout(binding=0) uniform UBO {
MyStruct s;
};
void main() {}
",
ShaderKind::Vertex,
&includes,
&defines,
None,
None,
)
.unwrap();
let doc = parse::parse_spirv(comp.as_binary()).unwrap();
structs::write_structs(&doc, &TypesMeta::default());
} | rust_cleaned_test_functions.jsonl/23744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38550,
51006,
368,
341,
1789,
286,
442,
773,
582,
1265,
1281,
2704,
432,
4278,
624,
286,
1077,
5646,
25,
508,
1820,
15064,
26,
220,
15,
60,
284,
5907,
286,
1077,
18653,
25,
17826,
703,
11,
923... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_transaction_refers_to_message() {
let id = Value::String("5b532e2ec17ac84b4efa92703192368dd4ed8a2729f2be2b0ee4e0665368f7c0".to_owned());
let json = json!({});
assert!(!is_transaction_refers_to_message(&json, &id));
let json = json!({
"in_msg": "aaa",
"out_msgs": ["bbb", "ccc"],
});
assert!(!is_transaction_refers_to_message(&json, &id));
let json = json!({
"in_msg": id,
"out_msgs": [],
});
assert!(is_transaction_refers_to_message(&json, &id));
let json = json!({
"in_msg": "aaa",
"out_msgs": ["aaa", "bbb", id, "ddd"],
});
assert!(is_transaction_refers_to_message(&json, &id));
} | rust_cleaned_test_functions.jsonl/90618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
28884,
7793,
388,
2346,
6462,
368,
341,
262,
1077,
877,
284,
5162,
486,
703,
445,
20,
65,
20,
18,
17,
68,
17,
757,
16,
22,
580,
23,
19,
65,
19,
75631,
24,
17,
22,
15,
18,
16,
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_serde_deserialize() {
super::test_decodable_json(|input| self::serde_json::from_str(&input), |input| self::serde_json::from_str(&input),
|input| self::serde_json::from_str(&input));
} | rust_cleaned_test_functions.jsonl/17714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
15768,
9050,
368,
341,
286,
2256,
486,
1944,
13783,
69129,
9455,
22428,
1355,
91,
656,
486,
47024,
9455,
486,
1499,
2895,
2099,
1355,
701,
760,
1355,
91,
656,
486,
47024,
9455,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bootstrap_empty_storage_with_second_block_with_first_predecessor_should_fail_unknown_predecessor_context(
) {
init_test_runtime();
// init empty context for test
let (chain_id, ..) = init_test_protocol_context(
"bootstrap_test_storage_02",
test_data_protocol_v1::tezos_network(),
);
// apply second block - level 2
let apply_block_result = client::apply_block(ApplyBlockRequest {
chain_id: chain_id,
block_header: BlockHeader::from_bytes(
hex::decode(test_data_protocol_v1::BLOCK_HEADER_LEVEL_2).unwrap(),
)
.unwrap(),
pred_header: BlockHeader::from_bytes(
hex::decode(test_data_protocol_v1::BLOCK_HEADER_LEVEL_1).unwrap(),
)
.unwrap(),
operations: ApplyBlockRequest::convert_operations(
test_data_protocol_v1::block_operations_from_hex(
test_data_protocol_v1::BLOCK_HEADER_HASH_LEVEL_2,
test_data_protocol_v1::block_header_level2_operations(),
),
),
max_operations_ttl: 0,
predecessor_block_metadata_hash: None,
predecessor_ops_metadata_hash: None,
});
assert!(apply_block_result.is_err());
assert!(match apply_block_result.unwrap_err() {
ApplyBlockError::UnknownPredecessorContext { .. } => true,
e => {
println!("expected UnknownPredecessorContext, but was {:?}", e);
false
}
});
} | rust_cleaned_test_functions.jsonl/8659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 686
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88424,
15124,
23310,
6615,
29644,
7113,
6615,
12978,
10442,
26911,
269,
43378,
22121,
57507,
10442,
26911,
269,
8467,
1006,
8,
341,
262,
2930,
4452,
33232,
1428,
262,
442,
2930,
4287,
2266,
369,
127... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_strb() {
assert_eq!(
decode_16(0x7008),
Instruction::STRB_imm {
params: Reg2FullParams {
rt: Reg::R0,
rn: Reg::R1,
imm32: 0,
index: true,
add: true,
wback: false,
},
thumb32: false,
}
);
} | rust_cleaned_test_functions.jsonl/64758 | {
"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,
15227,
2895,
65,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
16,
21,
7,
15,
87,
22,
15,
15,
23,
1326,
286,
29051,
486,
6666,
33,
71370,
341,
310,
3628,
25,
3184,
17,
9432,
4870,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sign_rfc6979_verify_hash_random() {
let mut rng = ThreadRng256 {};
for _ in 0..ITERATIONS {
let msg = rng.gen_uniform_u8x32();
let sk = SecKey::gensk(&mut rng);
let pk = sk.genpk();
let sign = sk.sign_rfc6979::<Sha256>(&msg);
assert!(pk.verify_hash_vartime(&Sha256::hash(&msg), &sign));
}
} | rust_cleaned_test_functions.jsonl/81726 | {
"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,
11172,
1710,
8316,
21,
24,
22,
24,
35638,
8950,
22644,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
20375,
286,
369,
716,
304,
220,
15,
496,
24733,
21792,
341,
310,
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... | 2 |
#[test]
fn test_coherence() {
let c = Contact { name: "John".to_string(), city: "Paris".to_string() };
assert!(json::decode::<Contact>(json::encode(&c).as_slice()).unwrap() == c);
} | rust_cleaned_test_functions.jsonl/92810 | {
"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,
11393,
51361,
368,
341,
262,
1077,
272,
284,
9180,
314,
829,
25,
330,
13079,
3263,
983,
3904,
1507,
3283,
25,
330,
59604,
3263,
983,
3904,
368,
2605,
262,
2060,
10297,
2236,
486,
18196,
27638,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_nfc() {
test("\u{212b}".as_bytes(), "\u{c5}\n");
test("\u{c5}".as_bytes(), "\u{c5}\n");
test("\u{41}\u{30a}".as_bytes(), "\u{c5}\n");
} | rust_cleaned_test_functions.jsonl/36864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
8316,
368,
341,
262,
1273,
4921,
84,
90,
17,
16,
17,
65,
21901,
300,
12524,
1507,
2917,
84,
90,
66,
20,
11035,
77,
797,
262,
1273,
4921,
84,
90,
66,
20,
21901,
300,
12524,
1507,
2917,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_i64() -> Result<()> {
let cases = vec![
("0000-00-00 00:00:00", 0),
("2000-01-01 00:00:00", 101),
("2045-00-00 00:00:00", 450_000),
("2059-12-31 00:00:00", 591_231),
("1970-01-01 00:00:00", 700_101),
("1999-12-31 00:00:00", 991_231),
("2000-01-01 00:00:00", 101_000_000),
("2069-12-31 23:59:59", 691_231_235_959),
("1970-01-01 00:00:00", 700_101_000_000),
("1999-12-31 23:59:59", 991_231_235_959),
("0100-00-00 00:00:00", 1_000_000_000_000),
("1000-01-01 00:00:00", 10_000_101_000_000),
("1999-01-01 00:00:00", 19_990_101_000_000),
];
let mut ctx = EvalContext::default();
for (expected, input) in cases {
let actual = Time::parse_from_i64(&mut ctx, input, TimeType::DateTime, 0)?;
assert_eq!(actual.to_string(), expected);
}
let should_fail = vec![
-1111,
1,
100,
700_100,
10_000_100,
100_000_000,
100_000_101_000_000,
];
for case in should_fail {
assert!(Time::parse_from_i64(&mut ctx, case, TimeType::DateTime, 0).is_err());
}
Ok(())
} | rust_cleaned_test_functions.jsonl/40455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 783
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5673,
5318,
21,
19,
368,
1464,
5714,
71698,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
15,
15,
15,
15,
12,
15,
15,
12,
15,
15,
220,
15,
15,
25,
15,
15,
25,
15,
15,
497,
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... | 6 |
#[test]
fn test_debug() {
let backtrace = Backtrace {
inner: Inner::Captured(Mutex::new(Capture {
actual_start: 1,
resolved: true,
frames: vec![
BacktraceFrame {
frame: RawFrame::Fake,
symbols: vec![BacktraceSymbol {
name: Some(b"std::backtrace::Backtrace::create".to_vec()),
filename: Some(BytesOrWide::Bytes(b"rust/backtrace.rs".to_vec())),
lineno: Some(100),
}],
},
BacktraceFrame {
frame: RawFrame::Fake,
symbols: vec![BacktraceSymbol {
name: Some(b"__rust_maybe_catch_panic".to_vec()),
filename: None,
lineno: None,
}],
},
BacktraceFrame {
frame: RawFrame::Fake,
symbols: vec![
BacktraceSymbol {
name: Some(b"std::rt::lang_start_internal".to_vec()),
filename: Some(BytesOrWide::Bytes(b"rust/rt.rs".to_vec())),
lineno: Some(300),
},
BacktraceSymbol {
name: Some(b"std::rt::lang_start".to_vec()),
filename: Some(BytesOrWide::Bytes(b"rust/rt.rs".to_vec())),
lineno: Some(400),
},
],
},
],
})),
};
#[rustfmt::skip]
let expected = "Backtrace [\
\n { fn: \"__rust_maybe_catch_panic\" },\
\n { fn: \"std::rt::lang_start_internal\", file: \"rust/rt.rs\", line: 300 },\
\n { fn: \"std::rt::lang_start\", file: \"rust/rt.rs\", line: 400 },\
\n]";
assert_eq!(format!("{:#?}", backtrace), expected);
} | rust_cleaned_test_functions.jsonl/23125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
262,
1077,
1182,
15067,
284,
6841,
15067,
341,
286,
9179,
25,
36356,
486,
40536,
3073,
3189,
9371,
486,
931,
3025,
11850,
341,
310,
5042,
4906,
25,
220,
16,
345,
310,
19673,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_ltr() {
use super::is_ltr;
assert_eq!(is_ltr(10), true);
assert_eq!(is_ltr(11), false);
assert_eq!(is_ltr(20), true);
} | rust_cleaned_test_functions.jsonl/29776 | {
"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,
6892,
907,
376,
368,
341,
286,
990,
2256,
486,
285,
907,
376,
280,
286,
2060,
10714,
10297,
285,
907,
376,
7,
16,
15,
701,
830,
317,
286,
2060,
10714,
10297,
285,
907,
376,
7,
16,
16,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_empty() {
const FORMAT_STR: &str = "(@$empty)";
let formatter = StringFormatter::new(FORMAT_STR)
.unwrap()
.map(|var| match var {
"empty" => Some(Ok("")),
_ => None,
});
let result = formatter.parse(None).unwrap();
assert_eq!(result.len(), 0);
} | rust_cleaned_test_functions.jsonl/71888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
368,
341,
286,
733,
52225,
7159,
25,
609,
495,
284,
330,
5957,
3,
3194,
86197,
286,
1077,
24814,
284,
923,
14183,
486,
931,
7832,
98084,
7159,
340,
310,
659,
15454,
741,
310,
659,
2186,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_new_from_nodes_and_edges() {
let nodes = vec![
Node::from_name("n1"),
Node::from_name("n2"),
Node::<&str, &str, &f64>::from_name("n3"),
];
let edges = vec![
Edge::with_weight("n1", "n2", &1.0),
Edge::with_weight("n2", "n1", &2.0),
Edge::with_weight("n1", "n3", &3.0),
];
let specs = GraphSpecs::directed();
let graph = Graph::new_from_nodes_and_edges(nodes, edges, specs);
assert!(graph.is_ok());
let graph = graph.unwrap();
assert_eq!(graph.get_all_nodes().len(), 3);
assert_eq!(graph.get_all_edges().len(), 3);
} | rust_cleaned_test_functions.jsonl/100475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 377
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
5673,
14896,
8378,
28026,
368,
341,
286,
1077,
7798,
284,
7486,
90515,
310,
6018,
486,
1499,
1269,
445,
77,
16,
4461,
310,
6018,
486,
1499,
1269,
445,
77,
17,
4461,
310,
6018,
27638,
5,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_angle_x_rotation_should_not_rotate_x_axis() {
let rotation = Rotation3::from_angle_x(Degrees(70_f64));
let vector = Vector3::unit_x();
let expected = vector;
let result = rotation.rotate_vector(&vector);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/70481 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
21727,
3212,
44813,
43378,
7913,
60834,
3212,
23567,
368,
341,
286,
1077,
12695,
284,
47528,
18,
486,
1499,
21727,
3212,
5432,
791,
7858,
7,
22,
15,
761,
21,
19,
1106,
286,
1077,
4621,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_departure_time() {
assert_eq!(
DepartureTime::new(1537308000).unwrap(),
DepartureTime::new(1537308000)
.unwrap()
.shift(&NaiveDateTime::from_timestamp(1536991111, 0))
);
assert_eq!(
DepartureTime::new(1565820000).unwrap(),
DepartureTime::new(1565820000)
.unwrap()
.shift(&NaiveDateTime::from_timestamp(1536991111, 0))
);
} | rust_cleaned_test_functions.jsonl/75486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
69865,
552,
3009,
368,
341,
286,
2060,
10714,
33673,
310,
39755,
552,
1462,
486,
931,
7,
16,
20,
18,
22,
18,
15,
23,
15,
15,
15,
568,
15454,
3148,
310,
39755,
552,
1462,
486,
931,
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_find_line_intersections() {
let line1 = vec![
Point2D::new(0.0, 0.0),
Point2D::new(10.0, 10.0),
Point2D::new(12.0, 6.0),
Point2D::new(6.0, 0.0),
];
let line2 = vec![
Point2D::new(-1.0, 5.0),
Point2D::new(6.0, 5.0),
Point2D::new(6.0, 2.0),
Point2D::new(12.0, 2.0),
];
let intersections = find_line_intersections(&line1, &line2);
let intersections_should_be = vec![
LineSegment::new(Point2D::new(5.0, 5.0), Point2D::new(5.0, 5.0)),
LineSegment::new(Point2D::new(8.0, 2.0), Point2D::new(8.0, 2.0)),
];
assert_eq!(intersections, intersections_should_be);
} | rust_cleaned_test_functions.jsonl/6630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
6528,
15318,
24661,
368,
341,
286,
1077,
1555,
16,
284,
7486,
90515,
310,
5126,
17,
35,
486,
931,
7,
15,
13,
15,
11,
220,
15,
13,
15,
1326,
310,
5126,
17,
35,
486,
931,
7,
16,
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_datetime() {
assert_eq!(datetime("1984-01-18T16:55+0200").unwrap().0,
DateTime {
date: Date { year: 1984, month: 1, day: 18},
time: Time { hour: 16, minute: 55, second: 0, tz_offset:7200 }
});
} | rust_cleaned_test_functions.jsonl/81578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28943,
368,
341,
262,
2060,
10714,
10297,
15450,
445,
16,
24,
23,
19,
12,
15,
16,
12,
16,
23,
51,
16,
21,
25,
20,
20,
10,
15,
17,
15,
15,
1827,
15454,
1005,
15,
345,
1060,
6520,
341,
394... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exchange_round_two_works() {
assert_eq!(round_two(&BigDecimal::from_str("123.12").unwrap()), 123.12);
} | rust_cleaned_test_functions.jsonl/74673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
29896,
23241,
11498,
82,
368,
341,
286,
2060,
10714,
10297,
1049,
23241,
2099,
76422,
486,
1499,
2895,
445,
16,
17,
18,
13,
16,
17,
1827,
15454,
11858,
220,
16,
17,
18,
13,
16,
17,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_invalid_pubkey_len() {
let tx = test_tx();
let mut packet = Packet::from_data(None, tx).unwrap();
let res = sigverify::do_get_packet_offsets(&packet, 0);
// make pubkey len huge
packet.buffer_mut()[res.unwrap().pubkey_start as usize - 1] = 0x7f;
let res = sigverify::do_get_packet_offsets(&packet, 0);
assert_eq!(res, Err(PacketError::InvalidPubkeyLen));
} | rust_cleaned_test_functions.jsonl/39072 | {
"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,
31433,
34014,
792,
6043,
368,
341,
286,
1077,
9854,
284,
1273,
17805,
543,
286,
1077,
5206,
10151,
284,
28889,
486,
1499,
1769,
26717,
11,
9854,
568,
15454,
1428,
286,
1077,
592,
284,
8366,
12446,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_utimensat() {
let _dr = crate::DirRestore::new();
let tempdir = tempfile::tempdir().unwrap();
let filename = "foo.txt";
let fullpath = tempdir.path().join(filename);
drop(File::create(&fullpath).unwrap());
let dirfd = fcntl::open(tempdir.path(), fcntl::OFlag::empty(), stat::Mode::empty()).unwrap();
utimensat(Some(dirfd), filename, &TimeSpec::seconds(12345), &TimeSpec::seconds(678),
UtimensatFlags::FollowSymlink).unwrap();
assert_times_eq(12345, 678, &fs::metadata(&fullpath).unwrap());
chdir(tempdir.path()).unwrap();
utimensat(None, filename, &TimeSpec::seconds(500), &TimeSpec::seconds(800),
UtimensatFlags::FollowSymlink).unwrap();
assert_times_eq(500, 800, &fs::metadata(&fullpath).unwrap());
} | rust_cleaned_test_functions.jsonl/48646 | {
"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,
60363,
45597,
266,
368,
341,
262,
1077,
716,
3612,
284,
17717,
486,
6184,
56284,
486,
931,
543,
262,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
3899,
284,
330,
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_good_script_alpha_code() {
match lookup_by_alpha("Hluw") {
None => panic!("was expecting a script"),
Some(script) => {
assert_eq!(script.alphabetic_code.to_string(), "Hluw".to_string());
assert_eq!(script.numeric_code, 80);
}
}
} | rust_cleaned_test_functions.jsonl/29976 | {
"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,
44781,
14660,
26633,
4136,
368,
341,
286,
2432,
18615,
3710,
26633,
445,
39,
9835,
86,
899,
341,
310,
2240,
589,
21975,
17223,
16123,
22331,
264,
5316,
4461,
310,
4329,
42795,
8,
589,
341,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_word_segmentation() {
let edit_distance_max = 2;
let mut sym_spell = SymSpell::<UnicodeStringStrategy>::default();
sym_spell.load_dictionary("./data/frequency_dictionary_en_82_765.txt", 0, 1, " ");
let typo = "thequickbrownfoxjumpsoverthelazydog";
let correction = "the quick brown fox jumps over the lazy dog";
let result = sym_spell.word_segmentation(typo, edit_distance_max);
assert_eq!(correction, result.segmented_string);
let typo = "itwasabrightcolddayinaprilandtheclockswerestrikingthirteen";
let correction = "it was a bright cold day in april and the clocks were striking thirteen";
let result = sym_spell.word_segmentation(typo, edit_distance_max);
assert_eq!(correction, result.segmented_string);
let typo =
"itwasthebestoftimesitwastheworstoftimesitwastheageofwisdomitwastheageoffoolishness";
let correction = "it was the best of times it was the worst of times it was the age of wisdom it was the age of foolishness";
let result = sym_spell.word_segmentation(typo, edit_distance_max);
assert_eq!(correction, result.segmented_string);
} | rust_cleaned_test_functions.jsonl/98945 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13533,
28061,
367,
368,
341,
286,
1077,
4499,
19464,
6345,
284,
220,
17,
280,
286,
1077,
5206,
7886,
64717,
284,
11375,
29028,
27638,
33920,
703,
19816,
6831,
2258,
543,
286,
7886,
64717,
5104,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_split() {
assert_eq!(
eval_binary("<< 1:4, << 1,2,3,4 >>/binary >>"),
[16, 16, 32, 48, 4]
);
} | rust_cleaned_test_functions.jsonl/83848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
17052,
368,
341,
286,
2060,
10714,
33673,
310,
5603,
31761,
445,
2442,
220,
16,
25,
19,
11,
1115,
220,
16,
11,
17,
11,
18,
11,
19,
3578,
14,
25891,
3578,
4461,
310,
508,
16,
21,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_incorrect_node_section_sz_oversize() {
let mut bytecode: Vec<u8> = BIND_HEADER.to_vec();
append_section_header(&mut bytecode, SYMB_MAGIC_NUM, 18);
let device_name: [u8; 5] = [0x49, 0x42, 0x49, 0x53, 0]; // "IBIS"
bytecode.extend_from_slice(&[1, 0, 0, 0]);
bytecode.extend_from_slice(&device_name);
let primary_node_name: [u8; 5] = [0x43, 0x4F, 0x4F, 0x54, 0]; // "RAIL"
bytecode.extend_from_slice(&[2, 0, 0, 0]);
bytecode.extend_from_slice(&primary_node_name);
let primary_node_inst = [0x30, 0x01, 0x01, 0, 0, 0, 0x05, 0x01, 0x10, 0, 0x20, 0];
let composite_insts_sz =
COMPOSITE_NAME_ID_BYTES + (NODE_TYPE_HEADER_SZ + primary_node_inst.len()) as u32;
append_section_header(&mut bytecode, COMPOSITE_MAGIC_NUM, composite_insts_sz);
// Add device name ID.
bytecode.extend_from_slice(&[1, 0, 0, 0]);
// Add primary node instructions with a size that exceed the entire instruction size.
append_node_header(&mut bytecode, RawNodeType::Primary, 2, 50);
bytecode.extend_from_slice(&primary_node_inst);
assert_eq!(Err(BytecodeError::IncorrectNodeSectionSize), DecodedRules::new(bytecode));
} | rust_cleaned_test_functions.jsonl/24051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
19928,
5084,
16221,
33945,
62,
8969,
551,
368,
341,
286,
1077,
5206,
75129,
25,
11312,
34837,
23,
29,
284,
91370,
20330,
2389,
13251,
543,
286,
8737,
16221,
8757,
2099,
6984,
75129,
11,
1607... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reference_vector_ILL4_ext_id1() {
let test_vector = include_bytes!("../vectors/ILL4_ext_id1.bit");
test_vs_minimp3(test_vector);
} | rust_cleaned_test_functions.jsonl/69814 | {
"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,
25433,
12247,
62,
9228,
19,
9927,
842,
16,
368,
341,
262,
1077,
1273,
12247,
284,
2924,
12524,
17223,
1244,
85,
10605,
14,
9228,
19,
9927,
842,
16,
30099,
797,
262,
1273,
42434,
7260,
6664,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_poh_cache_on_disconnect() {
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger");
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2);
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
let prev_hash = bank0.last_blockhash();
let (mut poh_recorder, entry_receiver, _record_receiver) = PohRecorder::new(
0,
prev_hash,
bank0.clone(),
Some((4, 4)),
bank0.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank0)),
&Arc::new(PohConfig::default()),
Arc::new(AtomicBool::default()),
);
bank0.fill_bank_with_ticks();
let bank1 = Arc::new(Bank::new_from_parent(&bank0, &Pubkey::default(), 1));
poh_recorder.set_bank(&bank1);
// Check we can make two ticks without hitting min_tick_height
let remaining_ticks_to_min =
poh_recorder.working_bank.as_ref().unwrap().min_tick_height
- poh_recorder.tick_height();
for _ in 0..remaining_ticks_to_min {
poh_recorder.tick();
}
assert_eq!(poh_recorder.tick_height, remaining_ticks_to_min);
assert_eq!(
poh_recorder.tick_cache.len(),
remaining_ticks_to_min as usize
);
assert!(poh_recorder.working_bank.is_some());
// and the working bank will be cleared
drop(entry_receiver);
poh_recorder.tick();
// Check everything is cleared
assert!(poh_recorder.working_bank.is_none());
// Extra +1 for the tick that happened after the drop of the entry receiver.
assert_eq!(
poh_recorder.tick_cache.len(),
remaining_ticks_to_min as usize + 1
);
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/106268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
2267,
11529,
4470,
67972,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
2099,
50704,
2638,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_middle() {
let result = linear_search(&vec![9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 4);
assert_eq!(result, Some(5));
} | rust_cleaned_test_functions.jsonl/50277 | {
"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,
62580,
368,
341,
286,
1077,
1102,
284,
13482,
10716,
2099,
4083,
20703,
24,
11,
220,
23,
11,
220,
22,
11,
220,
21,
11,
220,
20,
11,
220,
19,
11,
220,
18,
11,
220,
17,
11,
220,
16,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_all() {
assert_eq!(true, istor::istor("176.10.99.200", false)); //in the list
assert_eq!(false, istor::istor("176.10.99.300", false)); //not in the list
assert_eq!(false, istor::istor("176.10.99.200\n", false));
assert_eq!(true, istor::istor("95.143.193.125", false)); //in the list
} | rust_cleaned_test_functions.jsonl/122550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
368,
341,
286,
2060,
10714,
10297,
1866,
11,
220,
5323,
486,
5323,
445,
16,
22,
21,
13,
16,
15,
13,
24,
24,
13,
17,
15,
15,
497,
895,
5905,
442,
258,
279,
1140,
198,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_configuration() {
let tests = vec![
(
"Single channel",
chirpstack_api::gw::GatewayConfiguration{
channels: vec![
chirpstack_api::gw::ChannelConfiguration{
frequency: 868100000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 125000,
spreading_factors: vec![7,8,9,10,11,12],
})),
..Default::default()
},
],
..Default::default()
},
Concentrator{
multi_sf_channels: [
868100000,
0,
0,
0,
0,
0,
0,
0,
],
..Default::default()
},
),
(
"8 channels + LoRa std + FSK",
chirpstack_api::gw::GatewayConfiguration{
channels: vec![
chirpstack_api::gw::ChannelConfiguration{
frequency: 868100000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 125000,
spreading_factors: vec![7,8,9,10,11,12],
})),
..Default::default()
},
chirpstack_api::gw::ChannelConfiguration{
frequency: 868300000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 125000,
spreading_factors: vec![7,8,9,10,11,12],
})),
..Default::default()
},
chirpstack_api::gw::ChannelConfiguration{
frequency: 868500000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 125000,
spreading_factors: vec![7,8,9,10,11,12],
})),
..Default::default()
},
chirpstack_api::gw::ChannelConfiguration{
frequency: 867100000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 125000,
spreading_factors: vec![7,8,9,10,11,12],
})),
..Default::default()
},
chirpstack_api::gw::ChannelConfiguration{
frequency: 867300000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 125000,
spreading_factors: vec![7,8,9,10,11,12],
})),
..Default::default()
},
chirpstack_api::gw::ChannelConfiguration{
frequency: 867500000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 125000,
spreading_factors: vec![7,8,9,10,11,12],
})),
..Default::default()
},
chirpstack_api::gw::ChannelConfiguration{
frequency: 867700000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 125000,
spreading_factors: vec![7,8,9,10,11,12],
})),
..Default::default()
},
chirpstack_api::gw::ChannelConfiguration{
frequency: 867900000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 125000,
spreading_factors: vec![7,8,9,10,11,12],
})),
..Default::default()
},
chirpstack_api::gw::ChannelConfiguration{
frequency: 868300000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::LoraModulationConfig(chirpstack_api::gw::LoRaModulationConfig{
bandwidth: 250000,
spreading_factors: vec![12],
})),
..Default::default()
},
chirpstack_api::gw::ChannelConfiguration{
frequency: 868800000,
modulation: chirpstack_api::common::Modulation::Lora as i32,
modulation_config: Some(chirpstack_api::gw::channel_configuration::ModulationConfig::FskModulationConfig(chirpstack_api::gw::FskModulationConfig{
bandwidth: 125000,
bitrate: 50000,
})),
..Default::default()
},
],
..Default::default()
},
Concentrator{
multi_sf_channels: [
868100000,
868300000,
868500000,
867100000,
867300000,
867500000,
867700000,
867900000,
],
lora_std: LoRaStdChannel{
frequency: 868300000,
bandwidth: 250000,
spreading_factor: 12,
},
fsk: FSKChannel{
frequency: 868800000,
datarate: 50000,
bandwidth: 125000,
},
},
),
];
for (_, gw_config, expected_config) in tests {
let mut config = Configuration::default();
update_configuration(&mut config, &gw_config).unwrap();
assert_eq!(config.gateway.concentrator, expected_config);
}
} | rust_cleaned_test_functions.jsonl/125623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
35726,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
2399,
394,
330,
10888,
5496,
756,
394,
70446,
79,
7693,
11697,
486,
54133,
486,
40709,
7688,
515,
503,
11744,
25,
7486,
90515,
664,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cml_json5() {
let input = r##"{
"expose": [
// Here are some services to expose.
{ "service": "fuchsia.logger.Log", "from": "#logger", },
{ "directory": "blobfs", "from": "#logger", "rights": ["rw*"]},
],
"children": [
{
name: 'logger',
'url': 'fuchsia-pkg://fuchsia.com/logger/stable#meta/logger.cm',
},
],
}"##;
let result = write_and_validate("test.cml", input.as_bytes());
assert_matches!(result, Ok(()));
} | rust_cleaned_test_functions.jsonl/97343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
1014,
9455,
20,
368,
341,
286,
1077,
1946,
284,
435,
565,
1,
515,
310,
330,
327,
2900,
788,
2278,
394,
442,
5692,
525,
1045,
3516,
311,
28141,
624,
394,
314,
330,
7936,
788,
330,
69,
73... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_links_field() {
check(
r#"
struct S {
/// [`S`]
field<|>: i32
}
"#,
expect
"#]],
);
} | rust_cleaned_test_functions.jsonl/66152 | {
"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,
18869,
25258,
5013,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
328,
341,
262,
1048,
40518,
50,
63,
921,
262,
2070,
27,
91,
26818,
600,
18,
17,
198,
532,
57676,
345,
310,
1720,
0,
155... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_envelope_empty() {
// Without terminating newline after header
let bytes = Bytes::from("{\"event_id\":\"9ec79c33ec9942ab8353589fcb2e04dc\",\"dsn\":\"https://e12d836b15bb49d7bbf99e64295d995b:@sentry.io/42\"}");
let envelope = Envelope::parse_bytes(bytes).unwrap();
let event_id = EventId("9ec79c33ec9942ab8353589fcb2e04dc".parse().unwrap());
assert_eq!(envelope.event_id(), Some(event_id));
assert_eq!(envelope.len(), 0);
} | rust_cleaned_test_functions.jsonl/103608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
6205,
18853,
15124,
368,
341,
286,
442,
17147,
70581,
39027,
1283,
4247,
198,
286,
1077,
5820,
284,
30024,
486,
1499,
99141,
3087,
842,
23488,
24,
757,
22,
24,
66,
18,
18,
757,
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_bpf_loader_finalize() {
let program_id = Pubkey::new_rand();
let program_key = Pubkey::new_rand();
let rent_key = rent::id();
let mut file = File::open("test_elfs/noop.so").expect("file open failed");
let mut elf = Vec::new();
let rent = rent::Rent::default();
file.read_to_end(&mut elf).unwrap();
let mut program_account = Account::new(rent.minimum_balance(elf.len()), 0, &program_id);
program_account.data = elf;
let mut keyed_accounts = vec![KeyedAccount::new(&program_key, false, &mut program_account)];
let ix_data = bincode::serialize(&LoaderInstruction::Finalize).unwrap();
// Case: Empty keyed accounts
assert_eq!(
Err(InstructionError::NotEnoughAccountKeys),
process_instruction(&program_id, &mut vec![], &ix_data)
);
let mut rent_account = rent::create_account(1, &rent);
keyed_accounts.push(KeyedAccount::new(&rent_key, false, &mut rent_account));
// Case: Not signed
assert_eq!(
Err(InstructionError::MissingRequiredSignature),
process_instruction(&program_id, &mut keyed_accounts, &ix_data)
);
// Case: Finalize
let mut keyed_accounts = vec![
KeyedAccount::new(&program_key, true, &mut program_account),
KeyedAccount::new(&rent_key, false, &mut rent_account),
];
assert_eq!(
Ok(()),
process_instruction(&program_id, &mut keyed_accounts, &ix_data)
);
assert!(keyed_accounts[0].account.executable);
// Case: Finalize
program_account.data[0] = 0; // bad elf
let mut keyed_accounts = vec![
KeyedAccount::new(&program_key, true, &mut program_account),
KeyedAccount::new(&rent_key, false, &mut rent_account),
];
assert_eq!(
Err(InstructionError::InvalidAccountData),
process_instruction(&program_id, &mut keyed_accounts, &ix_data)
);
} | rust_cleaned_test_functions.jsonl/113969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 936
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
15897,
22139,
70616,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
2025,
3097,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
8016,
3097,
284,
8016,
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_highest_pair_wins() {
test(
&vec!["4S 2H 6S 2D JH", "2S 4H 6C 4D JD"],
&vec!["2S 4H 6C 4D JD"],
)
} | rust_cleaned_test_functions.jsonl/121263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
7504,
14445,
1670,
1330,
368,
341,
262,
1273,
1006,
286,
609,
4083,
0,
1183,
19,
50,
220,
17,
39,
220,
21,
50,
220,
17,
35,
619,
39,
497,
330,
17,
50,
220,
19,
39,
220,
21,
34,
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_delete_between_unsorted_sorted() -> Result<(), IndexError> {
let mut x: MyVec<usize> = MyVec::new();
let res = x.delete_between_unsorted(&1, &2);
assert_eq!(res, vec![]);
for v in vec![7, 1, 9, 11, 2, 3, 1, 5, 7, 11, 1, 6].iter() {
let len = x.len();
List::insert(&mut x, len, *v)?;
}
x.sort();
let res = x.delete_between_unsorted(&7, &4);
assert_eq!(res, vec![]);
let mut res = x.delete_between_unsorted(&3, &9);
res.sort();
for (idx, v) in vec![3, 5, 6, 7, 7, 9].iter().enumerate() {
assert_eq!(*List::get(&res, idx)?, *v);
}
for (idx, v) in vec![1, 1, 1, 2, 11, 11].iter().enumerate() {
assert_eq!(*List::get(&x, idx)?, *v);
}
let mut res = x.delete_between_unsorted(&0, &11);
res.sort();
assert_eq!(res, vec![1, 1, 1, 2, 11, 11]);
assert!(x.is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/24012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
48302,
4907,
28298,
41277,
368,
1464,
5714,
68843,
60203,
29,
341,
262,
1077,
5206,
856,
25,
3017,
10050,
90244,
29,
284,
3017,
10050,
486,
931,
543,
262,
1077,
592,
284,
856,
7440,
48302,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_read_btf_type_restrict() {
let endianness = Endianness::default();
let data: &[u8] = &[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x04, 0x00, 0x00, 0x00,
];
match unsafe { BtfType::read(data, endianness) } {
Ok(BtfType::Restrict(_)) => {}
Ok(t) => panic!("expected restrict type gpt {:#?}", t),
Err(_) => panic!("unexpected error"),
}
} | rust_cleaned_test_functions.jsonl/98496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
880,
8935,
1819,
97684,
368,
341,
286,
1077,
835,
72,
82033,
284,
3972,
72,
82033,
486,
2258,
543,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
87,
15,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_create_account() {
let account = create_account(42, &EpochSchedule::default());
let epoch_schedule = EpochSchedule::from_account(&account).unwrap();
assert_eq!(epoch_schedule, EpochSchedule::default());
} | rust_cleaned_test_functions.jsonl/10013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
13500,
368,
341,
286,
1077,
2692,
284,
1855,
13500,
7,
19,
17,
11,
609,
44338,
32210,
486,
2258,
1423,
286,
1077,
16342,
34530,
284,
87379,
32210,
486,
1499,
13500,
2099,
4608,
568,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decoder_invalid_escape() {
let mut d = HZEncoding.decoder();
assert_feed_ok!(d, b"#A", b"", "#A");
assert_feed_err!(d, b"", b"~", b"xy", "");
assert_feed_ok!(d, b"#B", b"", "#B");
assert_feed_ok!(d, b"", b"~", "");
assert_feed_err!(d, b"", b"", b"xy", "");
assert_feed_ok!(d, b"#C~{#D", b"", "#C\uff24");
assert_feed_err!(d, b"", b"~", b"xy", "");
assert_feed_ok!(d, b"#E", b"", "\uff25"); // does not reset to ASCII
assert_feed_ok!(d, b"", b"~", "");
assert_feed_err!(d, b"", b"", b"xy", "");
assert_feed_ok!(d, b"#F~}#G", b"", "\uff26#G");
assert_finish_ok!(d, "");
} | rust_cleaned_test_functions.jsonl/48124 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
31433,
21832,
368,
341,
286,
1077,
5206,
294,
284,
472,
57,
14690,
74047,
543,
286,
2060,
42390,
19817,
10297,
67,
11,
293,
57676,
32,
497,
293,
56323,
5869,
32,
797,
286,
2060,
42390,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_n_divergetd() {
let max_iter = 10;
assert_eq!(get_n_diverged(1.0, 0.0, max_iter), 3);
assert_eq!(get_n_diverged(0.0, 0.0, max_iter), max_iter as u8);
assert_eq!(get_n_diverged(0.0, 1.0, max_iter), max_iter as u8);
} | rust_cleaned_test_functions.jsonl/9442 | {
"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,
3062,
1089,
16237,
261,
455,
67,
368,
341,
197,
10217,
1932,
11723,
284,
220,
16,
15,
401,
197,
6948,
10714,
10297,
455,
1089,
16237,
51525,
7,
16,
13,
15,
11,
220,
15,
13,
15,
11,
1932,
117... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive() {
let cases = vec![
(
vec![Some(1), Some(2), Some(3)],
vec![Some(1), Some(2), Some(3)],
true,
),
(
vec![Some(1), Some(2), Some(3)],
vec![Some(1), Some(2), Some(4)],
false,
),
(
vec![Some(1), Some(2), None],
vec![Some(1), Some(2), None],
true,
),
(
vec![Some(1), None, Some(3)],
vec![Some(1), Some(2), None],
false,
),
(
vec![Some(1), None, None],
vec![Some(1), Some(2), None],
false,
),
];
for (lhs, rhs, expected) in cases {
let lhs = Int32Array::from(lhs).data();
let rhs = Int32Array::from(rhs).data();
test_equal(&lhs, &rhs, expected);
}
} | rust_cleaned_test_functions.jsonl/46941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 676
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
7486,
20703,
8373,
7,
16,
701,
4329,
7,
17,
701,
4329,
7,
18,
30749,
394,
7486,
20703,
8373,
7,
16,
701,
4329,
7,
17,
701,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_extra_predicate() {
libcnb_newtype!(
CapitalizedName,
CapitalizedNameError,
r"^[A-Z][a-z]*$",
|value| value != "Manuel"
);
assert!("Jonas".parse::<CapitalizedName>().is_ok());
assert_eq!(
"manuel".parse::<CapitalizedName>(),
Err(CapitalizedNameError::InvalidValue(String::from("manuel")))
);
assert_eq!(
"Manuel".parse::<CapitalizedName>(),
Err(CapitalizedNameError::InvalidValue(String::from("Manuel")))
);
} | rust_cleaned_test_functions.jsonl/10798 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31858,
97474,
368,
341,
286,
3051,
14271,
65,
5921,
1313,
33673,
310,
18374,
20167,
345,
310,
18374,
20167,
1454,
345,
310,
435,
1,
27736,
32,
11171,
1457,
64,
9141,
8465,
3,
756,
310,
760,
957,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concurrent_operations_auto_rebase() {
let test_env = TestEnvironment::default();
test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]);
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "contents").unwrap();
test_env.jj_cmd_success(&repo_path, &["describe", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
let op_id_hex = stdout[2..14].to_string();
test_env.jj_cmd_success(&repo_path, &["describe", "-m", "rewritten"]);
test_env.jj_cmd_success(
&repo_path,
&["new", "--at-op", &op_id_hex, "-m", "new child"],
);
// We should be informed about the concurrent modification
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "commit_id \" \" description"]);
insta::assert_snapshot!(stdout, @r###"
Concurrent modification detected, resolving automatically.
Rebased 1 descendant commits onto commits rewritten by other operation
o 4eeb7d76372418118a91c34f09e5e3936f0deeb5 new child
@ 14176aeadc0259b2150fc7374969e74b1552a498 rewritten
o 0000000000000000000000000000000000000000
"###);
} | rust_cleaned_test_functions.jsonl/63550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
3231,
57345,
27740,
1288,
3152,
368,
341,
262,
1077,
1273,
15879,
284,
3393,
12723,
486,
2258,
543,
262,
1273,
15879,
1169,
73,
11684,
18632,
8623,
15879,
9265,
12993,
1507,
609,
1183,
2327,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_real() {
let (sql, params) = Sqlite::build(Select::default().value(1.3f64.raw())).unwrap();
assert_eq!("SELECT 1.3", sql);
assert!(params.is_empty());
} | rust_cleaned_test_functions.jsonl/52924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
15266,
368,
341,
286,
1077,
320,
3544,
11,
3628,
8,
284,
7224,
632,
486,
5834,
7,
3379,
486,
2258,
1005,
957,
7,
16,
13,
18,
69,
21,
19,
18152,
34670,
15454,
543,
286,
2060,
10714,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_chained_cname_lookup() {
let resp_query = Query::query(Name::from_str("www.example.com.").unwrap(), RecordType::A);
let cname_record = cname_record(
Name::from_str("www.example.com.").unwrap(),
Name::from_str("v4.example.com.").unwrap(),
);
let v4_record = v4_record(
Name::from_str("v4.example.com.").unwrap(),
Ipv4Addr::new(93, 184, 216, 34),
);
let message1 = message(resp_query.clone(), vec![cname_record], vec![], vec![]);
let message2 = message(resp_query, vec![v4_record], vec![], vec![]);
let client: MockClientHandle<_, ResolveError> =
MockClientHandle::mock(vec![Ok(message2.into()), Ok(message1.into())]);
let lookup = LookupFuture::lookup(
vec![Name::from_str("www.example.com.").unwrap()],
RecordType::A,
Default::default(),
CachingClient::new(0, client, false),
);
let mut io_loop = Runtime::new().unwrap();
let lookup = io_loop.block_on(lookup).unwrap();
assert_eq!(
*lookup.iter().next().unwrap(),
RData::A(Ipv4Addr::new(93, 184, 216, 34))
);
} | rust_cleaned_test_functions.jsonl/21990 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 517
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2627,
666,
606,
27464,
368,
341,
262,
1077,
9039,
5738,
284,
11361,
486,
1631,
21182,
486,
1499,
2895,
445,
2136,
7724,
905,
98401,
15454,
1507,
13583,
929,
486,
32,
317,
262,
1077,
78514,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inputs_with_offset() {
assert_eq!(
CommandLineInputs::FileAndOffset(("-".to_string(), 8, None)),
parse_inputs(&MockOptions::new(vec!["+10"], vec![])).unwrap()
);
// offset must start with "+" if no input is specified.
assert_eq!(
CommandLineInputs::FileNames(vec!["10".to_string()]),
parse_inputs(&MockOptions::new(vec!["10"], vec![""])).unwrap()
);
assert_eq!(
CommandLineInputs::FileNames(vec!["+10a".to_string()]),
parse_inputs(&MockOptions::new(vec!["+10a"], vec![""])).unwrap()
);
assert_eq!(
CommandLineInputs::FileNames(vec!["+10".to_string()]),
parse_inputs(&MockOptions::new(vec!["+10"], vec!["j"])).unwrap()
);
assert_eq!(
CommandLineInputs::FileNames(vec!["+10".to_string()]),
parse_inputs(&MockOptions::new(vec!["+10"], vec!["o", "v"])).unwrap()
);
assert_eq!(
CommandLineInputs::FileAndOffset(("file1".to_string(), 8, None)),
parse_inputs(&MockOptions::new(vec!["file1", "+10"], vec![])).unwrap()
);
// offset does not need to start with "+" if a filename is included.
assert_eq!(
CommandLineInputs::FileAndOffset(("file1".to_string(), 8, None)),
parse_inputs(&MockOptions::new(vec!["file1", "10"], vec![])).unwrap()
);
assert_eq!(
CommandLineInputs::FileNames(vec!["file1".to_string(), "+10a".to_string()]),
parse_inputs(&MockOptions::new(vec!["file1", "+10a"], vec![""])).unwrap()
);
assert_eq!(
CommandLineInputs::FileNames(vec!["file1".to_string(), "+10".to_string()]),
parse_inputs(&MockOptions::new(vec!["file1", "+10"], vec!["j"])).unwrap()
);
// offset must be last on the command line
assert_eq!(
CommandLineInputs::FileNames(vec!["+10".to_string(), "file1".to_string()]),
parse_inputs(&MockOptions::new(vec!["+10", "file1"], vec![""])).unwrap()
);
} | rust_cleaned_test_functions.jsonl/58007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1078
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
28557,
6615,
6917,
368,
341,
1789,
286,
2060,
10714,
33673,
310,
78218,
31946,
486,
1703,
3036,
6446,
7,
13645,
3263,
983,
3904,
1507,
220,
23,
11,
2240,
6965,
310,
4715,
28557,
2099,
11571... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decoder_decode_header_too_many() {
let buffer = "RTSP/2.0 200 OK\r\n\
A: 1\r\n\
B: 2\r\n\
\r\n";
let config = ConfigBuilder::new().with_header_max_count(1).build();
let mut decoder = Decoder::with_config(config);
let (result, bytes_decoded) = decoder.decode(buffer);
assert_ne!(bytes_decoded, buffer.len());
assert_eq!(result, DecodeResult::Error(DecodeError::TooManyHeaders));
} | rust_cleaned_test_functions.jsonl/123058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
15227,
8757,
2346,
78,
22101,
368,
341,
286,
1077,
4147,
284,
330,
5350,
4592,
14,
17,
13,
15,
220,
17,
15,
15,
10402,
12016,
1699,
5661,
2549,
362,
25,
220,
16,
12016,
1699,
5661,
2549... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_2() {
let input = "mask = 000000000000000000000000000000X1001X
mem[42] = 100
mask = 00000000000000000000000000000000X0XX
mem[26] = 1";
let memory = apply_memory_address_decoder(input);
assert_eq!(10, memory.len());
(58..=59).for_each(|address| assert_eq!(&100, memory.get(&address).unwrap()));
(16..=19).for_each(|address| assert_eq!(&1, memory.get(&address).unwrap()));
(24..=27).for_each(|address| assert_eq!(&1, memory.get(&address).unwrap()));
} | rust_cleaned_test_functions.jsonl/90592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
17,
368,
341,
286,
1077,
1946,
284,
330,
11258,
284,
220,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_tuple_to_vec() {
let gil = Python::acquire_gil();
let py = gil.python();
let v: Vec<i32> = py.eval("(1, 2)", None, None).unwrap().extract().unwrap();
assert!(v == [1, 2]);
} | rust_cleaned_test_functions.jsonl/47427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
21773,
2346,
13251,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
25,
11312,
21897,
18,
17,
29,
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_cast_range_u8_max() {
assert_eq!(u8::MAX.to_int(), Some(u8::MAX as int));
assert_eq!(u8::MAX.to_i8(), None);
assert_eq!(u8::MAX.to_i16(), Some(u8::MAX as i16));
assert_eq!(u8::MAX.to_i32(), Some(u8::MAX as i32));
assert_eq!(u8::MAX.to_i64(), Some(u8::MAX as i64));
assert_eq!(u8::MAX.to_uint(), Some(u8::MAX as uint));
assert_eq!(u8::MAX.to_u8(), Some(u8::MAX as u8));
assert_eq!(u8::MAX.to_u16(), Some(u8::MAX as u16));
assert_eq!(u8::MAX.to_u32(), Some(u8::MAX as u32));
assert_eq!(u8::MAX.to_u64(), Some(u8::MAX as u64));
} | rust_cleaned_test_functions.jsonl/23659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
9698,
7300,
23,
6345,
368,
341,
286,
2060,
10714,
10297,
84,
23,
486,
10586,
2389,
4042,
1507,
220,
4329,
8154,
23,
486,
10586,
438,
526,
1106,
286,
2060,
10714,
10297,
84,
23,
486,
10586,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_allocations() {
let alice_pubkey = solana_sdk::pubkey::new_rand();
let allocation = Allocation {
recipient: alice_pubkey.to_string(),
amount: 42,
lockup_date: "".to_string(),
};
let file = NamedTempFile::new().unwrap();
let input_csv = file.path().to_str().unwrap().to_string();
let mut wtr = csv::WriterBuilder::new().from_writer(file);
wtr.serialize(&allocation).unwrap();
wtr.flush().unwrap();
assert_eq!(
read_allocations(&input_csv, None, false, true).unwrap(),
vec![allocation]
);
let allocation_sol = Allocation {
recipient: alice_pubkey.to_string(),
amount: sol_to_lamports(42.0),
lockup_date: "".to_string(),
};
assert_eq!(
read_allocations(&input_csv, None, true, true).unwrap(),
vec![allocation_sol.clone()]
);
assert_eq!(
read_allocations(&input_csv, None, false, false).unwrap(),
vec![allocation_sol.clone()]
);
assert_eq!(
read_allocations(&input_csv, None, true, false).unwrap(),
vec![allocation_sol]
);
} | rust_cleaned_test_functions.jsonl/18254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 639
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
14802,
804,
368,
341,
286,
1077,
70433,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
23757,
284,
72667,
341,
310,
21713,
25,
70433,
34014,
792,
2389,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_domain_serde() {
assert_eq!(serde_json::to_string(&ConfigDomain::General).unwrap(), "\"general\"");
let d = ConfigDomainExternal::UserOverride(ViewId(1));
assert_eq!(serde_json::to_string(&d).unwrap(), "{\"user_override\":\"view-id-1\"}");
let d = ConfigDomain::Language("Swift".into());
assert_eq!(serde_json::to_string(&d).unwrap(), "{\"language\":\"Swift\"}");
} | rust_cleaned_test_functions.jsonl/105406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
20111,
75861,
450,
368,
341,
286,
2060,
10714,
10297,
47024,
9455,
486,
983,
3904,
2099,
2648,
13636,
486,
15415,
568,
15454,
1507,
15898,
24595,
88385,
286,
1077,
294,
284,
5532,
13636,
25913... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long_tuple() {
let yaml = indoc! {"
---
[0, 0, 0]
"};
let expected = "invalid length 3, expected sequence of 2 elements at line 2 column 1";
test_error::<(u8, u8)>(yaml, expected);
} | rust_cleaned_test_functions.jsonl/45576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
21773,
368,
341,
262,
1077,
32246,
284,
1257,
509,
0,
314,
698,
286,
53923,
286,
508,
15,
11,
220,
15,
11,
220,
15,
921,
262,
330,
2440,
262,
1077,
3601,
284,
330,
11808,
3084,
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_str_non_collisions() {
assert!(!s_s_collide("/a", "/b"));
assert!(!s_s_collide("/a/b", "/a"));
assert!(!s_s_collide("/a/b", "/a/c"));
assert!(!s_s_collide("/a/hello", "/a/c"));
assert!(!s_s_collide("/hello", "/a/c"));
assert!(!s_s_collide("/hello/there", "/hello/there/guy"));
assert!(!s_s_collide("/b<a>/there", "/hi/there"));
assert!(!s_s_collide("/<a>/<b>c", "/hi/person"));
assert!(!s_s_collide("/<a>/<b>cd", "/hi/<a>e"));
assert!(!s_s_collide("/a<a>/<b>", "/b<b>/<a>"));
assert!(!s_s_collide("/a/<b>", "/b/<b>"));
assert!(!s_s_collide("/a<a>/<b>", "/b/<b>"));
assert!(!s_s_collide("/a", "/b"));
assert!(!s_s_collide("/a/b", "/a"));
assert!(!s_s_collide("/a/b", "/a/c"));
assert!(!s_s_collide("/a/hello", "/a/c"));
assert!(!s_s_collide("/hello", "/a/c"));
assert!(!s_s_collide("/hello/there", "/hello/there/guy"));
assert!(!s_s_collide("/b<a>/there", "/hi/there"));
assert!(!s_s_collide("/<a>/<b>c", "/hi/person"));
assert!(!s_s_collide("/<a>/<b>cd", "/hi/<a>e"));
assert!(!s_s_collide("/a<a>/<b>", "/b<b>/<a>"));
assert!(!s_s_collide("/a/<b>", "/b/<b>"));
assert!(!s_s_collide("/a<a>/<b>", "/b/<b>"));
assert!(!s_s_collide("/a", "/b"));
assert!(!s_s_collide("/a/b", "/a"));
assert!(!s_s_collide("/a/b", "/a/c"));
assert!(!s_s_collide("/a/hello", "/a/c"));
assert!(!s_s_collide("/hello", "/a/c"));
assert!(!s_s_collide("/hello/there", "/hello/there/guy"));
assert!(!s_s_collide("/b<a>/there", "/hi/there"));
assert!(!s_s_collide("/<a>/<b>c", "/hi/person"));
assert!(!s_s_collide("/<a>/<b>cd", "/hi/<a>e"));
assert!(!s_s_collide("/a<a>/<b>", "/b<b>/<a>"));
assert!(!s_s_collide("/a/<b>", "/b/<b>"));
assert!(!s_s_collide("/a<a>/<b>", "/b/<b>"));
assert!(!s_s_collide("/<a..>", "/"));
assert!(!s_s_collide("/hi/<a..>", "/hi/"));
assert!(!s_s_collide("/a/hi/<a..>", "/a/hi/"));
} | rust_cleaned_test_functions.jsonl/62160 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
21637,
43597,
6805,
368,
341,
286,
2060,
0,
3471,
82,
643,
43597,
577,
4283,
64,
497,
3521,
65,
4010,
286,
2060,
0,
3471,
82,
643,
43597,
577,
4283,
64,
3470,
497,
3521,
64,
4010,
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_hex_str_arg() {
let test_cases = vec![
(Some(b"abc".to_vec()), Some(b"616263".to_vec())),
(
Some("你好".as_bytes().to_vec()),
Some(b"E4BDA0E5A5BD".to_vec()),
),
(None, None),
];
for (arg, expect_output) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate(ScalarFuncSig::HexStrArg)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/10172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
2895,
6057,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
8373,
1883,
1,
13683,
3263,
983,
13251,
11858,
4329,
1883,
1,
21,
16,
21,
17,
21,
18,
3263,
983,
13251,
73727,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.