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_split_off_tiny_left_height_2() {
let pairs = (0..MIN_INSERTS_HEIGHT_2).map(|i| (i, i));
let mut left: BTreeMap<_, _> = pairs.clone().collect();
let right = left.split_off(&1);
assert_eq!(left.len(), 1);
assert_eq!(right.len(), MIN_INSERTS_HEIGHT_2 - 1);
assert_eq!(*left.first_key_value().unwrap().0, 0);
assert_eq!(*right.first_key_value().unwrap().0, 1);
} | rust_cleaned_test_functions.jsonl/56364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
13651,
528,
6441,
9579,
9561,
62,
17,
368,
341,
262,
1077,
13530,
284,
320,
15,
496,
16413,
47924,
50,
17355,
62,
17,
568,
2186,
22428,
72,
91,
320,
72,
11,
600,
1106,
262,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_atomic_update_api() -> Result<(), Box<dyn Error>> {
let p = create_temp_path("/dev/shm/elfshaker-test/test_atomic_update_api");
// Create an empty file with no lock on it.
// Should succeed later.
fs::create_dir_all(p.parent().unwrap())?;
fs::write(&p, vec![])?;
let content = b"non-empty" as &[u8];
const NTHREAD: i32 = 128;
let n_total = NTHREAD * 1000;
let result: i32 = run_in_parallel(NTHREAD as usize, 0..n_total, |_| {
AtomicCreateFile::new(&p)?.commit_content(content)
})
.into_iter()
.map(|r| match r {
Ok(_) => 1,
Err(e) if e.kind() == io::ErrorKind::AlreadyExists => -1,
Err(e) => panic!("unexpected error: {:?}", e),
})
.sum();
fs::remove_file(&p)?;
let (n_success, n_fail) = (1, n_total - 1);
// Test that we see exactly one success and the rest as failures.
assert_eq!((n_success * 1) + (n_fail * -1), result);
Ok(())
} | rust_cleaned_test_functions.jsonl/126614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51367,
8882,
11697,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
281,
284,
1855,
11771,
2638,
4283,
3583,
14688,
76,
14,
490,
927,
4407,
16839,
12697,
51367,
8882,
11697,
3071,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_create_db() {
let dir = tempdir().unwrap();
let env = Environment::new().set_max_dbs(11).open(dir.path()).unwrap();
let txn = env.begin_rw_txn().unwrap();
assert!(txn.open_db(Some("testdb")).is_err());
assert!(txn
.create_db(Some("testdb"), ffi::MDBX_db_flags_t::empty())
.is_ok());
assert!(txn.open_db(Some("testdb")).is_ok())
} | rust_cleaned_test_functions.jsonl/81369 | {
"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,
8657,
8685,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
6105,
284,
11586,
486,
931,
1005,
746,
6345,
814,
1279,
7,
16,
16,
568,
2508,
14161,
3875,
6011,
15454,
1428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arguments_explicit_dep_target_needed() {
let args = stringvec!["-c", "foo.c", "-MT", "depfile", "-fabc", "-MF", "file", "-o", "foo.o", "-MD"];
let ParsedArguments {
input,
language,
depfile: _,
outputs,
preprocessor_args,
msvc_show_includes,
common_args,
..
} = match _parse_arguments(&args) {
CompilerArguments::Ok(args) => args,
o @ _ => panic!("Got unexpected parse result: {:?}", o),
};
assert!(true, "Parsed ok");
assert_eq!(Some("foo.c"), input.to_str());
assert_eq!(Language::C, language);
assert_map_contains!(outputs, ("obj", PathBuf::from("foo.o")));
//TODO: fix assert_map_contains to assert no extra keys!
assert_eq!(1, outputs.len());
assert_eq!(ovec!["-MF", "file", "-MD", "-MT", "depfile"], preprocessor_args);
assert_eq!(ovec!["-fabc"], common_args);
assert!(!msvc_show_includes);
} | rust_cleaned_test_functions.jsonl/15019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
43433,
14214,
6026,
49258,
11123,
57426,
368,
341,
286,
1077,
2827,
284,
914,
4083,
0,
1183,
12,
66,
497,
330,
7975,
520,
497,
6523,
8505,
497,
330,
14891,
1192,
497,
6523,
69,
13683,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_accept_bad_id() {
let mut socket = socket(buffer(1), buffer(1));
assert_eq!(socket.bind(Endpoint::Ident(0x1234)), Ok(()));
let checksum = ChecksumCapabilities::default();
let mut bytes = [0xff; 20];
let mut packet = Icmpv4Packet::new_unchecked(&mut bytes);
let icmp_repr = Icmpv4Repr::EchoRequest {
ident: 0x4321,
seq_no: 0x5678,
data: &[0xff; 16],
};
icmp_repr.emit(&mut packet, &checksum);
// Ensure that a packet with an identifier that isn't the bound
// ID is not accepted
assert!(!socket.accepts(&Context::DUMMY, &REMOTE_IPV4_REPR, &icmp_repr.into()));
} | rust_cleaned_test_functions.jsonl/99232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35728,
34199,
842,
368,
341,
286,
1077,
5206,
7575,
284,
7575,
12584,
7,
16,
701,
4147,
7,
16,
1106,
286,
2060,
10714,
10297,
9556,
6090,
7,
27380,
486,
28301,
7,
15,
87,
16,
17,
18,
19,
573... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_badpath4() {
#[endpoint {
method = PUT,
path = "I don't start with a slash"
}]
async fn test_badpath_handler(
_: Arc<RequestContext<()>>,
) -> Result<Response<Body>, HttpError> {
unimplemented!();
}
let mut api = ApiDescription::new();
api.register(test_badpath_handler).unwrap();
} | rust_cleaned_test_functions.jsonl/17569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
2343,
19,
368,
341,
286,
11506,
32540,
341,
310,
1714,
284,
34380,
345,
310,
1815,
284,
330,
40,
1513,
944,
1191,
448,
264,
36626,
698,
286,
28394,
286,
3312,
5168,
1273,
34199,
2343,
101... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_open_hash_sync() {
use std::io::prelude::*;
let tmp = tempfile::tempdir().unwrap();
let dir = tmp.path().to_owned();
let sri = crate::write_sync(&dir, "my-key", b"hello world").unwrap();
let mut handle = crate::SyncReader::open_hash(&dir, sri).unwrap();
let mut str = String::new();
handle.read_to_string(&mut str).unwrap();
handle.check().unwrap();
assert_eq!(str, String::from("hello world"));
} | rust_cleaned_test_functions.jsonl/64594 | {
"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,
11311,
8950,
23008,
368,
341,
286,
990,
1460,
486,
815,
486,
1726,
52538,
56162,
286,
1077,
4174,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
5419,
284,
4174,
3875,
1005,
983,
51973,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stop_sending_other_error_wo_reset() {
let (mut client, mut server, request_stream_id) = connect_and_send_request(false);
// Stop sending with RequestRejected.
assert_eq!(
Ok(()),
server
.conn
.stream_stop_sending(request_stream_id, Error::HttpRequestRejected.code())
);
let out = server.conn.process(None, now());
client.process(out.dgram(), now());
let mut stop_sending = false;
while let Some(e) = client.next_event() {
match e {
Http3ClientEvent::StopSending { stream_id, error } => {
assert_eq!(stream_id, request_stream_id);
assert_eq!(error, Error::HttpRequestRejected.code());
stop_sending = true;
}
Http3ClientEvent::Reset { .. } => {
panic!("We should not get StopSending.");
}
Http3ClientEvent::HeaderReady { .. } | Http3ClientEvent::DataReadable { .. } => {
panic!("We should not get any headers or data");
}
_ => {}
}
}
assert!(stop_sending);
// after this we can still read from a stream.
let mut buf = [0_u8; 100];
let res = client.read_response_data(now(), request_stream_id, &mut buf);
assert!(res.is_ok());
client.close(now(), 0, "");
} | rust_cleaned_test_functions.jsonl/101904 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 773
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19039,
643,
2459,
30456,
4096,
96058,
18983,
368,
341,
1789,
286,
1077,
320,
6984,
2943,
11,
5206,
3538,
11,
1681,
12673,
842,
8,
284,
4564,
8378,
13565,
7893,
3576,
626,
286,
442,
14215,
11628,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_1() {
let s = String::from("abcd");
let t = String::from("abcde");
assert_eq!(Solution::find_the_difference(s, t), 'e');
} | rust_cleaned_test_functions.jsonl/56114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
368,
341,
286,
1077,
274,
284,
923,
486,
1499,
445,
68644,
797,
286,
1077,
259,
284,
923,
486,
1499,
445,
13683,
450,
3071,
286,
2060,
10714,
10297,
36842,
486,
3903,
16068,
47525,
1141,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ambiguous_nullable_grammar() {
let g = examples::make_ambiguous_nullable();
let nullable_error = calculate_nullables(&g).unwrap_err();
assert!(matches!(nullable_error, NullableError::Ambiguity));
} | rust_cleaned_test_functions.jsonl/27893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
90213,
69743,
62,
41094,
368,
341,
262,
1077,
342,
284,
10295,
486,
6927,
62,
90213,
69743,
543,
262,
1077,
13258,
4096,
284,
11047,
15162,
4788,
2099,
70,
568,
15454,
9266,
543,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_encode_single_message() {
let _m = mock("GET", "/subjects/nl.openweb.data.Heartbeat/versions/latest")
.with_status(200)
.with_header("content-type", "application/vnd.schemaregistry.v1+json")
.with_body(&get_proto_body(get_proto_hb_schema(), 7))
.create();
let sr_settings = SrSettings::new(format!("http://{}", server_address()));
let mut encoder = ProtoRawEncoder::new(sr_settings);
let strategy =
SubjectNameStrategy::RecordNameStrategy(String::from("nl.openweb.data.Heartbeat"));
let encoded_data = encoder
.encode_single_message(get_proto_hb_101_only_data(), &strategy)
.unwrap();
assert_eq!(encoded_data, get_proto_hb_101())
} | rust_cleaned_test_functions.jsonl/100933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
19487,
6462,
368,
341,
286,
1077,
716,
76,
284,
7860,
445,
3806,
497,
3521,
64782,
9612,
75,
5826,
2911,
2196,
13,
45384,
22227,
14,
28290,
33149,
1138,
310,
659,
4197,
4773,
7,
17,
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_convert_call_multiple_object_arguments() {
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(),
metadata: String::new(),
package: None,
imports: Vec::new(),
body: vec![ast::Statement::Expr(Box::new(ast::ExprStmt {
base: b.clone(),
expression: ast::Expression::Call(Box::new(ast::CallExpr {
base: b.clone(),
callee: ast::Expression::Identifier(ast::Identifier {
base: b.clone(),
name: "f".to_string(),
}),
lparen: vec![],
arguments: vec![
ast::Expression::Object(Box::new(ast::ObjectExpr {
base: b.clone(),
lbrace: vec![],
with: None,
properties: vec![ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "a".to_string(),
}),
separator: vec![],
value: Some(ast::Expression::Integer(ast::IntegerLit {
base: b.clone(),
value: 0,
})),
comma: vec![],
}],
rbrace: vec![],
})),
ast::Expression::Object(Box::new(ast::ObjectExpr {
base: b.clone(),
lbrace: vec![],
with: None,
properties: vec![ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "b".to_string(),
}),
separator: vec![],
value: Some(ast::Expression::Integer(ast::IntegerLit {
base: b.clone(),
value: 1,
})),
comma: vec![],
}],
rbrace: vec![],
})),
],
rparen: vec![],
})),
}))],
eof: vec![],
}],
};
let got = test_convert(pkg).err().unwrap().to_string();
expect![["error @0:0-0:0: function parameters are more than one record expression"]]
.assert_eq(&got);
} | rust_cleaned_test_functions.jsonl/131377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
13429,
45233,
5314,
43433,
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,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_initialization_failure() {
let manager = NthConnectFailManager { n: Mutex::new(0) };
let pool = Pool::builder()
.connection_timeout(Duration::from_secs(1))
.build_unchecked(manager);
let err = pool.get().err().unwrap();
assert!(err.to_string().contains("blammo"));
} | rust_cleaned_test_functions.jsonl/6405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
15809,
2022,
43618,
368,
341,
262,
1077,
6645,
284,
451,
339,
14611,
19524,
2043,
314,
308,
25,
66215,
486,
931,
7,
15,
8,
2605,
262,
1077,
7314,
284,
22728,
486,
17850,
741,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_gs_url() {
assert_eq!(
split_gs_url(&"gs://foo/bar/blah".to_string()).expect("bar/blah"),
("foo", "bar/blah")
);
assert_eq!(split_gs_url(&"gs://foo/".to_string()).expect("empty object"), ("foo", ""));
assert_eq!(split_gs_url(&"gs:///".to_string()).expect("empty object"), ("", ""));
assert!(split_gs_url(&"gs://foo".to_string()).is_err());
assert!(split_gs_url(&"gs://".to_string()).is_err());
assert!(split_gs_url(&"g".to_string()).is_err());
assert!(split_gs_url(&"".to_string()).is_err());
} | rust_cleaned_test_functions.jsonl/79954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
96930,
2903,
368,
341,
286,
2060,
10714,
33673,
310,
6718,
96930,
2903,
2099,
1,
5857,
1110,
7975,
49513,
14,
70614,
3263,
983,
3904,
6011,
17119,
445,
2257,
14,
70614,
4461,
310,
3489,
797... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_parser_and() {
let mut input = Cursor::new("a and b".as_bytes());
let mut parser = Parser::make(&mut input).expect("Should create parser");
let and = parser.parse().expect("And");
assert_eq!(and.to_string(), "a and b");
} | rust_cleaned_test_functions.jsonl/125353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
18517,
8378,
368,
972,
286,
1077,
5206,
1946,
284,
28067,
486,
931,
445,
64,
323,
293,
3263,
300,
12524,
6201,
286,
1077,
5206,
6729,
284,
21102,
486,
6927,
2099,
6984,
1946,
568,
17119,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quoted_node_selector() {
let selector_str = "\"unnamed\"";
assert_eq!(
Ok((
"",
NodeSelectorRaw {
node_kind: "unnamed".into(),
nth_child: None
}
)),
node_selector(selector_str)
);
let selector_str = "\"unnamed\":nth-child(11)";
assert_eq!(
Ok((
"",
NodeSelectorRaw {
node_kind: "unnamed".into(),
nth_child: Some(11)
}
)),
node_selector(selector_str)
);
} | rust_cleaned_test_functions.jsonl/56564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
9253,
5084,
28890,
368,
341,
286,
1077,
9367,
2895,
284,
15898,
14931,
3606,
95349,
286,
2060,
10714,
33673,
310,
7622,
94702,
394,
8324,
394,
6018,
5877,
20015,
341,
503,
2436,
33162,
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_sqlite_functions() {
let db = checked_memory_handle();
let result: Result<time::Timespec> =
db.query_row("SELECT CURRENT_TIMESTAMP", NO_PARAMS, |r| r.get(0));
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/62323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18063,
632,
31708,
368,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
543,
286,
1077,
1102,
25,
5714,
27,
1678,
486,
18889,
992,
29,
4035,
310,
2927,
4786,
8530,
445,
4858,
43107,
47854,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fr_is_valid() {
let mut a = MODULUS_LIMBS;
assert!(!a.is_valid());
a.sub_noborrow(&Fr([1, 0, 0, 0]));
assert!(a.is_valid());
assert!(Fr::from(0).is_valid());
assert!(Fr([
0xffffffff00000000,
0x53bda402fffe5bfe,
0x3339d80809a1d805,
0x73eda753299d7d48
])
.is_valid());
assert!(!Fr([
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff
])
.is_valid());
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
0xe5,
]);
for _ in 0..1000 {
let a = Fr::random(&mut rng);
assert!(a.is_valid());
}
} | rust_cleaned_test_functions.jsonl/100645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
6892,
8337,
368,
341,
262,
1077,
5206,
264,
284,
18669,
1094,
2034,
2351,
1791,
7347,
280,
262,
2060,
0,
3471,
64,
2079,
8337,
1423,
262,
264,
4309,
1089,
674,
7768,
2099,
22560,
2561,
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... | 2 |
#[test]
fn test_report_steady() {
let default = StrategyPeriodic::default();
let mut runtime = rt::Runtime::new().unwrap();
let steady = runtime.block_on(default.report_steady()).unwrap();
assert_eq!(steady, true);
} | rust_cleaned_test_functions.jsonl/37968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14813,
1261,
3149,
88,
368,
341,
286,
1077,
1638,
284,
27745,
23750,
292,
486,
2258,
543,
286,
1077,
5206,
15592,
284,
16677,
486,
15123,
486,
931,
1005,
15454,
543,
286,
1077,
24020,
284,
15592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_default() {
env::set_var("A_B_C", "abc");
let environment = Environment::new();
assert!(environment.collect().unwrap().contains_key("a_b_c"));
env::remove_var("A_B_C");
} | rust_cleaned_test_functions.jsonl/22982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
368,
341,
262,
6105,
486,
746,
4612,
445,
32,
1668,
920,
497,
330,
13683,
3071,
262,
1077,
4573,
284,
11586,
486,
931,
1428,
262,
2060,
10297,
23294,
29124,
1005,
15454,
1005,
13372,
3097,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_resolve_2d_f32() {
let mass = Mass::<f32, f32>::new_with_inertia(0.5, 0.);
let material = Material::default();
let left_velocity = NextFrame {
value: Velocity::new(Vector2::<f32>::new(1., 0.), 0.),
};
let left_pose = BodyPose::new(Point2::origin(), Basis2::one());
let right_velocity = NextFrame {
value: Velocity::new(Vector2::new(-2., 0.), 0.),
};
let right_pose = BodyPose::new(Point2::new(1., 0.), Basis2::one());
let contact = ContactEvent::new(
(1, 2),
Contact::new_impl(CollisionStrategy::FullResolution, Vector2::new(1., 0.), 0.5),
);
let set = resolve_contact(
&contact.contact,
&ResolveData::new(Some(&left_velocity), &left_pose, &mass, &material),
&ResolveData::new(Some(&right_velocity), &right_pose, &mass, &material),
);
assert_eq!(
(
SingleChangeSet::new(
Some(BodyPose::new(
Point2::new(-0.04900000075250864, 0.),
Basis2::one()
)),
Some(NextFrame {
value: Velocity::new(Vector2::new(-2., 0.), 0.),
}),
),
SingleChangeSet::new(
Some(BodyPose::new(
Point2::new(1.0490000007525087, 0.),
Basis2::one()
)),
Some(NextFrame {
value: Velocity::new(Vector2::new(1., 0.), 0.),
}),
)
),
set
);
} | rust_cleaned_test_functions.jsonl/28245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1011
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
62,
17,
67,
761,
18,
17,
368,
341,
286,
1077,
3072,
284,
9167,
27638,
69,
18,
17,
11,
282,
18,
17,
6831,
931,
6615,
1243,
40122,
7,
15,
13,
20,
11,
220,
15,
58957,
286,
1077,
3684,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_limit_number_of_message_ids_inside_ihave() {
let config = GossipsubConfigBuilder::default()
.max_ihave_messages(10)
.max_ihave_length(100)
.build()
.unwrap();
//build gossipsub with full mesh
let (mut gs, peers, topics) = inject_nodes1()
.peer_no(config.mesh_n_high())
.topics(vec!["test".into()])
.to_subscribe(false)
.gs_config(config.clone())
.create_network();
//graft to all peers to really fill the mesh with all the peers
for peer in peers {
gs.handle_graft(&peer, topics.clone());
}
//add two other peers not in the mesh
let p1 = add_peer(&mut gs, &topics, false, false);
let p2 = add_peer(&mut gs, &topics, false, false);
//receive 200 messages from another peer
let mut seq = 0;
for _ in 0..200 {
gs.handle_received_message(random_message(&mut seq, &topics), &PeerId::random());
}
//emit gossip
gs.emit_gossip();
let mut ihaves1 = HashSet::new();
let mut ihaves2 = HashSet::new();
assert_eq!(
count_control_msgs(&gs, |p, action| match action {
GossipsubControlAction::IHave { message_ids, .. } => {
if p == &p1 {
ihaves1 = message_ids.iter().cloned().collect();
true
} else if p == &p2 {
ihaves2 = message_ids.iter().cloned().collect();
true
} else {
false
}
}
_ => false,
}),
2,
"should have emitted one ihave to p1 and one to p2"
);
assert_eq!(
ihaves1.len(),
100,
"should have sent 100 message ids in ihave to p1"
);
assert_eq!(
ihaves2.len(),
100,
"should have sent 100 message ids in ihave to p2"
);
assert!(
ihaves1 != ihaves2,
"should have sent different random messages to p1 and p2 \
(this may fail with a probability < 10^-58"
);
assert!(
ihaves1.intersection(&ihaves2).into_iter().count() > 0,
"should have sent random messages with some common messages to p1 and p2 \
(this may fail with a probability < 10^-58"
);
} | rust_cleaned_test_functions.jsonl/66940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14763,
5500,
3575,
6462,
8077,
72860,
5318,
19016,
368,
341,
286,
1077,
2193,
284,
479,
41473,
1966,
2648,
3297,
486,
2258,
741,
310,
659,
2810,
5318,
19016,
23428,
7,
16,
15,
340,
310,
659,
281... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_help() {
let (r, sioe) = do_execute!(&["-H"]);
assert_eq!(buff!(sioe, serr), "");
assert_eq!(buff!(sioe, sout), help_msg!());
assert_eq!(r.is_ok(), true);
} | rust_cleaned_test_functions.jsonl/62173 | {
"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,
26926,
368,
341,
286,
1077,
320,
81,
11,
274,
815,
68,
8,
284,
653,
44329,
0,
2099,
1183,
12,
39,
15049,
286,
2060,
10714,
10297,
25976,
10297,
82,
815,
68,
11,
61934,
701,
14498,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hex_numbers_0() {
let s = to_chars("0x");
let cur = &mut 0;
expect_next_token(&s, cur, Token::Illegal);
} | rust_cleaned_test_functions.jsonl/21027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
32964,
62,
15,
368,
341,
286,
1077,
274,
284,
311,
37418,
445,
15,
87,
797,
286,
1077,
2847,
284,
609,
6984,
220,
15,
280,
286,
1720,
11257,
6458,
2099,
82,
11,
2847,
11,
9660,
486,
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 |
#[test]
fn test_from_ll_keymod_keydown_unknown_bits() {
let mut raw_event = Event::KeyDown {
timestamp: 0,
window_id: 1,
keycode: None,
scancode: Some(Scancode::Q),
keymod: Mod::empty(),
repeat: false,
}
.to_ll()
.unwrap();
raw_event.key.keysym.mod_ = 0xffff;
if let Event::KeyDown { keymod, .. } = Event::from_ll(raw_event) {
assert_eq!(keymod, Mod::all());
} else {
panic!()
}
} | rust_cleaned_test_functions.jsonl/75290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
42995,
3097,
2593,
3097,
2923,
57507,
20034,
368,
341,
286,
1077,
5206,
7112,
6748,
284,
3665,
486,
24173,
341,
310,
11441,
25,
220,
15,
345,
310,
3241,
842,
25,
220,
16,
345,
310,
86991,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_quadratic_mean_of_sinusoidal() {
let data = InfiniteSinusoidal::default(64.0, 16.0, 2.0).take(128).collect::<Vec<f64>>();
assert_almost_eq!((&data).quadratic_mean(), 2.0 / consts::SQRT_2, 1e-15);
} | rust_cleaned_test_functions.jsonl/55251 | {
"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,
11280,
88678,
16933,
3575,
643,
70856,
70816,
368,
341,
286,
1077,
821,
284,
54543,
48268,
355,
70816,
486,
2258,
7,
21,
19,
13,
15,
11,
220,
16,
21,
13,
15,
11,
220,
17,
13,
15,
568,
22769,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mirror_suite() {
enable_logging_for_test(true);
for (test_fn, can_setup) in MIRROR_TEST_FNS.iter() {
launch_mirror_test(*test_fn, *can_setup).unwrap();
}
} | rust_cleaned_test_functions.jsonl/59649 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88593,
57239,
368,
341,
262,
7283,
59982,
5478,
4452,
3715,
317,
262,
369,
320,
1944,
15246,
11,
646,
21363,
8,
304,
386,
87517,
11641,
1400,
2448,
19471,
368,
341,
286,
7050,
88593,
4452,
4071,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_to_public_key_1() {
let secret_key =
hex::decode("1ab1126ff2e37c6e6eddea943ccb3a48f83b380b856424ee552e113595525565")
.unwrap();
let expected = hex::decode(
"28fe26becbdc0384aa67bf734d08ec78ecc2330f0aa02ad9da00f56c37907f78\
2cd080d897822a95a0fb103c54f06e9bf445f82f10fe37efce69ecb59514abc8\
237faeb0351a693a45d5d54aa9759f52a71d76edae2132616d6085a9b2228bf9\
0f46bd1ef47552c3089604c65a3e7154e3976410be01149b60d5a41a6053e6c2",
)
.unwrap();
let mut curve = Bn256 {};
let public_key = curve.derive_public_key(&secret_key).unwrap();
let g2 = G2::from_compressed(&public_key).unwrap();
let expected_g2 = PublicKey::from_uncompressed(&expected).unwrap();
let uncompressed_slice = expected_g2.to_uncompressed().unwrap();
assert_eq!(uncompressed_slice, expected);
assert_eq!(g2, expected_g2.0);
} | rust_cleaned_test_functions.jsonl/65089 | {
"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,
2346,
27074,
3097,
62,
16,
368,
341,
286,
1077,
6234,
3097,
4035,
310,
12371,
486,
18196,
445,
16,
370,
16,
16,
17,
21,
542,
17,
68,
18,
22,
66,
21,
68,
21,
291,
55088,
24,
19,
18,
81317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_receipt_from_txhash() {
let tx_hash = "0xb540248a9cca048c5861dec953d7a776bc1944319b9bd27a462469c8a437f4ff";
let endpoint = "https://mainnet.infura.io/v3/9c7178cede9f4a8a84a151d058bd609c";
let res = get_receipt_from_tx_hash(endpoint, tx_hash);
println!("{:?}", res);
let mut stream = RlpStream::new();
res.unwrap().rlp_append(&mut stream);
println!("{:?}", hex::encode(stream.out()));
} | rust_cleaned_test_functions.jsonl/76363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
77974,
5673,
17805,
8296,
368,
341,
262,
1077,
9854,
8950,
284,
330,
15,
7929,
20,
19,
15,
17,
19,
23,
64,
24,
24441,
15,
19,
23,
66,
20,
23,
21,
16,
8169,
24,
20,
18,
67,
22,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_commit_credits() {
let pubkey0 = Pubkey::new_rand();
let pubkey1 = Pubkey::new_rand();
let pubkey2 = Pubkey::new_rand();
let account0 = Account::new(1, 0, &Pubkey::default());
let account1 = Account::new(2, 0, &Pubkey::default());
let accounts = Accounts::new(None);
accounts.store_slow(0, &pubkey0, &account0);
accounts.store_slow(0, &pubkey1, &account1);
{
let mut credit_only_account_locks = accounts.credit_only_account_locks.write().unwrap();
let credit_only_account_locks = credit_only_account_locks.as_mut().unwrap();
credit_only_account_locks.insert(
pubkey0,
CreditOnlyLock {
credits: AtomicU64::new(0),
lock_count: Mutex::new(1),
},
);
credit_only_account_locks.insert(
pubkey1,
CreditOnlyLock {
credits: AtomicU64::new(5),
lock_count: Mutex::new(1),
},
);
credit_only_account_locks.insert(
pubkey2,
CreditOnlyLock {
credits: AtomicU64::new(10),
lock_count: Mutex::new(1),
},
);
}
let ancestors = vec![(0, 0)].into_iter().collect();
accounts.commit_credits_unsafe(&ancestors, 0);
// No change when CreditOnlyLock credits are 0
assert_eq!(
accounts.load_slow(&ancestors, &pubkey0).unwrap().0.lamports,
1
);
// New balance should equal previous balance plus CreditOnlyLock credits
assert_eq!(
accounts.load_slow(&ancestors, &pubkey1).unwrap().0.lamports,
7
);
// New account should be created
assert_eq!(
accounts.load_slow(&ancestors, &pubkey2).unwrap().0.lamports,
10
);
// Account locks should be cleared
assert_eq!(
accounts
.credit_only_account_locks
.read()
.unwrap()
.as_ref()
.unwrap()
.len(),
0
);
} | rust_cleaned_test_functions.jsonl/104355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
666,
29502,
368,
341,
286,
1077,
95116,
15,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
95116,
16,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
95116,
17,
284,
22611,
792,
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_calculate_weight() {
let locktower = Locktower::new(EpochStakes::new_for_tests(2), 0, 0.67);
let stakes = vec![(
0,
StakeLockout {
stake: 1,
lockout: 8,
},
)]
.into_iter()
.collect();
assert_eq!(locktower.calculate_weight(&stakes), 8u128);
} | rust_cleaned_test_functions.jsonl/25558 | {
"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,
24005,
11207,
15876,
368,
341,
286,
1077,
5296,
77578,
284,
15701,
77578,
486,
931,
10722,
79,
4953,
623,
2050,
486,
931,
5478,
32509,
7,
17,
701,
220,
15,
11,
220,
15,
13,
21,
22,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_valid_page_ranges() {
let test_file_path = "test_num_page.log";
let mut scenario = new_ucmd!();
scenario
.args(&["--pages=20:5", test_file_path])
.fails()
.stderr_is("pr: invalid --pages argument '20:5'")
.stdout_is("");
new_ucmd!()
.args(&["--pages=1:5", test_file_path])
.succeeds();
new_ucmd!().args(&["--pages=1", test_file_path]).succeeds();
new_ucmd!()
.args(&["--pages=-1:5", test_file_path])
.fails()
.stderr_is("pr: invalid --pages argument '-1:5'")
.stdout_is("");
new_ucmd!()
.args(&["--pages=1:-5", test_file_path])
.fails()
.stderr_is("pr: invalid --pages argument '1:-5'")
.stdout_is("");
new_ucmd!()
.args(&["--pages=5:1", test_file_path])
.fails()
.stderr_is("pr: invalid --pages argument '5:1'")
.stdout_is("");
} | rust_cleaned_test_functions.jsonl/103048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
8337,
6129,
58748,
368,
341,
262,
1077,
1273,
2458,
2638,
284,
330,
1944,
4273,
6129,
1665,
876,
262,
1077,
5206,
15048,
284,
501,
68887,
2277,
0,
543,
262,
15048,
198,
286,
659,
2116,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checked_add() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);
assert!(a.checked_add(&b).unwrap() == c);
assert!(b.checked_add(&a).unwrap() == c);
}
} | rust_cleaned_test_functions.jsonl/90132 | {
"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,
56456,
2891,
368,
341,
286,
369,
42205,
304,
30735,
6410,
3298,
14017,
19471,
368,
341,
310,
1077,
320,
64,
13251,
11,
293,
13251,
11,
272,
13251,
8,
284,
353,
23162,
280,
310,
1077,
264,
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... | 2 |
#[test]
fn test_remove_account_before_initialization() {
let location = TempLocation::new();
request_stream_test(
location.to_persistent_lifetime(),
Arc::new(Inspector::new()),
|proxy, _| {
async move {
assert_eq!(
proxy.remove_account(FORCE_REMOVE_ON).await?,
Err(ApiError::InvalidRequest)
);
Ok(())
}
},
);
} | rust_cleaned_test_functions.jsonl/36824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
13500,
23708,
15809,
2022,
368,
341,
286,
1077,
3728,
284,
19944,
4707,
486,
931,
543,
286,
1681,
12673,
4452,
1006,
310,
3728,
2389,
620,
13931,
98827,
3148,
310,
19689,
486,
931,
7,
46230... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arc_condvar_poison() {
let packet = Packet(Arc::new((Mutex::new(1), Condvar::new())));
let packet2 = Packet(packet.0.clone());
let (tx, rx) = channel();
let _t = thread::spawn(move || -> () {
rx.recv().unwrap();
let &(ref lock, ref cvar) = &*packet2.0;
let _g = lock.lock().unwrap();
cvar.notify_one();
// Parent should fail when it wakes up.
panic!();
});
let &(ref lock, ref cvar) = &*packet.0;
let mut lock = lock.lock().unwrap();
tx.send(()).unwrap();
while *lock == 1 {
match cvar.wait(lock) {
Ok(l) => {
lock = l;
assert_eq!(*lock, 1);
}
Err(..) => break,
}
}
} | rust_cleaned_test_functions.jsonl/8918 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62914,
24433,
947,
61814,
3335,
368,
341,
286,
1077,
10151,
284,
28889,
4346,
1287,
486,
931,
1188,
38099,
486,
931,
7,
16,
701,
44826,
947,
486,
931,
45722,
286,
1077,
10151,
17,
284,
28889,
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... | 4 |
#[test]
fn test_from_json() {
let id = UUID4::random();
let json = format!("\"{}\"", id.to_string());
let deserialized: UUID4 = serde_json::from_str(json.as_str()).expect("should read fine");
assert_eq!(deserialized, id);
} | rust_cleaned_test_functions.jsonl/7587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
9455,
368,
341,
286,
1077,
877,
284,
23698,
19,
486,
11463,
543,
286,
1077,
2951,
284,
3561,
17223,
2105,
6257,
55853,
877,
2389,
3904,
1423,
286,
1077,
939,
67577,
25,
23698,
19,
284,
615... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_wpa_invalid_psk() {
let bss = fake_wpa1_bss_description(b"foo_bss".to_vec());
// PSK too short
let credential = fidl_sme::Credential::Psk(vec![0xAA; 31]);
get_legacy_wpa_association(&fake_device_info(CLIENT_ADDR), &credential, &bss)
.expect_err("expected RSNA failure with invalid PSK");
} | rust_cleaned_test_functions.jsonl/23530 | {
"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,
3062,
1670,
6595,
31433,
620,
4886,
368,
341,
286,
1077,
293,
778,
284,
12418,
1670,
6595,
16,
880,
778,
11448,
1883,
1,
7975,
880,
778,
3263,
983,
13251,
1423,
286,
442,
11405,
42,
2238,
2805,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_key() {
let a = RangeKey::from_start_key(b"".to_vec());
let b = RangeKey::from_start_key(b"".to_vec());
let c = RangeKey::from_end_key(b"a".to_vec());
let d = RangeKey::from_start_key(b"a".to_vec());
let e = RangeKey::from_start_key(b"d".to_vec());
let f = RangeKey::from_end_key(b"f".to_vec());
let g = RangeKey::from_end_key(b"u".to_vec());
let h = RangeKey::from_end_key(b"".to_vec());
assert!(a == b);
assert!(a < c);
assert!(a != h);
assert!(c == d);
assert!(d < e);
assert!(e < f);
assert!(f < g);
assert!(g < h);
assert!(h > g);
} | rust_cleaned_test_functions.jsonl/64324 | {
"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,
9698,
3097,
368,
341,
286,
1077,
264,
284,
16437,
1592,
486,
1499,
4906,
3097,
1883,
69355,
983,
13251,
1423,
286,
1077,
293,
284,
16437,
1592,
486,
1499,
4906,
3097,
1883,
69355,
983,
13251,
1423... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_query_items() {
let querier = new_valid_db("query_items.db");
let items = querier.query_items(Some("apple"), None, None);
assert_eq!(3, items.len());
} | rust_cleaned_test_functions.jsonl/107668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
5738,
12134,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
1631,
12134,
7076,
3071,
286,
1077,
3589,
284,
29134,
1268,
4786,
12134,
65405,
445,
22377,
3975,
2240,
11,
2240,
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 |
#[test]
fn test_request_snapshot_after_propose_merge() {
let mut cluster = new_node_cluster(0, 3);
configure_for_merge(&mut cluster);
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
cluster.run();
let region = pd_client.get_region(b"k1").unwrap();
cluster.must_split(®ion, b"k2");
cluster.must_put(b"k1", b"v1");
cluster.must_put(b"k3", b"v3");
let region = pd_client.get_region(b"k3").unwrap();
let target_region = pd_client.get_region(b"k1").unwrap();
// Make sure peer 1 is the leader.
cluster.must_transfer_leader(region.get_id(), new_peer(1, 1));
cluster.add_send_filter(CloneFilterFactory(DropMessageFilter::new(
MessageType::MsgAppend,
)));
let prepare_merge = new_prepare_merge(target_region);
let mut req = new_admin_request(region.get_id(), region.get_region_epoch(), prepare_merge);
req.mut_header().set_peer(new_peer(1, 1));
cluster
.sim
.rl()
.async_command_on_node(1, req, Callback::None)
.unwrap();
sleep_ms(200);
// Install snapshot filter before requesting snapshot.
let (tx, rx) = mpsc::channel();
let notifier = Mutex::new(Some(tx));
cluster.sim.wl().add_recv_filter(
2,
Box::new(RecvSnapshotFilter {
notifier,
region_id: region.get_id(),
}),
);
cluster.must_request_snapshot(2, region.get_id());
// Leader should reject request snapshot if there is any proposed merge.
rx.recv_timeout(Duration::from_millis(500)).unwrap_err();
} | rust_cleaned_test_functions.jsonl/27255 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 686
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
53265,
19844,
21663,
960,
20888,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
14411,
5478,
20888,
2099,
6984,
10652,
317,
262,
1077,
7744,
8179,
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_parsing_error_in_invalid_included_ranges() {
let mut parser = Parser::new();
// Ranges are not ordered
let error = parser
.set_included_ranges(&[
Range {
start_byte: 23,
end_byte: 29,
start_point: Point::new(0, 23),
end_point: Point::new(0, 29),
},
Range {
start_byte: 0,
end_byte: 5,
start_point: Point::new(0, 0),
end_point: Point::new(0, 5),
},
Range {
start_byte: 50,
end_byte: 60,
start_point: Point::new(0, 50),
end_point: Point::new(0, 60),
},
])
.unwrap_err();
assert_eq!(error, IncludedRangesError(1));
// Range ends before it starts
let error = parser
.set_included_ranges(&[Range {
start_byte: 10,
end_byte: 5,
start_point: Point::new(0, 10),
end_point: Point::new(0, 5),
}])
.unwrap_err();
assert_eq!(error, IncludedRangesError(0));
} | rust_cleaned_test_functions.jsonl/15876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
4096,
1243,
31433,
1243,
10181,
58748,
368,
341,
262,
1077,
5206,
6729,
284,
21102,
486,
931,
1428,
262,
442,
431,
5520,
525,
537,
11457,
198,
262,
1077,
1465,
284,
6729,
198,
286,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_empty_decl() {
use ast::Declaration;
use parser::declaration;
let env = &mut Env::with_core();
assert!(declaration("struct foo { } S;", env).is_err());
let env = &mut Env::with_gnu();
assert_eq!(
declaration("struct foo { } S;", env).unwrap(),
Declaration {
specifiers: vec![StructType {
kind: StructKind::Struct.into(),
identifier: Some(ident("foo")),
declarations: Some(Vec::new()),
}
.into()],
declarators: vec![InitDeclarator {
declarator: Declarator {
kind: ident("S"),
derived: vec![],
extensions: vec![],
}
.into(),
initializer: None,
}
.into()],
}
.into()
);
} | rust_cleaned_test_functions.jsonl/107588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
15124,
35814,
368,
341,
262,
990,
11763,
486,
24489,
280,
262,
990,
6729,
486,
80383,
401,
262,
1077,
6105,
284,
609,
6984,
37039,
486,
4197,
15467,
543,
262,
2060,
10297,
80383,
445,
1235,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_loop_scope() {
do_check(
r"
fn quux() {
loop {
let x = ();
<|>
};
}",
&["x"],
);
} | rust_cleaned_test_functions.jsonl/12174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17198,
23199,
368,
341,
286,
653,
7200,
1006,
310,
435,
698,
310,
5168,
922,
2200,
368,
341,
394,
6337,
341,
503,
1077,
856,
284,
9563,
503,
82639,
397,
394,
2605,
310,
335,
756,
310,
609,
118... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_v32_1() {
let mut data : &[u8] = &[1, 2];
assert_eq!(Ok(0x01), data.read_v32());
assert_eq!(Ok(0x02), data.read_v32());
assert_eq!(Err(Error::Short), data.read_v32());
assert_eq!(0, data.len());
} | rust_cleaned_test_functions.jsonl/72920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2273,
18,
17,
62,
16,
368,
341,
286,
1077,
5206,
821,
549,
44590,
84,
23,
60,
284,
44590,
16,
11,
220,
17,
935,
286,
2060,
10714,
10297,
11578,
7,
15,
87,
15,
16,
701,
821,
4125,
227... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq() {
let mut a: SmallVec<[u32; 2]> = SmallVec::new();
let mut b: SmallVec<[u32; 2]> = SmallVec::new();
let mut c: SmallVec<[u32; 2]> = SmallVec::new();
a.push(1);
a.push(2);
b.push(1);
b.push(2);
c.push(3);
c.push(4);
assert!(a == b);
assert!(a != c);
} | rust_cleaned_test_functions.jsonl/88156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
368,
341,
286,
1077,
5206,
264,
25,
14994,
10050,
66746,
84,
18,
17,
26,
220,
17,
25669,
284,
14994,
10050,
486,
931,
543,
286,
1077,
5206,
293,
25,
14994,
10050,
66746,
84,
18,
17,
26,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long_input() {
#[cfg(not(windows))]
const TIMES: usize = 14000;
// On Windows the command line is limited to 8191 bytes.
// try something long.
#[cfg(windows)]
const TIMES: usize = 500;
let arg = "abcdef".repeat(TIMES) + "\n";
let expected_out = arg.repeat(30);
run(&[&arg[..arg.len() - 1]], expected_out.as_bytes());
} | rust_cleaned_test_functions.jsonl/88241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
5898,
368,
341,
262,
11506,
14072,
24772,
3622,
1491,
22297,
262,
733,
86930,
25,
22301,
284,
220,
16,
19,
15,
15,
15,
280,
262,
442,
1913,
5515,
279,
3210,
1555,
374,
7199,
311,
220,
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_extract_gdb_version() {
macro_rules! test { ($($expectation:tt: $input:tt,)*) => {{$(
assert_eq!(extract_gdb_version($input), Some($expectation));
)*}}}
test! {
7000001: "GNU gdb (GDB) CentOS (7.0.1-45.el5.centos)",
7002000: "GNU gdb (GDB) Red Hat Enterprise Linux (7.2-90.el6)",
7004000: "GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04",
7004001: "GNU gdb (GDB) 7.4.1-debian",
7006001: "GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7",
7007001: "GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1",
7007001: "GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1",
7007001: "GNU gdb (GDB) Fedora 7.7.1-21.fc20",
7008000: "GNU gdb (GDB; openSUSE 13.2) 7.8",
7009001: "GNU gdb (GDB) Fedora 7.9.1-20.fc22",
7010001: "GNU gdb (GDB) Fedora 7.10.1-31.fc23",
7011000: "GNU gdb (Ubuntu 7.11-0ubuntu1) 7.11",
7011001: "GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1",
7011001: "GNU gdb (Debian 7.11.1-2) 7.11.1",
7011001: "GNU gdb (GDB) Fedora 7.11.1-86.fc24",
7011001: "GNU gdb (GDB; openSUSE Leap 42.1) 7.11.1",
7011001: "GNU gdb (GDB; openSUSE Tumbleweed) 7.11.1",
7011090: "7.11.90",
7011090: "GNU gdb (Ubuntu 7.11.90.20161005-0ubuntu1) 7.11.90.20161005-git",
7012000: "7.12",
7012000: "GNU gdb (GDB) 7.12",
7012000: "GNU gdb (GDB) 7.12.20161027-git",
7012050: "GNU gdb (GDB) 7.12.50.20161027-git",
}
} | rust_cleaned_test_functions.jsonl/41387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 858
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
1889,
1999,
9438,
368,
341,
262,
18072,
21407,
0,
1273,
314,
1711,
699,
17119,
367,
25,
5566,
25,
400,
1355,
25,
5566,
46021,
3764,
589,
30108,
1006,
286,
2060,
10714,
10297,
23493,
1889,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_der_int() {
let empty = &b""[..];
let bytes = hex!("02 03 01 00 01");
let expected = DerObject::from_obj(BerObjectContent::Integer(b"\x01\x00\x01"));
assert_eq!(parse_der_integer(&bytes), Ok((empty, expected)));
let res = parse_der_u64(&bytes);
assert_eq!(res.expect("integer").1, 0x10001);
// wrong tag
let bytes = hex!("04 03 41 41 41");
let res = parse_der_integer(&bytes);
assert!(res.is_err());
let res = parse_der_u64(&bytes);
assert!(res.is_err());
// very long integer
let bytes = hex!("02 0b 40 41 02 03 04 05 06 07 08 09 0a");
let res = parse_der_integer(&bytes);
assert!(res.is_ok());
let res = parse_der_u64(&bytes);
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/45860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
4042,
368,
341,
262,
1077,
4287,
284,
609,
65,
3014,
95874,
935,
262,
1077,
5820,
284,
12371,
17223,
15,
17,
220,
15,
18,
220,
15,
16,
220,
15,
15,
220,
15,
16,
797,
262,
1077,
3601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_i32() {
let data: &[u8] = &[0x12, 0x34, 0x56, 0x78];
let result: i32 = from_bytes(data, PodType::TVM).unwrap();
dbg!(result);
assert_eq!(result, 0x78563412);
} | rust_cleaned_test_functions.jsonl/57362 | {
"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,
5318,
18,
17,
368,
341,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
44590,
15,
87,
16,
17,
11,
220,
15,
87,
18,
19,
11,
220,
15,
87,
20,
21,
11,
220,
15,
87,
22,
23,
935,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_comparisons() {
let zero = bf16::from_f64(0.0);
let one = bf16::from_f64(1.0);
let neg_zero = bf16::from_f64(-0.0);
let neg_one = bf16::from_f64(-1.0);
assert_eq!(zero.partial_cmp(&neg_zero), Some(Ordering::Equal));
assert_eq!(neg_zero.partial_cmp(&zero), Some(Ordering::Equal));
assert!(zero == neg_zero);
assert!(neg_zero == zero);
assert!(!(zero != neg_zero));
assert!(!(neg_zero != zero));
assert!(!(zero < neg_zero));
assert!(!(neg_zero < zero));
assert!(zero <= neg_zero);
assert!(neg_zero <= zero);
assert!(!(zero > neg_zero));
assert!(!(neg_zero > zero));
assert!(zero >= neg_zero);
assert!(neg_zero >= zero);
assert_eq!(one.partial_cmp(&neg_zero), Some(Ordering::Greater));
assert_eq!(neg_zero.partial_cmp(&one), Some(Ordering::Less));
assert!(!(one == neg_zero));
assert!(!(neg_zero == one));
assert!(one != neg_zero);
assert!(neg_zero != one);
assert!(!(one < neg_zero));
assert!(neg_zero < one);
assert!(!(one <= neg_zero));
assert!(neg_zero <= one);
assert!(one > neg_zero);
assert!(!(neg_zero > one));
assert!(one >= neg_zero);
assert!(!(neg_zero >= one));
assert_eq!(one.partial_cmp(&neg_one), Some(Ordering::Greater));
assert_eq!(neg_one.partial_cmp(&one), Some(Ordering::Less));
assert!(!(one == neg_one));
assert!(!(neg_one == one));
assert!(one != neg_one);
assert!(neg_one != one);
assert!(!(one < neg_one));
assert!(neg_one < one);
assert!(!(one <= neg_one));
assert!(neg_one <= one);
assert!(one > neg_one);
assert!(!(neg_one > one));
assert!(one >= neg_one);
assert!(!(neg_one >= one));
} | rust_cleaned_test_functions.jsonl/4213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 956
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
1732,
19379,
368,
341,
286,
1077,
7168,
284,
39093,
16,
21,
486,
1499,
761,
21,
19,
7,
15,
13,
15,
317,
286,
1077,
825,
284,
39093,
16,
21,
486,
1499,
761,
21,
19,
7,
16,
13,
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... | 1 |
#[test]
fn test_as_bytes() {
assert_eq!(false.as_bytes(), &[0]);
assert_eq!(true.as_bytes(), &[1]);
assert_eq!(7_i32.as_bytes(), &[7, 0, 0, 0]);
assert_eq!(555_i32.as_bytes(), &[43, 2, 0, 0]);
assert_eq!(555_u32.as_bytes(), &[43, 2, 0, 0]);
assert_eq!(i32::max_value().as_bytes(), &[255, 255, 255, 127]);
assert_eq!(i32::min_value().as_bytes(), &[0, 0, 0, 128]);
assert_eq!(7_i64.as_bytes(), &[7, 0, 0, 0, 0, 0, 0, 0]);
assert_eq!(555_i64.as_bytes(), &[43, 2, 0, 0, 0, 0, 0, 0]);
assert_eq!(
(i64::max_value()).as_bytes(),
&[255, 255, 255, 255, 255, 255, 255, 127]
);
assert_eq!((i64::min_value()).as_bytes(), &[0, 0, 0, 0, 0, 0, 0, 128]);
assert_eq!(3.14_f32.as_bytes(), &[195, 245, 72, 64]);
assert_eq!(3.14_f64.as_bytes(), &[31, 133, 235, 81, 184, 30, 9, 64]);
assert_eq!("hello".as_bytes(), &[b'h', b'e', b'l', b'l', b'o']);
assert_eq!(
Vec::from("hello".as_bytes()).as_bytes(),
&[b'h', b'e', b'l', b'l', b'o']
);
// Test Int96
let i96 = Int96::from(vec![1, 2, 3]);
assert_eq!(i96.as_bytes(), &[1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0]);
// Test ByteArray
let ba = ByteArray::from(vec![1, 2, 3]);
assert_eq!(ba.as_bytes(), &[1, 2, 3]);
// Test Decimal
let decimal = Decimal::from_i32(123, 5, 2);
assert_eq!(decimal.as_bytes(), &[0, 0, 0, 123]);
let decimal = Decimal::from_i64(123, 5, 2);
assert_eq!(decimal.as_bytes(), &[0, 0, 0, 0, 0, 0, 0, 123]);
let decimal = Decimal::from_bytes(ByteArray::from(vec![1, 2, 3]), 5, 2);
assert_eq!(decimal.as_bytes(), &[1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/8691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 977
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
12524,
368,
341,
286,
2060,
10714,
10297,
3849,
5357,
12524,
1507,
44590,
15,
2558,
286,
2060,
10714,
10297,
1866,
5357,
12524,
1507,
44590,
16,
2558,
286,
2060,
10714,
10297,
22,
5318,
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_regex_search_with_region_tree() {
let mut region = Region::new();
let mut syntax = Syntax::ruby().clone();
syntax.enable_operators(SyntaxOperator::SYNTAX_OPERATOR_ATMARK_CAPTURE_HISTORY);
let regex = Regex::with_options(
"(?@a+(?@b+))|(?@c+(?@d+))",
RegexOptions::REGEX_OPTION_NONE,
&syntax,
)
.unwrap();
let r = regex.search_with_options(
"- cd aaabbb -",
0,
13,
SearchOptions::SEARCH_OPTION_NONE,
Some(&mut region),
);
assert_eq!(r, Some(2));
assert_eq!(region.len(), 5);
let tree = region.tree().unwrap();
assert_eq!(tree.len(), 1);
assert_eq!(tree.group(), 0);
assert_eq!(tree.pos(), (2, 4));
assert_eq!(tree[0].len(), 1);
assert_eq!(tree[0].group(), 3);
assert_eq!(tree[0].pos(), (2, 4));
assert_eq!(tree[0][0].len(), 0);
assert_eq!(tree[0][0].group(), 4);
assert_eq!(tree[0][0].pos(), (3, 4));
} | rust_cleaned_test_functions.jsonl/74700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 590
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
10716,
6615,
20627,
11663,
368,
341,
286,
1077,
5206,
5537,
284,
17152,
486,
931,
543,
286,
1077,
5206,
19482,
284,
32117,
486,
46275,
1005,
19982,
543,
286,
19482,
28697,
25634,
2973,
93549,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser() {
let circ = Circuit::parse("circuits/AES-non-expanded.txt").unwrap();
let key = vec![0u16; 128];
let pt = vec![0u16; 128];
let output = circ.eval_plain(&pt, &key).unwrap();
assert_eq!(output.iter().map(|i| i.to_string()).collect::<String>(),
"01100110111010010100101111010100111011111000101000101100001110111000100001001100111110100101100111001010001101000010101100101110");
let key = vec![1u16; 128];
let pt = vec![0u16; 128];
let output = circ.eval_plain(&pt, &key).unwrap();
assert_eq!(output.iter().map(|i| i.to_string()).collect::<String>(),
"10100001111101100010010110001100100001110111110101011111110011011000100101100100010010000100010100111000101111111100100100101100");
let mut key = vec![0u16; 128];
for i in 0..8 {
key[i] = 1;
}
let pt = vec![0u16; 128];
let output = circ.eval_plain(&pt, &key).unwrap();
assert_eq!(output.iter().map(|i| i.to_string()).collect::<String>(),
"10110001110101110101100000100101011010110010100011111101100001010000101011010100100101000100001000001000110011110001000101010101");
let mut key = vec![0u16; 128];
key[7] = 1;
let pt = vec![0u16; 128];
let output = circ.eval_plain(&pt, &key).unwrap();
assert_eq!(output.iter().map(|i| i.to_string()).collect::<String>(),
"11011100000011101101100001011101111110010110000100011010101110110111001001001001110011011101000101101000110001010100011001111110");
} | rust_cleaned_test_functions.jsonl/101184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 774
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
368,
341,
286,
1077,
4225,
284,
27218,
486,
6400,
445,
43298,
11797,
10360,
1570,
98700,
30036,
3909,
1827,
15454,
543,
286,
1077,
1376,
284,
7486,
20703,
15,
84,
16,
21,
26,
220,
16,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_insert_with_lock_no_ancestors() {
let key = Keypair::new();
let index = AccountsIndex::<bool>::default_for_tests();
let slot = 0;
let account_info = true;
let new_entry = WriteAccountMapEntry::new_entry_after_update(slot, account_info);
assert_eq!(0, account_maps_len_expensive(&index));
// will fail because key doesn't exist
let r_account_maps = index.get_account_maps_read_lock(&key.pubkey());
assert!(!WriteAccountMapEntry::update_key_if_exists(
r_account_maps,
&key.pubkey(),
&new_entry,
&mut SlotList::default(),
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
));
assert_eq!(
(slot, account_info),
new_entry.slot_list.read().as_ref().unwrap()[0]
);
assert_eq!(0, account_maps_len_expensive(&index));
let w_account_maps = index.get_account_maps_write_lock(&key.pubkey());
WriteAccountMapEntry::upsert(
w_account_maps,
&key.pubkey(),
new_entry,
&mut SlotList::default(),
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
);
assert_eq!(1, account_maps_len_expensive(&index));
let mut ancestors = Ancestors::default();
assert!(index.get(&key.pubkey(), Some(&ancestors), None).is_none());
assert!(index.get(&key.pubkey(), None, None).is_none());
let mut num = 0;
index.unchecked_scan_accounts(
"",
&ancestors,
|_pubkey, _index| num += 1,
COLLECT_ALL_UNSORTED_FALSE,
);
assert_eq!(num, 0);
ancestors.insert(slot, 0);
assert!(index.get(&key.pubkey(), Some(&ancestors), None).is_some());
index.unchecked_scan_accounts(
"",
&ancestors,
|_pubkey, _index| num += 1,
COLLECT_ALL_UNSORTED_FALSE,
);
assert_eq!(num, 1);
} | rust_cleaned_test_functions.jsonl/132254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1020
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
6615,
9818,
6536,
62,
681,
267,
1087,
368,
341,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
1922,
284,
40655,
1552,
27638,
2641,
6831,
2258,
5478,
32509,
543,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_virtio_blk() {
let mut focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest = Guest::new(&mut focal);
let mut workload_path = dirs::home_dir().unwrap();
workload_path.push("workloads");
let mut blk_file_path = workload_path;
blk_file_path.push("blk.img");
let kernel_path = direct_kernel_boot_path().unwrap();
let mut cloud_child = GuestCommand::new(&guest)
.args(&["--cpus", "boot=4"])
.args(&["--memory", "size=512M,shared=on"])
.args(&["--kernel", kernel_path.to_str().unwrap()])
.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE])
.args(&[
"--disk",
format!(
"path={}",
guest.disk_config.disk(DiskType::OperatingSystem).unwrap()
)
.as_str(),
format!(
"path={}",
guest.disk_config.disk(DiskType::CloudInit).unwrap()
)
.as_str(),
format!(
"path={},readonly=on,direct=on,num_queues=4",
blk_file_path.to_str().unwrap()
)
.as_str(),
])
.default_net()
.capture_output()
.spawn()
.unwrap();
thread::sleep(std::time::Duration::new(20, 0));
let r = std::panic::catch_unwind(|| {
// Check both if /dev/vdc exists and if the block size is 16M.
assert_eq!(
guest
.ssh_command("lsblk | grep vdc | grep -c 16M")
.unwrap_or_default()
.trim()
.parse::<u32>()
.unwrap_or_default(),
1
);
// Check both if /dev/vdc exists and if this block is RO.
assert_eq!(
guest
.ssh_command("lsblk | grep vdc | awk '{print $5}'")
.unwrap_or_default()
.trim()
.parse::<u32>()
.unwrap_or_default(),
1
);
// Check if the number of queues is 4.
assert_eq!(
guest
.ssh_command("ls -ll /sys/block/vdc/mq | grep ^d | wc -l")
.unwrap_or_default()
.trim()
.parse::<u32>()
.unwrap_or_default(),
4
);
});
let _ = cloud_child.kill();
let output = cloud_child.wait_with_output().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/23967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1937
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
51969,
368,
341,
310,
1077,
5206,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
310,
1077,
8640,
284,
26215,
486,
931,
2099,
6984,
41099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_shared_buffer_2_errors_after_read() {
paychains_logger::setup();
let (sender, receiver) = unbounded();
let file = SimpleReader::new(receiver);
let shared_buffer = SharedBuffer::new(file);
let mut reader = SharedBufferReader::new(&shared_buffer);
let mut reader2 = SharedBufferReader::new(&shared_buffer);
let mut data = Vec::new();
let done_signal = vec![];
// send some data
let sent = vec![1, 2, 3];
let _ = sender.send((sent.clone(), None));
// send an error
let _ = sender.send((done_signal, Some(get_error())));
assert_eq!(
reader.read_to_end(&mut data).unwrap_err().kind(),
get_error().kind()
);
let mut data = vec![0; sent.len()];
// this read should succeed because it was prior to error being received by bg reader
assert_eq!(reader2.read(&mut data[..]).unwrap(), sent.len(),);
assert_eq!(sent, data);
assert_eq!(
reader2.read_to_end(&mut data).unwrap_err().kind(),
SharedBufferReader::default_error().kind()
);
} | rust_cleaned_test_functions.jsonl/84070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 527
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20405,
7776,
62,
17,
20196,
19844,
6443,
368,
341,
286,
2291,
58358,
27413,
486,
15188,
543,
286,
1077,
320,
11644,
11,
13964,
8,
284,
650,
65686,
543,
286,
1077,
1034,
284,
8993,
5062,
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_proof_path_storage_key_leaf() {
let key = ProofPath::new(&[250; 32]);
let mut buf = vec![0; PROOF_PATH_SIZE];
key.write(&mut buf);
let key2 = ProofPath::read(&buf);
assert_eq!(buf[0], LEAF_KEY_PREFIX);
assert_eq!(buf[33], 0);
assert_eq!(&buf[1..33], &[250; 32]);
assert_eq!(key2, key);
} | rust_cleaned_test_functions.jsonl/25534 | {
"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,
86757,
2638,
23310,
3097,
38909,
368,
341,
262,
1077,
1376,
284,
36991,
1820,
486,
931,
2099,
58,
17,
20,
15,
26,
220,
18,
17,
2558,
262,
1077,
5206,
6607,
284,
7486,
20703,
15,
26,
5308,
1248... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
use crate::wire::testdata::icmp_redirect::IP_PACKET_BYTES;
let (body, src_ip, dst_ip, proto) = parse_ip_packet::<Ipv4>(IP_PACKET_BYTES).unwrap();
assert_eq!(body, &IP_PACKET_BYTES[20..]);
assert_eq!(src_ip, Ipv4Addr::new([10, 123, 0, 2]));
assert_eq!(dst_ip, Ipv4Addr::new([10, 123, 0, 1]));
assert_eq!(proto, IpProto::Icmp);
use crate::wire::testdata::icmp_echo_v6::REQUEST_IP_PACKET_BYTES;
let (body, src_ip, dst_ip, proto) =
parse_ip_packet::<Ipv6>(REQUEST_IP_PACKET_BYTES).unwrap();
assert_eq!(body, &REQUEST_IP_PACKET_BYTES[40..]);
assert_eq!(src_ip, Ipv6Addr::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]));
assert_eq!(dst_ip, Ipv6Addr::new([0xFE, 0xC0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
assert_eq!(proto, IpProto::Icmpv6);
} | rust_cleaned_test_functions.jsonl/29510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10385,
21078,
368,
341,
286,
990,
17717,
486,
35531,
486,
92425,
486,
50774,
30043,
486,
3298,
40328,
40705,
280,
286,
1077,
320,
2599,
11,
2286,
10385,
11,
10648,
10385,
11,
18433,
8,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_round_frac() {
let int_cases = vec![
(Some(23), Some(2), Some(23)),
(Some(23), Some(-1), Some(20)),
(Some(-27), Some(-1), Some(-30)),
(Some(-27), Some(-2), Some(0)),
(Some(-27), Some(-2), Some(0)),
(None, Some(-27), None),
(Some(-27), None, None),
(None, None, None),
];
for (arg0, arg1, exp) in int_cases {
let got = RpnFnScalarEvaluator::new()
.push_param(arg0)
.push_param(arg1)
.evaluate(ScalarFuncSig::RoundWithFracInt)
.unwrap();
assert_eq!(got, exp);
}
let dec_cases = vec![
(
Some(Decimal::from_str("150.000").unwrap()),
Some(2),
Some(Decimal::from_str("150.000").unwrap()),
),
(
Some(Decimal::from_str("150.257").unwrap()),
Some(1),
Some(Decimal::from_str("150.3").unwrap()),
),
(
Some(Decimal::from_str("153.257").unwrap()),
Some(-1),
Some(Decimal::from_str("150").unwrap()),
),
(Some(Decimal::from_str("153.257").unwrap()), None, None),
(None, Some(-27), None),
(None, None, None),
];
for (arg0, arg1, exp) in dec_cases {
let got = RpnFnScalarEvaluator::new()
.push_param(arg0)
.push_param(arg1)
.evaluate(ScalarFuncSig::RoundWithFracDec)
.unwrap();
assert_eq!(got, exp);
}
let real_cases = vec![
(
Some(Real::new(-1.298_f64).unwrap()),
Some(1),
Some(Real::new(-1.3_f64).unwrap()),
),
(
Some(Real::new(-1.298_f64).unwrap()),
Some(0),
Some(Real::new(-1.0_f64).unwrap()),
),
(
Some(Real::new(23.298_f64).unwrap()),
Some(2),
Some(Real::new(23.30_f64).unwrap()),
),
(
Some(Real::new(23.298_f64).unwrap()),
Some(-1),
Some(Real::new(20.0_f64).unwrap()),
),
(Some(Real::new(23.298_f64).unwrap()), None, None),
(None, Some(2), None),
(None, None, None),
];
for (arg0, arg1, exp) in real_cases {
let got = RpnFnScalarEvaluator::new()
.push_param(arg0)
.push_param(arg1)
.evaluate(ScalarFuncSig::RoundWithFracReal)
.unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/9509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1764
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
70358,
368,
341,
286,
1077,
526,
41427,
284,
7486,
90515,
310,
320,
8373,
7,
17,
18,
701,
4329,
7,
17,
701,
4329,
7,
17,
18,
6965,
310,
320,
8373,
7,
17,
18,
701,
4329,
4080,
16,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_changepeer_v2_to_confchange() {
let mut req = ChangePeerV2Request::default();
// Zore change for leave joint
assert_eq!(
(&req).to_confchange(vec![]).get_transition(),
eraftpb::ConfChangeTransition::Auto
);
// One change for simple confchange
req.mut_changes().push(ChangePeerRequest::default());
assert_eq!(
(&req).to_confchange(vec![]).get_transition(),
eraftpb::ConfChangeTransition::Auto
);
// More than one change for enter joint
req.mut_changes().push(ChangePeerRequest::default());
assert_eq!(
(&req).to_confchange(vec![]).get_transition(),
eraftpb::ConfChangeTransition::Explicit
);
req.mut_changes().push(ChangePeerRequest::default());
assert_eq!(
(&req).to_confchange(vec![]).get_transition(),
eraftpb::ConfChangeTransition::Explicit
);
} | rust_cleaned_test_functions.jsonl/14628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15947,
16537,
2273,
17,
2346,
16059,
3373,
368,
341,
286,
1077,
5206,
4232,
284,
10388,
30888,
53,
17,
1900,
486,
2258,
1428,
286,
442,
1863,
460,
2297,
369,
5274,
10284,
198,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normalized_lower_lay_string() {
let s = "Comunicações"; // assert_eq!(s.chars().count(), 14);
let s = normalized_lower_lay_string(s);
assert_eq!(s.chars().count(), 12);
assert_eq!(s, "comunicacoes");
} | rust_cleaned_test_functions.jsonl/34886 | {
"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,
80006,
30425,
907,
352,
3904,
368,
341,
286,
1077,
274,
284,
330,
1092,
359,
3001,
15249,
5123,
442,
981,
2060,
10714,
10297,
82,
85062,
1005,
1830,
1507,
220,
16,
19,
317,
286,
1077,
274,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_str() {
let owned: Option<::std::string::String> = from_str("string");
assert_eq!(owned.as_ref().map(|s| s.as_slice()), Some("string"));
} | rust_cleaned_test_functions.jsonl/42 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
368,
341,
414,
1077,
12938,
25,
6959,
87398,
1834,
486,
917,
486,
703,
29,
284,
504,
2895,
445,
917,
797,
414,
2060,
10714,
10297,
18332,
5357,
7793,
1005,
2186,
22428,
82,
91,
274,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_txn_heart_beat() {
let (_cluster, client, ctx) = must_new_cluster_and_kv_client();
let mut req = TxnHeartBeatRequest::default();
let k = b"k".to_vec();
let start_ts = 10;
req.set_context(ctx);
req.set_primary_lock(k.clone());
req.set_start_version(start_ts);
req.set_advise_lock_ttl(1000);
let resp = client.kv_txn_heart_beat(&req).unwrap();
assert!(!resp.has_region_error());
assert_eq!(
resp.get_error().get_txn_not_found(),
&TxnNotFound {
start_ts,
primary_key: k,
..Default::default()
}
);
} | rust_cleaned_test_functions.jsonl/61704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
62,
17735,
21263,
266,
368,
341,
262,
1077,
5453,
18855,
11,
2943,
11,
5635,
8,
284,
1969,
5921,
28441,
8378,
97066,
8179,
543,
262,
1077,
5206,
4232,
284,
39850,
77,
45384,
43658,
1900,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eth_transfer_success() {
// set up Aurora runner and accounts
let (mut runner, mut source_account, dest_address) = initialize_transfer();
let source_address = test_utils::address_from_secret_key(&source_account.secret_key);
// validate pre-state
test_utils::validate_address_balance_and_nonce(
&runner,
source_address,
INITIAL_BALANCE,
INITIAL_NONCE.into(),
);
test_utils::validate_address_balance_and_nonce(&runner, dest_address, Wei::zero(), 0.into());
// perform transfer
runner
.submit_with_signer(&mut source_account, |nonce| {
test_utils::transfer(dest_address, TRANSFER_AMOUNT, nonce)
})
.unwrap();
// validate post-state
test_utils::validate_address_balance_and_nonce(
&runner,
source_address,
INITIAL_BALANCE - TRANSFER_AMOUNT,
(INITIAL_NONCE + 1).into(),
);
test_utils::validate_address_balance_and_nonce(
&runner,
dest_address,
TRANSFER_AMOUNT,
0.into(),
);
} | rust_cleaned_test_functions.jsonl/131044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57757,
35403,
18632,
368,
341,
262,
442,
738,
705,
46792,
22259,
323,
9618,
198,
262,
1077,
320,
6984,
22259,
11,
5206,
2530,
13500,
11,
3201,
6744,
8,
284,
9468,
35403,
543,
262,
1077,
2530,
67... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_conflict() {
let l = default_logger();
let previous_ents = vec![new_entry(1, 1), new_entry(2, 2), new_entry(3, 3)];
let tests = vec![
(vec![], 0),
(vec![], 0),
// no conflict
(vec![new_entry(1, 1), new_entry(2, 2), new_entry(3, 3)], 0),
(vec![new_entry(2, 2), new_entry(3, 3)], 0),
(vec![new_entry(3, 3)], 0),
(
vec![
new_entry(1, 1),
new_entry(2, 2),
new_entry(3, 3),
new_entry(4, 4),
new_entry(5, 4),
],
4,
),
(
vec![
new_entry(2, 2),
new_entry(3, 3),
new_entry(4, 4),
new_entry(5, 4),
],
4,
),
(vec![new_entry(3, 3), new_entry(4, 4), new_entry(5, 4)], 4),
(vec![new_entry(4, 4), new_entry(5, 4)], 4),
// conflicts with existing entries
(vec![new_entry(1, 4), new_entry(2, 4)], 1),
(vec![new_entry(2, 1), new_entry(3, 4), new_entry(4, 4)], 2),
(
vec![
new_entry(3, 1),
new_entry(4, 2),
new_entry(5, 4),
new_entry(6, 4),
],
3,
),
];
for (i, &(ref ents, wconflict)) in tests.iter().enumerate() {
let store = MemStorage::new();
let mut raft_log = RaftLog::new(store, l.clone());
raft_log.append(&previous_ents);
let gconflict = raft_log.find_conflict(ents);
if gconflict != wconflict {
panic!("#{}: conflict = {}, want {}", i, gconflict, wconflict)
}
}
} | rust_cleaned_test_functions.jsonl/48405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
16059,
21242,
368,
341,
286,
1077,
326,
284,
1638,
27413,
543,
286,
1077,
3681,
62,
805,
284,
7486,
20703,
931,
9078,
7,
16,
11,
220,
16,
701,
501,
9078,
7,
17,
11,
220,
17,
701,
501,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vote_rountrip_with_sig() {
let dt = "2017-12-25T03:00:01.234Z".parse::<DateTime<Utc>>().unwrap();
let vote = Vote {
validator_address: AccountId::try_from(vec![
0xa3, 0xb2, 0xcc, 0xdd, 0x71, 0x86, 0xf1, 0x68, 0x5f, 0x21, 0xf2, 0x48, 0x2a, 0xf4,
0xfb, 0x34, 0x46, 0xa8, 0x4b, 0x35,
])
.unwrap(),
validator_index: ValidatorIndex::try_from(56789).unwrap(),
height: Height::from(12345_u32),
round: Round::from(2_u16),
timestamp: Some(dt.into()),
vote_type: Type::Prevote,
block_id: Some(BlockId {
hash: Hash::from_hex_upper(Algorithm::Sha256, "DEADBEEFDEADBEEFBAFBAFBAFBAFBAFA")
.unwrap(),
part_set_header: Header::new(
1_000_000,
Hash::from_hex_upper(Algorithm::Sha256, "DEADBEEFDEADBEEFBAFBAFBAFBAFBAFA")
.unwrap(),
)
.unwrap(),
}),
signature: Signature::new(vec![
130u8, 246, 183, 50, 153, 248, 28, 57, 51, 142, 55, 217, 194, 24, 134, 212, 233,
100, 211, 10, 24, 174, 179, 117, 41, 65, 141, 134, 149, 239, 65, 174, 217, 42, 6,
184, 112, 17, 7, 97, 255, 221, 252, 16, 60, 144, 30, 212, 167, 39, 67, 35, 118,
192, 133, 130, 193, 115, 32, 206, 152, 91, 173, 10,
])
.unwrap(),
};
let got = vote.encode_vec().unwrap();
let v = Vote::decode_vec(&got).unwrap();
assert_eq!(v, vote);
// SignVoteRequest
{
let svr = SignVoteRequest {
vote,
chain_id: ChainId::from_str("test_chain_id").unwrap(),
};
let mut got = vec![];
let _have = svr.encode(&mut got);
let svr2 = SignVoteRequest::decode(got.as_ref()).unwrap();
assert_eq!(svr, svr2);
}
} | rust_cleaned_test_functions.jsonl/113701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
62,
581,
77,
32981,
6615,
29252,
368,
341,
286,
1077,
7594,
284,
330,
17,
15,
16,
22,
12,
16,
17,
12,
17,
20,
51,
15,
18,
25,
15,
15,
25,
15,
16,
13,
17,
18,
19,
57,
3263,
6400,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timestamp_diff_serialize_bytes() {
let tmsp_diff_a = TimestampDiff::default();
let res = tmsp_diff_a.to_bytes();
assert!(res.is_ok());
let tmsp_diff_a_bytes = res.unwrap();
let res = TimestampDiff::from_bytes(&tmsp_diff_a_bytes);
assert!(res.is_ok());
let tmsp_diff_b = res.unwrap();
assert_eq!(tmsp_diff_a, tmsp_diff_b);
} | rust_cleaned_test_functions.jsonl/32124 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
15850,
88686,
12524,
368,
341,
262,
1077,
259,
92545,
15850,
4306,
284,
32758,
21751,
486,
2258,
543,
262,
1077,
592,
284,
259,
92545,
15850,
4306,
2389,
12524,
543,
262,
2060,
10297,
416,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_facets_by_active_substance() {
let active_substances = vec![
"LOSARTAN POTASSIUM".to_string(),
"HYDROCHLOROTHIAZIDE".to_string(),
"L-TEST".to_string(),
];
let products = vec![
"LOSARTAN POTASSIUM / HYDROCHLOROTHIAZIDE 100 MG /25 MG FILM-COATED TABLETS".to_owned(),
];
let expected = vec![
"H",
"H, HYDROCHLOROTHIAZIDE",
"H, HYDROCHLOROTHIAZIDE, LOSARTAN POTASSIUM / HYDROCHLOROTHIAZIDE 100 MG /25 MG FILM-COATED TABLETS",
"L",
"L, L-TEST",
"L, L-TEST, LOSARTAN POTASSIUM / HYDROCHLOROTHIAZIDE 100 MG /25 MG FILM-COATED TABLETS",
"L, LOSARTAN POTASSIUM",
"L, LOSARTAN POTASSIUM, LOSARTAN POTASSIUM / HYDROCHLOROTHIAZIDE 100 MG /25 MG FILM-COATED TABLETS",
];
assert_eq!(
create_facets_by_active_substance(
VecSanitisedString::from(products),
VecSanitisedString::from(active_substances)
),
expected
);
} | rust_cleaned_test_functions.jsonl/6363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
41589,
1415,
3710,
12930,
5228,
1309,
368,
341,
286,
1077,
4541,
5228,
9436,
284,
7486,
90515,
310,
330,
37558,
2992,
1093,
61502,
4939,
40,
2794,
3263,
983,
3904,
3148,
310,
330,
48852,
35,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tcp_stream() {
let (server_started_signal_tx, server_started_signal_rx) = mpsc::channel();
thread::spawn(move || {
let l = TcpListener::bind("127.0.0.1:8080").unwrap();
server_started_signal_tx.send(()).unwrap();
if let Some(Ok(mut stream)) = l.incoming().next() {
let data = "Hello".as_bytes().to_vec();
let mut size_buf = [0u8; LENGTH_PREFIX_SIZE];
BigEndian::write_i32(&mut size_buf, data.len() as i32);
log::debug!("writing {} bytes of data: {:?}", data.len(), &data);
if stream.write_all(&size_buf).is_err() || stream.write_all(&data).is_err() {
log::warn!("Cannot write to secure stream");
}
}
});
server_started_signal_rx.recv().expect("server terminated?");
let mut stream = TcpStream::connect("127.0.0.1:8080").unwrap();
let mut size_buf = [0u8; LENGTH_PREFIX_SIZE];
//should be u32 but java requires i32
let size = match stream.read_exact(&mut size_buf) {
Err(e) => {
log::warn!("Cannot read size of data: {}", e);
return;
}
Ok(_) => BigEndian::read_i32(&size_buf),
};
let mut buf = vec![0u8; size as usize];
stream.read_exact(&mut buf).unwrap();
println!("{}, {:?}", size, buf);
} | rust_cleaned_test_functions.jsonl/103496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 757
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45562,
12673,
368,
341,
286,
1077,
320,
4030,
55679,
21137,
17805,
11,
3538,
55679,
21137,
24330,
8,
284,
296,
81984,
486,
10119,
543,
286,
4516,
486,
46087,
34081,
1369,
341,
310,
1077,
326,
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... | 6 |
#[test]
fn test_select_expensive_books() -> Result<()> {
let sql = SqlBuilder::select_from("books")
.field("title")
.field("price")
.and_where("price > 100")
.sql()?;
assert_eq!(&sql, "SELECT title, price FROM books WHERE price > 100;");
let sql = SqlBuilder::select_from("books")
.field("title")
.field("price")
.and_where_gt("price", 200)
.sql()?;
assert_eq!(&sql, "SELECT title, price FROM books WHERE price > 200;");
let sql = SqlBuilder::select_from("books")
.field("title")
.field("price")
.and_where_ge("price", 300)
.sql()?;
assert_eq!(&sql, "SELECT title, price FROM books WHERE price >= 300;");
Ok(())
} | rust_cleaned_test_functions.jsonl/12589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 409
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
14214,
4025,
73084,
368,
1464,
5714,
71698,
341,
286,
1077,
5704,
284,
7224,
3297,
486,
1742,
5673,
445,
12110,
1138,
310,
659,
2566,
445,
2102,
1138,
310,
659,
2566,
445,
6555,
1138,
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... | 4 |
#[test]
fn test_specs() {
let global_config = resolve_global_config(HashMap::new()).config;
run_specs(
&PathBuf::from("./tests/specs"),
&ParseSpecOptions { default_file_name: "file.ts" },
&RunSpecsOptions { fix_failures: false, format_twice: true },
move |file_name, file_text, spec_config| {
let config_result = resolve_config(parse_config_key_map(spec_config), &global_config);
ensure_no_diagnostics(&config_result.diagnostics);
format_text(&file_name, &file_text, &config_result.config)
}
)
} | rust_cleaned_test_functions.jsonl/64632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71200,
368,
341,
1066,
262,
1077,
3644,
5332,
284,
8830,
19296,
5332,
7,
18497,
486,
931,
6011,
1676,
401,
262,
1598,
71200,
1006,
286,
609,
1820,
15064,
486,
1499,
13988,
23841,
45389,
82,
4461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_supplies_food_left() {
let mut supplies = Supplies::new();
supplies.buy_food(200).unwrap();
assert_eq!(200, supplies.food_left());
} | rust_cleaned_test_functions.jsonl/28651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
7202,
58580,
9579,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
16720,
63871,
58580,
7,
17,
15,
15,
568,
15454,
543,
286,
2060,
10714,
10297,
17,
15,
15,
11,
16720,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_persist_error() {
let nodes = create_nodes(2, "test_persist_error".to_string());
open_channel!(nodes[0], nodes[1], 100000);
let persister = |_: &_| Err(std::io::Error::new(std::io::ErrorKind::Other, "test"));
let event_handler = |_: &_| {};
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].net_graph_msg_handler.clone(), nodes[0].peer_manager.clone(), nodes[0].logger.clone());
match bg_processor.join() {
Ok(_) => panic!("Expected error persisting manager"),
Err(e) => {
assert_eq!(e.kind(), std::io::ErrorKind::Other);
assert_eq!(e.get_ref().unwrap().to_string(), "test");
},
}
} | rust_cleaned_test_functions.jsonl/26265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
4975,
4096,
368,
341,
2394,
197,
10217,
7798,
284,
1855,
14896,
7,
17,
11,
330,
1944,
620,
4975,
4096,
3263,
983,
3904,
1423,
197,
52199,
14571,
10297,
20008,
58,
15,
1125,
7798,
58,
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... | 2 |
#[test]
fn test_flag_capacity() {
let mut f1 = FlagVec::with_capacity(10);
assert_eq!(f1.capacity(), 16);
let mut f2 = f1.clone();
assert_eq!(f2.capacity(), 16);
f2 = f1.shrunk();
f1.shrink();
assert_eq!(f1.capacity(), 0);
assert_eq!(f1, f2);
f1.enlarge(20);
assert_eq!(f1.capacity(), 24);
} | rust_cleaned_test_functions.jsonl/24803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10933,
35603,
368,
341,
286,
1077,
5206,
282,
16,
284,
22666,
10050,
486,
4197,
35603,
7,
16,
15,
317,
286,
2060,
10714,
10297,
69,
16,
59168,
1507,
220,
16,
21,
317,
286,
1077,
5206,
282,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_persist_transaction_status() {
solana_logger::setup();
let GenesisConfigInfo {
mut genesis_config,
mint_keypair,
..
} = create_slow_genesis_config(solana_sdk::native_token::sol_to_lamports(1000.0));
genesis_config.rent.lamports_per_byte_year = 50;
genesis_config.rent.exemption_threshold = 2.0;
let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_sdk::pubkey::new_rand();
let keypair1 = Keypair::new();
let rent_exempt_amount = bank.get_minimum_balance_for_rent_exemption(0);
let success_tx = system_transaction::transfer(
&mint_keypair,
&pubkey,
rent_exempt_amount,
genesis_config.hash(),
);
let success_signature = success_tx.signatures[0];
let entry_1 = next_entry(&genesis_config.hash(), 1, vec![success_tx.clone()]);
let ix_error_tx = system_transaction::transfer(
&keypair1,
&pubkey1,
2 * rent_exempt_amount,
genesis_config.hash(),
);
let ix_error_signature = ix_error_tx.signatures[0];
let entry_2 = next_entry(&entry_1.hash, 1, vec![ix_error_tx.clone()]);
let entries = vec![entry_1, entry_2];
let transactions = sanitize_transactions(vec![success_tx, ix_error_tx]);
bank.transfer(rent_exempt_amount, &mint_keypair, &keypair1.pubkey())
.unwrap();
let ledger_path = get_tmp_ledger_path_auto_delete!();
{
let blockstore = Blockstore::open(ledger_path.path())
.expect("Expected to be able to open database ledger");
let blockstore = Arc::new(blockstore);
let (poh_recorder, _entry_receiver, record_receiver) = PohRecorder::new(
bank.tick_height(),
bank.last_blockhash(),
bank.clone(),
Some((4, 4)),
bank.ticks_per_slot(),
&pubkey,
&blockstore,
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&Arc::new(PohConfig::default()),
Arc::new(AtomicBool::default()),
);
let recorder = poh_recorder.recorder();
let poh_recorder = Arc::new(Mutex::new(poh_recorder));
let poh_simulator = simulate_poh(record_receiver, &poh_recorder);
poh_recorder.lock().unwrap().set_bank(&bank);
let shreds = entries_to_test_shreds(&entries, bank.slot(), 0, true, 0);
blockstore.insert_shreds(shreds, None, false).unwrap();
blockstore.set_roots(std::iter::once(&bank.slot())).unwrap();
let (transaction_status_sender, transaction_status_receiver) = unbounded();
let transaction_status_service = TransactionStatusService::new(
transaction_status_receiver,
Arc::new(AtomicU64::default()),
true,
None,
blockstore.clone(),
false,
&Arc::new(AtomicBool::new(false)),
);
let (gossip_vote_sender, _gossip_vote_receiver) = unbounded();
let _ = BankingStage::process_and_record_transactions(
&bank,
&transactions,
&recorder,
0,
Some(TransactionStatusSender {
sender: transaction_status_sender,
}),
&gossip_vote_sender,
&QosService::new(Arc::new(RwLock::new(CostModel::default())), 1),
);
transaction_status_service.join().unwrap();
let confirmed_block = blockstore.get_rooted_block(bank.slot(), false).unwrap();
let actual_tx_results: Vec<_> = confirmed_block
.transactions
.into_iter()
.map(|VersionedTransactionWithStatusMeta { transaction, meta }| {
(transaction.signatures[0], meta.status)
})
.collect();
let expected_tx_results = vec![
(success_signature, Ok(())),
(
ix_error_signature,
Err(TransactionError::InstructionError(
0,
InstructionError::Custom(1),
)),
),
];
assert_eq!(actual_tx_results, expected_tx_results);
poh_recorder
.lock()
.unwrap()
.is_exited
.store(true, Ordering::Relaxed);
let _ = poh_simulator.join();
}
Blockstore::destroy(ledger_path.path()).unwrap();
} | rust_cleaned_test_functions.jsonl/15494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2563
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
620,
4975,
28884,
4773,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_combine_child_keys_empty_base() {
let kids = Children::Keys(RefCell::new(vec!["baz".to_string(), "qux".to_string(), "plugh".to_string(),
"thud".to_string()]));
assert_eq!(vec!["baz".to_string(), "qux".to_string(), "plugh".to_string(),
"thud".to_string()], kids.combine_child_keys("".to_string()));
} | rust_cleaned_test_functions.jsonl/86193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72374,
17268,
12631,
15124,
7651,
368,
341,
262,
1077,
6837,
284,
15044,
486,
8850,
7,
3945,
3599,
486,
931,
25592,
0,
1183,
42573,
3263,
983,
3904,
1507,
330,
446,
87,
3263,
983,
3904,
1507,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_utctime() {
assert_parses::<UtcTime>(&[
(
Ok(UtcTime::new(
FixedOffset::west(7 * 60 * 60)
.ymd(1991, 5, 6)
.and_hms(16, 45, 40)
.into(),
)
.unwrap()),
b"\x17\x11910506164540-0700",
),
(
Ok(UtcTime::new(
FixedOffset::east(7 * 60 * 60 + 30 * 60)
.ymd(1991, 5, 6)
.and_hms(16, 45, 40)
.into(),
)
.unwrap()),
b"\x17\x11910506164540+0730",
),
(
Ok(UtcTime::new(Utc.ymd(1991, 5, 6).and_hms(23, 45, 40)).unwrap()),
b"\x17\x0d910506234540Z",
),
(
Ok(UtcTime::new(Utc.ymd(1991, 5, 6).and_hms(23, 45, 0)).unwrap()),
b"\x17\x0b9105062345Z",
),
(
Ok(UtcTime::new(Utc.ymd(1951, 5, 6).and_hms(23, 45, 0)).unwrap()),
b"\x17\x0b5105062345Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0da10506234540Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d91a506234540Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d9105a6234540Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d910506a34540Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d910506334a40Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d91050633444aZ",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d910506334461Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0e910506334400Za",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d000100000000Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d101302030405Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d100002030405Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d100100030405Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d100132030405Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d100231030405Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d100102240405Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d100102036005Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0d100102030460Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0e-100102030410Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0e10-0102030410Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0e10-0002030410Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0e1001-02030410Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0e100102-030410Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0e10010203-0410Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0e1001020304-10Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x0c18102813516Z",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x17\x1018102813516+0730",
),
]);
} | rust_cleaned_test_functions.jsonl/40834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
60363,
33600,
368,
341,
286,
2060,
77113,
288,
27638,
97768,
1462,
44784,
9640,
310,
2399,
394,
7622,
12317,
10413,
1462,
486,
931,
1006,
503,
20149,
6446,
486,
11039,
7,
22,
353,
220,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_datetime_check() {
let gil = Python::acquire_gil();
let py = gil.python();
let (obj, sub_obj, sub_sub_obj) =
_get_subclasses(&py, "datetime", "2018, 1, 1, 13, 30, 15").unwrap();
assert_check_only!(PyDate_Check, obj);
assert_check_exact!(PyDateTime_Check, obj);
assert_check_only!(PyDateTime_Check, sub_obj);
assert_check_only!(PyDateTime_Check, sub_sub_obj);
} | rust_cleaned_test_functions.jsonl/113013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28943,
7200,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
543,
262,
1077,
320,
2295,
11,
1186,
7328,
11,
1186,
5228,
7328,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_target_connection_state_will_not_drop_rcs_on_mdns_events() {
let t = Target::new_named("hello-kitty");
let rcs_state =
TargetConnectionState::Rcs(RcsConnection::new(&mut NodeId { id: 1234 }).unwrap());
t.set_state(rcs_state.clone());
// this transition RCS should be retained.
t.update_connection_state(|_| TargetConnectionState::Mdns(Instant::now()));
assert_eq!(t.get_connection_state(), rcs_state);
} | rust_cleaned_test_functions.jsonl/115223 | {
"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,
11123,
15866,
4387,
1670,
483,
7913,
29584,
30299,
82,
4470,
32994,
4412,
19691,
368,
341,
286,
1077,
259,
284,
13483,
486,
931,
71834,
445,
14990,
12646,
22814,
797,
286,
1077,
435,
4837,
4387,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitv_iterator() {
let bools = [true, false, true, true];
let bitv = from_bools(bools);
for (act, &ex) in bitv.iter().zip(bools.iter()) {
assert_eq!(ex, act);
}
} | rust_cleaned_test_functions.jsonl/12148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
85,
13491,
368,
341,
286,
1077,
1807,
82,
284,
508,
1866,
11,
895,
11,
830,
11,
830,
935,
286,
1077,
2699,
85,
284,
504,
22159,
82,
9764,
82,
626,
286,
369,
320,
531,
11,
609,
327,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vectors() {
let context = Context::create();
let builder = context.create_builder();
let module = context.create_module("my_mod");
let i32_type = context.i32_type();
let i32_zero = i32_type.const_int(0, false);
let i32_seven = i32_type.const_int(7, false);
let vec_type = i32_type.vec_type(2);
let fn_type = i32_type.fn_type(&[vec_type.into()], false);
let fn_value = module.add_function("my_func", fn_type, None);
let bb = fn_value.append_basic_block("entry");
let vector_param = fn_value.get_first_param().unwrap().into_vector_value();
builder.position_at_end(&bb);
builder.build_insert_element(vector_param, i32_seven, i32_zero, "insert");
let extracted = builder.build_extract_element(vector_param, i32_zero, "extract");
builder.build_return(Some(&extracted));
assert!(module.verify().is_ok());
} | rust_cleaned_test_functions.jsonl/122317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49158,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
7363,
284,
2266,
2520,
28532,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
2408,
7480,
797,
262,
1077,
600,
18,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sample_boundaries() {
let mut r = crate::test::rng(404);
assert_eq!(sample_inplace(&mut r, 0, 0).len(), 0);
assert_eq!(sample_inplace(&mut r, 1, 0).len(), 0);
assert_eq!(sample_inplace(&mut r, 1, 1).into_vec(), vec![0]);
assert_eq!(sample_rejection(&mut r, 1u32, 0).len(), 0);
assert_eq!(sample_floyd(&mut r, 0, 0).len(), 0);
assert_eq!(sample_floyd(&mut r, 1, 0).len(), 0);
assert_eq!(sample_floyd(&mut r, 1, 1).into_vec(), vec![0]);
let sum: usize = sample_rejection(&mut r, 1 << 25, 10u32).into_iter().sum();
assert!(1 << 25 < sum && sum < (1 << 25) * 25);
let sum: usize = sample_floyd(&mut r, 1 << 25, 10).into_iter().sum();
assert!(1 << 25 < sum && sum < (1 << 25) * 25);
} | rust_cleaned_test_functions.jsonl/11279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17491,
19447,
5431,
368,
341,
286,
1077,
5206,
435,
284,
17717,
486,
1944,
486,
69890,
7,
19,
15,
19,
626,
286,
2060,
10714,
10297,
13611,
1243,
2007,
2099,
6984,
435,
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_from_str() {
let desered = from_str(DOC).expect("Couldn't deserialize Data");
assert_eq!(
desered,
Data {
base: "https://example.com".into(),
client_id: "adbc01234".into(),
client_secret: "0987dcba".into(),
redirect: "urn:ietf:wg:oauth:2.0:oob".into(),
token: "fedc5678".into(),
}
);
} | rust_cleaned_test_functions.jsonl/39217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
368,
341,
286,
1077,
939,
12336,
284,
504,
2895,
5432,
7612,
568,
17119,
445,
38987,
944,
35240,
2885,
797,
286,
2060,
10714,
33673,
310,
939,
12336,
345,
310,
2885,
341,
394,
2331,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expect_at_most_with_few_requests() {
let mock = mock("GET", "/hello").expect_at_most(3).create();
request("GET /hello", "");
request("GET /hello", "");
mock.assert();
} | rust_cleaned_test_functions.jsonl/82434 | {
"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,
68918,
3752,
81416,
6615,
761,
365,
37216,
368,
341,
262,
1077,
7860,
284,
7860,
445,
3806,
497,
3521,
14990,
1827,
17119,
3752,
81416,
7,
18,
568,
3182,
1428,
262,
1681,
445,
3806,
608,
14990,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_folder() {
let items = string_vec_to_status(&[
"a/file.txt",
]);
let res = FileTreeItems::new(&items, &BTreeSet::new())
.unwrap()
.items
.iter()
.map(|i| i.info.full_path.clone())
.collect::<Vec<_>>();
assert_eq!(
res,
vec![String::from("a"), items[0].path.clone(),]
);
} | rust_cleaned_test_functions.jsonl/56871 | {
"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,
15268,
368,
341,
286,
1077,
3589,
284,
914,
13251,
2346,
4773,
2099,
9640,
310,
330,
64,
23903,
3909,
497,
715,
286,
22712,
286,
1077,
592,
284,
2887,
6533,
4353,
486,
931,
2099,
3615,
11,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_f_layout() {
let shape = (2, 2).f();
let arr = Array::<i32, Ix2>::from_shape_vec(shape, vec![1, 2, 3, 4]).unwrap();
assert!(!arr.is_standard_layout());
test_as_standard_layout_for(arr);
} | rust_cleaned_test_functions.jsonl/92645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
14466,
368,
341,
286,
1077,
6083,
284,
320,
17,
11,
220,
17,
568,
69,
543,
286,
1077,
2890,
284,
2910,
27638,
72,
18,
17,
11,
358,
87,
17,
6831,
1499,
13597,
13251,
25933,
11,
7486,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_response() {
let response = Response::new();
assert_eq!(response.status, StatusCode::Ok);
assert_eq!(response.headers, Headers::new());
assert!(response.body.is_none());
} | rust_cleaned_test_functions.jsonl/4154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
9655,
368,
341,
286,
1077,
2033,
284,
5949,
486,
931,
1428,
286,
2060,
10714,
10297,
2322,
4299,
11,
53403,
486,
11578,
317,
286,
2060,
10714,
10297,
2322,
18022,
11,
21426,
486,
931,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_easy_full_freecells() {
let game_state = GameState::from_file("test-inputs/easy-full-freecells.txt").unwrap();
let actual = game_state.legal_moves();
let expected = vec![
(
GameState::from_file("test-inputs/move-results/easy-full-freecells/6h-from-freecell3-to-cascade1.txt").unwrap(),
Move {
card: Card { suit: Heart, rank: 6 },
from: Position::Freecell(3),
to: Position::Cascade(1),
},
),
(
GameState::from_file("test-inputs/move-results/easy-full-freecells/9d-from-freecell2-to-cascade0.txt").unwrap(),
Move {
card: Card { suit: Diamond, rank: 9 },
from: Position::Freecell(2),
to: Position::Cascade(0),
},
),
(
GameState::from_file("test-inputs/move-results/easy-full-freecells/9d-from-freecell2-to-cascade3.txt").unwrap(),
Move {
card: Card { suit: Diamond, rank: 9 },
from: Position::Freecell(2),
to: Position::Cascade(3),
},
),
(
GameState::from_file("test-inputs/move-results/easy-full-freecells/ac-from-freecell1-to-foundations.txt").unwrap(),
Move {
card: Card { suit: Club, rank: ACE },
from: Position::Freecell(1),
to: Position::Foundations,
},
),
(
GameState::from_file("test-inputs/move-results/easy-full-freecells/ad-from-freecell0-to-cascade6.txt").unwrap(),
Move {
card: Card { suit: Diamond, rank: ACE },
from: Position::Freecell(0),
to: Position::Cascade(6),
},
),
(
GameState::from_file("test-inputs/move-results/easy-full-freecells/ad-from-freecell0-to-foundations.txt").unwrap(),
Move {
card: Card { suit: Diamond, rank: ACE },
from: Position::Freecell(0),
to: Position::Foundations,
},
),
];
utils::assert_eq_ignore_order(actual, expected);
} | rust_cleaned_test_functions.jsonl/112993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59091,
16372,
74179,
757,
6436,
368,
341,
262,
1077,
1809,
4387,
284,
47987,
486,
1499,
2458,
445,
1944,
13933,
82,
16546,
6405,
23642,
2220,
265,
757,
6436,
3909,
1827,
15454,
543,
262,
1077,
504... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_island() {
let flags = settings::Flags::new(settings::builder());
let mut buf = MachBuffer::new();
let mut state = Default::default();
buf.reserve_labels_for_blocks(4);
buf.bind_label(label(0));
let inst = Inst::CondBr {
kind: CondBrKind::NotZero(xreg(0)),
taken: target(2),
not_taken: target(3),
};
inst.emit(&mut buf, &flags, &mut state);
buf.bind_label(label(1));
while buf.cur_offset() < 2000000 {
if buf.island_needed(0) {
buf.emit_island();
}
let inst = Inst::Nop4;
inst.emit(&mut buf, &flags, &mut state);
}
buf.bind_label(label(2));
let inst = Inst::Nop4;
inst.emit(&mut buf, &flags, &mut state);
buf.bind_label(label(3));
let inst = Inst::Nop4;
inst.emit(&mut buf, &flags, &mut state);
let buf = buf.finish();
assert_eq!(2000000 + 8, buf.total_size());
let mut buf2 = MachBuffer::new();
let mut state = Default::default();
let inst = Inst::CondBr {
kind: CondBrKind::NotZero(xreg(0)),
taken: BranchTarget::ResolvedOffset(1048576 - 4),
not_taken: BranchTarget::ResolvedOffset(2000000 + 4 - 4),
};
inst.emit(&mut buf2, &flags, &mut state);
let buf2 = buf2.finish();
assert_eq!(&buf.data[0..8], &buf2.data[..]);
} | rust_cleaned_test_functions.jsonl/16775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 754
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
1933,
368,
341,
286,
1077,
8042,
284,
5003,
486,
9195,
486,
931,
23369,
486,
17850,
1423,
286,
1077,
5206,
6607,
284,
18294,
4095,
486,
931,
543,
286,
1077,
5206,
1584,
284,
7899,
486,
225... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serde_bincode() {
// Bincode is relevant to test separately from JSON because
// it is not self-describing.
use bincode::{deserialize, serialize};
let d = NaiveDate::from_ymd(2014, 7, 24);
let encoded = serialize(&d).unwrap();
let decoded: NaiveDate = deserialize(&encoded).unwrap();
assert_eq!(d, decoded);
} | rust_cleaned_test_functions.jsonl/29539 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
21816,
1851,
368,
341,
286,
442,
29344,
1851,
374,
9760,
311,
1273,
25156,
504,
4718,
1576,
198,
286,
442,
432,
374,
537,
656,
24506,
43531,
624,
286,
990,
9544,
1851,
22964,
66777,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_block_invalid_blockhash_for_master() {
let block = Some(Block::new(hex::decode(BLOCK).unwrap()));
let state = Master::for_test().candidate_block(block.clone()).build();
let blockhash = SHA256Hash::from_slice(&hex::decode(INVALID_HASH).unwrap()[..]).unwrap();
assert!(get_valid_block(&state, blockhash).is_err());
} | rust_cleaned_test_functions.jsonl/75390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8337,
7113,
31433,
7113,
8296,
5478,
24582,
368,
341,
286,
1077,
2504,
284,
4329,
55243,
486,
931,
44660,
486,
18196,
5349,
8044,
568,
15454,
7392,
286,
1077,
1584,
284,
10824,
486,
1958,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pvc() {
let pn: [u32; 22] = [
2, 3, 4, 6, 8, 9, 11, 12, 16, 18, 22, 24, 32, 36, 44, 48, 64, 72, 88, 96, 144, 176,
];
let pk_max: [u32; 22] = [
128, 128, 128, 88, 36, 26, 18, 16, 12, 11, 9, 9, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4,
];
pn.iter().zip(pk_max.iter()).for_each(|(n, max)| {
for pseudo in 1..41 {
let k = get_pulses(pseudo);
if k > *max {
break;
}
let nc = pvq_v(*n, k);
let mut inc = nc / 20000;
if inc < 1 {
inc = 1;
}
(0..nc).step_by(inc as usize).for_each(|i| {
let mut y = vec![0_i32; *n as usize];
cwrsi(&mut y, *n, k, i);
let mut sy = 0;
y.iter().for_each(|x| {
sy += i32::abs(*x) as u32;
});
assert_eq!(sy, k, "N={} Pulse count mismatch", *n);
let ii = icwrs(&y, *n);
let v = pvq_v(*n, k);
assert_eq!(ii, i, "N={} Combination index mismatch", *n);
assert_eq!(v, nc, "N={} Combination count mismatch", *n);
});
}
});
} | rust_cleaned_test_functions.jsonl/102498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 909
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
7362,
368,
341,
286,
1077,
43050,
25,
508,
84,
18,
17,
26,
220,
17,
17,
60,
284,
2278,
310,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
21,
11,
220,
23,
11,
220,
24,
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... | 4 |
#[test]
fn test_entry_take_doesnt_corrupt() {
#![allow(deprecated)] //rand
// Test for #19292
fn check(m: &HashMap<i32, ()>) {
for k in m.keys() {
assert!(m.contains_key(k), "{} is in keys() but not in the map?", k);
}
}
let mut m = HashMap::new();
let mut rng = thread_rng();
// Populate the map with some items.
for _ in 0..50 {
let x = rng.gen_range(-10, 10);
m.insert(x, ());
}
for _ in 0..1000 {
let x = rng.gen_range(-10, 10);
match m.entry(x) {
Vacant(_) => {}
Occupied(e) => {
e.remove();
}
}
check(&m);
}
} | rust_cleaned_test_functions.jsonl/8526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9078,
73261,
96374,
406,
14734,
6585,
368,
341,
286,
671,
20703,
7183,
12797,
19889,
7252,
442,
11335,
198,
4597,
442,
3393,
369,
671,
16,
24,
17,
24,
17,
198,
286,
5168,
1779,
1255,
25,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_disable_escapes() {
let input_str = "\\a \\\\ \\b \\r \\e \\f \\x41 \\n a\\cb \\u0100 \\t \\v";
new_ucmd!()
.arg("-E")
.arg(input_str)
.succeeds()
.stdout_only(format!("{}\n", input_str));
} | rust_cleaned_test_functions.jsonl/34823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33842,
92196,
9337,
368,
341,
262,
1077,
1946,
2895,
284,
26468,
64,
1124,
81351,
24984,
65,
24984,
81,
24984,
68,
24984,
69,
24984,
87,
19,
16,
24984,
77,
264,
3422,
7221,
24984,
84,
15,
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_uploads() {
use std::fs;
let dir = tempfile::Builder::new()
.prefix("docs.rs-upload-test")
.tempdir()
.unwrap();
let files = ["Cargo.toml", "src/main.rs"];
for &file in &files {
let path = dir.path().join(file);
if let Some(parent) = path.parent() {
fs::create_dir_all(parent).unwrap();
}
fs::write(path, "data").expect("failed to write to file");
}
wrapper(|env| {
let db = env.db();
let conn = db.conn();
let mut backend = Storage::Database(DatabaseBackend::new(&conn));
let stored_files = backend.store_all(&conn, "rustdoc", dir.path()).unwrap();
assert_eq!(stored_files.len(), files.len());
for name in &files {
let name = Path::new(name);
assert!(stored_files.contains_key(name));
}
assert_eq!(
stored_files.get(Path::new("Cargo.toml")).unwrap(),
"text/toml"
);
assert_eq!(
stored_files.get(Path::new("src/main.rs")).unwrap(),
"text/rust"
);
let file = backend.get("rustdoc/Cargo.toml").unwrap();
assert_eq!(file.content, b"data");
assert_eq!(file.mime, "text/toml");
assert_eq!(file.path, "rustdoc/Cargo.toml");
let file = backend.get("rustdoc/src/main.rs").unwrap();
assert_eq!(file.content, b"data");
assert_eq!(file.mime, "text/rust");
assert_eq!(file.path, "rustdoc/src/main.rs");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/70549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 937
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
19374,
368,
341,
286,
990,
1460,
486,
3848,
280,
286,
1077,
5419,
284,
54819,
486,
3297,
486,
931,
741,
310,
659,
11849,
445,
14120,
25638,
47169,
16839,
1138,
310,
659,
3888,
3741,
741,
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... | 4 |
#[test]
fn test_operator() {
assert_eq!(apply(node, "node", ">"), build_token(b::op(">")));
// assert_leaf! {
// parsers [ operator ]
// assert_leaf! {
// parsers [ operator ]
// assert_leaf! {
// parsers [ operator ]
// assert_leaf! {
// parsers [ operator ]
// assert_leaf! {
// parsers [ operator ]
} | rust_cleaned_test_functions.jsonl/46718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40594,
368,
341,
286,
2060,
10714,
10297,
10280,
6958,
11,
330,
3509,
497,
28957,
3975,
1936,
6458,
1883,
486,
453,
63853,
74385,
286,
442,
2060,
38909,
0,
341,
286,
442,
257,
87073,
508,
5675,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_euclidean_matrix_slice_metric() {
let m = matrix![
1.0, 1.0, 1.0;
1.0, 1.0, 1.0;
1.0, 1.0, 1.0
];
let m2 = matrix![
0.0, 0.0, 0.0;
0.0, 0.0, 0.0;
0.0, 0.0, 0.0
];
let m_slice = MatrixSlice::from_matrix(
&m, [0; 2], 1, 2
);
let m2_slice = MatrixSlice::from_matrix(
&m2, [0; 2], 1, 2
);
assert_scalar_eq!(MatrixMetric::metric(&Euclidean, &m_slice, &m2_slice), 2.0.sqrt(), comp = exact);
} | rust_cleaned_test_functions.jsonl/6899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
84,
50078,
10193,
26488,
41294,
368,
341,
286,
1077,
296,
284,
6172,
90515,
310,
220,
16,
13,
15,
11,
220,
16,
13,
15,
11,
220,
16,
13,
15,
280,
310,
220,
16,
13,
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_valset_sort() {
let correct: [GravitySignature; 8] = [
GravitySignature {
power: 685294939,
eth_address: "0x479FFc856Cdfa0f5D1AE6Fa61915b01351A7773D"
.parse()
.unwrap(),
v: 0u64.into(),
r: 0u64.into(),
s: 0u64.into(),
},
GravitySignature {
power: 678509841,
eth_address: "0x6db48cBBCeD754bDc760720e38E456144e83269b"
.parse()
.unwrap(),
v: 0u64.into(),
r: 0u64.into(),
s: 0u64.into(),
},
GravitySignature {
power: 671724742,
eth_address: "0x0A7254b318dd742A3086882321C27779B4B642a6"
.parse()
.unwrap(),
v: 0u64.into(),
r: 0u64.into(),
s: 0u64.into(),
},
GravitySignature {
power: 671724742,
eth_address: "0x454330deAaB759468065d08F2b3B0562caBe1dD1"
.parse()
.unwrap(),
v: 0u64.into(),
r: 0u64.into(),
s: 0u64.into(),
},
GravitySignature {
power: 671724742,
eth_address: "0x8E91960d704Df3fF24ECAb78AB9df1B5D9144140"
.parse()
.unwrap(),
v: 0u64.into(),
r: 0u64.into(),
s: 0u64.into(),
},
GravitySignature {
power: 617443955,
eth_address: "0x3511A211A6759d48d107898302042d1301187BA9"
.parse()
.unwrap(),
v: 0u64.into(),
r: 0u64.into(),
s: 0u64.into(),
},
GravitySignature {
power: 291759231,
eth_address: "0xF14879a175A2F1cEFC7c616f35b6d9c2b0Fd8326"
.parse()
.unwrap(),
v: 0u64.into(),
r: 0u64.into(),
s: 0u64.into(),
},
GravitySignature {
power: 6785098,
eth_address: "0x37A0603dA2ff6377E5C7f75698dabA8EE4Ba97B8"
.parse()
.unwrap(),
v: 0u64.into(),
r: 0u64.into(),
s: 0u64.into(),
},
];
let mut rng = thread_rng();
let mut incorrect = correct.clone();
incorrect.shuffle(&mut rng);
assert_ne!(incorrect, correct);
incorrect.sort();
incorrect.reverse();
assert_eq!(incorrect, correct);
} | rust_cleaned_test_functions.jsonl/31197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1929
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6189,
746,
18435,
368,
341,
286,
1077,
4396,
25,
508,
38409,
25088,
26,
220,
23,
60,
284,
2278,
310,
47490,
25088,
341,
394,
2355,
25,
220,
21,
23,
20,
17,
24,
19,
24,
18,
24,
345,
394,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_lsp_range() {
let fixture = deno_lint::diagnostic::Range {
start: deno_lint::diagnostic::Position {
line_index: 0,
column_index: 2,
byte_pos: 23,
},
end: deno_lint::diagnostic::Position {
line_index: 1,
column_index: 0,
byte_pos: 33,
},
};
let actual = as_lsp_range(&fixture);
assert_eq!(
actual,
lsp::Range {
start: lsp::Position {
line: 0,
character: 2,
},
end: lsp::Position {
line: 1,
character: 0,
},
}
);
} | rust_cleaned_test_functions.jsonl/3520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
907,
2154,
9698,
368,
341,
262,
1077,
12507,
284,
3371,
78,
907,
396,
486,
8579,
11953,
486,
6046,
341,
414,
1191,
25,
3371,
78,
907,
396,
486,
8579,
11953,
486,
3812,
341,
286,
1555,
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_plus_real() {
let test_cases = vec![
(
Real::new(1.01001).ok(),
Real::new(-0.01).ok(),
Real::new(1.00001).ok(),
false,
),
(Real::new(1e308).ok(), Real::new(1e308).ok(), None, true),
(
Real::new(std::f64::MAX - 1f64).ok(),
Real::new(2f64).ok(),
None,
true,
),
];
for (lhs, rhs, expected, is_err) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(lhs)
.push_param(rhs)
.evaluate(ScalarFuncSig::PlusReal);
if is_err {
assert!(output.is_err())
} else {
let output = output.unwrap();
assert_eq!(output, expected, "lhs={:?}, rhs={:?}", lhs, rhs);
}
}
} | rust_cleaned_test_functions.jsonl/5281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 613
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28043,
15266,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
2399,
394,
8800,
486,
931,
7,
16,
13,
15,
16,
15,
15,
16,
568,
562,
3148,
394,
8800,
486,
931,
4080,
15,
13,
15,
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... | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.