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_gnu_asm() {
use parser::statement;
assert_eq!(
statement(
r#"__asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));"#,
&mut Env::new()
),
Ok(GnuExtendedAsmStatement {
qualifier: None,
template: cstr(&[r#""pmovmskb %1, %0""#]),
outputs: vec![GnuAsmOperand {
symbolic_name: None,
constraints: cstr(&[r#""=r""#]),
variable_name: ident("__m"),
}
.into()],
inputs: vec![GnuAsmOperand {
symbolic_name: None,
constraints: cstr(&[r#""x""#]),
variable_name: ident("__x"),
}
.into()],
clobbers: vec![],
}
.into())
);
} | rust_cleaned_test_functions.jsonl/107560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 496
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
8933,
67529,
368,
341,
262,
990,
6729,
486,
24184,
401,
262,
2060,
10714,
33673,
286,
5114,
1006,
310,
435,
55543,
563,
10530,
3489,
5187,
859,
1011,
21310,
1018,
16,
11,
1018,
15,
1,
549,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ip_packet_in_ethernet_frame() {
use crate::testdata::tls_client_hello_v4::*;
let (body, src_mac, dst_mac, src_ip, dst_ip, proto, ttl) =
parse_ip_packet_in_ethernet_frame::<Ipv4>(ETHERNET_FRAME.bytes).unwrap();
assert_eq!(body, &IPV4_PACKET.bytes[IPV4_PACKET.body_range]);
assert_eq!(src_mac, ETHERNET_FRAME.metadata.src_mac);
assert_eq!(dst_mac, ETHERNET_FRAME.metadata.dst_mac);
assert_eq!(src_ip, IPV4_PACKET.metadata.src_ip);
assert_eq!(dst_ip, IPV4_PACKET.metadata.dst_ip);
assert_eq!(proto, IPV4_PACKET.metadata.proto);
assert_eq!(ttl, IPV4_PACKET.metadata.ttl);
} | rust_cleaned_test_functions.jsonl/13585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10385,
21078,
1243,
57757,
13845,
8929,
368,
341,
286,
990,
17717,
486,
92425,
486,
34488,
8179,
96724,
2273,
19,
56162,
286,
1077,
320,
2599,
11,
2286,
22802,
11,
10648,
22802,
11,
2286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_size() {
// minwinbase
assert_size!(Win32FindDataA, WIN32_FIND_DATAA);
assert_size!(SidIdentifierAuthority, SID_IDENTIFIER_AUTHORITY);
assert_size!(SecurityAttributes, SECURITY_ATTRIBUTES);
assert_size!(Sid, SID);
assert_size!(Acl, ACL);
assert_size!(SecurityDescriptor, SECURITY_DESCRIPTOR);
assert_size!(Overlapped, OVERLAPPED);
// processthreadsapi
assert_size!(StartupInfoA, STARTUPINFOA);
assert_size!(ProcessInformation, PROCESS_INFORMATION);
// winnt
assert_size!(ProcessorNumber, PROCESSOR_NUMBER);
assert_size!(GroupAffinity, GROUP_AFFINITY);
assert_size!(ExceptionPointers, EXCEPTION_POINTERS);
assert_size!(ExceptionRecord, EXCEPTION_RECORD);
// minwindef
assert_size!(FileTime, FILETIME);
assert_size!(SystemTime, SYSTEMTIME);
// tlhelp32
assert_size!(HeapList32, HEAPLIST32);
assert_size!(HeapEntry32, HEAPENTRY32);
assert_size!(ProcessEntry32, PROCESSENTRY32);
assert_size!(ProcessEntry32W, PROCESSENTRY32W);
assert_size!(ModuleEntry32, MODULEENTRY32);
assert_size!(ModuleEntry32W, MODULEENTRY32W);
// jobapi2
assert_size!(
JobObjectIoRateControlInformation,
JOBOBJECT_IO_RATE_CONTROL_INFORMATION
);
// verrsrc
assert_size!(VSFixedFileInfo, VS_FIXEDFILEINFO);
// winver
assert_size!(LangAndCodePage, LANGANDCODEPAGE);
} | rust_cleaned_test_functions.jsonl/15031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 736
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
2368,
368,
341,
286,
442,
1308,
7526,
3152,
198,
286,
2060,
2368,
10297,
16970,
18,
17,
9885,
1043,
32,
11,
22064,
18,
17,
67285,
7896,
32,
317,
286,
2060,
2368,
10297,
67653,
8714,
45532... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_smoke() {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
let mut msg = String::from("test");
let res = hooks_commit_msg(repo_path, &mut msg).unwrap();
assert_eq!(res, HookResult::Ok);
let res = hooks_post_commit(repo_path).unwrap();
assert_eq!(res, HookResult::Ok);
} | rust_cleaned_test_functions.jsonl/96225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15874,
4740,
368,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,
15867,
2638,
284,
3704,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_activate_duplicate_core_id() {
let mut devices = TestDevices::default();
let core_id = MockDeviceId(1);
// Add an active device with core_id
assert_eq!(devices.add_active_device(core_id, |id| id + 20), Some(1));
// Trying to activate another device with the same core_id should panic
let second_device = devices.add_device(|id| id + 10);
let _result = devices.activate_device(second_device, |_| core_id);
} | rust_cleaned_test_functions.jsonl/18163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67894,
70434,
15467,
842,
368,
341,
286,
1077,
5206,
7611,
284,
3393,
40835,
486,
2258,
543,
286,
1077,
6200,
842,
284,
14563,
6985,
764,
7,
16,
317,
286,
442,
2691,
458,
4541,
3671,
448,
6200,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deny_unknown_fields() {
assert_matches!(serde_json5::from_str::<Document>("{ unknown: \"\" }"), Err(_));
assert_matches!(serde_json5::from_str::<Environment>("{ unknown: \"\" }"), Err(_));
assert_matches!(serde_json5::from_str::<RunnerRegistration>("{ unknown: \"\" }"), Err(_));
assert_matches!(serde_json5::from_str::<ResolverRegistration>("{ unknown: \"\" }"), Err(_));
assert_matches!(serde_json5::from_str::<Use>("{ unknown: \"\" }"), Err(_));
assert_matches!(serde_json5::from_str::<Expose>("{ unknown: \"\" }"), Err(_));
assert_matches!(serde_json5::from_str::<Offer>("{ unknown: \"\" }"), Err(_));
assert_matches!(serde_json5::from_str::<Capability>("{ unknown: \"\" }"), Err(_));
assert_matches!(serde_json5::from_str::<Child>("{ unknown: \"\" }"), Err(_));
assert_matches!(serde_json5::from_str::<Collection>("{ unknown: \"\" }"), Err(_));
} | rust_cleaned_test_functions.jsonl/34907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
32395,
57507,
12132,
368,
341,
286,
2060,
38344,
10297,
47024,
9455,
20,
486,
1499,
2895,
27638,
7524,
13211,
90,
9788,
25,
7245,
2105,
335,
3975,
15495,
2490,
1106,
286,
2060,
38344,
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_6() {
assert_eq!(
parse_column_type(&mut Parser::new("decimal(18,4) zerofill")),
ColumnType::Decimal(NumericAttr {
maximum: Some(18),
decimal: Some(4),
unsigned: None,
zero_fill: Some(true),
})
);
} | rust_cleaned_test_functions.jsonl/73835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
21,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8744,
1819,
2099,
6984,
21102,
486,
931,
445,
23289,
7,
16,
23,
11,
19,
8,
76178,
1055,
483,
30154,
310,
9332,
929,
486,
11269,
8204,
1257... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_start_actor_builder() {
let count = Arc::new(AtomicUsize::new(0));
let act_count = Arc::clone(&count);
System::run(move || {
let addr = Arbiter::builder().start(move |_| MyActor(act_count));
addr.do_send(Ping(1));
});
assert_eq!(count.load(Ordering::Relaxed), 1);
} | rust_cleaned_test_functions.jsonl/132715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
54818,
28532,
368,
341,
262,
1077,
1760,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
1106,
262,
1077,
1160,
3180,
284,
19689,
486,
19982,
2099,
1830,
626,
262,
739,
486,
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... | 2 |
#[test]
fn test_analyze_options_declaration() {
let b = ast::BaseNode::default();
let pkg = ast::Package {
base: b.clone(),
path: "path".to_string(),
package: "main".to_string(),
files: vec![ast::File {
base: b.clone(),
name: "foo.flux".to_string(),
package: None,
imports: Vec::new(),
body: vec![ast::Statement::Option(ast::OptionStmt {
base: b.clone(),
assignment: ast::Assignment::Variable(ast::VariableAssgn {
base: b.clone(),
id: ast::Identifier {
base: b.clone(),
name: "task".to_string(),
},
init: ast::Expression::Object(Box::new(ast::ObjectExpr {
base: b.clone(),
with: None,
properties: vec![
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "name".to_string(),
}),
value: Some(ast::Expression::StringLit(ast::StringLit {
base: b.clone(),
value: "foo".to_string(),
})),
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "every".to_string(),
}),
value: Some(ast::Expression::Duration(ast::DurationLit {
base: b.clone(),
values: vec![ast::Duration {
magnitude: 1,
unit: "h".to_string(),
}],
})),
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "delay".to_string(),
}),
value: Some(ast::Expression::Duration(ast::DurationLit {
base: b.clone(),
values: vec![ast::Duration {
magnitude: 10,
unit: "m".to_string(),
}],
})),
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "cron".to_string(),
}),
value: Some(ast::Expression::StringLit(ast::StringLit {
base: b.clone(),
value: "0 2 * * *".to_string(),
})),
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "retry".to_string(),
}),
value: Some(ast::Expression::Integer(ast::IntegerLit {
base: b.clone(),
value: 5,
})),
},
],
})),
}),
})],
}],
};
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Option(OptionStmt {
loc: b.location.clone(),
assignment: Assignment::Variable(VariableAssgn {
loc: b.location.clone(),
id: Identifier {
loc: b.location.clone(),
name: "task".to_string(),
},
init: Expression::Object(Box::new(ObjectExpr {
loc: b.location.clone(),
typ: type_info(),
with: None,
properties: vec![
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "name".to_string(),
},
value: Expression::StringLit(StringLit {
loc: b.location.clone(),
typ: type_info(),
value: "foo".to_string(),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "every".to_string(),
},
value: Expression::Duration(DurationLit {
loc: b.location.clone(),
typ: type_info(),
value: chrono::Duration::hours(1),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "delay".to_string(),
},
value: Expression::Duration(DurationLit {
loc: b.location.clone(),
typ: type_info(),
value: chrono::Duration::minutes(10),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "cron".to_string(),
},
value: Expression::StringLit(StringLit {
loc: b.location.clone(),
typ: type_info(),
value: "0 2 * * *".to_string(),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "retry".to_string(),
},
value: Expression::Integer(IntegerLit {
loc: b.location.clone(),
typ: type_info(),
value: 5,
}),
},
],
})),
}),
})],
}],
};
let got = test_analyze(pkg).unwrap();
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/61560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 6731
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12008,
55856,
8743,
77926,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
11763,
486,
13100,
341,
310,
2331,
25,
293,
15997,
3148,
310,
1815,
25,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode() {
let tok = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzZWEifQ.L0DLtDjydcSK-c0gTyOYbmUQ_LUCZzqAGCINn2OLhFs";
// decode the payload to standard jwt::Claims
let t1: Token<Claims> = Token::decode(tok).unwrap();
// decode the payload to custom claims
let t2: Token<CustomClaims> = Token::decode(tok).unwrap();
// decode the payload to serde_json::Map
let t3: Token<Map<String, Value>> = Token::decode(tok).unwrap();
println!("{:?}\n{:?}\n{:?}", t1, t2, t3);
} | rust_cleaned_test_functions.jsonl/133971 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
368,
341,
262,
1077,
9628,
284,
330,
84609,
15,
68,
59450,
72,
81096,
34070,
53,
16,
96175,
8556,
41,
49039,
38,
5855,
81096,
45064,
52,
89,
40,
16,
56494,
41,
24,
13,
84609,
3992,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enc_in_place_err_empty_input() {
let n = Nonce::from([0u8; IETF_CHACHA_NONCESIZE]);
let sk = SecretKey::from([0u8; CHACHA_KEYSIZE]);
let mut out = [0u8; 0];
assert!(encrypt_in_place(&sk, &n, 0, &mut out).is_err());
} | rust_cleaned_test_functions.jsonl/44714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13781,
1243,
34548,
9266,
15124,
5898,
368,
341,
310,
1077,
308,
284,
11581,
346,
486,
1499,
2561,
15,
84,
23,
26,
358,
42239,
6466,
11873,
32,
22128,
32329,
3282,
2558,
310,
1077,
1901,
284,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_subtree() {
let root_hash = HashValue::new([1; HashValue::LENGTH]);
let smt = SparseMerkleTree::new(root_hash);
assert!(smt.root.read_lock().is_subtree());
assert_eq!(smt.root_hash(), root_hash);
} | rust_cleaned_test_functions.jsonl/15420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
5228,
9344,
368,
341,
262,
1077,
3704,
8950,
284,
6531,
1130,
486,
931,
2561,
16,
26,
6531,
1130,
486,
65981,
2558,
262,
1077,
1525,
83,
284,
71794,
44,
16754,
273,
6533,
486,
931,
9206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_tree_to_blob_into_tree_to_blob_with_conflict() -> BitResult<()> {
BitRepo::with_minimal_repo_with_dir(|repo| {
let ours = commit! {
dir < "dir"
};
let theirs = commit! {
dir < "conflict"
};
let conflicts = repo.three_way_merge(ours, theirs)?.into_conflicts();
assert_eq!(conflicts[0], Conflict::new_with_type(p!("dir"), ConflictType::BothAdded));
Ok(())
})
} | rust_cleaned_test_functions.jsonl/94181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
11663,
2346,
45908,
45514,
11663,
2346,
45908,
6615,
16059,
21242,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
6615,
4334,
22428,
23476,
91,
341,
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... | 2 |
#[test]
fn test_xtpl() {
let tpl_xp = xtpl(pbxz(), a24plus(), a24minus());
let x = affine_x(tpl_xp);
let tpl_p = tpl((a(), b()), pbxy());
assert_eq!(x, tpl_p.0)
} | rust_cleaned_test_functions.jsonl/11566 | {
"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,
60069,
500,
368,
341,
262,
1077,
60979,
3212,
79,
284,
856,
12620,
1295,
21861,
89,
1507,
264,
17,
19,
7138,
1507,
264,
17,
19,
38365,
1423,
262,
1077,
856,
284,
68809,
3212,
1155,
500,
3212,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peek() {
let mut buffer = buffer();
assert_eq!(buffer.peek(), Err(Error::Exhausted));
buffer.enqueue(6, ()).unwrap().copy_from_slice(b"abcdef");
assert_eq!(buffer.metadata_ring.len(), 1);
assert_eq!(buffer.peek().unwrap().1, &b"abcdef"[..]);
assert_eq!(buffer.dequeue().unwrap().1, &b"abcdef"[..]);
assert_eq!(buffer.peek(), Err(Error::Exhausted));
} | rust_cleaned_test_functions.jsonl/101975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
29107,
368,
341,
286,
1077,
5206,
4147,
284,
4147,
543,
286,
2060,
10714,
10297,
7573,
41249,
1507,
15495,
37396,
486,
840,
15074,
291,
1106,
286,
4147,
47468,
7,
21,
11,
1719,
568,
15454,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_multi_packet() {
let (mut encoder, mut decoder) =
new_optional_multi_packet_codec::<Vec<BinSafeStr>, RespVec>();
let mut buf = BytesMut::new();
let cmd = OptionalMulti::Multi(vec![]);
encoder
.encode(cmd, |data| buf.extend_from_slice(data))
.unwrap();
assert_eq!(buf.as_ref(), b"");
let res = decoder.decode(&mut buf);
assert!(decoder.curr_hint.is_none());
assert!(decoder.buf.is_empty());
assert!(decoder.state.consume().is_none());
let pkt = res.unwrap().unwrap();
let response = match pkt {
OptionalMulti::Single(_) => panic!("test_empty_multi_packet"),
OptionalMulti::Multi(response) => response,
};
assert_eq!(response.len(), 0);
} | rust_cleaned_test_functions.jsonl/42454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
25133,
21078,
368,
341,
286,
1077,
320,
6984,
23668,
11,
5206,
24551,
8,
4035,
310,
501,
74644,
25133,
21078,
51084,
27638,
10050,
27,
28794,
25663,
2580,
8066,
79786,
10050,
3913,
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_parsing_with_included_ranges_and_missing_tokens() {
let (parser_name, parser_code) = generate_parser_for_grammar(
r#"{
"name": "test_leading_missing_token",
"rules": {
"program": {
"type": "SEQ",
"members": [
{"type": "SYMBOL", "name": "A"},
{"type": "SYMBOL", "name": "b"},
{"type": "SYMBOL", "name": "c"},
{"type": "SYMBOL", "name": "A"},
{"type": "SYMBOL", "name": "b"},
{"type": "SYMBOL", "name": "c"}
]
},
"A": {"type": "SYMBOL", "name": "a"},
"a": {"type": "STRING", "value": "a"},
"b": {"type": "STRING", "value": "b"},
"c": {"type": "STRING", "value": "c"}
}
}"#,
)
.unwrap();
let mut parser = Parser::new();
parser
.set_language(get_test_language(&parser_name, &parser_code, None))
.unwrap();
// There's a missing `a` token at the beginning of the code. It must be inserted
let source_code = "__bc__bc__";
parser.set_included_ranges(&[
Range {
start_byte: 2,
end_byte: 4,
start_point: Point::new(0, 2),
end_point: Point::new(0, 4),
},
Range {
start_byte: 6,
end_byte: 8,
start_point: Point::new(0, 6),
end_point: Point::new(0, 8),
},
]);
let tree = parser.parse(source_code, None).unwrap();
let root = tree.root_node();
assert_eq!(
root.to_sexp(),
"(program (A (MISSING)) (b) (c) (A (MISSING)) (b) (c))"
);
assert_eq!(root.start_byte(), 2);
assert_eq!(root.child(3).unwrap().start_byte(), 4);
} | rust_cleaned_test_functions.jsonl/7397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1089
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
6615,
1243,
10181,
58748,
8378,
40447,
28838,
368,
341,
262,
1077,
320,
9657,
1269,
11,
6729,
4136,
8,
284,
6923,
18517,
5478,
62,
41094,
1006,
286,
435,
55543,
515,
310,
330,
606,
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_append_element() {
let mut db = MerkleTree::from_vec((0..1000).collect::<Vec<_>>());
assert_eq!(1000, db.len());
db.push(1000);
assert_eq!(1001, db.len());
} | rust_cleaned_test_functions.jsonl/98838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
7894,
368,
341,
262,
1077,
5206,
2927,
284,
8755,
23089,
6533,
486,
1499,
13251,
1188,
15,
496,
16,
15,
15,
15,
568,
17384,
27638,
10050,
32399,
2452,
1423,
262,
2060,
10714,
10297,
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_function() -> Result<()> {
let lua = Lua::new();
let globals = lua.globals();
lua.load(
r#"
function concat(arg1, arg2)
return arg1 .. arg2
end
"#,
)
.exec()?;
let concat = globals.get::<_, Function>("concat")?;
assert_eq!(concat.call::<_, String>(("foo", "bar"))?, "foobar");
Ok(())
} | rust_cleaned_test_functions.jsonl/4912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
368,
1464,
5714,
71698,
341,
262,
1077,
20357,
284,
37662,
486,
931,
1428,
262,
1077,
37785,
284,
20357,
1302,
16616,
543,
262,
20357,
5104,
1006,
286,
435,
2,
698,
286,
729,
33720,
9404,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_atanh() {
assert_eq!(0.0f32.atanh(), 0.0f32);
assert_eq!((-0.0f32).atanh(), -0.0f32);
assert_eq!(1.0f32.atanh(), Float::infinity::<f32>());
assert_eq!((-1.0f32).atanh(), Float::neg_infinity::<f32>());
assert!(2f64.atanh().atanh().is_NaN());
assert!((-2f64).atanh().atanh().is_NaN());
assert!(Float::infinity::<f64>().atanh().is_NaN());
assert!(Float::neg_infinity::<f64>().atanh().is_NaN());
assert!(Float::NaN::<f32>().atanh().is_NaN());
assert_approx_eq!(0.5f32.atanh(), 0.54930614433405484569762261846126285f32);
assert_approx_eq!((-0.5f32).atanh(), -0.54930614433405484569762261846126285f32);
} | rust_cleaned_test_functions.jsonl/101560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
27924,
368,
341,
286,
2060,
10714,
10297,
15,
13,
15,
69,
18,
17,
6847,
27924,
1507,
220,
15,
13,
15,
69,
18,
17,
317,
286,
2060,
10714,
0,
54934,
15,
13,
15,
69,
18,
17,
568,
16225,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bin() {
let cases = vec![
(Some(10), Some(b"1010".to_vec())),
(Some(0), Some(b"0".to_vec())),
(Some(1), Some(b"1".to_vec())),
(Some(365), Some(b"101101101".to_vec())),
(Some(1024), Some(b"10000000000".to_vec())),
(None, None),
(
Some(Int::max_value()),
Some(b"111111111111111111111111111111111111111111111111111111111111111".to_vec()),
),
(
Some(Int::min_value()),
Some(b"1000000000000000000000000000000000000000000000000000000000000000".to_vec()),
),
(
Some(-1),
Some(b"1111111111111111111111111111111111111111111111111111111111111111".to_vec()),
),
(
Some(-365),
Some(b"1111111111111111111111111111111111111111111111111111111010010011".to_vec()),
),
];
for (arg0, expect_output) in cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg0)
.evaluate(ScalarFuncSig::Bin)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/10150 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 716
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21816,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
8373,
7,
16,
15,
701,
4329,
1883,
1,
16,
15,
16,
15,
3263,
983,
13251,
73727,
310,
320,
8373,
7,
15,
701,
4329,
1883,
1,
15,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_regex_subscription_filter() {
let t1 = TopicHash::from_raw("tt");
let t2 = TopicHash::from_raw("et3t3te");
let t3 = TopicHash::from_raw("abcdefghijklmnopqrsuvwxyz");
let mut filter = RegexSubscriptionFilter(Regex::new("t.*t").unwrap());
let old = Default::default();
let subscriptions = vec![
GossipsubSubscription {
action: Subscribe,
topic_hash: t1,
},
GossipsubSubscription {
action: Subscribe,
topic_hash: t2,
},
GossipsubSubscription {
action: Subscribe,
topic_hash: t3,
},
];
let result = filter.filter_incoming_subscriptions(&subscriptions, &old).unwrap();
assert_eq!(result, subscriptions[..2].iter().collect());
} | rust_cleaned_test_functions.jsonl/121436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 545
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
59838,
8727,
368,
341,
310,
1077,
259,
16,
284,
32911,
6370,
486,
1499,
16067,
445,
5566,
797,
310,
1077,
259,
17,
284,
32911,
6370,
486,
1499,
16067,
445,
295,
18,
83,
18,
665,
797,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display() {
let n = RpNumber {
digits: (104321).into(),
decimal: 2,
};
assert_eq!("1043.21", format!("{}", n));
let n2 = RpNumber {
digits: (104321).into(),
decimal: 0,
};
assert_eq!("104321", format!("{}", n2));
let n3 = RpNumber {
digits: (104321).into(),
decimal: 10,
};
assert_eq!("0.0000104321", format!("{}", n3));
} | rust_cleaned_test_functions.jsonl/18463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
368,
341,
286,
1077,
308,
284,
68108,
2833,
341,
310,
18509,
25,
320,
16,
15,
19,
18,
17,
16,
568,
18122,
3148,
310,
12122,
25,
220,
17,
345,
286,
3634,
286,
2060,
10714,
17223,
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_leading_dots() {
assert_eq!(Host::parse(".org").unwrap(), Host::Domain(".org".to_owned()));
assert_eq!(Url::parse("file://./foo").unwrap().domain(), Some("."));
} | rust_cleaned_test_functions.jsonl/52245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11751,
2228,
814,
2412,
368,
341,
262,
2060,
10714,
10297,
9296,
486,
6400,
5680,
1775,
1827,
15454,
1507,
16102,
486,
13636,
5680,
1775,
3263,
983,
51973,
7392,
262,
2060,
10714,
10297,
2864,
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 |
#[test]
fn test_reverse_utf8() {
let cases = vec![
(Some(b"hello".to_vec()), Some(b"olleh".to_vec())),
(Some(b"".to_vec()), Some(b"".to_vec())),
(
Some("数据库".as_bytes().to_vec()),
Some("库据数".as_bytes().to_vec()),
),
(
Some("忠犬ハチ公".as_bytes().to_vec()),
Some("公チハ犬忠".as_bytes().to_vec()),
),
(
Some("あなたのことが好きです".as_bytes().to_vec()),
Some("すでき好がとこのたなあ".as_bytes().to_vec()),
),
(
Some("Bayern München".as_bytes().to_vec()),
Some("nehcnüM nreyaB".as_bytes().to_vec()),
),
(
Some("Η Αθηνά ".as_bytes().to_vec()),
Some(" άνηθΑ Η".as_bytes().to_vec()),
),
(None, None),
];
for (arg, expect_output) in cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate(ScalarFuncSig::ReverseUtf8)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/10158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 796
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43277,
39453,
23,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
8373,
1883,
1,
14990,
3263,
983,
13251,
11858,
4329,
1883,
1,
54048,
71,
3263,
983,
13251,
73727,
310,
320,
8373,
1883,
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... | 2 |
#[test]
fn test_batch_verify() {
let rng = &mut XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
0xbc, 0xe5,
]);
let params = &JubjubBls12::new();
let p_g = FixedGenerators::SpendingKeyGenerator;
let sk1 = PrivateKey::<Bls12>(Fs::random(rng));
let vk1 = PublicKey::from_private(&sk1, p_g, params);
let msg1 = b"Foo bar";
let sig1 = sk1.sign(msg1, rng, p_g, params);
assert!(vk1.verify(msg1, &sig1, p_g, params));
let sk2 = PrivateKey::<Bls12>(Fs::random(rng));
let vk2 = PublicKey::from_private(&sk2, p_g, params);
let msg2 = b"Foo bar";
let sig2 = sk2.sign(msg2, rng, p_g, params);
assert!(vk2.verify(msg2, &sig2, p_g, params));
let mut batch = vec![
BatchEntry {
vk: vk1,
msg: msg1,
sig: sig1,
},
BatchEntry {
vk: vk2,
msg: msg2,
sig: sig2,
},
];
assert!(batch_verify(rng, &batch, p_g, params));
batch[0].sig = sig2;
assert!(!batch_verify(rng, &batch, p_g, params));
} | rust_cleaned_test_functions.jsonl/127644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 752
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
35638,
368,
341,
286,
1077,
28422,
284,
609,
6984,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
310,
220,
15,
87,
20,
24,
11,
220,
15,
87,
21,
17,
11,
220,
15,
42459,
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_blob_io_chunk() {
let chunk: Arc<dyn BlobChunkInfo> = Arc::new(MockChunkInfo {
block_id: Default::default(),
blob_index: 0,
flags: Default::default(),
compress_size: 0x100,
uncompress_size: 0x200,
compress_offset: 0x1000,
uncompress_offset: 0x2000,
file_offset: 0,
index: 3,
reserved: 0,
});
let iochunk: BlobIoChunk = chunk.clone().into();
assert_eq!(iochunk.id(), 3);
assert_eq!(iochunk.compress_offset(), 0x1000);
assert_eq!(iochunk.compress_size(), 0x100);
assert_eq!(iochunk.uncompress_offset(), 0x2000);
assert_eq!(iochunk.uncompress_size(), 0x200);
assert_eq!(iochunk.is_compressed(), false);
assert_eq!(iochunk.is_hole(), false);
} | rust_cleaned_test_functions.jsonl/63306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45908,
16939,
30539,
368,
341,
286,
1077,
11879,
25,
19689,
92846,
49439,
28304,
1731,
29,
284,
19689,
486,
931,
66436,
28304,
1731,
341,
310,
2504,
842,
25,
7899,
486,
2258,
3148,
310,
23404,
356... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_mochigoma_with_fu_after_change_state_sente() {
let mvs:Vec<Vec<(Teban,Move)>> = vec![
vec![
(Teban::Sente,Move::Put(MochigomaKind::Fu,KomaDstPutPosition(9-7,6+1)))
],
vec![
(Teban::Sente,Move::Put(MochigomaKind::Fu,KomaDstPutPosition(9-6,0+1)))
],
vec![
(Teban::Sente,Move::Put(MochigomaKind::Fu,KomaDstPutPosition(9-7,0+1)))
],
vec![
(Teban::Sente,Move::Put(MochigomaKind::Fu,KomaDstPutPosition(9-7,3+1))),
(Teban::Sente,Move::To(KomaSrcPosition(9-7,3+1),KomaDstToPosition(9-7,2+1,true)))
],
vec![
(Teban::Sente,Move::Put(MochigomaKind::Fu,KomaDstPutPosition(9-7,6+1))),
(Teban::Gote,Move::To(KomaSrcPosition(9-7,1+1),KomaDstToPosition(9-7,6+1,false)))
]
];
let answer = [
0,5,0,4,5
];
for (mvs,answer) in mvs.iter().zip(&answer) {
let mut banmen = rule::BANMEN_START_POS.clone();
banmen.0[6][6] = Blank;
banmen.0[6][7] = Blank;
banmen.0[8][6] = Blank;
banmen.0[2][7] = Blank;
banmen.0[0][7] = Blank;
let mut ms:HashMap<MochigomaKind,u32> = HashMap::new();
ms.insert(MochigomaKind::Fu, 2);
let mut mc:MochigomaCollections = MochigomaCollections::Pair(ms,HashMap::new());
let mut state = State::new(banmen.clone());
for (t,m) in mvs {
match Rule::apply_move_none_check(&state,*t,&mc,m.to_applied_move()) {
(next,nmc,_) => {
state = next;
mc = nmc;
}
}
}
assert_eq!(*answer,
Rule::legal_moves_from_mochigoma(Teban::Sente,&mc,&state).into_iter().filter(|m| {
match m {
rule::LegalMove::Put(m) => m.dst() / 9 == 7,
_ => false
}
}).count());
}
} | rust_cleaned_test_functions.jsonl/81329 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 912
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
5673,
717,
4953,
343,
7786,
6615,
36467,
19844,
15947,
4387,
643,
6817,
368,
972,
10217,
296,
11562,
25,
10050,
50439,
28706,
51,
3065,
276,
11,
9860,
54229,
284,
7486,
20703,
319,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_yaw_and_pitch() {
let (yaw, pitch) =
yaw_and_pitch_from_vector(&Vector3::new(0.5f32.sqrt(), 1.0, 0.5f32.sqrt()));
assert_relative_eq!(yaw, f32::pi() / 4.0);
assert_relative_eq!(pitch, f32::pi() / 4.0);
let (yaw, pitch) =
yaw_and_pitch_from_vector(&Vector3::new(-0.5f32.sqrt(), -1.0, 0.5f32.sqrt()));
assert_relative_eq!(yaw, -f32::pi() / 4.0);
assert_relative_eq!(pitch, -f32::pi() / 4.0);
} | rust_cleaned_test_functions.jsonl/106184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80183,
8378,
51959,
368,
341,
286,
1077,
320,
98586,
11,
9649,
8,
4035,
310,
45672,
8378,
51959,
5673,
12247,
2099,
3781,
18,
486,
931,
7,
15,
13,
20,
69,
18,
17,
18049,
1507,
220,
16,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_i32_to_list_i32() {
let a = Int32Array::from(vec![5, 6, 7, 8, 9]);
let array = Arc::new(a) as ArrayRef;
let b = cast(&array, &DataType::List(Box::new(DataType::Int32))).unwrap();
assert_eq!(5, b.len());
let arr = b.as_any().downcast_ref::<ListArray>().unwrap();
assert_eq!(0, arr.value_offset(0));
assert_eq!(1, arr.value_offset(1));
assert_eq!(2, arr.value_offset(2));
assert_eq!(3, arr.value_offset(3));
assert_eq!(4, arr.value_offset(4));
assert_eq!(1, arr.value_length(0));
assert_eq!(1, arr.value_length(1));
assert_eq!(1, arr.value_length(2));
assert_eq!(1, arr.value_length(3));
assert_eq!(1, arr.value_length(4));
let values = arr.values();
let c = values.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(5, c.value(0));
assert_eq!(6, c.value(1));
assert_eq!(7, c.value(2));
assert_eq!(8, c.value(3));
assert_eq!(9, c.value(4));
} | rust_cleaned_test_functions.jsonl/29603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 548
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
5318,
18,
17,
2346,
2019,
5318,
18,
17,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
2558,
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_normalize() {
macro_rules! check {
($input:expr, $expected:expr $(,)?) => {{
let mut text = str!($input);
normalize(&mut text);
assert_eq!(text, $expected, "Normalized text doesn't match expected");
}};
}
check!("", "");
check!("Big Cheese Horace", "big-cheese-horace");
check!("bottom--Text", "bottom-text");
check!("Tufto's Proposal", "tufto-s-proposal");
check!(" - Test - ", "test");
check!("--TEST--", "test");
check!("-test-", "test");
check!(":test", "test");
check!("test:", "test");
check!(":test:", "test");
check!("/Some Page", "some-page");
check!("some/Page", "some-page");
check!("some,Page", "some-page");
check!("End of Death Hub", "end-of-death-hub");
check!("$100 is a lot of money", "100-is-a-lot-of-money");
check!("snake_case", "snake-case");
check!("long__snake__case", "long-snake-case");
check!("_template", "_template");
check!("_template_", "_template");
check!("__template", "_template");
check!("__template_", "_template");
check!("template_", "template");
check!("template__", "template");
check!("_Template", "_template");
check!("_Template_", "_template");
check!("__Template", "_template");
check!("__Template_", "_template");
check!("Template_", "template");
check!("Template__", "template");
check!(" <[ TEST ]> ", "test");
check!("ÄÀ-áö ðñæ_þß*řƒŦ", "äà-áö-ðñæ-þß-řƒŧ");
check!("Site-五", "site-五");
check!("ᒥᐢᑕᓇᐢᑯᐍᐤ--1", "ᒥᐢᑕᓇᐢᑯᐍᐤ-1");
check!("ᒥᐢᑕᓇᐢᑯᐍᐤ:_template", "ᒥᐢᑕᓇᐢᑯᐍᐤ:_template");
check!("🚗A‱B⁜C", "a-b-c");
check!("Ⰰ_á_X", "ⰰ-á-x");
check!("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "");
check!("Component:image block", "component:image-block");
check!("fragment:scp-4447-2", "fragment:scp-4447-2");
check!("fragment::scp-4447-2", "fragment:scp-4447-2");
check!("FRAGMENT:SCP-4447 (2)", "fragment:scp-4447-2");
check!("protected_:fragment_:page", "protected:fragment:page");
check!("protected:_fragment_:page", "protected:_fragment:page");
check!("fragment:_template", "fragment:_template");
check!("fragment:__template", "fragment:_template");
check!("fragment:_template_", "fragment:_template");
check!("fragment::_template", "fragment:_template");
check!("_default:_template", "_template");
check!("_default:__template", "_template");
check!("_default:_template_", "_template");
check!("_default::_template", "_template");
check!("/fragment:_template", "fragment:_template");
check!("/fragment:__template", "fragment:_template");
check!("/fragment:_template_", "fragment:_template");
check!("/fragment::_template", "fragment:_template");
check!("/_default:_template", "_template");
check!("/_default:__template", "_template");
check!("/_default:_template_", "_template");
check!("/_default::_template", "_template");
check!(
"protected:fragment:_template",
"protected:fragment:_template",
);
check!(
"protected:fragment:__template",
"protected:fragment:_template",
);
check!(
"protected:fragment:_template_",
"protected:fragment:_template",
);
check!(
"protected:fragment::_template",
"protected:fragment:_template",
);
check!(
"protected::fragment:_template",
"protected:fragment:_template",
);
check!(
"protected::fragment::_template",
"protected:fragment:_template",
);
} | rust_cleaned_test_functions.jsonl/98637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1630
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80807,
368,
341,
262,
18072,
21407,
0,
1779,
341,
286,
1711,
1355,
96011,
11,
400,
7325,
96011,
4930,
46021,
10170,
589,
80505,
310,
1077,
5206,
1467,
284,
607,
0,
699,
1355,
317,
310,
21694,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_generic_gate() {
let gates = create_circuit(0, 0);
// create witness
let mut witness: [Vec<Fp>; COLUMNS] = array_init(|_| vec![Fp::zero(); gates.len()]);
fill_in_witness(0, &mut witness, &[]);
// create and verify proof based on the witness
verify_proof(gates, witness, &[]);
} | rust_cleaned_test_functions.jsonl/32601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
54798,
368,
341,
262,
1077,
34534,
284,
1855,
666,
37268,
7,
15,
11,
220,
15,
626,
262,
442,
1855,
11298,
198,
262,
1077,
5206,
11298,
25,
508,
10050,
30499,
79,
65795,
356,
48770,
60,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ilrawtag_with_value() {
const SAMPLE: [u8; 5] = [0, 1, 2, 3, 4];
let t = ILRawTag::with_value(16, &SAMPLE);
assert_eq!(t.id(), 16);
assert_eq!(t.value().len(), SAMPLE.len());
assert_eq!(t.value().as_slice(), &SAMPLE);
} | rust_cleaned_test_functions.jsonl/25712 | {
"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,
26743,
1041,
4578,
6615,
3142,
368,
341,
262,
733,
62420,
25,
508,
84,
23,
26,
220,
20,
60,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,
259,
284,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cancel_timers_on_deinitialize() {
// Test that associated timers are cancelled when the arp device
// is deinitialized.
// that they return the same info.
type DummyContext2 = crate::context::testutil::DummyContext<
DummyArpContext,
ArpTimerId<EthernetLinkDevice, Ipv4Addr, usize>,
ArpFrameMetadata<EthernetLinkDevice, usize>,
>;
impl ArpDeviceIdContext<EthernetLinkDevice> for DummyContext2 {
type DeviceId = usize;
}
impl ArpContext<EthernetLinkDevice, Ipv4Addr> for DummyContext2 {
fn get_protocol_addr(&self, _device_id: usize) -> Option<Ipv4Addr> {
self.get_ref().proto_addr
}
fn get_hardware_addr(&self, _device_id: usize) -> Mac {
self.get_ref().hw_addr
}
fn address_resolved(&mut self, _device_id: usize, proto_addr: Ipv4Addr, hw_addr: Mac) {
self.get_mut().addr_resolved.push((proto_addr, hw_addr));
}
fn address_resolution_failed(&mut self, _device_id: usize, proto_addr: Ipv4Addr) {
self.get_mut().addr_resolution_failed.push(proto_addr);
}
fn address_resolution_expired(&mut self, _device_id: usize, proto_addr: Ipv4Addr) {
self.get_mut().addr_resolution_expired.push(proto_addr);
}
}
impl StateContext<ArpState<EthernetLinkDevice, Ipv4Addr>, usize> for DummyContext2 {
fn get_state_with(&self, _id: usize) -> &ArpState<EthernetLinkDevice, Ipv4Addr> {
&self.get_ref().arp_state
}
fn get_state_mut_with(
&mut self,
_id: usize,
) -> &mut ArpState<EthernetLinkDevice, Ipv4Addr> {
&mut self.get_mut().arp_state
}
}
// Setup up a dummy context and trigger a timer with a lookup
let mut ctx = DummyContext2::default();
let device_id_0: usize = 0;
let device_id_1: usize = 1;
lookup(&mut ctx, device_id_0, TEST_LOCAL_MAC, TEST_REMOTE_IPV4);
// We should have installed a single retry timer.
assert_eq!(ctx.timers().len(), 1);
// Deinitializing a different ID should not impact the current timer.
deinitialize(&mut ctx, device_id_1);
assert_eq!(ctx.timers().len(), 1);
// Deinitializing the correct ID should cancel the timer.
deinitialize(&mut ctx, device_id_0);
assert_eq!(ctx.timers().len(), 0);
} | rust_cleaned_test_functions.jsonl/16991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28895,
29087,
388,
4470,
2259,
21641,
368,
341,
286,
442,
3393,
429,
5815,
44522,
525,
25681,
979,
279,
98598,
3671,
198,
286,
442,
374,
409,
36161,
382,
16885,
286,
442,
429,
807,
470,
279,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_font_glyph_memory_layout() {
use std::mem;
assert_eq!(
mem::size_of::<FontGlyph>(),
mem::size_of::<sys::ImFontGlyph>()
);
assert_eq!(
mem::align_of::<FontGlyph>(),
mem::align_of::<sys::ImFontGlyph>()
);
use sys::ImFontGlyph;
macro_rules! assert_field_offset {
($l:ident, $r:ident) => {
assert_eq!(
memoffset::offset_of!(FontGlyph, $l),
memoffset::offset_of!(ImFontGlyph, $r)
);
};
}
assert_field_offset!(bitfields, _bitfield_1);
assert_field_offset!(advance_x, AdvanceX);
assert_field_offset!(x0, X0);
assert_field_offset!(y0, Y0);
assert_field_offset!(x1, X1);
assert_field_offset!(y1, Y1);
assert_field_offset!(u0, U0);
assert_field_offset!(v0, V0);
assert_field_offset!(u1, U1);
assert_field_offset!(v1, V1);
} | rust_cleaned_test_functions.jsonl/122537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17451,
88703,
19195,
14466,
368,
341,
262,
990,
1460,
486,
10536,
280,
262,
2060,
10714,
33673,
286,
1833,
486,
2141,
3575,
27638,
5447,
82039,
65766,
286,
1833,
486,
2141,
3575,
27638,
7791,
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_inversible_hash_64() {
log_init_test();
// random generation of values and mask and check inversion
let mut to_hash;
let mut hashed;
let mut i_hashed;
for i in 0..1000000 {
to_hash = rand::thread_rng().next_u64();
hashed = int64_hash(to_hash);
i_hashed = int64_hash_inverse(hashed);
trace!("i hash unhash = {} {} {} ", i , to_hash, i_hashed);
assert!(to_hash == i_hashed);
}
} | rust_cleaned_test_functions.jsonl/113685 | {
"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,
1243,
64298,
8950,
62,
21,
19,
368,
341,
286,
1487,
6137,
4452,
543,
286,
442,
4194,
9471,
315,
2750,
323,
6911,
323,
1779,
46488,
198,
286,
1077,
5206,
311,
8950,
280,
286,
1077,
5206,
50676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_primitive_array_lt_eq_nulls() {
cmp_i64!(
lt_eq,
lt_eq_dyn,
vec![None, None, Some(1), None, None, Some(1), None, None, Some(1)],
vec![None, Some(1), Some(0), None, Some(1), Some(2), None, None, Some(3)],
vec![None, None, Some(false), None, None, Some(true), None, None, Some(true)]
);
} | rust_cleaned_test_functions.jsonl/45810 | {
"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,
84087,
3858,
39164,
10714,
15162,
82,
368,
341,
286,
26089,
5318,
21,
19,
33673,
310,
25175,
10714,
345,
310,
25175,
10714,
69213,
345,
310,
7486,
20703,
4064,
11,
2240,
11,
4329,
7,
16,
701,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expr_with_attr() {
check(
r#"
macro_rules! m { ($a:expr) => { ok!(); } }
m!(#[allow(a)]());
"#,
expect![[r#"
macro_rules! m { ($a:expr) => { ok!(); } }
ok!();
"#]],
)
} | rust_cleaned_test_functions.jsonl/85226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21915,
6615,
10422,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
314,
1711,
64,
96011,
8,
589,
314,
5394,
0,
2129,
335,
456,
76,
10297,
13353,
7183,
2877,
7252,
1423,
576... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_decode_utf8_string_invalid() {
let bytes = b"\x80\xae".to_vec();
let src = unsafe { String::from_utf8_unchecked(bytes) };
let doc = doc! { "key": src };
let mut buf = Vec::new();
doc.to_writer(&mut buf).unwrap();
let expected = doc! { "key": "��" };
let decoded = Document::from_reader_utf8_lossy(&mut Cursor::new(buf)).unwrap();
assert_eq!(decoded, expected);
} | rust_cleaned_test_functions.jsonl/49139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
15227,
39453,
23,
3904,
31433,
368,
341,
262,
1077,
5820,
284,
293,
11934,
87,
23,
15,
3462,
5918,
3263,
983,
13251,
543,
262,
1077,
2286,
284,
19860,
314,
923,
486,
1499,
39453,
23,
4907... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_1_0() {
assert_eq!(
InventoryManagementSystem::fro(
"\
abcdef\n\
bababc\n\
abbcde\n\
abcccd\n\
aabcdd\n\
abcdee\n\
ababab\
"
)
.one(),
12
);
} | rust_cleaned_test_functions.jsonl/58149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
62,
15,
368,
341,
262,
2060,
10714,
33673,
286,
28126,
22237,
2320,
486,
69,
299,
1006,
310,
93317,
310,
39022,
750,
1699,
5661,
310,
16584,
13683,
1699,
5661,
310,
668,
8904,
450,
1699,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_type() {
use ::header::{ContentLength, UserAgent};
let len = ContentLength(5);
let agent = UserAgent("hyper".to_owned());
assert_eq!(TypeId::of::<ContentLength>(), len.get_type());
assert_eq!(TypeId::of::<UserAgent>(), agent.get_type());
let len: Box<Header + Send + Sync> = Box::new(len);
let agent: Box<Header + Send + Sync> = Box::new(agent);
assert_eq!(TypeId::of::<ContentLength>(), (*len).get_type());
assert_eq!(TypeId::of::<UserAgent>(), (*agent).get_type());
} | rust_cleaned_test_functions.jsonl/108091 | {
"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,
3062,
1819,
368,
341,
262,
990,
3504,
2708,
22964,
2762,
4373,
11,
2657,
16810,
2315,
262,
1077,
2422,
284,
8883,
4373,
7,
20,
317,
262,
1077,
8315,
284,
2657,
16810,
445,
68192,
3263,
983,
5197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunks_err_when_larger_than_max_number() {
let input = MAX_NUMBER + 1;
assert_eq!(
chunks(input).unwrap_err(),
UnsupportedLargeNumberError {
number: input,
max_number: MAX_NUMBER
}
);
} | rust_cleaned_test_functions.jsonl/14852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65470,
9266,
47636,
907,
41776,
51613,
6345,
5500,
368,
341,
286,
1077,
1946,
284,
8334,
19364,
488,
220,
16,
280,
286,
2060,
10714,
33673,
310,
26757,
5384,
568,
15454,
9266,
3148,
310,
33081,
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 |
#[test]
fn test_bench_tps_local_cluster() {
solana_logger::setup();
const NUM_NODES: usize = 1;
let cluster = LocalCluster::new(&ClusterConfig {
node_stakes: vec![999_990; NUM_NODES],
cluster_lamports: 2_000_000,
validator_configs: vec![ValidatorConfig::default(); NUM_NODES],
..ClusterConfig::default()
});
let drone_keypair = Keypair::new();
cluster.transfer(&cluster.funding_keypair, &drone_keypair.pubkey(), 1_000_000);
let (addr_sender, addr_receiver) = channel();
run_local_drone(drone_keypair, addr_sender, None);
let drone_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap();
let mut config = Config::default();
config.tx_count = 100;
config.duration = Duration::from_secs(5);
let client = create_client(
(cluster.entry_point_info.rpc, cluster.entry_point_info.tpu),
FULLNODE_PORT_RANGE,
);
let lamports_per_account = 100;
let (keypairs, _keypair_balance) = generate_and_fund_keypairs(
&client,
Some(drone_addr),
&config.id,
config.tx_count,
lamports_per_account,
)
.unwrap();
let total = do_bench_tps(vec![client], config, keypairs, 0);
assert!(total > 100);
} | rust_cleaned_test_functions.jsonl/1526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 679
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
528,
1690,
13564,
28441,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
733,
15943,
92948,
25,
22301,
284,
220,
16,
280,
286,
1077,
10652,
284,
8774,
28678,
486,
931,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proxy_scheme_ip_address_default_http() {
let ps = "192.168.1.1:8888".into_proxy_scheme().unwrap();
match ps {
ProxyScheme::Http { auth, host } => {
assert!(auth.is_none());
assert_eq!(host, "192.168.1.1:8888");
}
other => panic!("unexpected: {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/6809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29712,
53293,
10385,
6744,
9993,
25888,
368,
341,
286,
1077,
4726,
284,
330,
16,
24,
17,
13,
16,
21,
23,
13,
16,
13,
16,
25,
23,
23,
23,
23,
3263,
18122,
29712,
53293,
1005,
15454,
1428,
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_sizes_33_128() {
ArrayVec::from([0u8; 52]);
ArrayVec::from([0u8; 127]);
} | rust_cleaned_test_functions.jsonl/36794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 56
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32159,
62,
18,
18,
62,
16,
17,
23,
368,
341,
262,
2910,
10050,
486,
1499,
2561,
15,
84,
23,
26,
220,
20,
17,
2558,
262,
2910,
10050,
486,
1499,
2561,
15,
84,
23,
26,
220,
16,
17,
22,
255... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sample_and_hold_noop() {
let spec = "input x: UInt8\noutput y: UInt8 @ x := x.hold().defaults(to: 0)";
assert_eq!(0, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17491,
8378,
65824,
6536,
453,
368,
341,
286,
1077,
1398,
284,
330,
1355,
856,
25,
22275,
23,
1699,
3006,
379,
25,
22275,
23,
569,
856,
1669,
856,
860,
813,
1005,
26756,
12186,
25,
220,
15,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_tuple_coercion() {
let gil = Python::acquire_gil();
let py = gil.python();
let v = ("foo", "bar");
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
assert!(seq.tuple().is_ok());
} | rust_cleaned_test_functions.jsonl/47425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
11393,
2962,
290,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
284,
3489,
7975,
497,
330,
2257,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_btf_type_func_proto() {
let endianness = Endianness::default();
let data: &[u8] = &[
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
];
match unsafe { BtfType::read(data, endianness) } {
Ok(BtfType::FuncProto(_, _)) => {}
Ok(t) => panic!("expected func_proto type, got {:#?}", t),
Err(_) => panic!("unexpected error"),
}
} | rust_cleaned_test_functions.jsonl/98498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
880,
8935,
1819,
9596,
37689,
368,
341,
286,
1077,
835,
72,
82033,
284,
3972,
72,
82033,
486,
2258,
543,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
87,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_random_choice_zero_elements_f64() {
let capacity: usize = 1000;
let mut samples: Vec<usize> = Vec::with_capacity(capacity);
let mut weights: Vec<f64> = Vec::with_capacity(capacity);
for i in 0..capacity {
samples.push(i + 1);
weights.push((i + 1usize) as f64);
}
let choices = random_choice().random_choice_f64(&samples, &weights, 0 as usize);
assert!(choices.len() == 0);
} | rust_cleaned_test_functions.jsonl/107014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
31936,
19359,
22801,
761,
21,
19,
368,
341,
286,
1077,
8654,
25,
22301,
284,
220,
16,
15,
15,
15,
280,
286,
1077,
5206,
10469,
25,
11312,
90244,
29,
284,
11312,
486,
4197,
35603,
51386,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cmd_fail() {
// queue up a string with cat in it.
let cmd = String::from("cat");
// call get output with test/ as an argument on the stdio.
let res = get_output(cmd, vec!["test/".to_string()], Stdio::piped());
// assert that the result is an Error type.
assert_err!(&res);
// destruct the Error to check the ErrorKind and test that it is a Command type.
if let Err(Error(ErrorKind::Command(e), _)) = &res {
// assert that the message in the error matches this string.
assert_eq!(*e, "cat: test/: Is a directory\n".to_string());
}
} | rust_cleaned_test_functions.jsonl/46769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11684,
22121,
368,
341,
262,
442,
7177,
705,
264,
914,
448,
8251,
304,
432,
624,
262,
1077,
5439,
284,
923,
486,
1499,
445,
4616,
3071,
262,
442,
1618,
633,
2550,
448,
1273,
14,
438,
458,
5693... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_generic_struct() {
#[derive(CheckBytes, Debug)]
struct Test<T> {
a: u32,
b: T,
}
let value = Test { a: 42, b: true };
check_as_bytes(&value, &mut ());
unsafe {
Test::<bool>::check_bytes(
bytes![0u8, 0u8, 0u8, 0u8, 1u8, 255u8, 255u8, 255u8].cast(),
&mut (),
)
.unwrap();
Test::<bool>::check_bytes(
bytes![12u8, 34u8, 56u8, 78u8, 1u8, 255u8, 255u8, 255u8].cast(),
&mut (),
)
.unwrap();
Test::<bool>::check_bytes(
bytes![0u8, 0u8, 0u8, 0u8, 0u8, 255u8, 255u8, 255u8].cast(),
&mut (),
)
.unwrap();
Test::<bool>::check_bytes(
bytes![0u8, 0u8, 0u8, 0u8, 2u8, 255u8, 255u8, 255u8].cast(),
&mut (),
)
.unwrap_err();
}
} | rust_cleaned_test_functions.jsonl/28477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 651
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
15126,
368,
341,
286,
11506,
27098,
3025,
1227,
7078,
11,
11091,
5563,
286,
2036,
3393,
3125,
29,
341,
310,
264,
25,
575,
18,
17,
345,
310,
293,
25,
350,
345,
286,
555,
286,
1077,
897,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_leader_transactions() {
let dummy_leader_id = Keypair::new().pubkey();
let dummy_leader_tokens = 1;
let mut transactions = Mint::new_with_leader(100, dummy_leader_id, dummy_leader_tokens)
.create_transaction()
.into_iter();
let tx = transactions.next().unwrap();
assert_eq!(tx.instructions.len(), 2);
assert!(system_program::check_id(tx.program_id(0)));
assert!(system_program::check_id(tx.program_id(1)));
let instruction: SystemInstruction = deserialize(tx.userdata(0)).unwrap();
if let SystemInstruction::Move { tokens } = instruction {
assert_eq!(tokens, 100);
}
let instruction: SystemInstruction = deserialize(tx.userdata(1)).unwrap();
if let SystemInstruction::Move { tokens } = instruction {
assert_eq!(tokens, 1);
}
assert_eq!(transactions.next(), None);
} | rust_cleaned_test_functions.jsonl/7366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
79991,
68182,
368,
341,
286,
1077,
17292,
79991,
842,
284,
6569,
1082,
1310,
486,
931,
1005,
9585,
792,
543,
286,
1077,
17292,
79991,
28838,
284,
220,
16,
280,
286,
1077,
5206,
14131,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parenthesized_expression() {
check(
"5*(2+1)",
expect![[r#"
Root@0..7
Exp_Binary@0..7
Exp_Literal@0..1
Lit_Integer@0..1 "5"
Sym_Asterisk@1..2 "*"
Exp_Paren@2..7
Sym_LParen@2..3 "("
Exp_Binary@3..6
Exp_Literal@3..4
Lit_Integer@3..4 "2"
Sym_Plus@4..5 "+"
Exp_Literal@5..6
Lit_Integer@5..6 "1"
Sym_RParen@6..7 ")"
"#]],
);
} | rust_cleaned_test_functions.jsonl/40934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
9151,
82879,
28068,
368,
341,
286,
1779,
1006,
310,
330,
20,
6599,
17,
10,
16,
15752,
310,
1720,
0,
15505,
81,
2,
698,
394,
18854,
31,
15,
496,
22,
198,
1698,
7787,
1668,
3287,
31,
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_serialize_info_currmovenum() {
#[cfg(not(feature = "chess"))]
let attributes: Vec<UciInfoAttribute> = vec![
UciInfoAttribute::CurrMove(UciMove::from_to(
UciSquare::from('a', 2),
UciSquare::from('f', 2),
)),
UciInfoAttribute::CurrMoveNum(2)
];
#[cfg(feature = "chess")]
let attributes: Vec<UciInfoAttribute> = vec![
UciInfoAttribute::CurrMove(ChessMove::new(Square::A2, Square::F2, None)),
UciInfoAttribute::CurrMoveNum(2)
];
let m = UciMessage::Info(attributes);
assert_eq!(m.serialize(), "info currmove a2f2 currmovenum 2");
} | rust_cleaned_test_functions.jsonl/19062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 377
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
3109,
40515,
29961,
9018,
368,
341,
286,
11506,
14072,
24772,
27062,
284,
330,
331,
433,
2761,
921,
310,
1077,
8201,
25,
11312,
36397,
5855,
1731,
3907,
29,
284,
7486,
90515,
310,
547,
5855... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_methods() {
assert_eq!(
Method::Delete,
Route::DeleteInvite {
code: "twilight-rs",
}
.method()
);
assert_eq!(
Method::Get,
Route::GetInvite {
code: "twilight-rs",
with_counts: false,
}
.method()
);
assert_eq!(
Method::Patch,
Route::UpdateMessage {
channel_id: 123,
message_id: 456,
}
.method()
);
assert_eq!(Method::Post, Route::CreateGuild.method());
assert_eq!(
Method::Put,
Route::SyncTemplate {
guild_id: 123,
template_code: "abc",
}
.method()
);
} | rust_cleaned_test_functions.jsonl/30652 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36084,
368,
341,
286,
2060,
10714,
33673,
310,
6730,
486,
6435,
345,
310,
9572,
486,
6435,
93540,
341,
394,
2038,
25,
330,
15560,
34900,
3795,
82,
756,
310,
456,
310,
659,
4393,
741,
286,
1439,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_flags() {
assert_eq!(
parse_java_args(&["-hello-world", "com.hello.Example"]),
JavaArgs {
errors: vec!["Unrecognized option: -hello-world".to_string()],
mode: ExecutionMode::Class {
class: "com.hello.Example".to_string(),
args: vec![],
},
..default()
}
);
} | rust_cleaned_test_functions.jsonl/107288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
14130,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
77323,
8384,
2099,
1183,
12,
14990,
30084,
497,
330,
874,
860,
4791,
5121,
1516,
46442,
286,
7943,
4117,
341,
310,
5975,
25,
7486,
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,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_token_revocation_with_non_https_url() {
let client = new_client();
let result = client
.set_revocation_uri(RevocationUrl::new("http://revocation/url".to_string()).unwrap())
.revoke_token(AccessToken::new("access_token_123".to_string()).into())
.unwrap_err();
assert_eq!(
format!("{}", result),
"Scheme for revocation endpoint URL must be HTTPS"
);
} | rust_cleaned_test_functions.jsonl/18621 | {
"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,
6458,
38082,
2276,
6615,
21637,
26817,
2903,
368,
341,
262,
1077,
2943,
284,
501,
8179,
1428,
262,
1077,
1102,
284,
2943,
198,
286,
659,
746,
38082,
2276,
15572,
7,
36184,
2276,
2864,
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_newline() {
assert_eq!(remove_irc_control_chars("\na\nb\nc\n"), " a b c ");
assert_eq!(remove_irc_control_chars("\ra\rb\rc\r"), " a b c ");
} | rust_cleaned_test_functions.jsonl/6843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
1056,
368,
341,
262,
2060,
10714,
10297,
5399,
62,
2437,
13436,
37418,
4921,
3376,
1699,
65,
59,
1016,
1699,
3975,
330,
264,
293,
272,
7318,
262,
2060,
10714,
10297,
5399,
62,
2437,
13436,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_context() {
use super::SECP256K1;
let sk_data = hex!("e6dd32f8761625f105c39a39f19370b3521d845a12456d60ce44debd0a362641");
let sk = SecretKey::from_slice(&sk_data).unwrap();
let msg_data = hex!("a4965ca63b7d8562736ceec36dfa5a11bf426eb65be8ea3f7a49ae363032da0d");
let msg = Message::from_slice(&msg_data).unwrap();
// Check usage as explicit parameter
let pk = PublicKey::from_secret_key(&SECP256K1, &sk);
// Check usage as self
let sig = SECP256K1.sign(&msg, &sk);
assert!(SECP256K1.verify(&msg, &sig, &pk).is_ok());
} | rust_cleaned_test_functions.jsonl/12680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
8467,
368,
341,
286,
990,
2256,
486,
925,
7123,
17,
20,
21,
42,
16,
401,
286,
1077,
1901,
1769,
284,
12371,
17223,
68,
21,
631,
18,
17,
69,
23,
22,
21,
16,
21,
17,
20,
69,
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_doesnt_allocate_for_zero_sized_type() {
let _context = crate::quick_init().unwrap();
let x = UnifiedBox::new(ZeroSizedType).unwrap();
let ptr = UnifiedBox::into_unified(x);
assert!(ptr.is_null());
let _ = unsafe { UnifiedBox::from_unified(ptr) };
} | rust_cleaned_test_functions.jsonl/47356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96374,
406,
77078,
5478,
19359,
643,
1506,
1819,
368,
341,
286,
1077,
716,
2147,
284,
17717,
486,
27763,
6137,
1005,
15454,
543,
286,
1077,
856,
284,
72434,
1611,
486,
931,
7,
17999,
50,
1506,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_xor_rng_u32() {
for _ in 0..1000 {
assert_ne!(xor_rng_u32(), xor_rng_u32());
}
} | rust_cleaned_test_functions.jsonl/1653 | {
"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,
76462,
66849,
7300,
18,
17,
368,
341,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
310,
2060,
13925,
10297,
71311,
66849,
7300,
18,
17,
1507,
53941,
66849,
7300,
18,
17,
1423,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_find_move_intersection() {
let first_move = Move {
start: Point { x: 10, y: 0 },
end: Point { x: 10, y: 50 },
move_type: MoveType::Vertical,
};
let second_move = Move {
start: Point { x: 25, y: 25 },
end: Point { x: -25, y: 25 },
move_type: MoveType::Horizontal,
};
let expected_intersection = Point{x: 10, y: 25};
assert_eq!(expected_intersection, first_move.find_intersection(&second_move).unwrap());
} | rust_cleaned_test_functions.jsonl/44994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
17134,
82558,
368,
341,
286,
1077,
1156,
17134,
284,
14561,
341,
394,
1191,
25,
5126,
314,
856,
25,
220,
16,
15,
11,
379,
25,
220,
15,
1153,
394,
835,
25,
5126,
314,
856,
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_should_process_or_forward_packets() {
let my_pubkey = solana_sdk::pubkey::new_rand();
let my_pubkey1 = solana_sdk::pubkey::new_rand();
let bank = Arc::new(Bank::default());
assert_matches!(
BankingStage::consume_or_forward_packets(&my_pubkey, None, Some(&bank), false, false),
BufferedPacketsDecision::Hold
);
assert_matches!(
BankingStage::consume_or_forward_packets(&my_pubkey, None, None, false, false),
BufferedPacketsDecision::Hold
);
assert_matches!(
BankingStage::consume_or_forward_packets(&my_pubkey1, None, None, false, false),
BufferedPacketsDecision::Hold
);
assert_matches!(
BankingStage::consume_or_forward_packets(
&my_pubkey,
Some(my_pubkey1),
None,
false,
false
),
BufferedPacketsDecision::Forward
);
assert_matches!(
BankingStage::consume_or_forward_packets(
&my_pubkey,
Some(my_pubkey1),
None,
true,
true
),
BufferedPacketsDecision::Hold
);
assert_matches!(
BankingStage::consume_or_forward_packets(
&my_pubkey,
Some(my_pubkey1),
None,
true,
false
),
BufferedPacketsDecision::ForwardAndHold
);
assert_matches!(
BankingStage::consume_or_forward_packets(
&my_pubkey,
Some(my_pubkey1),
Some(&bank),
false,
false
),
BufferedPacketsDecision::Consume(_)
);
assert_matches!(
BankingStage::consume_or_forward_packets(
&my_pubkey1,
Some(my_pubkey1),
None,
false,
false
),
BufferedPacketsDecision::Hold
);
assert_matches!(
BankingStage::consume_or_forward_packets(
&my_pubkey1,
Some(my_pubkey1),
Some(&bank),
false,
false
),
BufferedPacketsDecision::Consume(_)
);
} | rust_cleaned_test_functions.jsonl/2933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
11305,
8734,
32121,
63569,
368,
341,
286,
1077,
847,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
847,
34014,
792,
16,
284,
2048,
3362,
61783,
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_str_multiline() {
let a: String = "this \
is a test"
.to_string();
let b: String = "this \
is \
another \
test"
.to_string();
assert_eq!(a, "this is a test".to_string());
assert_eq!(b, "this is another test".to_string());
} | rust_cleaned_test_functions.jsonl/119452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
26290,
26560,
368,
341,
262,
1077,
264,
25,
923,
284,
330,
574,
3044,
285,
264,
1273,
698,
286,
659,
983,
3904,
543,
262,
1077,
293,
25,
923,
284,
330,
574,
3044,
1060,
374,
3044,
1060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_size_hint() {
let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];
let map: HashMap<_, _> = xs.iter().cloned().collect();
let mut iter = map.iter();
for _ in iter.by_ref().take(3) {}
assert_eq!(iter.size_hint(), (3, Some(3)));
} | rust_cleaned_test_functions.jsonl/8519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2368,
45825,
368,
341,
286,
1077,
11943,
284,
17826,
16,
11,
220,
16,
701,
320,
17,
11,
220,
17,
701,
320,
18,
11,
220,
18,
701,
320,
19,
11,
220,
19,
701,
320,
20,
11,
220,
20,
701,
320... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_name_sorting() {
let names = ["Apple",
"Banana",
"Fruit", "Fruit0", "Fruit00",
"Fruit1", "Fruit01",
"Fruit2", "Fruit02",
"Fruit20",
"Fruit100",
"Pear"];
let mut sorted = names.to_owned();
sorted.sort_by_key(|&s| name_key(s));
assert_eq!(names, sorted);
} | rust_cleaned_test_functions.jsonl/4580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1269,
18435,
287,
368,
341,
262,
1077,
5036,
284,
4383,
26567,
756,
338,
330,
50241,
3362,
756,
338,
330,
37,
21026,
497,
330,
37,
21026,
15,
497,
330,
37,
21026,
15,
15,
756,
338,
330,
37,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder_basic() {
let s = SchemaBuilder::new()
.influx_field("str_field", String)
.tag("the_tag")
.influx_field("int_field", Integer)
.influx_field("uint_field", UInteger)
.influx_field("bool_field", Boolean)
.influx_field("float_field", Float)
.tag("the_second_tag")
.timestamp()
.measurement("the_measurement")
.build()
.unwrap();
assert_column_eq!(s, 0, Field(String), "str_field");
assert_column_eq!(s, 1, Tag, "the_tag");
assert_column_eq!(s, 2, Field(Integer), "int_field");
assert_column_eq!(s, 3, Field(UInteger), "uint_field");
assert_column_eq!(s, 4, Field(Boolean), "bool_field");
assert_column_eq!(s, 5, Field(Float), "float_field");
assert_column_eq!(s, 6, Tag, "the_second_tag");
assert_column_eq!(s, 7, Timestamp, "time");
assert_eq!(s.measurement().unwrap(), "the_measurement");
assert_eq!(s.len(), 8);
} | rust_cleaned_test_functions.jsonl/12631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
34729,
368,
341,
286,
1077,
274,
284,
12539,
3297,
486,
931,
741,
310,
659,
258,
36706,
5013,
445,
495,
5013,
497,
923,
340,
310,
659,
4578,
445,
1782,
9372,
1138,
310,
659,
258,
36706,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fractional() {
let p = Parser::new();
assert_eq!(p.fractional(".03856").1, Done("", vec![".03856", "03856"]));
} | rust_cleaned_test_functions.jsonl/27413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59023,
278,
368,
341,
262,
1077,
281,
284,
21102,
486,
931,
543,
262,
2060,
10714,
10297,
79,
833,
16199,
278,
5680,
15,
18,
23,
20,
21,
1827,
16,
11,
27357,
19814,
7486,
0,
97170,
15,
18,
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 |
#[test]
fn test_api_withdraw_invalid_denomination() {
let mut mock = mock::Mock::default();
let mut ctx = mock.create_ctx();
let mut meta = Metadata {
..Default::default()
};
let genesis = Default::default();
Accounts::init_or_migrate(
&mut ctx,
&mut meta,
AccountsGenesis {
balances: {
let mut balances = BTreeMap::new();
// Alice.
balances.insert(keys::alice::address(), {
let mut denominations = BTreeMap::new();
denominations.insert(Denomination::NATIVE, 1_000_000);
denominations
});
balances
},
total_supplies: {
let mut total_supplies = BTreeMap::new();
total_supplies.insert(Denomination::NATIVE, 1_000_000);
total_supplies
},
..Default::default()
},
);
Module::<Accounts, Consensus>::init_or_migrate(&mut ctx, &mut meta, genesis);
let tx = transaction::Transaction {
version: 1,
call: transaction::Call {
format: transaction::CallFormat::Plain,
method: "consensus.Withdraw".to_owned(),
body: cbor::to_value(Withdraw {
// separate `to` account to make sure everything is hooked up to the right places.
to: Some(keys::bob::address()),
amount: BaseUnits::new(1_000, Denomination::NATIVE),
}),
},
auth_info: transaction::AuthInfo {
signer_info: vec![transaction::SignerInfo::new_sigspec(
keys::alice::sigspec(),
0,
)],
fee: transaction::Fee {
amount: Default::default(),
gas: 1000,
consensus_messages: 1,
},
},
};
ctx.with_tx(0, tx, |mut tx_ctx, call| {
let result = Module::<Accounts, Consensus>::tx_withdraw(
&mut tx_ctx,
cbor::from_value(call.body).unwrap(),
)
.unwrap_err();
assert!(matches!(
result,
Error::Consensus(ConsensusError::InvalidDenomination)
));
});
} | rust_cleaned_test_functions.jsonl/52596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
6615,
7633,
31433,
49522,
80380,
368,
341,
262,
1077,
5206,
7860,
284,
7860,
486,
11571,
486,
2258,
543,
262,
1077,
5206,
5635,
284,
7860,
2520,
15147,
543,
262,
1077,
5206,
8823,
284,
3358... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_server_www_udp() {
let addr = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 0));
let udp_socket = UdpSocket::bind(&addr).unwrap();
let ipaddr = udp_socket.local_addr().unwrap();
println!("udp_socket on port: {}", ipaddr);
let server_continue = Arc::new(AtomicBool::new(true));
let server_continue2 = server_continue.clone();
let server_thread = thread::Builder::new()
.name("test_server:udp:server".to_string())
.spawn(move || server_thread_udp(udp_socket, server_continue2))
.unwrap();
let client_thread = thread::Builder::new()
.name("test_server:udp:client".to_string())
.spawn(move || client_thread_www(lazy_udp_client(ipaddr)))
.unwrap();
let client_result = client_thread.join();
assert!(client_result.is_ok(), "client failed: {:?}", client_result);
server_continue.store(false, Ordering::Relaxed);
server_thread.join().unwrap();;
} | rust_cleaned_test_functions.jsonl/109268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
62,
2136,
69432,
368,
341,
262,
1077,
10789,
284,
20954,
13986,
486,
53,
19,
73066,
13986,
53,
19,
486,
931,
8972,
30168,
19,
13986,
486,
931,
7,
16,
17,
22,
11,
220,
15,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_not_empty_password() {
let url = Url::parse("http://michael:pass@example.com").unwrap();
assert_eq!(url.password().unwrap(), "pass");
let url = Url::parse("http://:pass@example.com").unwrap();
assert_eq!(url.password().unwrap(), "pass");
} | rust_cleaned_test_functions.jsonl/80268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
15124,
10122,
368,
341,
286,
1077,
2515,
284,
22840,
486,
6400,
445,
1254,
1110,
76,
59708,
25,
6385,
35487,
905,
1827,
15454,
543,
286,
2060,
10714,
10297,
1085,
11630,
1005,
15454,
1507,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sth() {
test_interpreter_and_jit_asm!(
"
sth [r1+2], 0x2211
ldxh r0, [r1+2]
exit",
[
0xaa, 0xbb, 0xff, 0xff, 0xcc, 0xdd,
],
(),
{ |_vm, res: Result| { res.unwrap() == 0x2211 } },
3
);
} | rust_cleaned_test_functions.jsonl/58994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
71,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
357,
71,
508,
81,
16,
10,
17,
1125,
220,
15,
87,
17,
17,
16,
16,
198,
286,
326,
12719,
71,
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... | 1 |
#[test]
fn test_replica_map_ids() {
// id starts from 1 rather than 0
let p1: PartitionMaps = vec![(1, vec![0]), (2, vec![2])].into();
let p1_result = p1.valid_partition_map();
assert!(p1_result.is_err());
assert_eq!(
format!("{}", p1_result.unwrap_err()),
"assigned partitions must start with id 0"
);
// id has a gap
let p2: PartitionMaps = vec![(0, vec![0]), (2, vec![2])].into();
let p2_result = p2.valid_partition_map();
assert!(p2_result.is_err());
assert_eq!(
format!("{}", p2_result.unwrap_err()),
"assigned partition ids must be in sequence and without gaps"
);
// ids are out of sequence
let p3: PartitionMaps = vec![(0, vec![0]), (2, vec![2]), (1, vec![1])].into();
let p3_result = p3.valid_partition_map();
assert!(p3_result.is_err());
assert_eq!(
format!("{}", p3_result.unwrap_err()),
"assigned partition ids must be in sequence and without gaps"
);
// duplicate ids
let p4: PartitionMaps = vec![(0, vec![0]), (1, vec![1]), (1, vec![1])].into();
let p4_result = p4.valid_partition_map();
assert!(p4_result.is_err());
assert_eq!(
format!("{}", p4_result.unwrap_err()),
"assigned partition ids must be in sequence and without gaps"
);
// ids are ok
let p5: PartitionMaps = vec![(0, vec![1]), (1, vec![1]), (2, vec![2])].into();
let p5_result = p5.valid_partition_map();
assert!(p5_result.is_ok());
} | rust_cleaned_test_functions.jsonl/79995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 834
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25533,
15317,
5376,
8077,
368,
341,
286,
442,
877,
8471,
504,
220,
16,
4751,
1091,
220,
15,
198,
286,
1077,
281,
16,
25,
54626,
36562,
284,
7486,
0,
9697,
16,
11,
7486,
20703,
15,
9719,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unreachable() {
// the same for a stack which has the UDP `send_port_unreachable` option
fn test<I: TestIpExt + IcmpIpExt, C: PartialEq + Debug>(
code: C,
assert_counters: &[&str],
original_packet_len: usize,
) where
IcmpDestUnreachable:
for<'a> IcmpMessage<I, &'a [u8], Code = C, Body = OriginalPacket<&'a [u8]>>,
{
let mut buffer = Buf::new(vec![0; 128], ..)
.encapsulate(UdpPacketBuilder::new(
I::DUMMY_CONFIG.remote_ip.get(),
I::DUMMY_CONFIG.local_ip.get(),
None,
NonZeroU16::new(1234).unwrap(),
))
.serialize_vec_outer()
.unwrap();
test_receive_ip_packet::<I, _, _, _, _>(
// Enable the `send_port_unreachable` feature.
|builder| {
builder.transport_builder().udp_builder().send_port_unreachable(true);
},
buffer.as_mut(),
I::DUMMY_CONFIG.local_ip,
64,
IpProto::Udp.into(),
assert_counters,
Some((IcmpDestUnreachable::default(), code)),
// Ensure packet is truncated to the right length.
|packet| assert_eq!(packet.original_packet().bytes().len(), original_packet_len),
);
test_receive_ip_packet::<I, C, IcmpDestUnreachable, _, _>(
// Leave the `send_port_unreachable` feature disabled.
|_| {},
buffer.as_mut(),
I::DUMMY_CONFIG.local_ip,
64,
IpProto::Udp.into(),
&[],
None,
|_| {},
);
}
test::<Ipv4, _>(
Icmpv4DestUnreachableCode::DestPortUnreachable,
&["send_icmpv4_port_unreachable", "send_icmp_error_message"],
84,
);
test::<Ipv6, _>(
Icmpv6DestUnreachableCode::PortUnreachable,
&["send_icmpv6_port_unreachable", "send_icmp_error_message"],
176,
);
} | rust_cleaned_test_functions.jsonl/65669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8716,
4907,
46550,
368,
341,
23459,
16885,
286,
442,
279,
1852,
369,
264,
5611,
892,
702,
279,
42394,
1565,
6681,
8716,
4907,
46550,
63,
2999,
198,
23459,
286,
5168,
1273,
13332,
25,
3393,
23378,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fr_mul() {
let f1 = Fr::from(BigInteger([
0xc81265fb4130fe0c,
0xb308836c14e22279,
0x699e887f96bff372,
0x84ecc7e76c11ad,
]));
let f2 = Fr::from(BigInteger([
0x71875719b422efb8,
0x43658e68a93612,
0x9fa756be2011e833,
0xaa2b2cb08dac497,
]));
let f3 = Fr::from(BigInteger([
0x6d6618ac6b4a8381,
0x5b9eb35d711ee1da,
0xce83310e6ac4105d,
0x98032e0f206320a,
]));
assert_eq!(f1 * &f2, f3);
} | rust_cleaned_test_functions.jsonl/81833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
24944,
368,
341,
262,
1077,
282,
16,
284,
2869,
486,
1499,
91756,
8956,
286,
220,
15,
8148,
23,
16,
17,
21,
20,
10798,
19,
16,
18,
15,
1859,
15,
66,
345,
286,
220,
15,
7929,
18,
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_const_create_lower() {
const C: Id = Id::const_create_lower(0);
assert_eq!(C.value(), 0);
let _ = IdWithInitVal::const_create_lower(0);
const _C0: IdWithInitVal = IdWithInitVal::const_create_lower(50);
const _C1: IdWithInitVal = IdWithInitVal::const_create_lower(100);
const _C2: UnusedId = UnusedId::const_create_lower(5);
} | rust_cleaned_test_functions.jsonl/10265 | {
"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,
13610,
8657,
30425,
368,
341,
286,
733,
356,
25,
5223,
284,
5223,
486,
1024,
8657,
30425,
7,
15,
317,
286,
2060,
10714,
10297,
34,
2824,
1507,
220,
15,
626,
286,
1077,
716,
284,
5223,
2354,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_atomic_fill_and_borrow() {
let lazycell = AtomicLazyCell::new();
assert!(!lazycell.filled());
lazycell.fill(1).unwrap();
assert!(lazycell.filled());
let value = lazycell.borrow();
assert_eq!(value, Some(&1));
let value = lazycell.get();
assert_eq!(value, Some(1));
} | rust_cleaned_test_functions.jsonl/5808 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51367,
30728,
8378,
880,
7768,
368,
341,
286,
1077,
64436,
3337,
613,
284,
30316,
39766,
3599,
486,
931,
1428,
286,
2060,
0,
3471,
75,
1370,
3337,
613,
833,
4374,
1423,
286,
64436,
3337,
613,
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_peer_starts_waiting_streams() {
let mut exec = fasync::TestExecutor::new_with_fake_time().expect("an executor");
exec.set_fake_time(fasync::Time::from_nanos(5_000_000_000));
let (avdtp, remote) = setup_avdtp_peer();
let (profile_proxy, _requests) =
create_proxy_and_stream::<ProfileMarker>().expect("test proxy pair creation");
let mut streams = Streams::new();
let mut test_builder = TestMediaTaskBuilder::new();
streams.insert(Stream::build(
make_sbc_endpoint(1, avdtp::EndpointType::Source),
test_builder.builder(),
));
let next_task_fut = test_builder.next_task();
pin_mut!(next_task_fut);
let peer = Peer::create(PeerId(1), avdtp, streams, None, profile_proxy, None);
let remote_peer = avdtp::Peer::new(remote);
let sbc_endpoint_id = 1_u8.try_into().expect("should be able to get sbc endpointid");
let sbc_caps = sbc_capabilities();
let set_config_fut =
remote_peer.set_configuration(&sbc_endpoint_id, &sbc_endpoint_id, &sbc_caps);
pin_mut!(set_config_fut);
match exec.run_until_stalled(&mut set_config_fut) {
Poll::Ready(Ok(())) => {}
x => panic!("Set capabilities should be ready but got {:?}", x),
};
let open_fut = remote_peer.open(&sbc_endpoint_id);
pin_mut!(open_fut);
match exec.run_until_stalled(&mut open_fut) {
Poll::Ready(Ok(())) => {}
x => panic!("Open should be ready but got {:?}", x),
};
// Establish a media transport stream
let (_remote_transport, transport) = Channel::create();
assert_eq!(Some(()), peer.receive_channel(transport).ok());
// The remote end should get a start request after the timeout.
let mut remote_requests = remote_peer.take_request_stream();
let next_remote_request_fut = remote_requests.next();
pin_mut!(next_remote_request_fut);
// Nothing should happen immediately.
assert!(exec.run_until_stalled(&mut next_remote_request_fut).is_pending());
exec.set_fake_time(zx::Duration::from_seconds(3).after_now());
exec.wake_expired_timers();
let stream_ids = match exec.run_until_stalled(&mut next_remote_request_fut) {
Poll::Ready(Some(Ok(avdtp::Request::Start { responder, stream_ids }))) => {
responder.send().unwrap();
stream_ids
}
x => panic!("Expected to receive a start request for the stream, got {:?}", x),
};
let media_task = match exec.run_until_stalled(&mut next_task_fut) {
Poll::Ready(Some(task)) => task,
x => panic!("Local task should be created at this point: {:?}", x),
};
// Should have started the media task
assert!(media_task.is_started());
// Remote peer should still be able to suspend the stream.
let suspend_fut = remote_peer.suspend(&stream_ids);
pin_mut!(suspend_fut);
match exec.run_until_stalled(&mut suspend_fut) {
Poll::Ready(Ok(())) => {}
x => panic!("Suspend should be ready but got {:?}", x),
};
// Should have stopped the media task on suspend.
assert!(!media_task.is_started());
} | rust_cleaned_test_functions.jsonl/91787 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1518
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45159,
86552,
84683,
74872,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
6615,
56881,
3009,
1005,
17119,
445,
276,
31558,
3071,
286,
3883,
980,
56881,
3009,
955,
76... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_noto_serif() {
run_test(
&TEST_DATA,
"directwrite/good-noto-serif.kn",
"noto/NotoSerifKannada-Regular.ttf",
&[JOINER_GLYPH_INDEX],
462,
);
} | rust_cleaned_test_functions.jsonl/91220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2072,
75861,
333,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
19798,
4934,
4846,
1386,
29169,
78,
27566,
5202,
77,
756,
503,
330,
1921,
78,
20290,
2072,
31745,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_operation_request_conv() {
let prevalidator = PrevalidatorWrapper {
chain_id: ChainId::try_from(hex::decode(CHAIN_ID).unwrap()).unwrap(),
protocol: get_protocol_hash(&[1, 2, 3, 4, 5, 6, 7, 8, 9]),
context_fitness: Some(vec![vec![0, 1], vec![0, 0, 1, 2, 3, 4, 5]]),
};
let operations = ApplyBlockRequest::convert_operations(block_operations_from_hex(
HEADER_HASH,
sample_operations_for_request_decoded(),
));
let operation = operations[0][0].clone();
let validate_operation_request = ValidateOperationRequest {
prevalidator,
operation,
};
let result: bool = runtime::execute(move || {
ocaml_frame!(gc(prevalidator_root, operation_root), {
let prevalidator = to_ocaml!(
gc,
validate_operation_request.prevalidator,
prevalidator_root
);
let operation = to_ocaml!(
gc,
FfiOperation::from(&validate_operation_request.operation),
operation_root
);
let validate_operation_request = to_ocaml!(gc, validate_operation_request);
ocaml_call!(tezos_ffi::construct_and_compare_validate_operation_request(
gc,
validate_operation_request,
gc.get(&prevalidator),
gc.get(&operation),
))
.unwrap()
.to_rust()
})
})
.unwrap();
assert!(result, "ValidateOperationRequest conversion failed")
} | rust_cleaned_test_functions.jsonl/67316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 779
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
32565,
7893,
22716,
368,
341,
262,
1077,
855,
16112,
284,
4968,
16112,
11542,
341,
286,
8781,
842,
25,
28525,
764,
486,
1539,
5673,
44660,
486,
18196,
82934,
6836,
3450,
568,
15454,
6011,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_invalid_dlci() {
let role = Role::Unassigned;
let buf: &[u8] = &[
0b00000101,
0b00101111, // Control Field - SABM command with P/F = 0.
0b00000001, // Length Field - Bit0 = 1: Indicates one octet length.
0x00, // Random FCS.
];
assert_matches!(Frame::parse(role, false, buf), Err(FrameParseError::InvalidDLCI(1)));
} | rust_cleaned_test_functions.jsonl/87860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
31433,
50811,
5855,
368,
341,
286,
1077,
3476,
284,
15404,
486,
1806,
39021,
280,
286,
1077,
6607,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
65,
15,
15,
15,
15,
15,
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_syn_sent_win_scale_buffers() {
for (buffer_size, shift_amt) in &[
(64, 0),
(128, 0),
(1024, 0),
(65535, 0),
(65536, 1),
(65537, 1),
(131071, 1),
(131072, 2),
(524287, 3),
(524288, 4),
(655350, 4),
(1048576, 5),
] {
let mut s = socket_with_buffer_sizes(64, *buffer_size);
assert_eq!(s.remote_win_shift, *shift_amt);
s.connect(REMOTE_END, LOCAL_END).unwrap();
recv!(s, [TcpRepr {
control: TcpControl::Syn,
ack_number: None,
max_seg_size: Some(BASE_MSS),
window_scale: Some(*shift_amt),
window_len: cmp::min(*buffer_size >> *shift_amt, 65535) as u16,
sack_permitted: true,
..RECV_TEMPL
}]);
}
} | rust_cleaned_test_functions.jsonl/91834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 611
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
24115,
25672,
16727,
54591,
368,
341,
286,
369,
320,
7573,
2368,
11,
6407,
54605,
8,
304,
609,
9640,
310,
320,
21,
19,
11,
220,
15,
1326,
310,
320,
16,
17,
23,
11,
220,
15,
1326,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_scalar() {
let fv = FV::<Scalar>::default_2048();
let (pk, sk) = fv.generate_keypair();
let v = vec![1; fv.n];
let w = vec![2; fv.n];
let vplusw = vec![3; fv.n];
// encrypt v
let mut ctv = fv.encrypt_sk(&v, &sk);
let ctw = fv.encrypt(&w, &pk);
// ct_v + ct_w.
fv.add_inplace(&mut ctv, &ctw);
let pt_after_add: DefaultFVPlaintext = fv.decrypt(&ctv, &sk);
assert_eq!(pt_after_add, vplusw);
} | rust_cleaned_test_functions.jsonl/103691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
41652,
368,
341,
286,
1077,
61654,
284,
434,
53,
27638,
20639,
6831,
2258,
62,
17,
15,
19,
23,
543,
286,
1077,
320,
20819,
11,
1901,
8,
284,
61654,
22019,
3097,
12670,
1428,
286,
1077,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_numeral_system() {
// we test only normalized inputs here
assert_eq!(
Sign::Positive,
Sign::from_input(""),
"Must be Sign::Positive"
);
assert_eq!(
Sign::Negative,
Sign::from_input("-"),
"Must be Sign::Negative"
);
} | rust_cleaned_test_functions.jsonl/1295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4273,
3253,
17687,
368,
341,
286,
442,
582,
1273,
1172,
29410,
11127,
1588,
198,
286,
2060,
10714,
33673,
310,
7075,
486,
35490,
345,
310,
7075,
486,
1499,
5898,
445,
4461,
310,
330,
31776,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lexemes_eq() {
use super::Lexemes::*;
let my_var = Name::new("my_var").unwrap();
let lexemes = MemoryLexemeStream::new(vec![
Keyword(KeywordLexeme::from_str("let").unwrap()),
Keyword(KeywordLexeme::from_str("mut").unwrap()),
Identifier(IdentifierLexeme::from_name(my_var)),
Association(AssociationLexeme::from_unprefixed()),
Literal(LiteralLexeme::Int(21)),
EndStatement(EndStatementLexeme::new_semicolon()),
Identifier(IdentifierLexeme::from_name(my_var)),
Association(AssociationLexeme::from_str("+").unwrap()),
Identifier(IdentifierLexeme::from_name(my_var)),
]);
assert_eq!(lexemes, lexemes);
assert_ne!(lexemes, MemoryLexemeStream::new(vec![]));
} | rust_cleaned_test_functions.jsonl/6826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74547,
15660,
10714,
368,
341,
262,
990,
2256,
486,
47778,
15660,
56162,
262,
1077,
847,
4612,
284,
3988,
486,
931,
445,
2408,
4612,
1827,
15454,
543,
262,
1077,
22429,
15660,
284,
13850,
47778,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_parsing() {
// Assert no panic
let result = parse_function_call(r#"foo("first", a, 1 + 2, $0)"#);
assert!(result.is_ok());
let (remaining, _call) = result.unwrap();
assert_eq!(remaining, "");
} | rust_cleaned_test_functions.jsonl/10833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
620,
28598,
368,
341,
286,
442,
5319,
902,
21975,
198,
286,
1077,
1102,
284,
4715,
9174,
13429,
2601,
55543,
7975,
445,
3896,
497,
264,
11,
220,
16,
488,
220,
17,
11,
400,
15,
9940,
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_router_response_to_router_solicitation_from_specified_source() {
/// Get a Router Solicitation ICMPv6 packet buffer.
fn rs_msg(src_ip: Ipv6Addr, src_mac: Mac, dst_ip: Ipv6Addr) -> Buf<Vec<u8>> {
let mac_bytes = src_mac.bytes();
let options = &[NdpOption::SourceLinkLayerAddress(&mac_bytes)];
OptionsSerializer::<_>::new(options.iter())
.into_serializer()
.encapsulate(IcmpPacketBuilder::<Ipv6, &[u8], _>::new(
src_ip,
dst_ip,
IcmpUnusedCode,
RouterSolicitation::default(),
))
.serialize_vec_outer()
.unwrap()
.unwrap_b()
}
let mut ndp_configs = NdpConfigurations::default();
let mut ndp_rc_configs = NdpRouterConfigurations::default();
ndp_rc_configs.set_should_send_advertisements(true);
ndp_rc_configs.set_router_advertisements_interval(200..=300);
ndp_configs.set_router_configurations(ndp_rc_configs.clone());
ndp_configs.set_dup_addr_detect_transmits(None);
ndp_configs.set_max_router_solicitations(None);
let dummy_config = Ipv6::DUMMY_CONFIG;
let mut state_builder = StackStateBuilder::default();
state_builder.ipv6_builder().forward(true);
state_builder.device_builder().set_default_ndp_configs(ndp_configs.clone());
let mut ctx = DummyEventDispatcherBuilder::default()
.build_with(state_builder, DummyEventDispatcher::default());
let device =
ctx.state_mut().add_ethernet_device(TEST_LOCAL_MAC, Ipv6::MINIMUM_LINK_MTU.into());
crate::device::initialize_device(&mut ctx, device);
// Assign an address to the device (should be assigned immediately since
add_ip_addr_subnet(
&mut ctx,
device,
AddrSubnet::new(dummy_config.local_ip.get(), 128).unwrap(),
)
.unwrap();
// Make device a router so it will start sending router advertisements
crate::device::set_routing_enabled::<_, Ipv6>(&mut ctx, device, true);
// Should not have sent anything yet.
assert_eq!(ctx.dispatcher().frames_sent().len(), 0);
let now = ctx.now();
// First `MAX_INITIAL_RTR_ADVERTISEMENTS` will have an interval of
assert_eq!(
ctx.dispatcher()
.timer_events()
.filter(|x| (*x.0 == now.checked_add(MAX_INITIAL_RTR_ADVERT_INTERVAL).unwrap())
&& (*x.1
== NdpTimerId::new_router_advertisement_transmit(device.id().into())
.into()))
.count(),
1
);
// Receiving a Router Solicitation from a specified source with a source
// link address should update our neighbor cache.
let mut rs_buf = rs_msg(
dummy_config.remote_ip.get(),
dummy_config.remote_mac,
dummy_config.local_ip.get(),
);
let rs = rs_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(
dummy_config.remote_ip,
dummy_config.local_ip,
))
.unwrap();
ctx.receive_ndp_packet(
device,
Ipv6SourceAddr::from_witness(dummy_config.remote_ip).unwrap(),
dummy_config.local_ip,
rs.unwrap_ndp(),
);
// Send the Router Advertisement.
assert_eq!(ctx.dispatcher().frames_sent().len(), 0);
assert_eq!(
trigger_next_timer(&mut ctx).unwrap(),
NdpTimerId::new_router_advertisement_transmit(device.id().into()).into()
);
assert_eq!(ctx.dispatcher().frames_sent().len(), 1);
validate_simple_ra(&ctx.dispatcher().frames_sent()[0].1, 1800);
// Source should be in our neighbor cache.
let ndp_state =
StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with(
&mut ctx,
device.id().into(),
);
let neighbor = ndp_state
.neighbors
.get_neighbor_state_mut(&dummy_config.remote_ip.try_into().unwrap())
.unwrap();
assert_eq!(neighbor.link_address.unwrap(), dummy_config.remote_mac);
assert_eq!(neighbor.state, NeighborEntryState::Stale);
assert_eq!(neighbor.is_router, false);
// Receiving a Router Solicitation from a specified source with a source
// already exists.
// Update neighbor entries to other values to check an update.
neighbor.link_address = Some(Mac::new([99, 98, 97, 96, 95, 94]));
neighbor.state = NeighborEntryState::Reachable;
neighbor.is_router = true;
let mut rs_buf = rs_msg(
dummy_config.remote_ip.get(),
dummy_config.remote_mac,
dummy_config.local_ip.get(),
);
let rs = rs_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(
dummy_config.remote_ip,
dummy_config.local_ip,
))
.unwrap();
ctx.receive_ndp_packet(
device,
Ipv6SourceAddr::from_witness(dummy_config.remote_ip).unwrap(),
dummy_config.local_ip,
rs.unwrap_ndp(),
);
// Send the Router Advertisement.
assert_eq!(ctx.dispatcher().frames_sent().len(), 1);
assert_eq!(
trigger_next_timer(&mut ctx).unwrap(),
NdpTimerId::new_router_advertisement_transmit(device.id().into()).into()
);
assert_eq!(ctx.dispatcher().frames_sent().len(), 2);
validate_simple_ra(&ctx.dispatcher().frames_sent()[1].1, 1800);
// Source's neighbor entry should be updated.
let ndp_state =
StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with(
&mut ctx,
device.id().into(),
);
let neighbor = ndp_state
.neighbors
.get_neighbor_state(&dummy_config.remote_ip.try_into().unwrap())
.unwrap();
assert_eq!(neighbor.link_address.unwrap(), dummy_config.remote_mac);
assert_eq!(neighbor.state, NeighborEntryState::Stale);
assert_eq!(neighbor.is_router, false);
} | rust_cleaned_test_functions.jsonl/82821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55587,
9655,
2346,
55587,
643,
7762,
7556,
5673,
13594,
1870,
10347,
368,
341,
286,
1048,
2126,
264,
10554,
76194,
7556,
83988,
85,
21,
10151,
4147,
624,
286,
5168,
10036,
6483,
14705,
10385,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intersection_zero() {
let left = VecDocSet::from(vec![0]);
let right = VecDocSet::from(vec![0]);
let mut intersection = Intersection::new(vec![left, right]);
assert_eq!(intersection.doc(), 0);
assert_eq!(intersection.advance(), TERMINATED);
} | rust_cleaned_test_functions.jsonl/13257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82558,
19359,
368,
341,
286,
1077,
2115,
284,
11312,
9550,
1649,
486,
1499,
25592,
20703,
15,
2558,
286,
1077,
1290,
284,
11312,
9550,
1649,
486,
1499,
25592,
20703,
15,
2558,
286,
1077,
5206,
192... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uploading_data_with_unexpected_reply() {
let data: [u8; 1024] = [0; 1024];
let mut test_transport = TestTransport::new();
test_transport.push(Reply::Info("Writing".to_string()));
let response = upload(&data, &mut test_transport);
assert!(response.is_err());
} | rust_cleaned_test_functions.jsonl/78933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21691,
287,
1769,
6615,
4907,
7325,
15323,
368,
341,
286,
1077,
821,
25,
508,
84,
23,
26,
220,
16,
15,
17,
19,
60,
284,
508,
15,
26,
220,
16,
15,
17,
19,
935,
286,
1077,
5206,
1273,
46398,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_helpers() {
let res: HttpResponse = ErrorBadRequest("err").into();
assert_eq!(res.status(), StatusCode::BAD_REQUEST);
let res: HttpResponse = ErrorUnauthorized("err").into();
assert_eq!(res.status(), StatusCode::UNAUTHORIZED);
let res: HttpResponse = ErrorPaymentRequired("err").into();
assert_eq!(res.status(), StatusCode::PAYMENT_REQUIRED);
let res: HttpResponse = ErrorForbidden("err").into();
assert_eq!(res.status(), StatusCode::FORBIDDEN);
let res: HttpResponse = ErrorNotFound("err").into();
assert_eq!(res.status(), StatusCode::NOT_FOUND);
let res: HttpResponse = ErrorMethodNotAllowed("err").into();
assert_eq!(res.status(), StatusCode::METHOD_NOT_ALLOWED);
let res: HttpResponse = ErrorNotAcceptable("err").into();
assert_eq!(res.status(), StatusCode::NOT_ACCEPTABLE);
let res: HttpResponse = ErrorProxyAuthenticationRequired("err").into();
assert_eq!(res.status(), StatusCode::PROXY_AUTHENTICATION_REQUIRED);
let res: HttpResponse = ErrorRequestTimeout("err").into();
assert_eq!(res.status(), StatusCode::REQUEST_TIMEOUT);
let res: HttpResponse = ErrorConflict("err").into();
assert_eq!(res.status(), StatusCode::CONFLICT);
let res: HttpResponse = ErrorGone("err").into();
assert_eq!(res.status(), StatusCode::GONE);
let res: HttpResponse = ErrorLengthRequired("err").into();
assert_eq!(res.status(), StatusCode::LENGTH_REQUIRED);
let res: HttpResponse = ErrorPreconditionFailed("err").into();
assert_eq!(res.status(), StatusCode::PRECONDITION_FAILED);
let res: HttpResponse = ErrorPayloadTooLarge("err").into();
assert_eq!(res.status(), StatusCode::PAYLOAD_TOO_LARGE);
let res: HttpResponse = ErrorUriTooLong("err").into();
assert_eq!(res.status(), StatusCode::URI_TOO_LONG);
let res: HttpResponse = ErrorUnsupportedMediaType("err").into();
assert_eq!(res.status(), StatusCode::UNSUPPORTED_MEDIA_TYPE);
let res: HttpResponse = ErrorRangeNotSatisfiable("err").into();
assert_eq!(res.status(), StatusCode::RANGE_NOT_SATISFIABLE);
let res: HttpResponse = ErrorExpectationFailed("err").into();
assert_eq!(res.status(), StatusCode::EXPECTATION_FAILED);
let res: HttpResponse = ErrorImATeapot("err").into();
assert_eq!(res.status(), StatusCode::IM_A_TEAPOT);
let res: HttpResponse = ErrorMisdirectedRequest("err").into();
assert_eq!(res.status(), StatusCode::MISDIRECTED_REQUEST);
let res: HttpResponse = ErrorUnprocessableEntity("err").into();
assert_eq!(res.status(), StatusCode::UNPROCESSABLE_ENTITY);
let res: HttpResponse = ErrorLocked("err").into();
assert_eq!(res.status(), StatusCode::LOCKED);
let res: HttpResponse = ErrorFailedDependency("err").into();
assert_eq!(res.status(), StatusCode::FAILED_DEPENDENCY);
let res: HttpResponse = ErrorUpgradeRequired("err").into();
assert_eq!(res.status(), StatusCode::UPGRADE_REQUIRED);
let res: HttpResponse = ErrorPreconditionRequired("err").into();
assert_eq!(res.status(), StatusCode::PRECONDITION_REQUIRED);
let res: HttpResponse = ErrorTooManyRequests("err").into();
assert_eq!(res.status(), StatusCode::TOO_MANY_REQUESTS);
let res: HttpResponse = ErrorRequestHeaderFieldsTooLarge("err").into();
assert_eq!(res.status(), StatusCode::REQUEST_HEADER_FIELDS_TOO_LARGE);
let res: HttpResponse = ErrorUnavailableForLegalReasons("err").into();
assert_eq!(res.status(), StatusCode::UNAVAILABLE_FOR_LEGAL_REASONS);
let res: HttpResponse = ErrorInternalServerError("err").into();
assert_eq!(res.status(), StatusCode::INTERNAL_SERVER_ERROR);
let res: HttpResponse = ErrorNotImplemented("err").into();
assert_eq!(res.status(), StatusCode::NOT_IMPLEMENTED);
let res: HttpResponse = ErrorBadGateway("err").into();
assert_eq!(res.status(), StatusCode::BAD_GATEWAY);
let res: HttpResponse = ErrorServiceUnavailable("err").into();
assert_eq!(res.status(), StatusCode::SERVICE_UNAVAILABLE);
let res: HttpResponse = ErrorGatewayTimeout("err").into();
assert_eq!(res.status(), StatusCode::GATEWAY_TIMEOUT);
let res: HttpResponse = ErrorHttpVersionNotSupported("err").into();
assert_eq!(res.status(), StatusCode::HTTP_VERSION_NOT_SUPPORTED);
let res: HttpResponse = ErrorVariantAlsoNegotiates("err").into();
assert_eq!(res.status(), StatusCode::VARIANT_ALSO_NEGOTIATES);
let res: HttpResponse = ErrorInsufficientStorage("err").into();
assert_eq!(res.status(), StatusCode::INSUFFICIENT_STORAGE);
let res: HttpResponse = ErrorLoopDetected("err").into();
assert_eq!(res.status(), StatusCode::LOOP_DETECTED);
let res: HttpResponse = ErrorNotExtended("err").into();
assert_eq!(res.status(), StatusCode::NOT_EXTENDED);
let res: HttpResponse = ErrorNetworkAuthenticationRequired("err").into();
assert_eq!(res.status(), StatusCode::NETWORK_AUTHENTICATION_REQUIRED);
} | rust_cleaned_test_functions.jsonl/33574 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2098
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
54473,
368,
341,
286,
1077,
592,
25,
17580,
284,
4600,
46015,
445,
615,
1827,
18122,
543,
286,
2060,
10714,
10297,
416,
4299,
1507,
53403,
486,
53572,
14454,
626,
286,
1077,
592,
25,
17580,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_malformed_script() {
let (_swarm, mut client_proxy) = setup_swarm_and_client_proxy(1, 0);
client_proxy.create_next_account(false).unwrap();
client_proxy
.mint_coins(&["mintb", "0", "100"], true)
.unwrap();
let script_path = workspace_builder::workspace_root()
.join("language/stdlib/transaction_scripts/peer_to_peer_transfer_with_metadata.mvir");
let unwrapped_script_path = script_path.to_str().unwrap();
let script_params = &["execute", "0", unwrapped_script_path, "script"];
let script_compiled_path = client_proxy.compile_program(script_params).unwrap();
client_proxy
.execute_script(&["execute", "0", &script_compiled_path[..], "10"])
.unwrap();
// Previous transaction should not choke the system.
client_proxy
.mint_coins(&["mintb", "0", "10"], true)
.unwrap();
} | rust_cleaned_test_functions.jsonl/32480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
278,
10155,
14660,
368,
341,
262,
1077,
5453,
2280,
2178,
11,
5206,
2943,
29712,
8,
284,
6505,
32581,
2178,
8378,
8179,
29712,
7,
16,
11,
220,
15,
317,
262,
2943,
29712,
2520,
11257,
13500,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_as_countedext() {
let client: Box<dyn CountedExt> = Box::new(StatsdClient::from_sink("prefix", NopMetricSink));
client.incr("some.counter").unwrap();
} | rust_cleaned_test_functions.jsonl/10613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
11898,
3180,
291,
427,
368,
341,
286,
1077,
2943,
25,
8261,
92846,
4504,
291,
6756,
29,
284,
8261,
486,
931,
7,
16635,
67,
2959,
486,
1499,
51567,
445,
11849,
497,
451,
453,
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 |
#[test]
fn test_symbol_presence() {
let string = "<< Help";
println!("starts with {:?}", try_extract_symbol_at_start(string));
assert!(try_extract_symbol_at_start(string) == Some("<<"));
assert!(try_extract_symbol_at_start(&string[2..]) == None);
} | rust_cleaned_test_functions.jsonl/5917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21179,
56403,
368,
341,
262,
1077,
914,
284,
14717,
11479,
876,
262,
13751,
17223,
65876,
448,
71964,
1430,
39123,
21179,
3752,
4906,
3609,
1106,
262,
2060,
10297,
1539,
39123,
21179,
3752,
4906,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply_partials() {
// let mut config = Config::Basic {
// let partial_config = PartialConfig::Basic {
// match config {
// Config::Basic {
} | rust_cleaned_test_functions.jsonl/65845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
10495,
10309,
368,
341,
220,
442,
1077,
5206,
2193,
284,
5532,
486,
15944,
341,
30779,
2303,
18611,
220,
442,
1077,
7130,
5332,
284,
24552,
2648,
486,
15944,
341,
30779,
2303,
18611,
18611,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_long_format_multiple_users() {
let args = ["-l", "root", "root", "root"];
new_ucmd!()
.args(&args)
.succeeds()
.stdout_is(expected_result(&args));
} | rust_cleaned_test_functions.jsonl/24862 | {
"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,
17799,
8955,
45233,
16348,
368,
341,
262,
1077,
2827,
284,
4383,
12,
75,
497,
330,
2888,
497,
330,
2888,
497,
330,
2888,
31797,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
2116,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_roundtrip_one() {
let levels = vec![0, 1, 1, 1, 1, 0, 0, 0, 0, 1];
let max_level = 1;
test_internal_roundtrip(Encoding::RLE, &levels, max_level, false);
test_internal_roundtrip(Encoding::BIT_PACKED, &levels, max_level, false);
test_internal_roundtrip(Encoding::RLE, &levels, max_level, true);
} | rust_cleaned_test_functions.jsonl/76392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
32981,
11667,
368,
341,
262,
1077,
5866,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
16,
11,
220,
16,
11,
220,
16,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assembler_signed_ops() {
test_case(&["MLI X, 0xffff"], &[0x8065]);
test_case(&["DVI B, [J]"], &[0x3c27]);
test_case(&["MDI C, 31"], &[0x7c49, 0x001f]);
} | rust_cleaned_test_functions.jsonl/44758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
35401,
55617,
21959,
368,
341,
262,
1273,
19096,
2099,
1183,
2668,
40,
1599,
11,
220,
15,
20518,
7914,
44590,
15,
87,
23,
15,
21,
20,
2558,
262,
1273,
19096,
2099,
1183,
35,
25308,
425,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_data_error() {
// Test the mock diem interface implementation
let node = setup_node_using_test_mocks();
verify_missing_data(node);
// Test the json diem interface implementation
let (node, _runtime) = setup_node_using_json_rpc();
verify_missing_data(node);
} | rust_cleaned_test_functions.jsonl/100458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
1769,
4096,
368,
341,
262,
442,
3393,
279,
7860,
1853,
336,
3749,
8129,
198,
262,
1077,
2436,
284,
6505,
5084,
75180,
4452,
717,
25183,
543,
262,
10146,
40447,
1769,
6958,
626,
262,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_getters() {
macro_rules! t(
(s: $path:expr, $filename:expr, $dirname:expr, $filestem:expr, $ext:expr) => (
{
let path = $path;
let filename = $filename;
assert!(path.filename_str() == filename,
"`{}`.filename_str(): Expected `{:?}`, found `{:?}`",
path.as_str().unwrap(), filename, path.filename_str());
let dirname = $dirname;
assert!(path.dirname_str() == dirname,
"`{}`.dirname_str(): Expected `{:?}`, found `{:?}`",
path.as_str().unwrap(), dirname, path.dirname_str());
let filestem = $filestem;
assert!(path.filestem_str() == filestem,
"`{}`.filestem_str(): Expected `{:?}`, found `{:?}`",
path.as_str().unwrap(), filestem, path.filestem_str());
let ext = $ext;
assert!(path.extension_str() == ext,
"`{}`.extension_str(): Expected `{:?}`, found `{:?}`",
path.as_str().unwrap(), ext, path.extension_str());
}
);
(v: $path:expr, $filename:expr, $dirname:expr, $filestem:expr, $ext:expr) => (
{
let path = $path;
assert!(path.filename() == $filename);
assert!(path.dirname() == $dirname);
assert!(path.filestem() == $filestem);
assert!(path.extension() == $ext);
}
)
)
t!(v: Path::new(b"a\\b\\c"), Some(b"c"), b"a\\b", Some(b"c"), None);
t!(s: Path::new("a\\b\\c"), Some("c"), Some("a\\b"), Some("c"), None);
t!(s: Path::new("."), None, Some("."), None, None);
t!(s: Path::new("\\"), None, Some("\\"), None, None);
t!(s: Path::new(".."), None, Some(".."), None, None);
t!(s: Path::new("..\\.."), None, Some("..\\.."), None, None);
t!(s: Path::new("hi\\there.txt"), Some("there.txt"), Some("hi"),
Some("there"), Some("txt"));
t!(s: Path::new("hi\\there"), Some("there"), Some("hi"), Some("there"), None);
t!(s: Path::new("hi\\there."), Some("there."), Some("hi"),
Some("there"), Some(""));
t!(s: Path::new("hi\\.there"), Some(".there"), Some("hi"), Some(".there"), None);
t!(s: Path::new("hi\\..there"), Some("..there"), Some("hi"),
Some("."), Some("there"));
} | rust_cleaned_test_functions.jsonl/102778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1510
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5045,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
320,
82,
25,
400,
2343,
96011,
11,
400,
8404,
96011,
11,
400,
14434,
96011,
11,
400,
1192,
64088,
96011,
11,
400,
427,
96011,
8,
589... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_server_www_tcp() {
let addr = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 0));
let tcp_listener = TcpListener::bind(&addr).unwrap();
let ipaddr = tcp_listener.local_addr().unwrap();
println!("tcp_listner on port: {}", ipaddr);
let server_continue = Arc::new(AtomicBool::new(true));
let server_continue2 = server_continue.clone();
let server_thread = thread::Builder::new()
.name("test_server:tcp:server".to_string())
.spawn(move || server_thread_tcp(tcp_listener, server_continue2))
.unwrap();
let client_thread = thread::Builder::new()
.name("test_server:tcp:client".to_string())
.spawn(move || client_thread_www(lazy_tcp_client(ipaddr)))
.unwrap();
let client_result = client_thread.join();
assert!(client_result.is_ok(), "client failed: {:?}", client_result);
server_continue.store(false, Ordering::Relaxed);
server_thread.join().unwrap();;
} | rust_cleaned_test_functions.jsonl/109269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
62,
2136,
45562,
368,
341,
262,
1077,
10789,
284,
20954,
13986,
486,
53,
19,
73066,
13986,
53,
19,
486,
931,
8972,
30168,
19,
13986,
486,
931,
7,
16,
17,
22,
11,
220,
15,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.