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_build_execution() {
check_build_execution_from_sel(
vec![ExecPattern::from_string("vi {file}")],
"/home/dys/dev",
vec![],
vec!["vi", "/home/dys/dev"],
);
check_build_execution_from_sel(
vec![
ExecPattern::from_string("/bin/e.exe -a {arg} -e {file}"),
ExecPattern::from_array(vo!["/bin/e.exe","-a", "{arg}", "-e", "{file}"]),
],
"expérimental & 试验性",
vec![("arg", "deux mots")],
vec!["/bin/e.exe", "-a", "deux mots", "-e", "expérimental & 试验性"],
);
check_build_execution_from_sel(
vec![
ExecPattern::from_string("xterm -e \"kak {file}\""),
ExecPattern::from_array(vo!["xterm", "-e", "kak {file}"]),
],
"/path/to/file",
vec![],
vec!["xterm", "-e", "kak /path/to/file"],
);
} | rust_cleaned_test_functions.jsonl/42770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 584
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
60948,
368,
341,
286,
1779,
20801,
60948,
5673,
34153,
1006,
310,
7486,
20703,
10216,
15760,
486,
1499,
3904,
445,
9971,
314,
1192,
55961,
1259,
310,
3521,
5117,
3446,
1047,
35061,
756,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_insert() {
let result = parse_statement("INSERT INTO test set k=1;").unwrap();
if let Statement::Insert(stream, builder) = result {
assert_eq!(stream, String::from("test"));
} else {
panic!("")
}
let x = "INSERT INTO test set k=1, v=2;";
let result = parse_statement(x).unwrap();
} | rust_cleaned_test_functions.jsonl/114444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
17678,
368,
1476,
286,
1077,
1102,
284,
4715,
37404,
445,
12698,
12496,
1273,
738,
595,
28,
16,
26,
1827,
15454,
1428,
286,
421,
1077,
21756,
486,
13780,
20574,
11,
7363,
8,
284,
1102,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_opalkelly_xem_6010_synth_wire() {
let mut uut = OpalKellyWireTest::new::<XEM6010>();
uut.hi.link_connect_dest();
uut.connect_all();
synth::synth_obj(uut, target_path!("xem_6010/wire"));
test_opalkelly_xem_wire_runtime(target_path!("xem_6010/wire/top.bit")).unwrap()
} | rust_cleaned_test_functions.jsonl/93818 | {
"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,
10287,
1692,
11896,
3212,
336,
62,
21,
15,
16,
15,
643,
45809,
75206,
368,
341,
262,
1077,
5206,
575,
332,
284,
10672,
278,
69072,
37845,
2271,
486,
931,
27638,
55,
2716,
21,
15,
16,
15,
3913,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_from_impl_with_lifetime() {
check_assist(
generate_from_impl_for_enum,
r#"
//- minicore: from
enum Generic<'a> { $0One(&'a i32) }
"#,
r#"
enum Generic<'a> { One(&'a i32) }
impl<'a> From<&'a i32> for Generic<'a> {
fn from(v: &'a i32) -> Self {
Self::One(v)
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/4577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5673,
21007,
6615,
98827,
368,
341,
286,
1779,
12083,
380,
1006,
310,
6923,
5673,
21007,
5478,
31054,
345,
310,
435,
2,
698,
61463,
1308,
292,
460,
25,
504,
198,
9018,
21281,
18291,
64,
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,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_or_function_dotted_qualified() {
let input = "A.B$(1)";
let eol_reader = EolReader::from(input);
let mut parser = word_p();
let (_, result) = parser.parse(eol_reader).expect("Should parse");
assert_eq!(
result,
Some(Expression::func("A.B$".into(), vec![1.as_lit_expr(1, 6)]))
);
} | rust_cleaned_test_functions.jsonl/102686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
8734,
9174,
814,
15521,
62,
36335,
368,
341,
503,
1077,
1946,
284,
330,
32,
1785,
8525,
16,
24023,
503,
1077,
384,
337,
22306,
284,
468,
337,
5062,
486,
1499,
5384,
317,
503,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_level_cache_write_back() {
let allocator = Arena::new();
let vm_cache = VMModuleCache::new(&allocator);
// Put an existing module in the cache.
let module = test_module("existing_module".to_string());
vm_cache.cache_module(module).unwrap();
// Create a new script that refers to both published and unpublished modules.
let script = CompiledScript {
main: FunctionDefinition {
function: FunctionHandleIndex::new(0),
flags: CodeUnit::PUBLIC,
code: CodeUnit {
max_stack_size: 10,
locals: LocalsSignatureIndex(0),
code: vec![],
},
},
module_handles: vec![
// Self
ModuleHandle {
address: AddressPoolIndex::new(0),
name: StringPoolIndex::new(0),
},
// To-be-published Module
ModuleHandle {
address: AddressPoolIndex::new(0),
name: StringPoolIndex::new(1),
},
// Existing module on chain
ModuleHandle {
address: AddressPoolIndex::new(0),
name: StringPoolIndex::new(2),
},
],
struct_handles: vec![],
function_handles: vec![
// Func2 defined in the new module
FunctionHandle {
name: StringPoolIndex::new(4),
signature: FunctionSignatureIndex::new(0),
module: ModuleHandleIndex::new(1),
},
// Func1 defined in the old module
FunctionHandle {
name: StringPoolIndex::new(3),
signature: FunctionSignatureIndex::new(1),
module: ModuleHandleIndex::new(2),
},
],
type_signatures: vec![],
function_signatures: vec![
FunctionSignature {
return_types: vec![],
arg_types: vec![],
},
FunctionSignature {
return_types: vec![],
arg_types: vec![SignatureToken::U64],
},
],
locals_signatures: vec![LocalsSignature(vec![])],
string_pool: vec![
"hello".to_string(),
"module".to_string(),
"existing_module".to_string(),
"func1".to_string(),
"func2".to_string(),
],
byte_array_pool: vec![],
address_pool: vec![AccountAddress::default()],
};
let owned_entry_module = script.into_module();
let loaded_main = LoadedModule::new(owned_entry_module).unwrap();
let entry_func = FunctionRef::new(&loaded_main, CompiledScript::MAIN_INDEX).unwrap();
let entry_module = entry_func.module();
{
let txn_allocator = Arena::new();
{
let txn_cache = TransactionModuleCache::new(&vm_cache, &txn_allocator);
// We should be able to read existing modules in both cache.
let func1_vm_ref = vm_cache
.resolve_function_ref(entry_module, FunctionHandleIndex::new(1))
.unwrap()
.unwrap();
let func1_txn_ref = txn_cache
.resolve_function_ref(entry_module, FunctionHandleIndex::new(1))
.unwrap()
.unwrap();
assert_eq!(func1_vm_ref, func1_txn_ref);
txn_cache
.cache_module(test_module("module".to_string()))
.unwrap();
// cache.
assert!(vm_cache
.resolve_function_ref(entry_module, FunctionHandleIndex::new(0))
.unwrap()
.is_none());
let func2_txn_ref = txn_cache
.resolve_function_ref(entry_module, FunctionHandleIndex::new(0))
.unwrap()
.unwrap();
assert_eq!(func2_txn_ref.arg_count(), 1);
assert_eq!(func2_txn_ref.return_count(), 0);
assert_eq!(
func2_txn_ref.code_definition(),
vec![Bytecode::Ret].as_slice()
);
}
// Drop the transactional arena
vm_cache
.reclaim_cached_module(txn_allocator.into_vec())
.unwrap();
}
// After reclaiming we should see it from the
let func2_ref = vm_cache
.resolve_function_ref(entry_module, FunctionHandleIndex::new(0))
.unwrap()
.unwrap();
assert_eq!(func2_ref.arg_count(), 1);
assert_eq!(func2_ref.return_count(), 0);
assert_eq!(func2_ref.code_definition(), vec![Bytecode::Ret].as_slice());
} | rust_cleaned_test_functions.jsonl/127131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
8274,
11529,
9165,
3895,
368,
341,
262,
1077,
43655,
284,
27047,
486,
931,
543,
262,
1077,
10995,
11529,
284,
17792,
3332,
8233,
486,
931,
2099,
57631,
626,
262,
442,
10224,
458,
6350,
4688... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unify_external_internal() {
let mut test = OsoTest::new();
test.qeval("new List() = []");
test.qeval("new Dictionary() = {}");
test.qeval("new String() = \"\"");
test.qeval("new Integer() = 0");
test.qeval("new Float() = 0.0");
test.qeval("new Boolean() = false");
} | rust_cleaned_test_functions.jsonl/30394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
1437,
47432,
23472,
368,
341,
262,
1077,
5206,
1273,
284,
506,
704,
2271,
486,
931,
543,
262,
1273,
11354,
14170,
445,
931,
1759,
368,
284,
3056,
797,
262,
1273,
11354,
14170,
445,
931,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deeply_nested_add() {
let root = json!({
"a": {
"b": {
"c": {
"a": 1,
"b": 1,
"c": 1,
}
}
}
});
let value_to_add = json!(2);
let path = Path::new("/a/b/c/d");
let new = add(root, value_to_add, path).unwrap();
let deep_object = new.get("a").unwrap().get("b").unwrap().get("c").unwrap();
assert_eq!(deep_object.get("d").unwrap(), &json!(2));
} | rust_cleaned_test_functions.jsonl/83910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87044,
398,
66279,
2891,
368,
341,
286,
1077,
3704,
284,
2951,
0,
2262,
310,
330,
64,
788,
341,
394,
330,
65,
788,
341,
503,
330,
66,
788,
341,
664,
330,
64,
788,
220,
16,
345,
664,
330,
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_relative_mode() {
let mut interpreter = IntCodeInterpreter::new();
interpreter.set_memory_size(100000);
interpreter.reset(&vec![
109, 1, 204, -1, 1001, 100, 1, 100, 1008, 100, 16, 101, 1006, 101, 0, 99,
]);
interpreter.run();
assert_eq!(
interpreter.output(),
"1091204-1100110011001008100161011006101099"
);
} | rust_cleaned_test_functions.jsonl/42129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29286,
7302,
368,
341,
286,
1077,
5206,
39299,
284,
1333,
2078,
58426,
486,
931,
543,
286,
39299,
980,
19195,
2368,
7,
16,
15,
15,
15,
15,
15,
317,
286,
39299,
13857,
2099,
4083,
90515,
310,
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_get_block_entries() {
let sudoku = create_sudoku(TEST_VALUES);
assert_eq!(
sudoku.get_block_entries(40),
nonzerou8_map!(30 => 8, 31 => 3, 39 => 1, 40 => 7, 41 => 6, 50 => 4)
);
} | rust_cleaned_test_functions.jsonl/58571 | {
"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,
3062,
7113,
26092,
368,
341,
286,
1077,
90809,
284,
1855,
643,
68302,
50320,
58662,
626,
286,
2060,
10714,
33673,
310,
90809,
670,
7113,
26092,
7,
19,
15,
1326,
310,
2477,
7070,
283,
23,
5376,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_usage_short_only() {
let mut opts = Options::new();
opts.optopt("k", "", "Kiwi", "VAL");
opts.optflag("s", "", "Starfruit");
opts.optflagopt("a", "", "Apple", "TYPE");
let expected = "Usage: fruits
Options:
-k VAL Kiwi
-s Starfruit
-a [TYPE] Apple
";
let usage = opts.usage("Usage: fruits");
debug!("expected: <<{}>>", expected);
debug!("generated: <<{}>>", usage);
assert!(usage == expected)
} | rust_cleaned_test_functions.jsonl/52395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31507,
16673,
18410,
368,
341,
262,
1077,
5206,
12185,
284,
14566,
486,
931,
543,
262,
12185,
28102,
2912,
445,
74,
497,
7342,
330,
72572,
16632,
497,
330,
5594,
797,
262,
12185,
28102,
9903,
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_verify_far_contents_with_fixed_inputs() {
let outdir = TempDir::new().unwrap();
let meta_far_path = outdir.path().join("meta.far");
let creation_manifest = CreationManifest::from_external_and_far_contents(
btreemap! {
"lib/mylib.so".to_string() => "host/mylib.so".to_string()
},
btreemap! {
"meta/my_component.cmx".to_string() => "host/my_component.cmx".to_string(),
"meta/package".to_string() => "host/meta/package".to_string()
},
)
.unwrap();
let component_manifest_contents = "my_component.cmx contents";
let mut v = vec![];
let meta_package = MetaPackage::from_name_and_variant(
"my-package-name".parse().unwrap(),
"my-package-variant".parse().unwrap(),
);
meta_package.serialize(&mut v).unwrap();
let file_system = FakeFileSystem {
content_map: hashmap! {
"host/mylib.so".to_string() => "mylib.so contents".as_bytes().to_vec(),
"host/my_component.cmx".to_string() => component_manifest_contents.as_bytes().to_vec(),
"host/meta/package".to_string() => v.clone()
},
};
build_with_file_system(&creation_manifest, &meta_far_path, "published-name", &file_system)
.unwrap();
let mut reader = fuchsia_archive::Reader::new(File::open(&meta_far_path).unwrap()).unwrap();
let actual_meta_package_bytes = reader.read_file("meta/package").unwrap();
let expected_meta_package_bytes = v.as_slice();
assert_eq!(actual_meta_package_bytes.as_slice(), &expected_meta_package_bytes[..]);
let actual_meta_contents_bytes = reader.read_file("meta/contents").unwrap();
let expected_meta_contents_bytes =
b"lib/mylib.so=4a886105646222c10428e5793868b13f536752d4b87e6497cdf9caed37e67410\n";
assert_eq!(actual_meta_contents_bytes.as_slice(), &expected_meta_contents_bytes[..]);
let actual_meta_component_bytes = reader.read_file("meta/my_component.cmx").unwrap();
assert_eq!(actual_meta_component_bytes.as_slice(), component_manifest_contents.as_bytes());
} | rust_cleaned_test_functions.jsonl/39057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1044
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
67513,
16682,
6615,
37839,
28557,
368,
341,
286,
1077,
700,
3741,
284,
19944,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
8823,
67513,
2638,
284,
700,
3741,
3875,
1005,
5987,
445,
5490,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_substring_2_args() {
let cases = vec![
(
Some("中文a测试bb".as_bytes().to_vec()),
Some(1),
Some("中文a测试bb".as_bytes().to_vec()),
),
(
Some("中文a测试".as_bytes().to_vec()),
Some(-3),
Some("试".as_bytes().to_vec()),
),
(
Some("\x61\x76\x5e\x38\x2f\x35".as_bytes().to_vec()),
Some(-1),
Some("\x35".as_bytes().to_vec()),
),
(
Some("\x61\x76\x5e\x38\x2f\x35".as_bytes().to_vec()),
Some(2),
Some("\x76\x5e\x38\x2f\x35".as_bytes().to_vec()),
),
(
Some("Quadratically".as_bytes().to_vec()),
Some(5),
Some("ratically".as_bytes().to_vec()),
),
(
Some("Sakila".as_bytes().to_vec()),
Some(1),
Some("Sakila".as_bytes().to_vec()),
),
(
Some("Sakila".as_bytes().to_vec()),
Some(-3),
Some("ila".as_bytes().to_vec()),
),
(
Some("Sakila".as_bytes().to_vec()),
Some(0),
Some("".as_bytes().to_vec()),
),
(
Some("Sakila".as_bytes().to_vec()),
Some(100),
Some("".as_bytes().to_vec()),
),
(
Some("Sakila".as_bytes().to_vec()),
Some(-100),
Some("".as_bytes().to_vec()),
),
(
Some("Sakila".as_bytes().to_vec()),
Some(i64::max_value()),
Some("".as_bytes().to_vec()),
),
(
Some("Sakila".as_bytes().to_vec()),
Some(i64::min_value()),
Some("".as_bytes().to_vec()),
),
(
Some("".as_bytes().to_vec()),
Some(1),
Some("".as_bytes().to_vec()),
),
(
Some("".as_bytes().to_vec()),
Some(-1),
Some("".as_bytes().to_vec()),
),
];
for (str, pos, exp) in cases {
let output = RpnFnScalarEvaluator::new()
.push_param(str)
.push_param(pos)
.evaluate(ScalarFuncSig::Substring2Args)
.unwrap();
assert_eq!(output, exp);
}
} | rust_cleaned_test_functions.jsonl/19771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1784
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
917,
62,
17,
8384,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
4329,
445,
104811,
64,
81705,
6066,
3263,
300,
12524,
1005,
983,
13251,
14702,
394,
4329,
7,
16,
1326,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_abstract_nested_type() {
let hdr = indoc! {"
namespace N {
class A {
public:
A() {}
class B {
private:
B() {}
public:
virtual ~B() {}
virtual void Foo() = 0;
};
};
};
void take_A_B(const N::A::B&);
"};
let rs = quote! {};
run_test("", hdr, rs, &["take_A_B", "N::A_B"], &[]);
} | rust_cleaned_test_functions.jsonl/9853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85939,
66279,
1819,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
4473,
451,
341,
310,
536,
362,
341,
310,
584,
510,
394,
362,
368,
5613,
394,
536,
425,
341,
394,
869,
510,
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_string_tags() {
// these files have null-terminated strings for their Software tag. One has extra bytes after
let filenames = ["minisblack-1c-16b.tiff", "rgb-3c-16b.tiff"];
for filename in filenames.iter() {
let path = PathBuf::from(TEST_IMAGE_DIR).join(filename);
let img_file = File::open(path).expect("Cannot find test image!");
let mut decoder = Decoder::new(img_file).expect("Cannot create decoder");
let software = decoder.get_tag(tiff::tags::Tag::Software).unwrap();
match software {
ifd::Value::Ascii(s) => assert_eq!(
&s,
"GraphicsMagick 1.2 unreleased Q16 http://www.GraphicsMagick.org/"
),
_ => assert!(false),
};
}
} | rust_cleaned_test_functions.jsonl/75206 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
16333,
368,
341,
262,
442,
1493,
3542,
614,
845,
12,
68659,
9069,
369,
862,
4377,
4772,
13,
3776,
702,
4960,
5820,
1283,
7213,
262,
1077,
40540,
284,
4383,
1065,
285,
11453,
12,
16,
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... | 3 |
#[test]
fn test_endpoint_api() {
let time_service = TimeServiceFactory::default();
let artifact = time_service.artifact_id();
let mut testkit = TestKitBuilder::validator()
.with_validators(3)
.with_artifact(artifact.clone())
.with_instance(artifact.into_default_instance(INSTANCE_ID, INSTANCE_NAME))
.with_rust_service(time_service)
.with_rust_service(Supervisor)
.with_artifact(Supervisor.artifact_id())
.with_instance(Supervisor::simple())
.create();
let mut api = testkit.api();
let validators = testkit.network().validators().to_vec();
let mut current_validators_times: HashMap<_, _> = HashMap::from_iter(
validators
.iter()
.map(|validator| (validator.service_keypair().0, None)),
);
let mut all_validators_times = HashMap::new();
assert_current_time_eq(&mut api, None);
assert_current_validators_times_eq(&mut api, ¤t_validators_times);
assert_all_validators_times_eq(&mut api, &all_validators_times);
let time0 = Utc::now();
let keypair = validators[0].service_keypair();
let tx = keypair.report_time(INSTANCE_ID, TxTime::new(time0));
testkit.create_block_with_transaction(tx);
current_validators_times.insert(keypair.0, Some(time0));
all_validators_times.insert(keypair.0, Some(time0));
assert_current_time_eq(&mut api, Some(time0));
assert_current_validators_times_eq(&mut api, ¤t_validators_times);
assert_all_validators_times_eq(&mut api, &all_validators_times);
let time1 = time0 + Duration::seconds(10);
let keypair = validators[1].service_keypair();
let tx = keypair.report_time(INSTANCE_ID, TxTime::new(time1));
testkit.create_block_with_transaction(tx);
current_validators_times.insert(keypair.0, Some(time1));
all_validators_times.insert(keypair.0, Some(time1));
assert_current_time_eq(&mut api, Some(time1));
assert_current_validators_times_eq(&mut api, ¤t_validators_times);
assert_all_validators_times_eq(&mut api, &all_validators_times);
let time2 = time1 + Duration::seconds(10);
let keypair = validators[2].service_keypair();
let tx = keypair.report_time(INSTANCE_ID, TxTime::new(time2));
testkit.create_block_with_transaction(tx);
current_validators_times.insert(keypair.0, Some(time2));
all_validators_times.insert(keypair.0, Some(time2));
assert_current_time_eq(&mut api, Some(time2));
assert_current_validators_times_eq(&mut api, ¤t_validators_times);
assert_all_validators_times_eq(&mut api, &all_validators_times);
let (public_key_0, secret_key_0) = validators[0].service_keypair();
let cfg_change_height = Height(10);
let new_cfg = {
let validator_keys = vec![
testkit.network_mut().add_node().public_keys(),
validators[1].public_keys(),
validators[2].public_keys(),
];
testkit
.consensus_config()
.with_validator_keys(validator_keys)
};
testkit.create_block_with_transaction(
ConfigPropose::new(0, cfg_change_height)
.consensus_config(new_cfg)
.sign_for_supervisor(public_key_0, &secret_key_0),
);
testkit.create_blocks_until(cfg_change_height);
current_validators_times.remove(&public_key_0);
let validators = testkit.network().validators().to_vec();
current_validators_times.insert(validators[0].service_keypair().0, None);
let snapshot = testkit.snapshot();
let schema = get_schema(&snapshot);
if let Some(time) = schema.validators_times.get(&public_key_0) {
all_validators_times.insert(public_key_0, Some(time));
}
assert_current_time_eq(&mut api, Some(time2));
assert_current_validators_times_eq(&mut api, ¤t_validators_times);
assert_all_validators_times_eq(&mut api, &all_validators_times);
let time3 = time2 + Duration::seconds(10);
let keypair = validators[0].service_keypair();
let tx = keypair.report_time(INSTANCE_ID, TxTime::new(time3));
testkit.create_block_with_transaction(tx);
current_validators_times.insert(keypair.0, Some(time3));
all_validators_times.insert(keypair.0, Some(time3));
assert_current_time_eq(&mut api, Some(time3));
assert_current_validators_times_eq(&mut api, ¤t_validators_times);
assert_all_validators_times_eq(&mut api, &all_validators_times);
} | rust_cleaned_test_functions.jsonl/21890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1777
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36699,
11697,
368,
341,
262,
1077,
882,
12267,
284,
4120,
1860,
4153,
486,
2258,
543,
262,
1077,
36639,
284,
882,
12267,
46886,
20754,
842,
543,
262,
1077,
5206,
1273,
8226,
284,
3393,
7695,
3297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cli_get_config_error_opening_file() {
let cli = Cli {
config: PathBuf::from_str("/tmp/btc-adapter-test.json").expect("Bad file path string"),
};
let result = cli.get_config();
assert!(result.is_err());
let error = result.unwrap_err();
assert!(matches!(error, CliError::Io(_)));
} | rust_cleaned_test_functions.jsonl/28212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
3062,
5332,
4096,
11311,
287,
2458,
368,
341,
286,
1077,
21348,
284,
96971,
341,
310,
2193,
25,
7933,
15064,
486,
1499,
2895,
4283,
5173,
3470,
10413,
12,
19731,
16839,
4323,
1827,
17119,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_different_structs_for_same_header() {
let headers = Headers::from_raw(&mut mem("Content-Length: 10\r\n\r\n")).unwrap();
let ContentLength(_) = *headers.get::<ContentLength>().unwrap();
assert!(headers.get::<CrazyLength>().is_none());
} | rust_cleaned_test_functions.jsonl/18239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82741,
15126,
82,
5478,
33574,
8757,
368,
341,
286,
1077,
7102,
284,
21426,
486,
1499,
16067,
2099,
6984,
1833,
445,
2762,
52493,
25,
220,
16,
15,
12016,
1699,
12016,
1699,
15197,
15454,
543,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_loops_nested_loops() {
let graph = {
let mut graph = Graph::new();
graph.insert_vertex(1).unwrap();
graph.insert_vertex(2).unwrap();
graph.insert_vertex(3).unwrap();
graph.insert_vertex(4).unwrap();
graph.insert_vertex(5).unwrap();
graph.insert_edge((1, 2)).unwrap();
graph.insert_edge((2, 3)).unwrap();
graph.insert_edge((3, 4)).unwrap();
graph.insert_edge((3, 2)).unwrap(); // back edge
graph.insert_edge((4, 5)).unwrap();
graph.insert_edge((4, 1)).unwrap(); // back edge
graph
};
let loops = graph.compute_loops(1).unwrap();
assert_eq!(loops.len(), 2);
assert!(loops.contains(&Loop::new(1, vec![1, 2, 3, 4].into_iter().collect())));
assert!(loops.contains(&Loop::new(2, vec![2, 3].into_iter().collect())));
} | rust_cleaned_test_functions.jsonl/1497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
5560,
3721,
66279,
5560,
3721,
368,
341,
286,
1077,
4771,
284,
341,
310,
1077,
5206,
4771,
284,
12165,
486,
931,
1428,
310,
4771,
7030,
26611,
7,
16,
568,
15454,
543,
310,
4771,
7030,
266... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fat_open() {
let d = FakeDisk::new("clear-28660-kvm.img");
match crate::part::find_efi_partition(&d) {
Ok((start, end)) => {
let mut f = crate::fat::Filesystem::new(&d, start, end);
match f.init() {
Ok(()) => {
let file = f.open("\\EFI\\BOOT\\BOOTX64.EFI").unwrap();
assert_eq!(file.active_cluster, 166);
assert_eq!(file.size, 92789);
}
Err(e) => panic!(e),
}
}
Err(e) => panic!(e),
}
} | rust_cleaned_test_functions.jsonl/111074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
266,
11311,
368,
341,
286,
1077,
294,
284,
36965,
47583,
486,
931,
445,
7422,
12,
17,
23,
21,
21,
15,
12646,
7338,
15334,
797,
286,
2432,
17717,
486,
4480,
486,
3903,
79410,
72,
43840,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_vertical_filter() {
let image = gray_image!(
1, 4, 1;
4, 7, 4;
1, 4, 1);
let expected = gray_image!(
2, 5, 2;
2, 5, 2;
2, 5, 2);
let kernel = vec![1f32 / 3f32; 3];
let filtered = vertical_filter(&image, &kernel);
assert_pixels_eq!(filtered, expected);
} | rust_cleaned_test_functions.jsonl/35606 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61203,
8727,
368,
341,
286,
1077,
2168,
284,
17545,
4954,
33673,
310,
220,
16,
11,
220,
19,
11,
220,
16,
280,
310,
220,
19,
11,
220,
22,
11,
220,
19,
280,
310,
220,
16,
11,
220,
19,
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_decrement() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(engine.eval::<INT>("let x = 10; x -= 7; x")?, 3);
assert!(matches!(
*engine.eval::<String>(r#"let s = "test"; s -= "ing"; s"#).expect_err("expects error"),
EvalAltResult::ErrorFunctionNotFound(err, _) if err == "- (string, string)"
));
Ok(())
} | rust_cleaned_test_functions.jsonl/106800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
13477,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10714,
10297,
8512,
31710,
27638,
3221,
13211,
1149,
856,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_escaped_chars() {
const FORMAT_STR: &str = r#"\\\[\$text\]\(red bold\)"#;
let formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper);
let result = formatter.parse(None).unwrap();
let mut result_iter = result.iter();
match_next!(result_iter, r#"\[$text](red bold)"#, None);
} | rust_cleaned_test_functions.jsonl/71881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
65826,
37418,
368,
341,
286,
733,
52225,
7159,
25,
609,
495,
284,
435,
55543,
81351,
26056,
3,
1318,
59,
17960,
7,
1151,
13939,
59,
9940,
2,
401,
286,
1077,
24814,
284,
923,
14183,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_enum_not_applicable_if_struct_exists() {
check_not_applicable(
r#"struct One;
enum A { <|>One(u8, u32) }"#,
);
} | rust_cleaned_test_functions.jsonl/13112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
31054,
7913,
8191,
46114,
11119,
15126,
9766,
368,
341,
286,
1779,
7913,
8191,
46114,
1006,
310,
435,
55543,
1235,
3776,
280,
286,
7618,
362,
314,
82639,
29,
3966,
8154,
23,
11,
575,
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 |
#[test]
fn test_2_by_2_matrix_eigenvalues() {
let a = matrix![1., 2.; 3., 4.];
// characteristic polynomial is λ² − 5λ − 2 = 0
assert_eq!(vec![(5. - (33.0f32).sqrt()) / 2., (5. + (33.0f32).sqrt()) / 2.],
a.eigenvalues().unwrap());
} | rust_cleaned_test_functions.jsonl/96790 | {
"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,
62,
17,
3710,
62,
17,
10193,
2204,
6433,
3661,
368,
341,
286,
1077,
264,
284,
6172,
20703,
16,
2572,
220,
17,
15642,
220,
18,
2572,
220,
19,
13,
935,
286,
442,
28583,
47311,
374,
48338,
29456,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_syscall_sol_log_u64() {
let compute_meter: Rc<RefCell<dyn ComputeMeter>> =
Rc::new(RefCell::new(MockComputeMeter {
remaining: std::u64::MAX,
}));
let log = Rc::new(RefCell::new(vec![]));
let logger: Rc<RefCell<dyn Logger>> =
Rc::new(RefCell::new(MockLogger { log: log.clone() }));
let mut syscall_sol_log_u64 = SyscallLogU64 {
cost: 0,
compute_meter,
logger,
};
let memory_mapping = MemoryMapping::new::<UserError>(vec![], &DEFAULT_CONFIG).unwrap();
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
syscall_sol_log_u64.call(1, 2, 3, 4, 5, &memory_mapping, &mut result);
result.unwrap();
assert_eq!(log.borrow().len(), 1);
assert_eq!(log.borrow()[0], "Program log: 0x1, 0x2, 0x3, 0x4, 0x5");
} | rust_cleaned_test_functions.jsonl/16353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20344,
6659,
53668,
5224,
7300,
21,
19,
368,
341,
286,
1077,
12564,
79338,
25,
81463,
27,
3945,
3599,
92846,
22603,
68224,
2452,
4035,
310,
81463,
486,
931,
7,
3945,
3599,
486,
931,
66436,
46254,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init_fails_with_no_wallet_key() {
vcx_shutdown(true);
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE,"false");
let wallet_name = "test_init_fails_with_no_wallet_key";
let content = json!({
"wallet_name": wallet_name,
}).to_string();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::MISSING_WALLET_KEY.code_num);
} | rust_cleaned_test_functions.jsonl/19799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
761,
6209,
6615,
6536,
62308,
3097,
368,
341,
286,
24553,
87,
54804,
3715,
317,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
1335,
3849,
797,
286,
1077,
15085,
126... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_heap() {
let mut heap = MaxHeap::new();
heap.add(4);
heap.add(2);
heap.add(9);
heap.add(11);
assert_eq!(heap.len(), 4);
assert_eq!(heap.next(), Some(11));
assert_eq!(heap.next(), Some(9));
assert_eq!(heap.next(), Some(4));
heap.add(1);
assert_eq!(heap.next(), Some(2));
} | rust_cleaned_test_functions.jsonl/17182 | {
"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,
6345,
33059,
368,
341,
286,
1077,
5206,
17364,
284,
7487,
27909,
486,
931,
543,
286,
17364,
1364,
7,
19,
317,
286,
17364,
1364,
7,
17,
317,
286,
17364,
1364,
7,
24,
317,
286,
17364,
1364,
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_nested() {
struct Foo;
impl Debug for Foo {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_set()
.entry(&true)
.entry(&format_args!("{}/{}", 10, 20))
.finish()
}
}
struct Bar;
impl Debug for Bar {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_set().entry(&Foo).entry(&"world").finish()
}
}
assert_eq!("{{true, 10/20}, \"world\"}", debug3::pprint(Bar));
} | rust_cleaned_test_functions.jsonl/124743 | {
"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,
66279,
368,
341,
286,
2036,
33428,
401,
286,
11605,
11091,
369,
33428,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
81387,
8,
341,
394,
8879,
7883,
2602,
741,
503,
659,
4085,
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_tikv_forwarding() {
let (_cluster, client, call_opt, ctx) = setup_cluster();
// Verify not setting forwarding header will result in store not match.
let mut put_req = RawPutRequest::default();
put_req.set_context(ctx.clone());
let put_resp = client.raw_put(&put_req).unwrap();
assert!(
put_resp.get_region_error().has_store_not_match(),
"{:?}",
put_resp
);
assert!(put_resp.error.is_empty(), "{:?}", put_resp);
test_func_init!(client, ctx, call_opt, kv_get, GetRequest);
test_func_init!(client, ctx, call_opt, kv_scan, ScanRequest);
test_func_init!(client, ctx, call_opt, kv_prewrite, PrewriteRequest, Op::Put);
test_func_init!(
client,
ctx,
call_opt,
kv_pessimistic_lock,
PessimisticLockRequest,
Op::PessimisticLock
);
test_func_init!(
client,
ctx,
call_opt,
kv_pessimistic_rollback,
PessimisticRollbackRequest,
batch
);
test_func_init!(client, ctx, call_opt, kv_commit, CommitRequest, batch);
test_func_init!(client, ctx, call_opt, kv_cleanup, CleanupRequest);
test_func_init!(client, ctx, call_opt, kv_batch_get, BatchGetRequest);
test_func_init!(
client,
ctx,
call_opt,
kv_batch_rollback,
BatchRollbackRequest,
batch
);
test_func_init!(
client,
ctx,
call_opt,
kv_txn_heart_beat,
TxnHeartBeatRequest
);
test_func_init!(
client,
ctx,
call_opt,
kv_check_txn_status,
CheckTxnStatusRequest
);
test_func_init!(
client,
ctx,
call_opt,
kv_check_secondary_locks,
CheckSecondaryLocksRequest,
batch
);
test_func_init!(client, ctx, call_opt, kv_scan_lock, ScanLockRequest);
test_func_init!(client, ctx, call_opt, kv_resolve_lock, ResolveLockRequest);
test_func_init!(client, ctx, call_opt, kv_delete_range, DeleteRangeRequest);
test_func_init!(client, ctx, call_opt, mvcc_get_by_key, MvccGetByKeyRequest);
test_func_init!(
client,
ctx,
call_opt,
mvcc_get_by_start_ts,
MvccGetByStartTsRequest
);
test_func_init!(client, ctx, call_opt, raw_get, RawGetRequest);
test_func_init!(client, ctx, call_opt, raw_batch_get, RawBatchGetRequest);
test_func_init!(client, ctx, call_opt, raw_scan, RawScanRequest);
test_func_init!(client, ctx, call_opt, raw_batch_scan, RawBatchScanRequest);
test_func_init!(client, ctx, call_opt, raw_put, RawPutRequest);
test_func!(client, ctx, call_opt, raw_batch_put, {
let mut req = RawBatchPutRequest::default();
req.set_pairs(vec![KvPair::default()].into());
req
});
test_func_init!(client, ctx, call_opt, raw_delete, RawDeleteRequest);
test_func_init!(
client,
ctx,
call_opt,
raw_batch_delete,
RawBatchDeleteRequest,
batch
);
test_func_init!(
client,
ctx,
call_opt,
raw_delete_range,
RawDeleteRangeRequest
);
test_func!(client, ctx, call_opt, coprocessor, {
let mut req = Request::default();
req.set_tp(REQ_TYPE_DAG);
req
});
test_func!(client, ctx, call_opt, split_region, {
let mut req = SplitRegionRequest::default();
req.set_split_key(b"k1".to_vec());
req
});
test_func_init!(client, ctx, call_opt, read_index, ReadIndexRequest);
// Test if duplex can be redirect correctly.
let cases = vec![
(CallOption::default().timeout(Duration::from_secs(3)), false),
(call_opt.clone(), true),
];
for (opt, success) in cases {
let (mut sender, receiver) = client.batch_commands_opt(opt).unwrap();
for _ in 0..100 {
let mut batch_req = BatchCommandsRequest::default();
for i in 0..10 {
let mut get = GetRequest::default();
get.set_context(ctx.clone());
let mut req = batch_commands_request::Request::default();
req.cmd = Some(batch_commands_request::request::Cmd::Get(get));
batch_req.mut_requests().push(req);
batch_req.mut_request_ids().push(i);
}
block_on(sender.send((batch_req, WriteFlags::default()))).unwrap();
}
block_on(sender.close()).unwrap();
let resps = block_on(
receiver
.map(move |b| futures::stream::iter(b.unwrap().take_responses().into_vec()))
.flatten()
.collect::<Vec<_>>(),
);
assert_eq!(resps.len(), 1000);
for resp in resps {
let resp = match resp.cmd {
Some(batch_commands_response::response::Cmd::Get(g)) => g,
_ => panic!("unexpected response {:?}", resp),
};
let error = resp.get_region_error();
if success {
assert!(!error.has_store_not_match(), "{:?}", resp);
} else {
assert!(error.has_store_not_match(), "{:?}", resp);
}
}
}
} | rust_cleaned_test_functions.jsonl/61707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2595
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
1579,
85,
32121,
287,
368,
341,
262,
1077,
5453,
18855,
11,
2943,
11,
1618,
15032,
11,
5635,
8,
284,
6505,
28441,
1428,
262,
442,
25429,
537,
6243,
62104,
4247,
686,
1102,
304,
3553,
537,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode() {
let (message, signature) = split_encoded_parts(RFC7515_A1_ENCODED).unwrap().decode().unwrap();
assert!(&message.header == &json_object!{
"alg": "HS256",
"typ": "JWT"
});
assert!(let Ok(_) = message.parse_json_object());
assert!(message.parse_json_object().ok() == Some(json_object!{
"iss": "joe",
"exp": 1300819380,
"http://example.com/is_root": true,
}));
assert!(&signature[..] == RFC7515_A1_SIGNATURE);
} | rust_cleaned_test_functions.jsonl/6392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
368,
341,
197,
10217,
320,
1994,
11,
11957,
8,
284,
6718,
73069,
33217,
2785,
6754,
22,
20,
16,
20,
1566,
16,
89513,
35,
568,
15454,
1005,
18196,
1005,
15454,
1428,
197,
6948,
0,
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_solution_1() {
assert_eq!(SUM_0, solution_1(&mut Packets::from(DATA_0)));
assert_eq!(SUM_1, solution_1(&mut parse(CONTENT_1)));
assert_eq!(SUM_2, solution_1(&mut Packets::from(DATA_2)));
assert_eq!(SUM_3, solution_1(&mut parse(CONTENT_3)));
assert_eq!(SUM_4, solution_1(&mut parse(CONTENT_4)));
} | rust_cleaned_test_functions.jsonl/20583 | {
"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,
50274,
62,
16,
368,
341,
286,
2060,
10714,
10297,
27377,
62,
15,
11,
6291,
62,
16,
2099,
6984,
13795,
1415,
486,
1499,
59093,
62,
15,
4945,
286,
2060,
10714,
10297,
27377,
62,
16,
11,
6291,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_hosts_conf() {
let path = format!("{}/hosts", tests_dir());
let hosts = read_hosts_conf(&path).unwrap();
let name = Name::from_str("localhost").unwrap();
let rdatas = hosts
.lookup_static_host(&Query::query(name.clone(), RecordType::A))
.unwrap()
.iter()
.map(|r| r.to_owned())
.collect::<Vec<RData>>();
assert_eq!(
rdatas,
vec![
RData::A(Ipv4Addr::new(127, 0, 0, 1)),
]
);
let rdatas = hosts
.lookup_static_host(&Query::query(name.clone(), RecordType::AAAA))
.unwrap()
.iter()
.map(|r| r.to_owned())
.collect::<Vec<RData>>();
assert_eq!(
rdatas,
vec![
RData::AAAA(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)),
]
);
let name = Name::from_str("broadcasthost").unwrap();
let rdatas = hosts
.lookup_static_host(&Query::query(name.clone(), RecordType::A))
.unwrap()
.iter()
.map(|r| r.to_owned())
.collect::<Vec<RData>>();
assert_eq!(rdatas, vec![RData::A(Ipv4Addr::new(255, 255, 255, 255))]);
let name = Name::from_str("example.com").unwrap();
let rdatas = hosts
.lookup_static_host(&Query::query(name.clone(), RecordType::A))
.unwrap()
.iter()
.map(|r| r.to_owned())
.collect::<Vec<RData>>();
assert_eq!(rdatas, vec![RData::A(Ipv4Addr::new(10, 0, 1, 102))]);
let name = Name::from_str("a.example.com").unwrap();
let rdatas = hosts
.lookup_static_host(&Query::query(name.clone(), RecordType::A))
.unwrap()
.iter()
.map(|r| r.to_owned())
.collect::<Vec<RData>>();
assert_eq!(rdatas, vec![RData::A(Ipv4Addr::new(10, 0, 1, 111))]);
let name = Name::from_str("b.example.com").unwrap();
let rdatas = hosts
.lookup_static_host(&Query::query(name.clone(), RecordType::A))
.unwrap()
.iter()
.map(|r| r.to_owned())
.collect::<Vec<RData>>();
assert_eq!(rdatas, vec![RData::A(Ipv4Addr::new(10, 0, 1, 111))]);
} | rust_cleaned_test_functions.jsonl/38045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
61129,
16059,
368,
341,
286,
1077,
1815,
284,
3561,
88928,
4472,
44692,
497,
7032,
4334,
1423,
286,
1077,
18432,
284,
1349,
61129,
16059,
2099,
2343,
568,
15454,
1428,
286,
1077,
829,
284,
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_combined() {
let args =
vec!("prog".to_string(),
"free1".to_string(),
"-s".to_string(),
"20".to_string(),
"free2".to_string(),
"--flag".to_string(),
"--long=30".to_string(),
"-f".to_string(),
"-m".to_string(),
"40".to_string(),
"-m".to_string(),
"50".to_string(),
"-n".to_string(),
"-A B".to_string(),
"-n".to_string(),
"-60 70".to_string());
let opts =
vec!(optopt("s", "something", "something", "SOMETHING"),
optflag("", "flag", "a flag"),
reqopt("", "long", "hi", "LONG"),
optflag("f", "", "another flag"),
optmulti("m", "", "mmmmmm", "YUM"),
optmulti("n", "", "nothing", "NOTHING"),
optopt("", "notpresent", "nothing to see here", "NOPE"));
let rs = getopts(args.as_slice(), opts.as_slice());
match rs {
Ok(ref m) => {
assert!(*m.free.get(0) == "prog".to_string());
assert!(*m.free.get(1) == "free1".to_string());
assert_eq!(m.opt_str("s").unwrap(), "20".to_string());
assert!(*m.free.get(2) == "free2".to_string());
assert!((m.opt_present("flag")));
assert_eq!(m.opt_str("long").unwrap(), "30".to_string());
assert!((m.opt_present("f")));
let pair = m.opt_strs("m");
assert!(*pair.get(0) == "40".to_string());
assert!(*pair.get(1) == "50".to_string());
let pair = m.opt_strs("n");
assert!(*pair.get(0) == "-A B".to_string());
assert!(*pair.get(1) == "-60 70".to_string());
assert!((!m.opt_present("notpresent")));
}
_ => fail!()
}
} | rust_cleaned_test_functions.jsonl/13332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
89945,
368,
341,
286,
1077,
2827,
4035,
310,
7486,
17223,
32992,
3263,
983,
3904,
3148,
338,
330,
10593,
16,
3263,
983,
3904,
3148,
338,
6523,
82,
3263,
983,
3904,
3148,
338,
330,
17,
15,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_enum_in_message() {
let mut m = TestEnumWithAlias::new();
m.set_en(EnumWithAlias::A);
test_serialize_deserialize("08 0a", &m);
} | rust_cleaned_test_functions.jsonl/63347 | {
"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,
31054,
1243,
6462,
368,
341,
262,
1077,
5206,
296,
284,
3393,
10766,
2354,
22720,
486,
931,
543,
262,
296,
980,
6205,
62382,
2354,
22720,
486,
32,
317,
262,
1273,
88686,
15768,
9050,
445,
15,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hover_through_func_in_macro_recursive() {
check(
r#"
macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } }
macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } }
fn bar() -> u32 { 0 }
fn foo() { let a = id!([0u32, bar($0)] ); }
"#,
expect![[r#"
*bar()*
```rust
u32
```
"#]],
);
} | rust_cleaned_test_functions.jsonl/66646 | {
"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,
53445,
87399,
9596,
1243,
58810,
66242,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
32606,
21407,
0,
877,
87044,
314,
1711,
699,
5566,
25,
5566,
8,
3764,
589,
314,
93977,
5566,
4806,
335,
456,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_inline_aliases3() {
test_same(concat!(
"var x = this.foo(); this.bar(); ",
"function f() { var y = x; g(); this.baz(y); } ",
"function g() { x = 3; }"
));
} | rust_cleaned_test_functions.jsonl/27681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
41871,
90233,
18,
368,
341,
262,
1273,
33574,
96360,
33673,
286,
330,
947,
856,
284,
419,
58432,
2129,
419,
22001,
2129,
21796,
286,
330,
1688,
282,
368,
314,
762,
379,
284,
856,
26,
342,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u128_overflow() {
use ffi;
use object::PyObject;
use std::os::raw::c_uchar;
use types::exceptions;
let gil = Python::acquire_gil();
let py = gil.python();
let overflow_bytes: [c_uchar; 20] = [255; 20];
unsafe {
let obj = ffi::_PyLong_FromByteArray(
overflow_bytes.as_ptr() as *const c_uchar,
20,
super::IS_LITTLE_ENDIAN,
0,
);
let obj = PyObject::from_owned_ptr_or_panic(py, obj);
let err = obj.extract::<u128>(py).unwrap_err();
assert!(err.is_instance::<exceptions::OverflowError>(py));
}
} | rust_cleaned_test_functions.jsonl/8679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
16,
17,
23,
79073,
368,
341,
286,
990,
76956,
280,
286,
990,
1633,
486,
53376,
280,
286,
990,
1460,
486,
436,
486,
1041,
486,
66,
62,
29272,
280,
286,
990,
4494,
486,
61752,
280,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_confirmations() {
let GenesisBlockInfo {
genesis_block,
mint_keypair: alice,
..
} = create_genesis_block(10_000);
let bank = Bank::new(&genesis_block);
let blockhash = bank.last_blockhash();
let bank_forks = Arc::new(RwLock::new(BankForks::new(0, bank)));
let bob = Keypair::new();
let rpc = RpcSolPubSubImpl::default();
let session = create_session();
let (subscriber, _id_receiver, mut receiver) = Subscriber::new_test("accountNotification");
rpc.account_subscribe(session, subscriber, bob.pubkey().to_string(), Some(2));
let tx = system_transaction::transfer(&alice, &bob.pubkey(), 100, blockhash);
bank_forks
.write()
.unwrap()
.get(0)
.unwrap()
.process_transaction(&tx)
.unwrap();
rpc.subscriptions.notify_subscribers(0, &bank_forks);
let bank0 = bank_forks.read().unwrap()[0].clone();
let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
bank_forks.write().unwrap().insert(bank1);
rpc.subscriptions.notify_subscribers(1, &bank_forks);
let bank1 = bank_forks.read().unwrap()[1].clone();
let bank2 = Bank::new_from_parent(&bank1, &Pubkey::default(), 2);
bank_forks.write().unwrap().insert(bank2);
rpc.subscriptions.notify_subscribers(2, &bank_forks);
let string = receiver.poll();
let expected = json!({
"jsonrpc": "2.0",
"method": "accountNotification",
"params": {
"result": {
"owner": system_program::id(),
"lamports": 100,
"data": [],
"executable": false,
},
"subscription": 0,
}
});
if let Async::Ready(Some(response)) = string.unwrap() {
assert_eq!(serde_json::to_string(&expected).unwrap(), response);
}
} | rust_cleaned_test_functions.jsonl/103085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1032
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
23800,
804,
368,
341,
286,
1077,
40788,
4713,
1731,
341,
310,
59366,
7113,
345,
310,
28337,
3097,
12670,
25,
70433,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
7113,
7,
16,
15,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_def() {
let re = ResourceDef::new("/user/-{id}*");
assert_eq!(re, ResourceDef::from("/user/-{id}*"));
assert_eq!(re, ResourceDef::from("/user/-{id}*".to_string()));
let mut h = HashMap::new();
h.insert(re.clone(), 1);
assert!(h.contains_key(&re));
let seg = Segment::Static("s".to_string());
assert_eq!(seg, Segment::Static("s".to_string()));
let seg2 = Segment::Dynamic {
pattern: Regex::new("test").unwrap(),
names: Vec::new(),
len: 1,
tail: false,
};
assert!(seg != seg2);
assert_eq!(seg2, seg2);
} | rust_cleaned_test_functions.jsonl/2251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7844,
368,
341,
286,
1077,
312,
284,
11765,
2620,
486,
931,
4283,
872,
23650,
90,
307,
92814,
797,
286,
2060,
10714,
10297,
265,
11,
11765,
2620,
486,
1499,
4283,
872,
23650,
90,
307,
92814,
401... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_min_max_empty() {
let a = BooleanArray::new_empty(DataType::Boolean);
assert_eq!(None, min_boolean(&a));
assert_eq!(None, max_boolean(&a));
} | rust_cleaned_test_functions.jsonl/112096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
7260,
6345,
15124,
368,
341,
262,
1077,
264,
284,
6992,
1857,
486,
931,
15124,
63941,
486,
6890,
317,
262,
2060,
10714,
10297,
4064,
11,
1308,
46642,
2099,
64,
1106,
262,
2060,
10714,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_entropy() {
test_case(-0.0, 2.0, 0.6931471805599453094172, |x| x.entropy());
test_case(0.0, 2.0, 0.6931471805599453094172, |x| x.entropy());
test_almost(0.1, 4.0, 1.360976553135600743431, 1e-15, |x| x.entropy());
test_case(1.0, 10.0, 2.19722457733621938279, |x| x.entropy());
test_case(10.0, 11.0, 0.0, |x| x.entropy());
test_case(0.0, f64::INFINITY, f64::INFINITY, |x| x.entropy());
} | rust_cleaned_test_functions.jsonl/47370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50374,
368,
341,
286,
1273,
19096,
4080,
15,
13,
15,
11,
220,
17,
13,
15,
11,
220,
15,
13,
21,
24,
18,
16,
19,
22,
16,
23,
15,
20,
20,
24,
24,
19,
20,
18,
15,
24,
19,
16,
22,
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... | 1 |
#[test]
fn test_mnemonic_try_from_usize() {
for value in Mnemonic::values() {
let converted = <Mnemonic as TryFrom<usize>>::try_from(value as usize).unwrap();
assert_eq!(converted, value);
}
assert!(<Mnemonic as TryFrom<usize>>::try_from(IcedConstants::MNEMONIC_ENUM_COUNT).is_err());
assert!(<Mnemonic as TryFrom<usize>>::try_from(core::usize::MAX).is_err());
} | rust_cleaned_test_functions.jsonl/64688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
70775,
53283,
5673,
11306,
551,
368,
341,
2023,
897,
304,
56731,
38801,
486,
3661,
368,
341,
197,
10217,
16099,
284,
366,
44,
70775,
438,
9735,
3830,
90244,
77595,
1539,
5673,
3679,
438,
2230... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_privkey_serialize() {
mc_util_test_helper::run_with_several_seeds(|mut rng| {
let privkey = RistrettoPrivate::from_random(&mut rng);
let serialized =
mc_util_serial::serialize(&privkey).expect("Could not serialize private key.");
let deserialized: RistrettoPrivate = mc_util_serial::deserialize(&serialized)
.expect("Could not deserialize private key");
let pubkey = RistrettoPublic::from(&privkey);
let deserialized_pubkey = RistrettoPublic::from(&deserialized);
assert_eq!(deserialized_pubkey, pubkey);
});
} | rust_cleaned_test_functions.jsonl/51018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24726,
792,
88686,
368,
341,
286,
19223,
18974,
4452,
10418,
486,
6108,
6615,
3453,
17539,
3453,
6767,
22428,
6984,
28422,
91,
341,
310,
1077,
6095,
792,
284,
431,
380,
2122,
983,
16787,
486,
1499... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remaining_capacity_as_slice_mut() {
let mut v = Vec::with_capacity(5);
v.push(10);
v.push(11);
v.push(12);
unsafe {
{
let s = remaining_capacity_as_slice_mut(&mut v);
assert_eq!(2, s.len());
s[0] = 13;
s[1] = 14;
}
v.set_len(5);
}
assert_eq!(vec![10, 11, 12, 13, 14], v);
} | rust_cleaned_test_functions.jsonl/26243 | {
"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,
59244,
35603,
11898,
26488,
29523,
368,
341,
286,
1077,
5206,
348,
284,
11312,
486,
4197,
35603,
7,
20,
317,
286,
348,
2552,
7,
16,
15,
317,
286,
348,
2552,
7,
16,
16,
317,
286,
348,
2552,
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_if_alternative() {
assert_eq!(
Value::Symbol("alternative".into()),
if_alternative(parse("(if (condition) consequent alternative)"))
);
assert_eq!(
Value::Boolean(false),
if_alternative(parse("(if (condition) consequent)"))
);
} | rust_cleaned_test_functions.jsonl/14324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
79728,
1388,
368,
341,
286,
2060,
10714,
33673,
310,
5162,
486,
15090,
445,
76995,
3263,
18122,
14702,
310,
421,
79728,
1388,
27762,
31732,
333,
320,
9056,
8,
12494,
306,
10555,
8,
5455,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytewise_should_not_add_newline_when_line_equal_to_fold() {
new_ucmd!()
.args(&["-w1", "-b"])
.pipe_in(" ")
.succeeds()
.stdout_is(" ");
} | rust_cleaned_test_functions.jsonl/23304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3710,
83,
24350,
43378,
7913,
2891,
5921,
1056,
47636,
6528,
11478,
2346,
61187,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
16,
497,
6523,
65,
14108,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fresh_host_on() {
let src = ":tmi.twitch.tv HOSTTARGET #randers :leebaxd 0";
let irc_message = IRCMessage::parse(src).unwrap();
let msg = HostTargetMessage::try_from(irc_message.clone()).unwrap();
assert_eq!(
msg,
HostTargetMessage {
channel_login: "randers".to_owned(),
action: HostTargetAction::HostModeOn {
hosted_channel_login: "leebaxd".to_owned(),
viewer_count: Some(0)
},
source: irc_message
}
);
} | rust_cleaned_test_functions.jsonl/1049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
2488,
12848,
4470,
368,
341,
286,
1077,
2286,
284,
13022,
83,
8155,
90179,
14485,
44578,
45583,
671,
11335,
388,
549,
273,
3065,
706,
67,
220,
15,
876,
286,
1077,
79923,
6462,
284,
59328,
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_size() {
assert_size!(Tune, 68);
assert_size!(Artist, 12);
assert_size!(Length, 2);
assert_size!(Rating, 1);
assert_size!(Source, 12);
assert_size!(Title, 12);
assert_size!(Track, 12);
assert_size!(Uri, 12);
} | rust_cleaned_test_functions.jsonl/37468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2368,
368,
341,
286,
2060,
2368,
10297,
51,
2886,
11,
220,
21,
23,
317,
286,
2060,
2368,
10297,
40309,
11,
220,
16,
17,
317,
286,
2060,
2368,
10297,
4373,
11,
220,
17,
317,
286,
2060,
2368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_test1() {
static OUTPUT: &'static str = include_str!("tangling/test1/output");
let files = ["tests/tangling/test1/000-file1", "tests/tangling/test1/001-file2"];
let files: Vec<String> = files.iter().map(|str| str.to_string()).collect();
let files = input::open_files(files).unwrap();
let output_options = kaiseki::OutputOptions {
comment: None
};
let (output, errors) = kaiseki::tangle_output(files, output_options);
assert_eq!(errors.len(), 0);
for (line1, line2) in OUTPUT.lines().zip(output) {
assert_eq!(line1, &line2 as &str);
}
} | rust_cleaned_test_functions.jsonl/85849 | {
"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,
4452,
16,
368,
341,
220,
1099,
30990,
25,
30136,
1978,
607,
284,
2924,
2895,
17223,
83,
90104,
12697,
16,
47016,
3071,
220,
1077,
3542,
284,
4383,
23841,
5523,
90104,
12697,
16,
14,
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... | 2 |
#[test]
fn test_open_write() {
let tmp = tempfile::TempDir::new().unwrap();
let file = EncryptedFile::new(tmp.path(), "encrypted");
assert_eq!(file.base, tmp.path());
assert_eq!(file.name, "encrypted");
let ret = file.read(&PlaintextBackend::default());
assert_matches!(ret, Err(Error::Io(_)));
if let Err(Error::Io(e)) = file.read(&PlaintextBackend::default()) {
assert_eq!(ErrorKind::NotFound, e.kind());
}
let content = b"test content";
file.write(content, &PlaintextBackend::default()).unwrap();
drop(file);
let file = EncryptedFile::new(tmp.path(), "encrypted");
assert_eq!(file.read(&PlaintextBackend::default()).unwrap(), content);
} | rust_cleaned_test_functions.jsonl/14689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
9165,
368,
341,
286,
1077,
4174,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
1034,
284,
10751,
14026,
1703,
486,
931,
10368,
3875,
1507,
330,
36444,
797,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_column_chunk_metadata_thrift_conversion() {
let column_descr = get_test_schema_descr().column(0);
let col_metadata = ColumnChunkMetaData::builder(column_descr.clone())
.set_encodings(vec![Encoding::PLAIN, Encoding::RLE])
.set_file_path("file_path".to_owned())
.set_file_offset(100)
.set_num_values(1000)
.set_compression(Compression::SNAPPY)
.set_total_compressed_size(2000)
.set_total_uncompressed_size(3000)
.set_data_page_offset(4000)
.set_dictionary_page_offset(Some(5000))
.set_page_encoding_stats(vec![
PageEncodingStats {
page_type: PageType::DATA_PAGE,
encoding: Encoding::PLAIN,
count: 3,
},
PageEncodingStats {
page_type: PageType::DATA_PAGE,
encoding: Encoding::RLE,
count: 5,
},
])
.set_bloom_filter_offset(Some(6000))
.set_offset_index_offset(Some(7000))
.set_offset_index_length(Some(25))
.set_column_index_offset(Some(8000))
.set_column_index_length(Some(25))
.build()
.unwrap();
let col_chunk_res =
ColumnChunkMetaData::from_thrift(column_descr, col_metadata.to_thrift())
.unwrap();
assert_eq!(col_chunk_res, col_metadata);
} | rust_cleaned_test_functions.jsonl/82559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 852
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
30539,
22220,
5854,
41380,
64132,
368,
341,
286,
1077,
3250,
64622,
284,
633,
4452,
25371,
64622,
1005,
6229,
7,
15,
626,
286,
1077,
1375,
22220,
284,
9332,
28304,
37307,
486,
17850,
17277,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_credential_generation() {
//! Credentials should have valid checksums
const RUNS: usize = 1000;
let rng = Arc::new(Mutex::new(ring::rand::SystemRandom::new()));
let uuid = UUID::gen(rng.clone());
for _ in 0..RUNS {
let cred = Credential::gen(rng.clone(), &uuid);
// Ensures the generated password has a valid checksum
assert!(cred.password.validate_checksum())
}
} | rust_cleaned_test_functions.jsonl/76579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
30320,
64191,
368,
341,
286,
17664,
61260,
1265,
614,
2697,
32529,
82,
198,
286,
733,
30760,
50,
25,
22301,
284,
220,
16,
15,
15,
15,
280,
286,
1077,
28422,
284,
19689,
486,
931,
3189,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_file_style_colored_input_color_is_stripped_under_normal() {
let config = integration_test_utils::make_config_from_args(&[
"--file-style",
"normal",
"--file-decoration-style",
"omit",
]);
let output = integration_test_utils::run_delta(
GIT_DIFF_SINGLE_HUNK_WITH_ANSI_ESCAPE_SEQUENCES,
&config,
);
ansi_test_utils::assert_line_has_no_color(&output, 7, "src/align.rs");
} | rust_cleaned_test_functions.jsonl/70068 | {
"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,
2458,
15117,
10211,
3018,
5898,
6714,
6892,
1261,
461,
6924,
58228,
13973,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
9640,
310,
14482,
1192,
11297,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_control_character() {
let s = "{ \"key\": \"a\0b\nc\" }";
let value: Value = from_str_lenient(s).unwrap();
assert_eq!(value, json!({"key": "a\0b\nc"}));
} | rust_cleaned_test_functions.jsonl/77190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13436,
40988,
368,
341,
262,
1077,
274,
284,
13868,
7245,
792,
11693,
7245,
64,
59,
15,
65,
59,
1016,
2105,
335,
876,
262,
1077,
897,
25,
5162,
284,
504,
2895,
6043,
1167,
1141,
568,
15454,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compound_literal() {
use parser::expression;
use ast::{CompoundLiteral, StructType};
use ast::Designator::Member;
use self::int::dec;
let env = &mut Env::with_gnu();
assert_eq!(
expression("(struct test_struct) { 1, .x = 2, 3 }", env),
Ok(CompoundLiteral {
type_name: TypeName {
specifiers: vec![StructType {
kind: StructKind::Struct.into(),
identifier: Some(ident("test_struct")),
declarations: None,
}.into()],
declarator: None,
}
.into(),
initializer_list: vec![
InitializerListItem {
designation: vec![],
initializer: dec("1"),
}
.into(),
InitializerListItem {
designation: vec![Member(ident("x")).into()],
initializer: dec("2"),
}
.into(),
InitializerListItem {
designation: vec![],
initializer: dec("3"),
}
.into(),
],
}
.into())
);
} | rust_cleaned_test_functions.jsonl/107589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 738
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
795,
34100,
368,
341,
262,
990,
6729,
486,
28099,
280,
262,
990,
11763,
22964,
43134,
17350,
11,
16139,
929,
2440,
262,
990,
11763,
486,
20470,
850,
486,
9366,
280,
262,
990,
656,
486,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string() {
let vec = vec!["abcbuÖeiovÄnameÜavmpßvmea€µsbpnvapeapmaebn".to_string(),
"abcbuÖganeiovÄnameÜavmpßvmea€µsbpnvapeapmaebn".to_string(),
"abcbuÖganeiovÄnameÜavmpßvmea€µsbpapmaebn".to_string(),
"abcbuÖganeiovÄnameÜavmpßvmeabpnvapeapmaebn".to_string(),
"abcbuÖganeiÄnameÜavmpßvmea€µsbpnvapeapmaebn".to_string(),
"abcbuÖganeiovÄnameÜavmpßvmea€µsbpmaebn".to_string(),
"abcbuÖganeiovÄnameÜavmpßvmea€µnvapeapmaebn".to_string()];
check_round_trip(vec);
} | rust_cleaned_test_functions.jsonl/24195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
368,
341,
262,
1077,
7486,
284,
7486,
0,
1183,
370,
7221,
84,
63361,
68,
30835,
86975,
606,
52491,
402,
1307,
7997,
85,
2660,
64,
15056,
73048,
16892,
19958,
85,
2027,
391,
1728,
3065,
77,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mapper_test_interface() {
let mut vec: Vec<(String, String)> = Vec::new();
let test_input = MapInputKV::new("test_key".to_owned(), "this is a".to_owned());
let mapper = TestMapper;
mapper
.map(test_input, IntermediateVecEmitter::new(&mut vec))
.unwrap();
assert_eq!("this is a", vec[0].0);
assert_eq!("test", vec[0].1);
} | rust_cleaned_test_functions.jsonl/20343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76664,
4452,
20546,
368,
341,
286,
1077,
5206,
7486,
25,
11312,
28706,
703,
11,
923,
16018,
284,
11312,
486,
931,
543,
286,
1077,
1273,
5898,
284,
5027,
2505,
82707,
486,
931,
445,
1944,
3097,
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_symlink_to_dir_2args() {
let (at, mut ucmd) = at_and_ucmd!();
let filename = "test_symlink_to_dir_2args_file";
let from_file = &format!("{}/{}", at.as_string(), filename);
let to_dir = "test_symlink_to_dir_2args_to_dir";
let to_file = &format!("{}/{}", to_dir, filename);
at.mkdir(to_dir);
at.touch(from_file);
ucmd.args(&["-s", from_file, to_dir]).succeeds().no_stderr();
assert!(at.file_exists(to_file));
assert!(at.is_symlink(to_file));
assert_eq!(at.resolve_link(to_file), filename);
} | rust_cleaned_test_functions.jsonl/4896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58530,
44243,
2346,
4334,
62,
17,
2116,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
3899,
284,
330,
1944,
58530,
44243,
2346,
4334,
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_delete_range_prefix_bloom_case_1() {
let path = tempdir_with_prefix("_rust_rocksdb_test_delete_range_prefix_bloom_case_1");
let path_str = path.path().to_str().unwrap();
let mut opts = DBOptions::new();
opts.create_if_missing(true);
let mut cf_opts = ColumnFamilyOptions::new();
cf_opts
.set_prefix_extractor::<&str, FixedSuffixSliceTransform>(
"FixedSuffixSliceTransform",
FixedSuffixSliceTransform::new(3),
)
.unwrap_or_else(|err| panic!(format!("{:?}", err)));
// Create prefix bloom filter for memtable.
cf_opts.set_memtable_prefix_bloom_size_ratio(0.1 as f64);
let cf = "default";
let db = DB::open_cf(opts, path_str, vec![(cf, cf_opts)]).unwrap();
let samples_a = vec![
(b"keya11111", b"value1"),
(b"keyb22222", b"value2"),
(b"keyc33333", b"value3"),
(b"keyd44444", b"value4"),
];
let handle = get_cf_handle(&db, cf).unwrap();
for (k, v) in samples_a {
db.put_cf(handle, k, v).unwrap();
assert_eq!(v, &*db.get(k).unwrap().unwrap());
}
let before = gen_crc32_from_db(&db);
let gen_path = tempdir_with_prefix("_rust_rocksdb_case_prefix_bloom_1_ingest_sst_gen");
let test_sstfile = gen_path.path().join("test_sst_file");
let test_sstfile_str = test_sstfile.to_str().unwrap();
let ingest_opt = IngestExternalFileOptions::new();
let default_options = db.get_options();
gen_sst_from_db(
default_options,
db.cf_handle("default"),
test_sstfile_str,
&db,
);
db.delete_range_cf(handle, b"keya11111", b"keye55555")
.unwrap();
check_kv(
&db,
db.cf_handle(cf),
&[
(b"keya11111", None),
(b"keyb22222", None),
(b"keyc33333", None),
(b"keyd44444", None),
],
);
db.ingest_external_file_cf(handle, &ingest_opt, &[test_sstfile_str])
.unwrap();
check_kv(
&db,
db.cf_handle(cf),
&[
(b"keya11111", Some(b"value1")),
(b"keyb22222", Some(b"value2")),
(b"keyc33333", Some(b"value3")),
(b"keyd44444", Some(b"value4")),
],
);
let after = gen_crc32_from_db(&db);
assert_eq!(before, after);
} | rust_cleaned_test_functions.jsonl/57047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
9698,
13974,
880,
18474,
19096,
62,
16,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
4452,
11353,
9698,
13974,
880,
18474,
19096,
62,
16,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_stacked_porep_setup_terminates() {
let degree = BASE_DEGREE;
let expansion_degree = EXP_DEGREE;
let nodes = 1024 * 1024 * 32 * 8;
let layer_challenges = LayerChallenges::new(10, 333);
let sp = SetupParams {
nodes,
degree,
expansion_degree,
porep_id: [32; 32],
layer_challenges,
api_version: ApiVersion::V1_1_0,
};
let _pp = StackedDrg::<DiskTree<Sha256Hasher, U8, U0, U0>, Blake2sHasher>::setup(&sp)
.expect("setup failed");
} | rust_cleaned_test_functions.jsonl/56523 | {
"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,
1261,
11191,
620,
460,
79,
21363,
62,
22969,
973,
368,
341,
262,
1077,
8381,
284,
22194,
2881,
98562,
280,
262,
1077,
14461,
49524,
284,
13460,
2881,
98562,
280,
262,
1077,
7798,
284,
220,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_compression() {
let tmp = tempdir::TempDir::new("rust-htslib").expect("Cannot create temp dir");
let input_bam_path = "test/test.bam";
// test levels with decreasing compression factor
let levels_to_test = vec![
CompressionLevel::Maximum,
CompressionLevel::Level(6),
CompressionLevel::Fastest,
CompressionLevel::Uncompressed,
];
let file_sizes: Vec<_> = levels_to_test
.iter()
.map(|level| {
let output_bam_path = tmp.path().join("test.bam");
{
let mut reader = Reader::from_path(&input_bam_path).unwrap();
let header = Header::from_template(reader.header());
let mut writer =
Writer::from_path(&output_bam_path, &header, Format::BAM).unwrap();
writer.set_compression_level(*level).unwrap();
for record in reader.records() {
writer.write(&record.unwrap()).unwrap();
}
}
fs::metadata(output_bam_path).unwrap().len()
})
.collect();
assert!(file_sizes.windows(2).all(|size| size[0] <= size[1]));
tmp.close().expect("Failed to delete temp dir");
} | rust_cleaned_test_functions.jsonl/34039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 720
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
2965,
4011,
368,
341,
286,
1077,
4174,
284,
2730,
3741,
486,
12151,
6184,
486,
931,
445,
35788,
12,
426,
82,
2740,
1827,
17119,
445,
17444,
1855,
2730,
5419,
797,
286,
1077,
1946,
880,
309... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_logger_filters() {
if env::var("RUN_TEST_LOGGER_FILTERS").is_ok() {
let test_directives =
"afg=debug,sync=trace,client=warn,telemetry,something-with-dash=error";
init_logger(&test_directives);
tracing::dispatcher::get_default(|dispatcher| {
let test_filter = |target, level| {
struct DummyCallSite;
impl Callsite for DummyCallSite {
fn set_interest(&self, _: Interest) {}
fn metadata(&self) -> &Metadata<'_> {
unreachable!();
}
}
let metadata = tracing::metadata!(
name: "",
target: target,
level: level,
fields: &[],
callsite: &DummyCallSite,
kind: Kind::SPAN,
);
dispatcher.enabled(&metadata)
};
assert!(test_filter("afg", Level::INFO));
assert!(test_filter("afg", Level::DEBUG));
assert!(!test_filter("afg", Level::TRACE));
assert!(test_filter("sync", Level::TRACE));
assert!(test_filter("client", Level::WARN));
assert!(test_filter("telemetry", Level::TRACE));
assert!(test_filter("something-with-dash", Level::ERROR));
});
} else {
let status = Command::new(env::current_exe().unwrap())
.arg("test_logger_filters")
.env("RUN_TEST_LOGGER_FILTERS", "1")
.output()
.unwrap()
.status;
assert!(status.success());
}
} | rust_cleaned_test_functions.jsonl/127510 | {
"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,
27413,
22481,
368,
341,
197,
743,
6105,
486,
947,
445,
47390,
11641,
87673,
23728,
50,
1827,
285,
19817,
368,
341,
298,
10217,
1273,
32871,
1886,
4035,
571,
197,
1,
2577,
70,
28,
8349,
10671,
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_len() {
let v: SmallVector<int> = SmallVector::zero();
assert_eq!(0, v.len());
assert_eq!(1, SmallVector::one(1i).len());
assert_eq!(5, SmallVector::many(vec!(1i, 2, 3, 4, 5)).len());
} | rust_cleaned_test_functions.jsonl/52125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6043,
368,
341,
286,
1077,
348,
25,
14994,
3781,
4159,
29,
284,
14994,
3781,
486,
14154,
543,
286,
2060,
10714,
10297,
15,
11,
348,
19406,
5231,
286,
2060,
10714,
10297,
16,
11,
14994,
3781,
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_erase_all_dynamic_rules() {
let rules = vec![
rule!("fuchsia.com" => "fuchsia.com", "/rolldice" => "/rolldice"),
rule!("fuchsia.com" => "fuchsia.com", "/rolldice/" => "/rolldice/"),
];
let dynamic_config = make_rule_config(rules.clone());
let mut manager = RewriteManagerBuilder::new(Some(&dynamic_config)).unwrap().build();
assert_eq!(manager.list().cloned().collect::<Vec<_>>(), rules);
let mut transaction = manager.transaction();
transaction.reset_all();
assert_eq!(manager.list().cloned().collect::<Vec<_>>(), rules);
assert_eq!(transaction.list_dynamic().cloned().collect::<Vec<_>>(), vec![]);
assert_eq!(manager.apply(transaction).unwrap(), ());
assert_eq!(manager.list().cloned().collect::<Vec<_>>(), vec![]);
let manager = RewriteManagerBuilder::new(Some(&dynamic_config)).unwrap().build();
assert_eq!(manager.list().cloned().collect::<Vec<_>>(), vec![]);
} | rust_cleaned_test_functions.jsonl/46503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85516,
5705,
45992,
21407,
368,
341,
286,
1077,
5601,
284,
7486,
90515,
310,
5912,
17223,
69,
73391,
905,
1,
589,
330,
69,
73391,
905,
497,
3521,
1080,
507,
558,
1,
589,
3521,
1080,
507,
558,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trait() {
check(
r#"
trait Foo$0 where Self: {}
impl Foo for () {}
"#,
expect![[r#"
Foo Trait FileId(0) 0..24 6..9
FileId(0) 31..34
"#]],
);
} | rust_cleaned_test_functions.jsonl/60672 | {
"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,
78491,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
29432,
33428,
3,
15,
1380,
10115,
25,
10086,
6383,
33428,
369,
1719,
5613,
57676,
345,
310,
1720,
0,
15505,
81,
2,
698,
394,
33428,
68301,
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_terminal_or_honor_in_each_set_does_not_combined_with_terminal_in_each_set() {
let test_str = "111789m111p99s11z 1z";
let test = Hand::from(test_str);
let test_analyzer = HandAnalyzer::new(&test).unwrap();
let mut status = Status::new();
let settings = Settings::new();
status.has_claimed_open = false;
assert_eq!(
check_terminal_or_honor_in_each_set(&test_analyzer, &status, &settings).unwrap().1,
true
);
assert_eq!(
check_terminal_in_each_set(&test_analyzer, &status, &settings).unwrap().1,
false
);
} | rust_cleaned_test_functions.jsonl/91438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64309,
8734,
1523,
54037,
1243,
32046,
2602,
96374,
7913,
89945,
6615,
64309,
1243,
32046,
2602,
368,
341,
286,
1077,
1273,
2895,
284,
330,
16,
16,
16,
22,
23,
24,
76,
16,
16,
16,
79,
24,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_rfind() {
let v = [0, 1, 2, 3, 4, 5];
let mut iter = v.iter();
let mut i = v.len();
while let Some(&elt) = iter.rfind(|_| true) {
i -= 1;
assert_eq!(elt, v[i]);
}
assert_eq!(i, 0);
assert_eq!(v.iter().rfind(|&&x| x <= 3), Some(&3));
} | rust_cleaned_test_functions.jsonl/4150 | {
"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,
21814,
1710,
3903,
368,
341,
262,
1077,
348,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
5367,
284,
348,
19471,
543,
262,
1077,
520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_0001() {
let scope = &te_scope(r#"{}"#);
te_number(false, scope, "1/1", 1, 0);
} | rust_cleaned_test_functions.jsonl/6470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 55
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
15,
16,
368,
341,
220,
1077,
6891,
284,
609,
665,
23199,
2601,
55543,
6257,
57676,
317,
220,
1013,
5500,
3576,
11,
6891,
11,
330,
16,
14,
16,
497,
220,
16,
11,
220,
15,
317,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rpath_relative() {
let config = &mut RPathConfig {
os: abi::OsFreebsd,
used_crates: Vec::new(),
out_filename: Path::new("bin/rustc"),
get_install_prefix_lib_path: || fail!(),
realpath: |p| Ok(p.clone())
};
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
assert_eq!(res.as_slice(), "$ORIGIN/../lib");
} | rust_cleaned_test_functions.jsonl/110753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
2343,
29286,
368,
341,
286,
1077,
2193,
284,
609,
6984,
431,
1820,
2648,
341,
310,
2643,
25,
61050,
486,
28867,
10940,
51835,
345,
310,
1483,
32331,
973,
25,
11312,
486,
931,
3148,
310,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_spin() {
let dur = Duration::from_secs(1);
let ex0 = LocalExecutorBuilder::default().make().unwrap();
let ex0_ru_start = getrusage_utime();
ex0.run(async { timer::sleep(dur).await });
let ex0_ru_finish = getrusage_utime();
let ex = LocalExecutorBuilder::new(Placement::Fixed(0))
.spin_before_park(Duration::from_millis(100))
.make()
.unwrap();
let ex_ru_start = getrusage_utime();
ex.run(async {
crate::spawn_local(async move { timer::sleep(dur).await }).await;
});
let ex_ru_finish = getrusage_utime();
assert!(
ex0_ru_finish - ex0_ru_start < Duration::from_millis(10),
"expected user time on LE0 is less than 10 millisecond"
);
// 100 ms may have passed without us running for 100ms in case
// there are other threads. Need to be a bit more relaxed
assert!(
ex_ru_finish - ex_ru_start >= Duration::from_millis(50),
"expected user time on LE is much greater than 50 millisecond"
);
} | rust_cleaned_test_functions.jsonl/1233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47965,
368,
341,
286,
1077,
10651,
284,
21045,
486,
1499,
68718,
7,
16,
317,
286,
1077,
505,
15,
284,
8774,
25255,
3297,
486,
2258,
1005,
6927,
1005,
15454,
543,
286,
1077,
505,
15,
73584,
4906,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skip_deserializing() -> Result<(), Error> {
combined_keys_gen!(sender_combined_key, receiver_combined_key);
let shared_key = SharedKey::generate();
#[derive(PartialEq, Debug, Serialize, Deserialize)]
struct Struct {
a: i32,
b: i32,
#[serde(skip_deserializing)]
c: i32,
}
impl SerdeEncryptPublicKey for Struct {
type S = BincodeSerializer<Self>;
}
impl SerdeEncryptSharedKey for Struct {
type S = BincodeSerializer<Self>;
}
let msg = Struct {
a: 42,
b: 42,
c: 42,
};
let receive_msg = public_key_enc_dec(&msg, &sender_combined_key, &receiver_combined_key)?;
assert_eq!(msg.a, receive_msg.a);
assert_eq!(msg.b, receive_msg.b);
assert_eq!(
receive_msg.c, 0,
"deserialization skipped and got default value"
);
let receive_msg = shared_key_enc_dec(&msg, &shared_key)?;
assert_eq!(msg.a, receive_msg.a);
assert_eq!(msg.b, receive_msg.b);
assert_eq!(
receive_msg.c, 0,
"deserialization skipped and got default value"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/31582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 534
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
15768,
2848,
4849,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
10856,
12631,
16322,
10297,
11644,
89945,
3097,
11,
13964,
89945,
3097,
317,
262,
1077,
6094,
3097,
284,
16990,
1592,
486,
19366... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_jge_reg() {
test_interpreter_and_jit_asm!(
"
mov32 r0, 0
mov32 r1, 0xa
mov32 r2, 0xb
jge r1, r2, +4
mov32 r0, 1
mov32 r1, 0xb
jge r1, r2, +1
mov32 r0, 2
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x1 } },
8
);
} | rust_cleaned_test_functions.jsonl/59011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
709,
4920,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
18,
17,
435,
15,
11,
220,
15,
198,
286,
1974,
18,
17,
435,
16,
11,
220,
15,
9591,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cfg_not() {
with_globals(|| {
assert_eq!(!Cfg::False, Cfg::True);
assert_eq!(!Cfg::True, Cfg::False);
assert_eq!(!word_cfg("test"), Cfg::Not(Box::new(word_cfg("test"))));
assert_eq!(
!Cfg::All(vec![word_cfg("a"), word_cfg("b")]),
Cfg::Not(Box::new(Cfg::All(vec![word_cfg("a"), word_cfg("b")])))
);
assert_eq!(
!Cfg::Any(vec![word_cfg("a"), word_cfg("b")]),
Cfg::Not(Box::new(Cfg::Any(vec![word_cfg("a"), word_cfg("b")])))
);
assert_eq!(!Cfg::Not(Box::new(word_cfg("test"))), word_cfg("test"));
})
} | rust_cleaned_test_functions.jsonl/53553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18343,
7913,
368,
341,
286,
448,
58775,
79453,
341,
310,
2060,
10714,
0,
3471,
42467,
486,
4049,
11,
356,
4817,
486,
2514,
317,
310,
2060,
10714,
0,
3471,
42467,
486,
2514,
11,
356,
4817,
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... | 2 |
#[test]
fn test_parse_day_4_input() {
assert_eq!(
Day4Input {
called: vec![13, 15],
cards: vec![
BingoCard {
grid: ndarray::arr2(&[[1, 2], [3, 4]])
},
BingoCard {
grid: ndarray::arr2(&[[5, 6], [7, 8]])
}
]
},
parse_day_4_input(&["13,15", "", "1 2", "3 4", "", "5 6", "7 8"])
)
} | rust_cleaned_test_functions.jsonl/133044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16763,
62,
19,
5898,
368,
341,
262,
2060,
10714,
33673,
286,
6059,
19,
2505,
341,
310,
2598,
25,
7486,
20703,
16,
18,
11,
220,
16,
20,
1259,
310,
7411,
25,
7486,
90515,
394,
92048,
5770... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_metas_can_merge_v4() {
let invoke_context = ThisInvokeContext::new_mock(&[], &[]);
// Identical Metas can merge
assert!(MergeKind::metas_can_merge(
&invoke_context,
&Meta::default(),
&Meta::default(),
Some(&Clock::default())
)
.is_ok());
let mismatched_rent_exempt_reserve_ok = Meta {
rent_exempt_reserve: 42,
..Meta::default()
};
assert_ne!(
mismatched_rent_exempt_reserve_ok.rent_exempt_reserve,
Meta::default().rent_exempt_reserve,
);
assert!(MergeKind::metas_can_merge(
&invoke_context,
&Meta::default(),
&mismatched_rent_exempt_reserve_ok,
Some(&Clock::default())
)
.is_ok());
assert!(MergeKind::metas_can_merge(
&invoke_context,
&mismatched_rent_exempt_reserve_ok,
&Meta::default(),
Some(&Clock::default())
)
.is_ok());
let mismatched_authorized_fails = Meta {
authorized: Authorized {
staker: Pubkey::new_unique(),
withdrawer: Pubkey::new_unique(),
},
..Meta::default()
};
assert_ne!(
mismatched_authorized_fails.authorized,
Meta::default().authorized,
);
assert!(MergeKind::metas_can_merge(
&invoke_context,
&Meta::default(),
&mismatched_authorized_fails,
Some(&Clock::default())
)
.is_err());
assert!(MergeKind::metas_can_merge(
&invoke_context,
&mismatched_authorized_fails,
&Meta::default(),
Some(&Clock::default())
)
.is_err());
let lockup1_timestamp = 42;
let lockup2_timestamp = 4242;
let lockup1_epoch = 4;
let lockup2_epoch = 42;
let metas_with_lockup1 = Meta {
lockup: Lockup {
unix_timestamp: lockup1_timestamp,
epoch: lockup1_epoch,
custodian: Pubkey::new_unique(),
},
..Meta::default()
};
let metas_with_lockup2 = Meta {
lockup: Lockup {
unix_timestamp: lockup2_timestamp,
epoch: lockup2_epoch,
custodian: Pubkey::new_unique(),
},
..Meta::default()
};
// Mismatched lockups fail when both in force
assert_ne!(metas_with_lockup1.lockup, Meta::default().lockup);
assert!(MergeKind::metas_can_merge(
&invoke_context,
&metas_with_lockup1,
&metas_with_lockup2,
Some(&Clock::default())
)
.is_err());
assert!(MergeKind::metas_can_merge(
&invoke_context,
&metas_with_lockup2,
&metas_with_lockup1,
Some(&Clock::default())
)
.is_err());
let clock = Clock {
epoch: lockup1_epoch + 1,
unix_timestamp: lockup1_timestamp + 1,
..Clock::default()
};
// Mismatched lockups fail when either in force
assert_ne!(metas_with_lockup1.lockup, Meta::default().lockup);
assert!(MergeKind::metas_can_merge(
&invoke_context,
&metas_with_lockup1,
&metas_with_lockup2,
Some(&clock)
)
.is_err());
assert!(MergeKind::metas_can_merge(
&invoke_context,
&metas_with_lockup2,
&metas_with_lockup1,
Some(&clock)
)
.is_err());
let clock = Clock {
epoch: lockup2_epoch + 1,
unix_timestamp: lockup2_timestamp + 1,
..Clock::default()
};
// Mismatched lockups succeed when both expired
assert_ne!(metas_with_lockup1.lockup, Meta::default().lockup);
assert!(MergeKind::metas_can_merge(
&invoke_context,
&metas_with_lockup1,
&metas_with_lockup2,
Some(&clock)
)
.is_ok());
assert!(MergeKind::metas_can_merge(
&invoke_context,
&metas_with_lockup2,
&metas_with_lockup1,
Some(&clock)
)
.is_ok());
} | rust_cleaned_test_functions.jsonl/15335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
35917,
27421,
20888,
2273,
19,
368,
341,
286,
1077,
19873,
8467,
284,
1096,
17604,
1972,
486,
931,
34134,
2099,
12995,
609,
56703,
286,
442,
22507,
938,
6212,
300,
646,
10880,
198,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_branch_while() {
let mut reader = ParserInput::new("abcdabcda");
let mut parser = branch_while(read_text("a"), read_text("bcd"));
let result = parser(&mut reader);
assert_eq!(result, Ok(vec!["bcd", "bcd"]));
let result = parser(&mut reader);
assert_eq!(result, Ok(vec![]));
} | rust_cleaned_test_functions.jsonl/46932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28031,
86069,
368,
341,
286,
1077,
5206,
6604,
284,
21102,
2505,
486,
931,
445,
68644,
13683,
3235,
797,
286,
1077,
5206,
6729,
284,
8870,
86069,
25781,
4326,
445,
64,
3975,
1349,
4326,
445,
91490... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keywords_in_trait_def() {
check(
r"trait My { <|> }",
expect![[r#"
kw fn
kw const
kw type
kw unsafe
"#]],
);
} | rust_cleaned_test_functions.jsonl/126831 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
1243,
78491,
7844,
368,
341,
286,
1779,
1006,
310,
435,
1,
29432,
3017,
314,
82639,
29,
335,
756,
310,
1720,
0,
15505,
81,
2,
698,
394,
29525,
5168,
198,
394,
29525,
733,
198,
394,
2952... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_dead_fork_invalid_slot_tick_count() {
solana_logger::setup();
// Too many ticks per slot
let res = check_dead_fork(|_keypair, bank| {
let blockhash = bank.last_blockhash();
let slot = bank.slot();
let hashes_per_tick = bank.hashes_per_tick().unwrap_or(0);
entries_to_test_shreds(
entry::create_ticks(bank.ticks_per_slot() + 1, hashes_per_tick, blockhash),
slot,
slot.saturating_sub(1),
false,
0,
)
});
if let Err(BlockstoreProcessorError::InvalidBlock(block_error)) = res {
assert_eq!(block_error, BlockError::TooManyTicks);
} else {
panic!();
}
// Too few ticks per slot
let res = check_dead_fork(|_keypair, bank| {
let blockhash = bank.last_blockhash();
let slot = bank.slot();
let hashes_per_tick = bank.hashes_per_tick().unwrap_or(0);
entries_to_test_shreds(
entry::create_ticks(bank.ticks_per_slot() - 1, hashes_per_tick, blockhash),
slot,
slot.saturating_sub(1),
true,
0,
)
});
if let Err(BlockstoreProcessorError::InvalidBlock(block_error)) = res {
assert_eq!(block_error, BlockError::TooFewTicks);
} else {
panic!();
}
} | rust_cleaned_test_functions.jsonl/11049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 801
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53427,
761,
669,
31433,
27563,
43612,
3180,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
442,
24599,
1657,
29957,
817,
9446,
198,
286,
1077,
592,
284,
1779,
53427,
761,
669,
22428,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inline_into_loops() {
test(
"var x = true; while (true) alert(x);",
"var x; while (true) alert(true);",
);
test(
"var x = true; while (true) for (var i in {}) alert(x);",
"var x; while (true) for (var i in {}) alert(true);",
);
test_same("var x = [true]; while (true) alert(x);");
} | rust_cleaned_test_functions.jsonl/27643 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
45514,
5560,
3721,
368,
341,
262,
1273,
1006,
286,
330,
947,
856,
284,
830,
26,
1393,
320,
1866,
8,
5115,
2075,
1215,
756,
286,
330,
947,
856,
26,
1393,
320,
1866,
8,
5115,
3715,
1215,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_decls() {
let res = parse_module(Span::new("x=1\ny=2"));
assert!(res.is_ok());
let (_, vs) = res.unwrap();
if let Decl::Equation(eq) = vs.get(0).unwrap() {
assert_eq!(eq.name, "x");
assert_eq!(eq.expr.expr, Expr::Literal(Literal::Int64(1)));
}
if let Decl::Equation(eq) = vs.get(1).unwrap() {
assert_eq!(eq.name, "y");
assert_eq!(eq.expr.expr, Expr::Literal(Literal::Int64(2)));
}
} | rust_cleaned_test_functions.jsonl/32926 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
2259,
18074,
368,
341,
262,
1077,
592,
284,
4715,
10750,
3759,
848,
486,
931,
445,
87,
28,
16,
1699,
88,
28,
17,
14929,
262,
2060,
10297,
416,
2079,
19817,
5231,
262,
1077,
39464,
6165,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bisect_when_key_does_not_exist() {
let mut level = Level::new();
level.insert(1, 1);
level.insert(0, 0);
level.insert(3, 3);
level.insert(2, 2);
level.insert(2, 2);
level.insert(5, 5);
// test value doesn't exist
let maybe_marker = level.bisect(&4);
assert!(maybe_marker.is_some());
assert_eq!(maybe_marker.as_ref().unwrap().borrow().key, 3);
let maybe_end = level.bisect(&5);
assert!(maybe_end.is_some());
assert!(maybe_end.as_ref().unwrap().borrow().right.is_none());
} | rust_cleaned_test_functions.jsonl/65962 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
285,
439,
47636,
3097,
96374,
7913,
35906,
368,
341,
286,
1077,
5206,
2188,
284,
9395,
486,
931,
543,
286,
2188,
7030,
7,
16,
11,
220,
16,
317,
286,
2188,
7030,
7,
15,
11,
220,
15,
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_merge_batches() {
new_ucmd!()
.args(&["ext_sort.txt", "-n", "-S", "150B"])
.succeeds()
.stdout_only_fixture("ext_sort.expected");
} | rust_cleaned_test_functions.jsonl/131628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
57755,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
427,
18435,
3909,
497,
6523,
77,
497,
6523,
50,
497,
330,
16,
20,
15,
33,
14108,
286,
659,
82,
29264,
82,
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 |
#[test]
fn test_parse_threat_vuln() {
let log = "Feb 8 09:05:49 pa-fw1 1,2021/02/08 09:05:48,0123456789,THREAT,vulnerability,1,2021/02/08 09:05:48,100.10.20.34,200.10.20.65,100.10.20.34,200.10.20.65,ssl vpn access,,,web-browsing,vsys1,untrust,untrust,ethernet1/1,ethernet1/1,InnoTec Log Collector,2021/02/08 09:05:48,104063,1,36026,443,36026,20077,0x1502000,tcp,reset-both,\"diag_Form\",GPON Home Routers Remote Code Execution Vulnerability(37264),any,critical,client-to-server,1607660,0x8000000000000000,Spain,Spain,0,,0,,,1,,,,,,,,0,0,0,0,0,,pa-fw1,,,,,0,,0,,N/A,code-execution,AppThreat-8371-6531,0x2";
let log = SiemLog::new(log.to_string(), 0, SiemIp::V4(0));
let siem_log = parse_log(log);
match siem_log {
Ok(log) => {
assert_eq!(log.service(), "THREAT");
assert_eq!(
log.field("observer.id"),
Some(&SiemField::from_str("0123456789"))
);
assert_eq!(
log.field("source.ip"),
Some(&SiemField::IP(SiemIp::from_ip_str("100.10.20.34").unwrap()))
);
assert_eq!(
log.field("destination.ip"),
Some(&SiemField::IP(SiemIp::from_ip_str("200.10.20.65").unwrap()))
);
assert_eq!(
log.field("rule.id"),
Some(&SiemField::U32(37264))
);
assert_eq!(
log.field("source.port"),
Some(&SiemField::U32(36026))
);
assert_eq!(
log.field("destination.port"),
Some(&SiemField::U32(443))
);
assert_eq!(
log.field("rule.name"),
Some(&SiemField::from_str("GPON Home Routers Remote Code Execution Vulnerability"))
);
assert_eq!(
log.field("network.direction"),
Some(&SiemField::from_str("client-to-server"))
);
assert_eq!(
log.field("event.outcome"),
Some(&SiemField::from_str("BLOCKED"))
);
assert_eq!(
log.field("trace.id"),
Some(&SiemField::from_str("104063"))
);
assert_eq!(
log.field(field_dictionary::IN_INTERFACE),
Some(&SiemField::from_str("ethernet1/1"))
);
assert_eq!(
log.field(field_dictionary::OUT_INTERFACE),
Some(&SiemField::from_str("ethernet1/1"))
);
}
Err(_) => assert_eq!(1, 0),
}
} | rust_cleaned_test_functions.jsonl/87489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1725
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5854,
1222,
2273,
360,
77,
368,
341,
286,
1077,
1487,
284,
330,
40591,
220,
220,
23,
220,
15,
24,
25,
15,
20,
25,
19,
24,
7106,
39239,
16,
220,
16,
11,
17,
15,
17,
16,
14,
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... | 2 |
#[test]
fn test_client_request_encode_title_case() {
use crate::proto::BodyLength;
use http::header::HeaderValue;
let mut head = MessageHead::default();
head.headers
.insert("content-length", HeaderValue::from_static("10"));
head.headers
.insert("content-type", HeaderValue::from_static("application/json"));
head.headers.insert("*-*", HeaderValue::from_static("o_o"));
let mut vec = Vec::new();
Client::encode(
Encode {
head: &mut head,
body: Some(BodyLength::Known(10)),
keep_alive: true,
req_method: &mut None,
title_case_headers: true,
},
&mut vec,
)
.unwrap();
assert_eq!(vec, b"GET / HTTP/1.1\r\nContent-Length: 10\r\nContent-Type: application/json\r\n*-*: o_o\r\n\r\n".to_vec());
} | rust_cleaned_test_functions.jsonl/7667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
7893,
11224,
6112,
19096,
368,
341,
286,
990,
17717,
486,
15110,
486,
5444,
4373,
280,
286,
990,
1758,
486,
2708,
486,
97721,
401,
286,
1077,
5206,
1968,
284,
4856,
12346,
486,
2258,
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_footer() {
let f = Footer::new(BlockHandle::new(44, 4), BlockHandle::new(55, 5));
let mut buf = [0; 48];
f.encode(&mut buf[..]);
let f2 = Footer::decode(&buf);
assert_eq!(f2.meta_index.offset(), 44);
assert_eq!(f2.meta_index.size(), 4);
assert_eq!(f2.index.offset(), 55);
assert_eq!(f2.index.size(), 5);
} | rust_cleaned_test_functions.jsonl/107471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25966,
368,
341,
286,
1077,
282,
284,
26477,
486,
931,
55243,
6999,
486,
931,
7,
19,
19,
11,
220,
19,
701,
8362,
6999,
486,
931,
7,
20,
20,
11,
220,
20,
1106,
286,
1077,
5206,
6607,
284,
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_read_current_channel_rejects_invalid_json() {
let dir = tempfile::tempdir().unwrap();
fs::write(dir.path().join("current_channel.json"), "no channel here").unwrap();
assert_matches!(read_current_channel(dir.path()), Err(Error::Json(_)));
} | rust_cleaned_test_functions.jsonl/110842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
11080,
14571,
1288,
583,
82,
31433,
9455,
368,
341,
286,
1077,
5419,
284,
54819,
486,
3888,
3741,
1005,
15454,
1428,
286,
8619,
486,
4934,
14161,
3875,
1005,
5987,
445,
3231,
14571,
4323,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_platform_devices() {
let platform_ids = get_platform_ids().unwrap();
assert!(0 < platform_ids.len());
let device_ids = get_device_ids(platform_ids[0], CL_DEVICE_TYPE_ALL).unwrap();
println!("Platform[0]->number of devices: {}", device_ids.len());
assert!(0 < device_ids.len());
} | rust_cleaned_test_functions.jsonl/32016 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
34260,
41334,
368,
341,
286,
1077,
5339,
8077,
284,
633,
34260,
8077,
1005,
15454,
543,
286,
2060,
10297,
15,
366,
5339,
8077,
19406,
5231,
286,
1077,
3671,
8077,
284,
633,
9204,
8077,
75800... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_comments_string_escapes_single() {
let example: Vec<char> = "test\"// test \"\ntest".to_string().chars().collect();
let result = remove_comments(&example);
let without_comments = chars_to_string(&result.without_comments);
assert_eq!("test\"// test \"\ntest", without_comments);
assert_eq!(0, result.comments.len());
} | rust_cleaned_test_functions.jsonl/126900 | {
"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,
18193,
30359,
3904,
92196,
9337,
19487,
368,
341,
286,
1077,
3110,
25,
11312,
21919,
29,
284,
330,
1944,
2105,
322,
1273,
7245,
59,
406,
477,
3263,
983,
3904,
1005,
19255,
1005,
17384,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_underline() {
let c = Underline::new("single");
let b = c.build();
assert_eq!(str::from_utf8(&b).unwrap(), r#"<w:u w:val="single" />"#);
} | rust_cleaned_test_functions.jsonl/72780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58228,
1056,
368,
341,
286,
1077,
272,
284,
9449,
1056,
486,
931,
445,
15338,
797,
286,
1077,
293,
284,
272,
13239,
543,
286,
2060,
10714,
10297,
495,
486,
1499,
39453,
23,
2099,
65,
568,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_validate_packet() {
// Successful validation
assert!(validate_packet(
&[PacketType::ParameterValue as u8, 0x00],
2,
PacketType::ParameterValue
)
.is_ok());
// Bad PacketType
assert_matches!(
validate_packet(
&[0xff, 0x00], 2, PacketType::ParameterValue),
Err(Error::UnknownEnumValue {
primitive: 0xff,
enum_name
}) if enum_name.contains("PacketType")
);
// Wrong packet length
assert_eq!(
validate_packet(
&[PacketType::ParameterValue as u8, 0x00],
3,
PacketType::ParameterValue
),
Err(Error::ShortData { required: 3, received: 2 })
);
// Wrong PacketType
assert_eq!(
validate_packet(&[PacketType::ReportFormat as u8, 0x00], 2, PacketType::ParameterValue),
Err(Error::WrongPacketType {
expected: PacketType::ParameterValue,
received: PacketType::ReportFormat
})
);
} | rust_cleaned_test_functions.jsonl/33410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 633
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
21078,
368,
341,
286,
442,
45526,
10519,
198,
286,
2060,
10297,
7067,
21078,
1006,
310,
44590,
16679,
929,
486,
89432,
438,
575,
23,
11,
220,
15,
87,
15,
15,
1259,
310,
220,
17,
345,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_pop_psw() {
let mut state = State8080::empty_state();
state.memory = vec![0xf1, 0xc3, 0xff];
state.sp = 0x01;
state.a = 0x00;
state.cc.cy = 0x00;
state.cc.p = Parity::Even;
state.cc.ac = 0x00;
state.cc.z = 0x00;
state.cc.s = Sign::Positive;
emulate_8080_op(&mut state);
assert_eq!(state.a, 0xff);
assert_eq!(state.cc.cy, 0x01);
assert_eq!(state.cc.p, Parity::Odd);
assert_eq!(state.cc.ac, 0x00);
assert_eq!(state.cc.z, 0x01);
assert_eq!(state.cc.s, Sign::Negative);
assert_eq!(state.sp, 0x03);
} | rust_cleaned_test_functions.jsonl/7773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
620,
2280,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
5848,
16,
11,
220,
15,
8148,
18,
11,
220,
15,
9020... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_ban() {
let route = Route::DeleteBan {
guild_id: GUILD_ID,
user_id: USER_ID,
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/bans/{user_id}",
guild_id = GUILD_ID,
user_id = USER_ID
)
);
} | rust_cleaned_test_functions.jsonl/119879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
880,
276,
368,
341,
286,
1077,
6021,
284,
9572,
486,
6435,
50241,
341,
310,
26411,
842,
25,
479,
18023,
3450,
345,
310,
1196,
842,
25,
13872,
3450,
345,
286,
2605,
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... | 1 |
#[test]
fn test_add_hashes_last_3() {
let mut rng = CustomRng;
let mut tree = MerkleTree::new(create(3), POOL_PARAMS.clone());
let max_index = (1 << constants::HEIGHT) - 1;
let hashes: Vec<_> = (max_index - 2..=max_index)
.map(|n| (n, rng.gen(), false))
.collect();
tree.add_hashes(hashes.clone());
let nodes = tree.get_all_nodes();
assert_eq!(nodes.len(), constants::HEIGHT + 4);
for h in 0..constants::HEIGHT as u32 {
let index = max_index / 2u64.pow(h);
assert!(tree.get_opt(h, index).is_some()); // TODO: Compare with expected hash
}
for (i, tuple) in hashes.iter().enumerate() {
assert_eq!(tree.get(0, tuple.0), hashes[i].1);
}
} | rust_cleaned_test_functions.jsonl/23748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
91616,
12195,
62,
18,
368,
341,
286,
1077,
5206,
28422,
284,
8406,
49,
968,
280,
286,
1077,
5206,
4916,
284,
8755,
23089,
6533,
486,
931,
32602,
7,
18,
701,
12932,
1930,
37488,
15997,
5231... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_was_set() {
let config = Config::from_toml("hard_tabs = true", Path::new("")).unwrap();
assert_eq!(config.was_set().hard_tabs(), true);
assert_eq!(config.was_set().verbose(), false);
} | rust_cleaned_test_functions.jsonl/62920 | {
"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,
91612,
2602,
368,
341,
286,
1077,
2193,
284,
5532,
486,
1499,
528,
316,
75,
445,
18703,
57953,
284,
830,
497,
7933,
486,
931,
445,
15197,
15454,
1428,
286,
2060,
10714,
10297,
1676,
1418,
300,
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 |
#[test]
fn test_timestamp_seconds_systemtime() {
let zero = SystemTime::UNIX_EPOCH;
let one_second = SystemTime::UNIX_EPOCH
.checked_add(Duration::new(1, 0))
.unwrap();
let half_second = SystemTime::UNIX_EPOCH
.checked_add(Duration::new(0, 500_000_000))
.unwrap();
let minus_one_second = SystemTime::UNIX_EPOCH
.checked_sub(Duration::new(1, 0))
.unwrap();
let minus_half_second = SystemTime::UNIX_EPOCH
.checked_sub(Duration::new(0, 500_000_000))
.unwrap();
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructIntStrict(#[serde_as(as = "TimestampSeconds")] SystemTime);
is_equal(StructIntStrict(zero), expect![[r#"0"#]]);
is_equal(StructIntStrict(one_second), expect![[r#"1"#]]);
is_equal(StructIntStrict(minus_one_second), expect![[r#"-1"#]]);
check_serialization(StructIntStrict(half_second), expect![[r#"1"#]]);
check_serialization(StructIntStrict(minus_half_second), expect![[r#"-1"#]]);
check_error_deserialization::<StructIntStrict>(
r#""1""#,
expect![[r#"invalid type: string "1", expected i64 at line 1 column 3"#]],
);
check_error_deserialization::<StructIntStrict>(
r#"0.123"#,
expect![[r#"invalid type: floating point `0.123`, expected i64 at line 1 column 5"#]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructIntFlexible(#[serde_as(as = "TimestampSeconds<i64, Flexible>")] SystemTime);
is_equal(StructIntFlexible(zero), expect![[r#"0"#]]);
is_equal(StructIntFlexible(one_second), expect![[r#"1"#]]);
is_equal(StructIntFlexible(minus_one_second), expect![[r#"-1"#]]);
check_serialization(StructIntFlexible(half_second), expect![[r#"1"#]]);
check_serialization(StructIntFlexible(minus_half_second), expect![[r#"-1"#]]);
check_deserialization(StructIntFlexible(one_second), r#""1""#);
check_deserialization(StructIntFlexible(one_second), r#"1.0"#);
check_deserialization(StructIntFlexible(minus_half_second), r#""-0.5""#);
check_deserialization(StructIntFlexible(half_second), r#"0.5"#);
check_error_deserialization::<StructIntFlexible>(
r#""a""#,
expect![[
r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 3"#
]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Structf64Strict(#[serde_as(as = "TimestampSeconds<f64>")] SystemTime);
is_equal(Structf64Strict(zero), expect![[r#"0.0"#]]);
is_equal(Structf64Strict(one_second), expect![[r#"1.0"#]]);
is_equal(Structf64Strict(minus_one_second), expect![[r#"-1.0"#]]);
check_serialization(Structf64Strict(half_second), expect![[r#"1.0"#]]);
check_serialization(Structf64Strict(minus_half_second), expect![[r#"-1.0"#]]);
check_deserialization(Structf64Strict(one_second), r#"0.5"#);
check_error_deserialization::<Structf64Strict>(
r#""1""#,
expect![[r#"invalid type: string "1", expected f64 at line 1 column 3"#]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Structf64Flexible(#[serde_as(as = "TimestampSeconds<f64, Flexible>")] SystemTime);
is_equal(Structf64Flexible(zero), expect![[r#"0.0"#]]);
is_equal(Structf64Flexible(one_second), expect![[r#"1.0"#]]);
is_equal(Structf64Flexible(minus_one_second), expect![[r#"-1.0"#]]);
check_serialization(Structf64Flexible(half_second), expect![[r#"1.0"#]]);
check_serialization(Structf64Flexible(minus_half_second), expect![[r#"-1.0"#]]);
check_deserialization(Structf64Flexible(one_second), r#""1""#);
check_deserialization(Structf64Flexible(one_second), r#"1.0"#);
check_deserialization(Structf64Flexible(minus_half_second), r#""-0.5""#);
check_deserialization(Structf64Flexible(half_second), r#"0.5"#);
check_error_deserialization::<Structf64Flexible>(
r#""a""#,
expect![[
r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 3"#
]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructStringStrict(#[serde_as(as = "TimestampSeconds<String>")] SystemTime);
is_equal(StructStringStrict(zero), expect![[r#""0""#]]);
is_equal(StructStringStrict(one_second), expect![[r#""1""#]]);
is_equal(StructStringStrict(minus_one_second), expect![[r#""-1""#]]);
check_serialization(StructStringStrict(half_second), expect![[r#""1""#]]);
check_serialization(StructStringStrict(minus_half_second), expect![[r#""-1""#]]);
check_deserialization(StructStringStrict(one_second), r#""1""#);
check_error_deserialization::<StructStringStrict>(
r#""0.5""#,
expect![[r#"invalid digit found in string at line 1 column 5"#]],
);
check_error_deserialization::<StructStringStrict>(
r#""-0.5""#,
expect![[r#"invalid digit found in string at line 1 column 6"#]],
);
check_error_deserialization::<StructStringStrict>(
r#"1"#,
expect![[
r#"invalid type: integer `1`, expected a string containing a number at line 1 column 1"#
]],
);
check_error_deserialization::<StructStringStrict>(
r#"0.0"#,
expect![[
r#"invalid type: floating point `0`, expected a string containing a number at line 1 column 3"#
]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructStringFlexible(#[serde_as(as = "TimestampSeconds<String, Flexible>")] SystemTime);
is_equal(StructStringFlexible(zero), expect![[r#""0""#]]);
is_equal(StructStringFlexible(one_second), expect![[r#""1""#]]);
is_equal(StructStringFlexible(minus_one_second), expect![[r#""-1""#]]);
check_serialization(StructStringFlexible(half_second), expect![[r#""1""#]]);
check_serialization(
StructStringFlexible(minus_half_second),
expect![[r#""-1""#]],
);
check_deserialization(StructStringFlexible(one_second), r#"1"#);
check_deserialization(StructStringFlexible(one_second), r#"1.0"#);
check_deserialization(StructStringFlexible(minus_half_second), r#""-0.5""#);
check_deserialization(StructStringFlexible(half_second), r#"0.5"#);
check_error_deserialization::<StructStringFlexible>(
r#""a""#,
expect![[
r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 3"#
]],
);
} | rust_cleaned_test_functions.jsonl/105402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2870
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
34825,
17687,
1678,
368,
341,
262,
1077,
7168,
284,
739,
1462,
486,
99089,
2089,
69945,
280,
262,
1077,
825,
29644,
284,
739,
1462,
486,
99089,
2089,
69945,
198,
286,
659,
7549,
2891,
64114... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index() -> Result<()> {
let data_directory = tempdir().unwrap();
let index = Index::at(data_directory.path()).unwrap();
let namespace_name = "some_namespace".parse().unwrap();
let collection_name = "some_collection".parse().unwrap();
index.create_ns(&namespace_name)?;
{
let mut namespace_ = index.borrow_mut(&namespace_name)?;
println!("{:?}", namespace_.clone());
namespace_.create_collection(
&collection_name,
&json!({
"a_field": 5
}),
)?;
println!("{:?}", namespace_.clone());
namespace_.commit()?;
}
{
let namespace_ = index.borrow(&namespace_name)?;
namespace_.get_collection(&collection_name)?;
println!("{:?}", namespace);
}
index.delete_ns(&namespace_name)?;
assert!(index.borrow(&namespace_name).is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/44409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
368,
1464,
5714,
71698,
341,
286,
1077,
821,
14846,
284,
2730,
3741,
1005,
15454,
1428,
286,
1077,
1922,
284,
8008,
486,
266,
2592,
14846,
3875,
6011,
15454,
543,
286,
1077,
4473,
1269,
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... | 8 |
#[test]
fn test_parse_trait_with_code() {
let _ = env_logger::try_init();
let mut conv_map = parse(
SourceId::none(),
r#"
#[allow(dead_code)]
#[swig_code = "let {to_var}: {to_var_type} = {from_var}.swig_into(env);"]
trait SwigInto<T> {
fn swig_into(self, env: *mut JNIEnv) -> T;
}
impl SwigInto<bool> for jboolean {
fn swig_into(self, _: *mut JNIEnv) -> bool {
self != 0
}
}
#[allow(dead_code)]
#[swig_code = "let {to_var}: {to_var_type} = <{to_var_type}>::swig_from({from_var}, env);"]
trait SwigFrom<T> {
fn swig_from(T, env: *mut JNIEnv) -> Self;
}
impl SwigFrom<bool> for jboolean {
fn swig_from(x: bool, _: *mut JNIEnv) -> Self {
if x {
1 as jboolean
} else {
0 as jboolean
}
}
}
"#,
64,
FxHashMap::default(),
)
.unwrap();
let jboolean_ty =
conv_map.find_or_alloc_rust_type(&parse_type! { jboolean }, SourceId::none());
let bool_ty = conv_map.find_or_alloc_rust_type(&parse_type! { bool }, SourceId::none());
let (_, code) = conv_map
.convert_rust_types(
jboolean_ty.to_idx(),
bool_ty.to_idx(),
"a0",
"a1",
"jlong",
invalid_src_id_span(),
)
.unwrap();
assert_eq!(" let a1: bool = a0.swig_into(env);\n".to_string(), code);
let (_, code) = conv_map
.convert_rust_types(
bool_ty.to_idx(),
jboolean_ty.to_idx(),
"a0",
"a1",
"jlong",
invalid_src_id_span(),
)
.unwrap();
assert_eq!(
" let a1: jboolean = <jboolean>::swig_from(a0, env);\n".to_string(),
code
);
} | rust_cleaned_test_functions.jsonl/18734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
78491,
6615,
4136,
368,
341,
286,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
543,
286,
1077,
5206,
5686,
5376,
284,
4715,
1006,
310,
8748,
764,
486,
6697,
3148,
310,
435,
2,
698,
13353... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_swap_with_fee_constraints() {
let owner_key = Pubkey::new_unique();
let trade_fee_numerator = 1;
let trade_fee_denominator = 10;
let owner_trade_fee_numerator = 1;
let owner_trade_fee_denominator = 30;
let owner_withdraw_fee_numerator = 1;
let owner_withdraw_fee_denominator = 30;
let host_fee_numerator = 10;
let host_fee_denominator = 100;
let token_a_amount = 1_000_000;
let token_b_amount = 5_000_000;
let fees = Fees {
trade_fee_numerator,
trade_fee_denominator,
owner_trade_fee_numerator,
owner_trade_fee_denominator,
owner_withdraw_fee_numerator,
owner_withdraw_fee_denominator,
host_fee_numerator,
host_fee_denominator,
};
let curve = ConstantProductCurve {};
let swap_curve = SwapCurve {
curve_type: CurveType::ConstantProduct,
calculator: Box::new(curve),
};
let owner_key_str = &owner_key.to_string();
let valid_curve_types = &[CurveType::ConstantProduct];
let constraints = Some(SwapConstraints {
owner_key: owner_key_str,
valid_curve_types,
fees: &fees,
});
let mut accounts = SwapAccountInfo::new(
&owner_key,
fees.clone(),
swap_curve,
token_a_amount,
token_b_amount,
);
// initialize swap
do_process_instruction_with_fee_constraints(
initialize(
&SWAP_PROGRAM_ID,
&spl_token::id(),
&accounts.swap_key,
&accounts.authority_key,
&accounts.token_a_key,
&accounts.token_b_key,
&accounts.pool_mint_key,
&accounts.pool_fee_key,
&accounts.pool_token_key,
accounts.fees.clone(),
accounts.swap_curve.clone(),
)
.unwrap(),
vec![
&mut accounts.swap_account,
&mut Account::default(),
&mut accounts.token_a_account,
&mut accounts.token_b_account,
&mut accounts.pool_mint_account,
&mut accounts.pool_fee_account,
&mut accounts.pool_token_account,
&mut Account::default(),
],
&constraints,
)
.unwrap();
let authority_key = accounts.authority_key;
let (
token_a_key,
mut token_a_account,
token_b_key,
mut token_b_account,
pool_key,
mut pool_account,
) = accounts.setup_token_accounts(
&owner_key,
&authority_key,
token_a_amount,
token_b_amount,
0,
);
let amount_in = token_a_amount / 2;
let minimum_amount_out = 0;
// perform the swap
do_process_instruction_with_fee_constraints(
swap(
&SWAP_PROGRAM_ID,
&spl_token::id(),
&accounts.swap_key,
&accounts.authority_key,
&accounts.authority_key,
&token_a_key,
&accounts.token_a_key,
&accounts.token_b_key,
&token_b_key,
&accounts.pool_mint_key,
&accounts.pool_fee_key,
Some(&pool_key),
Swap {
amount_in,
minimum_amount_out,
},
)
.unwrap(),
vec![
&mut accounts.swap_account,
&mut Account::default(),
&mut Account::default(),
&mut token_a_account,
&mut accounts.token_a_account,
&mut accounts.token_b_account,
&mut token_b_account,
&mut accounts.pool_mint_account,
&mut accounts.pool_fee_account,
&mut Account::default(),
&mut pool_account,
],
&constraints,
)
.unwrap();
// check that fees were taken in the host fee account
let host_fee_account = spl_token::state::Account::unpack(&pool_account.data).unwrap();
let owner_fee_account =
spl_token::state::Account::unpack(&accounts.pool_fee_account.data).unwrap();
let total_fee = owner_fee_account.amount * host_fee_denominator
/ (host_fee_denominator - host_fee_numerator);
assert_eq!(
total_fee,
host_fee_account.amount + owner_fee_account.amount
);
} | rust_cleaned_test_functions.jsonl/14317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2714
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
40991,
6615,
34305,
60267,
368,
341,
286,
1077,
6372,
3097,
284,
22611,
792,
486,
931,
21218,
1428,
286,
1077,
6559,
34305,
1089,
60969,
284,
220,
16,
280,
286,
1077,
6559,
34305,
49522,
302... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transpose() {
let xs = vec![1, 2, 3, 4, 5];
let expected_c1 = vec![Some(1), Some(2), Some(3), Some(4), Some(5)];
let expected_c2 = vec![Some(1), Some(4), Some(2), Some(5), Some(3), None];
let expected_c3 = vec![Some(1), Some(3), Some(5), Some(2), Some(4), None];
let expected_c4 = vec![Some(1), Some(3), Some(5), None, Some(2), Some(4), None, None];
assert_eq!(expected_c1, transpose(&xs, 1));
assert_eq!(expected_c2, transpose(&xs, 2));
assert_eq!(expected_c3, transpose(&xs, 3));
assert_eq!(expected_c4, transpose(&xs, 4));
} | rust_cleaned_test_functions.jsonl/97285 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
2900,
368,
341,
286,
1077,
11943,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
1077,
3601,
666,
16,
284,
7486,
20703,
8373,
7,
16,
701,
4329,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.