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_get_pk() -> Result<()>{
// configure client_api
let ch_api: ClearingHouseApiClient = ApiClient::new(CH_API);
// run the test
let jwks = ch_api.get_pk()?;
println!("jwks: {:#?}", jwks);
// The returned payload should contain an RSA key
if let biscuit::jwk::AlgorithmParameters::RSA(params) = &jwks.keys[0].algorithm{
println!("e: {:#?}", params.e);
println!("n: {:#?}", params.n);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/85913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
33321,
368,
1464,
5714,
71698,
515,
262,
442,
14411,
2943,
11697,
198,
262,
1077,
521,
11697,
25,
12023,
287,
28607,
56584,
284,
13443,
2959,
486,
931,
82934,
11415,
626,
262,
442,
1598,
279... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_str_to_c_str() {
"".to_c_str().with_ref(|buf| {
unsafe {
assert_eq!(*buf.offset(0), 0);
}
});
"hello".to_c_str().with_ref(|buf| {
unsafe {
assert_eq!(*buf.offset(0), 'h' as libc::c_char);
assert_eq!(*buf.offset(1), 'e' as libc::c_char);
assert_eq!(*buf.offset(2), 'l' as libc::c_char);
assert_eq!(*buf.offset(3), 'l' as libc::c_char);
assert_eq!(*buf.offset(4), 'o' as libc::c_char);
assert_eq!(*buf.offset(5), 0);
}
})
} | rust_cleaned_test_functions.jsonl/27795 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
2346,
666,
2895,
368,
341,
286,
44907,
983,
666,
2895,
1005,
4197,
7793,
22428,
5909,
91,
341,
310,
19860,
341,
394,
2060,
10714,
0,
4071,
5909,
14760,
7,
15,
701,
220,
15,
317,
310,
456... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_python_version_pypy() {
assert_eq!(
format_python_version(
"\
Python 3.7.9 (7e6e2bb30ac5fbdbd443619cae28c51d5c162a02, Nov 24 2020, 10:03:59)
[PyPy 7.3.3-beta0 with GCC 10.2.0]",
"v${major}.${minor}.${patch}"
),
Some("v3.7.9".to_string())
);
} | rust_cleaned_test_functions.jsonl/99460 | {
"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,
8955,
55869,
9438,
620,
54234,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
55869,
9438,
1006,
394,
93317,
30280,
220,
18,
13,
22,
13,
24,
320,
22,
68,
21,
68,
17,
6066,
18,
15,
580,
20,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize() {
let deserializer = BytesDeserializer::default();
let data = Vec::from("data");
let mut cur = Cursor::new(data.clone());
let mut buf = Vec::new();
deserializer.deserialize_to("topic", &mut cur, &mut buf).unwrap();
assert_eq!(cur.position(), 4);
assert_eq!(&buf, &data);
cur.set_position(0);
assert_eq!(deserializer.deserialize("topic", &mut cur).unwrap(), data);
} | rust_cleaned_test_functions.jsonl/132229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
368,
341,
286,
1077,
939,
41939,
284,
30024,
80097,
486,
2258,
543,
286,
1077,
821,
284,
11312,
486,
1499,
445,
691,
797,
286,
1077,
5206,
2847,
284,
28067,
486,
931,
2592,
15997,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug() {
assert_eq!(
format!("{:?}", Fp6::zero()),
"0 + 0*u + 0*u^2 + 0*u^3 + 0*u^4 + 0*u^5"
);
assert_eq!(
format!("{:?}", Fp6::one()),
"1 + 0*u + 0*u^2 + 0*u^3 + 0*u^4 + 0*u^5"
);
assert_eq!(
format!("{:?}", Fp6::new([1, 2, 3, 4, 5, 6])),
"1 + 2*u + 3*u^2 + 4*u^3 + 5*u^4 + 6*u^5"
);
let a = Fp6::one().neg();
assert_eq!(
format!("{:?}", a),
"18446744069414584320 + 0*u + 0*u^2 + 0*u^3 + 0*u^4 + 0*u^5"
);
} | rust_cleaned_test_functions.jsonl/132378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
88928,
25,
52652,
434,
79,
21,
486,
14154,
14702,
310,
330,
15,
488,
220,
15,
59121,
488,
220,
15,
59121,
61,
17,
488,
220,
15,
59121,
61,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ifnot_untaken() {
let template = compile("{{ if not null }}Hello!{{ endif }}");
let context = context();
let template_registry = other_templates();
let formatter_registry = formatters();
let string = template
.render(&context, &template_registry, &formatter_registry)
.unwrap();
assert_eq!("Hello!", &string);
} | rust_cleaned_test_functions.jsonl/2378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
1921,
62,
3850,
3366,
368,
972,
286,
1077,
3811,
284,
19192,
445,
2979,
421,
537,
845,
3869,
9707,
0,
2979,
12330,
3869,
2815,
286,
1077,
2266,
284,
2266,
1647,
286,
1077,
3811,
50650,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_swap_serde() {
global::set_local_chain_type(global::ChainTypes::Floonet);
// Seller context
let ctx_sell_str = read_to_string("swap_test/context_sell.json").unwrap();
let ctx_sell: Context = serde_json::from_str(&ctx_sell_str).unwrap();
assert_eq!(
serde_json::to_string_pretty(&ctx_sell).unwrap(),
ctx_sell_str
);
// Buyer context
let ctx_buy_str = read_to_string("swap_test/context_buy.json").unwrap();
let ctx_buy: Context = serde_json::from_str(&ctx_buy_str).unwrap();
assert_eq!(serde_json::to_string_pretty(&ctx_buy).unwrap(), ctx_buy_str);
// Seller's swap state in different stages
for i in 0..6 {
println!("TRY SELL {}", i);
let swap_str = read_to_string(format!("swap_test/swap_sell_{}.json", i + 1)).unwrap();
let swap: Swap = serde_json::from_str(&swap_str).unwrap();
assert_eq!(serde_json::to_string_pretty(&swap).unwrap(), swap_str);
println!("OK SELL {}", i);
}
// Buyer's swap state in different stages
for i in 0..3 {
println!("TRY BUY {}", i);
let swap_str = read_to_string(format!("swap_test/swap_buy_{}.json", i + 1)).unwrap();
let swap: Swap = serde_json::from_str(&swap_str).unwrap();
assert_eq!(serde_json::to_string_pretty(&swap).unwrap(), swap_str);
println!("OK BUY {}", i);
}
// Messages
for i in 0..4 {
println!("TRY MSG {}", i);
let message_str = read_to_string(format!("swap_test/message_{}.json", i + 1)).unwrap();
let message: Message = serde_json::from_str(&message_str).unwrap();
assert_eq!(serde_json::to_string_pretty(&message).unwrap(), message_str);
println!("OK MSG {}", i);
}
} | rust_cleaned_test_functions.jsonl/22240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 684
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40991,
75861,
450,
368,
341,
197,
18842,
486,
746,
13564,
30583,
1819,
31951,
486,
18837,
4173,
486,
37,
31335,
295,
626,
197,
197,
322,
48232,
2266,
198,
197,
10217,
5635,
71072,
2895,
284,
1349,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_get_quality_scores() -> Result<(), Box<dyn std::error::Error>> {
fn t(mut src: &[u8], expected: &sam::record::QualityScores) -> io::Result<()> {
let mut actual = sam::record::QualityScores::default();
get_quality_scores(&mut src, &mut actual, expected.len())?;
assert_eq!(&actual, expected);
Ok(())
}
t(&[], &sam::record::QualityScores::default())?;
t(&[0x2d, 0x23, 0x2b, 0x32], &"NDLS".parse()?)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/75436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
55074,
27198,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
286,
5168,
259,
70305,
2286,
25,
44590,
84,
23,
1125,
3601,
25,
609,
45996,
486,
8548,
486,
33074,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_components_debug() {
let path = Path::new("/tmp");
let mut components = path.components();
let expected = "Components([RootDir, Normal(\"tmp\")])";
let actual = format!("{:?}", components);
assert_eq!(expected, actual);
let _ = components.next().unwrap();
let expected = "Components([Normal(\"tmp\")])";
let actual = format!("{:?}", components);
assert_eq!(expected, actual);
let _ = components.next().unwrap();
let expected = "Components([])";
let actual = format!("{:?}", components);
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/19659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23258,
15446,
368,
341,
286,
1077,
1815,
284,
7933,
486,
931,
4283,
5173,
3071,
286,
1077,
5206,
6813,
284,
1815,
20040,
1428,
286,
1077,
3601,
284,
330,
10443,
2561,
8439,
6184,
11,
18437,
36014,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_headers_empty() {
let empty = HashMap::new();
assert_eq!(&empty, Table::find_first(TABLE_TD).unwrap().headers());
assert_eq!(&empty, Table::find_first(TABLE_TD_TD).unwrap().headers());
} | rust_cleaned_test_functions.jsonl/47586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26719,
15124,
368,
341,
286,
1077,
4287,
284,
10528,
486,
931,
543,
286,
2060,
10714,
0,
2099,
3194,
11,
6633,
486,
3903,
12978,
83006,
95862,
568,
15454,
1005,
7713,
1423,
286,
2060,
10714,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_upgrade_nonexisting_client() {
let client_id = ClientId::from_str("mockclient1").unwrap();
let signer = get_dummy_account_id();
let ctx = MockContext::default().with_client(&client_id, Height::new(0, 42));
let buf: Vec<u8> = Vec::new();
let buf2: Vec<u8> = Vec::new();
let c_bytes = CommitmentProofBytes::from(buf);
let cs_bytes = CommitmentProofBytes::from(buf2);
let msg = MsgUpgradeAnyClient {
client_id: ClientId::from_str("nonexistingclient").unwrap(),
client_state: MockClientState(MockHeader::new(Height::new(1, 26))).into(),
consensus_state: MockConsensusState::new(MockHeader::new(Height::new(1, 26))).into(),
proof_upgrade_client: MerkleProof::try_from(c_bytes).unwrap(),
proof_upgrade_consensus_state: MerkleProof::try_from(cs_bytes).unwrap(),
signer,
};
let output = dispatch(&ctx, ClientMsg::UpgradeClient(msg.clone()));
match output {
Err(Error(ErrorDetail::ClientNotFound(e), _)) => {
assert_eq!(e.client_id, msg.client_id);
}
_ => {
panic!("expected ClientNotFound error, instead got {:?}", output);
}
}
} | rust_cleaned_test_functions.jsonl/33742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 604
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67794,
21637,
36895,
8179,
368,
341,
286,
1077,
2943,
842,
284,
8423,
764,
486,
1499,
2895,
445,
16712,
2972,
16,
1827,
15454,
543,
286,
1077,
70039,
284,
633,
60321,
13500,
842,
1428,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_encode_rpn_response() {
let command = MuxCommand {
params: MuxCommandParams::RemotePortNegotiation(RemotePortNegotiationParams {
dlci: DLCI::try_from(5).unwrap(),
port_values: None,
}),
command_response: CommandResponse::Response,
};
let mut buf = vec![0; command.encoded_len()];
assert!(command.encode(&mut buf[..]).is_ok());
let expected = vec![
0b10010001,
0b00000011,
0b00010111, // Payload = RPN Command Params.
];
assert_eq!(buf, expected);
} | rust_cleaned_test_functions.jsonl/107781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
1710,
19958,
9655,
368,
341,
286,
1077,
3210,
284,
386,
2200,
4062,
341,
310,
3628,
25,
386,
2200,
4062,
4870,
486,
24703,
7084,
47800,
354,
7101,
2785,
336,
1272,
7084,
47800,
354,
7101,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser_auth_methods() {
let buf = vec![0x00, 0x02, 0x03, 0x01];
let (_, methods) = parser_auth_methods(buf.as_ref()).unwrap();
println!("Request: {:#?}", methods);
} | rust_cleaned_test_functions.jsonl/15185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
14014,
36084,
368,
341,
262,
1077,
6607,
220,
284,
7486,
20703,
15,
87,
15,
15,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
16,
935,
262,
1077,
39464,
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_create_store_blob() {
let content = "Hello, World";
let store = "blob 12\0Hello, World";
assert_eq!(store, create_store(content));
} | rust_cleaned_test_functions.jsonl/101572 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
14809,
45908,
368,
341,
286,
1077,
2213,
284,
330,
9707,
11,
4337,
876,
286,
1077,
3553,
284,
330,
35112,
220,
16,
17,
59,
15,
9707,
11,
4337,
876,
286,
2060,
10714,
10297,
4314,
11,
185... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decode_cmn_w_reg() {
assert_eq!(
decode_32(0xeb1c0f41),
Instruction::CMN_reg {
params: Reg2ShiftNoSetFlagsParams {
rn: Reg::R12,
rm: Reg::R1,
shift_n: 1,
shift_t: SRType::LSL,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64832 | {
"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,
15227,
666,
21775,
1670,
4920,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
54468,
16,
66,
15,
69,
19,
16,
1326,
286,
29051,
486,
9985,
45,
4920,
341,
310,
3628,
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_port_type() {
assert_eq!(
PortType::from(fnet_interfaces::DeviceClass::Loopback(fnet_interfaces::Empty {})),
PortType::Loopback
);
assert_eq!(
PortType::from(fnet_interfaces::DeviceClass::Device(
fidl_fuchsia_hardware_network::DeviceClass::Ethernet
)),
PortType::Ethernet
);
assert_eq!(
PortType::from(fnet_interfaces::DeviceClass::Device(
fidl_fuchsia_hardware_network::DeviceClass::Wlan
)),
PortType::WiFi
);
assert_eq!(
PortType::from(fnet_interfaces::DeviceClass::Device(
fidl_fuchsia_hardware_network::DeviceClass::WlanAp
)),
PortType::WiFi
);
assert_eq!(
PortType::from(fnet_interfaces::DeviceClass::Device(
fidl_fuchsia_hardware_network::DeviceClass::Virtual
)),
PortType::Unknown
);
} | rust_cleaned_test_functions.jsonl/64392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 558
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8716,
1819,
368,
341,
286,
2060,
10714,
33673,
310,
5776,
929,
486,
1499,
955,
4711,
72960,
486,
6985,
1957,
486,
14620,
1419,
955,
4711,
72960,
486,
3522,
4687,
6965,
310,
5776,
929,
486,
14620,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rng_boxed_trait() {
use crate::distributions::{Distribution, Standard};
let rng = rng(110);
let mut r = Box::new(rng) as Box<dyn RngCore>;
r.next_u32();
r.gen::<i32>();
assert_eq!(r.gen_range(0..1), 0);
let _c: u8 = Standard.sample(&mut r);
} | rust_cleaned_test_functions.jsonl/10503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66849,
10194,
291,
78491,
368,
341,
286,
990,
17717,
486,
67,
17994,
22964,
62377,
11,
11766,
2440,
286,
1077,
28422,
284,
28422,
7,
16,
16,
15,
317,
286,
1077,
5206,
435,
284,
8261,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_touch_set_ymdhm_time() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "test_touch_set_ymdhm_time";
ucmd.args(&["-t", "1501011234", file])
.succeeds()
.no_stderr();
assert!(at.file_exists(file));
let start_of_year = str_to_filetime("%y%m%d%H%M", "1501010000");
let (atime, mtime) = get_file_times(&at, file);
assert_eq!(atime, mtime);
assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240);
assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240);
} | rust_cleaned_test_functions.jsonl/41020 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60840,
2602,
62,
1600,
30621,
76,
3009,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
284,
330,
1944,
60840,
2602,
62,
1600,
3062... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append_vec_new_bad_size() {
let path = get_append_vec_path("test_append_vec_new_bad_size");
let _av = AppendVec::new(&path.path, true, 0);
} | rust_cleaned_test_functions.jsonl/5410 | {
"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,
26041,
13251,
5921,
34199,
2368,
368,
341,
286,
1077,
1815,
284,
633,
26041,
13251,
2638,
445,
1944,
26041,
13251,
5921,
34199,
2368,
797,
286,
1077,
716,
402,
284,
29807,
10050,
486,
931,
2099,
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 |
#[test]
fn test_calculate_stake_weighted_timestamp_levels() {
let epoch_start_timestamp: UnixTimestamp = 1_578_909_061;
let slot = 20;
let slot_duration = Duration::from_millis(400);
let poh_offset = (slot * slot_duration).as_secs();
let max_allowable_drift_percentage_25 = 25;
let allowable_drift_25 = MaxAllowableDrift {
fast: max_allowable_drift_percentage_25,
slow: max_allowable_drift_percentage_25,
};
let max_allowable_drift_percentage_50 = 50;
let allowable_drift_50 = MaxAllowableDrift {
fast: max_allowable_drift_percentage_50,
slow: max_allowable_drift_percentage_50,
};
let acceptable_delta_25 =
(max_allowable_drift_percentage_25 * poh_offset as u32 / 100) as i64;
let acceptable_delta_50 =
(max_allowable_drift_percentage_50 * poh_offset as u32 / 100) as i64;
assert!(acceptable_delta_50 > acceptable_delta_25 + 1);
let poh_estimate = epoch_start_timestamp + poh_offset as i64;
let pubkey0 = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_sdk::pubkey::new_rand();
let pubkey2 = solana_sdk::pubkey::new_rand();
let stakes: HashMap<Pubkey, (u64, Account)> = [
(
pubkey0,
(
sol_to_lamports(1_000_000.0),
Account::new(1, 0, &Pubkey::default()),
),
),
(
pubkey1,
(
sol_to_lamports(1_000_000.0),
Account::new(1, 0, &Pubkey::default()),
),
),
(
pubkey2,
(
sol_to_lamports(1_000_000.0),
Account::new(1, 0, &Pubkey::default()),
),
),
]
.iter()
.cloned()
.collect();
let unique_timestamps: HashMap<Pubkey, (Slot, UnixTimestamp)> = [
(
pubkey0,
(slot as u64, poh_estimate + acceptable_delta_25 + 1),
),
(
pubkey1,
(slot as u64, poh_estimate + acceptable_delta_25 + 1),
),
(
pubkey2,
(slot as u64, poh_estimate + acceptable_delta_25 + 1),
),
]
.iter()
.cloned()
.collect();
let bounded = calculate_stake_weighted_timestamp(
&unique_timestamps,
&stakes,
slot as Slot,
slot_duration,
Some((0, epoch_start_timestamp)),
allowable_drift_25,
true,
)
.unwrap();
assert_eq!(bounded, poh_estimate + acceptable_delta_25);
let bounded = calculate_stake_weighted_timestamp(
&unique_timestamps,
&stakes,
slot as Slot,
slot_duration,
Some((0, epoch_start_timestamp)),
allowable_drift_50,
true,
)
.unwrap();
assert_eq!(bounded, poh_estimate + acceptable_delta_25 + 1);
let unique_timestamps: HashMap<Pubkey, (Slot, UnixTimestamp)> = [
(
pubkey0,
(slot as u64, poh_estimate + acceptable_delta_50 + 1),
),
(
pubkey1,
(slot as u64, poh_estimate + acceptable_delta_50 + 1),
),
(
pubkey2,
(slot as u64, poh_estimate + acceptable_delta_50 + 1),
),
]
.iter()
.cloned()
.collect();
let bounded = calculate_stake_weighted_timestamp(
&unique_timestamps,
&stakes,
slot as Slot,
slot_duration,
Some((0, epoch_start_timestamp)),
allowable_drift_25,
true,
)
.unwrap();
assert_eq!(bounded, poh_estimate + acceptable_delta_25);
let bounded = calculate_stake_weighted_timestamp(
&unique_timestamps,
&stakes,
slot as Slot,
slot_duration,
Some((0, epoch_start_timestamp)),
allowable_drift_50,
true,
)
.unwrap();
assert_eq!(bounded, poh_estimate + acceptable_delta_50);
} | rust_cleaned_test_functions.jsonl/62274 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
1261,
726,
15876,
291,
23073,
37819,
368,
341,
286,
1077,
16342,
4906,
23073,
25,
46995,
20812,
284,
220,
16,
62,
20,
22,
23,
62,
24,
15,
24,
62,
15,
21,
16,
280,
286,
1077,
94... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_default() {
new_ucmd!()
.args(&["--from=si", "--header"])
.pipe_in("header\n1K\n1.1M\n0.1G")
.run()
.stdout_is("header\n1000\n1100000\n100000000\n");
} | rust_cleaned_test_functions.jsonl/45995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
9993,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
1499,
28,
6321,
497,
14482,
2708,
14108,
286,
659,
13768,
1243,
445,
2708,
1699,
16,
42,
1699,
16,
13,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legal_moves_banmen_with_kaku_all_position_sente() {
let blank_banmen = Banmen([[Blank; 9]; 9]);
for x in 0..9 {
for y in 0..9 {
let mut banmen = blank_banmen.clone();
banmen.0[y][x] = SKaku;
assert_eq!(legal_moves_from_banmen(&Teban::Sente,&banmen),
Rule::legal_moves_from_banmen(Teban::Sente,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
);
}
}
} | rust_cleaned_test_functions.jsonl/81087 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
4698,
23557,
5705,
9661,
643,
6817,
368,
972,
10217,
10113,
880,
276,
5676,
284,
22730,
5676,
27119,
22770,
26,
220,
24,
5265,
220,
24,
55531,
2023,
856,
304,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_error_on_exceed() {
let types = [TestType::UnitTest, TestType::IntegrationTest, TestType::DocTest];
for test_type in types.iter() {
let result = time_test_failure_template(*test_type);
assert_eq!(result, TestResult::TrTimedFail);
}
// Check that for unknown tests thresholds aren't applied.
let result = time_test_failure_template(TestType::Unknown);
assert_eq!(result, TestResult::TrOk);
} | rust_cleaned_test_functions.jsonl/7709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
4470,
2702,
4635,
368,
341,
262,
1077,
4494,
284,
508,
2271,
929,
486,
97330,
11,
3393,
929,
486,
52464,
2271,
11,
3393,
929,
486,
9550,
2271,
4821,
262,
369,
1273,
1819,
304,
4494,
19471,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_new() {
let range = (Inv::from(0.4), Inv::from(1.0));
let (min, max) = Hypothesis::new(Inv::from(0.7), 0.1, range).range();
approx::assert_abs_diff_eq!(f64::from(min), 0.5);
approx::assert_abs_diff_eq!(f64::from(max), 0.9);
// inv_depth - factor * variance < min < inv_depth + factor * variance
let (min, max) = Hypothesis::new(Inv::from(0.3), 0.1, range).range();
approx::assert_abs_diff_eq!(f64::from(min), 0.4);
approx::assert_abs_diff_eq!(f64::from(max), 0.5);
// inv_depth - factor * variance < max < inv_depth + factor * variance
let (min, max) = Hypothesis::new(Inv::from(0.9), 0.1, range).range();
approx::assert_abs_diff_eq!(f64::from(min), 0.7);
approx::assert_abs_diff_eq!(f64::from(max), 1.0);
let flag = Flag::HypothesisOutOfSerchRange;
// inv_depth - factor * variance < inv_depth + factor * variance < min
assert_eq!(check_args(Inv::from(0.1), 0.1, range).unwrap_err(), flag);
// max < inv_depth - factor * variance < inv_depth + factor * variance
assert_eq!(check_args(Inv::from(1.5), 0.1, range).unwrap_err(), flag);
// inv_depth - factor * variance < inv_depth + factor * variance == min
assert_eq!(check_args(Inv::from(0.2), 0.1, range).unwrap_err(), flag);
// max == inv_depth - factor * variance < inv_depth + factor * variance
assert_eq!(check_args(Inv::from(1.2), 0.1, range).unwrap_err(), flag);
} | rust_cleaned_test_functions.jsonl/74877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 680
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
1789,
286,
1077,
2088,
284,
320,
15174,
486,
1499,
7,
15,
13,
19,
701,
18807,
486,
1499,
7,
16,
13,
15,
1106,
286,
1077,
320,
1065,
11,
1932,
8,
284,
38415,
78,
13189,
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_new_data(){
let weight1: f32 = 0.4;
let weight2: f32 = 0.2;
let weight3: f32 = 0.2;
let weight4: f32 = 0.2;
let raster1 = Raster::new("data/data1.asc".to_string());
let raster2 = Raster::new("data/data2.asc".to_string());
let raster3 = Raster::new("data/data3.asc".to_string());
let raster4 = Raster::new("data/data4.asc".to_string());
let result = Raster::new("data/result.asc".to_string());
let combination = Raster::<f32>{
data: weight1 * raster1.data + weight2 * raster2.data + weight3 * raster3.data + weight4 * raster4.data
};
assert_relative_eq!(combination, result, epsilon = 1e-5f32);
} | rust_cleaned_test_functions.jsonl/46336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
1769,
12760,
286,
1077,
4680,
16,
25,
282,
18,
17,
284,
220,
15,
13,
19,
463,
286,
1077,
4680,
17,
25,
282,
18,
17,
284,
220,
15,
13,
17,
463,
286,
1077,
4680,
18,
25,
282,
18,
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_put_head_get_delete_object_blocking() {
let s3_path = "/test_blocking.file";
let bucket = test_aws_bucket();
let test: Vec<u8> = object(3072);
let (_data, code) = bucket.put_object_blocking(s3_path, &test).unwrap();
assert_eq!(code, 200);
let (data, code) = bucket.get_object_blocking(s3_path).unwrap();
assert_eq!(code, 200);
assert_eq!(test, data);
let (data, code) = bucket
.get_object_range_blocking(s3_path, 100, Some(1000))
.unwrap();
assert_eq!(code, 206);
assert_eq!(test[100..1001].to_vec(), data);
let (head_object_result, code) = bucket.head_object_blocking(s3_path).unwrap();
assert_eq!(code, 200);
assert_eq!(
head_object_result.content_type.unwrap(),
"application/octet-stream".to_owned()
);
let (_, code) = bucket.delete_object_blocking(s3_path).unwrap();
assert_eq!(code, 204);
} | rust_cleaned_test_functions.jsonl/100389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
13138,
3062,
11353,
5314,
91449,
368,
341,
286,
1077,
274,
18,
2638,
284,
3521,
1944,
91449,
9715,
876,
286,
1077,
15621,
284,
1273,
62,
8635,
38749,
543,
286,
1077,
1273,
25,
11312,
34837,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser_content_length_too_long() {
test_parser_error(
b"GET / HTTP/1.1\r\nHost: localhost\r\nContent-Length: 10\r\n\r\nfoo",
&RequestParserError::new(58, "expected 7 more bytes"),
);
} | rust_cleaned_test_functions.jsonl/100927 | {
"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,
18517,
7495,
5118,
2346,
78,
17799,
368,
341,
286,
1273,
18517,
4096,
1006,
310,
293,
1,
3806,
608,
10130,
14,
16,
13,
16,
12016,
1699,
9296,
25,
47422,
12016,
1699,
2762,
52493,
25,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_ro_data() {
let mut asm = Assembler::new();
let test_string = ".code\ntest: .asciiz 'This is a test'\n.wrong\n";
let program = asm.assemble(test_string);
assert!(program.is_err());
} | rust_cleaned_test_functions.jsonl/7203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
26608,
1769,
368,
341,
286,
1077,
5206,
32828,
284,
1634,
35401,
486,
931,
543,
286,
1077,
1273,
3904,
284,
5933,
1851,
59,
406,
477,
25,
659,
5061,
72,
449,
364,
1986,
374,
264,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_mapping() {
spawn_child(
"find_mappings",
&[
&format!("{}", libc::printf as *const () as usize),
&format!("{}", String::new as *const () as usize),
],
);
} | rust_cleaned_test_functions.jsonl/126017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
26930,
368,
341,
262,
18042,
17268,
1006,
286,
330,
3903,
84153,
756,
286,
609,
9640,
310,
609,
2243,
79878,
42142,
486,
2517,
438,
353,
1024,
1719,
438,
22301,
1326,
310,
609,
2243,
79878,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unpack_bits_in_word() {
let data = 0x2030;
let ret = [
false, false, false, false, true, true, false, false, false, false, false, false,
false, true, false, false,
];
let buf = unpack_bits_in_word(data);
assert_eq!(buf, ret);
} | rust_cleaned_test_functions.jsonl/62516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54889,
20034,
1243,
13533,
368,
341,
286,
1077,
821,
284,
220,
15,
87,
17,
15,
18,
15,
280,
286,
1077,
2112,
284,
2278,
310,
895,
11,
895,
11,
895,
11,
895,
11,
830,
11,
830,
11,
895,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_movss() {
assert_emit!(0xf3, 0x0f, 0x10, 0xc1; movss(XMM0, XMM1));
assert_emit!(0xf3, 0x41, 0x0f, 0x10, 0xdf; movss(XMM3, XMM15));
assert_emit!(0xf3, 0x44, 0x0f, 0x10, 0xc4; movss(XMM8, XMM4));
} | rust_cleaned_test_functions.jsonl/85494 | {
"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,
55798,
778,
368,
341,
286,
2060,
69082,
10297,
15,
5848,
18,
11,
220,
15,
87,
15,
69,
11,
220,
15,
87,
16,
15,
11,
220,
15,
8148,
16,
26,
1974,
778,
7644,
8035,
15,
11,
1599,
8035,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_upfront_shutdown_script() {
// enforce it at shutdown message
let mut config = UserConfig::default();
config.channel_options.announced_channel = true;
config.peer_channel_config_limits.force_announced_channel_preference = false;
config.channel_options.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &user_cfgs);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let flags = InitFeatures::known();
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 2, 1000000, 1000000, flags.clone(), flags.clone());
nodes[0].node.close_channel(&OutPoint { txid: chan.3.txid(), index: 0 }.to_channel_id()).unwrap();
let mut node_0_shutdown = get_event_msg!(nodes[0], MessageSendEvent::SendShutdown, nodes[2].node.get_our_node_id());
node_0_shutdown.scriptpubkey = Builder::new().push_opcode(opcodes::all::OP_RETURN).into_script().to_p2sh();
// Test we enforce upfront_scriptpbukey if by providing a diffrent one at closing that we disconnect peer
nodes[2].node.handle_shutdown(&nodes[0].node.get_our_node_id(), &InitFeatures::known(), &node_0_shutdown);
assert!(regex::Regex::new(r"Got shutdown request with a scriptpubkey \([A-Fa-f0-9]+\) which did not match their previous scriptpubkey.").unwrap().is_match(check_closed_broadcast!(nodes[2], true).unwrap().data.as_str()));
check_closed_event!(nodes[2], 1, ClosureReason::ProcessingError { err: "Got shutdown request with a scriptpubkey (a91441c98a140039816273e50db317422c11c2bfcc8887) which did not match their previous scriptpubkey.".to_string() });
check_added_monitors!(nodes[2], 1);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 2, 1000000, 1000000, flags.clone(), flags.clone());
nodes[0].node.close_channel(&OutPoint { txid: chan.3.txid(), index: 0 }.to_channel_id()).unwrap();
let node_0_shutdown = get_event_msg!(nodes[0], MessageSendEvent::SendShutdown, nodes[2].node.get_our_node_id());
nodes[2].node.handle_shutdown(&nodes[0].node.get_our_node_id(), &InitFeatures::known(), &node_0_shutdown);
let events = nodes[2].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
match events[0] {
MessageSendEvent::SendShutdown { node_id, .. } => { assert_eq!(node_id, nodes[0].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
// We test that if case of peer non-signaling we don't enforce committed script at channel opening
let flags_no = InitFeatures::known().clear_upfront_shutdown_script();
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 1000000, flags_no, flags.clone());
nodes[0].node.close_channel(&OutPoint { txid: chan.3.txid(), index: 0 }.to_channel_id()).unwrap();
let node_1_shutdown = get_event_msg!(nodes[0], MessageSendEvent::SendShutdown, nodes[1].node.get_our_node_id());
nodes[1].node.handle_shutdown(&nodes[0].node.get_our_node_id(), &InitFeatures::known(), &node_1_shutdown);
check_added_monitors!(nodes[1], 1);
let events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
match events[0] {
MessageSendEvent::SendShutdown { node_id, .. } => { assert_eq!(node_id, nodes[0].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
let chan = create_announced_chan_between_nodes_with_value(&nodes, 1, 0, 1000000, 1000000, flags.clone(), flags.clone());
nodes[1].node.close_channel(&OutPoint { txid: chan.3.txid(), index: 0 }.to_channel_id()).unwrap();
check_added_monitors!(nodes[1], 1);
let node_0_shutdown = get_event_msg!(nodes[1], MessageSendEvent::SendShutdown, nodes[0].node.get_our_node_id());
nodes[0].node.handle_shutdown(&nodes[1].node.get_our_node_id(), &InitFeatures::known(), &node_0_shutdown);
let events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
match events[0] {
MessageSendEvent::SendShutdown { node_id, .. } => { assert_eq!(node_id, nodes[1].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
//// channel smoothly
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 1000000, flags.clone(), flags.clone());
nodes[1].node.close_channel(&OutPoint { txid: chan.3.txid(), index: 0 }.to_channel_id()).unwrap();
check_added_monitors!(nodes[1], 1);
let node_0_shutdown = get_event_msg!(nodes[1], MessageSendEvent::SendShutdown, nodes[0].node.get_our_node_id());
nodes[0].node.handle_shutdown(&nodes[1].node.get_our_node_id(), &InitFeatures::known(), &node_0_shutdown);
let events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 2);
match events[0] {
MessageSendEvent::SendShutdown { node_id, .. } => { assert_eq!(node_id, nodes[1].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
match events[1] {
MessageSendEvent::SendClosingSigned { node_id, .. } => { assert_eq!(node_id, nodes[1].node.get_our_node_id()) }
_ => panic!("Unexpected event"),
}
} | rust_cleaned_test_functions.jsonl/6682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1924
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8237,
6951,
54804,
14660,
368,
341,
1572,
197,
322,
28162,
432,
518,
23766,
1943,
271,
10217,
5206,
2193,
284,
2657,
2648,
486,
2258,
543,
25873,
16195,
8743,
13,
1020,
19453,
14571,
284,
830,
280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_accountsdb_rest_of_hash_calculation() {
solana_logger::setup();
let mut account_maps: Vec<CalculateHashIntermediate> = Vec::new();
let key = Pubkey::new(&[11u8; 32]);
let hash = Hash::new(&[1u8; 32]);
let val = CalculateHashIntermediate::new(0, hash, 88, Slot::default(), key);
account_maps.push(val);
let key = Pubkey::new(&[12u8; 32]);
let hash = Hash::new(&[2u8; 32]);
let val = CalculateHashIntermediate::new(
0,
hash,
ZERO_RAW_LAMPORTS_SENTINEL,
Slot::default(),
key,
);
account_maps.push(val);
let result =
AccountsDB::rest_of_hash_calculation((vec![account_maps.clone()], Measure::start("")));
let expected_hash = Hash::from_str("8j9ARGFv4W2GfML7d3sVJK2MePwrikqYnu6yqer28cCa").unwrap();
assert_eq!(result, (expected_hash, 88));
// 3rd key - with pubkey value before 1st key so it will be sorted first
let key = Pubkey::new(&[10u8; 32]);
let hash = Hash::new(&[2u8; 32]);
let val = CalculateHashIntermediate::new(0, hash, 20, Slot::default(), key);
account_maps.push(val);
let result =
AccountsDB::rest_of_hash_calculation((vec![account_maps.clone()], Measure::start("")));
let expected_hash = Hash::from_str("EHv9C5vX7xQjjMpsJMzudnDTzoTSRwYkqLzY8tVMihGj").unwrap();
assert_eq!(result, (expected_hash, 108));
// 3rd key - with later slot
let key = Pubkey::new(&[10u8; 32]);
let hash = Hash::new(&[99u8; 32]);
let val = CalculateHashIntermediate::new(0, hash, 30, Slot::default() + 1, key);
account_maps.push(val);
let result = AccountsDB::rest_of_hash_calculation((vec![account_maps], Measure::start("")));
let expected_hash = Hash::from_str("7NNPg5A8Xsg1uv4UFm6KZNwsipyyUnmgCrznP6MBWoBZ").unwrap();
assert_eq!(result, (expected_hash, 118));
} | rust_cleaned_test_functions.jsonl/60844 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 952
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
32231,
3575,
8950,
38241,
2914,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
5206,
2692,
46512,
25,
11312,
27,
47866,
6370,
98961,
29,
284,
11312,
486,
931,
1428,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_webhook() {
let route = Route::CreateWebhook {
channel_id: CHANNEL_ID,
};
assert_eq!(
route.to_string(),
format!("channels/{channel_id}/webhooks", channel_id = CHANNEL_ID)
);
} | rust_cleaned_test_functions.jsonl/119876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25960,
20873,
368,
341,
286,
1077,
6021,
284,
9572,
486,
4021,
5981,
20873,
341,
310,
5496,
842,
25,
58756,
3450,
345,
286,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,
3904,
3148,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_le32() {
test_interpreter_and_jit_asm!(
"
ldxw r0, [r1]
le32 r0
exit",
[0x44, 0x33, 0x22, 0x11],
(),
{ |_vm, res: Result| { res.unwrap() == 0x11223344 } },
3
);
} | rust_cleaned_test_functions.jsonl/58949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11751,
18,
17,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
326,
12719,
86,
435,
15,
11,
508,
81,
16,
921,
286,
512,
18,
17,
435,
15,
198,
286,
4869,
756... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cume_dist_return_type() -> Result<()> {
let fun = WindowFunction::from_str("cume_dist")?;
let observed = return_type(&fun, &[])?;
assert_eq!(DataType::Float64, observed);
Ok(())
} | rust_cleaned_test_functions.jsonl/119625 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
3885,
16031,
12511,
1819,
368,
1464,
5714,
71698,
341,
286,
1077,
2464,
284,
13642,
5152,
486,
1499,
2895,
445,
66,
3885,
16031,
899,
37445,
286,
1077,
13166,
284,
470,
1819,
2099,
11894,
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
] | 3 |
#[test]
fn test_parse_fixed_array_param() {
assert_eq!(
HumanReadableParser::parse_type("address[2]").unwrap(),
ParamType::FixedArray(Box::new(ParamType::Address), 2)
);
assert_eq!(
HumanReadableParser::parse_type("bool[17]").unwrap(),
ParamType::FixedArray(Box::new(ParamType::Bool), 17)
);
assert_eq!(
HumanReadableParser::parse_type("bytes[45][3]").unwrap(),
ParamType::FixedArray(
Box::new(ParamType::FixedArray(Box::new(ParamType::Bytes), 45)),
3
)
);
} | rust_cleaned_test_functions.jsonl/77865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
37839,
3858,
4090,
368,
341,
286,
2060,
10714,
33673,
310,
11097,
57938,
6570,
486,
6400,
1819,
445,
4995,
58,
17,
44891,
15454,
3148,
310,
6991,
929,
486,
13520,
1857,
67758,
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_compile_async() {
let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("tests/002_hello.ts");
let specifier =
ModuleSpecifier::resolve_url_or_path(p.to_str().unwrap()).unwrap();
let out = SourceFile {
url: specifier.as_url().clone(),
filename: PathBuf::from(p.to_str().unwrap().to_string()),
media_type: msg::MediaType::TypeScript,
source_code: include_bytes!("../tests/002_hello.ts").to_vec(),
};
let mock_state = ThreadSafeGlobalState::mock(vec![
String::from("deno"),
String::from("hello.js"),
]);
let fut = async move {
let result = mock_state
.ts_compiler
.compile_async(mock_state.clone(), &out)
.await;
assert!(result.is_ok());
assert!(result
.unwrap()
.code
.as_bytes()
.starts_with("console.log(\"Hello World\");".as_bytes()));
};
tokio_util::run(fut.boxed())
} | rust_cleaned_test_functions.jsonl/15441 | {
"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,
74170,
28346,
368,
341,
262,
1077,
281,
284,
1460,
486,
2343,
486,
1820,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
5455,
414,
659,
3765,
741,
414,
659,
15454,
741,
414,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_context_empty_storage() {
block_on(async {
let storage = MemStorage::new();
let context = Context::load(&storage).await;
assert_eq!(SystemTime::UNIX_EPOCH, context.schedule.last_update_time);
assert_eq!(None, context.state.server_dictated_poll_interval);
});
} | rust_cleaned_test_functions.jsonl/69582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
8467,
15124,
23310,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
5819,
284,
13550,
5793,
486,
931,
543,
310,
1077,
2266,
284,
9608,
486,
1078,
2099,
16172,
568,
11421,
280,
310,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold_get_elem2_2() {
fold("x = 'string'[-1]", "x = void 0;");
fold("x = 'string'[6]", "x = void 0;");
} | rust_cleaned_test_functions.jsonl/122194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
3062,
28179,
17,
62,
17,
368,
341,
262,
11555,
445,
87,
284,
364,
917,
6,
7609,
16,
19076,
330,
87,
284,
737,
220,
15,
34649,
262,
11555,
445,
87,
284,
364,
917,
66895,
21,
19076,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_true() {
// generated with
// openssl genpkey -out rsakey.pem -algorithm RSA -pkeyopt rsa_keygen_bits:2048
let private_key = r#"-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDjT1UyWwk/v2UG
BhTEB+8NIL4RW3+u7TSOVP0Qpxf22bhJH9+RqwZPlwzbhYQT1TNXT4fFnARaGWaG
EtPV/rlV6o9PcLCMj3y2sOiKBy0qS6/3nYHKlFNPGnesYLTIbk54Orp4OYnSqQ/G
zBZbS3IRDsTaOb4D+KaxdPm/I8qN1TEPIDEkDRYtRprbmTQaz3rl0ooKuDCHiWoW
I7rG6zGkcGwBZAkwh0XFeklJSwZbC0JK88wolHKWJba6KCO8A2LpskacPB/KP5mQ
bnTzIS5xiNMKf9qhLm/HgDzgCL9E8StnZygUmRFKYh4MTzrpfGaoT5Vm+tijlrDi
CDE33tuZAgMBAAECggEBANuVDnsngCbJsECCbVr1QxNOdu1zk0ObN3LrXM/Sao72
wVQ6axFfwifuhegl8XHrOb51QHY/geC7utN3qpWFjOoXPbuC47nU/qfI+8oippm+
Jc2wpOnaISRAMC0f+mPIUxtHuExdYOtUj7399vbYSed6eeVJdGqHsBerJXtkis44
uuzlQ6ISMPd3YhxN6S4QbPyw6aaoJG0qYpdHSL/n9r49hA3sKbAQVSOTzM1PMRje
6kB6BPrfmyVavHUXRZG1lU7gD41F8nG0wXOvsFu1XXPeEjw2/uBRanA8rWtAPv02
vBXcBMHpv7ySWCVOXMLWfZmo4GJIjfhtjTasUTSxVAECgYEA+Tvei02NBGWdjOzu
xoLvF71oT22Ic862StvmDJYSV/9bs1r8pxGCPs0tkHr/DQoBcmvAComrcEBltkaZ
yyKxDdSLrsy1nkL4hPMwJF0gNZAAaj4rMNfadKGOmlhQBcFCBph8kijcGsyYn1Vs
2cGCIZCALofDm4t8oIUpB8+UsYECgYEA6XsYh50+JkpuTknTbciOQJijl0a0oK6X
SO9mwoWEtg0+mrR3gL0kjghUObN5p0lhLLyqCBDVeFdaDcWbZXdF/KuSyI48Bube
c0EYkCFk1W/39yVb6LqQP6xoPrA/nLB4AuZYSqkZwx+bHH7OBgHaXRh2m2HawU5B
pQsM2PVwhhkCgYAonJfTzSw4VjKI/yadVEKPdL6liqycakeMBS8ESAPvMN4JaL8Y
niLCBv7wtwoOXt4DfglJ7krwPJ4WSITQ8/Mz1Ll6H0NM6Y7DYzkqA76226MlrMGu
8M1ZCeZJwjAv7+DJYFmUG3JaL5KDDBFznjONMpWgf2DhXKZPJcOc0TdigQKBgGHL
4NN1JsItLRT30WrLteISzXsg76naV54CQR27hYIn/BAbBW9USop/rJ/asFtE3kI5
6FKmknPsyti368ZNdnBGgZ4mDbiqXYUTQDGm+zB3zPqlmGDcPG2fTq7rbkm4lRxJ
1bO4LwVPKM5/wtY7UnbqN0wQaevMVqzF+ySpce+JAoGBAOLkdZrv7+JPfusIlj/H
CuNhikh1WMHm6Al0SYBURhUb52hHGEAnpaIxwQrN4PPD4Iboyp0kLsjMtKxlvnBm
WpsqFXdkj9GLZt1s1Q/5SW5Twb7gxdR7cXrXOcATivN1/GDdhIHS1NEb3MM7EBXc
9RSM375nLWCP0LDosgKSaq+u
-----END PRIVATE KEY-----
"#;
let msg = "foo bar";
let expected = "h0H_U6SO_i1F7JwzzTBHL1DNTw-YD6jdMul9Uwo_5xB_TmztP9c7T8e5CVY1o5_vMfQ3SZJXZ9liwd7FK8a7NjNumWIWq0_KZvDxMK6D2SSkA8WAz4KsdUU1CNVxM51UYQgYnHpaJvtNmowgzCnahNQQso4hKsYCe7nNKlTiCP1yPzM4MWJYh2cekH1SGqSaOtgvQZz4GrOPG-hhcyMZMk_u-sZ0F3PUFj0-kfbhZPNVpvv4-wI_XA84q85Wech4nsgLbxO9397-whsmGVNlqqo2PwwxASn7dEqtrrvD7mkabf32OqmgJ-xXT_n4m67kvgzC7ausezX7E0zcnBj3RQ==".to_string();
assert_eq!(base64_encode(&sign(&msg, private_key).unwrap()), expected);
} | rust_cleaned_test_functions.jsonl/10118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1715
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16082,
368,
341,
286,
442,
7907,
448,
8945,
286,
442,
80733,
4081,
79,
792,
481,
411,
10036,
726,
88,
49373,
481,
19688,
45641,
481,
79,
792,
2912,
68570,
3097,
4370,
20034,
25,
17,
15,
19,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_capacity_file_write() {
struct TestCase {
file_cap: u64,
file_1_initial_state: Vec<u8>,
file_2_initial_state: Vec<u8>,
write_to_perform: Vec<u8>,
file_1_expected_state: Vec<u8>,
file_2_expected_state: Vec<u8>,
}
let test_cases = vec![
TestCase {
file_cap: 10,
file_1_initial_state: vec![],
file_2_initial_state: vec![],
write_to_perform: vec![],
file_1_expected_state: vec![],
file_2_expected_state: vec![],
},
TestCase {
file_cap: 10,
file_1_initial_state: vec![],
file_2_initial_state: vec![],
write_to_perform: vec![0],
file_1_expected_state: vec![0],
file_2_expected_state: vec![],
},
TestCase {
file_cap: 10,
file_1_initial_state: vec![0],
file_2_initial_state: vec![0],
write_to_perform: vec![],
file_1_expected_state: vec![0],
file_2_expected_state: vec![0],
},
TestCase {
file_cap: 10,
file_1_initial_state: vec![],
file_2_initial_state: vec![],
write_to_perform: vec![0, 1, 2, 3, 4],
file_1_expected_state: vec![0, 1, 2, 3, 4],
file_2_expected_state: vec![],
},
TestCase {
file_cap: 10,
file_1_initial_state: vec![0, 1, 2, 3, 4],
file_2_initial_state: vec![],
write_to_perform: vec![5],
file_1_expected_state: vec![5],
file_2_expected_state: vec![0, 1, 2, 3, 4],
},
TestCase {
file_cap: 10,
file_1_initial_state: vec![5, 6, 7, 8, 9],
file_2_initial_state: vec![0, 1, 2, 3, 4],
write_to_perform: vec![10, 11, 12, 13, 14],
file_1_expected_state: vec![10, 11, 12, 13, 14],
file_2_expected_state: vec![5, 6, 7, 8, 9],
},
TestCase {
file_cap: 0,
file_1_initial_state: vec![],
file_2_initial_state: vec![],
write_to_perform: vec![1, 2, 3, 4, 5],
file_1_expected_state: vec![],
file_2_expected_state: vec![],
},
];
for tc in test_cases {
let tmp_dir = TempDir::new().unwrap();
let tmp_file_path = tmp_dir.path().join("test.log");
fs::OpenOptions::new()
.append(true)
.create(true)
.open(&tmp_file_path)
.unwrap()
.write(&tc.file_1_initial_state)
.unwrap();
fs::OpenOptions::new()
.append(true)
.create(true)
.open(&tmp_file_path.with_extension("log.old"))
.unwrap()
.write(&tc.file_2_initial_state)
.unwrap();
MaxCapacityFile::new(tmp_file_path.clone(), tc.file_cap)
.unwrap()
.write(&tc.write_to_perform)
.unwrap();
let mut file1 = fs::OpenOptions::new().read(true).open(&tmp_file_path).unwrap();
let file_size = file1.metadata().unwrap().len();
let mut buf = vec![0; file_size as usize];
file1.read(&mut buf).unwrap();
assert_eq!(buf, tc.file_1_expected_state);
let mut file2 = fs::OpenOptions::new()
.read(true)
.open(&tmp_file_path.with_extension("log.old"))
.unwrap();
let file_size = file2.metadata().unwrap().len();
let mut buf = vec![0; file_size as usize];
file2.read(&mut buf).unwrap();
assert_eq!(buf, tc.file_2_expected_state);
}
} | rust_cleaned_test_functions.jsonl/113587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
35603,
2458,
9165,
368,
341,
286,
2036,
30573,
341,
310,
1034,
16388,
25,
575,
21,
19,
345,
310,
1034,
62,
16,
15809,
4387,
25,
11312,
34837,
23,
12520,
310,
1034,
62,
17,
15809,
4387,
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_blob_container_url_display_redacted() {
let url_no_query = "https://myaccount.blob.core.windows.net/mycontainer";
let url_sas_query =
"https://myaccount.blob.core.windows.net/mycontainer?x=public1&sig=secret&y=public2";
assert_eq!(
url_no_query,
&format!("{:?}", BlobContainerUrl::parse(url_no_query).unwrap())
);
let redacted =
"https://myaccount.blob.core.windows.net/mycontainer?x=public1&sig=REDACTED&y=public2"
.to_owned();
assert_eq!(
redacted,
format!("{:?}", BlobContainerUrl::parse(url_sas_query).unwrap())
);
} | rust_cleaned_test_functions.jsonl/81902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45908,
15847,
2903,
14825,
26058,
22167,
368,
341,
286,
1077,
2515,
6536,
5738,
284,
330,
2428,
1110,
2408,
4608,
96281,
4871,
68113,
5071,
34198,
3586,
876,
286,
1077,
2515,
643,
300,
5738,
4035,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matches_subdir() {
let file = build_ignore("target");
assert!(file.is_excluded(&base_dir().join("target").join("file")));
assert!(file.is_excluded(&base_dir().join("target").join("subdir").join("file")));
} | rust_cleaned_test_functions.jsonl/9285 | {
"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,
38344,
5228,
3741,
368,
341,
286,
1077,
1034,
284,
1936,
58493,
445,
5657,
3071,
286,
2060,
10297,
1192,
2079,
2702,
10181,
2099,
3152,
4334,
1005,
5987,
445,
5657,
1827,
5987,
445,
1192,
17621,
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_serialize_deserialize() {
let _guard = LOCK.run_concurrently();
let src = doc! { "subkey": 1 };
let dst = vec![
27, 0, 0, 0, 3, 107, 101, 121, 0, 17, 0, 0, 0, 16, 115, 117, 98, 107, 101, 121, 0, 1, 0, 0,
0, 0, 0,
];
let doc = doc! { "key": src };
let mut buf = Vec::new();
doc.to_writer(&mut buf).unwrap();
assert_eq!(buf, dst);
let deserialized = Document::from_reader(&mut Cursor::new(buf)).unwrap();
assert_eq!(deserialized, doc);
} | rust_cleaned_test_functions.jsonl/49141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
15768,
9050,
368,
341,
262,
1077,
716,
26098,
284,
49463,
7634,
3382,
58202,
543,
262,
1077,
2286,
284,
4629,
0,
314,
330,
1966,
792,
788,
220,
16,
2605,
262,
1077,
10648,
284,
7486,
9051... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request() {
let mut req = TestRequest::default().to_srv_request();
assert_eq!(req.head_mut().version, http::Version::HTTP_11);
assert!(req.peer_addr().is_none());
let err = http::error::PayloadError::Overflow;
let res: HttpResponse = req.render_error(err).into();
assert_eq!(res.status(), http::StatusCode::PAYLOAD_TOO_LARGE);
let req = TestRequest::default().to_srv_request();
let err = http::error::PayloadError::Overflow;
let res: HttpResponse = req.error_response(err).into();
assert_eq!(res.status(), http::StatusCode::PAYLOAD_TOO_LARGE);
let mut req = TestRequest::default().to_srv_request();
req.headers_mut().insert(
header::CONTENT_TYPE,
header::HeaderValue::from_static("text"),
);
req.headers_mut().remove(header::CONTENT_TYPE);
assert!(!req.headers().contains_key(header::CONTENT_TYPE));
assert!(!req.message_headers().contains_key(header::CONTENT_TYPE));
req.extensions_mut().insert("TEXT".to_string());
assert_eq!(req.message_extensions().get::<String>().unwrap(), "TEXT");
req.message_extensions_mut().remove::<String>();
assert!(!req.extensions().contains::<String>());
} | rust_cleaned_test_functions.jsonl/99286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 553
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
286,
1077,
5206,
4232,
284,
3393,
1900,
486,
2258,
1005,
983,
63921,
7893,
543,
286,
2060,
10714,
10297,
2958,
16042,
29523,
1005,
4366,
11,
1758,
486,
5637,
486,
9230,
62,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_properties() {
let cases = [
("a", 0, 1),
("b", PROP_SIZE_INDEX_DISTANCE / 8, 1),
("c", PROP_SIZE_INDEX_DISTANCE / 4, 1),
("d", PROP_SIZE_INDEX_DISTANCE / 2, 1),
("e", PROP_SIZE_INDEX_DISTANCE / 8, 1),
("f", PROP_SIZE_INDEX_DISTANCE / 4, 1),
("g", PROP_SIZE_INDEX_DISTANCE / 2, 1),
("h", PROP_SIZE_INDEX_DISTANCE / 8, 1),
("i", PROP_SIZE_INDEX_DISTANCE / 4, 1),
("j", PROP_SIZE_INDEX_DISTANCE / 2, 1),
("k", PROP_SIZE_INDEX_DISTANCE / 2, 1),
("l", 0, PROP_KEYS_INDEX_DISTANCE / 2),
("m", 0, PROP_KEYS_INDEX_DISTANCE / 2),
("n", 1, PROP_KEYS_INDEX_DISTANCE),
("o", 1, 1),
];
let mut collector = RangePropertiesCollector::default();
for &(k, vlen, count) in &cases {
let v = vec![0; vlen as usize];
for _ in 0..count {
collector.add(k.as_bytes(), &v, DBEntryType::Put, 0, 0);
}
}
for &(k, vlen, _) in &cases {
let v = vec![0; vlen as usize];
collector.add(k.as_bytes(), &v, DBEntryType::Other, 0, 0);
}
let result = UserProperties(collector.finish());
let props = RangeProperties::decode(&result).unwrap();
assert_eq!(props.smallest_key().unwrap(), cases[0].0.as_bytes());
assert_eq!(
props.largest_key().unwrap(),
cases[cases.len() - 1].0.as_bytes()
);
assert_eq!(
props.get_approximate_size_in_range(b"", b"k"),
PROP_SIZE_INDEX_DISTANCE / 8 * 25 + 11
);
assert_eq!(props.get_approximate_keys_in_range(b"", b"k"), 11 as u64);
let handles = &props.offsets;
assert_eq!(handles.len(), 7);
let a = &handles[b"a".as_ref()];
assert_eq!(a.size, 1);
let e = &handles[b"e".as_ref()];
assert_eq!(e.size, PROP_SIZE_INDEX_DISTANCE + 5);
let i = &handles[b"i".as_ref()];
assert_eq!(i.size, PROP_SIZE_INDEX_DISTANCE / 8 * 17 + 9);
let k = &handles[b"k".as_ref()];
assert_eq!(k.size, PROP_SIZE_INDEX_DISTANCE / 8 * 25 + 11);
let m = &handles[b"m".as_ref()];
assert_eq!(m.keys, 11 + PROP_KEYS_INDEX_DISTANCE);
let n = &handles[b"n".as_ref()];
assert_eq!(n.keys, 11 + 2 * PROP_KEYS_INDEX_DISTANCE);
let o = &handles[b"o".as_ref()];
assert_eq!(o.keys, 12 + 2 * PROP_KEYS_INDEX_DISTANCE);
let empty = RangeOffsets::default();
let cases = [
(" ", "k", k, &empty),
(" ", " ", &empty, &empty),
("k", "k", k, k),
("a", "k", k, a),
("a", "i", i, a),
("e", "h", i, e),
("g", "h", i, e),
("g", "g", i, i),
];
for &(start, end, end_idx, start_idx) in &cases {
let size = end_idx.size - start_idx.size;
assert_eq!(
props.get_approximate_size_in_range(start.as_bytes(), end.as_bytes()),
size
);
let keys = end_idx.keys - start_idx.keys;
assert_eq!(
props.get_approximate_keys_in_range(start.as_bytes(), end.as_bytes()),
keys
);
}
} | rust_cleaned_test_functions.jsonl/70606 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2008
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
25158,
368,
341,
286,
1077,
5048,
284,
2278,
310,
3489,
64,
497,
220,
15,
11,
220,
16,
1326,
3374,
310,
3489,
65,
497,
41977,
4098,
14515,
63217,
608,
220,
23,
11,
220,
16,
1326,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_visit_return() {
let mut void_node = ReturnNode {
value: None, // indicates a Void return value.
span: None,
};
let mut int_node = ReturnNode {
value: Some(ExpressionNode::from(100)),
span: None,
};
let void_function_def = FunctionDefNode {
return_type: LpcType::Void,
name: "foo".to_string(),
parameters: vec![],
flags: FunctionFlags::default(),
body: vec![],
span: None,
};
let int_function_def = FunctionDefNode {
return_type: LpcType::Int(false),
name: "snuh".to_string(),
parameters: vec![],
flags: FunctionFlags::default(),
body: vec![],
span: None,
};
let function_prototypes = HashMap::new();
let mut scopes = ScopeTree::default();
scopes.push_new();
let context = CompilationContext {
scopes,
function_prototypes,
..CompilationContext::default()
};
let mut walker = SemanticCheckWalker::new(context);
// return void from void function
walker.current_function = Some(void_function_def.clone());
let _ = void_node.visit(&mut walker);
assert!(walker.context.errors.is_empty());
// return void from non-void function
walker.current_function = Some(int_function_def);
let _ = void_node.visit(&mut walker);
assert!(!walker.context.errors.is_empty());
walker.context.errors = vec![];
// return int from int function
let _ = int_node.visit(&mut walker);
assert!(walker.context.errors.is_empty());
// return int from void function
walker.current_function = Some(void_function_def);
let _ = int_node.visit(&mut walker);
assert!(!walker.context.errors.is_empty());
} | rust_cleaned_test_functions.jsonl/108597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56484,
12511,
368,
341,
310,
1077,
5206,
737,
5084,
284,
3411,
1955,
341,
394,
897,
25,
2240,
11,
442,
14807,
264,
19193,
470,
897,
624,
394,
9390,
25,
2240,
345,
310,
3634,
310,
1077,
5206,
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_client_initiate() {
let mut ctx: CCPContext = CCPContext::new();
let mut buf: [u8; CCP_MAX_PACKET_SIZE] = [0; CCP_MAX_PACKET_SIZE];
let msg = String::from("TESTTESTTESTTEST").into_bytes();
let msg = msg.as_slice();
let mut ret = ctx.mk_client_initiate(&mut buf,
SERVER_NAME,
msg);
if ret > 0 {
ret = ctx.parse_client_initiate(&buf, ret as usize);
}
assert!(ret == 544 + msg.len() as isize);
} | rust_cleaned_test_functions.jsonl/100573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
6137,
6493,
368,
341,
286,
1077,
5206,
5635,
25,
75921,
1972,
284,
75921,
1972,
486,
931,
543,
286,
1077,
5206,
6607,
25,
508,
84,
23,
26,
75921,
6806,
40328,
4098,
60,
284,
508,
15,
26,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_sorted_vec() {
quickcheck::quickcheck(prop_sorted_vec as fn(Vec<i32>) -> bool);
fn prop_sorted_vec(mut values: Vec<i32>) -> bool {
let mut sorted_vec = SortedVector::new();
for &value in &values {
sorted_vec.push(value)
}
values.sort();
let mut results = Vec::with_capacity(values.len());
while !sorted_vec.is_empty() {
results.push(sorted_vec.pop().unwrap());
}
results.reverse();
assert_eq!(&values, &results);
true
}
} | rust_cleaned_test_functions.jsonl/79764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41277,
13251,
368,
341,
286,
3974,
2028,
486,
27763,
2028,
30638,
41277,
13251,
438,
5168,
49923,
21897,
18,
17,
9231,
1464,
1807,
626,
286,
5168,
2004,
41277,
13251,
70305,
2750,
25,
11312,
21897,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_add_flag() {
let mut opcode = OpcodeData {
name: "TestOp",
immediates: vec![],
inputs: Inputs::NOV,
outputs: Outputs::NOV,
flags: InstrFlags::NF,
};
let fixups = hashmap! {
"TestOp" => vec! {
add_flag(InstrFlags::AS_STRUCT),
},
};
fixups::apply_fixups(&mut opcode, &fixups);
assert_eq!(
opcode,
OpcodeData {
name: "TestOp",
immediates: vec![],
inputs: Inputs::NOV,
outputs: Outputs::NOV,
flags: InstrFlags::NF | InstrFlags::AS_STRUCT,
}
);
} | rust_cleaned_test_functions.jsonl/54512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
10933,
368,
341,
286,
1077,
5206,
30028,
284,
78899,
1043,
341,
310,
829,
25,
330,
2271,
7125,
756,
310,
5551,
973,
25,
7486,
20703,
1259,
310,
11127,
25,
46281,
486,
8996,
53,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_if() {
let prog = r#"
let a = 5;
if true {
a = 10;
}
a
"#;
expect_prog(prog, Value::Int(10));
} | rust_cleaned_test_functions.jsonl/77502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
368,
341,
262,
1077,
29271,
284,
435,
2,
698,
1149,
264,
284,
220,
20,
280,
333,
830,
341,
262,
264,
284,
220,
16,
15,
280,
532,
64,
198,
262,
5869,
401,
262,
1720,
60390,
80078,
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 |
#[test]
fn test_http_request_chunked_payload_and_next_message() {
let mut codec = Codec::default();
let mut buf = BytesMut::from(
"GET /test HTTP/1.1\r\n\
transfer-encoding: chunked\r\n\r\n",
);
let item = codec.decode(&mut buf).unwrap().unwrap();
let req = item.message();
assert_eq!(req.method(), Method::GET);
assert!(req.chunked().unwrap());
buf.extend(
b"4\r\ndata\r\n4\r\nline\r\n0\r\n\r\n\
POST /test2 HTTP/1.1\r\n\
transfer-encoding: chunked\r\n\r\n"
.iter(),
);
let msg = codec.decode(&mut buf).unwrap().unwrap();
assert_eq!(msg.chunk().as_ref(), b"data");
let msg = codec.decode(&mut buf).unwrap().unwrap();
assert_eq!(msg.chunk().as_ref(), b"line");
let msg = codec.decode(&mut buf).unwrap().unwrap();
assert!(msg.eof());
// decode next message
let item = codec.decode(&mut buf).unwrap().unwrap();
let req = item.message();
assert_eq!(*req.method(), Method::POST);
assert!(req.chunked().unwrap());
} | rust_cleaned_test_functions.jsonl/15426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 597
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25888,
7893,
30539,
291,
32813,
8378,
11257,
6462,
368,
341,
286,
1077,
5206,
34647,
284,
67077,
486,
2258,
1428,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
1006,
310,
330,
3806,
608,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ranges() {
let drawing_area = create_mocked_drawing_area(1024, 768, |_m| {})
.apply_coord_spec(Cartesian2d::<
crate::coord::types::RangedCoordi32,
crate::coord::types::RangedCoordu32,
>::new(-100..100, 0..200, (0..1024, 0..768)));
let x_range = drawing_area.get_x_range();
assert_eq!(x_range, -100..100);
let y_range = drawing_area.get_y_range();
assert_eq!(y_range, 0..200);
} | rust_cleaned_test_functions.jsonl/81499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58748,
368,
341,
286,
1077,
13330,
15030,
284,
1855,
34134,
291,
814,
1696,
15030,
7,
16,
15,
17,
19,
11,
220,
22,
21,
23,
11,
70886,
76,
91,
35248,
310,
659,
10280,
30096,
13594,
3025,
471,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_column_across_option() {
let test_file_path = "column.log";
let expected_test_file_path = "column_across.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["--pages=3:5", "--column=3", "-a", "-n", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
} | rust_cleaned_test_functions.jsonl/103055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
8744,
14718,
2128,
9672,
368,
341,
262,
1077,
1273,
2458,
2638,
284,
330,
6229,
1665,
876,
262,
1077,
3601,
4452,
2458,
2638,
284,
330,
6229,
14718,
2128,
1665,
56835,
876,
262,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_container_policy_path_value() {
#[derive(Debug)]
struct TestData<'a> {
param: &'a str,
result: Result<String>,
}
let tests = &[
TestData {
param: "",
result: Err(anyhow!(ERR_INVALID_CONTAINER_POLICY_PATH_KEY)),
},
TestData {
param: "agent.container_policy_file",
result: Err(anyhow!(ERR_INVALID_CONTAINER_POLICY_PATH_VALUE)),
},
TestData {
param: "agent.container_policy_file=",
result: Err(anyhow!(ERR_INVALID_CONTAINER_POLICY_PATH_VALUE)),
},
TestData {
param: "foo=bar",
result: Err(anyhow!(ERR_INVALID_CONTAINER_POLICY_PATH_KEY)),
},
TestData {
param: "agent.policy_path=/another/absolute/path.json",
result: Err(anyhow!(ERR_INVALID_CONTAINER_POLICY_PATH_KEY)),
},
TestData {
param: "agent.container_policy_file=/etc/container/policy.json",
result: Ok("/etc/container/policy.json".into()),
},
TestData {
param: "agent.container_policy_file=/another/absolute/path.json",
result: Ok("/another/absolute/path.json".into()),
},
TestData {
param: "agent.container_policy_file=./relative/path.json",
result: Err(anyhow!(ERR_INVALID_CONTAINER_POLICY_ABSOLUTE)),
},
TestData {
param: "agent.container_policy_file=./relative/path.json",
result: Err(anyhow!(ERR_INVALID_CONTAINER_POLICY_ABSOLUTE)),
},
TestData {
param: "agent.container_policy_file=../../relative/path.json",
result: Err(anyhow!(ERR_INVALID_CONTAINER_POLICY_ABSOLUTE)),
},
TestData {
param: "agent.container_policy_file=junk_string",
result: Err(anyhow!(ERR_INVALID_CONTAINER_POLICY_ABSOLUTE)),
},
];
for (i, d) in tests.iter().enumerate() {
let msg = format!("test[{}]: {:?}", i, d);
let result = get_container_policy_path_value(d.param);
let msg = format!("{}: result: {:?}", msg, result);
assert_result!(d.result, result, msg);
}
} | rust_cleaned_test_functions.jsonl/119147 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
15847,
22773,
2638,
3142,
368,
341,
286,
11506,
27098,
42618,
5563,
286,
2036,
93200,
18291,
64,
29,
341,
310,
1685,
25,
30136,
64,
607,
345,
310,
1102,
25,
5714,
3464,
12520,
286,
555,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rev() {
let xs = [2, 4, 6, 8, 10, 12, 14, 16];
let mut it = xs.iter();
it.next();
it.next();
assert!(it.rev().cloned().collect::<Vec<isize>>() ==
vec![16, 14, 12, 10, 8, 6]);
} | rust_cleaned_test_functions.jsonl/25940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38082,
368,
341,
262,
1077,
11943,
284,
508,
17,
11,
220,
19,
11,
220,
21,
11,
220,
23,
11,
220,
16,
15,
11,
220,
16,
17,
11,
220,
16,
19,
11,
220,
16,
21,
935,
262,
1077,
5206,
432,
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_guild_store_channel_deserialization() {
let value = GuildChannel::Text(TextChannel {
id: ChannelId(1),
guild_id: Some(GuildId(2)),
kind: ChannelType::GuildStore,
last_message_id: None,
last_pin_timestamp: None,
name: "store".to_owned(),
nsfw: false,
permission_overwrites: Vec::new(),
parent_id: None,
position: 2,
rate_limit_per_user: None,
topic: Some("a store channel".to_owned()),
});
let permission_overwrites: Vec<PermissionOverwrite> = Vec::new();
assert_eq!(
value,
serde_json::from_value(serde_json::json!({
"id": "1",
"guild_id": "2",
"name": "store",
"nsfw": false,
"permission_overwrites": permission_overwrites,
"position": 2,
"topic": "a store channel",
"type": ChannelType::GuildStore,
}))
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/54439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 620
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
1498,
14809,
14571,
15768,
50563,
368,
341,
286,
1077,
897,
284,
32492,
9629,
486,
1178,
34082,
9629,
341,
310,
877,
25,
13434,
764,
7,
16,
1326,
310,
26411,
842,
25,
4329,
6699,
1498,
764... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_country_fails() {
// Setup environment
let mut exec = fasync::TestExecutor::new().expect("Failed to create an executor");
let test_values = test_setup();
let (phy, mut phy_stream) = fake_phy();
let phy_id = 10u16;
test_values.phys.insert(phy_id, phy);
let alpha2 = fake_alpha2();
// Initiate a QueryPhy request. The returned future should not be able
// to produce a result immediately
let req_msg = fidl_svc::SetCountryRequest { phy_id, alpha2: alpha2.clone() };
let req_fut = super::set_country(&test_values.phys, req_msg);
pin_mut!(req_fut);
assert_eq!(Poll::Pending, exec.run_until_stalled(&mut req_fut));
let (req, responder) = assert_variant!(exec.run_until_stalled(&mut phy_stream.next()),
Poll::Ready(Some(Ok(fidl_dev::PhyRequest::SetCountry { req, responder }))) => (req, responder)
);
assert_eq!(req.alpha2, alpha2.clone());
// Failure case #1: WLAN PHY not responding
assert_eq!(Poll::Pending, exec.run_until_stalled(&mut req_fut));
// Failure case #2: WLAN PHY has not implemented the feature.
assert_eq!(Poll::Pending, exec.run_until_stalled(&mut req_fut));
let resp = zx::Status::NOT_SUPPORTED.into_raw();
responder.send(resp).expect("failed to send the response to SetCountry");
assert_eq!(Poll::Ready(zx::Status::NOT_SUPPORTED), exec.run_until_stalled(&mut req_fut));
} | rust_cleaned_test_functions.jsonl/20595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
28106,
761,
6209,
368,
341,
286,
442,
18626,
4573,
198,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
9408,
311,
1855,
458,
31558,
797,
286,
1077,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dns_tcp() {
let dns_name = DnsName::from_str("example.com").unwrap();
let addr = NetworkAddress::from_str("/dns/example.com/tcp/123").unwrap();
let expected_suffix: &[Protocol] = &[];
assert_eq!(
parse_dns_tcp(addr.as_slice()).unwrap(),
((IpFilter::Any, &dns_name, 123), expected_suffix)
);
let addr = NetworkAddress::from_str("/dns4/example.com/tcp/123").unwrap();
let expected_suffix: &[Protocol] = &[];
assert_eq!(
parse_dns_tcp(addr.as_slice()).unwrap(),
((IpFilter::OnlyIp4, &dns_name, 123), expected_suffix)
);
let addr = NetworkAddress::from_str("/dns6/example.com/tcp/123").unwrap();
let expected_suffix: &[Protocol] = &[];
assert_eq!(
parse_dns_tcp(addr.as_slice()).unwrap(),
((IpFilter::OnlyIp6, &dns_name, 123), expected_suffix)
);
let addr = NetworkAddress::from_str("/dns/example.com/tcp/123/memory/44").unwrap();
let expected_suffix: &[Protocol] = &[Protocol::Memory(44)];
assert_eq!(
parse_dns_tcp(addr.as_slice()).unwrap(),
((IpFilter::Any, &dns_name, 123), expected_suffix)
);
let addr = NetworkAddress::from_str("/tcp/999/memory/123").unwrap();
assert_eq!(None, parse_dns_tcp(addr.as_slice()));
} | rust_cleaned_test_functions.jsonl/4282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 701
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
71125,
45562,
368,
341,
286,
1077,
44077,
1269,
284,
422,
4412,
675,
486,
1499,
2895,
445,
8687,
905,
1827,
15454,
543,
286,
1077,
10789,
284,
8141,
4286,
486,
1499,
2895,
4283,
45226,
6518... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_incomplete() {
let r = Response { response: &[0] };
assert_eq!(r.parse(), ParsedResponse::Incomplete);
let r = Response { response: &[0, 1, 2, 3, 4, 5, 6] };
assert_eq!(r.parse(), ParsedResponse::Incomplete);
let r = Response { response: &[0, 1, 2, 3, 4, 5, 6, 13] };
assert_eq!(r.parse(), ParsedResponse::Incomplete);
} | rust_cleaned_test_functions.jsonl/77731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1243,
14737,
368,
341,
286,
1077,
435,
284,
5949,
314,
2033,
25,
44590,
15,
60,
2605,
286,
2060,
10714,
10297,
81,
4632,
1507,
393,
18112,
2582,
486,
96698,
626,
286,
1077,
435,
284,
5949... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_internal_fn_is_def() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert!(engine.eval::<bool>(
r#"
fn foo(x) { x + 1 }
is_def_fn("foo", 1)
"#
)?);
assert!(!engine.eval::<bool>(
r#"
fn foo(x) { x + 1 }
is_def_fn("bar", 1)
"#
)?);
assert!(!engine.eval::<bool>(
r#"
fn foo(x) { x + 1 }
is_def_fn("foo", 0)
"#
)?);
Ok(())
} | rust_cleaned_test_functions.jsonl/131012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23472,
15246,
6892,
7844,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10297,
8512,
31710,
27638,
2641,
17055,
286,
435,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_display_fromstr() {
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S(#[serde_as(as = "DisplayFromStr")] u32);
is_equal(S(123), expect![[r#""123""#]]);
} | rust_cleaned_test_functions.jsonl/45727 | {
"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,
14825,
5673,
495,
368,
341,
262,
11506,
47024,
11898,
921,
262,
11506,
27098,
42618,
11,
39900,
11,
48440,
11,
55039,
5563,
262,
2036,
328,
7,
13353,
47024,
11898,
36951,
284,
330,
7020,
3830,
258... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quote_safe() {
let should_not_quote = "<>";
assert_eq!(quote(should_not_quote, should_not_quote.as_bytes()).ok().unwrap(), should_not_quote);
assert_eq!(quote_plus(should_not_quote, should_not_quote.as_bytes()).ok().unwrap(), should_not_quote);
} | rust_cleaned_test_functions.jsonl/21619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45236,
34067,
368,
341,
262,
1077,
1265,
7913,
45236,
284,
4055,
6734,
262,
2060,
10714,
10297,
2949,
7,
5445,
7913,
45236,
11,
1265,
7913,
45236,
5357,
12524,
6011,
562,
1005,
15454,
1507,
1265,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transform_fields() {
let re = Regex::new(",").unwrap();
assert_eq!(
super::parse_transform_fields(&re, &"A,B,C,D,E,F", &vec![Single(2), Single(4), Single(-1), Single(-7)]),
"B,D,F"
);
assert_eq!(
super::parse_transform_fields(&re, &"A,B,C,D,E,F", &vec![LeftInf(3), LeftInf(-6), LeftInf(-7)]),
"A,B,C,A,"
);
assert_eq!(
super::parse_transform_fields(
&re,
&"A,B,C,D,E,F",
&vec![RightInf(5), RightInf(-2), RightInf(-1), RightInf(8)]
),
"E,FE,FF"
);
assert_eq!(
super::parse_transform_fields(
&re,
&"A,B,C,D,E,F",
&vec![Both(3, 3), Both(-9, 2), Both(6, 10), Both(-9, -5)]
),
"C,A,B,FA,B,"
);
} | rust_cleaned_test_functions.jsonl/82619 | {
"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,
21039,
18449,
12132,
368,
341,
1789,
286,
1077,
312,
284,
26146,
486,
931,
47503,
568,
15454,
1428,
286,
2060,
10714,
33673,
310,
2256,
486,
6400,
18449,
12132,
2099,
265,
11,
609,
1,
32,
8161,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_object_file_representation_eof_only() {
let records = &[Record::EndOfFile];
let expected_result = String::from(":00000001FF\n");
assert_eq!(
create_object_file_representation(records),
Ok(expected_result)
);
} | rust_cleaned_test_functions.jsonl/105914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
5314,
2458,
94263,
90792,
18410,
368,
341,
262,
1077,
7424,
284,
44590,
6471,
486,
3727,
74696,
935,
262,
1077,
3601,
5287,
284,
923,
486,
1499,
18893,
15,
15,
15,
15,
15,
15,
15,
16,
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_list_index() {
Python::with_gil(|py| {
let list = PyList::new(py, &[1, 1, 2, 3, 5, 8]);
assert_eq!(0, list.index(1i32).unwrap());
assert_eq!(2, list.index(2i32).unwrap());
assert_eq!(3, list.index(3i32).unwrap());
assert_eq!(4, list.index(5i32).unwrap());
assert_eq!(5, list.index(8i32).unwrap());
assert!(list.index(42i32).is_err());
});
} | rust_cleaned_test_functions.jsonl/108649 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
3560,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
1140,
284,
5355,
852,
486,
931,
46827,
11,
44590,
16,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_too_many_tokens() {
let err = Model::train("data/many_tokens.ffm").unwrap_err();
assert_eq!(err.to_string(), "FFM error (line: 1, node: 1, token: 4): too many tokens".to_string());
} | rust_cleaned_test_functions.jsonl/25230 | {
"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,
2346,
78,
22101,
28838,
368,
341,
286,
1077,
1848,
284,
4903,
486,
10397,
445,
691,
14,
34576,
28838,
83885,
76,
1827,
15454,
9266,
543,
286,
2060,
10714,
10297,
615,
2389,
3904,
1507,
330,
1748,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_text_string() {
assert_eq!(
extract_text_string(cbor_int!(123)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
extract_text_string(cbor_bool!(true)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(extract_text_string(cbor_text!("")), Ok(String::new()));
assert_eq!(
extract_text_string(cbor_text!("foo")),
Ok(String::from("foo"))
);
assert_eq!(
extract_text_string(cbor_bytes_lit!(b"bar")),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
extract_text_string(cbor_array![]),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
extract_text_string(cbor_map! {}),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
} | rust_cleaned_test_functions.jsonl/48995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 529
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
4326,
3904,
368,
341,
286,
2060,
10714,
33673,
310,
8649,
4326,
3904,
1337,
9368,
4042,
10297,
16,
17,
18,
6965,
310,
15495,
7,
1162,
2537,
17,
9875,
48933,
868,
6735,
80002,
4189,
340,
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_default_manifest() {
// This test is to ensure that `BifrostManifest::default` does
// not panic.
let _dm = BifrostManifest::default();
} | rust_cleaned_test_functions.jsonl/33225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
74269,
368,
341,
286,
442,
1096,
1273,
374,
311,
5978,
429,
1565,
33,
333,
41502,
38495,
486,
2258,
63,
1558,
198,
286,
442,
537,
21975,
624,
286,
1077,
716,
13849,
284,
425,
333,
41502,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_device_cgroup() {
let mut spec = Spec {
linux: Some(Linux::default()),
..Default::default()
};
update_device_cgroup(&mut spec).unwrap();
let devices = spec.linux.unwrap().resources.unwrap().devices;
assert_eq!(devices.len(), 1);
let meta = fs::metadata(VM_ROOTFS).unwrap();
let rdev = meta.dev();
let major = stat::major(rdev) as i64;
let minor = stat::minor(rdev) as i64;
assert_eq!(devices[0].major, Some(major));
assert_eq!(devices[0].minor, Some(minor));
} | rust_cleaned_test_functions.jsonl/53136 | {
"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,
9204,
666,
4074,
368,
341,
286,
1077,
5206,
1398,
284,
10956,
341,
310,
36245,
25,
4329,
4957,
19559,
486,
2258,
14702,
310,
5241,
3675,
486,
2258,
741,
286,
3634,
286,
2647,
9204,
666,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_binomial() {
macro_rules! check_simple {
($t:ty) => { {
let n: $t = 3;
let expected = [1, 3, 3, 1];
for (b, &e) in IterBinomial::new(n).zip(&expected) {
assert_eq!(b, e);
}
} }
}
check_simple!(u8);
check_simple!(i8);
check_simple!(u16);
check_simple!(i16);
check_simple!(u32);
check_simple!(i32);
check_simple!(u64);
check_simple!(i64);
macro_rules! check_binomial {
($t:ty, $n:expr) => { {
let n: $t = $n;
let mut k: $t = 0;
for b in IterBinomial::new(n) {
assert_eq!(b, binomial(n, k));
k += 1;
}
} }
}
// Check the largest n for which there is no overflow.
check_binomial!(u8, 10);
check_binomial!(i8, 9);
check_binomial!(u16, 18);
check_binomial!(i16, 17);
check_binomial!(u32, 34);
check_binomial!(i32, 33);
check_binomial!(u64, 67);
check_binomial!(i64, 66);
} | rust_cleaned_test_functions.jsonl/5338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
21816,
20855,
368,
341,
262,
18072,
21407,
0,
1779,
30015,
341,
286,
1711,
83,
25,
1881,
8,
589,
314,
341,
310,
1077,
308,
25,
400,
83,
284,
220,
18,
280,
310,
1077,
3601,
284,
508,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bool_array_and_sliced_offset1() {
let a = BooleanArray::from(vec![
false, false, false, false, false, false, false, false, false, false, true,
true,
]);
let b = BooleanArray::from(vec![false, true, false, true]);
let a = a.slice(8, 4);
let a = a.as_any().downcast_ref::<BooleanArray>().unwrap();
let c = and(&a, &b).unwrap();
assert_eq!(4, c.len());
assert_eq!(false, c.value(0));
assert_eq!(false, c.value(1));
assert_eq!(false, c.value(2));
assert_eq!(true, c.value(3));
} | rust_cleaned_test_functions.jsonl/118982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
3858,
8378,
643,
74630,
6917,
16,
368,
341,
286,
1077,
264,
284,
6992,
1857,
486,
1499,
25592,
90515,
310,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_host_off() {
let src = ":tmi.twitch.tv HOSTTARGET #randers :- 0";
let irc_message = IRCMessage::parse(src).unwrap();
let msg = HostTargetMessage::try_from(irc_message.clone()).unwrap();
assert_eq!(
msg,
HostTargetMessage {
channel_login: "randers".to_owned(),
action: HostTargetAction::HostModeOff {
viewer_count: Some(0)
},
source: irc_message
}
);
} | rust_cleaned_test_functions.jsonl/1051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
13651,
368,
341,
286,
1077,
2286,
284,
13022,
83,
8155,
90179,
14485,
44578,
45583,
671,
11335,
388,
20955,
220,
15,
876,
286,
1077,
79923,
6462,
284,
59328,
2052,
486,
6400,
14705,
568,
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_call_hierarchy_outgoing_in_different_files() {
check_hierarchy(
r#"
//- /lib.rs
mod foo;
use foo::callee;
fn call$0er() {
callee();
}
//- /foo/mod.rs
pub fn callee() {}
"#,
"caller Function FileId(0) 27..56 30..36",
&[],
&["callee Function FileId(1) 0..18 7..13 : [45..51]"],
);
} | rust_cleaned_test_functions.jsonl/738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
95043,
6068,
9546,
1243,
82741,
10931,
368,
341,
286,
1779,
95043,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
280,
810,
15229,
486,
86476,
401,
8822,
1618,
3,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_canonicalize_idents_different_protocols() {
let ident1 = ident(&src("https://github.com/PistonDevelopers/piston"));
let ident2 = ident(&src("git://github.com/PistonDevelopers/piston"));
assert_eq!(ident1, ident2);
} | rust_cleaned_test_functions.jsonl/127468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
22391,
551,
842,
805,
82741,
22357,
22018,
368,
341,
286,
1077,
3524,
16,
284,
3524,
2099,
3548,
445,
2428,
1110,
5204,
905,
16341,
58819,
20444,
388,
4322,
58819,
4010,
286,
1077,
3524,
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_rand() {
let got = eval_func(ScalarFuncSig::Rand, &[Datum::Null])
.unwrap()
.as_real()
.unwrap();
assert!(got.is_some());
assert!(got.unwrap() < 1.0);
assert!(got.unwrap() >= 0.0);
} | rust_cleaned_test_functions.jsonl/13169 | {
"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,
33864,
368,
341,
286,
1077,
2684,
284,
5603,
9596,
7,
20639,
9626,
47246,
486,
56124,
11,
44590,
68036,
486,
3280,
2546,
310,
659,
15454,
741,
310,
659,
300,
15266,
741,
310,
659,
15454,
1428,
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_33() {
assert_eq!(Solution::search(vec![2, 5, 6, 0, 0, 1, 2], 0), true);
assert_eq!(Solution::search(vec![2, 5, 6, 0, 0, 1, 2], 3), false);
} | rust_cleaned_test_functions.jsonl/116674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
18,
18,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
1836,
25592,
20703,
17,
11,
220,
20,
11,
220,
21,
11,
220,
15,
11,
220,
15,
11,
220,
16,
11,
220,
17,
1125,
220,
15,
701,
830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_value_extreme() {
let bytes = &[];
let mut reader = BytesReader::from_bytes(bytes);
let d = TestExtremeDefaultValues::from_reader(&mut reader, bytes).unwrap();
assert_eq!(f64::INFINITY, d.inf_double);
assert_eq!(f64::NEG_INFINITY, d.neg_inf_double);
assert!(d.nan_double.is_nan());
assert_eq!(f32::INFINITY, d.inf_float);
assert_eq!(f32::NEG_INFINITY, d.neg_inf_float);
assert!(d.nan_float.is_nan());
} | rust_cleaned_test_functions.jsonl/117010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
3142,
9927,
9634,
368,
341,
262,
1077,
5820,
284,
609,
15078,
262,
1077,
5206,
6604,
284,
30024,
5062,
486,
1499,
12524,
23158,
317,
262,
1077,
294,
284,
3393,
92518,
3675,
6227,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_diff_multiple_inputs_one_different() {
let diff = Diff::default_refinement(&[b"a b c", b"a X c", b"a b c"]);
assert_eq!(
diff.hunks().collect_vec(),
vec![
DiffHunk::Matching(b"a "),
DiffHunk::Different(vec![b"b", b"X", b"b"]),
DiffHunk::Matching(b" c"),
]
);
} | rust_cleaned_test_functions.jsonl/89259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
45233,
28557,
11667,
82741,
368,
341,
286,
1077,
3638,
284,
28369,
486,
2258,
7793,
37184,
2099,
58,
65,
56693,
293,
272,
497,
293,
56693,
1599,
272,
497,
293,
56693,
293,
272,
15049,
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_allocate_new_block() {
let a = BlockArena::new();
let mut expect_size = 0;
for (i, size) in [1, 128, 256, 1000, 4096, 10000].iter().enumerate() {
a.allocate_new_block(*size);
expect_size += *size;
assert_eq!(a.memory_used(), expect_size, "memory used should match");
assert_eq!(
a.blocks.borrow().len(),
i + 1,
"number of blocks should match"
)
}
} | rust_cleaned_test_functions.jsonl/14860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77078,
5921,
7113,
368,
341,
286,
1077,
264,
284,
8362,
93937,
486,
931,
543,
286,
1077,
5206,
1720,
2368,
284,
220,
15,
280,
286,
369,
320,
72,
11,
1379,
8,
304,
508,
16,
11,
220,
16,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_duplicate_shred_header_size() {
let dup = DuplicateShred {
from: Pubkey::new_unique(),
wallclock: u64::MAX,
slot: Slot::MAX,
shred_index: u32::MAX,
shred_type: ShredType(u8::MAX),
num_chunks: u8::MAX,
chunk_index: u8::MAX,
chunk: Vec::default(),
};
assert_eq!(
bincode::serialize(&dup).unwrap().len(),
DUPLICATE_SHRED_HEADER_SIZE
);
assert_eq!(
bincode::serialized_size(&dup).unwrap(),
DUPLICATE_SHRED_HEADER_SIZE as u64
);
} | rust_cleaned_test_functions.jsonl/21873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
3712,
1151,
8757,
2368,
368,
341,
286,
1077,
22737,
284,
71071,
2016,
1151,
341,
310,
504,
25,
22611,
792,
486,
931,
21218,
3148,
310,
7002,
20666,
25,
575,
21,
19,
486,
10586,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_str() {
assert_eq!("linear".parse(), Ok(MoleculeTopology::Linear));
assert_eq!("circular".parse(), Ok(MoleculeTopology::Circular));
assert_eq!("".parse::<MoleculeTopology>(), Err(ParseError::Empty));
assert_eq!(
"noodles".parse::<MoleculeTopology>(),
Err(ParseError::Invalid)
);
assert_eq!(
"Linear".parse::<MoleculeTopology>(),
Err(ParseError::Invalid)
);
} | rust_cleaned_test_functions.jsonl/121814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
368,
341,
286,
2060,
10714,
17223,
22763,
3263,
6400,
1507,
7622,
3189,
54169,
60954,
486,
31898,
1106,
286,
2060,
10714,
17223,
66,
21472,
3263,
6400,
1507,
7622,
3189,
54169,
60954,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invoke_context_verify() {
let accounts = vec![(
solana_sdk::pubkey::new_rand(),
Rc::new(RefCell::new(AccountSharedData::default())),
)];
let message = Message::new(
&[Instruction::new_with_bincode(
accounts[0].0,
&MockInstruction::NoopSuccess,
vec![AccountMeta::new_readonly(accounts[0].0, false)],
)],
None,
);
let mut invoke_context = ThisInvokeContext::new_mock(&accounts, &[]);
invoke_context
.push(&message, &message.instructions[0], &[0], None)
.unwrap();
assert!(invoke_context
.verify(&message, &message.instructions[0], &[0])
.is_ok());
let mut _borrowed = accounts[0].1.borrow();
assert_eq!(
invoke_context.verify(&message, &message.instructions[0], &[0]),
Err(InstructionError::AccountBorrowOutstanding)
);
} | rust_cleaned_test_functions.jsonl/6710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79779,
8467,
35638,
368,
341,
286,
1077,
9618,
284,
7486,
20703,
1006,
310,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
3148,
310,
81463,
486,
931,
7,
3945,
3599,
486,
931,
65360,
16997,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug_is_implemented_with_no_default_bitrange() {
format!("{:?}", BitField1(0));
format!("{:?}", BitField3(0));
format!("{:?}", BitField4([0; 1]));
format!("{:?}", BitField6([0; 1]));
format!("{:?}", BitField7([0; 1]));
format!("{:?}", BitField9([0; 1]));
} | rust_cleaned_test_functions.jsonl/2280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
6892,
17895,
14231,
6615,
6536,
9993,
13996,
9669,
368,
341,
286,
3561,
88928,
25,
52652,
6495,
1877,
16,
7,
15,
1106,
286,
3561,
88928,
25,
52652,
6495,
1877,
18,
7,
15,
1106,
286,
3561,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_where_eq() -> Result<()> {
let res = SqlBuilder::select_from("books")
.and_where_eq("", "aaa")
.sql();
if let Err(err) = res {
assert_eq!(&err.to_string(), "WHERE field not defined");
} else {
panic!("Error checking does not works");
}
Ok(())
} | rust_cleaned_test_functions.jsonl/12611 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
36814,
10714,
368,
1464,
5714,
71698,
341,
286,
1077,
592,
284,
7224,
3297,
486,
1742,
5673,
445,
12110,
1138,
310,
659,
437,
36814,
10714,
19814,
330,
32646,
1138,
310,
659,
3544,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_validator_set() {
let num_nodes = 4;
let (_env, op_tool, backend, mut storage) = launch_swarm_with_op_tool_and_backend(num_nodes, 0);
// Fetch the validator config and validator info for this operator's owner
let owner_account = storage.get::<AccountAddress>(OWNER_ACCOUNT).unwrap().value;
let validator_config = op_tool.validator_config(owner_account, &backend).unwrap();
let validator_set_infos = op_tool
.validator_set(Some(owner_account), &backend)
.unwrap();
assert_eq!(1, validator_set_infos.len());
// Compare the validator config and the validator info
let validator_info = validator_set_infos.first().unwrap();
assert_eq!(validator_info.account_address, owner_account);
assert_eq!(validator_info.name, validator_config.name);
assert_eq!(
validator_info.consensus_public_key,
validator_config.consensus_public_key
);
assert_eq!(
validator_info.validator_network_address,
validator_config.validator_network_address
);
assert_eq!(
validator_info.fullnode_network_address,
validator_config.fullnode_network_address
);
// Fetch the entire validator set and check this account is included
let validator_set_infos = op_tool.validator_set(None, &backend).unwrap();
assert_eq!(num_nodes, validator_set_infos.len());
let _ = validator_set_infos
.iter()
.find(|info| info.account_address == owner_account)
.unwrap();
// Overwrite the shared network encryption key in storage and verify that the
// validator set can still be retrieved (but unable to decrypt the validator
// network address)
let _ = storage
.set(VALIDATOR_NETWORK_ADDRESS_KEYS, "random string")
.unwrap();
let validator_set_infos = op_tool.validator_set(None, &backend).unwrap();
assert_eq!(num_nodes, validator_set_infos.len());
let validator_info = validator_set_infos
.iter()
.find(|info| info.account_address == owner_account)
.unwrap();
assert_eq!(
validator_info.fullnode_network_address,
validator_config.fullnode_network_address
);
assert_ne!(
validator_info.validator_network_address,
validator_config.validator_network_address
);
} | rust_cleaned_test_functions.jsonl/64976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 922
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64959,
2602,
368,
341,
262,
1077,
1629,
14896,
284,
220,
19,
280,
262,
1077,
5453,
3160,
11,
1179,
22785,
11,
19163,
11,
5206,
5819,
8,
284,
7050,
32581,
2178,
6615,
10287,
22785,
8378,
40011,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_train_eval() {
let err = Model::train_eval("data/train.ffm", "missing.ffm").unwrap_err();
assert_eq!(err.to_string(), "No such file or directory (os error 2)".to_string());
} | rust_cleaned_test_functions.jsonl/25224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
7591,
21296,
368,
341,
286,
1077,
1848,
284,
4903,
486,
10397,
21296,
445,
691,
50838,
83885,
76,
497,
330,
30616,
83885,
76,
1827,
15454,
9266,
543,
286,
2060,
10714,
10297,
615,
2389,
390... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_global_type() {
// create a GlobalType instance
let result = GlobalType::create(ValType::I32, Mutability::Const);
assert!(result.is_ok());
let global_ty = result.unwrap();
assert!(!global_ty.inner.0.is_null());
assert!(!global_ty.registered);
// value type
assert_eq!(global_ty.value_type(), ValType::I32);
// Mutability
assert_eq!(global_ty.mutability(), Mutability::Const);
} | rust_cleaned_test_functions.jsonl/91080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
1819,
368,
341,
286,
442,
1855,
264,
7962,
929,
2867,
198,
286,
1077,
1102,
284,
7962,
929,
486,
3182,
7,
2208,
929,
486,
40,
18,
17,
11,
31228,
2897,
486,
19167,
317,
286,
2060,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_and_with_one_lte_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let json = format!(r#"{{"$and":[{{"~{}":{{"$lte":"{}"}}}}]}}"#, name1, value1);
let query = parse_from_json(&json).unwrap();
let expected = Operator::And(
vec![
Operator::Lte(
TagName::PlainTagName(name1.to_vec()),
TargetValue::Unencrypted(value1.clone())
)
]
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
6615,
11667,
907,
665,
21039,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
2951,
284,
3561... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser_with_dereference_data() {
let builder = InitialLinuxLibcStackLayoutBuilder::new()
.add_arg_v("first_arg\0")
.add_arg_v("second_arg")
.add_arg_v("third__arg")
.add_env_v("ENV1=FOO")
.add_env_v("ENV2=BAR")
.add_env_v("ENV3=FOOBAR\0")
.add_aux_v(AuxVar::Platform("x86_64"))
.add_aux_v(AuxVar::Uid(0xdeadbeef));
let mut buf = vec![0; builder.total_size()];
unsafe {
// user_addr == write_addr => easy debugging
let user_ptr = buf.as_ptr() as u64;
builder.serialize_into_buf(buf.as_mut_slice(), user_ptr);
}
let parsed = InitialLinuxLibcStackLayout::from(buf.as_slice());
dbg!(parsed.argc());
dbg!(parsed.argv_ptr_iter().collect::<Vec<_>>());
unsafe {
dbg!(parsed.argv_iter().collect::<Vec<_>>());
}
dbg!(parsed.envv_ptr_iter().collect::<Vec<_>>());
unsafe {
dbg!(parsed.envv_iter().collect::<Vec<_>>());
}
dbg!(parsed.aux_serialized_iter().collect::<Vec<_>>());
} | rust_cleaned_test_functions.jsonl/17057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
6615,
814,
485,
2202,
1769,
368,
341,
286,
1077,
7363,
284,
4127,
46324,
9194,
66,
4336,
2175,
3297,
486,
931,
741,
310,
659,
718,
6057,
2273,
445,
3896,
6057,
59,
15,
1138,
310,
659,
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_update_structured_extended_entry() {
use crate::cpu_leaf::leaf_0x7::index0::*;
// Check that if index == 0 the entry is processed
let vm_spec = VmSpec::new(0, 1, false).expect("Error creating vm_spec");
let mut entry = &mut kvm_cpuid_entry2 {
function: leaf_0x7::LEAF_NUM,
index: 0,
flags: 0,
eax: 0,
ebx: 0,
ecx: 0,
edx: *(0 as u32).write_bit(edx::ARCH_CAPABILITIES_BITINDEX, true),
padding: [0, 0, 0],
};
assert!(update_structured_extended_entry(&mut entry, &vm_spec).is_ok());
assert_eq!(entry.edx.read_bit(edx::ARCH_CAPABILITIES_BITINDEX), false);
// Check that if index != 0 the entry is not processed
entry.index = 1;
entry.edx.write_bit(edx::ARCH_CAPABILITIES_BITINDEX, true);
assert!(update_structured_extended_entry(&mut entry, &vm_spec).is_ok());
assert_eq!(entry.edx.read_bit(edx::ARCH_CAPABILITIES_BITINDEX), true);
} | rust_cleaned_test_functions.jsonl/94917 | {
"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,
8882,
15126,
3073,
61678,
9078,
368,
341,
286,
990,
17717,
486,
16475,
38909,
486,
24153,
62,
15,
87,
22,
486,
1252,
15,
79304,
286,
442,
4248,
429,
421,
1922,
621,
220,
15,
279,
4343,
374,
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_encode_length() {
assert_eq!(encode_length(0), [0; 4]);
assert_eq!(encode_length(1), [1, 0, 0, 0]);
assert_eq!(
encode_length(MAX_LENGTH_VALUE),
[255; BYTES_PER_LENGTH_OFFSET]
);
} | rust_cleaned_test_functions.jsonl/106471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
5118,
368,
341,
286,
2060,
10714,
10297,
6180,
5118,
7,
15,
701,
508,
15,
26,
220,
19,
10149,
286,
2060,
10714,
10297,
6180,
5118,
7,
16,
701,
508,
16,
11,
220,
15,
11,
220,
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... | 1 |
#[test]
fn test_encode_string_vectors() {
let mut dest = vec![];
let value: Vec<String> = vec![String::from("test")];
let result = value.encode(&mut dest, 0);
assert!(result.is_ok());
assert_eq!(dest.len(), 10);
assert_eq!(dest[3], 0x01);
assert_eq!(dest[9], 0x74);
assert_eq!(value.write_size(0), dest.len());
} | rust_cleaned_test_functions.jsonl/126952 | {
"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,
11224,
3904,
49158,
368,
341,
286,
1077,
5206,
3201,
284,
7486,
0,
15078,
286,
1077,
897,
25,
11312,
3464,
29,
284,
7486,
20703,
703,
486,
1499,
445,
1944,
899,
935,
286,
1077,
1102,
284,
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_basic_auth_parse_no_password() {
let r: Raw = b"Basic QWxhZGRpbjo=".as_ref().into();
let auth: Authorization<Basic> = Header::parse_header(&r).unwrap();
assert_eq!(auth.0.username, "Aladdin");
assert_eq!(auth.0.password, Some("".to_owned()));
} | rust_cleaned_test_functions.jsonl/31566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
14014,
21039,
6536,
10122,
368,
341,
286,
1077,
435,
25,
23022,
284,
293,
1,
15944,
1207,
54,
87,
71,
57,
8626,
16650,
7305,
35226,
300,
7793,
1005,
18122,
543,
286,
1077,
4166,
25,
30562... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_anyhow_py_function_ok_result() {
use pyo3::{py_run, pyfunction, wrap_pyfunction, Python};
#[pyfunction]
fn produce_ok_result() -> anyhow::Result<String> {
Ok(String::from("OK buddy"))
}
Python::with_gil(|py| {
let func = wrap_pyfunction!(produce_ok_result)(py).unwrap();
py_run!(
py,
func,
r#"
func()
"#
);
});
} | rust_cleaned_test_functions.jsonl/46316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37248,
5158,
40291,
9174,
19817,
5287,
368,
341,
262,
990,
4510,
78,
18,
22964,
3288,
14007,
11,
4510,
1688,
11,
15061,
40291,
1688,
11,
13027,
2315,
262,
11506,
3288,
1688,
921,
262,
5168,
8193,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_body() {
block_on(async {
let srv = TestServer::start(|| {
HttpService::new(
App::new()
.service(post_test)
.service(put_test)
.service(head_test)
.service(connect_test)
.service(options_test)
.service(trace_test)
.service(patch_test)
.service(test),
)
});
let request = srv.request(http::Method::GET, srv.url("/test"));
let response = request.send().await.unwrap();
assert!(response.status().is_success());
let request = srv.request(http::Method::HEAD, srv.url("/test"));
let response = request.send().await.unwrap();
assert!(response.status().is_success());
let request = srv.request(http::Method::CONNECT, srv.url("/test"));
let response = request.send().await.unwrap();
assert!(response.status().is_success());
let request = srv.request(http::Method::OPTIONS, srv.url("/test"));
let response = request.send().await.unwrap();
assert!(response.status().is_success());
let request = srv.request(http::Method::TRACE, srv.url("/test"));
let response = request.send().await.unwrap();
assert!(response.status().is_success());
let request = srv.request(http::Method::PATCH, srv.url("/test"));
let response = request.send().await.unwrap();
assert!(response.status().is_success());
let request = srv.request(http::Method::PUT, srv.url("/test"));
let response = request.send().await.unwrap();
assert!(response.status().is_success());
assert_eq!(response.status(), http::StatusCode::CREATED);
let request = srv.request(http::Method::POST, srv.url("/test"));
let response = request.send().await.unwrap();
assert!(response.status().is_success());
assert_eq!(response.status(), http::StatusCode::NO_CONTENT);
let request = srv.request(http::Method::GET, srv.url("/test"));
let response = request.send().await.unwrap();
assert!(response.status().is_success());
})
} | rust_cleaned_test_functions.jsonl/129741 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1024
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14114,
368,
341,
262,
2504,
4470,
18285,
341,
286,
1077,
43578,
284,
3393,
5475,
486,
2468,
79453,
341,
310,
4823,
1860,
486,
931,
1006,
394,
1845,
486,
931,
741,
503,
659,
7936,
19630,
4452,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_limit_and_offset_when_only_limit_is_set() {
let expected = expected_values("SELECT \"users\".* FROM \"users\" LIMIT $1", vec![10]);
let query = Select::from_table("users").limit(10);
let (sql, params) = Postgres::build(query).unwrap();
assert_eq!(expected.0, sql);
assert_eq!(expected.1, params);
} | rust_cleaned_test_functions.jsonl/6447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14763,
8378,
6917,
47636,
18410,
14763,
6892,
2602,
368,
341,
286,
1077,
3601,
284,
3601,
9146,
445,
4858,
7245,
4218,
2105,
4908,
4295,
7245,
4218,
2105,
10376,
400,
16,
497,
7486,
20703,
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_read_propagates_error() {
let source = FakeSource::with_error(ErrorKind::ResizingTerminalFailure("Foo".to_string()));
let mut reader = InternalEventReader {
events: VecDeque::new(),
source: Some(Box::new(source)),
};
assert_eq!(
reader
.read(&InternalEventFilter)
.err()
.map(|e| format!("{:?}", &e)),
Some(format!(
"{:?}",
ErrorKind::ResizingTerminalFailure("Foo".to_string())
))
);
} | rust_cleaned_test_functions.jsonl/101479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
21663,
351,
973,
4096,
368,
341,
286,
1077,
2530,
284,
36965,
3608,
486,
4197,
4096,
37396,
10629,
486,
1061,
4849,
47890,
17507,
445,
40923,
3263,
983,
3904,
25138,
286,
1077,
5206,
6604,
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_basic() {
Runtime::new()
.unwrap()
.block_on(lazy(|| {
let (_, payload) = Payload::new(false);
let mut payload = PayloadBuffer::new(payload);
assert_eq!(payload.len, 0);
assert_eq!(Async::NotReady, payload.readany().ok().unwrap());
let res: Result<(), ()> = Ok(());
result(res)
}))
.unwrap();
} | rust_cleaned_test_functions.jsonl/1591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
341,
286,
10954,
486,
931,
741,
310,
659,
15454,
741,
310,
659,
4574,
4470,
2333,
13619,
79453,
341,
394,
1077,
39464,
7729,
8,
284,
52916,
486,
931,
3576,
317,
394,
1077,
5206,
7729... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.