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_reinit_duplex_stream_by_unplugging_a_default_input_device() {
test_unplug_a_device_on_an_active_stream(StreamType::DUPLEX, Scope::Input, true, 500);
} | rust_cleaned_test_functions.jsonl/23865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
2327,
51932,
2571,
12673,
3710,
4907,
500,
35268,
4306,
9993,
5898,
9204,
368,
341,
262,
1273,
4907,
47474,
4306,
9204,
4470,
12008,
12930,
12673,
52011,
929,
486,
35,
3124,
35245,
11,
34920,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_visit_each_account_once() {
let do_work = |accounts: &[InstructionAccount]| -> (usize, usize, usize) {
let mut unique_entries = 0;
let mut index_sum_a = 0;
let mut index_sum_b = 0;
let mut work = |index_in_instruction: usize, entry: &InstructionAccount| {
unique_entries += 1;
index_sum_a += index_in_instruction;
index_sum_b += entry.index_in_transaction;
Ok(())
};
visit_each_account_once(accounts, &mut work, InstructionError::NotEnoughAccountKeys)
.unwrap();
(unique_entries, index_sum_a, index_sum_b)
};
assert_eq!(
(3, 3, 19),
do_work(&[
InstructionAccount {
index_in_transaction: 7,
index_in_caller: 0,
is_signer: false,
is_writable: false,
},
InstructionAccount {
index_in_transaction: 3,
index_in_caller: 1,
is_signer: false,
is_writable: false,
},
InstructionAccount {
index_in_transaction: 9,
index_in_caller: 2,
is_signer: false,
is_writable: false,
},
InstructionAccount {
index_in_transaction: 3,
index_in_caller: 1,
is_signer: false,
is_writable: false,
},
])
);
} | rust_cleaned_test_functions.jsonl/14506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1037
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56484,
32046,
13500,
7630,
368,
341,
286,
1077,
653,
11498,
284,
760,
26206,
25,
44590,
16664,
7365,
29685,
1464,
320,
51878,
11,
22301,
11,
22301,
8,
341,
310,
1077,
5206,
4911,
26092,
284,
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_serde() {
use nalgebra::{Unit, Vector3};
use super::PerspectiveParams;
use crate::{Camera, ExtrinsicParameters, IntrinsicParametersPerspective};
let params = PerspectiveParams {
fx: 100.0,
fy: 102.0,
skew: 0.1,
cx: 321.0,
cy: 239.9,
};
let intrinsics: IntrinsicParametersPerspective<_> = params.into();
let camcenter = Vector3::new(10.0, 0.0, 10.0);
let lookat = Vector3::new(0.0, 0.0, 0.0);
let up = Unit::new_normalize(Vector3::new(0.0, 0.0, 1.0));
let pose = ExtrinsicParameters::from_view(&camcenter, &lookat, &up);
let expected = Camera::new(intrinsics, pose);
let buf = serde_json::to_string(&expected).unwrap();
let actual: Camera<_, _> = serde_json::from_str(&buf).unwrap();
assert!(expected == actual);
} | rust_cleaned_test_functions.jsonl/117919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
341,
286,
990,
84533,
26083,
22964,
4562,
11,
4196,
18,
2315,
286,
990,
2256,
486,
58642,
9085,
4870,
280,
286,
990,
17717,
22964,
13445,
11,
1374,
45002,
9706,
11,
758,
45002,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_settings_fail() {
let mut context = get_context(accounts(1));
testing_env!(context.build());
let mut contract = Contract::new();
testing_env!(context.is_view(true).build());
assert_eq!(contract.slot_granularity, SLOT_GRANULARITY);
testing_env!(context
.is_view(false)
.signer_account_id(accounts(3))
.predecessor_account_id(accounts(3))
.build());
contract.update_settings(None, Some(10), None, None, None, None, None, None, None);
} | rust_cleaned_test_functions.jsonl/74937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
10853,
22121,
368,
341,
286,
1077,
5206,
2266,
284,
633,
8467,
91868,
7,
16,
1106,
286,
7497,
15879,
10297,
2147,
13239,
1423,
286,
1077,
5206,
5116,
284,
19185,
486,
931,
543,
286,
7497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deep_group_empty() {
let tokens = TokenStream::from_iter(vec![TokenTree::Group(Group::new(
Delimiter::None,
TokenStream::from_iter(vec![TokenTree::Group(Group::new(
Delimiter::None,
TokenStream::from_iter(vec![TokenTree::Literal(Literal::string("hi"))]),
))]),
))]);
snapshot!(tokens as Lit, @r#""hi""# );
} | rust_cleaned_test_functions.jsonl/103937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87044,
6288,
15124,
368,
341,
262,
1077,
11211,
284,
9660,
3027,
486,
1499,
11723,
25592,
20703,
3323,
6533,
486,
2808,
79535,
486,
931,
1006,
286,
7313,
17700,
486,
4064,
345,
286,
9660,
3027,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_operations_group() {
let mut schema_builder = schema::Schema::builder();
let text_field = schema_builder.add_text_field("text", schema::TEXT);
let index = Index::create_in_ram(schema_builder.build());
let index_writer = index.writer_for_tests().unwrap();
let operations = vec![
UserOperation::Add(doc!(text_field=>"a")),
UserOperation::Add(doc!(text_field=>"b")),
];
let batch_opstamp1 = index_writer.run(operations).unwrap();
assert_eq!(batch_opstamp1, 2u64);
} | rust_cleaned_test_functions.jsonl/21493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57345,
6288,
368,
341,
1789,
286,
1077,
5206,
10802,
28532,
284,
10802,
486,
8632,
486,
17850,
543,
286,
1077,
1467,
5013,
284,
10802,
28532,
1364,
4326,
5013,
445,
1318,
497,
10802,
486,
12708,
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_new_error_1() {
pyo3::prepare_freethreaded_python();
Python::with_gil(|py| -> () {
let circs: Vec<CircuitWrapper> = Vec::new();
let program_type = py.get_type::<QuantumProgramWrapper>();
let program = program_type.call1((circs, vec!["test".to_string()]));
assert!(program.is_err());
})
} | rust_cleaned_test_functions.jsonl/8605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
4096,
62,
16,
368,
341,
262,
4510,
78,
18,
486,
13609,
74179,
769,
878,
291,
55869,
543,
262,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
1464,
1719,
341,
286,
1077,
4225,
82,
25,
1131... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_failure() {
let promise = Promise::<usize>::new();
let receiver = promise.clone().receiver();
assert!(receiver.recv().ready().is_none());
mem::drop(promise);
assert_eq!(Err(RecvError), receiver.recv().ready().unwrap());
} | rust_cleaned_test_functions.jsonl/91939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43618,
368,
341,
286,
1077,
11222,
284,
7303,
27638,
51878,
6831,
931,
543,
286,
1077,
13964,
284,
11222,
15997,
1005,
37553,
543,
286,
2060,
10297,
37553,
40433,
1005,
2307,
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... | 1 |
#[test]
fn test_negation_two_rules() -> TestResult {
let p = Polar::new();
// TODO: More complicated version:
p.load_str(
r#"f(x) if not g(x);
g(y) if y = 1;
h(x) if not (not g(x));
"#,
)?;
let mut q = p.new_query_from_term(term!(call!("f", [sym!("x")])), false);
let bindings = next_binding(&mut q)?;
assert_partial_expressions!(
&bindings,
"x" => "_this != 1"
);
assert_query_done!(q);
let mut q = p.new_query_from_term(term!(call!("f", [2])), false);
assert_eq!(next_binding(&mut q)?.len(), 0);
assert_query_done!(q);
let mut q = p.new_query_from_term(term!(call!("f", [1])), false);
assert_query_done!(q);
let mut q = p.new_query_from_term(term!(call!("h", [sym!("x")])), false);
let bindings = next_binding(&mut q)?;
assert_eq!(bindings.get(&sym!("x")).unwrap(), &term!(1));
assert_query_done!(q);
Ok(())
} | rust_cleaned_test_functions.jsonl/63045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 601
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
367,
23241,
21407,
368,
1464,
3393,
2077,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
442,
5343,
25,
4398,
16965,
2319,
510,
16885,
286,
281,
5104,
2895,
1006,
310,
435,
55543,
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... | 5 |
#[test]
fn test_styled_variable_as_segments() {
const FORMAT_STR: &str = "[$var](red bold)";
let var_style = Some(Color::Red.bold());
let styled_style = Some(Color::Green.italic());
let styled_no_modifier_style = Some(Color::Green.normal());
let mut segments: Vec<Segment> = Vec::new();
segments.extend(Segment::from_text(None, "styless"));
segments.extend(Segment::from_text(styled_style, "styled"));
segments.extend(Segment::from_text(
styled_no_modifier_style,
"styled_no_modifier",
));
let formatter = StringFormatter::new(FORMAT_STR)
.unwrap()
.map_variables_to_segments(|variable| match variable {
"var" => Some(Ok(segments.clone())),
_ => None,
});
let result = formatter.parse(None, None).unwrap();
let mut result_iter = result.iter();
match_next!(result_iter, "styless", var_style);
match_next!(result_iter, "styled", styled_style);
match_next!(result_iter, "styled_no_modifier", styled_no_modifier_style);
} | rust_cleaned_test_functions.jsonl/109464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
7601,
14635,
11898,
55735,
368,
341,
286,
733,
52225,
7159,
25,
609,
495,
284,
330,
3442,
947,
9533,
1151,
13939,
24023,
286,
1077,
762,
15117,
284,
4329,
15028,
486,
6033,
31675,
1423,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_smoke() {
let td = TempDir::new().unwrap();
debug_cmd_print(
td.path().as_os_str().to_str().unwrap(),
"git clone https://github.com/extrawurst/brewdump.git",
);
let repo_path = td.path().join("brewdump");
let repo_path = repo_path.as_os_str().to_str().unwrap();
let remotes = get_remotes(repo_path).unwrap();
assert_eq!(remotes, vec![String::from(DEFAULT_REMOTE_NAME)]);
fetch_origin(repo_path, "master").unwrap();
} | rust_cleaned_test_functions.jsonl/22106 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15874,
4740,
368,
341,
286,
1077,
17941,
284,
19944,
6184,
486,
931,
1005,
15454,
1428,
286,
7390,
11684,
10064,
1006,
310,
17941,
3875,
1005,
300,
29387,
2895,
1005,
983,
2895,
1005,
15454,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_auto_intersection_type1() {
// o.___
// \ 'o
// x <-- intersection!
// o.___\
// 'o
let mut path = Path::builder();
path.begin(point(0.0, 0.0));
path.line_to(point(2.0, 1.0));
path.line_to(point(0.0, 2.0));
path.line_to(point(2.0, 3.0));
path.end(true);
let path = path.build();
test_path_and_count_triangles(path.as_slice(), 2);
} | rust_cleaned_test_functions.jsonl/102401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27740,
82558,
1819,
16,
368,
341,
262,
442,
220,
297,
4847,
12924,
262,
442,
256,
1124,
256,
364,
78,
7213,
262,
442,
257,
856,
220,
70386,
19246,
4894,
1066,
262,
442,
220,
297,
4847,
62,
566... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stdin_show_nonprinting() {
for same_param in vec!["-v", "--show-nonprinting"] {
new_ucmd!()
.args(&[same_param])
.pipe_in("\t\0\n")
.succeeds()
.stdout_only("\t^@\n");
}
} | rust_cleaned_test_functions.jsonl/90932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
15267,
21637,
98831,
368,
341,
262,
369,
1852,
4090,
304,
7486,
0,
1183,
12,
85,
497,
14482,
3445,
98700,
98831,
1341,
341,
286,
501,
68887,
2277,
0,
741,
310,
659,
2116,
2099,
58,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_indexed_reader_iter_size_hint() {
let mut reader = IndexedReader::new(io::Cursor::new(FASTA_FILE), FAI_FILE).unwrap();
reader.fetch("id", 2, 4).unwrap();
let mut iterator = reader.read_iter().unwrap();
assert_eq!(iterator.size_hint(), (2, Some(2)));
assert_eq!(iterator.next().unwrap().unwrap(), b'C');
assert_eq!(iterator.size_hint(), (1, Some(1)));
assert_eq!(iterator.next().unwrap().unwrap(), b'G');
assert_eq!(iterator.size_hint(), (0, Some(0)));
assert!(iterator.next().is_none());
assert_eq!(iterator.size_hint(), (0, Some(0)));
} | rust_cleaned_test_functions.jsonl/62841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
291,
22306,
11723,
2368,
45825,
368,
341,
286,
1077,
5206,
6604,
284,
8008,
17120,
486,
931,
37258,
486,
14543,
486,
931,
7,
59206,
32,
8087,
701,
15008,
40,
8087,
568,
15454,
543,
286,
66... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_digest_algorithm() {
let sha256_byte: [u8; 1] = [0x11];
let sha512_byte: [u8; 1] = [0x12];
let bitcoin160_byte: [u8; 1] = [0x48];
let bitcoin256_byte: [u8; 1] = [0x51];
test_encode!(
(sha256_byte, DigestAlgorithm),
(sha512_byte, DigestAlgorithm),
(bitcoin160_byte, DigestAlgorithm),
(bitcoin256_byte, DigestAlgorithm)
);
let sha256 = DigestAlgorithm::strict_decode(&[0x11][..]).unwrap();
let sha512 = DigestAlgorithm::strict_decode(&[0x12][..]).unwrap();
let bitcoin160 = DigestAlgorithm::strict_decode(&[0x48][..]).unwrap();
let bitcoin256 = DigestAlgorithm::strict_decode(&[0x51][..]).unwrap();
assert_eq!(sha256, DigestAlgorithm::Sha256);
assert_eq!(sha512, DigestAlgorithm::Sha512);
assert_eq!(bitcoin160, DigestAlgorithm::Bitcoin160);
assert_eq!(bitcoin256, DigestAlgorithm::Bitcoin256);
} | rust_cleaned_test_functions.jsonl/45940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 467
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52994,
59531,
368,
341,
286,
1077,
15870,
17,
20,
21,
19737,
25,
508,
84,
23,
26,
220,
16,
60,
284,
508,
15,
87,
16,
16,
935,
286,
1077,
15870,
20,
16,
17,
19737,
25,
508,
84,
23,
26,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_supported_ext() {
assert!(!is_supported_ext(Path::new("tests/subdir/redirects")));
assert!(!is_supported_ext(Path::new("README.md")));
assert!(is_supported_ext(Path::new("lib/typescript.d.ts")));
assert!(is_supported_ext(Path::new("testdata/001_hello.js")));
assert!(is_supported_ext(Path::new("testdata/002_hello.ts")));
assert!(is_supported_ext(Path::new("foo.jsx")));
assert!(is_supported_ext(Path::new("foo.tsx")));
assert!(is_supported_ext(Path::new("foo.TS")));
assert!(is_supported_ext(Path::new("foo.TSX")));
assert!(is_supported_ext(Path::new("foo.JS")));
assert!(is_supported_ext(Path::new("foo.JSX")));
assert!(is_supported_ext(Path::new("foo.mjs")));
assert!(!is_supported_ext(Path::new("foo.mjsx")));
} | rust_cleaned_test_functions.jsonl/79107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
57885,
9927,
368,
341,
262,
2060,
0,
3471,
285,
57885,
9927,
33030,
486,
931,
445,
23841,
37885,
3741,
14,
8117,
82,
17621,
262,
2060,
0,
3471,
285,
57885,
9927,
33030,
486,
931,
445,
5467... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_option_arc() {
use std::sync::Arc;
let five = Arc::new(5);
match Some(five) {
Some(a) => assert_eq!(*a, 5),
None => panic!("unexpected None while matching on Some(Arc::new(5))")
}
} | rust_cleaned_test_functions.jsonl/132905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
9672,
62914,
368,
341,
262,
990,
1460,
486,
12996,
486,
36809,
401,
262,
1077,
4236,
284,
19689,
486,
931,
7,
20,
317,
262,
2432,
4329,
955,
533,
8,
341,
286,
4329,
2877,
8,
589,
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... | 2 |
#[test]
fn test_region_heartbeat_timestamp() {
let mut cluster = new_server_cluster(0, 3);
cluster.run();
cluster.must_transfer_leader(1, new_peer(2, 2));
let reported_ts = cluster.pd_client.get_region_last_report_ts(1).unwrap();
assert_ne!(reported_ts, PdInstant::zero());
sleep(Duration::from_millis(1000));
cluster.must_transfer_leader(1, new_peer(1, 1));
sleep(Duration::from_millis(1000));
cluster.must_transfer_leader(1, new_peer(2, 2));
for _ in 0..100 {
sleep_ms(100);
let reported_ts_now = cluster.pd_client.get_region_last_report_ts(1).unwrap();
if reported_ts_now > reported_ts {
return;
}
}
panic!("reported ts should be updated");
} | rust_cleaned_test_functions.jsonl/50373 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20627,
62,
72471,
23073,
368,
341,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
220,
18,
317,
262,
10652,
7634,
1428,
1066,
262,
10652,
69419,
35403,
79991,
7,
16,
11,
501,
45159,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dec() {
let mut r = Register::new();
let mut b = MockBus::new();
b.memory[0x80] = 0x02;
dec(0x80, &mut r, &mut b);
assert_eq!(b.memory[0x80], 0x01)
} | rust_cleaned_test_functions.jsonl/14207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
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,
87,
23,
15,
60,
284,
220,
15,
87,
15,
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_split_off_2() {
// singleton
{
let mut m = LinkedList::new();
m.push_back(1);
let p = m.split_off(0);
assert_eq!(m.len(), 0);
assert_eq!(p.len(), 1);
assert_eq!(p.back(), Some(&1));
assert_eq!(p.front(), Some(&1));
}
{
let u = vec![1, 2, 3, 4, 5];
let mut m = list_from(&u);
let mut n = m.split_off(2);
assert_eq!(m.len(), 2);
assert_eq!(n.len(), 3);
for elt in 1..3 {
assert_eq!(m.pop_front(), Some(elt));
}
for elt in 3..6 {
assert_eq!(n.pop_front(), Some(elt));
}
}
{
let u = vec![1, 2, 3, 4, 5];
let mut m = list_from(&u);
let mut n = m.split_off(4);
assert_eq!(m.len(), 4);
assert_eq!(n.len(), 1);
for elt in 1..5 {
assert_eq!(m.pop_front(), Some(elt));
}
for elt in 5..6 {
assert_eq!(n.pop_front(), Some(elt));
}
}
// no-op on the last index
{
let mut m = LinkedList::new();
m.push_back(1);
let p = m.split_off(1);
assert_eq!(m.len(), 1);
assert_eq!(p.len(), 0);
assert_eq!(m.back(), Some(&1));
assert_eq!(m.front(), Some(&1));
}
} | rust_cleaned_test_functions.jsonl/92209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 766
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
13651,
62,
17,
368,
341,
262,
442,
36903,
198,
262,
341,
286,
1077,
5206,
296,
284,
22917,
486,
931,
543,
286,
296,
2552,
3895,
7,
16,
626,
286,
1077,
281,
284,
296,
5289,
13651,
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... | 5 |
#[test]
fn test_read_symbols() {
let input = "foo + - * ? !";
let heap = &mut Heap::new();
let results : Vec<Value> = read_from_str(input, heap, "test_read_symbols")
.map(|(_, r)| *r.ok().expect("Should not get a read error"))
.collect();
assert_eq!(results.len(), 6);
match results[0] {
Value::Symbol(str) => assert_eq!(*str, "foo".to_string()),
_ => assert!(false),
}
match results[1] {
Value::Symbol(str) => assert_eq!(*str, "+".to_string()),
_ => assert!(false),
}
match results[2] {
Value::Symbol(str) => assert_eq!(*str, "-".to_string()),
_ => assert!(false),
}
match results[3] {
Value::Symbol(str) => assert_eq!(*str, "*".to_string()),
_ => assert!(false),
}
match results[4] {
Value::Symbol(str) => assert_eq!(*str, "?".to_string()),
_ => assert!(false),
}
match results[5] {
Value::Symbol(str) => assert_eq!(*str, "!".to_string()),
_ => assert!(false),
}
} | rust_cleaned_test_functions.jsonl/62120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 728
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
55752,
368,
341,
286,
1077,
1946,
284,
330,
7975,
488,
481,
353,
937,
753,
876,
286,
1077,
17364,
284,
609,
6984,
47307,
486,
931,
543,
286,
1077,
3059,
549,
11312,
48325,
29,
284,
1349,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_from_affine_reflection_from_line_that_does_not_cross_origin1() {
// We can always choose the y-intercept as the known point.
let bias = Vector2::new(0.0, 2.0);
let normal = Unit::from_value(
Vector2::new(-1.0 / f64::sqrt(5.0), 2.0 / f64::sqrt(5.0))
);
let matrix = Matrix3x3::from_affine_reflection(&normal, &bias);
let vector = Vector3::new(1.0, 0.0, 1.0);
let expected = Vector3::new(-1.0, 4.0, 1.0);
let result = matrix * vector;
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/129054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
48914,
482,
7793,
1170,
5673,
6528,
70197,
96374,
7913,
35284,
34043,
16,
368,
341,
286,
442,
1205,
646,
2677,
5157,
279,
379,
44894,
1484,
438,
279,
3881,
1459,
624,
286,
1077,
15470,
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_resolve_parent_module() {
let (analysis, pos) = analysis_and_position(
"
//- /lib.rs
mod foo;
//- /foo.rs
<|>// empty
",
);
let symbols = analysis.parent_module(pos).unwrap();
assert_eq_dbg(
r#"[(FileId(1), FileSymbol { name: "foo", node_range: [4; 7), kind: MODULE })]"#,
&symbols,
);
} | rust_cleaned_test_functions.jsonl/75849 | {
"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,
77291,
15960,
10750,
368,
341,
262,
1077,
320,
34484,
11,
1133,
8,
284,
6358,
8378,
9661,
1006,
286,
6228,
286,
78406,
608,
2740,
25638,
198,
286,
1463,
15229,
280,
286,
78406,
608,
7975,
25638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bigint_is_zero() {
let big_int = BigInt {
base: 10,
powers: vec![0],
};
assert_eq!(big_int.is_zero(), true);
} | rust_cleaned_test_functions.jsonl/48669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36386,
396,
6892,
19359,
368,
341,
286,
1077,
2409,
4042,
284,
62608,
341,
310,
2331,
25,
220,
16,
15,
345,
310,
13430,
25,
7486,
20703,
15,
1259,
286,
3634,
286,
2060,
10714,
10297,
16154,
4042... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parsing_del_without_key() {
let statement = get_statement!("DEL");
assert_eq!(
statement,
Statement {
stype: StatementType::Fail,
key: None,
value: None
}
);
} | rust_cleaned_test_functions.jsonl/104584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
18029,
39904,
3097,
368,
341,
310,
1077,
5114,
284,
633,
37404,
17223,
38332,
797,
310,
2060,
10714,
33673,
394,
5114,
345,
394,
21756,
341,
503,
357,
499,
25,
21756,
929,
486,
19524,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_time_addassignment() {
let hms = NaiveTime::from_hms;
let mut time = hms(12, 12, 12);
time += Duration::hours(10);
assert_eq!(time, hms(22, 12, 12));
time += Duration::hours(10);
assert_eq!(time, hms(8, 12, 12));
} | rust_cleaned_test_functions.jsonl/86750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
2891,
29951,
368,
341,
286,
1077,
305,
1011,
284,
12812,
533,
1462,
486,
1499,
1523,
1011,
280,
286,
1077,
5206,
882,
284,
305,
1011,
7,
16,
17,
11,
220,
16,
17,
11,
220,
16,
17,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_topological_sort_cycle() -> Result<(), Error> {
let deps = hashmap! {
"n0".into() => btreeset!["n1".into(), "n2".into(), "n3".into()],
"n1".into() => btreeset!["n4".into(), "n6".into()],
"n2".into() => btreeset!["n4".into()],
"n3".into() => btreeset!["n5".into(), "n6".into()],
"n4".into() => btreeset!["n6".into()],
"n5".into() => BTreeSet::new(),
"n6".into() => btreeset!["n1".into()],
};
let result = topological_sort(&deps);
assert!(result.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/25440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10426,
5729,
18435,
39079,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
48178,
284,
92148,
0,
341,
310,
330,
77,
15,
3263,
18122,
368,
589,
19592,
7858,
295,
0,
1183,
77,
16,
3263,
18122,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_store_channel_ok() {
let port_id = PortId::from_str(String::from_str("port-0").unwrap().as_str()).unwrap();
let channel_id = ChannelId::from_str(String::from_str("channel-0").unwrap().as_str()).unwrap();
let channel_end = ChannelEnd::default();
let mut context: Context<Test> = Context::new();
new_test_ext().execute_with(|| {
assert_eq!(
context
.store_channel((port_id.clone(), channel_id.clone()), &channel_end)
.is_ok(),
true
);
let result = context.channel_end(&(port_id.clone(), channel_id.clone())).unwrap();
assert_eq!(result, channel_end);
})
} | rust_cleaned_test_functions.jsonl/60072 | {
"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,
14809,
14571,
19817,
368,
341,
10217,
2635,
842,
284,
5776,
764,
486,
1499,
2895,
2242,
486,
1499,
2895,
445,
403,
12,
15,
1827,
15454,
1005,
300,
2895,
6011,
15454,
543,
10217,
5496,
842,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_type_offset_incomplete() {
// Need at least 4 bytes.
let buf = [0xff, 0xff, 0xff];
let rest = &mut EndianSlice::new(&buf, LittleEndian);
match parse_type_offset(rest, Format::Dwarf32) {
Err(Error::UnexpectedEof(_)) => assert!(true),
otherwise => panic!("Unexpected result: {:?}", otherwise),
};
} | rust_cleaned_test_functions.jsonl/102005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1819,
6917,
1243,
14737,
368,
341,
286,
442,
14656,
518,
3245,
220,
19,
5820,
624,
286,
1077,
6607,
284,
508,
15,
9020,
11,
220,
15,
9020,
11,
220,
15,
9020,
935,
286,
1077,
2732,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_publish_dhcp_logs_command_failure() {
let dhcp: Dhcp = Dhcp::default();
let kafka: Kafka = Kafka::default();
assert_eq!(publish_dhcp_logs(false, ERROR_MESSAGE,
dhcp, kafka), ERROR_MESSAGE);
} | rust_cleaned_test_functions.jsonl/13564 | {
"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,
58779,
814,
62169,
42899,
10811,
43618,
368,
341,
286,
1077,
85787,
25,
43227,
4672,
284,
43227,
4672,
486,
2258,
543,
286,
1077,
67852,
25,
57025,
284,
57025,
486,
2258,
543,
286,
2060,
10714,
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 |
#[test]
fn test_from_frac_only_lit() {
let d = Decimal::<7>::from_str("+.75").unwrap();
assert_eq!(d.coeff, 7500000);
} | rust_cleaned_test_functions.jsonl/12018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
70358,
18410,
98399,
368,
341,
286,
1077,
294,
284,
26728,
27638,
22,
6831,
1499,
2895,
34973,
13,
22,
20,
1827,
15454,
543,
286,
2060,
10714,
10297,
67,
86462,
11,
220,
22,
20,
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 |
#[test]
fn test_decoder_invalid_partial() {
let mut d = HZEncoding.decoder();
assert_feed_ok!(d, b"", b"~", "");
assert_finish_err!(d, "");
let mut d = HZEncoding.decoder();
assert_feed_ok!(d, b"~{", b"#", "");
assert_finish_err!(d, "");
let mut d = HZEncoding.decoder();
assert_feed_ok!(d, b"~{#A", b"~", "\uff21");
assert_finish_err!(d, "");
} | rust_cleaned_test_functions.jsonl/48123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
31433,
52068,
368,
341,
286,
1077,
5206,
294,
284,
472,
57,
14690,
74047,
543,
286,
2060,
42390,
19817,
10297,
67,
11,
293,
56323,
293,
1,
93,
497,
14498,
286,
2060,
42980,
9266,
10297,
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_lew_mean() {
let result = get_actual_result("test_csvs/Lew.csv", "mean");
assert_abs_diff_eq!(result, -177.435000000000, epsilon = mean_epsilon());
} | rust_cleaned_test_functions.jsonl/80550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11751,
86,
16933,
368,
341,
262,
1077,
1102,
284,
633,
40149,
5287,
445,
1944,
14020,
82,
7434,
365,
11219,
497,
330,
14287,
797,
262,
2060,
31170,
15850,
10714,
10297,
1382,
11,
481,
16,
22,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_transaction_status() {
let blockstore_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&blockstore_path).unwrap();
// TransactionStatus column opens initialized with one entry at index 2
let transaction_status_cf = blockstore.db.column::<cf::TransactionStatus>();
let pre_balances_vec = vec![1, 2, 3];
let post_balances_vec = vec![3, 2, 1];
let status = TransactionStatusMeta {
status: solana_sdk::transaction::Result::<()>::Ok(()),
fee: 42u64,
pre_balances: pre_balances_vec,
post_balances: post_balances_vec,
inner_instructions: Some(vec![]),
log_messages: Some(vec![]),
pre_token_balances: Some(vec![]),
post_token_balances: Some(vec![]),
}
.into();
let signature1 = Signature::new(&[1u8; 64]);
let signature2 = Signature::new(&[2u8; 64]);
let signature3 = Signature::new(&[3u8; 64]);
let signature4 = Signature::new(&[4u8; 64]);
let signature5 = Signature::new(&[5u8; 64]);
let signature6 = Signature::new(&[6u8; 64]);
let signature7 = Signature::new(&[7u8; 64]);
// Insert slots with fork
let meta0 = SlotMeta::new(0, 0);
blockstore.meta_cf.put(0, &meta0).unwrap();
let meta1 = SlotMeta::new(1, 0);
blockstore.meta_cf.put(1, &meta1).unwrap();
let meta2 = SlotMeta::new(2, 0);
blockstore.meta_cf.put(2, &meta2).unwrap();
let meta3 = SlotMeta::new(3, 2);
blockstore.meta_cf.put(3, &meta3).unwrap();
blockstore.set_roots(&[0, 2]).unwrap();
transaction_status_cf
.put_protobuf((0, signature2, 1), &status)
.unwrap();
transaction_status_cf
.put_protobuf((0, signature2, 2), &status)
.unwrap();
transaction_status_cf
.put_protobuf((0, signature4, 1), &status)
.unwrap();
transaction_status_cf
.put_protobuf((0, signature5, 1), &status)
.unwrap();
transaction_status_cf
.put_protobuf((0, signature5, 3), &status)
.unwrap();
transaction_status_cf
.put_protobuf((0, signature6, 1), &status)
.unwrap();
// signature5 extra entries
transaction_status_cf
.put_protobuf((1, signature4, 2), &status)
.unwrap();
transaction_status_cf
.put_protobuf((1, signature5, 4), &status)
.unwrap();
transaction_status_cf
.put_protobuf((1, signature5, 5), &status)
.unwrap();
transaction_status_cf
.put_protobuf((1, signature6, 3), &status)
.unwrap();
if let (Some((slot, _status)), counter) = blockstore
.get_transaction_status_with_counter(signature2, &[])
.unwrap()
{
assert_eq!(slot, 2);
assert_eq!(counter, 2);
}
if let (Some((slot, _status)), counter) = blockstore
.get_transaction_status_with_counter(signature2, &[3])
.unwrap()
{
assert_eq!(slot, 2);
assert_eq!(counter, 2);
}
if let (Some((slot, _status)), counter) = blockstore
.get_transaction_status_with_counter(signature4, &[])
.unwrap()
{
assert_eq!(slot, 2);
assert_eq!(counter, 3);
}
if let (Some((slot, _status)), counter) = blockstore
.get_transaction_status_with_counter(signature4, &[3])
.unwrap()
{
assert_eq!(slot, 2);
assert_eq!(counter, 3);
}
let (status, counter) = blockstore
.get_transaction_status_with_counter(signature5, &[])
.unwrap();
assert_eq!(status, None);
assert_eq!(counter, 6);
if let (Some((slot, _status)), counter) = blockstore
.get_transaction_status_with_counter(signature5, &[3])
.unwrap()
{
assert_eq!(slot, 3);
assert_eq!(counter, 2);
}
let (status, counter) = blockstore
.get_transaction_status_with_counter(signature1, &[])
.unwrap();
assert_eq!(status, None);
assert_eq!(counter, 2);
let (status, counter) = blockstore
.get_transaction_status_with_counter(signature1, &[3])
.unwrap();
assert_eq!(status, None);
assert_eq!(counter, 2);
let (status, counter) = blockstore
.get_transaction_status_with_counter(signature3, &[])
.unwrap();
assert_eq!(status, None);
assert_eq!(counter, 2);
let (status, counter) = blockstore
.get_transaction_status_with_counter(signature3, &[3])
.unwrap();
assert_eq!(status, None);
assert_eq!(counter, 2);
let (status, counter) = blockstore
.get_transaction_status_with_counter(signature7, &[])
.unwrap();
assert_eq!(status, None);
assert_eq!(counter, 2);
let (status, counter) = blockstore
.get_transaction_status_with_counter(signature7, &[3])
.unwrap();
assert_eq!(status, None);
assert_eq!(counter, 2);
}
Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/7616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3608
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
28884,
4773,
368,
341,
286,
1077,
2504,
4314,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
2099,
4574,
4314,
2638,
568,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_slice_entire() {
// be exactly the same as the entire encoded tree. This can act as a cheap way to convert
// an outboard tree to a combined one.
for &case in crate::test::TEST_CASES {
println!("case {}", case);
let input = make_test_input(case);
let (encoded, _) = encode::encode(&input);
let (outboard, _) = encode::outboard(&input);
let mut slice = Vec::new();
let mut extractor = encode::SliceExtractor::new_outboard(
Cursor::new(&input),
Cursor::new(&outboard),
0,
case as u64,
);
extractor.read_to_end(&mut slice).unwrap();
assert_eq!(encoded, slice);
}
} | rust_cleaned_test_functions.jsonl/118143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
27425,
554,
368,
341,
16885,
286,
442,
387,
6896,
279,
1852,
438,
279,
4453,
20498,
4916,
13,
1096,
646,
1160,
438,
264,
11872,
1616,
311,
5508,
198,
286,
442,
458,
700,
2482,
4916,
311,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_insert() {
let hdr: MapxOrdRawKeyVs<usize> = MapxOrdRawKeyVs::new();
pnk!(hdr.version_create(VersionName(b"manster0")));
let max = 500;
(0..max)
.map(|i: usize| (i, (max + i)))
.for_each(|(key, value)| {
let key = <usize as ValueEnDe>::encode(&key);
assert!(hdr.get(&key).is_none());
assert!(pnk!(hdr.insert(key.clone(), value)).is_none());
assert!(pnk!(hdr.insert(key.clone(), value)).is_some());
assert!(hdr.contains_key(&key));
assert_eq!(pnk!(hdr.get(&key)), value);
assert_eq!(pnk!(pnk!(hdr.remove(&key))), value);
assert!(hdr.get(&key).is_none());
});
} | rust_cleaned_test_functions.jsonl/53983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
262,
1077,
36615,
25,
5027,
87,
24621,
20015,
1592,
51737,
90244,
29,
284,
5027,
87,
24621,
20015,
1592,
51737,
486,
931,
543,
262,
43050,
74,
10297,
28785,
19484,
8657,
7,
5637,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u64() {
assert_eq!(unsigned_integer_64("0"), Ok(("", 0)));
assert_eq!(unsigned_integer_64("1"), Ok(("", 1)));
assert_eq!(
unsigned_integer_64("18446744073709551615"),
Ok(("", 18_446_744_073_709_551_615))
);
assert_eq!(
unsigned_integer_64("18446744073709551616"),
Err(Err::Error(Error::new(
"18446744073709551616",
ErrorKind::MapRes
)))
);
} | rust_cleaned_test_functions.jsonl/71150 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
21,
19,
368,
341,
310,
2060,
10714,
10297,
3626,
31725,
62,
21,
19,
445,
15,
3975,
7622,
7,
19814,
220,
15,
4945,
310,
2060,
10714,
10297,
3626,
31725,
62,
21,
19,
445,
16,
3975,
7622,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_setattr_2() {
check_output_default(
"class Bar {}\n\
class Foo {}\n\
var foo = Foo();\n\
foo.bar = Bar();\n\
foo.bar.baz = \"baz\";\n\
print foo.bar.baz;",
"\'baz\'",
)
} | rust_cleaned_test_functions.jsonl/111850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
2991,
62,
17,
368,
341,
286,
1779,
7645,
9993,
1006,
310,
330,
1040,
4716,
56057,
77,
5661,
1797,
536,
33428,
56057,
77,
5661,
1797,
762,
15229,
284,
33428,
2129,
59,
77,
5661,
1797,
15229... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_inline_aliases2b() {
test_same("var x = this.foo(); this.bar(); var y; y = x; y = 3; this.baz(y); ");
} | rust_cleaned_test_functions.jsonl/27680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
41871,
90233,
17,
65,
368,
341,
262,
1273,
33574,
445,
947,
856,
284,
419,
58432,
2129,
419,
22001,
2129,
762,
379,
26,
379,
284,
856,
26,
379,
284,
220,
18,
26,
419,
948,
1370,
7021,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_minority_fork_overcommit_attack() {
let neutral_fork = ForkInfo {
leader: 0,
fork: vec![0, 1, 2],
voters: vec![],
};
let forks: Vec<ForkInfo> = vec![
// Minority fork
ForkInfo {
leader: 2,
fork: (3..=3 + 8).collect(),
voters: vec![2],
},
ForkInfo {
leader: 1,
fork: (12..12 + 8).collect(),
voters: vec![0, 1],
},
];
let validators: Vec<ValidatorInfo> = vec![
ValidatorInfo {
stake: 34_000_000,
keypair: Keypair::new(),
authorized_voter_keypair: Keypair::new(),
staking_keypair: Keypair::new(),
},
ValidatorInfo {
stake: 33_000_000,
keypair: Keypair::new(),
authorized_voter_keypair: Keypair::new(),
staking_keypair: Keypair::new(),
},
// Malicious Node
ValidatorInfo {
stake: 33_000_000,
keypair: Keypair::new(),
authorized_voter_keypair: Keypair::new(),
staking_keypair: Keypair::new(),
},
];
let resp = simulate_fork_selection(&neutral_fork, &forks, &validators);
// Both honest nodes are now want to switch to minority fork and are locked out
assert!(resp[0].is_some());
assert_eq!(resp[0].as_ref().unwrap().is_locked_out, true);
assert_eq!(
resp[0].as_ref().unwrap().slot,
forks[0].fork.last().unwrap().clone()
);
assert!(resp[1].is_some());
assert_eq!(resp[1].as_ref().unwrap().is_locked_out, true);
assert_eq!(
resp[1].as_ref().unwrap().slot,
forks[0].fork.last().unwrap().clone()
);
} | rust_cleaned_test_functions.jsonl/91750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70861,
487,
761,
669,
15431,
17413,
45697,
368,
341,
286,
1077,
20628,
761,
669,
284,
47850,
1731,
341,
310,
7653,
25,
220,
15,
345,
310,
22435,
25,
7486,
20703,
15,
11,
220,
16,
11,
220,
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_example3() {
let expr = expr!(Atom::SubStr {
index: 0,
left: Position::CPos(0),
right: Position::Pos(Token::punctuation('\\').into(), RegExp::empty(), -1)
});
run_expr_test(
&expr,
vec![
(vec!["Company\\Code\\index.html"], "Company\\Code\\"),
(
vec!["Company\\Docs\\Spec\\specs.doc"],
"Company\\Docs\\Spec\\",
),
(vec!["\\Users\\xlor\\FlashFill"], "\\Users\\xlor\\"),
],
)
} | rust_cleaned_test_functions.jsonl/14498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
18,
368,
341,
220,
1077,
15169,
284,
15169,
10297,
35836,
486,
3136,
2580,
341,
262,
1922,
25,
220,
15,
345,
262,
2115,
25,
12380,
486,
34,
4859,
7,
15,
1326,
262,
1290,
25,
12380,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_response() {
let orig = io::Error::new(io::ErrorKind::Other, "other");
let err: Error = ParseError::Io(orig).into();
assert_eq!(
format!("{}", err),
"error parsing HTTP message: IO error: other"
);
} | rust_cleaned_test_functions.jsonl/5114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
9655,
368,
341,
286,
1077,
2713,
284,
6399,
486,
1454,
486,
931,
37258,
486,
1454,
10629,
486,
11409,
11,
330,
1575,
797,
286,
1077,
1848,
25,
4600,
284,
14775,
1454,
486,
42799,
54837,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_crack_vigenere() {
// Set 1 Challenge 6
let key = crack_vigenere(VIGENERE_STRING).unwrap();
// Terminator X: Bring the noise
let expected = &[84, 101, 114, 109, 105, 110, 97, 116, 111, 114, 32, 88, 58, 32, 66, 114, 105, 110, 103, 32, 116, 104, 101, 32, 110, 111, 105, 115, 101];
assert_eq!(key, expected);
// It's "Play That Funky Music"
} | rust_cleaned_test_functions.jsonl/74995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32331,
473,
2273,
6433,
485,
368,
341,
286,
442,
2573,
220,
16,
25257,
220,
21,
198,
286,
1077,
1376,
284,
17486,
2273,
6433,
485,
12410,
1914,
12265,
36,
12283,
568,
15454,
543,
286,
442,
97361... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inspect_log_parsing() {
let (_inspector, mut node) = inspector_and_list_node();
inspect_log!(node, k1: "v1", k2: "v2");
inspect_log!(node, k1: "v1", k2: "v2",);
inspect_log!(node, {
k1: "v1",
k2: "v2"
});
inspect_log!(node, {
k1: "v1",
k2: "v2",
});
} | rust_cleaned_test_functions.jsonl/90892 | {
"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,
34386,
987,
5224,
620,
28598,
368,
341,
1789,
286,
1077,
5453,
1330,
18997,
11,
5206,
2436,
8,
284,
44725,
8378,
2019,
5084,
1428,
1789,
286,
24085,
5224,
10297,
3509,
11,
595,
16,
25,
330,
85,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message_add() {
let msg1 = Message::random().unwrap();
let msg2 = Message::random().unwrap();
let msg3 = (msg1 + msg2).unwrap();
let msg1_point = msg1.to_point().decompress().unwrap();
let msg2_point = msg2.to_point().decompress().unwrap();
let msg3_point = msg3.to_point().decompress().unwrap();
assert_eq!(msg3_point, msg1_point + msg2_point);
} | rust_cleaned_test_functions.jsonl/42591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
2891,
368,
341,
262,
1077,
3750,
16,
284,
4856,
486,
11463,
1005,
15454,
543,
262,
1077,
3750,
17,
284,
4856,
486,
11463,
1005,
15454,
543,
262,
1077,
3750,
18,
284,
320,
3236,
16,
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_descriptor_calculation_with_multiple_functions() {
let includes: [PathBuf; 0] = [];
let defines: [(String, String); 0] = [];
let (comp, _) = compile(
None,
&Path::new(""),
"
#version 450
layout(set = 1, binding = 0) buffer Buffer {
vec3 data;
} bo;
layout(set = 2, binding = 0) uniform Uniform {
float data;
} ubo;
layout(set = 3, binding = 1) uniform sampler textureSampler;
layout(set = 3, binding = 2) uniform texture2D imageTexture;
float withMagicSparkles(float data) {
return texture(sampler2D(imageTexture, textureSampler), vec2(data, data)).x;
}
vec3 makeSecretSauce() {
return vec3(withMagicSparkles(ubo.data));
}
void main() {
bo.data = makeSecretSauce();
}
",
ShaderKind::Vertex,
&includes,
&defines,
None,
None,
)
.unwrap();
let spirv = Spirv::new(comp.as_binary()).unwrap();
for (_, _, info) in reflect::entry_points(&spirv, true) {
let mut bindings = Vec::new();
for (loc, _reqs) in info.descriptor_requirements {
bindings.push(loc);
}
assert_eq!(bindings.len(), 4);
assert!(bindings.contains(&(1, 0)));
assert!(bindings.contains(&(2, 0)));
assert!(bindings.contains(&(3, 1)));
assert!(bindings.contains(&(3, 2)));
return;
}
panic!("Could not find entrypoint");
} | rust_cleaned_test_functions.jsonl/77126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 873
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33774,
38241,
2914,
6615,
45233,
31708,
368,
341,
286,
1077,
5646,
25,
508,
1820,
15064,
26,
220,
15,
60,
284,
5907,
286,
1077,
18653,
25,
17826,
703,
11,
923,
1215,
220,
15,
60,
284,
5907,
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... | 3 |
#[test]
fn test_keywords_after_unsafe_in_block_expr() {
check(
r"fn my_fn() { unsafe <|> }",
expect![[r#"
kw fn
kw impl
kw trait
"#]],
);
} | rust_cleaned_test_functions.jsonl/99580 | {
"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,
51354,
19844,
4907,
18675,
1243,
7113,
21915,
368,
341,
286,
1779,
1006,
310,
435,
1,
8822,
847,
15246,
368,
314,
19860,
82639,
29,
335,
756,
310,
1720,
0,
15505,
81,
2,
698,
394,
29525,
5168,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_if_root() {
let path = ActorPath::from("/acme/building/room/sensor");
let root = path.root();
println!("{:?}", path);
println!("{:?}", root);
assert!(root.is_top_level());
assert!(!path.is_top_level());
} | rust_cleaned_test_functions.jsonl/32097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
12993,
368,
341,
286,
1077,
1815,
284,
24718,
1820,
486,
1499,
4283,
580,
2660,
30593,
287,
14,
2966,
2687,
3805,
797,
286,
1077,
3704,
284,
1815,
12576,
543,
286,
13751,
88928,
25,
52652,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_arguments_response_file() {
assert_eq!(CompilerArguments::CannotCache("@", None),
parse_arguments(&ovec!["-c", "foo.c", "@foo", "-Fofoo.obj"]));
} | rust_cleaned_test_functions.jsonl/14165 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
43433,
9655,
2458,
368,
341,
286,
2060,
10714,
10297,
38406,
19139,
486,
17444,
8233,
10662,
497,
2240,
1326,
4293,
4715,
43433,
2099,
994,
66,
0,
1183,
12,
66,
497,
330,
7975,
520,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_timestamp_builder() {
// Using individual field setters produces the same Timestamp as using setters
let timestamp1 = Timestamp::with_year(2021)
.with_month(2)
.with_day(5)
.with_hour_and_minute(17, 39)
.with_second(51)
.with_milliseconds(194)
.build_at_offset(-4 * 60)
.unwrap_or_else(|e| panic!("Couldn't build timestamp: {:?}", e));
let timestamp2 = Timestamp::with_ymd(2021, 2, 5)
.with_hms(17, 39, 51)
.with_milliseconds(194)
.build_at_offset(-4 * 60)
.unwrap_or_else(|e| panic!("Couldn't build timestamp: {:?}", e));
let timestamp3 = Timestamp::with_ymd_hms_millis(2021, 2, 5, 17, 39, 51, 194)
.build_at_offset(-4 * 60)
.unwrap_or_else(|e| panic!("Couldn't build timestamp: {:?}", e));
assert_eq!(timestamp1.precision, Precision::FractionalSeconds);
assert_eq!(timestamp1.fractional_seconds, Some(Mantissa::Digits(3)));
assert_eq!(timestamp1, timestamp2);
assert_eq!(timestamp2, timestamp3);
} | rust_cleaned_test_functions.jsonl/13963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 581
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
28532,
368,
341,
286,
442,
12091,
3842,
2070,
80842,
18644,
279,
1852,
32758,
438,
1667,
80842,
8945,
286,
1077,
11441,
16,
284,
32758,
486,
4197,
14645,
7,
17,
15,
17,
16,
340,
310,
659,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_optional_args() {
fn add(_: &State, val: u32, a: u32, b: Option<u32>) -> Result<u32, Error> {
let mut sum = val + a;
if let Some(b) = b {
sum += b;
}
Ok(sum)
}
let env = crate::Environment::new();
let state = State {
env: &env,
ctx: crate::vm::Context::default(),
auto_escape: crate::AutoEscape::None,
current_block: None,
name: "<unknown>",
};
let bx = BoxedFilter::new(add);
assert_eq!(
bx.apply_to(&state, Value::from(23), vec![Value::from(42)])
.unwrap(),
Value::from(65)
);
assert_eq!(
bx.apply_to(
&state,
Value::from(23),
vec![Value::from(42), Value::UNDEFINED]
)
.unwrap(),
Value::from(65)
);
assert_eq!(
bx.apply_to(
&state,
Value::from(23),
vec![Value::from(42), Value::from(1)]
)
.unwrap(),
Value::from(66)
);
} | rust_cleaned_test_functions.jsonl/83573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74644,
8384,
368,
341,
286,
5168,
912,
73834,
609,
1397,
11,
1044,
25,
575,
18,
17,
11,
264,
25,
575,
18,
17,
11,
293,
25,
6959,
34837,
18,
17,
9231,
1464,
5714,
34837,
18,
17,
11,
4600,
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_last() {
let mut a = vec![];
assert_eq!(a.last(), None);
a = vec![11];
assert_eq!(a.last().unwrap(), &11);
a = vec![11, 12];
assert_eq!(a.last().unwrap(), &12);
} | rust_cleaned_test_functions.jsonl/12854 | {
"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,
12195,
368,
341,
262,
1077,
5206,
264,
284,
7486,
0,
15078,
262,
2060,
10714,
10297,
64,
9110,
1507,
2240,
317,
262,
264,
284,
7486,
20703,
16,
16,
935,
262,
2060,
10714,
10297,
64,
9110,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repeat() {
assert_eq!("x".repeat(4), String::from_str("xxxx"));
assert_eq!("hi".repeat(4), String::from_str("hihihihi"));
assert_eq!("ไท华".repeat(3), String::from_str("ไท华ไท华ไท华"));
assert_eq!("".repeat(4), String::from_str(""));
assert_eq!("hi".repeat(0), String::from_str(""));
} | rust_cleaned_test_functions.jsonl/56802 | {
"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,
41975,
368,
341,
286,
2060,
10714,
17223,
87,
3263,
30624,
7,
19,
701,
923,
486,
1499,
2895,
445,
18516,
4010,
286,
2060,
10714,
17223,
6023,
3263,
30624,
7,
19,
701,
923,
486,
1499,
2895,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_redshift_describe_reserved_node_offerings() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"redshift-describe-reserved-node-offerings.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DescribeReservedNodeOfferingsMessage::default();
let result = client.describe_reserved_node_offerings(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/12118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
26058,
13418,
15768,
3114,
74913,
5084,
67814,
819,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_request_dev_eui_extraction() {
let data = phy_join_request_payload();
let phy = PhyPayload::new(&data[..]);
assert!(phy.is_ok());
if let MacPayload::JoinRequest(join_request) = phy.unwrap().mac_payload() {
assert_eq!(join_request.dev_eui(), EUI64::new(&data[9..17]).unwrap());
} else {
panic!("failed to parse JoinRequest mac payload");
}
} | rust_cleaned_test_functions.jsonl/81614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
7893,
10433,
2204,
1963,
94842,
368,
341,
262,
1077,
821,
284,
36455,
31017,
7893,
32813,
543,
262,
1077,
36455,
284,
92582,
29683,
486,
931,
2099,
691,
95874,
10149,
262,
2060,
10297,
12700,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_chunked_early_eof() {
let mut bytes = &b"\
9\r\n\
foo bar\
"[..];
let mut decoder = Decoder::chunked();
assert_eq!(decoder.decode(&mut bytes).unwrap().unwrap().len(), 7);
let e = decoder.decode(&mut bytes).unwrap_err();
assert_eq!(e.kind(), io::ErrorKind::UnexpectedEof);
} | rust_cleaned_test_functions.jsonl/13924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
30539,
291,
62,
22140,
90792,
368,
341,
286,
1077,
5206,
5820,
284,
609,
65,
83383,
310,
220,
24,
12016,
1699,
5661,
310,
15229,
3619,
5661,
286,
10545,
496,
935,
286,
1077,
5206,
24551,
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_clone_with_epoch() {
let mut stakes = Stakes::default();
let ((vote_pubkey, vote_account), (stake_pubkey, stake_account)) =
create_staked_node_accounts(10);
stakes.store(&vote_pubkey, &vote_account, true);
stakes.store(&stake_pubkey, &stake_account, true);
let stake = stake_state::stake_from(&stake_account).unwrap();
{
let vote_accounts = stakes.vote_accounts();
assert_eq!(
vote_accounts.get(&vote_pubkey).unwrap().0,
stake.stake(stakes.epoch, Some(&stakes.stake_history))
);
}
#[allow(deprecated)]
let stakes = stakes.clone_with_epoch(3);
{
let vote_accounts = stakes.vote_accounts();
assert_eq!(
vote_accounts.get(&vote_pubkey).unwrap().0,
stake.stake(stakes.epoch, Some(&stakes.stake_history))
);
}
} | rust_cleaned_test_functions.jsonl/94747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 496
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
6615,
20682,
368,
341,
286,
1077,
5206,
44425,
284,
794,
2050,
486,
2258,
1428,
286,
1077,
1781,
29358,
34014,
792,
11,
6910,
13500,
701,
320,
267,
726,
34014,
792,
11,
18279,
13500,
593,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bound_to_thread() {
let mut map = HashMap::new();
map.insert("a", "first value");
map.insert("b", "second value");
map.insert("c", "third value");
map.insert("d", "fourth value");
let mut settings = Settings::new();
settings.set_sort_maps(true);
settings.bind_to_thread();
assert_yaml_snapshot!(&map, @r###"
---
a: first value
b: second value
c: third value
d: fourth value
"###);
} | rust_cleaned_test_functions.jsonl/40591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19447,
2346,
10814,
368,
341,
262,
1077,
5206,
2415,
284,
10528,
486,
931,
543,
262,
2415,
7030,
445,
64,
497,
330,
3896,
897,
797,
262,
2415,
7030,
445,
65,
497,
330,
5569,
897,
797,
262,
241... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decoding_image_header() {
let mut header = Vec::new();
header.extend_from_slice(QOI_BYTES_MAGIC);
header.extend_from_slice(&0u32.to_be_bytes());
header.extend_from_slice(&0u32.to_be_bytes());
header.extend_from_slice(&[4, 0]);
assert_eq!(
decode_header(header.as_slice()),
Ok(ImageMeta { width: 0, height: 0, channels: 4, colorspace: Colorspace::Srgb })
);
} | rust_cleaned_test_functions.jsonl/69395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
3700,
4954,
8757,
368,
341,
262,
1077,
5206,
4247,
284,
11312,
486,
931,
1428,
262,
4247,
15831,
5673,
26488,
6253,
79781,
40705,
49194,
317,
262,
4247,
15831,
5673,
26488,
2099,
15,
84,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mtu() {
// and that we don't send an Ethernet frame whose size is greater than
// the MTU.
fn test(size: usize, expect_frames_sent: usize) {
let mut ctx = DummyContext::with_state(DummyEthernetContext::new(
DUMMY_CONFIG_V4.local_mac,
Ipv6::MINIMUM_LINK_MTU.into(),
));
<DummyContext as ArpHandler<_, _>>::insert_static_neighbor(
&mut ctx,
DummyDeviceId,
DUMMY_CONFIG_V4.remote_ip.get(),
DUMMY_CONFIG_V4.remote_mac,
);
let _ = send_ip_frame(
&mut ctx,
DummyDeviceId,
DUMMY_CONFIG_V4.remote_ip,
Buf::new(&mut vec![0; size], ..),
);
assert_eq!(ctx.frames().len(), expect_frames_sent);
}
test(Ipv6::MINIMUM_LINK_MTU.into(), 1);
test(usize::from(Ipv6::MINIMUM_LINK_MTU) + 1, 0);
} | rust_cleaned_test_functions.jsonl/114201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 594
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
24494,
368,
341,
1789,
286,
442,
323,
429,
582,
1513,
944,
3624,
458,
45408,
4034,
6693,
1379,
374,
7046,
1091,
198,
286,
442,
279,
19087,
52,
624,
286,
5168,
1273,
6856,
25,
22301,
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... | 1 |
#[test]
fn test_derive_decode_fixed_size() {
use binstruct_codegen::BinDecode;
#[derive(Debug, BinDecode, PartialEq)]
#[binstruct(mod_path = "crate::serialize")]
struct T {
_1: u32,
}
assert_eq!(T::MIN_SIZE, size_of::<u32>());
assert!(T::FIXED_SIZE);
let mut buf = BytesMut::new();
buf.put_u32_le(1);
let t = T::decode(&mut buf).unwrap();
assert_eq!(t, T { _1: 1 })
} | rust_cleaned_test_functions.jsonl/101522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
15227,
37839,
2368,
368,
341,
220,
990,
9544,
1235,
32018,
486,
28794,
32564,
280,
220,
11506,
27098,
42618,
11,
29344,
32564,
11,
55039,
5563,
220,
11506,
6863,
1235,
23351,
2638,
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_pubsub_unsubscribe_no_subs() {
let ctx = TestContext::new();
let mut con = ctx.connection();
{
let _pubsub = con.as_pubsub();
}
// Connection should be usable again for non-pubsub commands
let _: redis::Value = con.set("foo", "bar").unwrap();
let value: String = con.get("foo").unwrap();
assert_eq!(&value[..], "bar");
} | rust_cleaned_test_functions.jsonl/108960 | {
"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,
34014,
1966,
4907,
9384,
6536,
82767,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
1428,
262,
341,
286,
1077,
716,
9585,
1966,
284,
390,
535... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_field_int() {
let cases = vec![
(
vec![Datum::I64(1), Datum::I64(-2), Datum::I64(3)],
Datum::I64(0),
),
(
vec![Datum::I64(-1), Datum::I64(2), Datum::I64(-1), Datum::I64(2)],
Datum::I64(2),
),
(
vec![
Datum::I64(i64::MAX),
Datum::I64(0),
Datum::I64(i64::MIN),
Datum::I64(i64::MAX),
],
Datum::I64(3),
),
(
vec![Datum::Null, Datum::I64(0), Datum::I64(0)],
Datum::I64(0),
),
(vec![Datum::Null, Datum::Null, Datum::I64(0)], Datum::I64(0)),
(vec![Datum::I64(100)], Datum::I64(0)),
];
let mut ctx = EvalContext::default();
for (args, exp) in cases {
let children: Vec<Expr> = (0..args.len()).map(|id| col_expr(id as i64)).collect();
let op = scalar_func_expr(ScalarFuncSig::FieldInt, &children);
let e = Expression::build(&mut ctx, op).unwrap();
let res = e.eval(&mut ctx, &args).unwrap();
assert_eq!(res, exp);
}
} | rust_cleaned_test_functions.jsonl/9106 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 820
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
4042,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
7486,
20703,
68036,
486,
40,
21,
19,
7,
16,
701,
68459,
486,
40,
21,
19,
4080,
17,
701,
68459,
486,
40,
21,
19,
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... | 2 |
#[test]
fn test_add_node_check_quorum() {
setup_for_test();
let mut r = new_test_raft(1, vec![1], 10, 1, new_storage());
r.check_quorum = true;
r.become_candidate();
r.become_leader();
for _ in 0..r.get_election_timeout() - 1 {
r.tick();
}
r.add_node(2);
r.tick();
// Node 1 should still be the leader after a single tick.
assert_eq!(r.state, StateRole::Leader);
// node 1 should step down.
for _ in 0..r.get_election_timeout() {
r.tick();
}
assert_eq!(r.state, StateRole::Follower);
} | rust_cleaned_test_functions.jsonl/107154 | {
"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,
2891,
5084,
7200,
11280,
33006,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
1125,
220,
16,
15,
11,
220,
16,
11,
501,
233... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_csi_normal_mouse() {
assert_eq!(
parse_csi_normal_mouse(b"\x1B[M0\x60\x70").unwrap(),
Some(InternalEvent::Event(Event::Mouse(MouseEvent {
kind: MouseEventKind::Down(MouseButton::Left),
column: 63,
row: 79,
modifiers: KeyModifiers::CONTROL,
})))
);
} | rust_cleaned_test_functions.jsonl/21331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
666,
6321,
13973,
39203,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
666,
6321,
13973,
39203,
1883,
11934,
87,
16,
33,
39379,
15,
3462,
21,
15,
3462,
22,
15,
1827,
15454,
3148,
310,
432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_permute_iter_2() {
assert_eq!(
_permute_iter(&vec!["abc", "def", "ghi"], &vec![2, 1, 0]),
vec!["ghi", "def", "abc"]
);
} | rust_cleaned_test_functions.jsonl/50997 | {
"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,
31961,
1070,
11723,
62,
17,
368,
341,
262,
2060,
10714,
33673,
286,
716,
19913,
1070,
11723,
2099,
4083,
0,
1183,
13683,
497,
330,
750,
497,
330,
75076,
7914,
609,
4083,
20703,
17,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unary_examples() {
assert_eq!(eval("3"), Ok(Value::Int(3)));
assert_eq!(eval("3.3"), Ok(Value::Float(3.3)));
assert_eq!(eval("true"), Ok(Value::Boolean(true)));
assert_eq!(eval("false"), Ok(Value::Boolean(false)));
assert_eq!(
eval("blub"),
Err(EvalexprError::VariableIdentifierNotFound(
"blub".to_string()
))
);
assert_eq!(eval("-3"), Ok(Value::Int(-3)));
assert_eq!(eval("-3.6"), Ok(Value::Float(-3.6)));
assert_eq!(eval("----3"), Ok(Value::Int(3)));
} | rust_cleaned_test_functions.jsonl/105337 | {
"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,
4907,
658,
45279,
368,
341,
262,
2060,
10714,
10297,
14170,
445,
18,
3975,
7622,
25346,
486,
1072,
7,
18,
4945,
262,
2060,
10714,
10297,
14170,
445,
18,
13,
18,
3975,
7622,
25346,
486,
5442,
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_parse_ifpriomap() -> Result<()> {
const CONTENT_OK: &str = "\
lo 0
wlp1s0 1
";
assert_eq!(
parse_ifpriomap(CONTENT_OK.as_bytes())?,
hashmap! { ("lo".to_string(), 0), ("wlp1s0".to_string(), 1) }
);
assert_eq!(parse_ifpriomap("".as_bytes())?, HashMap::new(),);
const CONTENT_NG_NOT_INT: &str = "\
lo 0
wlp1s0 invalid
";
const CONTENT_NG_MISSING_DATA: &str = "\
lo
wlp1s0 1
";
const CONTENT_NG_EXTRA_DATA: &str = "\
lo
wlp1s0 1 invalid
";
for case in &[
CONTENT_NG_NOT_INT,
CONTENT_NG_MISSING_DATA,
CONTENT_NG_EXTRA_DATA,
] {
assert_eq!(
parse_ifpriomap(case.as_bytes()).unwrap_err().kind(),
ErrorKind::Parse
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/50761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 487
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11119,
68608,
74811,
368,
1464,
5714,
71698,
341,
286,
733,
35768,
8375,
25,
609,
495,
284,
93317,
385,
220,
15,
198,
86,
13545,
16,
82,
15,
220,
16,
198,
3302,
286,
2060,
10714,
33673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_slice() {
let t = "αβγabc";
assert_eq!(t.get_slice(..), Some(t));
assert_eq!(t.get_slice(0..t.len()), Some(t));
assert_eq!(t.get_slice(1..), None);
assert_eq!(t.get_slice(0..t.len()+1), None);
assert_eq!(t.get_slice(t.len()+1..), None);
assert_eq!(t.get_slice(t.len()..), Some(""));
} | rust_cleaned_test_functions.jsonl/4260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
368,
341,
262,
1077,
259,
284,
330,
18945,
51255,
59374,
13683,
876,
262,
2060,
10714,
10297,
83,
670,
26488,
56422,
701,
4329,
1155,
1106,
262,
2060,
10714,
10297,
83,
670,
26488,
7,
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_single_element_text_change() {
let old = Element {
id: vec![0],
name: "p".into(),
text: Some("the cat sat on the mat".into()),
..Default::default()
};
let new = Element {
id: vec![0],
name: "p".into(),
text: Some("the mat sat on the cat".into()),
..Default::default()
};
let c = old.diff(Some(&new));
insta::assert_debug_snapshot!("test_single_element_text_change", c);
} | rust_cleaned_test_functions.jsonl/125800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
7894,
4326,
15947,
368,
341,
262,
1077,
2310,
284,
8543,
341,
286,
877,
25,
7486,
20703,
15,
1259,
286,
829,
25,
330,
79,
3263,
18122,
3148,
286,
1467,
25,
4329,
445,
1782,
8251,
7578,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_explorer_transaction_info() {
use exonum::explorer::{BlockchainExplorer, TransactionInfo};
use exonum::helpers::Height;
let (mut testkit, api) = init_testkit();
let tx = {
let (pubkey, key) = crypto::gen_keypair();
TxIncrement::new(&pubkey, 5, &key)
};
let info = api.public(ApiKind::Explorer)
.get::<Value>(&format!("v1/transactions?hash={}", &tx.hash().to_hex()))
.unwrap_err();
let error_body = json!({ "type": "unknown" });
assert_matches!(
info,
ApiError::NotFound(ref body) if serde_json::from_str::<Value>(body).unwrap() == error_body
);
api.send(tx.clone());
testkit.poll_events();
let info: Value = api.public(ApiKind::Explorer)
.get(&format!("v1/transactions?hash={}", &tx.hash().to_hex()))
.unwrap();
assert_eq!(
info,
json!({
"type": "in-pool",
"content": tx.serialize_field().unwrap(),
})
);
testkit.create_block();
let info: TransactionInfo<Value> = api.public(ApiKind::Explorer)
.get(&format!("v1/transactions?hash={}", &tx.hash().to_hex()))
.unwrap();
assert!(info.is_committed());
let committed = info.as_committed().unwrap();
assert_eq!(committed.location().block_height(), Height(1));
assert!(committed.status().is_ok());
let explorer = BlockchainExplorer::new(testkit.blockchain());
let block = explorer.block(Height(1)).unwrap();
assert!(
committed
.location_proof()
.validate(
*block.header().tx_hash(),
u64::from(block.header().tx_count())
)
.is_ok()
);
} | rust_cleaned_test_functions.jsonl/86877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
79825,
28884,
3109,
368,
341,
262,
990,
98744,
372,
486,
29892,
14827,
22964,
98898,
70916,
11,
17869,
1731,
2440,
262,
990,
98744,
372,
486,
21723,
486,
3640,
401,
262,
1077,
320,
6984,
127... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_unsafe_transmute_on_in_array___returns_expected_result() {
#[derive(Arraygen)]
#[gen_array(fn numbers: i32)]
struct Sut {
#[in_array(numbers { unsafe_transmute })]
pub a: f32,
}
let actual = Sut { a: -1.23456789 };
assert_eq!(actual.numbers()[0], -1080162734);
} | rust_cleaned_test_functions.jsonl/76354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
18675,
7965,
52214,
4470,
1243,
3858,
5973,
4216,
32190,
5287,
368,
341,
286,
11506,
27098,
38192,
4370,
5563,
286,
11506,
4370,
3858,
24008,
5109,
25,
600,
18,
17,
5563,
286,
2036,
328,
332... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_problem() {
let v = vec![1, 2, 3];
let w = vec![3, 5, 1];
let k = 42;
let p = build_problem(v.clone(), w.clone(), k.clone());
assert_eq!(p.v, v);
assert_eq!(p.w, w);
assert_eq!(p.k, k);
} | rust_cleaned_test_functions.jsonl/69075 | {
"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,
20801,
60139,
368,
341,
286,
1077,
348,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
289,
284,
7486,
20703,
18,
11,
220,
20,
11,
220,
16,
935,
286,
1077,
595,
284,
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_old_ridl() {
let rules = create_rules(
r#"
#[macro_export]
macro_rules! RIDL {
(interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident)
{$(
fn $method:ident(&mut self $(,$p:ident : $t:ty)*) -> $rtr:ty
),+}
) => {
impl $interface {
$(pub unsafe fn $method(&mut self) -> $rtr {
((*self.lpVtbl).$method)(self $(,$p)*)
})+
}
};
}"#,
);
let expanded = expand(&rules, r#"
RIDL!{interface ID3D11Asynchronous(ID3D11AsynchronousVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) {
fn GetDataSize(&mut self) -> UINT
}}"#);
assert_eq!(expanded.to_string(), "impl ID3D11Asynchronous {pub unsafe fn GetDataSize (& mut self) -> UINT {((* self . lpVtbl) .GetDataSize) (self)}}");
} | rust_cleaned_test_functions.jsonl/14738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21108,
1710,
55464,
368,
341,
9401,
262,
1077,
5601,
284,
1855,
21407,
1006,
286,
435,
2,
698,
13353,
32606,
27114,
921,
32606,
21407,
0,
27326,
43,
341,
262,
320,
4970,
400,
4970,
25,
1713,
171... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nonce_info() {
let lamports_per_signature = 42;
let nonce_authority = keypair_from_seed(&[0; 32]).unwrap();
let nonce_address = nonce_authority.pubkey();
let from = keypair_from_seed(&[1; 32]).unwrap();
let from_address = from.pubkey();
let to_address = Pubkey::new_unique();
let nonce_account = AccountSharedData::new_data(
43,
&nonce::state::Versions::new_current(nonce::State::Initialized(
nonce::state::Data::new(
Pubkey::default(),
Hash::new_unique(),
lamports_per_signature,
),
)),
&system_program::id(),
)
.unwrap();
let from_account = AccountSharedData::new(44, 0, &Pubkey::default());
let to_account = AccountSharedData::new(45, 0, &Pubkey::default());
let recent_blockhashes_sysvar_account = AccountSharedData::new(4, 0, &Pubkey::default());
const TEST_RENT_DEBIT: u64 = 1;
let rent_collected_nonce_account = {
let mut account = nonce_account.clone();
account.set_lamports(nonce_account.lamports() - TEST_RENT_DEBIT);
account
};
let rent_collected_from_account = {
let mut account = from_account.clone();
account.set_lamports(from_account.lamports() - TEST_RENT_DEBIT);
account
};
let instructions = vec![
system_instruction::advance_nonce_account(&nonce_address, &nonce_authority.pubkey()),
system_instruction::transfer(&from_address, &to_address, 42),
];
// NoncePartial create + NonceInfo impl
let partial = NoncePartial::new(nonce_address, rent_collected_nonce_account.clone());
assert_eq!(*partial.address(), nonce_address);
assert_eq!(*partial.account(), rent_collected_nonce_account);
assert_eq!(
partial.lamports_per_signature(),
Some(lamports_per_signature)
);
assert_eq!(partial.fee_payer_account(), None);
// Add rent debits to ensure the rollback captures accounts without rent fees
let mut rent_debits = RentDebits::default();
rent_debits.insert(
&from_address,
TEST_RENT_DEBIT,
rent_collected_from_account.lamports(),
);
rent_debits.insert(
&nonce_address,
TEST_RENT_DEBIT,
rent_collected_nonce_account.lamports(),
);
// NonceFull create + NonceInfo impl
{
let message = new_sanitized_message(&instructions, Some(&from_address));
let accounts = [
(
*message.account_keys().get(0).unwrap(),
rent_collected_from_account.clone(),
),
(
*message.account_keys().get(1).unwrap(),
rent_collected_nonce_account.clone(),
),
(*message.account_keys().get(2).unwrap(), to_account.clone()),
(
*message.account_keys().get(3).unwrap(),
recent_blockhashes_sysvar_account.clone(),
),
];
let full = NonceFull::from_partial(partial.clone(), &message, &accounts, &rent_debits)
.unwrap();
assert_eq!(*full.address(), nonce_address);
assert_eq!(*full.account(), rent_collected_nonce_account);
assert_eq!(full.lamports_per_signature(), Some(lamports_per_signature));
assert_eq!(
full.fee_payer_account(),
Some(&from_account),
"rent debit should be refunded in captured fee account"
);
}
// Nonce account is fee-payer
{
let message = new_sanitized_message(&instructions, Some(&nonce_address));
let accounts = [
(
*message.account_keys().get(0).unwrap(),
rent_collected_nonce_account,
),
(
*message.account_keys().get(1).unwrap(),
rent_collected_from_account,
),
(*message.account_keys().get(2).unwrap(), to_account),
(
*message.account_keys().get(3).unwrap(),
recent_blockhashes_sysvar_account,
),
];
let full = NonceFull::from_partial(partial.clone(), &message, &accounts, &rent_debits)
.unwrap();
assert_eq!(*full.address(), nonce_address);
assert_eq!(*full.account(), nonce_account);
assert_eq!(full.lamports_per_signature(), Some(lamports_per_signature));
assert_eq!(full.fee_payer_account(), None);
}
{
let message = new_sanitized_message(&instructions, Some(&nonce_address));
assert_eq!(
NonceFull::from_partial(partial, &message, &[], &RentDebits::default())
.unwrap_err(),
TransactionError::AccountNotFound,
);
}
} | rust_cleaned_test_functions.jsonl/55005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2695
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48508,
3109,
368,
341,
286,
1077,
31603,
3394,
5678,
39859,
284,
220,
19,
17,
401,
286,
1077,
39676,
22938,
487,
284,
1376,
12670,
5673,
33809,
2099,
58,
15,
26,
220,
18,
17,
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_raw_node_propose_add_learner_node() {
setup_for_test();
let s = new_storage();
let mut raw_node = new_raw_node(1, vec![], 10, 1, s.clone(), vec![new_peer(1)]);
let rd = raw_node.ready();
s.wl().append(rd.entries()).expect("");
raw_node.advance(rd);
raw_node.campaign().expect("");
loop {
let rd = raw_node.ready();
s.wl().append(rd.entries()).expect("");
if rd.ss().is_some() && rd.ss().unwrap().leader_id == raw_node.raft.id {
raw_node.advance(rd);
break;
}
raw_node.advance(rd);
}
// propose add learner node and check apply state
let cc = conf_change(ConfChangeType::AddLearnerNode, 2);
raw_node.propose_conf_change(vec![], cc).expect("");
let rd = raw_node.ready();
s.wl().append(rd.entries()).expect("");
assert!(
rd.committed_entries.is_some() && rd.committed_entries.as_ref().unwrap().len() == 1,
"should committed the conf change entry"
);
let e = &rd.committed_entries.as_ref().unwrap()[0];
let conf_change = protobuf::parse_from_bytes(e.get_data()).unwrap();
let conf_state = raw_node.apply_conf_change(&conf_change);
assert_eq!(conf_state.nodes, vec![1]);
assert_eq!(conf_state.learners, vec![2]);
} | rust_cleaned_test_functions.jsonl/2058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
5084,
21663,
960,
2891,
62,
93595,
5084,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
274,
284,
501,
23310,
543,
262,
1077,
5206,
7112,
5084,
284,
501,
16067,
5084,
7,
16,
11,
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... | 4 |
#[test]
fn test_stake_state_calculate_points_with_typical_values() {
let mut vote_state = VoteState::default();
// bootstrap means fully-vested stake at epoch 0 with
// 10_000_000 ANLOG is a big but not unreasaonable stake
let stake = new_stake(
native_token::anlog_to_tock(10_000_000f64),
&Pubkey::default(),
&vote_state,
std::u64::MAX,
&Config::default(),
);
assert_eq!(
None,
calculate_stake_rewards(
0,
&stake,
&PointValue {
rewards: 1_000_000_000,
points: 1
},
&vote_state,
None,
null_tracer(),
true,
)
);
let epoch_slots: u128 = 14 * 24 * 3600 * 160;
for _ in 0..epoch_slots {
vote_state.increment_credits(0);
}
// no overflow on points
assert_eq!(
u128::from(stake.delegation.stake) * epoch_slots,
calculate_stake_points(&stake, &vote_state, None, null_tracer())
);
} | rust_cleaned_test_functions.jsonl/15304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 715
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
4387,
24005,
11207,
12928,
6615,
42111,
938,
9146,
368,
341,
286,
1077,
5206,
6910,
4387,
284,
34034,
1397,
486,
2258,
1428,
286,
442,
26925,
3363,
7225,
12,
7019,
291,
18279,
518,
1634... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_data_block_index_type() {
let path = "_rust_rocksdb_test_set_data_block_index_type";
let n = DBPath::new(path);
// Default is `BinarySearch`
{
let mut opts = Options::default();
opts.create_if_missing(true);
let block_opts = BlockBasedOptions::default();
opts.set_block_based_table_factory(&block_opts);
let _db = DB::open(&opts, &n).expect("open a db works");
let mut rocksdb_log = fs::File::open(format!("{}/LOG", (&n).as_ref().to_str().unwrap()))
.expect("rocksdb creates a LOG file");
let mut settings = String::new();
rocksdb_log
.read_to_string(&mut settings)
.expect("can read the LOG file");
assert!(settings.contains("data_block_index_type: 0"));
assert!(settings.contains("data_block_hash_table_util_ratio: 0.750000"));
}
// Setting the index type and hash table utilization ratio works
{
let mut opts = Options::default();
opts.create_if_missing(false);
let mut block_opts = BlockBasedOptions::default();
block_opts.set_data_block_index_type(DataBlockIndexType::BinaryAndHash);
block_opts.set_data_block_hash_ratio(0.35);
opts.set_block_based_table_factory(&block_opts);
let _db = DB::open(&opts, &n).expect("open a db works");
let mut rocksdb_log = fs::File::open(format!("{}/LOG", (&n).as_ref().to_str().unwrap()))
.expect("rocksdb creates a LOG file");
let mut settings = String::new();
rocksdb_log
.read_to_string(&mut settings)
.expect("can read the LOG file");
assert!(settings.contains("data_block_index_type: 1"));
assert!(settings.contains("data_block_hash_table_util_ratio: 0.350000"));
}
} | rust_cleaned_test_functions.jsonl/131122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
1769,
7113,
3560,
1819,
368,
341,
262,
1077,
1815,
284,
9000,
35788,
26608,
14553,
1999,
4452,
2602,
1769,
7113,
3560,
1819,
876,
262,
1077,
308,
284,
5952,
1820,
486,
931,
5581,
626,
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_send_sync_impl() {
fn is_sync_and_send<T: Sync + Send>() {};
#[derive(Debug)]
struct TestError;
impl std::fmt::Display for TestError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "TestError")
}
}
impl std::error::Error for TestError {}
is_sync_and_send::<AccessToken>();
is_sync_and_send::<AuthUrl>();
is_sync_and_send::<AuthorizationCode>();
is_sync_and_send::<AuthorizationRequest>();
is_sync_and_send::<
Client<
StandardErrorResponse<BasicErrorResponseType>,
StandardTokenResponse<EmptyExtraTokenFields, BasicTokenType>,
BasicTokenType,
StandardTokenIntrospectionResponse<EmptyExtraTokenFields, BasicTokenType>,
StandardRevocableToken,
BasicRevocationErrorResponse,
>,
>();
is_sync_and_send::<
ClientCredentialsTokenRequest<
StandardErrorResponse<BasicErrorResponseType>,
StandardTokenResponse<EmptyExtraTokenFields, BasicTokenType>,
BasicTokenType,
>,
>();
is_sync_and_send::<ClientId>();
is_sync_and_send::<ClientSecret>();
is_sync_and_send::<
CodeTokenRequest<
StandardErrorResponse<BasicErrorResponseType>,
StandardTokenResponse<EmptyExtraTokenFields, BasicTokenType>,
BasicTokenType,
>,
>();
is_sync_and_send::<CsrfToken>();
is_sync_and_send::<EmptyExtraTokenFields>();
is_sync_and_send::<HttpRequest>();
is_sync_and_send::<HttpResponse>();
is_sync_and_send::<
PasswordTokenRequest<
StandardErrorResponse<BasicErrorResponseType>,
StandardTokenResponse<EmptyExtraTokenFields, BasicTokenType>,
BasicTokenType,
>,
>();
is_sync_and_send::<PkceCodeChallenge>();
is_sync_and_send::<PkceCodeChallengeMethod>();
is_sync_and_send::<PkceCodeVerifier>();
is_sync_and_send::<RedirectUrl>();
is_sync_and_send::<RefreshToken>();
is_sync_and_send::<
RefreshTokenRequest<
StandardErrorResponse<BasicErrorResponseType>,
StandardTokenResponse<EmptyExtraTokenFields, BasicTokenType>,
BasicTokenType,
>,
>();
is_sync_and_send::<ResourceOwnerPassword>();
is_sync_and_send::<ResourceOwnerUsername>();
is_sync_and_send::<ResponseType>();
is_sync_and_send::<Scope>();
is_sync_and_send::<StandardErrorResponse<BasicErrorResponseType>>();
is_sync_and_send::<StandardTokenResponse<EmptyExtraTokenFields, BasicTokenType>>();
is_sync_and_send::<TokenUrl>();
is_sync_and_send::<AuthType>();
is_sync_and_send::<BasicErrorResponseType>();
is_sync_and_send::<BasicTokenType>();
is_sync_and_send::<RequestTokenError<TestError, StandardErrorResponse<BasicErrorResponseType>>>(
);
is_sync_and_send::<DeviceCode>();
is_sync_and_send::<EndUserVerificationUrl>();
is_sync_and_send::<UserCode>();
is_sync_and_send::<DeviceAuthorizationUrl>();
is_sync_and_send::<StandardDeviceAuthorizationResponse>();
is_sync_and_send::<
DeviceAccessTokenRequest<
StandardTokenResponse<EmptyExtraTokenFields, BasicTokenType>,
BasicTokenType,
EmptyExtraDeviceAuthorizationFields,
>,
>();
is_sync_and_send::<DeviceAuthorizationRequest<StandardErrorResponse<BasicErrorResponseType>>>();
is_sync_and_send::<DeviceCodeErrorResponseType>();
is_sync_and_send::<DeviceCodeErrorResponse>();
#[cfg(feature = "curl")]
is_sync_and_send::<super::curl::Error>();
#[cfg(feature = "reqwest")]
is_sync_and_send::<super::reqwest::Error<TestError>>();
} | rust_cleaned_test_functions.jsonl/18635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
23008,
21007,
368,
341,
262,
5168,
374,
23008,
8378,
13565,
3125,
25,
28937,
488,
11000,
13555,
9321,
262,
11506,
27098,
42618,
5563,
262,
2036,
3393,
1454,
280,
262,
11605,
1460,
486,
12501,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clear() {
let mut rm = DefaultRoleManager::new(3);
rm.add_link("u1", "g1", None);
rm.add_link("u2", "g1", None);
rm.add_link("u3", "g2", None);
rm.add_link("u4", "g2", None);
rm.add_link("u4", "g3", None);
rm.add_link("g1", "g3", None);
rm.clear();
assert_eq!(false, rm.has_link("u1", "g1", None));
assert_eq!(false, rm.has_link("u1", "g2", None));
assert_eq!(false, rm.has_link("u1", "g3", None));
assert_eq!(false, rm.has_link("u2", "g1", None));
assert_eq!(false, rm.has_link("u2", "g2", None));
assert_eq!(false, rm.has_link("u2", "g3", None));
assert_eq!(false, rm.has_link("u3", "g1", None));
assert_eq!(false, rm.has_link("u3", "g2", None));
assert_eq!(false, rm.has_link("u3", "g3", None));
assert_eq!(false, rm.has_link("u4", "g1", None));
assert_eq!(false, rm.has_link("u4", "g2", None));
assert_eq!(false, rm.has_link("u4", "g3", None));
} | rust_cleaned_test_functions.jsonl/38671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21811,
368,
341,
286,
1077,
5206,
18998,
284,
7899,
9030,
2043,
486,
931,
7,
18,
317,
286,
18998,
1364,
7233,
445,
84,
16,
497,
330,
70,
16,
497,
2240,
317,
286,
18998,
1364,
7233,
445,
84,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_bogus_validators() {
match read_single_check("checks/tests/test10.json") {
Some(_) => assert!(false),
None => assert!(true),
}
} | rust_cleaned_test_functions.jsonl/80336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
880,
538,
355,
8337,
2973,
368,
341,
286,
2432,
1349,
19487,
7200,
445,
49383,
62468,
12697,
16,
15,
4323,
899,
341,
310,
4329,
48139,
589,
2060,
10297,
3849,
1326,
310,
2240,
589,
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
] | 2 |
#[test]
fn test_test_response_parse() {
let mut buf = BytesMut::from(TEST_RESPONSE);
let expected = get_test_response();
let res = TestResponse::parse(&mut buf);
assert_eq!(buf.remaining(), 0);
assert!(res.is_ok());
assert_eq!(res.unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/90786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4452,
9655,
21039,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
50320,
35901,
317,
286,
1077,
3601,
284,
633,
4452,
9655,
543,
286,
1077,
592,
284,
3393,
2582,
486,
6400,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_option() {
let data_orig = Foo {
field0: usize::MAX,
field1: format!("FOO_{}", i128::MIN),
};
let data = ArcSwapOption::from_pointee(data_orig.clone());
let data_str = serde_json::to_string(&data).unwrap();
let data_deser = serde_json::from_str::<Foo>(&data_str).unwrap();
assert_eq!(data_deser, data_orig);
} | rust_cleaned_test_functions.jsonl/122520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
9672,
368,
341,
286,
1077,
821,
35328,
284,
33428,
341,
310,
2070,
15,
25,
22301,
486,
10586,
345,
310,
2070,
16,
25,
3561,
17223,
3788,
46,
62,
42351,
600,
16,
17,
23,
486,
16413,
1326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_frames_from_duration() {
const FPS: usize = 48000;
// because frames need to be completely within the duration.
const ONE_FRAME_NANOS: i64 = 20833 + 1;
const THREE_FRAME_NANOS: i64 = 20833 * 3 + 1;
assert_eq!(0, frames_from_duration(FPS, 0.nanos()));
assert_eq!(0, frames_from_duration(FPS, (ONE_FRAME_NANOS - 1).nanos()));
assert_eq!(1, frames_from_duration(FPS, ONE_FRAME_NANOS.nanos()));
// a duration that is LONGER.
assert_eq!(2, frames_from_duration(FPS, (THREE_FRAME_NANOS - 1).nanos()));
assert_eq!(2, frames_from_duration(FPS, THREE_FRAME_NANOS.nanos()));
assert_eq!(3, frames_from_duration(FPS, (THREE_FRAME_NANOS + 1).nanos()));
assert_eq!(FPS - 1, frames_from_duration(FPS, 1.second()));
assert_eq!(72000 - 1, frames_from_duration(FPS, 1500.millis()));
assert_eq!(10660, frames_from_duration(FPS, 222084000.nanos()));
} | rust_cleaned_test_functions.jsonl/41877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29319,
5673,
25454,
368,
341,
286,
733,
43628,
25,
22301,
284,
220,
19,
23,
15,
15,
15,
280,
1789,
286,
442,
1576,
14087,
1184,
311,
387,
6587,
2878,
279,
8090,
624,
286,
733,
24038,
22260,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_script_serialization() {
for (original, entity) in &[
(
"{\
\"code_hash\":\"0x00000000000000000000000000000000\
00000000000000000000000000000000\",\
\"hash_type\":\"data\",\
\"args\":\"0x\"\
}",
Script {
code_hash: h256!("0x0"),
hash_type: ScriptHashType::Data,
args: JsonBytes::default(),
},
),
(
"{\
\"code_hash\":\"0x00000000000000000000000000000000\
00000000000000000000000000000000\",\
\"hash_type\":\"type\",\
\"args\":\"0x\"\
}",
Script {
code_hash: h256!("0x0"),
hash_type: ScriptHashType::Type,
args: JsonBytes::default(),
},
),
(
"{\
\"code_hash\":\"0x00000000000000000000000000000000\
00000000000000000000000000000001\",\
\"hash_type\":\"data1\",\
\"args\":\"0x\"\
}",
Script {
code_hash: h256!("0x1"),
hash_type: ScriptHashType::Data1,
args: JsonBytes::default(),
},
),
] {
let decoded: Script = serde_json::from_str(original).unwrap();
assert_eq!(&decoded, entity);
let encoded = serde_json::to_string(&decoded).unwrap();
assert_eq!(&encoded, original);
}
for malformed in &[
"{\
\"code_hash\":\"0x00000000000000000000000000000000\
00000000000000000000000000000000\",\
\"args\":\"0x\"\
}",
"{\
\"code_hash\":\"0x00000000000000000000000000000000\
00000000000000000000000000000000\",\
\"hash_type\":null,\
\"args\":\"0x\"\
}",
"{\
\"code_hash\":\"0x00000000000000000000000000000000\
00000000000000000000000000000000\",\
\"hash_type\":type,\
\"args\":\"0x\"\
}",
"{\
\"code_hash\":\"0x00000000000000000000000000000000\
00000000000000000000000000000000\",\
\"hash_type\":\"data2\",\
\"args\":\"0x\"\
}",
"{\
\"code_hash\":\"0x00000000000000000000000000000000\
00000000000000000000000000000000\",\
\"hash_type\":\"data\",\
\"unknown_field\":0,\
\"args\":\"0x\"\
}",
] {
let result: Result<Script, _> = serde_json::from_str(malformed);
assert!(
result.is_err(),
"should reject malformed json: [{}]",
malformed
)
}
} | rust_cleaned_test_functions.jsonl/100707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1644
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14660,
25602,
2022,
368,
341,
262,
369,
320,
9889,
11,
5387,
8,
304,
609,
9640,
286,
2399,
310,
13868,
5661,
394,
7245,
1851,
8950,
23488,
15,
87,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_vcx_issuer_send_credential_offer() {
init!("true");
let handle = issuer_credential::from_string(DEFAULT_SERIALIZED_ISSUER_CREDENTIAL).unwrap();
assert_eq!(issuer_credential::get_state(handle).unwrap(), VcxStateType::VcxStateInitialized as u32);
let connection_handle = ::connection::tests::build_test_connection();
connection::connect(connection_handle, None).unwrap();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_issuer_send_credential_offer(cb.command_handle,
handle,
connection_handle,
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
let cb = return_types_u32::Return_U32_U32::new().unwrap();
assert_eq!(vcx_issuer_credential_update_state_with_message(cb.command_handle, handle, CString::new(CREDENTIAL_REQ_RESPONSE_STR).unwrap().into_raw(), Some(cb.get_callback())), error::SUCCESS.code_num);
let state = cb.receive(Some(Duration::from_secs(10))).unwrap();
assert_eq!(state, VcxStateType::VcxStateRequestReceived as u32);
} | rust_cleaned_test_functions.jsonl/66772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 649
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
62,
66817,
13565,
666,
30320,
67814,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3705,
284,
54835,
666,
30320,
486,
1499,
3904,
43175,
14844,
88727,
92687,
52,
640,
920,
81509,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dump() {
let (_tmp, path) = tmpdir("test-glob");
dump(path.clone() + "/foo", "bar");
assert!(slurp(path.clone() + "/foo") == "bar");
} | rust_cleaned_test_functions.jsonl/74390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18296,
368,
341,
220,
1077,
5453,
5173,
11,
1815,
8,
284,
4174,
3741,
445,
1944,
2371,
1684,
797,
220,
10276,
5581,
15997,
368,
488,
3521,
7975,
497,
330,
2257,
797,
220,
2060,
10297,
3226,
324,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rc_clone() {
let str_pool : Pool<String> = Pool::with_size(2);
{
assert_eq!(2, str_pool.size());
let text = str_pool.new_rc_from("cat");
let text_clone = text.clone();
assert_eq!(text, text_clone);
assert_eq!(0, str_pool.size());
}
assert_eq!(2, str_pool.size());
} | rust_cleaned_test_functions.jsonl/121194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30299,
54742,
368,
341,
262,
1077,
607,
15709,
549,
22728,
3464,
29,
284,
22728,
486,
4197,
2368,
7,
17,
317,
262,
341,
414,
2060,
10714,
10297,
17,
11,
607,
15709,
2486,
1423,
414,
1077,
1467,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_dbg() {
check_assist(remove_dbg, "$0dbg!(1 + 1)", "1 + 1");
check_assist(remove_dbg, "dbg!$0((1 + 1))", "(1 + 1)");
check_assist(remove_dbg, "dbg!(1 $0+ 1)", "1 + 1");
check_assist(remove_dbg, "let _ = $0dbg!(1 + 1)", "let _ = 1 + 1");
check_assist(
remove_dbg,
"
fn foo(n: usize) {
if let Some(_) = dbg!(n.$0checked_sub(4)) {
// ...
}
}
",
"
fn foo(n: usize) {
if let Some(_) = n.checked_sub(4) {
// ...
}
}
",
);
check_assist(remove_dbg, "$0dbg!(Foo::foo_test()).bar()", "Foo::foo_test().bar()");
} | rust_cleaned_test_functions.jsonl/13605 | {
"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,
18193,
44124,
368,
341,
286,
1779,
12083,
380,
67709,
44124,
11,
5201,
15,
54318,
10297,
16,
488,
220,
16,
11583,
330,
16,
488,
220,
16,
3071,
286,
1779,
12083,
380,
67709,
44124,
11,
330,
54318... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_whitespace_elements() {
let c = Template::compile(
" {{elem}}\n\t{{#if true}} \
{{/if}}\n{{{{raw}}}} {{{{/raw}}}}\n{{{{raw}}}}{{{{/raw}}}}\n",
);
let r = c.unwrap();
// the \n after last raw block is dropped by pest
assert_eq!(r.elements.len(), 6);
} | rust_cleaned_test_functions.jsonl/110790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86175,
22801,
368,
341,
286,
1077,
272,
284,
14355,
486,
20433,
1006,
310,
330,
220,
5867,
18871,
3417,
59,
77,
4955,
2979,
2,
333,
830,
3417,
3044,
260,
5867,
14,
333,
3417,
59,
77,
2979,
297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_iter() {
let xs = [1, 2, 3, 4];
let ys = [4, 3, 2, 1];
assert!(xs.iter().eq(ys.iter().rev()));
assert!(xs.iter().lt(xs.iter().skip(2)));
} | rust_cleaned_test_functions.jsonl/70125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
11723,
368,
341,
262,
1077,
11943,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,
31810,
284,
508,
19,
11,
220,
18,
11,
220,
17,
11,
220,
16,
935,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tabs_empty_string() {
new_ucmd!()
.args(&["--tabs", ""])
.pipe_in("a\tb\tc")
.succeeds()
.stdout_is("a b c");
} | rust_cleaned_test_functions.jsonl/121794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57953,
15124,
3904,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
30993,
497,
330,
14108,
286,
659,
13768,
1243,
445,
64,
4955,
65,
4955,
66,
1138,
286,
659,
82,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_limit_reader_limit() {
let r = MemReader::new(vec!(0, 1, 2));
let mut r = LimitReader::new(r, 3);
assert_eq!(3, r.limit());
assert_eq!(0, r.read_byte().unwrap());
assert_eq!(2, r.limit());
assert_eq!(vec!(1, 2), r.read_to_end().unwrap());
assert_eq!(0, r.limit());
} | rust_cleaned_test_functions.jsonl/3605 | {
"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,
14763,
22306,
14763,
368,
341,
286,
1077,
435,
284,
13550,
5062,
486,
931,
25592,
10297,
15,
11,
220,
16,
11,
220,
17,
1106,
286,
1077,
5206,
435,
284,
28008,
5062,
486,
931,
2601,
11,
220,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_benchmarks() {
new_test_ext().execute_with(|| {
assert_ok!(test_benchmark_set::<Test>());
assert_ok!(test_benchmark_on_finalize::<Test>());
});
} | rust_cleaned_test_functions.jsonl/35879 | {
"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,
880,
19762,
15544,
368,
341,
197,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
298,
6948,
19817,
10297,
1944,
880,
39381,
2602,
27638,
2271,
32872,
298,
6948,
19817,
10297,
1944,
880,
39381,
447... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multi_tracker() {
use super::*;
use std::sync::Arc;
#[derive(Debug, Default, PartialEq)]
struct Value {
v1: u64,
v2: bool,
}
let count = 10;
let vc = Arc::new(VersionTrack::new(Value::default()));
let mut trackers = Vec::with_capacity(count);
for _ in 0..count {
trackers.push(vc.clone().tracker("test-tracker".to_owned()));
}
assert!(trackers.iter_mut().all(|tr| tr.any_new().is_none()));
vc.update(|v| {
v.v1 = 1000;
v.v2 = true;
});
for tr in trackers.iter_mut() {
let incoming = tr.any_new();
assert!(incoming.is_some());
let incoming = incoming.unwrap();
assert_eq!(incoming.v1, 1000);
assert_eq!(incoming.v2, true);
}
assert!(trackers.iter_mut().all(|tr| tr.any_new().is_none()));
} | rust_cleaned_test_functions.jsonl/1561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
50264,
368,
341,
286,
990,
2256,
56162,
286,
990,
1460,
486,
12996,
486,
36809,
401,
286,
11506,
27098,
42618,
11,
7899,
11,
55039,
5563,
286,
2036,
5162,
341,
310,
348,
16,
25,
575,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_trailing_whitespace() {
test_parse_ok(vec![
("[1, 2] ", vec![1u64, 2]),
("[1, 2]\n", vec![1, 2]),
("[1, 2]\t", vec![1, 2]),
("[1, 2]\t \n", vec![1, 2]),
]);
} | rust_cleaned_test_functions.jsonl/29845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
3547,
14277,
86175,
368,
341,
262,
1273,
21039,
19817,
25592,
90515,
286,
3489,
58,
16,
11,
220,
17,
60,
3670,
7486,
20703,
16,
84,
21,
19,
11,
220,
17,
17036,
286,
3489,
58,
16,
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_quat_funcs() {
let q0 = Quat::from_rotation_ypr(deg(45.0), deg(180.0), deg(90.0));
assert!(q0.is_normalized());
assert_approx_eq!(q0.length_squared(), 1.0);
assert_approx_eq!(q0.length(), 1.0);
assert_approx_eq!(q0.length_reciprocal(), 1.0);
assert_approx_eq!(q0, q0.normalize());
assert_approx_eq!(q0.dot(q0), 1.0);
assert_approx_eq!(q0.dot(q0), 1.0);
let q1 = Quat::from(Vec4::from(q0) * 2.0);
assert!(!q1.is_normalized());
assert_approx_eq!(q1.length_squared(), 4.0, 1.0e-6);
assert_approx_eq!(q1.length(), 2.0);
assert_approx_eq!(q1.length_reciprocal(), 0.5);
assert_approx_eq!(q0, q1.normalize());
assert_approx_eq!(q0.dot(q1), 2.0, 1.0e-6);
} | rust_cleaned_test_functions.jsonl/73791 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
266,
64124,
368,
341,
262,
1077,
2804,
15,
284,
3406,
266,
486,
1499,
44813,
4178,
649,
77127,
7,
19,
20,
13,
15,
701,
5254,
7,
16,
23,
15,
13,
15,
701,
5254,
7,
24,
15,
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... | 1 |
#[test]
fn test_commit_without_new_term_entry() {
let l = default_logger();
let mut tt = Network::new(vec![None, None, None, None, None], &l);
tt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
tt.cut(1, 3);
tt.cut(1, 4);
tt.cut(1, 5);
tt.send(vec![new_message(1, 1, MessageType::MsgPropose, 1)]);
tt.send(vec![new_message(1, 1, MessageType::MsgPropose, 1)]);
assert_eq!(tt.peers[&1].raft_log.committed, 1);
// network recovery
tt.recover();
// elect 1 as the new leader with term 2
// should be committed
tt.send(vec![new_message(2, 2, MessageType::MsgHup, 0)]);
assert_eq!(tt.peers[&1].raft_log.committed, 4);
} | rust_cleaned_test_functions.jsonl/19096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
39904,
5921,
17464,
9078,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
17853,
284,
8141,
486,
931,
25592,
20703,
4064,
11,
2240,
11,
2240,
11,
2240,
11,
2240,
1125,
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_put_empty() {
let tmp_dir = TempPath::new();
let db = DiemDB::new_for_test(&tmp_dir);
let store = &db.event_store;
let mut cs = ChangeSet::new();
assert_eq!(
store.put_events(0, &[], &mut cs).unwrap(),
*ACCUMULATOR_PLACEHOLDER_HASH
);
} | rust_cleaned_test_functions.jsonl/76117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
15124,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
1820,
486,
931,
543,
262,
1077,
2927,
284,
7767,
336,
3506,
486,
931,
5478,
4452,
2099,
5173,
4334,
317,
262,
1077,
3553,
284,
609,
199... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long() {
assert_eq!(
Variant::VDouble(5.1).multiply(Variant::VLong(2)).unwrap(),
Variant::VDouble(10.2)
);
} | rust_cleaned_test_functions.jsonl/84587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
7378,
7,
20,
13,
16,
568,
64648,
12410,
15341,
486,
53,
6583,
7,
17,
4579,
15454,
3148,
503,
39292,
486,
53,
7378,
7,
16,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.