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_new_raft_with_bad_config_errors() {
let invalid_config = new_test_config(INVALID_ID, 1, 1);
let s = MemStorage::new_with_conf_state((vec![1, 2], vec![]));
let raft = Raft::new(&invalid_config, s, &default_logger());
assert!(raft.is_err())
} | rust_cleaned_test_functions.jsonl/19190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
62,
2944,
6615,
34199,
5332,
20196,
368,
341,
262,
1077,
8318,
5332,
284,
501,
4452,
5332,
23515,
10044,
3450,
11,
220,
16,
11,
220,
16,
317,
262,
1077,
274,
284,
13550,
5793,
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_module_from_code() {
let gil = Python::acquire_gil();
let py = gil.python();
let adder_mod = PyModule::from_code(
py,
"def add(a,b):\n\treturn a+b",
"adder_mod.py",
"adder_mod",
)
.expect("Module code should be loaded");
let add_func = adder_mod
.getattr("add")
.expect("Add function should be in the module")
.to_object(py);
let ret_value: i32 = add_func
.call1(py, (1, 2))
.expect("A value should be returned")
.extract(py)
.expect("The value should be able to be converted to an i32");
assert_eq!(ret_value, 3);
} | rust_cleaned_test_functions.jsonl/22683 | {
"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,
10750,
5673,
4136,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
1428,
262,
1077,
912,
261,
7480,
284,
5355,
3332,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser() {
assert_eq!(tok_values("\\x"), [Command("\\x")]);
assert_eq!(tok_values("\\x a b"),
[Command("\\x"), Argument("a"), Argument("b")]);
assert_eq!(tok_values("\\x 'a b'"),
[Command("\\x"), Argument("'a b'")]);
assert_eq!(tok_values("\\describe schema::`Object`"),
[Command("\\describe"), Argument("schema::`Object`")]);
} | rust_cleaned_test_functions.jsonl/33449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
368,
341,
286,
2060,
10714,
10297,
29594,
9146,
29710,
87,
3975,
508,
4062,
29710,
87,
899,
2558,
286,
2060,
10714,
10297,
29594,
9146,
29710,
87,
264,
293,
4461,
310,
508,
4062,
29710,
87,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index() {
let m = mat4x3(1., 2., 3., 2., 4., 6., 3., 6., 9., 4., 8., 12.);
assert_eq!(m[3], vec3(4., 8., 12.));
assert_eq!(m[1], m.c1);
assert_eq!(m[2][0], 3.);
assert_eq!(m[0][1], 2.)
} | rust_cleaned_test_functions.jsonl/76101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
368,
341,
286,
1077,
296,
284,
5517,
19,
87,
18,
7,
16,
2572,
220,
17,
2572,
220,
18,
2572,
220,
17,
2572,
220,
19,
2572,
220,
21,
2572,
220,
18,
2572,
220,
21,
2572,
220,
24,
2572,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_control_flow_graph() {
for _ in 0..20 {
let mut rand_input = [0u8; 2048];
thread_rng().fill_bytes(&mut rand_input);
let module_bytes = translate_to_fuzz_mvp(&rand_input).write();
let module: elements::Module = elements::deserialize_buffer(&module_bytes)
.expect("failed to parse Wasm blob generated by translate_to_fuzz");
for func_body in module.code_section().iter().flat_map(|section| section.bodies()) {
let rules = RuleSet::default();
let metered_blocks = determine_metered_blocks(func_body.code(), &rules).unwrap();
let success = validate_metering_injections(func_body, &rules, &metered_blocks).unwrap();
assert!(success);
}
}
} | rust_cleaned_test_functions.jsonl/130404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
13436,
27441,
14738,
368,
341,
197,
2023,
716,
304,
220,
15,
496,
17,
15,
341,
298,
10217,
5206,
10382,
5898,
284,
508,
15,
84,
23,
26,
220,
17,
15,
19,
23,
935,
298,
68214,
66849,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_rearrange_sequence() {
let mut colors = vec![
Color::white(),
Color::graytone(0.25),
Color::graytone(0.5),
Color::graytone(0.8),
Color::black(),
];
rearrange_sequence(&mut colors, DistanceMetric::CIE76);
assert_eq!(
colors,
vec![
Color::white(),
Color::black(),
Color::graytone(0.5),
Color::graytone(0.25),
Color::graytone(0.8),
]
);
} | rust_cleaned_test_functions.jsonl/24385 | {
"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,
1288,
1118,
844,
23735,
368,
341,
286,
1077,
5206,
7987,
284,
7486,
90515,
310,
3478,
486,
5782,
3148,
310,
3478,
486,
11650,
57929,
7,
15,
13,
17,
20,
1326,
310,
3478,
486,
11650,
57929,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mutable_freeze() {
let mut buf = MutableBuffer::new(1);
buf.extend_from_slice(b"aaaa bbbb cccc dddd");
assert_eq!(19, buf.len());
assert_eq!(64, buf.capacity());
assert_eq!(b"aaaa bbbb cccc dddd", buf.data());
let immutable_buf = buf.freeze();
assert_eq!(19, immutable_buf.len());
assert_eq!(64, immutable_buf.capacity());
assert_eq!(b"aaaa bbbb cccc dddd", immutable_buf.data());
} | rust_cleaned_test_functions.jsonl/54337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
5922,
8905,
2986,
368,
341,
286,
1077,
5206,
6607,
284,
31143,
4095,
486,
931,
7,
16,
317,
286,
6607,
15831,
5673,
26488,
1883,
1,
28458,
293,
53151,
272,
37054,
294,
40360,
797,
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_signature_rsa_pss_verify() {
test::run(
test_file!("rsa_pss_verify_tests.txt"),
|section, test_case| {
assert_eq!(section, "");
let digest_name = test_case.consume_string("Digest");
let alg = match digest_name.as_ref() {
"SHA256" => &signature::RSA_PSS_2048_8192_SHA256,
"SHA384" => &signature::RSA_PSS_2048_8192_SHA384,
"SHA512" => &signature::RSA_PSS_2048_8192_SHA512,
_ => panic!("Unsupported digest: {}", digest_name),
};
let public_key = test_case.consume_bytes("Key");
// Sanity check that we correctly DER-encoded the originally-
assert!(untrusted::Input::from(&public_key)
.read_all(error::Unspecified, |input| der::nested(
input,
der::Tag::Sequence,
error::Unspecified,
|input| {
let _ = der::positive_integer(input)?;
let _ = der::positive_integer(input)?;
Ok(())
}
))
.is_ok());
let msg = test_case.consume_bytes("Msg");
let sig = test_case.consume_bytes("Sig");
let is_valid = test_case.consume_string("Result") == "P";
let actual_result =
signature::UnparsedPublicKey::new(alg, &public_key).verify(&msg, &sig);
assert_eq!(actual_result.is_ok(), is_valid);
Ok(())
},
);
} | rust_cleaned_test_functions.jsonl/17914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 920
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
82522,
620,
778,
35638,
368,
341,
262,
1273,
486,
6108,
1006,
286,
1273,
2458,
17223,
60869,
620,
778,
35638,
32509,
3909,
4461,
286,
760,
2809,
11,
1273,
19096,
91,
341,
310,
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... | 4 |
#[test]
fn test_function_expression_simple() {
let b = ast::BaseNode::default();
let symbols = ["a", "b"]
.into_iter()
.map(|s| (s.to_string(), Symbol::from(s)))
.collect::<BTreeMap<_, _>>();
let f = FunctionExpr {
loc: b.location.clone(),
typ: type_info(),
params: vec![
FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: symbols["a"].clone(),
},
default: None,
},
FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: symbols["b"].clone(),
},
default: None,
},
],
body: Block::Return(ReturnStmt {
loc: b.location.clone(),
argument: Expression::Binary(Box::new(BinaryExpr {
loc: b.location.clone(),
typ: type_info(),
operator: ast::Operator::AdditionOperator,
left: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["a"].clone(),
}),
right: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["b"].clone(),
}),
})),
}),
vectorized: None,
};
assert_eq!(Vec::<&FunctionParameter>::new(), f.defaults());
assert_eq!(None, f.pipe());
} | rust_cleaned_test_functions.jsonl/131379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
28068,
30015,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
17738,
284,
4383,
64,
497,
330,
65,
7026,
310,
659,
18122,
11723,
741,
310,
659,
2186,
22428... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_groth16_srs_io() {
use memmap::MmapOptions;
use std::fs::File;
use std::io::{Seek, SeekFrom, Write};
use tempfile::NamedTempFile;
const NUM_PROOFS_TO_AGGREGATE: usize = 16;
let mut rng = rand_chacha::ChaChaRng::seed_from_u64(0u64);
println!("Creating parameters...");
// Generate parameters for inner product aggregation
let srs: GenericSRS<Bls12> = setup_fake_srs(&mut rng, NUM_PROOFS_TO_AGGREGATE);
// Write out parameters to a temp file
let mut cache_file = NamedTempFile::new().expect("failed to create temp cache file");
srs.write(&mut cache_file).expect("failed to write out srs");
cache_file.flush().expect("failed to flush srs write");
println!("cache file written to");
// Read back parameters from the temp file
cache_file
.seek(SeekFrom::Start(0))
.expect("failed to rewind tmp file");
let srs2 =
GenericSRS::<Bls12>::read(&mut cache_file).expect("failed to read srs from cache file");
// Ensure that the parameters match
assert_eq!(srs, srs2);
let cache_path = cache_file.into_temp_path();
let mapped_file = File::open(&cache_path).expect("failed to open file");
let mmap = unsafe {
MmapOptions::new()
.map(&mapped_file)
.expect("failed to mmap")
};
let max_len = (2 << 19) + 1;
let srs3 =
GenericSRS::<Bls12>::read_mmap(&mmap, max_len).expect("failed to read srs from cache file");
// Ensure that the parameters match
assert_eq!(srs, srs3);
// Remove temp file
cache_path.close().expect("failed to close temp path");
} | rust_cleaned_test_functions.jsonl/2135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
299,
339,
16,
21,
643,
5428,
16939,
368,
341,
262,
990,
1833,
2186,
486,
44,
2186,
3798,
280,
262,
990,
1460,
486,
3848,
486,
1703,
280,
262,
990,
1460,
486,
815,
22964,
39350,
11,
29739... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_head_empty_body() {
let req = Request::with_connector(
Head, Url::parse("http://example.dom").unwrap(), &mut MockConnector
).unwrap();
let bytes = run_request(req);
let s = from_utf8(&bytes[..]).unwrap();
assert_no_body(s);
} | rust_cleaned_test_functions.jsonl/2065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13138,
15124,
14114,
368,
341,
286,
1077,
4232,
284,
6145,
486,
4197,
76393,
1006,
310,
11203,
11,
22840,
486,
6400,
445,
1254,
1110,
8687,
21435,
1827,
15454,
1507,
609,
6984,
14563,
35954,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pause() {
let runc_id = format!("{}", Uuid::new_v4());
let runc_path = env::temp_dir().join(&runc_id).join("runc.amd64");
let runc_root =
PathBuf::from(env::var_os("XDG_RUNTIME_DIR").expect("expected temporary path"))
.join("rust-runc")
.join(&runc_id);
fs::create_dir_all(&runc_root).expect("unable to create runc root");
extract_tarball(
&PathBuf::from("test_fixture/runc_v1.0.0-rc10.tar.gz"),
&env::temp_dir().join(&runc_id),
)
.expect("unable to extract runc");
let mut config: RuncConfiguration = Default::default();
config.command = Some(runc_path.clone());
config.root = Some(runc_root.clone());
let runc = Runc::new(config).expect("Unable to create runc instance");
let task = async move {
let container = ManagedContainer::new(
&runc_path,
&runc_root,
&PathBuf::from("test_fixture/busybox.tar.gz"),
)
.await?;
runc.pause(&container.id).await?;
let container_state = runc.state(&container.id).await?;
// Can't seem to kill/delete a paused container
runc.resume(&container.id).await?;
Ok::<_, Error>(container_state)
};
let mut runtime = Runtime::new().expect("unable to create runtime");
let container_state = runtime.block_on(task).expect("test failed");
assert_eq!(container_state.status, Some(String::from("paused")));
} | rust_cleaned_test_functions.jsonl/24469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 782
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59989,
368,
341,
286,
1077,
435,
1347,
842,
284,
3561,
79878,
547,
2423,
486,
931,
2273,
19,
1423,
286,
1077,
435,
1347,
2638,
284,
6105,
486,
3888,
4334,
1005,
5987,
2099,
81,
1347,
842,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_rekove_without_reload() -> Result<()> {
let k: Key<Provider> = Key::random()?;
let v0 = DBView::load(k.clone(), empty::<ReadResult>())?;
let mut writes = vec![];
let id = RecordId::random::<Provider>()?;
let mut w = v0.writer(id);
writes.push(w.truncate()?);
writes.push(w.revoke()?);
let v1 = DBView::load(k, writes.iter().map(write_to_read))?;
assert_eq!(v1.reader().prepare_read(&id)?, PreparedRead::NoSuchRecord);
assert_eq!(v1.all().len(), 1);
assert_eq!(v1.records().count(), 0);
assert_eq!(v1.absolute_balance(), (0, 2));
assert_eq!(v1.chain_ctrs(), vec![(id, 1u64)].into_iter().collect());
assert_eq!(v1.gc().len(), 2);
Ok(())
} | rust_cleaned_test_functions.jsonl/125344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
74,
994,
39904,
79405,
368,
1464,
5714,
71698,
341,
262,
1077,
595,
25,
5309,
27,
5179,
29,
284,
5309,
486,
11463,
94136,
262,
1077,
348,
15,
284,
5952,
851,
486,
1078,
5969,
15997,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_emit_jcc_unsigned_greater() {
let mut buf = MacroAssembler::new();
let lbl = buf.create_label();
emit_jcc(&mut buf, CondCode::UnsignedGreater, lbl);
emit_nop(&mut buf);
buf.bind_label(lbl);
assert_eq!(vec![0x0f, 0x87, 1, 0, 0, 0, 0x90], buf.data());
} | rust_cleaned_test_functions.jsonl/85431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
5374,
638,
67830,
97994,
368,
341,
286,
1077,
5206,
6607,
284,
53317,
77858,
486,
931,
543,
286,
1077,
16421,
284,
6607,
2520,
6106,
543,
286,
16691,
5374,
638,
2099,
6984,
6607,
11,
44826,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exa1_skip_if_not_pressed() {
let mut machine = Machine::new(TestContext::new());
machine.register_set(0xB, 0xD);
machine.key.key_down(0xC);
machine.test_opcode(0xEBA1);
// Should skip next instruction
assert_eq!(machine.pc, PC_BEGIN + 4);
// Should not skip if it is pressed
machine.reset();
machine.register_set(0xB, 0xC);
machine.key.key_down(0xC);
machine.test_opcode(0xEBA1);
assert_eq!(machine.pc, PC_BEGIN + 2);
} | rust_cleaned_test_functions.jsonl/127979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
64,
16,
44830,
11119,
7913,
46178,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
262,
5662,
9929,
2602,
7,
15,
14377,
11,
220,
15,
15764,
317,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_construct_hash() {
assert_eq!(H128::default(), H128::new());
assert_eq!(H128::new(), H128::zero());
assert_eq!(H128::len(), 16);
} | rust_cleaned_test_functions.jsonl/123491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64803,
8950,
368,
341,
197,
6948,
10714,
10297,
39,
16,
17,
23,
486,
2258,
1507,
472,
16,
17,
23,
486,
931,
1423,
197,
6948,
10714,
10297,
39,
16,
17,
23,
486,
931,
1507,
472,
16,
17,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_bytes() {
let (sql, params) = Sqlite::build(Select::default().value(Value::bytes(vec![1, 2, 3]).raw())).unwrap();
assert_eq!("SELECT x'010203'", sql);
assert!(params.is_empty());
} | rust_cleaned_test_functions.jsonl/52926 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
12524,
368,
341,
286,
1077,
320,
3544,
11,
3628,
8,
284,
7224,
632,
486,
5834,
7,
3379,
486,
2258,
1005,
957,
25346,
486,
9651,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
10697,
1041,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_project() {
let project: Project = read_test_file("project");
// Split for clippy's complexity checks.
check_project_a(&project);
check_project_b(&project);
check_project_c(&project);
} | rust_cleaned_test_functions.jsonl/12950 | {
"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,
6443,
16352,
368,
341,
262,
1077,
2390,
25,
5787,
284,
1349,
4452,
2458,
445,
4987,
3071,
262,
442,
27810,
369,
1185,
45749,
594,
23094,
12341,
624,
262,
1779,
16352,
4306,
2099,
4987,
317,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_match_libname() {
assert_eq!(match_libname("liblldb.so"), Some("lldb"));
assert_eq!(match_libname("liblldb-3.8.so"), Some("lldb-3.8"));
assert_eq!(match_libname("liblldbIntelFeatures.so"), None);
} | rust_cleaned_test_functions.jsonl/64725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
16142,
606,
368,
341,
262,
2060,
10714,
10297,
6347,
16142,
606,
445,
2740,
32459,
65,
26476,
3975,
4329,
445,
32459,
65,
4010,
262,
2060,
10714,
10297,
6347,
16142,
606,
445,
2740,
32459,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_output() -> Result<(), EtError> {
let mut out = Vec::new();
assert!(run(["entab"], &b">test\nACGT"[..], io::Cursor::new(&mut out)).is_ok());
assert_eq!(&out[..], b"id\tsequence\ntest\tACGT\n");
Ok(())
} | rust_cleaned_test_functions.jsonl/49291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
368,
1464,
5714,
68843,
18888,
1454,
29,
341,
286,
1077,
5206,
700,
284,
11312,
486,
931,
543,
286,
2060,
10297,
6108,
19065,
306,
370,
7914,
609,
65,
755,
1944,
1699,
1706,
25388,
36864,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drain_filter() {
{
let mut set: HashSet<i32> = (0..8).collect();
let drained = set.drain_filter(|&k| k % 2 == 0);
let mut out = drained.collect::<Vec<_>>();
out.sort_unstable();
assert_eq!(vec![0, 2, 4, 6], out);
assert_eq!(set.len(), 4);
}
{
let mut set: HashSet<i32> = (0..8).collect();
drop(set.drain_filter(|&k| k % 2 == 0));
assert_eq!(set.len(), 4, "Removes non-matching items on drop");
}
} | rust_cleaned_test_functions.jsonl/53018 | {
"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,
26680,
466,
8727,
368,
341,
286,
341,
310,
1077,
5206,
738,
25,
18931,
21897,
18,
17,
29,
284,
320,
15,
496,
23,
568,
17384,
543,
310,
1077,
60408,
284,
738,
950,
29093,
8727,
22428,
5,
74,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_str_local_path() {
let path = "/tmp/local_path.txt";
let res = S3Path::from_str(&path);
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/85012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
13564,
2638,
368,
341,
286,
1077,
1815,
284,
3521,
5173,
22270,
2638,
3909,
876,
286,
1077,
592,
284,
328,
18,
1820,
486,
1499,
2895,
2099,
2343,
317,
286,
2060,
10297,
416,
2079,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cpi() {
let mut state = State8080::empty_state();
state.memory = vec![0xfe, 0x40];
state.a = 0x4a;
state.cc.cy = 1;
state.cc.z = 1;
emulate_8080_op(&mut state);
assert_eq!(state.cc.cy, 0);
assert_eq!(state.cc.z, 0);
assert_eq!(state.program_counter(), 2);
} | rust_cleaned_test_functions.jsonl/7782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2493,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
31469,
11,
220,
15,
87,
19,
15,
935,
286,
1584,
5849,
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_key_derivation() {
// testnet compressed
let sk = PrivateKey::from_wif("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy").unwrap();
assert_eq!(sk.network, Testnet);
assert_eq!(sk.compressed, true);
assert_eq!(&sk.to_wif(), "cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy");
let secp = Secp256k1::new();
let pk = Address::p2pkh(&sk.public_key(&secp), sk.network);
assert_eq!(&pk.to_string(), "mqwpxxvfv3QbM8PU8uBx2jaNt9btQqvQNx");
// test string conversion
assert_eq!(&sk.to_string(), "cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy");
let sk_str =
PrivateKey::from_str("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy").unwrap();
assert_eq!(&sk.to_wif(), &sk_str.to_wif());
// mainnet uncompressed
let sk = PrivateKey::from_wif("5JYkZjmN7PVMjJUfJWfRFwtuXTGB439XV6faajeHPAM9Z2PT2R3").unwrap();
assert_eq!(sk.network, Bitcoin);
assert_eq!(sk.compressed, false);
assert_eq!(&sk.to_wif(), "5JYkZjmN7PVMjJUfJWfRFwtuXTGB439XV6faajeHPAM9Z2PT2R3");
let secp = Secp256k1::new();
let mut pk = sk.public_key(&secp);
assert_eq!(pk.compressed, false);
assert_eq!(&pk.to_string(), "042e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af191923a2964c177f5b5923ae500fca49e99492d534aa3759d6b25a8bc971b133");
assert_eq!(pk, PublicKey::from_str("042e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af191923a2964c177f5b5923ae500fca49e99492d534aa3759d6b25a8bc971b133").unwrap());
let addr = Address::p2pkh(&pk, sk.network);
assert_eq!(&addr.to_string(), "1GhQvF6dL8xa6wBxLnWmHcQsurx9RxiMc8");
pk.compressed = true;
assert_eq!(&pk.to_string(), "032e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af");
assert_eq!(pk, PublicKey::from_str("032e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af").unwrap());
} | rust_cleaned_test_functions.jsonl/15427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
35345,
39127,
368,
341,
286,
442,
1273,
4711,
30649,
198,
286,
1077,
1901,
284,
9679,
1592,
486,
1499,
1670,
333,
445,
66,
53,
83,
19,
78,
22,
33,
16128,
343,
16,
13401,
88,
45540,
38,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accumulate_axis_inplace_noop() {
let mut a = Array2::<u8>::zeros((0, 3));
a.accumulate_axis_inplace(Axis(0), |&prev, curr| *curr += prev);
assert_eq!(a, Array2::zeros((0, 3)));
let mut a = Array2::<u8>::zeros((3, 1));
a.accumulate_axis_inplace(Axis(1), |&prev, curr| *curr += prev);
assert_eq!(a, Array2::zeros((3, 1)));
} | rust_cleaned_test_functions.jsonl/92635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75837,
6334,
23567,
1243,
2007,
6536,
453,
368,
341,
262,
1077,
5206,
264,
284,
2910,
17,
27638,
84,
23,
6831,
35716,
1188,
15,
11,
220,
18,
1106,
262,
264,
13,
98387,
23567,
1243,
2007,
4346,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kth_multiple() {
let test_cases = [
(0, 1),
(1, 3),
(2, 5),
(3, 7),
(4, 9),
(5, 15),
(6, 21),
(7, 25),
(8, 27),
(9, 35),
(100, 35721),
(1000, 82_046_671_875),
];
for case in test_cases {
assert_eq!(kth_multiple(case.0), case.1);
}
} | rust_cleaned_test_functions.jsonl/97312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
339,
45233,
368,
341,
262,
1077,
1273,
41427,
284,
2278,
286,
320,
15,
11,
220,
16,
701,
715,
286,
320,
16,
11,
220,
18,
1326,
286,
320,
17,
11,
220,
20,
1326,
286,
320,
18,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_with_rho_and_sigma() {
let settings = Settings::new(1., array![2., 2.], array![2., 2.], 50, 2, false);
let mut problem_data = ProblemData::new(
CsMat::csc_from_dense(array![[65., 76.], [76., 89.]].view(), f64::EPSILON),
array![7., 3.],
CsMat::csc_from_dense(array![[7., 8.], [5., 4.]].view(), f64::EPSILON),
array![8., 8.],
array![
PiecewiseQuadratic::indicator(f64::NEG_INFINITY, f64::INFINITY),
PiecewiseQuadratic::indicator(f64::NEG_INFINITY, f64::INFINITY),
],
);
let mut variables = Variables::from_problem_data(&problem_data);
let res = optimize_structs(
&settings,
&mut problem_data,
&mut variables,
&SimpleObjRes {},
false,
)
.0
.x;
assert!(res.abs_diff_eq(&array![2.66666651, -1.33333319], 1e-5))
} | rust_cleaned_test_functions.jsonl/49657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
79160,
8378,
49005,
368,
341,
286,
1077,
5003,
284,
11296,
486,
931,
7,
16,
2572,
1334,
20703,
17,
2572,
220,
17,
13,
1125,
1334,
20703,
17,
2572,
220,
17,
13,
1125,
220,
20,
15,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intersection() {
let b1 = Box3D::from_points(&[point3(-15.0, -20.0, -20.0), point3(10.0, 20.0, 20.0)]);
let b2 = Box3D::from_points(&[point3(-10.0, 20.0, 20.0), point3(15.0, -20.0, -20.0)]);
assert!(b1.intersection(&b2).is_some());
let b1 = Box3D::from_points(&[point3(-15.0, -20.0, -20.0), point3(-10.0, 20.0, 20.0)]);
let b2 = Box3D::from_points(&[point3(10.0, 20.0, 20.0), point3(15.0, -20.0, -20.0)]);
assert!(b1.intersection(&b2).is_none());
} | rust_cleaned_test_functions.jsonl/92558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82558,
368,
341,
286,
1077,
293,
16,
284,
8261,
18,
35,
486,
1499,
12928,
2099,
58,
2768,
18,
4080,
16,
20,
13,
15,
11,
481,
17,
15,
13,
15,
11,
481,
17,
15,
13,
15,
701,
1459,
18,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bootstrap_from_matches() {
// Create command line test data
let app = clap_app!(myapp =>
(@arg base_dir: -b --base_dir +takes_value "A path to a directory to store your files")
(@arg config: -c --config +takes_value "A path to the configuration file to use (config.toml)")
(@arg log_config: -l--log_config +takes_value "A path to the logfile configuration (log4rs.yml))")
(@arg init: --init "Create a default configuration file if it doesn't exist")
);
let matches = app.clone().get_matches_from(vec![
"",
"--log_config",
"no-file-created",
"--config",
"no-file-created",
"--base_dir",
"no-dir-created",
"--init",
]);
let bootstrap = ConfigBootstrap::from_matches(&matches).expect("failed to extract matches");
assert!(bootstrap.init);
assert_eq!(bootstrap.base_path.to_str(), Some("no-dir-created"));
assert_eq!(bootstrap.log_config.to_str(), Some("no-file-created"));
assert_eq!(bootstrap.config.to_str(), Some("no-file-created"));
// Check aliases too
let app = clap_app!(myapp =>
(@arg ("base-path"): -b --("base-path") +takes_value "A path to a directory to store your files")
(@arg config: -c --config +takes_value "A path to the configuration file to use (config.toml)")
(@arg ("log-config"): -l --("log-config") +takes_value "A path to the logfile configuration (log4rs.yml))")
(@arg init: --init "Create a default configuration file if it doesn't exist")
);
let matches = app.get_matches_from(vec![
"",
"--log-config",
"no-file-created",
"--base-path",
"no-dir-created",
]);
let bootstrap = ConfigBootstrap::from_matches(&matches).expect("failed to extract matches");
assert!(!bootstrap.init);
assert_eq!(bootstrap.base_path.to_str(), Some("no-dir-created"));
assert_eq!(bootstrap.log_config.to_str(), Some("no-file-created"));
assert_eq!(bootstrap.config.to_str(), Some(""));
} | rust_cleaned_test_functions.jsonl/9032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1015
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88424,
5673,
38344,
368,
341,
286,
442,
4230,
3210,
1555,
1273,
821,
198,
286,
1077,
906,
284,
89577,
8191,
10297,
2408,
676,
6274,
310,
8006,
858,
2331,
4334,
25,
481,
65,
1177,
3152,
4334,
488... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_addhelper() {
let mut x = [1, 2, 3];
let cout = addhelper(&mut x, &[4, 5, 6]);
assert_eq!(x, [5, 7, 9]);
assert!(!cout);
let mut x = [1, 2, 3];
let cout = addhelper(&mut x, &[4, 5]);
assert_eq!(x, [5, 7, 3]);
assert!(!cout);
let mut x = [4, 5, 6];
let cout = addhelper(&mut x, &[1, 2]);
assert_eq!(x, [5, 7, 6]);
assert!(!cout);
// Carry once
let mut x = [3, 5, 6];
let cout = addhelper(&mut x, &[0xFFFFFFFE, 2]);
assert_eq!(x, [1, 8, 6]);
assert!(!cout);
let mut x = [3, 5, 6];
let cout = addhelper(&mut x, &[2, 0xFFFFFFFE]);
assert_eq!(x, [5, 3, 7]);
assert!(!cout);
// Carry twice
let mut x = [3, 0xFFFFFFFE, 6];
let cout = addhelper(&mut x, &[0xFFFFFFFE, 2]);
assert_eq!(x, [1, 1, 7]);
assert!(!cout);
// Carry out
let mut x = [3, 0xFFFFFFFE, 0xFFFFFFFF];
let cout = addhelper(&mut x, &[0xFFFFFFFE, 2]);
assert_eq!(x, [1, 1, 0]);
assert!(cout);
} | rust_cleaned_test_functions.jsonl/9425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 645
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
18764,
368,
341,
286,
1077,
5206,
856,
284,
508,
16,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
5034,
284,
912,
18764,
2099,
6984,
856,
11,
44590,
19,
11,
220,
20,
11,
220,
21,
2558,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_char() {
// 𝄞mus<invalid>ic<invalid>
let v = [
0xD8, 0x34, 0xDD, 0x1E, 0x00, 0x6d, 0x00, 0x75, 0x00, 0x73, 0xDD, 0x1E, 0x00, 0x69, 0x00,
0x63, 0xD8, 0x34,
];
assert_eq!(
utf16be_to_char(&v)
.map(|r| r.map_err(|e| e.unpaired_surrogate()))
.collect::<Vec<_>>(),
vec![
Ok('𝄞'),
Ok('m'),
Ok('u'),
Ok('s'),
Err(0xDD1E),
Ok('i'),
Ok('c'),
Err(0xD834)
]
);
let mut lossy = String::from("𝄞mus");
lossy.push(std::char::REPLACEMENT_CHARACTER);
lossy.push('i');
lossy.push('c');
lossy.push(std::char::REPLACEMENT_CHARACTER);
let r = utf16be_to_string(&v);
if let Err(r) = r {
// FIXME: compare against PdfError::Utf16Decode variant
assert_eq!(r.to_string(), "UTF16 decode error");
}
assert_eq!(utf16be_to_string(&v[..8]).unwrap(), String::from("𝄞mu"));
assert_eq!(utf16be_to_string_lossy(&v).unwrap(), lossy);
} | rust_cleaned_test_functions.jsonl/39684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 760
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
9232,
368,
341,
286,
442,
81250,
226,
252,
37727,
27,
11808,
29,
292,
27,
11808,
397,
286,
1077,
348,
284,
2278,
310,
220,
15,
15764,
23,
11,
220,
15,
87,
18,
19,
11,
220,
15,
82331,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_samples_for_harvest() {
let fs = 44100;
let x_length = 256;
let frame_period = 5.0;
unsafe {
let samples = GetSamplesForHarvest(fs, x_length, frame_period);
assert_eq!(samples, 2);
}
} | rust_cleaned_test_functions.jsonl/20847 | {
"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,
3062,
18297,
5478,
1523,
277,
7019,
368,
341,
10217,
8619,
1843,
284,
220,
19,
19,
16,
15,
15,
280,
10217,
856,
5118,
257,
284,
220,
17,
20,
21,
280,
10217,
4034,
20818,
284,
220,
20,
13,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timeout() {
exec! {
"sleep",
args: ["60"],
timeout: 3000,
log: true,
code: 9, // SIGKILL
stdout: [],
stderr: []
};
} | rust_cleaned_test_functions.jsonl/72687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20537,
368,
341,
262,
3883,
0,
341,
286,
330,
25809,
756,
286,
2827,
25,
4383,
21,
15,
8097,
286,
9632,
25,
220,
18,
15,
15,
15,
345,
286,
1487,
25,
830,
3554,
286,
2038,
25,
220,
24,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mmio_console_config_cmdline_parser() {
let mut vm_config = VmConfig::default();
assert!(parse_virtio_serial(&mut vm_config, "virtio-serial-device").is_ok());
assert!(vm_config
.add_chardev("socket,id=test_console,path=/path/to/socket,server,nowait")
.is_ok());
let virt_console = parse_virtconsole(
&mut vm_config,
"virtconsole,chardev=test_console,id=console1",
);
assert!(virt_console.is_ok());
let console_cfg = virt_console.unwrap();
assert_eq!(console_cfg.id, "console1");
assert_eq!(
console_cfg.chardev.backend,
ChardevType::Socket("/path/to/socket".to_string())
);
let mut vm_config = VmConfig::default();
assert!(
parse_virtio_serial(&mut vm_config, "virtio-serial-device,bus=pcie.0,addr=0x1")
.is_err()
);
assert!(vm_config
.add_chardev("sock,id=test_console,path=/path/to/socket")
.is_err());
let mut vm_config = VmConfig::default();
assert!(parse_virtio_serial(&mut vm_config, "virtio-serial-device").is_ok());
assert!(vm_config
.add_chardev("socket,id=test_console,path=/path/to/socket,server,nowait")
.is_ok());
let virt_console = parse_virtconsole(
&mut vm_config,
"virtconsole,chardev=test_console1,id=console1",
);
// test_console1 does not exist.
assert!(virt_console.is_err());
} | rust_cleaned_test_functions.jsonl/127552 | {
"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,
35599,
815,
51724,
5332,
11684,
1056,
18517,
368,
341,
286,
1077,
5206,
10995,
5332,
284,
647,
76,
2648,
486,
2258,
543,
286,
2060,
10297,
6400,
2273,
2106,
815,
25602,
2099,
6984,
10995,
5332,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_div_roundup() {
assert_eq!(div_roundup(5u8, 2u8), 3u8);
assert_eq!(div_roundup(4u8, 2u8), 2u8);
assert_eq!(div_roundup(4000u32, 1500u32), 3u32);
} | rust_cleaned_test_functions.jsonl/17564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
29896,
454,
368,
341,
262,
2060,
10714,
10297,
611,
29896,
454,
7,
20,
84,
23,
11,
220,
17,
84,
23,
701,
220,
18,
84,
23,
317,
262,
2060,
10714,
10297,
611,
29896,
454,
7,
19,
84,
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_straight_scoring() {
test(
&vec!["2H 3C 4D 5D 6H", "4S AH 3S 2D 5H"],
&vec!["2H 3C 4D 5D 6H"],
)
} | rust_cleaned_test_functions.jsonl/121275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
7386,
13171,
5503,
368,
341,
1066,
262,
1273,
1006,
286,
609,
4083,
0,
1183,
17,
39,
220,
18,
34,
220,
19,
35,
220,
20,
35,
220,
21,
39,
497,
330,
19,
50,
47288,
220,
18,
50,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_options_declaration() {
let b = ast::BaseNode::default();
let pkg = parse_package(
r#"option task = { name: "foo", every: 1h, delay: 10m, cron: "0 2 * * *", retry: 5}"#,
);
let got = test_convert(pkg).unwrap();
let symbols = collect_symbols(&got);
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Option(Box::new(OptionStmt {
loc: b.location.clone(),
assignment: Assignment::Variable(VariableAssgn::new(
Identifier {
loc: b.location.clone(),
name: symbols["task"].clone(),
},
Expression::Object(Box::new(ObjectExpr {
loc: b.location.clone(),
typ: type_info(),
with: None,
properties: vec![
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: symbols["name"].clone(),
},
value: Expression::StringLit(StringLit {
loc: b.location.clone(),
value: "foo".to_string(),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: symbols["every"].clone(),
},
value: Expression::Duration(DurationLit {
loc: b.location.clone(),
value: Duration {
months: 5,
nanoseconds: 5000,
negative: false,
},
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: symbols["delay"].clone(),
},
value: Expression::Duration(DurationLit {
loc: b.location.clone(),
value: Duration {
months: 1,
nanoseconds: 50,
negative: true,
},
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: symbols["cron"].clone(),
},
value: Expression::StringLit(StringLit {
loc: b.location.clone(),
value: "0 2 * * *".to_string(),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: symbols["retry"].clone(),
},
value: Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 5,
}),
},
],
})),
b.location.clone(),
)),
}))],
}],
};
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/131372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3562
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
8743,
77926,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
4715,
26328,
1006,
310,
435,
55543,
2047,
3383,
284,
314,
829,
25,
330,
7975,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_fizz_or_buzz() {
let three_four = FizzBuzz::new(3, 4);
let two_five = FizzBuzz::new(2, 5);
assert_eq!("59", three_four.get_value(59));
assert_eq!("3", two_five.get_value(3));
assert_eq!("143", two_five.get_value(143));
} | rust_cleaned_test_functions.jsonl/74961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
761,
8759,
8734,
880,
8889,
368,
341,
286,
1077,
2326,
56142,
284,
434,
8759,
59473,
486,
931,
7,
18,
11,
220,
19,
317,
286,
1077,
1378,
95258,
284,
434,
8759,
59473,
486,
931,
7,
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_non_finite_floats() {
let mut tokens = json_token_iter(b"inf");
tokens
.next()
.expect("there is a token")
.expect_err("but it is invalid, ensure that Rust float boundary cases don't parse");
} | rust_cleaned_test_functions.jsonl/58151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
761,
15856,
17586,
82,
368,
341,
286,
1077,
5206,
11211,
284,
2951,
6458,
11723,
1883,
1,
13573,
797,
286,
11211,
198,
310,
659,
3600,
741,
310,
659,
17119,
445,
18532,
374,
264,
3950,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_error_cases() {
let mut event_manager = EventManager::new().unwrap();
let mut net = Net::default_net(TestMutators::default());
let mem = Net::default_guest_memory();
let (rxq, txq) = Net::virtqueues(&mem);
net.assign_queues(rxq.create_queue(), txq.create_queue());
net.activate(mem.clone()).unwrap();
// RX rate limiter events should error since the limiter is not blocked.
// Validate that the event failed and failure was properly accounted for.
let rx_rate_limiter_ev =
EpollEvent::new(EventSet::IN, net.rx_rate_limiter.as_raw_fd() as u64);
check_metric_after_block!(
&METRICS.net.event_fails,
1,
net.process(&rx_rate_limiter_ev, &mut event_manager)
);
// TX rate limiter events should error since the limiter is not blocked.
// Validate that the event failed and failure was properly accounted for.
let tx_rate_limiter_ev =
EpollEvent::new(EventSet::IN, net.tx_rate_limiter.as_raw_fd() as u64);
check_metric_after_block!(
&METRICS.net.event_fails,
1,
net.process(&tx_rate_limiter_ev, &mut event_manager)
);
} | rust_cleaned_test_functions.jsonl/72369 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
4096,
41427,
368,
341,
286,
1077,
5206,
1538,
12144,
284,
3665,
2043,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
4179,
284,
9374,
486,
2258,
19722,
31159,
51440,
2973,
486,
2258,
1423,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ipblock_intersects() {
assert_eq!(IpBlock::new(5, 6).intersects(&IpBlock::new(4, 9)), true);
assert_eq!(IpBlock::new(4, 9).intersects(&IpBlock::new(5, 6)), true);
assert_eq!(IpBlock::new(2, 4).intersects(&IpBlock::new(5, 8)), false);
} | rust_cleaned_test_functions.jsonl/109568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10385,
4574,
15318,
54429,
368,
341,
286,
2060,
10714,
10297,
23378,
4713,
486,
931,
7,
20,
11,
220,
21,
568,
2245,
54429,
2099,
23378,
4713,
486,
931,
7,
19,
11,
220,
24,
5731,
830,
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_text_performance() {
let width = 1000;
let height = 1000;
let mut surface = Surface::new_raster_n32_premul(ISize::new(width, height)).unwrap();
let canvas = surface.canvas();
let font = Font::new(
Typeface::new("Source Sans Pro", FontStyle::normal()).unwrap(),
Some(14.0),
);
let now = Instant::now();
for _ in 0..25000 {
let text_blob = TextBlob::from_str("HelloHelloHelloHello", &font).unwrap();
canvas.draw_text_blob(
&text_blob,
Point::new(10.0, 10.0),
Paint::default()
.set_color(Color::BLACK)
.set_anti_alias(true),
);
}
let new_now = Instant::now();
println!("{:?}", new_now.duration_since(now));
} | rust_cleaned_test_functions.jsonl/81983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 458
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
84833,
368,
341,
286,
1077,
2374,
284,
220,
16,
15,
15,
15,
280,
286,
1077,
2608,
284,
220,
16,
15,
15,
15,
401,
286,
1077,
5206,
7329,
284,
26963,
486,
931,
1710,
2300,
1089,
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... | 2 |
#[test]
fn test_a_ray_when_the_camera_is_transformed() {
let mut camera = camera::Camera::new(201, 101, std::f64::consts::PI / 2.0);
let transform = matrix::Matrix4::IDENTITY
.translation(0.0, -2.0, 5.0)
.rotation_y(std::f64::consts::PI / 4.0);
camera.transform = transform;
let ray = camera.ray_for_pixel(100, 50);
assert_tuple_approx_eq!(ray.origin, tuple::Point::new(0.0, 2.0, -5.0));
assert_tuple_approx_eq!(
ray.direction,
tuple::Vector::new(2.0_f64.sqrt() / 2.0, 0.0, -2.0_f64.sqrt() / 2.0,)
);
} | rust_cleaned_test_functions.jsonl/116189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
72690,
47636,
16068,
29843,
6892,
18449,
291,
368,
341,
286,
1077,
5206,
6249,
284,
6249,
486,
13445,
486,
931,
7,
17,
15,
16,
11,
220,
16,
15,
16,
11,
1460,
486,
69,
21,
19,
486,
9577... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json() {
use serialize::json::{Json, List, U64};
let ctx = TestContext::new();
let con = ctx.connection();
redis::cmd("SET").arg("foo").arg("[1, 2, 3]").execute(&con);
let json : Json = redis::cmd("GET").arg("foo").query(&con).unwrap();
assert_eq!(json, List(vec![
U64(1),
U64(2),
U64(3),
]));
} | rust_cleaned_test_functions.jsonl/31505 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
368,
341,
262,
990,
24235,
486,
2236,
22964,
5014,
11,
1759,
11,
547,
21,
19,
2315,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
390,
284,
5635,
20310,
1428,
262,
20870,
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_fmt() {
let fields = OptionalFields::default();
assert_eq!(fields.to_string(), "");
let fields = OptionalFields::from(vec![String::from("n")]);
assert_eq!(fields.to_string(), "n");
let fields = OptionalFields::from(vec![String::from("n"), String::from("d")]);
assert_eq!(fields.to_string(), "n\td");
} | rust_cleaned_test_functions.jsonl/36907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
368,
341,
286,
1077,
5043,
284,
12256,
8941,
486,
2258,
543,
286,
2060,
10714,
10297,
9007,
2389,
3904,
1507,
50970,
286,
1077,
5043,
284,
12256,
8941,
486,
1499,
25592,
20703,
703,
486,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_littleendian() {
let mut storage = vec![0; 1024];
type Field1 = PrimitiveField<i32, LittleEndian, 5>;
type Field2 = PrimitiveField<i32, LittleEndian, 20>;
Field1::write(&mut storage, 10i32.pow(8));
Field2::write(&mut storage, -(10i32.pow(7)));
assert_eq!(
10i32.pow(8),
i32::from_le_bytes((&storage[5..9]).try_into().unwrap())
);
assert_eq!(
-(10i32.pow(7)),
i32::from_le_bytes((&storage[20..24]).try_into().unwrap())
);
assert_eq!(10i32.pow(8), Field1::read(&storage));
assert_eq!(-(10i32.pow(7)), Field2::read(&storage));
assert_eq!(Some(4), PrimitiveField::<i32, LittleEndian, 5>::SIZE);
assert_eq!(Some(4), PrimitiveField::<i32, LittleEndian, 5>::SIZE);
} | rust_cleaned_test_functions.jsonl/35721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
18,
17,
907,
2377,
408,
1103,
368,
341,
286,
1077,
5206,
5819,
284,
7486,
20703,
15,
26,
220,
16,
15,
17,
19,
4821,
286,
943,
8601,
16,
284,
51460,
1877,
21897,
18,
17,
11,
14671,
4323... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sequence_iter_is_stable() {
let data = [0; 32];
for data_size in 0..32 {
let event = LV2AtomEventBuilder::<32>::new(0, 0, &data[..data_size]).unwrap();
for capacity in 0..1024 {
let mut sequence = LV2AtomSequence::new(&test_features(), capacity);
while sequence.push_event(&event).is_ok() {}
for event in sequence.iter() {
assert_eq!(event.data, &data[..data_size]);
}
}
}
} | rust_cleaned_test_functions.jsonl/80318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23735,
11723,
6892,
1261,
480,
368,
341,
286,
1077,
821,
284,
508,
15,
26,
220,
18,
17,
935,
286,
369,
821,
2368,
304,
220,
15,
496,
18,
17,
341,
310,
1077,
1538,
284,
39169,
17,
35836,
1556... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_integer() {
assert_eq!(integer("0"), Ok(("", 0)));
assert_eq!(integer("0123456789"), Ok(("", 123456789)));
assert_eq!(integer("0123_456_789"), Ok(("", 123456789)));
assert_eq!(integer("0123_456_789_"), Ok(("", 123456789)));
assert_eq!(integer("+0123456789"), Ok(("", 123456789)));
assert_eq!(integer("-0123456789"), Ok(("", -123456789)));
assert!(integer("?0123456789").is_err());
assert!(integer("_0123456789").is_err());
assert!(integer("a").is_err());
assert!(integer("--").is_err());
} | rust_cleaned_test_functions.jsonl/116070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31725,
368,
341,
286,
2060,
10714,
10297,
11662,
445,
15,
3975,
7622,
7,
19814,
220,
15,
4945,
286,
2060,
10714,
10297,
11662,
445,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
3975,
7622,
7,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_error_autoscaling_delete_policy() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/error",
"autoscaling-delete-policy.xml",
);
let mock = MockRequestDispatcher::with_status(400).with_body(&mock_response);
let client =
AutoscalingClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DeletePolicyType::default();
let result = client.delete_policy(request).sync();
assert!(!result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/8935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4096,
32808,
436,
81552,
11353,
22773,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
41737,
756,
310,
330,
79301,
81552,
40904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_custom_with_preceding_whitespace() {
let s = "1d{ 1,\t1, \t0,\t \t0,\t -1, -1}";
let roll: Roll = s.parse().expect("Bad parse");
assert_eq!(roll.sides, 6);
assert_eq!(roll.values, vec![1, 1, 0, 0, -1, -1]);
} | rust_cleaned_test_functions.jsonl/52852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15875,
6615,
10442,
1998,
287,
86175,
368,
341,
286,
1077,
274,
284,
330,
16,
67,
90,
220,
16,
26266,
83,
16,
11,
1124,
83,
15,
26266,
83,
1124,
83,
15,
26266,
83,
481,
16,
11,
256,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dir_path() {
t!(s: Path::new("hi\\there").dir_path(), "hi");
t!(s: Path::new("hi").dir_path(), ".");
t!(s: Path::new("\\hi").dir_path(), "\\");
t!(s: Path::new("\\").dir_path(), "\\");
t!(s: Path::new("..").dir_path(), "..");
t!(s: Path::new("..\\..").dir_path(), "..\\..");
// dir_path is just dirname interpreted as a path.
// No need for extended tests
} | rust_cleaned_test_functions.jsonl/102779 | {
"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,
4334,
2638,
368,
341,
286,
259,
10297,
82,
25,
7933,
486,
931,
445,
6023,
3422,
18532,
1827,
3741,
2638,
1507,
330,
6023,
797,
286,
259,
10297,
82,
25,
7933,
486,
931,
445,
6023,
1827,
3741,
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_virtio_pmem() {
test_block!(tb, "", {
let mut clear = ClearDiskConfig::new();
let guest = Guest::new(&mut clear);
let mut workload_path = dirs::home_dir().unwrap();
workload_path.push("workloads");
let mut kernel_path = workload_path.clone();
kernel_path.push("vmlinux");
let mut child = Command::new("target/debug/cloud-hypervisor")
.args(&["--cpus", "1"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", kernel_path.to_str().unwrap()])
.args(&[
"--disk",
guest
.disk_config
.disk(DiskType::OperatingSystem)
.unwrap()
.as_str(),
guest
.disk_config
.disk(DiskType::CloudInit)
.unwrap()
.as_str(),
])
.args(&["--net", guest.default_net_string().as_str()])
.args(&[
"--pmem",
format!(
"file={},size={}",
guest.disk_config.disk(DiskType::RawOperatingSystem).unwrap(),
fs::metadata(&guest.disk_config.disk(DiskType::RawOperatingSystem).unwrap()).unwrap().len()
)
.as_str(),
])
.args(&["--cmdline", "root=PARTUUID=3cb0e0a5-925d-405e-bc55-edf0cec8f10a console=tty0 console=ttyS0,115200n8 console=hvc0 quiet init=/usr/lib/systemd/systemd-bootchart initcall_debug tsc=reliable no_timer_check noreplace-smp cryptomgr.notests rootfstype=ext4,btrfs,xfs kvm-intel.nested=1 rw"])
.spawn()
.unwrap();
thread::sleep(std::time::Duration::new(20, 0));
// Check for the presence of /dev/pmem0
aver_eq!(
tb,
guest
.ssh_command("ls /dev/pmem0")
.unwrap_or_default()
.trim(),
"/dev/pmem0"
);
guest.ssh_command("sudo reboot")?;
thread::sleep(std::time::Duration::new(10, 0));
let _ = child.kill();
let _ = child.wait();
Ok(())
});
} | rust_cleaned_test_functions.jsonl/55948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1463
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
620,
10536,
368,
341,
286,
1273,
7113,
10297,
18387,
11,
7342,
341,
310,
1077,
5206,
2797,
284,
12023,
47583,
2648,
486,
931,
543,
310,
1077,
8640,
284,
26215,
486,
931,
2099,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_process_fame() {
crate::grit_test::set_test_logging(LOG_LEVEL);
let td: TempDir = crate::grit_test::init_repo();
let path = td.path().to_str().unwrap();
let args = FameArgs::new(
String::from(path),
Some("loc".to_string()),
None,
None,
None,
None,
None,
false,
None,
);
let f = Fame::new(args);
let result = match f.process() {
Ok(()) => true,
Err(_t) => false,
};
assert!(result, "test_process_file result was {}", result);
} | rust_cleaned_test_functions.jsonl/5819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
761,
373,
368,
341,
286,
17717,
486,
901,
275,
4452,
486,
746,
4452,
59982,
24850,
17415,
626,
286,
1077,
17941,
25,
19944,
6184,
284,
17717,
486,
901,
275,
4452,
486,
2327,
37784,
543,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_slice_to() {
let vec: &[int] = &[1, 2, 3, 4];
assert_eq!(vec[..4], vec);
let b: &[int] = &[1, 2];
assert_eq!(vec[..2], b);
let b: &[int] = &[];
assert_eq!(vec[..0], b);
} | rust_cleaned_test_functions.jsonl/31830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
2346,
368,
341,
286,
1077,
7486,
25,
44590,
396,
60,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
2060,
10714,
10297,
4083,
95874,
19,
1125,
7486,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_runnables_impl_mod() {
check(
r#"
//- /lib.rs
mod foo;
//- /foo.rs
struct Foo;$0
impl Foo {
/// ```
/// let x = 5;
/// ```
fn foo() {}
}
"#,
&[DocTest],
expect![[r#"
[
Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
1,
),
full_range: 27..81,
name: "foo",
},
kind: DocTest {
test_id: Path(
"foo::Foo::foo",
),
},
cfg: None,
},
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/22198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 706
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
14007,
77,
4788,
21007,
7480,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
280,
61463,
608,
7975,
25638,
198,
1235,
33428,
25675,
15,
198,
6383,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispatch_stack_zero_copy_bufs() {
let (mut isolate, dispatch_count) = setup(Mode::AsyncZeroCopy(2));
js_check(isolate.execute(
"filename.js",
r#"
let zero_copy_a = new Uint8Array([0]);
let zero_copy_b = new Uint8Array([1]);
Deno.core.send(1, zero_copy_a, zero_copy_b);
"#,
));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
} | rust_cleaned_test_functions.jsonl/23801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
15528,
19359,
16096,
10363,
82,
368,
341,
262,
1077,
320,
6984,
42123,
11,
6845,
3180,
8,
284,
6505,
3189,
534,
486,
6525,
17999,
12106,
7,
17,
1106,
262,
6994,
7200,
82669,
7769,
1006,
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_op_logic() {
let lexer = Lexer::new("a && b || c && !d");
let actual: Vec<TokType> = lexer.map(|t| t.0).collect();
let expected = vec![
TokType::Iden("a".to_string()),
TokType::And,
TokType::Iden("b".to_string()),
TokType::Or,
TokType::Iden("c".to_string()),
TokType::And,
TokType::Not,
TokType::Iden("d".to_string()),
];
assert_eq!(actual, expected)
} | rust_cleaned_test_functions.jsonl/24698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
54335,
368,
341,
286,
1077,
53259,
284,
85082,
486,
931,
445,
64,
1009,
293,
1369,
272,
1009,
753,
67,
797,
286,
1077,
5042,
25,
11312,
3125,
562,
929,
29,
284,
53259,
4770,
22428,
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_selection_sort() {
let mut arr1: [i64; 4] = [21, -4, 6, 12];
let arr1_sorted: [i64; 4] = [-4, 6, 12, 21];
assert_eq!(sorting::selection_sort(&mut arr1), arr1_sorted);
} | rust_cleaned_test_functions.jsonl/130156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23672,
18435,
368,
341,
262,
1077,
5206,
2890,
16,
25,
508,
72,
21,
19,
26,
220,
19,
60,
284,
508,
17,
16,
11,
481,
19,
11,
220,
21,
11,
220,
16,
17,
935,
262,
1077,
2890,
16,
41277,
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_read_i64_positive() -> IonResult<()> {
let mut cursor = ion_cursor_for(&[0x21, 0x01]);
assert_eq!(cursor.next()?, Some(Value(IonType::Integer, false)));
assert_eq!(cursor.read_i64()?, Some(1i64));
Ok(())
} | rust_cleaned_test_functions.jsonl/82734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
5318,
21,
19,
54160,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
5206,
8128,
284,
27672,
28601,
5478,
2099,
58,
15,
87,
17,
16,
11,
220,
15,
87,
15,
16,
2558,
286,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_attachment() {
let value = Attachment {
filename: "a.png".to_owned(),
height: Some(184),
id: AttachmentId(700_000_000_000_000_000),
proxy_url: "https://cdn.example.com/1.png".to_owned(),
size: 13_593,
url: "https://example.com/1.png".to_owned(),
width: Some(184),
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "Attachment",
len: 7,
},
Token::Str("filename"),
Token::Str("a.png"),
Token::Str("height"),
Token::Some,
Token::U64(184),
Token::Str("id"),
Token::NewtypeStruct {
name: "AttachmentId",
},
Token::Str("700000000000000000"),
Token::Str("proxy_url"),
Token::Str("https://cdn.example.com/1.png"),
Token::Str("size"),
Token::U64(13_593),
Token::Str("url"),
Token::Str("https://example.com/1.png"),
Token::Str("width"),
Token::Some,
Token::U64(184),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/21424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 837
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40868,
368,
341,
286,
1077,
897,
284,
55748,
341,
310,
3899,
25,
330,
64,
3508,
3263,
983,
51973,
3148,
310,
2608,
25,
4329,
7,
16,
23,
19,
1326,
310,
877,
25,
55748,
764,
7,
22,
15,
15,
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_prepare() {
let expr = SuffixExpr::new("key", "Rust").prepare();
let expected = SuffixExpr::<Escaped> {
column: Cow::Borrowed("key"),
target: Cow::Borrowed("Rust"),
_marker: PhantomData,
};
assert_eq!(expected, expr)
} | rust_cleaned_test_functions.jsonl/122491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47460,
368,
341,
286,
1077,
15169,
284,
328,
13554,
16041,
486,
931,
445,
792,
497,
330,
49,
590,
1827,
13609,
543,
286,
1077,
3601,
284,
328,
13554,
16041,
27638,
36121,
10185,
29,
341,
310,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_rpool_r1_ok() {
let result = fill_rpool(
"[\"312a8e55996f72a708929e68c7c0f4dcdcdcddb35d512f9ded388bcd7dce8633\"]".to_string(),
"[\"0260b63daf0f1576b1275f4713c2393dd0de89abbc14e70c7b1e209f5a9fbb69f0\"]".to_string(),
Curve::Secp256r1,
"{\"n\":\"9e2f24f407914eff43b7c7df083c5cc9765c05386485e9e9aa55e7b039290300ba39e86f399e2b338fad4bb34a4d7a7a0cd14fd28503eeebb73ff38e8164616942113afadaeaba525bd4cfdafc4ddd3b012d3fbcd9f276acbad4379b8b93bc4f4d6ddc0a2b9af36b34771595f0e6cb62987b961d83f49ba6ec4b088a1350b3dbbea3e21033801f6c4b212ecd830b5b81075effd06b47feecf18f3c9093662c918073dd95a525b4f99478512ea3bf085993c9bf65922d42b65b338431711dddb5491c2004548df31ab6092ec58db564c8a88a309b0f734171de1f8f4361d5f883e38d5bf519dc347036910aec3c80f2058fa8945c38787094f3450774e2b23129\"}".to_string(),
);
let (success, _): (bool, String) = serde_json::from_str(&result).unwrap();
assert!(success);
} | rust_cleaned_test_functions.jsonl/49756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 579
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
1710,
10285,
1710,
16,
19817,
368,
341,
286,
1077,
1102,
284,
5155,
1710,
10285,
1006,
310,
10545,
2105,
18,
16,
17,
64,
23,
68,
20,
20,
24,
24,
21,
69,
22,
17,
64,
22,
15,
23,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_point_regular_points() {
// Conversion to/from degrees has a little more variability than the default EPSILON.
const EPSILON: f64 = 1e-13;
let center = Point::from(LatLng::new(Deg(80.).into(), Deg(135.).into()));
let radius = Angle::from(Deg(20.));
let pts = regular_points(¢er, radius, 4);
assert_eq!(4, pts.len());
let lls = pts.iter().map(|p| LatLng::from(p)).collect::<Vec<_>>();
let cll = LatLng::from(¢er);
// Make sure that the radius is correct.
let want_dist = 20.;
for ll in lls.iter() {
let got = cll.distance(ll).deg();
assert!(f64_near(want_dist, got, EPSILON));
}
let want_angle = PI / 2.;
// Make sure the angle between each point is correct.
for i in 0..4 {
let v0 = pts[(4 + i + 1) % 4];
let v1 = pts[(4 + i) % 4];
let v2 = pts[(4 + i - 1) % 4];
assert!(f64_near(
want_angle,
((v0 - v1).0.angle(&(v2 - v1).0)).rad(),
EPSILON
));
}
// Make sure that all edges of the polygon have the same length.
let want_len = 27.990890717782829;
for i in 0..4 {
let ll1 = &lls[i];
let ll2 = &lls[(i + 1) % 4];
assert!(f64_near(want_len, ll1.distance(ll2).deg(), EPSILON));
}
// Spot check an actual coordinate now that we know the points are spaced
// evenly apart at the same angles and radii.
assert!(f64_near(lls[0].lat.deg(), 62.162880741097204, EPSILON));
assert!(f64_near(lls[0].lng.deg(), 103.11051028343407, EPSILON));
} | rust_cleaned_test_functions.jsonl/70562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 868
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
49443,
12928,
368,
341,
286,
442,
42509,
311,
91106,
12348,
702,
264,
2632,
803,
53609,
1091,
279,
1638,
40607,
55016,
624,
286,
733,
40607,
55016,
25,
282,
21,
19,
284,
220,
16,
68,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_fastq_reader() {
// try different initial capacities to test
// buffer growing feature
for cap in 3..100 {
let mut exp_iter = EXPECTED.iter();
let mut reader = Reader::with_capacity(FASTQ, cap);
while let Some(&(id, desc, head, seq, qual)) = exp_iter.next() {
let record = reader
.next()
.unwrap()
.expect(&format!("Error reading record at cap. {}", cap));
assert_eq!(record.id(), id, "ID mismatch at cap. {}", cap);
assert_eq!(record.desc(), desc, "desc mismatch at cap. {}", cap);
assert_eq!(record.head(), head, "head mismatch at cap. {}", cap);
assert_eq!(record.seq(), seq, "seq at cap. {}", cap);
assert_eq!(record.qual(), qual, "qual mismatch at cap. {}", cap);
let owned = record.to_owned_record();
assert_eq!(owned.id(), id, "ID mismatch at cap. {}", cap);
assert_eq!(owned.desc(), desc, "desc mismatch at cap. {}", cap);
assert_eq!(owned.head(), head, "head mismatch at cap. {}", cap);
assert_eq!(owned.seq(), seq, "seq at cap. {}", cap);
assert_eq!(owned.qual(), qual, "qual mismatch at cap. {}", cap);
}
assert!(reader.next().is_none());
}
} | rust_cleaned_test_functions.jsonl/40330 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35743,
80,
22306,
368,
341,
262,
442,
1430,
2155,
2856,
58439,
311,
1273,
198,
262,
442,
4147,
7826,
4565,
198,
262,
369,
2062,
304,
220,
18,
496,
16,
15,
15,
341,
286,
1077,
5206,
1343,
11723... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_look_at_lh_no_displacement_or_rotation() {
let eye = Point3::new(0.0, 0.0, 0.0);
let target = Point3::new(0.0, 0.0, 1.0);
let up = Vector3::unit_y();
let look_at = Matrix4x4::look_at_lh(&eye, &target, &up);
let direction = target - Point3::origin();
let expected = Vector4::new(0.0, 0.0, 1.0, 0.0);
let result = look_at * direction.normalize().extend(0.0);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24271,
3752,
907,
71,
6536,
9932,
16101,
8734,
44813,
368,
341,
286,
1077,
7912,
284,
5126,
18,
486,
931,
7,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
317,
286,
1077,
2169,
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_buf_writer_seek() {
let mut buf = [0 as u8, ..8];
{
let mut writer = BufWriter::new(&mut buf);
assert_eq!(writer.tell(), Ok(0));
writer.write(&[1]).unwrap();
assert_eq!(writer.tell(), Ok(1));
writer.seek(2, SeekSet).unwrap();
assert_eq!(writer.tell(), Ok(2));
writer.write(&[2]).unwrap();
assert_eq!(writer.tell(), Ok(3));
writer.seek(-2, SeekCur).unwrap();
assert_eq!(writer.tell(), Ok(1));
writer.write(&[3]).unwrap();
assert_eq!(writer.tell(), Ok(2));
writer.seek(-1, SeekEnd).unwrap();
assert_eq!(writer.tell(), Ok(7));
writer.write(&[4]).unwrap();
assert_eq!(writer.tell(), Ok(8));
}
let b: &[_] = &[1, 3, 2, 0, 0, 0, 0, 4];
assert_eq!(buf, b);
} | rust_cleaned_test_functions.jsonl/7086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10363,
28908,
74473,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
438,
575,
23,
11,
5241,
23,
935,
286,
341,
310,
1077,
5206,
6916,
284,
69013,
6492,
486,
931,
2099,
6984,
6607,
317,
310,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_id_includes_content_hash() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let mut block = get_block(&mut rng);
let mut bytes = [0u8; 32];
rng.fill_bytes(&mut bytes);
let wrong_content_hash = BlockContentsHash(bytes);
block.contents_hash = wrong_content_hash;
assert!(!block.is_block_id_valid());
} | rust_cleaned_test_functions.jsonl/4206 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
842,
1243,
7396,
7495,
8950,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
2558,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_var_call() {
assert_eq!(
super::parse("{{ function(\"123\", 3) }}", &Syntax::default()).unwrap(),
vec![Node::Expr(
Ws(false, false),
Expr::VarCall("function", vec![Expr::StrLit("123"), Expr::NumLit("3")]),
)],
);
} | rust_cleaned_test_functions.jsonl/50224 | {
"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,
21039,
4612,
13429,
368,
341,
286,
2060,
10714,
33673,
310,
2256,
486,
6400,
445,
2979,
729,
36014,
16,
17,
18,
16215,
220,
18,
8,
3869,
497,
609,
33890,
486,
2258,
6011,
15454,
3148,
310,
7486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rle_decode_bool() {
// RLE test data: 50 1s followed by 50 0s
let data1 = ByteBufferPtr::new(vec![0x64, 0x01, 0x64, 0x00]);
// 100 / 8 = 13 groups
let data2 = ByteBufferPtr::new(vec![
0x1B, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x0A,
]);
let mut decoder: RleDecoder = RleDecoder::new(1);
decoder.set_data(data1);
let mut buffer = vec![false; 100];
let mut expected = vec![];
for i in 0..100 {
if i < 50 {
expected.push(true);
} else {
expected.push(false);
}
}
let result = decoder.get_batch::<bool>(&mut buffer);
assert!(result.is_ok());
assert_eq!(buffer, expected);
decoder.set_data(data2);
let mut buffer = vec![false; 100];
let mut expected = vec![];
for i in 0..100 {
if i % 2 == 0 {
expected.push(false);
} else {
expected.push(true);
}
}
let result = decoder.get_batch::<bool>(&mut buffer);
assert!(result.is_ok());
assert_eq!(buffer, expected);
} | rust_cleaned_test_functions.jsonl/72788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 709
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
273,
15227,
22159,
368,
341,
286,
442,
431,
867,
1273,
821,
25,
220,
20,
15,
220,
16,
82,
8110,
553,
220,
20,
15,
220,
15,
82,
8945,
286,
1077,
821,
16,
284,
50299,
5348,
486,
931,
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... | 5 |
#[test]
fn test_link_signal() {
assert_eq!(
GiDocgen::from_str("[signal@Gtk.RecentManager::changed]"),
Ok(GiDocgen::Signal {
namespace: Some("Gtk".to_string()),
type_: "RecentManager".to_string(),
name: "changed".to_string(),
})
);
assert_eq!(
GiDocgen::from_str("[signal@Gtk.RecentManager]"),
Err(GiDocgenError::BrokenLinkType("signal".to_string()))
);
assert_eq!(
GiDocgen::from_str("[signal@Gtk.RecentManager::]"),
Err(GiDocgenError::BrokenLinkType("signal".to_string()))
);
assert_eq!(
GiDocgen::from_str("[signal@Gtk.RecentManager:]"),
Err(GiDocgenError::BrokenLinkType("signal".to_string()))
);
} | rust_cleaned_test_functions.jsonl/78475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
21137,
368,
341,
286,
2060,
10714,
33673,
310,
15392,
9550,
4370,
486,
1499,
2895,
10937,
26622,
31,
45103,
2817,
1168,
2043,
486,
17353,
60,
4461,
310,
7622,
6699,
72,
9550,
4370,
486,
2681... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ldx() {
let mut r = Register::new();
let mut b = MockBus::new();
b.memory[0xA5] = 0xFF;
ldx(0xA5, &mut r, &mut b);
assert_eq!(r.get_X(),0xFF)
} | rust_cleaned_test_functions.jsonl/14182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50573,
87,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
1077,
5206,
293,
284,
14563,
15073,
486,
931,
543,
262,
293,
36611,
58,
15,
14673,
20,
60,
284,
220,
15,
9264,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_quit() {
let mut s = Stack::new();
let res = s.eval(Op::Quit);
assert!(res.is_err());
if let Err(Error::Quit) = res {
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/34528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
72424,
368,
341,
286,
1077,
5206,
274,
284,
14284,
486,
931,
1428,
286,
1077,
592,
284,
274,
31710,
54494,
486,
42856,
317,
286,
2060,
10297,
416,
2079,
9266,
1423,
286,
421,
1077,
15495,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_file_requests() {
let root_id = uuid::Uuid::parse_str("00000000-0000-0000-0000-000000000000");
let root_id = root_id.expect("Couldn't parse uuid.");
let main = Path { root_id, segments: vec!["Main.txt".into()] };
let target = Path { root_id, segments: vec!["Target.txt".into()] };
let path_main = json!({"path" : {
"rootId" : "00000000-0000-0000-0000-000000000000",
"segments" : ["Main.txt"]
}
});
let from_main_to_target = json!({
"from" : {
"rootId" : "00000000-0000-0000-0000-000000000000",
"segments" : ["Main.txt"]
},
"to" : {
"rootId" : "00000000-0000-0000-0000-000000000000",
"segments" : ["Target.txt"]
}
});
let file_exists_json = json!({"exists":true});
let unit_json = json!(null);
test_request(
|client| client.copy_file(&main, &target),
"file/copy",
from_main_to_target.clone(),
unit_json.clone(),
(),
);
test_request(
|client| client.delete_file(&main),
"file/delete",
path_main.clone(),
unit_json.clone(),
(),
);
test_request(
|client| client.file_exists(&main),
"file/exists",
path_main.clone(),
file_exists_json,
response::FileExists { exists: true },
);
let list_response_json = json!({
"paths" : [
{
"type" : "File",
"name" : "foo.txt",
"path" : {
"rootId" : "00000000-0000-0000-0000-000000000000",
"segments" : []
}
},
{
"type" : "File",
"name" : "bar.txt",
"path" : {
"rootId" : "00000000-0000-0000-0000-000000000000",
"segments" : []
}
}
]
});
let list_response_value = response::FileList {
paths: vec![
FileSystemObject::File {
name: "foo.txt".into(),
path: Path { root_id, segments: default() },
},
FileSystemObject::File {
name: "bar.txt".into(),
path: Path { root_id, segments: default() },
},
],
};
test_request(
|client| client.file_list(&main),
"file/list",
path_main.clone(),
list_response_json,
list_response_value,
);
test_request(
|client| client.move_file(&main, &target),
"file/move",
from_main_to_target,
unit_json.clone(),
(),
);
let read_response_json = json!({"contents":"Hello world!"});
let read_response = response::Read { contents: "Hello world!".into() };
test_request(
|client| client.read_file(&main),
"file/read",
path_main.clone(),
read_response_json,
read_response,
);
let parse_rfc3339 = |s| chrono::DateTime::parse_from_rfc3339(s).unwrap();
let file_system_object = FileSystemObject::File {
name: "test.txt".into(),
path: Path { root_id, segments: default() },
};
let file_system_object_json = json!({
"type" : "File",
"name" : "test.txt",
"path" : {
"rootId" : "00000000-0000-0000-0000-000000000000",
"segments" : []
}
});
let expected_attributes = response::FileInfo {
attributes: FileAttributes {
creation_time: parse_rfc3339("2020-01-07T21:25:26Z"),
last_access_time: parse_rfc3339("2020-01-21T22:16:51.123994500+00:00"),
last_modified_time: parse_rfc3339("2020-01-07T21:25:26Z"),
kind: file_system_object.clone(),
byte_size: 125125,
},
};
let sample_attributes_json = json!({ "attributes" : {
"creationTime" : "2020-01-07T21:25:26Z",
"lastAccessTime" : "2020-01-21T22:16:51.123994500+00:00",
"lastModifiedTime" : "2020-01-07T21:25:26Z",
"kind" : file_system_object_json,
"byteSize" : 125125
}});
test_request(
|client| client.file_info(&main),
"file/info",
path_main,
sample_attributes_json,
expected_attributes,
);
let create_file_json = json!({ "object": file_system_object_json });
test_request(
|client| client.create_file(&file_system_object),
"file/create",
create_file_json,
unit_json.clone(),
(),
);
test_request(
|client| client.write_file(&main, &"Hello world!".to_string()),
"file/write",
json!({
"path" : {
"rootId" : "00000000-0000-0000-0000-000000000000",
"segments" : ["Main.txt"]
},
"contents" : "Hello world!"
}),
unit_json,
(),
);
} | rust_cleaned_test_functions.jsonl/32827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
37216,
368,
341,
262,
1077,
3704,
842,
284,
16040,
486,
38431,
486,
6400,
2895,
445,
15,
15,
15,
15,
15,
15,
15,
15,
12,
15,
15,
15,
15,
12,
15,
15,
15,
15,
12,
15,
15,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_canonicalize_resource_2() {
let url = url::Url::parse(
"http://myaccount.blob.core.windows.\
net/mycontainer?restype=container&comp=list&include=snapshots&\
include=metadata&include=uncommittedblobs",
)
.unwrap();
assert_eq!(
super::canonicalized_resource(
&MockClientEndpoint {
account: "myaccount".to_owned(),
key: "useless".to_owned(),
},
&url
),
"/myaccount/mycontainer\ncomp:list\ninclude:metadata,snapshots,\
uncommittedblobs\nrestype:container"
);
} | rust_cleaned_test_functions.jsonl/5200 | {
"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,
27421,
22391,
551,
17962,
62,
17,
368,
341,
286,
1077,
2515,
284,
2515,
486,
2864,
486,
6400,
1006,
310,
330,
1254,
1110,
2408,
4608,
96281,
4871,
68113,
13,
5661,
1797,
4179,
34198,
3586,
30,
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_filter_union_array_sparse() {
let mut builder = UnionBuilder::new_sparse(3);
builder.append::<Int32Type>("A", 1).unwrap();
builder.append::<Float64Type>("B", 3.2).unwrap();
builder.append::<Int32Type>("A", 34).unwrap();
let array = builder.build().unwrap();
test_filter_union_array(array);
} | rust_cleaned_test_functions.jsonl/75318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
51621,
3858,
71123,
368,
341,
286,
1077,
5206,
7363,
284,
9145,
3297,
486,
931,
71123,
7,
18,
317,
286,
7363,
2057,
27638,
1072,
18,
17,
929,
13211,
32,
497,
220,
16,
568,
15454,
543,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_cfi_instruction_restore_extended() {
let expected_rest = [1, 2, 3, 4];
let expected_reg = 7;
let section = Section::with_endian(Endian::Little)
.D8(constants::DW_CFA_restore_extended.0)
.uleb(expected_reg.into())
.append_bytes(&expected_rest);
let contents = section.get_contents().unwrap();
let input = &mut EndianSlice::new(&contents, LittleEndian);
assert_eq!(
parse_cfi_instruction(input, 8),
Ok(CallFrameInstruction::Restore {
register: Register(expected_reg),
})
);
assert_eq!(*input, EndianSlice::new(&expected_rest, LittleEndian));
} | rust_cleaned_test_functions.jsonl/9323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
666,
9983,
54923,
62677,
61678,
368,
341,
286,
1077,
3601,
32231,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
1077,
3601,
4920,
284,
220,
22,
280,
286,
1077,
3772,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_predefined_numbers() {
assert_eq!((2, vec![0x00_u8]), serialize_uper(PredefinedNumbers::Abc));
assert_eq!((2, vec![0x40_u8]), serialize_uper(PredefinedNumbers::Def));
assert_eq!((8, vec![0x80_u8]), serialize_uper(PredefinedNumbers::Ghi));
assert_eq!((8, vec![0x81_u8]), serialize_uper(PredefinedNumbers::Jkl));
assert_eq!(PredefinedNumbers::Abc, deserialize_uper(&[0x00_u8], 2,));
assert_eq!(PredefinedNumbers::Def, deserialize_uper(&[0x40_u8], 2,));
assert_eq!(PredefinedNumbers::Ghi, deserialize_uper(&[0x80_u8], 8,));
assert_eq!(PredefinedNumbers::Jkl, deserialize_uper(&[0x81_u8], 8,));
} | rust_cleaned_test_functions.jsonl/29172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
9711,
32964,
368,
341,
262,
2060,
10714,
0,
1188,
17,
11,
7486,
20703,
15,
87,
15,
15,
7300,
23,
9719,
24235,
62,
3466,
7,
4703,
9711,
27237,
486,
5830,
66,
1106,
262,
2060,
10714,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_method() {
assert_eq!(parse_method("POST"), Ok(("", Method::Post)));
assert_eq!(parse_method("GET"), Ok(("", Method::Get)));
} | rust_cleaned_test_functions.jsonl/50866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9032,
368,
341,
286,
2060,
10714,
10297,
6400,
9032,
445,
2946,
3975,
7622,
7,
19814,
6730,
486,
4133,
4945,
286,
2060,
10714,
10297,
6400,
9032,
445,
3806,
3975,
7622,
7,
19814,
6730,
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 |
#[test]
fn test_combine_pairs_of_lines() {
for &s in &["-s", "--serial"] {
for &d in &["-d", "--delimiters"] {
new_ucmd!()
.args(&[s, d, "\t\n", "html_colors.txt"])
.run()
.stdout_is_fixture("html_colors.expected");
}
}
} | rust_cleaned_test_functions.jsonl/75402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72374,
36430,
3575,
18323,
368,
341,
262,
369,
609,
82,
304,
609,
1183,
12,
82,
497,
14482,
10182,
1341,
341,
286,
369,
609,
67,
304,
609,
1183,
12,
67,
497,
14482,
9588,
67645,
1341,
341,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_volumecreateoptionsbuilder_driver_opts() {
let opts: HashMap<&str, &str> = [("option", "value")].iter().cloned().collect();
let volume = VolumeCreateOptions::builder()
.driver("my_driver", Some(&opts))
.build();
let serialized = volume.serialize().unwrap();
let volume_info: VolumeTestInfo = serde_json::from_str(&serialized).unwrap();
let mut driver_options = HashMap::new();
driver_options.insert("option".to_string(), "value".to_string());
assert_eq!(volume_info.driver, Some("my_driver".to_string()));
assert_eq!(volume_info.name, None);
assert_eq!(volume_info.driver_opts, Some(driver_options))
} | rust_cleaned_test_functions.jsonl/73126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
1132,
757,
964,
2875,
17850,
20602,
32354,
368,
341,
286,
1077,
12185,
25,
10528,
52244,
495,
11,
609,
495,
29,
284,
84019,
2047,
497,
330,
957,
899,
936,
2015,
1005,
564,
19684,
1005,
173... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_style() {
let original_environment_variable = env::var("COLORTERM");
let mut style = Style::default();
assert_eq!(style.ansi.foreground, None);
assert_eq!(style.css, None);
// darkcyan is an ANSI color and is preserved
env::set_var("COLORTERM", "");
parse_style(&mut style, Value::String(DARK_CYAN.to_string()));
assert_eq!(style.ansi.foreground, Some(Color::Fixed(36)));
assert_eq!(style.css, Some("style=\'color: #0af87\'".to_string()));
// junglegreen is not an ANSI color and is preserved when the terminal supports it
env::set_var("COLORTERM", "truecolor");
parse_style(&mut style, Value::String(JUNGLE_GREEN.to_string()));
assert_eq!(style.ansi.foreground, Some(Color::RGB(38, 166, 154)));
assert_eq!(style.css, Some("style=\'color: #26a69a\'".to_string()));
// junglegreen gets approximated as darkcyan when the terminal does not support it
env::set_var("COLORTERM", "");
parse_style(&mut style, Value::String(JUNGLE_GREEN.to_string()));
assert_eq!(style.ansi.foreground, Some(Color::Fixed(36)));
assert_eq!(style.css, Some("style=\'color: #26a69a\'".to_string()));
if let Ok(environment_variable) = original_environment_variable {
env::set_var("COLORTERM", environment_variable);
} else {
env::remove_var("COLORTERM");
}
} | rust_cleaned_test_functions.jsonl/53972 | {
"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,
21039,
15117,
368,
341,
286,
1077,
4024,
51774,
14635,
284,
6105,
486,
947,
445,
19363,
2868,
38720,
3071,
286,
1077,
5206,
1707,
284,
11913,
486,
2258,
543,
286,
2060,
10714,
10297,
3528,
13,
520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_leader_validator_basic() {
logger::setup();
let leader_rotation_interval = 10;
// Account that will be the sink for all the test's transactions
let bob_pubkey = Keypair::new().pubkey();
// Create the leader node information
let leader_keypair = Arc::new(Keypair::new());
let leader_node = Node::new_localhost_with_pubkey(leader_keypair.pubkey());
let leader_info = leader_node.info.clone();
// Create the validator node information
let validator_keypair = Arc::new(Keypair::new());
let validator_node = Node::new_localhost_with_pubkey(validator_keypair.pubkey());
// Make a common mint and a genesis entry for both leader + validator ledgers
let num_ending_ticks = 1;
let (mint, leader_ledger_path, genesis_entries) = create_tmp_sample_ledger(
"test_leader_validator_basic",
10_000,
num_ending_ticks,
leader_info.id,
500,
);
let validator_ledger_path = tmp_copy_ledger(&leader_ledger_path, "test_leader_validator_basic");
let last_id = genesis_entries
.last()
.expect("expected at least one genesis entry")
.id;
// Initialize both leader + validator ledger
let mut ledger_paths = Vec::new();
ledger_paths.push(leader_ledger_path.clone());
ledger_paths.push(validator_ledger_path.clone());
// Write the bootstrap entries to the ledger that will cause leader rotation
// after the bootstrap height
let mut ledger_writer = LedgerWriter::open(&leader_ledger_path, false).unwrap();
let (active_set_entries, vote_account_keypair) =
make_active_set_entries(&validator_keypair, &mint.keypair(), &last_id, &last_id, 0);
ledger_writer.write_entries(&active_set_entries).unwrap();
// Create the leader scheduler config
let num_bootstrap_slots = 2;
let bootstrap_height = num_bootstrap_slots * leader_rotation_interval;
let leader_scheduler_config = LeaderSchedulerConfig::new(
Some(bootstrap_height),
Some(leader_rotation_interval),
Some(leader_rotation_interval * 2),
Some(bootstrap_height),
);
// Start the validator node
let mut validator = Fullnode::new(
validator_node,
&validator_ledger_path,
validator_keypair,
Arc::new(vote_account_keypair),
Some(leader_info.ncp),
false,
LeaderScheduler::new(&leader_scheduler_config),
None,
);
// Start the leader fullnode
let mut leader = Fullnode::new(
leader_node,
&leader_ledger_path,
leader_keypair,
Arc::new(Keypair::new()),
Some(leader_info.ncp),
false,
LeaderScheduler::new(&leader_scheduler_config),
None,
);
// Wait for convergence
let servers = converge(&leader_info, 2);
assert_eq!(servers.len(), 2);
// Push transactions until we detect the nodes exit
let mut i = 1;
loop {
// Poll to see that the bank state is updated after every transaction
// so that we can be sure leader rotation is triggered
let result = send_tx_and_retry_get_balance(&leader_info, &mint, &bob_pubkey, 1, None);
// the node has transitioned already
if result != Some(i as u64) {
break;
}
i += 1;
}
// Wait for validator to shut down tvu and restart tpu
match validator.handle_role_transition().unwrap() {
Some(FullnodeReturnType::ValidatorToLeaderRotation) => (),
_ => panic!("Expected reason for exit to be leader rotation"),
}
// Wait for the leader to shut down tpu and restart tvu
match leader.handle_role_transition().unwrap() {
Some(FullnodeReturnType::LeaderToValidatorRotation) => (),
_ => panic!("Expected reason for exit to be leader rotation"),
}
// Query newly transitioned validator to make sure they have the proper balances
// in the bank after the transitions
let mut leader_client = mk_client(&leader_info);
// we only have an upper bound on the balance
if let Ok(bal) = leader_client.poll_get_balance(&bob_pubkey) {
assert!(bal <= i);
}
// Shut down
validator.close().unwrap();
leader.close().unwrap();
// Check the ledger of the validator to make sure the entry height is correct
// and that the old leader and the new leader's ledgers agree up to the point
// of leader rotation
let validator_entries =
read_ledger(&validator_ledger_path, true).expect("Expected parsing of validator ledger");
let leader_entries =
read_ledger(&leader_ledger_path, true).expect("Expected parsing of leader ledger");
let mut min_len = 0;
for (v, l) in validator_entries.zip(leader_entries) {
min_len += 1;
assert_eq!(
v.expect("expected valid validator entry"),
l.expect("expected valid leader entry")
);
}
assert!(min_len >= bootstrap_height);
for path in ledger_paths {
DbLedger::destroy(&path).expect("Expected successful database destruction");
remove_dir_all(path).unwrap();
}
} | rust_cleaned_test_functions.jsonl/36559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2002
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79991,
64959,
34729,
368,
341,
262,
5925,
486,
15188,
543,
262,
1077,
7653,
44813,
20541,
284,
220,
16,
15,
401,
262,
442,
8615,
429,
686,
387,
279,
19309,
369,
678,
279,
1273,
594,
14131,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_for_in() {
test(
"for (var i in j) { var c = i; }",
"for (var i in j) { var c = i; }",
);
test_same("var i = 0; for (i in j) ;");
test_same("var i = 0; for (i in j) { var c = i; }");
test_same("i = 0; for (var i in j) { var c = i; }");
test_same("var j = {'key':'value'}; for (var i in j) {print(i)};");
} | rust_cleaned_test_functions.jsonl/27633 | {
"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,
5478,
1243,
368,
341,
262,
1273,
1006,
286,
330,
1958,
320,
947,
600,
304,
502,
8,
314,
762,
272,
284,
600,
26,
335,
756,
286,
330,
1958,
320,
947,
600,
304,
502,
8,
314,
762,
272,
284,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_drafts_rel() {
let mut collection = CollectionBuilder::default();
collection.source = Some(path::PathBuf::from("/"));
collection.title = Some("title".to_owned());
collection.drafts_dir = Some("rel".to_owned());
collection.include_drafts = true;
let collection = collection.build().unwrap();
assert_eq!(
collection.drafts.unwrap().subtree(),
path::Path::new("/rel")
);
} | rust_cleaned_test_functions.jsonl/116420 | {
"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,
20801,
91339,
82,
13557,
368,
341,
286,
1077,
5206,
4426,
284,
11101,
3297,
486,
2258,
543,
286,
4426,
14698,
284,
4329,
5581,
486,
1820,
15064,
486,
1499,
4283,
4010,
286,
4426,
6067,
284,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_release_track_from() {
assert_eq!(ReleaseTrack::Stable, 1u8.into());
assert_eq!(ReleaseTrack::Nightly, 2u8.into());
assert_eq!(ReleaseTrack::Unknown, 0u8.into());
} | rust_cleaned_test_functions.jsonl/108911 | {
"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,
24577,
28545,
5673,
368,
341,
197,
6948,
10714,
10297,
16077,
15667,
486,
623,
480,
11,
220,
16,
84,
23,
39860,
1423,
197,
6948,
10714,
10297,
16077,
15667,
486,
50437,
398,
11,
220,
17,
84,
23,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_read_improper_lists() {
let input = "(1 . 2) (3 . ()) (4 . (5 . 6)) (1 2 . 3)";
let heap = &mut Heap::new();
let results : Vec<Value> = read_from_str(input, heap, "test_read_improper_lists")
.map(|(_, r)| *r.ok().expect("Should not get a read error"))
.collect();
assert_eq!(results.len(), 4);
let v0 = &results[0];
assert_eq!(v0.car(heap),
Some(Rooted::new(heap, Value::new_integer(1))));
assert_eq!(v0.cdr(heap),
Some(Rooted::new(heap, Value::new_integer(2))));
let v1 = &results[1];
assert_eq!(v1.car(heap),
Some(Rooted::new(heap, Value::new_integer(3))));
assert_eq!(v1.cdr(heap),
Some(Rooted::new(heap, Value::EmptyList)));
let v2 = &results[2];
assert_eq!(v2.car(heap),
Some(Rooted::new(heap, Value::new_integer(4))));
assert_eq!(v2.cdr(heap).expect("v2.cdr")
.car(heap),
Some(Rooted::new(heap, Value::new_integer(5))));
assert_eq!(v2.cdr(heap).expect("v2.cdr")
.cdr(heap),
Some(Rooted::new(heap, Value::new_integer(6))));
let v3 = &results[3];
assert_eq!(v3.car(heap),
Some(Rooted::new(heap, Value::new_integer(1))));
assert_eq!(v3.cdr(heap).expect("v3.cdr")
.car(heap),
Some(Rooted::new(heap, Value::new_integer(2))));
assert_eq!(v3.cdr(heap).expect("v3.cdr")
.cdr(heap),
Some(Rooted::new(heap, Value::new_integer(3))));
} | rust_cleaned_test_functions.jsonl/62118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 990
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
17895,
80668,
37288,
368,
341,
286,
1077,
1946,
284,
11993,
16,
659,
220,
17,
8,
320,
18,
659,
44481,
320,
19,
659,
320,
20,
659,
220,
21,
593,
320,
16,
220,
17,
659,
220,
18,
24023,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_small() {
let x = ApInt::from_u64(0xFEDC_BA98_7654_3210);
let expected = &[
Token::Tuple { len: 2 },
Token::U64(64),
Token::Seq { len: Some(1) },
Token::U64(0xFEDC_BA98_7654_3210),
Token::SeqEnd,
Token::TupleEnd,
];
assert_tokens(&x.compact(), expected)
} | rust_cleaned_test_functions.jsonl/82725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
368,
341,
310,
1077,
856,
284,
5232,
1072,
486,
1499,
7300,
21,
19,
7,
15,
9770,
1479,
34,
1668,
32,
24,
23,
62,
22,
21,
20,
19,
62,
18,
17,
16,
15,
317,
310,
1077,
3601,
284,
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_slice() {
let val: InlineDyn<[u8], U4> = InlineDyn::try_new([1, 2, 3, 4]).unwrap();
assert_eq!(val.get_ref(), [1, 2, 3, 4]);
} | rust_cleaned_test_functions.jsonl/83894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
368,
341,
286,
1077,
1044,
25,
54235,
95709,
66746,
84,
23,
1125,
547,
19,
29,
284,
54235,
95709,
486,
1539,
5921,
2561,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
10697,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scans_echo_short_tags() {
let mut scanner = Scanner::new("<?= $var; ?>");
scanner.scan().unwrap();
assert_eq!(token_list!(scanner.tokens), "<?= $var ; ?>");
} | rust_cleaned_test_functions.jsonl/52959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
596,
68628,
16673,
16333,
368,
341,
286,
1077,
5206,
20775,
284,
17170,
486,
931,
445,
25557,
400,
947,
26,
3370,
3071,
286,
20775,
47949,
1005,
15454,
1428,
286,
2060,
10714,
10297,
5839,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_timestamp_str() {
assert_de_tokens(
&UnixTimestamp::from_secs(123),
&[Token::Str("1970-01-01T00:02:03Z")],
);
} | rust_cleaned_test_functions.jsonl/13694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
23073,
2895,
368,
341,
286,
2060,
2259,
28838,
1006,
310,
609,
55832,
20812,
486,
1499,
68718,
7,
16,
17,
18,
1326,
310,
44590,
3323,
486,
2580,
445,
16,
24,
22,
15,
12,
15,
16,
12,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_random() {
// not sure how to test this aside from just getting some values
let _n : uint = random();
let _f : f32 = random();
let _o : Option<Option<i8>> = random();
let _many : ((),
(uint,
int,
Option<(u32, (bool,))>),
(u8, i8, u16, i16, u32, i32, u64, i64),
(f32, (f64, (f64,)))) = random();
} | rust_cleaned_test_functions.jsonl/23766 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
368,
341,
286,
442,
537,
2704,
1246,
311,
1273,
419,
15663,
504,
1101,
3709,
1045,
2750,
198,
286,
1077,
716,
77,
549,
2622,
284,
4194,
543,
286,
1077,
716,
69,
549,
282,
18,
17,
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_affine_jacobian_conversion() {
let rng = &mut ::rand::thread_rng();
assert!(G1::zero().to_affine().is_none());
assert!(G2::zero().to_affine().is_none());
for _ in 0..1000 {
let a = G1::one() * Fr::random(rng);
let b = a.to_affine().unwrap();
let c = b.to_jacobian();
assert_eq!(a, c);
}
for _ in 0..1000 {
let a = G2::one() * Fr::random(rng);
let b = a.to_affine().unwrap();
let c = b.to_jacobian();
assert_eq!(a, c);
}
} | rust_cleaned_test_functions.jsonl/6619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
482,
5374,
62518,
64132,
368,
341,
262,
1077,
28422,
284,
609,
6984,
3504,
11335,
486,
4528,
66849,
1428,
262,
2060,
10297,
38,
16,
486,
14154,
1005,
983,
48914,
482,
1005,
285,
31488,
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... | 3 |
#[test]
fn test_rand_with_seed_first_gen() {
let tests: Vec<(i64, f64)> = vec![
(0, 0.15522042769493574),
(1, 0.40540353712197724),
(-1, 0.9050373219931845),
(622337, 0.3608469249315997),
(10000000009, 0.3472714008272359),
(-1845798578934, 0.5058874688166077),
(922337203685, 0.40536338501178043),
(922337203685477580, 0.5550739490939993),
(9223372036854775807, 0.9050373219931845),
];
for (seed, exp) in tests {
let got = RpnFnScalarEvaluator::new()
.push_param(Some(seed))
.evaluate::<Real>(ScalarFuncSig::RandWithSeedFirstGen)
.unwrap()
.unwrap();
assert_eq!(got, Real::from(exp));
}
let none_case_got = RpnFnScalarEvaluator::new()
.push_param(ScalarValue::Int(None))
.evaluate::<Real>(ScalarFuncSig::RandWithSeedFirstGen)
.unwrap()
.unwrap();
assert_eq!(none_case_got, Real::from(0.15522042769493574));
} | rust_cleaned_test_functions.jsonl/37501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 658
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33864,
6615,
33809,
12978,
16322,
368,
341,
286,
1077,
7032,
25,
11312,
28706,
72,
21,
19,
11,
282,
21,
19,
16018,
284,
7486,
90515,
310,
320,
15,
11,
220,
15,
13,
16,
20,
20,
17,
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... | 2 |
#[test]
fn test_verkey_is_b58_and_valid_length() {
let verkey = "EkVTa7SCJ5SntpYyX7CSb2pcBhiVGT9kWSagA8a9T69A";
match validate_verkey(&verkey) {
Err(_) => panic!("Should be valid verkey"),
Ok(x) => assert_eq!(x, verkey)
}
} | rust_cleaned_test_functions.jsonl/17830 | {
"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,
26042,
792,
6892,
880,
20,
23,
8378,
8337,
5118,
368,
341,
286,
1077,
2739,
792,
284,
330,
41917,
20457,
64,
22,
3540,
41,
20,
50,
89340,
56,
88,
55,
22,
6412,
65,
17,
3992,
33,
6023,
53,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_file_handles() {
assert_file_handle!("CLOSE #1", 1);
assert_file_handle!("CLOSE #2", 2);
assert_file_handle!("CLOSE #255", 255); // max value
} | rust_cleaned_test_functions.jsonl/102664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
2458,
68017,
368,
341,
310,
2060,
2458,
10630,
17223,
47887,
671,
16,
497,
220,
16,
317,
310,
2060,
2458,
10630,
17223,
47887,
671,
17,
497,
220,
17,
317,
310,
2060,
2458,
10630,
17223,
47... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_collection_fails_on_existing() {
let mut collection = setup_collection();
// Create
collection.create().unwrap();
// Tries to create again
collection.create().unwrap_err();
} | rust_cleaned_test_functions.jsonl/63497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25019,
761,
6209,
4470,
62630,
368,
341,
286,
1077,
5206,
4426,
284,
6505,
25019,
1428,
286,
442,
4230,
198,
286,
4426,
2520,
1005,
15454,
1428,
286,
442,
350,
4019,
311,
1855,
1549,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_purge_all_incremental_snapshot_archives_when_no_full_snapshot_archives() {
let snapshot_archives_dir = tempfile::TempDir::new().unwrap();
for snapshot_filenames in [
format!("incremental-snapshot-100-120-{}.tar", Hash::default()),
format!("incremental-snapshot-100-140-{}.tar", Hash::default()),
format!("incremental-snapshot-100-160-{}.tar", Hash::default()),
format!("incremental-snapshot-100-180-{}.tar", Hash::default()),
format!("incremental-snapshot-200-220-{}.tar", Hash::default()),
format!("incremental-snapshot-200-240-{}.tar", Hash::default()),
format!("incremental-snapshot-200-260-{}.tar", Hash::default()),
format!("incremental-snapshot-200-280-{}.tar", Hash::default()),
] {
let snapshot_path = snapshot_archives_dir.path().join(&snapshot_filenames);
File::create(snapshot_path).unwrap();
}
purge_old_snapshot_archives(snapshot_archives_dir.path(), usize::MAX, usize::MAX);
let remaining_incremental_snapshot_archives =
get_incremental_snapshot_archives(snapshot_archives_dir.path());
assert!(remaining_incremental_snapshot_archives.is_empty());
} | rust_cleaned_test_functions.jsonl/67613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 547
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
39823,
5705,
51482,
278,
53265,
34330,
1886,
47636,
6536,
16372,
53265,
34330,
1886,
368,
341,
286,
1077,
16295,
34330,
1886,
4334,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
1428,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_sync_fs() {
let temporary_directory = tempdir().unwrap();
let temporary_path = fs::canonicalize(temporary_directory.path()).unwrap();
new_ucmd!()
.arg("--file-system")
.arg(&temporary_path)
.succeeds();
} | rust_cleaned_test_functions.jsonl/14251 | {
"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,
23008,
34470,
368,
341,
262,
1077,
13340,
14846,
284,
2730,
3741,
1005,
15454,
543,
262,
1077,
13340,
2638,
284,
8619,
486,
77942,
551,
9758,
7592,
14846,
3875,
6011,
15454,
543,
262,
501,
68887,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_aggregated_signatures_1() {
// Message
let msg = hex::decode("73616d706c65").unwrap();
// Signature 1
let secret_key1 =
hex::decode("1ab1126ff2e37c6e6eddea943ccb3a48f83b380b856424ee552e113595525565")
.unwrap();
let public_key1 = Bn256.derive_public_key(&secret_key1).unwrap();
let sign_1 = Bn256.sign(&secret_key1, &msg).unwrap();
// Signature 2
let secret_key2 =
hex::decode("2009da7287c158b126123c113d1c85241b6e3294dd75c643588630a8bc0f934c")
.unwrap();
let public_key2 = Bn256.derive_public_key(&secret_key2).unwrap();
let sign_2 = Bn256.sign(&secret_key2, &msg).unwrap();
// Public Key and Signature aggregation
let agg_public_key = Bn256
.aggregate_public_keys(&[&public_key1, &public_key2])
.unwrap();
let agg_signature = Bn256.aggregate_signatures(&[&sign_1, &sign_2]).unwrap();
// Verification single signatures
assert!(
Bn256.verify(&sign_1, &msg, &public_key1).is_ok(),
"Signature 1 verification failed"
);
assert!(
Bn256.verify(&sign_2, &msg, &public_key2).is_ok(),
"Signature 2 signature verification failed"
);
// Aggregated signature verification
assert!(
Bn256.verify(&agg_signature, &msg, &agg_public_key).is_ok(),
"Aggregated signature verification failed"
);
} | rust_cleaned_test_functions.jsonl/65100 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 769
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
20587,
93040,
11172,
2789,
62,
16,
368,
341,
286,
442,
4856,
198,
286,
1077,
3750,
284,
12371,
486,
18196,
445,
22,
18,
21,
16,
21,
67,
22,
15,
21,
66,
21,
20,
1827,
15454,
1428,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_value() {
let available_bytes = (core::mem::size_of::<usize>() - 1) as u32;
let max_value = 2usize.pow(available_bytes * 8) - 2;
#[cfg(target_pointer_width = "64")]
assert_eq!(max_value, 72057594037927934);
#[cfg(target_pointer_width = "32")]
assert_eq!(max_value, 16777214);
let cap = Capacity::new(max_value).unwrap();
let after = cap.as_usize().unwrap();
assert_eq!(max_value, after);
} | rust_cleaned_test_functions.jsonl/86251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
3142,
368,
341,
286,
1077,
2500,
12524,
284,
320,
2153,
486,
10536,
486,
2141,
3575,
27638,
51878,
13555,
481,
220,
16,
8,
438,
575,
18,
17,
280,
286,
1077,
1932,
3142,
284,
220,
17,
518... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.