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_create_label() {
let mut cs = TestConstraintSystem::<Bls12>::new();
let rng = &mut XorShiftRng::from_seed(crate::TEST_SEED);
let size = 64;
let porep_id = [32; 32];
let graph = StackedBucketGraph::<Sha256Hasher>::new_stacked(
size,
BASE_DEGREE,
EXP_DEGREE,
porep_id,
)
.unwrap();
let id_fr = Fr::random(rng);
let id: Vec<u8> = fr_into_bytes(&id_fr);
let layer = 3;
let node = 22;
let mut data: Vec<u8> = (0..2 * size)
.flat_map(|_| fr_into_bytes(&Fr::random(rng)))
.collect();
let mut parents = vec![0; BASE_DEGREE + EXP_DEGREE];
graph.parents(node, &mut parents).unwrap();
let raw_parents_bytes: Vec<Vec<u8>> = parents
.iter()
.enumerate()
.map(|(i, p)| {
if i < BASE_DEGREE {
// base
data_at_node(&data[..size * NODE_SIZE], *p as usize)
.unwrap()
.to_vec()
} else {
// exp
data_at_node(&data[size * NODE_SIZE..], *p as usize)
.unwrap()
.to_vec()
}
})
.collect();
let mut parents_bytes = raw_parents_bytes.clone();
parents_bytes.extend_from_slice(&raw_parents_bytes);
parents_bytes.extend_from_slice(&raw_parents_bytes[..9]);
assert_eq!(parents_bytes.len(), TOTAL_PARENTS);
let parents_bits: Vec<Vec<Boolean>> = parents_bytes
.iter()
.enumerate()
.map(|(i, p)| {
let mut cs = cs.namespace(|| format!("parents {}", i));
bytes_into_boolean_vec_be(&mut cs, Some(p), p.len()).unwrap()
})
.collect();
let id_bits: Vec<Boolean> = {
let mut cs = cs.namespace(|| "id");
bytes_into_boolean_vec_be(&mut cs, Some(id.as_slice()), id.len()).unwrap()
};
let layer_alloc = uint32::UInt32::constant(layer as u32);
let node_alloc = uint64::UInt64::constant(node as u64);
let out = create_label_circuit(
cs.namespace(|| "create_label"),
&id_bits,
parents_bits,
layer_alloc,
node_alloc,
)
.expect("key derivation function failed");
assert!(cs.is_satisfied(), "constraints not satisfied");
assert_eq!(cs.num_constraints(), 1_342_661);
let (l1, l2) = data.split_at_mut(size * NODE_SIZE);
create_label_exp(&graph, None, &id_fr.into(), &*l2, l1, layer, node).unwrap();
let expected_raw = data_at_node(&l1, node).unwrap();
let expected = bytes_into_fr(expected_raw).unwrap();
assert_eq!(
expected,
out.get_value().unwrap(),
"circuit and non circuit do not match"
);
} | rust_cleaned_test_functions.jsonl/51320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1667
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
6106,
368,
341,
286,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
33,
4730,
16,
17,
6831,
931,
543,
286,
1077,
28422,
284,
609,
6984,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
5490... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse() {
macro_rules! assert_pns_eq_sub {
($in_:expr, $kind:ident($arg:expr, $pos:expr)) => {
assert_eq!(pns(concat!($in_, "!")), Some((S::$kind($arg.into(), $pos), "!")))
};
}
assert_pns_eq_sub!("$0", Ordinal(0, (0, 2)));
assert_pns_eq_sub!("$1", Ordinal(1, (0, 2)));
assert_pns_eq_sub!("$9", Ordinal(9, (0, 2)));
assert_pns_eq_sub!("$N", Name("N", (0, 2)));
assert_pns_eq_sub!("$NAME", Name("NAME", (0, 5)));
} | rust_cleaned_test_functions.jsonl/88184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
310,
18072,
21407,
0,
2060,
620,
4412,
10714,
5228,
341,
394,
1711,
258,
23211,
9413,
11,
400,
15314,
25,
1713,
699,
858,
96011,
11,
400,
966,
96011,
593,
589,
341,
503,
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_path_from_parser() {
let hex = hex::decode(TEST_PATH_BUFFER).expect("");
let mut parser = BinaryParser::from(hex.clone());
let pathset = Path::from_parser(&mut parser, None).unwrap();
assert_eq!(pathset.as_ref(), hex);
} | rust_cleaned_test_functions.jsonl/77242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
5673,
18517,
368,
341,
286,
1077,
12371,
284,
12371,
486,
18196,
50320,
7944,
14394,
568,
17119,
13056,
286,
1077,
5206,
6729,
284,
17718,
6570,
486,
1499,
44660,
15997,
1423,
286,
1077,
1815,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tag_attribute_iterator() {
let html_attribute = TagAttribute::HtmlAttribute(HtmlAttribute {
name: "class".to_string(),
value: Some("main".to_string()),
});
let nested_html_attribute = TagAttribute::HtmlAttribute(HtmlAttribute {
name: "style".to_string(),
value: Some("display: block".to_string()),
});
let second_nested_html_attribute = TagAttribute::HtmlAttribute(HtmlAttribute {
name: "disabled".to_string(),
value: None,
});
let twig_syntax_attribute = TagAttribute::TwigStructure(TwigStructure::TwigIf(TwigIf {
if_arms: vec![TwigIfArm {
expression: Some("isDisabled".to_string()),
children: vec![
nested_html_attribute.clone(),
second_nested_html_attribute.clone(),
],
}],
}));
let comment_attribute = TagAttribute::TwigComment(TwigComment {
content: "TODO".to_string(),
});
let tag = Tag {
name: "div".to_string(),
self_closed: false,
attributes: vec![
html_attribute.clone(),
twig_syntax_attribute.clone(),
comment_attribute.clone(),
],
children: vec![],
};
let syntax_node = SyntaxNode::Tag(tag.clone());
let mut attr_iter = syntax_node.attribute_iter();
assert_eq!(attr_iter, tag.attribute_iter()); // these iterators should be the same
assert_eq!(attr_iter.next(), Some(&html_attribute));
assert_eq!(attr_iter.next(), Some(&twig_syntax_attribute));
assert_eq!(attr_iter.next(), Some(&nested_html_attribute));
assert_eq!(attr_iter.next(), Some(&second_nested_html_attribute));
assert_eq!(attr_iter.next(), Some(&comment_attribute));
assert_eq!(attr_iter.next(), None);
} | rust_cleaned_test_functions.jsonl/62788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 941
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9372,
16791,
13491,
368,
341,
286,
1077,
5272,
16791,
284,
12353,
3907,
486,
13591,
3907,
94620,
3907,
341,
310,
829,
25,
330,
1040,
3263,
983,
3904,
3148,
310,
897,
25,
4329,
445,
3817,
3263,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_substitute_param_no_qualify() {
check_assist(
add_missing_impl_members,
"
mod foo {
trait Foo<T> { fn foo(&self, bar: T); }
pub struct Param;
}
struct Param;
struct S;
impl foo::Foo<Param> for S { <|> }",
"
mod foo {
trait Foo<T> { fn foo(&self, bar: T); }
pub struct Param;
}
struct Param;
struct S;
impl foo::Foo<Param> for S {
<|>fn foo(&self, bar: Param) { unimplemented!() }
}",
);
} | rust_cleaned_test_functions.jsonl/106819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
7660,
4090,
6536,
64391,
1437,
368,
341,
1789,
286,
1779,
12083,
380,
1006,
310,
912,
40447,
21007,
30397,
345,
310,
6228,
2593,
15229,
341,
262,
17567,
33428,
3125,
29,
314,
5168,
15229,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mut() {
let mut e: Element = Element::parse(File::open("tests/data/rw.xml").unwrap()).unwrap();
{
let name = e.get_mut_child("name").unwrap();
name.attributes.insert("suffix".to_owned(), "mr".to_owned());
}
} | rust_cleaned_test_functions.jsonl/15712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
368,
1476,
262,
1077,
5206,
384,
25,
8543,
284,
8543,
486,
6400,
19821,
486,
2508,
445,
23841,
13167,
7382,
86,
9028,
1827,
15454,
6011,
15454,
543,
262,
341,
286,
1077,
829,
284,
384,
67... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_txn_store_scan_key_only() {
let store = AssertionStorage::default();
store.put_ok(b"A", b"A", 5, 10);
store.put_ok(b"B", b"B", 5, 10);
store.put_ok(b"C", b"C", 5, 10);
store.scan_key_only_ok(b"AA", 2, 10, vec![Some(b"B"), Some(b"C")]);
} | rust_cleaned_test_functions.jsonl/63395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
28857,
3097,
18410,
368,
341,
262,
1077,
3553,
284,
46730,
5793,
486,
2258,
543,
262,
3553,
3597,
19817,
1883,
29133,
497,
293,
29133,
497,
220,
20,
11,
220,
16,
15,
317,
262,
3553... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_point() {
let mut subject = point!(x: 4760096.421921f64, y: 3744293.729449f64);
subject
.transform_crs_to_crs("EPSG:2230", "EPSG:26946")
.unwrap();
let expected = point!(x: 1450880.29f64, y: 1141263.01f64);
assert_relative_eq!(subject, expected, epsilon = 0.2);
} | rust_cleaned_test_functions.jsonl/35283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
368,
341,
286,
1077,
5206,
3832,
284,
1459,
10297,
87,
25,
220,
19,
22,
21,
15,
15,
24,
21,
13,
19,
17,
16,
24,
17,
16,
69,
21,
19,
11,
379,
25,
220,
18,
22,
19,
19,
17,
24,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_region_sibling() {
let r1 = metapb::Region::new();
check_sibling(&r1, &r1, false);
let (r1, r2) = split(r1, b"k1");
check_sibling(&r1, &r2, true);
let (r2, r3) = split(r2, b"k2");
check_sibling(&r2, &r3, true);
let (r3, r4) = split(r3, b"k3");
check_sibling(&r3, &r4, true);
check_sibling(&r1, &r2, true);
check_sibling(&r2, &r3, true);
check_sibling(&r1, &r3, false);
check_sibling(&r2, &r4, false);
check_sibling(&r1, &r4, false);
} | rust_cleaned_test_functions.jsonl/10732 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20627,
96328,
368,
341,
286,
1077,
435,
16,
284,
2270,
391,
65,
486,
14091,
486,
931,
543,
286,
1779,
96328,
2099,
81,
16,
11,
609,
81,
16,
11,
895,
626,
286,
1077,
320,
81,
16,
11,
435,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_row_display() {
// Primitive types
assert_eq!(format!("{}", Field::Null), "null");
assert_eq!(format!("{}", Field::Bool(true)), "true");
assert_eq!(format!("{}", Field::Bool(false)), "false");
assert_eq!(format!("{}", Field::Byte(1)), "1");
assert_eq!(format!("{}", Field::Short(2)), "2");
assert_eq!(format!("{}", Field::Int(3)), "3");
assert_eq!(format!("{}", Field::Long(4)), "4");
assert_eq!(format!("{}", Field::UByte(1)), "1");
assert_eq!(format!("{}", Field::UShort(2)), "2");
assert_eq!(format!("{}", Field::UInt(3)), "3");
assert_eq!(format!("{}", Field::ULong(4)), "4");
assert_eq!(format!("{}", Field::Float(5.0)), "5.0");
assert_eq!(format!("{}", Field::Float(5.1234)), "5.1234");
assert_eq!(format!("{}", Field::Double(6.0)), "6.0");
assert_eq!(format!("{}", Field::Double(6.1234)), "6.1234");
assert_eq!(format!("{}", Field::Str("abc".to_string())), "\"abc\"");
assert_eq!(
format!("{}", Field::Bytes(ByteArray::from(vec![1, 2, 3]))),
"[1, 2, 3]"
);
assert_eq!(
format!("{}", Field::Date(14611)),
convert_date_to_string(14611)
);
assert_eq!(
format!("{}", Field::Timestamp(1262391174000)),
convert_timestamp_to_string(1262391174000)
);
assert_eq!(
format!("{}", Field::Decimal(Decimal::from_i32(4, 8, 2))),
convert_decimal_to_string(&Decimal::from_i32(4, 8, 2))
);
// Complex types
let fields = vec![
("x".to_string(), Field::Null),
("Y".to_string(), Field::Int(2)),
("z".to_string(), Field::Float(3.1)),
("a".to_string(), Field::Str("abc".to_string())),
];
let row = Field::Group(make_row(fields));
assert_eq!(format!("{}", row), "{x: null, Y: 2, z: 3.1, a: \"abc\"}");
let row = Field::ListInternal(make_list(vec![
Field::Int(2),
Field::Int(1),
Field::Null,
Field::Int(12),
]));
assert_eq!(format!("{}", row), "[2, 1, null, 12]");
let row = Field::MapInternal(make_map(vec![
(Field::Int(1), Field::Float(1.2)),
(Field::Int(2), Field::Float(4.5)),
(Field::Int(3), Field::Float(2.3)),
]));
assert_eq!(format!("{}", row), "{1 -> 1.2, 2 -> 4.5, 3 -> 2.3}");
} | rust_cleaned_test_functions.jsonl/43807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1069
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
14825,
368,
341,
262,
442,
51460,
4494,
198,
262,
2060,
10714,
10297,
2243,
79878,
8601,
486,
3280,
701,
330,
2921,
797,
262,
2060,
10714,
10297,
2243,
79878,
8601,
486,
11233,
3715,
5731,
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_global_dispatcher_register_actor() {
let bastion_id = BastionId::new();
let (sender, _) = mpsc::unbounded();
let path = Arc::new(BastionPath::root());
let name = "test_name".to_string();
let child_ref = ChildRef::new(bastion_id, sender, name, path);
let dispatcher_type = DispatcherType::Named("test".to_string());
let local_dispatcher = Arc::new(Box::new(Dispatcher::with_type(dispatcher_type.clone())));
let actor_groups = vec![dispatcher_type];
let module_name = "my::test::module".to_string();
let global_dispatcher = GlobalDispatcher::new();
global_dispatcher
.register_dispatcher(&local_dispatcher)
.unwrap();
assert_eq!(local_dispatcher.actors.contains_key(&child_ref), false);
global_dispatcher
.register(&actor_groups, &child_ref, module_name)
.unwrap();
assert_eq!(local_dispatcher.actors.contains_key(&child_ref), true);
} | rust_cleaned_test_functions.jsonl/21762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 458
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
92189,
14000,
54818,
368,
341,
286,
1077,
31977,
290,
842,
284,
45068,
290,
764,
486,
931,
543,
286,
1077,
320,
11644,
11,
27439,
284,
296,
81984,
486,
359,
65686,
543,
286,
1077,
1815,
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_title_error() {
assert!(matches!(
EmbedBuilder::new().title("").build().unwrap_err().kind(),
EmbedErrorType::TitleEmpty { title }
if title.is_empty()
));
let title_too_long = EmbedBuilder::TITLE_LENGTH_LIMIT + 1;
assert!(matches!(
EmbedBuilder::new().title("a".repeat(title_too_long)).build().unwrap_err().kind(),
EmbedErrorType::TitleTooLong { title }
if title.len() == title_too_long
));
} | rust_cleaned_test_functions.jsonl/50086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6112,
4096,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
37068,
3297,
486,
931,
1005,
2102,
80821,
5834,
1005,
15454,
9266,
1005,
15314,
3148,
310,
37068,
1454,
929,
486,
3851,
3522,
314,
2265,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_20() {
assert_eq!(
parse_column_type(&mut Parser::new(
"set('Trailers','Commentaries','Deleted Scenes','Behind the Scenes')"
)),
ColumnType::Set(SetDef {
members: vec![
"Trailers".to_owned(),
"Commentaries".to_owned(),
"Deleted Scenes".to_owned(),
"Behind the Scenes".to_owned(),
],
attr: StringAttr {
length: None,
charset: None,
collation: None,
}
})
);
} | rust_cleaned_test_functions.jsonl/73849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
15,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8744,
1819,
2099,
6984,
21102,
486,
931,
1006,
394,
330,
746,
492,
74096,
388,
1844,
10677,
5431,
1844,
26039,
83183,
1844,
73642,
279,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_info_currline() {
#[cfg(not(feature = "chess"))]
let attributes: Vec<UciInfoAttribute> = vec![
UciInfoAttribute::CurrLine {
cpu_nr: Some(1),
line: vec![
UciMove::from_to(
UciSquare::from('d', 1),
UciSquare::from('h', 5),
),
UciMove::from_to(
UciSquare::from('g', 6),
UciSquare::from('h', 5),
)
],
}
];
#[cfg(feature = "chess")]
let attributes: Vec<UciInfoAttribute> = vec![
UciInfoAttribute::CurrLine {
cpu_nr: Some(1),
line: vec![
ChessMove::new(Square::D1, Square::H5, None),
ChessMove::new(Square::G6, Square::H5, None),
],
}
];
let m = UciMessage::Info(attributes);
assert_eq!(m.serialize(), "info currline cpunr 1 d1h5 g6h5");
} | rust_cleaned_test_functions.jsonl/19069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 695
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
3109,
40515,
1056,
368,
341,
286,
11506,
14072,
24772,
27062,
284,
330,
331,
433,
2761,
921,
310,
1077,
8201,
25,
11312,
36397,
5855,
1731,
3907,
29,
284,
7486,
90515,
310,
547,
5855,
1731,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rw_arc_no_poison_rw() {
let arc = Arc::new(RwLock::new(1));
let arc2 = arc.clone();
let _: Result<(), _> = thread::spawn(move || {
let _lock = arc2.read().unwrap();
panic!()
}).join();
let lock = arc.write().unwrap();
assert_eq!(*lock, 1);
} | rust_cleaned_test_functions.jsonl/5881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49566,
62914,
6536,
61814,
3335,
49566,
368,
341,
286,
1077,
15580,
284,
19689,
486,
931,
2785,
86,
11989,
486,
931,
7,
16,
1106,
286,
1077,
15580,
17,
284,
15580,
15997,
543,
286,
1077,
58536,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_header_type_with_invalid_header() {
let header = [0x62, 0x6C, 0x6F, 0x62, 0x0];
let _ = get_header_type(&header);
} | rust_cleaned_test_functions.jsonl/108330 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8757,
1819,
6615,
31433,
8757,
368,
341,
286,
1077,
4247,
284,
508,
15,
87,
21,
17,
11,
220,
15,
87,
21,
34,
11,
220,
15,
87,
21,
37,
11,
220,
15,
87,
21,
17,
11,
220,
15,
87,
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 |
#[test]
fn test_set() {
let settings = Settings::new();
let v1: u32 = 1;
let v2: f32 = 1.0;
let vt1 = TypeId::of::<u32>();
let vt2 = TypeId::of::<f32>();
let v3: u32 = 2;
settings.set(&v1);
let values = settings.settings.read();
let r1 = values.get(&vt1).unwrap().downcast_ref::<u32>().unwrap();
assert_eq!(v1, *r1);
settings.set(&v2);
settings.set(&v3);
let r2 = values.get(&vt1).unwrap().downcast_ref::<u32>().unwrap();
let r3 = values.get(&vt2).unwrap().downcast_ref::<f32>().unwrap();
assert_eq!(v3, *r2);
assert_eq!(v2, *r3);
} | rust_cleaned_test_functions.jsonl/29875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
368,
341,
286,
1077,
5003,
284,
11296,
486,
931,
1428,
286,
1077,
348,
16,
25,
575,
18,
17,
284,
220,
16,
280,
286,
1077,
348,
17,
25,
282,
18,
17,
284,
220,
16,
13,
15,
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_psty_payload() {
let set_size_sx: usize = 1 << 6;
let set_size_rx: usize = 1 << 6;
let weight_max: u64 = 100000;
let payload_max: u64 = 100000;
let payload_size: usize = 64;
let mut rng = AesRng::new();
let (sender, receiver) = UnixStream::pair().unwrap();
let sender_inputs = enum_ids_shuffled(set_size_sx, ITEM_SIZE);
let receiver_inputs = enum_ids_shuffled(set_size_rx, ITEM_SIZE);
let weights = int_vec_block512(rand_u64_vec(set_size_sx, weight_max, &mut rng));
let payloads = int_vec_block512(rand_u64_vec(set_size_rx, payload_max, &mut rng));
let result_in_clear = weighted_mean_clear(
&receiver_inputs.borrow(),
&sender_inputs.borrow(),
&payloads.borrow(),
&weights.borrow(),
);
std::thread::spawn(move || {
let mut rng = AesRng::new();
let reader = BufReader::new(sender.try_clone().unwrap());
let writer = BufWriter::new(sender);
let mut channel = Channel::new(reader, writer);
let mut psi = Sender::init(&mut channel, &mut rng).unwrap();
// For small to medium sized sets where batching can occur accross all bins
let _ = psi
.full_protocol(&sender_inputs, &weights, payload_size, &mut channel, &mut rng)
.unwrap();
});
let mut rng = AesRng::new();
let reader = BufReader::new(receiver.try_clone().unwrap());
let writer = BufWriter::new(receiver);
let mut channel = Channel::new(reader, writer);
let mut psi = Receiver::init(&mut channel, &mut rng).unwrap();
// For small to medium sized sets where batching can occur accross all bins
let weighted_mean = psi
.full_protocol(&receiver_inputs, &payloads, payload_size, &mut channel, &mut rng)
.unwrap();
assert_eq!(result_in_clear, weighted_mean);
} | rust_cleaned_test_functions.jsonl/12051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 932
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
78755,
32813,
368,
341,
286,
1077,
738,
2368,
643,
87,
25,
22301,
284,
220,
16,
1115,
220,
21,
280,
286,
1077,
738,
2368,
24330,
25,
22301,
284,
220,
16,
1115,
220,
21,
401,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_find_all_methods() {
let (analysis, pos) = fixture::position(
r#"
fn private_fn() {$0}
pub fn pub_fn() {}
pub fn generic_fn<T>(arg: T) {}
"#,
);
let refs = analysis.find_all_methods(pos.file_id).unwrap();
check_result(&refs, &[3..=13, 27..=33, 47..=57]);
} | rust_cleaned_test_functions.jsonl/73291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
36084,
368,
341,
286,
1077,
320,
34484,
11,
1133,
8,
284,
12507,
486,
3487,
1006,
310,
435,
2,
698,
310,
5168,
869,
15246,
368,
13924,
15,
630,
310,
6675,
5168,
6675,
15246,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_setup_sregs() {
let hv = hypervisor::new().unwrap();
let vm = hv.create_vm().expect("new VM fd creation failed");
let vcpu = vm.create_vcpu(0).unwrap();
let mut expected_sregs: SpecialRegisters = vcpu.get_sregs().unwrap();
let gm = GuestMemoryMmap::from_ranges(&vec![(GuestAddress(0), 0x10000)]).unwrap();
configure_segments_and_sregs(&gm, &mut expected_sregs, BootProtocol::LinuxBoot).unwrap();
setup_page_tables(&gm, &mut expected_sregs).unwrap();
setup_sregs(&gm, &vcpu, BootProtocol::LinuxBoot).unwrap();
let actual_sregs: SpecialRegisters = vcpu.get_sregs().unwrap();
assert_eq!(expected_sregs, actual_sregs);
} | rust_cleaned_test_functions.jsonl/21463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21363,
643,
30886,
368,
341,
286,
1077,
22747,
284,
9751,
31396,
486,
931,
1005,
15454,
543,
286,
1077,
10995,
284,
22747,
2520,
39008,
1005,
17119,
445,
931,
17792,
12414,
9688,
4641,
797,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_field() {
assert_eq!(field(&[3], &[1]), arr2(&[[0], [1], [2]]));
assert_eq!(field(&[3], &[2]), arr2(&[[0], [2], [4]]));
assert_eq!(
field(&[2, 2], &[1, 1]),
arr2(&[[0, 0], [0, 1], [1, 0], [1, 1]])
);
assert_eq!(
field(&[2, 2], &[2, 1]),
arr2(&[[0, 0], [0, 1], [2, 0], [2, 1]])
);
} | rust_cleaned_test_functions.jsonl/32078 | {
"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,
5013,
368,
341,
286,
2060,
10714,
10297,
2566,
2099,
58,
18,
1125,
44590,
16,
9719,
2890,
17,
2099,
15505,
15,
1125,
508,
16,
1125,
508,
17,
5053,
1106,
286,
2060,
10714,
10297,
2566,
2099,
58,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_precise_time() {
let s0 = precise_time_s();
debug!("s0={} sec", s0);
assert!(s0 > 0.);
let ns0 = precise_time_ns();
let ns1 = precise_time_ns();
debug!("ns0={} ns", ns0);
debug!("ns1={} ns", ns1);
assert!(ns1 >= ns0);
let ns2 = precise_time_ns();
debug!("ns2={} ns", ns2);
assert!(ns2 >= ns1);
} | rust_cleaned_test_functions.jsonl/7335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59179,
1064,
3009,
368,
341,
286,
1077,
274,
15,
284,
23560,
3009,
643,
543,
286,
7390,
17223,
82,
15,
68085,
5701,
497,
274,
15,
317,
286,
2060,
10297,
82,
15,
861,
220,
15,
13,
626,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_detailed_files_rot_timestamp() {
let handle = Logger::try_with_str("info")
.unwrap()
.format(detailed_format)
.log_to_file(FileSpec::default().use_timestamp(true))
.rotate(Criterion::Size(2000), Naming::Numbers, Cleanup::Never)
.start()
.unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
error!("This is an error message");
warn!("This is a warning");
info!("This is an info message");
debug!("This is a debug message - you must not see it!");
trace!("This is a trace message - you must not see it!");
handle.validate_logs(&[
("ERROR", "test_detailed_files_rot", "error"),
("WARN", "test_detailed_files_rot", "warning"),
("INFO", "test_detailed_files_rot", "info"),
]);
} | rust_cleaned_test_functions.jsonl/23402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
10111,
10931,
38256,
23073,
368,
341,
262,
1077,
3705,
284,
9514,
486,
1539,
6615,
2895,
445,
2733,
1138,
286,
659,
15454,
741,
286,
659,
2243,
1500,
10111,
8955,
340,
286,
659,
839,
2346,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_symbol() {
let mut r = BufReader::new(b"core::cmp::min");
assert_eq!(r.read(),Some(Token::DocStart("")));
assert_eq!(r.read(), Some(Token::Symbol("core::cmp::min")));
assert_eq!(r.read(),Some(Token::DocEnd("")));
assert_eq!(r.read(), None);
} | rust_cleaned_test_functions.jsonl/95947 | {
"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,
21179,
368,
341,
286,
1077,
5206,
435,
284,
69013,
5062,
486,
931,
1883,
1,
2153,
486,
7293,
486,
1065,
797,
286,
2060,
10714,
10297,
81,
4125,
1507,
8373,
38584,
486,
9550,
3479,
445,
17621,
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_serialize_vrq_f2_00_02() {
#[cfg(feature = "v3")]
init_psa_crypto();
let vrq = Voucher::try_from(VRQ_F2_00_02).unwrap();
assert_eq!(vrq.get_cose_content().unwrap(), hex_literal::hex!("
A1 # map(1)
19 09C5 # unsigned(2501)
A5 # map(5)
01 # unsigned(1)
69 # text(9)
70726F78696D697479 # \"proximity\"
02 # unsigned(2)
C1 # tag(1)
1A 5F501DD2 # unsigned(1599086034)
0D # unsigned(13)
51 # bytes(17)
30302D44302D45352D46322D30302D3032 # \"00-D0-E5-F2-00-02\"
07 # unsigned(7)
76 # text(22)
66727655695A685938506E566C524B43495333714D51 # \"frvUiZhY8PnVlRKCIS3qMQ\"
0A # unsigned(10)
59 01DC # bytes(476)
308201D83082015EA003020102020101300A06082A8648CE3D040302307331123010060A0992268993F22C6401191602636131193017060A0992268993F22C640119160973616E64656C6D616E3142304006035504030C39233C53797374656D5661726961626C653A3078303030303535623832353063306462383E20556E737472756E6720466F756E7461696E204341301E170D3230303832393034303031365A170D3232303832393034303031365A304631123010060A0992268993F22C6401191602636131193017060A0992268993F22C640119160973616E64656C6D616E3115301306035504030C0C556E737472756E67204A52433059301306072A8648CE3D020106082A8648CE3D030107034200049665507234BA9FE5DDE65FF6F0816FE9489E810C12073B468F97642B63008D020F57C97C947F848CB20E61D6C9888D15B4421FD7F26AB7E4CE05F8A74CD38B3AA310300E300C0603551D130101FF04023000300A06082A8648CE3D0403020368003065023100879ECDE38A05122EB6F72CB21BC3D25CBEE6573770569CEC230CA48C39F1404D72D4D755059B8082020ED41D4F119FE702303C14D88A0AFC4047CF1F87B873C16A28BFB83C0F88434D9DF3F7A86E2DC6BD8895442F2037EDCCE4855B11DA9A19E4E8 #
# python3: `bytes([161, 25, ... 228, 232]).hex()` > https://cbor.me/
"));
assert_eq!(vrq.get_signature().unwrap().0, /* bare */ [242, 113, 238, 15, 125, 71, 169, 233, 252, 219, 95, 74, 88, 238, 47, 97, 183, 138, 84, 131, 159, 203, 164, 31, 34, 135, 174, 129, 228, 47, 180, 129, 171, 146, 165, 162, 167, 222, 82, 112, 125, 198, 7, 254, 142, 250, 108, 214, 194, 253, 235, 104, 154, 68, 171, 179, 127, 93, 192, 158, 174, 24, 23, 8]);
assert_eq!(vrq.serialize().unwrap(), VRQ_F2_00_02);
} | rust_cleaned_test_functions.jsonl/81745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
2273,
52189,
761,
17,
62,
15,
15,
62,
15,
17,
368,
341,
262,
11506,
14072,
27062,
284,
330,
85,
18,
5422,
262,
2930,
620,
9081,
78298,
1428,
262,
1077,
36100,
80,
284,
647,
23937,
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_to_cmp_f() {
assert_eq!(
Label::from_ascii("ABC")
.unwrap()
.cmp_with_f::<CaseInsensitive>(&Label::from_ascii("abc").unwrap()),
Ordering::Equal
);
assert_eq!(
Label::from_ascii("abcDEF")
.unwrap()
.cmp_with_f::<CaseInsensitive>(&Label::from_ascii("abcdef").unwrap()),
Ordering::Equal
);
assert_eq!(
Label::from_ascii("ABC")
.unwrap()
.cmp_with_f::<CaseSensitive>(&Label::from_ascii("abc").unwrap()),
Ordering::Less
);
assert_eq!(
Label::from_ascii("abcDEF")
.unwrap()
.cmp_with_f::<CaseSensitive>(&Label::from_ascii("abcdef").unwrap()),
Ordering::Less
);
} | rust_cleaned_test_functions.jsonl/5051 | {
"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,
2346,
35193,
761,
368,
341,
286,
2060,
10714,
33673,
310,
9402,
486,
1499,
50238,
445,
25411,
1138,
394,
659,
15454,
741,
394,
659,
7293,
6615,
761,
27638,
4207,
75293,
44784,
2476,
486,
1499,
502... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_power_of_two() {
assert!((next_power_of_two(0u) == 0u));
assert!((next_power_of_two(1u) == 1u));
assert!((next_power_of_two(2u) == 2u));
assert!((next_power_of_two(3u) == 4u));
assert!((next_power_of_two(4u) == 4u));
assert!((next_power_of_two(5u) == 8u));
assert!((next_power_of_two(6u) == 8u));
assert!((next_power_of_two(7u) == 8u));
assert!((next_power_of_two(8u) == 8u));
assert!((next_power_of_two(9u) == 16u));
assert!((next_power_of_two(10u) == 16u));
assert!((next_power_of_two(11u) == 16u));
assert!((next_power_of_two(12u) == 16u));
assert!((next_power_of_two(13u) == 16u));
assert!((next_power_of_two(14u) == 16u));
assert!((next_power_of_two(15u) == 16u));
assert!((next_power_of_two(16u) == 16u));
assert!((next_power_of_two(17u) == 32u));
assert!((next_power_of_two(18u) == 32u));
assert!((next_power_of_two(19u) == 32u));
assert!((next_power_of_two(20u) == 32u));
assert!((next_power_of_two(21u) == 32u));
assert!((next_power_of_two(22u) == 32u));
assert!((next_power_of_two(23u) == 32u));
assert!((next_power_of_two(24u) == 32u));
assert!((next_power_of_two(25u) == 32u));
assert!((next_power_of_two(26u) == 32u));
assert!((next_power_of_two(27u) == 32u));
assert!((next_power_of_two(28u) == 32u));
assert!((next_power_of_two(29u) == 32u));
assert!((next_power_of_two(30u) == 32u));
assert!((next_power_of_two(31u) == 32u));
assert!((next_power_of_two(32u) == 32u));
assert!((next_power_of_two(33u) == 64u));
assert!((next_power_of_two(34u) == 64u));
assert!((next_power_of_two(35u) == 64u));
assert!((next_power_of_two(36u) == 64u));
assert!((next_power_of_two(37u) == 64u));
assert!((next_power_of_two(38u) == 64u));
assert!((next_power_of_two(39u) == 64u));
} | rust_cleaned_test_functions.jsonl/35453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 905
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
20421,
3575,
23241,
368,
341,
262,
2060,
0,
1188,
3600,
20421,
3575,
23241,
7,
15,
84,
8,
621,
220,
15,
84,
1106,
262,
2060,
0,
1188,
3600,
20421,
3575,
23241,
7,
16,
84,
8,
621,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_string_attribute_value() {
let value = Value::String("String Value".to_string());
let expected = AttributeValue {
s: Some("String Value".to_string()),
..Default::default()
};
assert_eq!(build_attribute_value(&value), expected);
} | rust_cleaned_test_functions.jsonl/87598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
3904,
16791,
3142,
368,
341,
286,
1077,
897,
284,
5162,
486,
703,
445,
703,
5162,
3263,
983,
3904,
1423,
286,
1077,
3601,
284,
16752,
1130,
341,
310,
274,
25,
4329,
445,
703,
5162,
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... | 1 |
#[test]
fn test_rpc_get_fees() {
let rpc = RpcHandler::start();
let bank = rpc.working_bank();
let recent_blockhash = bank.confirmed_last_blockhash();
let RpcHandler { meta, io, .. } = rpc;
let req = r#"{"jsonrpc":"2.0","id":1,"method":"getFees"}"#;
let res = io.handle_request_sync(req, meta);
let expected = json!({
"jsonrpc": "2.0",
"result": {
"context": {"slot": 0},
"value": {
"blockhash": recent_blockhash.to_string(),
"feeCalculator": {
"lamportsPerSignature": 0,
},
"lastValidSlot": MAX_RECENT_BLOCKHASHES,
"lastValidBlockHeight": MAX_RECENT_BLOCKHASHES,
},
},
"id": 1
});
let expected: Response =
serde_json::from_value(expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/6313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
761,
5516,
368,
341,
286,
1077,
35596,
284,
79961,
3050,
486,
2468,
543,
286,
1077,
6073,
284,
35596,
18282,
287,
35733,
543,
286,
1077,
3213,
7113,
8296,
284,
6073,
13937,
8434,
1219... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_execute_jump_if_true() {
let mut machine1 = Machine::new(vec![1105,0,4,99,104,1,99]);
machine1.execute().unwrap();
assert_eq!(machine1.output, vec![]);
let mut machine2 = Machine::new(vec![1105,1,4,99,4,1,99]);
machine2.execute().unwrap();
assert_eq!(machine2.output, vec![1]);
} | rust_cleaned_test_functions.jsonl/43085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
65436,
11119,
16082,
368,
341,
10217,
5206,
5662,
16,
284,
12960,
486,
931,
25592,
20703,
16,
16,
15,
20,
11,
15,
11,
19,
11,
24,
24,
11,
16,
15,
19,
11,
16,
11,
24,
24,
2558,
2109,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_found() {
let haystack = "111 a 111b".to_string();
search_test!(&haystack, &"xxx".to_string(), None);
search_test!(&haystack, &"12b".to_string(), None);
search_test!(&haystack, &"a31".to_string(), None);
} | rust_cleaned_test_functions.jsonl/19406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
21480,
368,
341,
286,
1077,
88447,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
3263,
983,
3904,
543,
286,
2711,
4452,
0,
2099,
67312,
7693,
11,
609,
1,
24048,
3263,
983,
3904,
1507... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reference() {
let expected = 5 * 1000;
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let mut file = at.make_file(TFILE2);
scene.ucmd().arg("-s").arg("+5KB").arg(TFILE1).run();
scene
.ucmd()
.arg("--reference")
.arg(TFILE1)
.arg(TFILE2)
.run();
file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!(
expected == actual,
"expected '{}' got '{}'",
expected,
actual
);
} | rust_cleaned_test_functions.jsonl/50492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25433,
368,
341,
262,
1077,
3601,
284,
220,
20,
353,
220,
16,
15,
15,
15,
280,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pcr_read_all() {
let mut context = create_ctx_without_session();
let pcr_selection_list = PcrSelectionListBuilder::new()
.with_selection(
HashingAlgorithm::Sha256,
&[
PcrSlot::Slot0,
PcrSlot::Slot1,
PcrSlot::Slot2,
PcrSlot::Slot3,
PcrSlot::Slot4,
PcrSlot::Slot5,
PcrSlot::Slot6,
PcrSlot::Slot7,
PcrSlot::Slot8,
PcrSlot::Slot9,
PcrSlot::Slot10,
PcrSlot::Slot11,
PcrSlot::Slot12,
PcrSlot::Slot13,
PcrSlot::Slot14,
PcrSlot::Slot15,
PcrSlot::Slot16,
PcrSlot::Slot17,
PcrSlot::Slot18,
PcrSlot::Slot19,
PcrSlot::Slot20,
PcrSlot::Slot21,
PcrSlot::Slot22,
PcrSlot::Slot23,
],
)
.build()
.expect("Failed to create PcrSelectionList for read_all call");
let pcr_data = tss_esapi::abstraction::pcr::read_all(&mut context, pcr_selection_list)
.expect("Call to pcr_read_all failed");
assert_eq!(
pcr_data
.pcr_bank(HashingAlgorithm::Sha256)
.expect("PcrData did not contain expected PcrBank")
.len(),
24,
"PcrData did not contain expected amount of digests"
);
let (_count, _read_pcr_selection_1, read_pcrs_1) = context
.pcr_read(
PcrSelectionListBuilder::new()
.with_selection(
HashingAlgorithm::Sha256,
&[
PcrSlot::Slot0,
PcrSlot::Slot1,
PcrSlot::Slot2,
PcrSlot::Slot3,
PcrSlot::Slot4,
PcrSlot::Slot5,
PcrSlot::Slot6,
PcrSlot::Slot7,
],
)
.build()
.expect("Failed to create PcrSekectinList for first pcr_read call"),
)
.expect("Call 1 to pcr_read failed");
let (_count, _read_pcr_selection_2, read_pcrs_2) = context
.pcr_read(
PcrSelectionListBuilder::new()
.with_selection(
HashingAlgorithm::Sha256,
&[
PcrSlot::Slot8,
PcrSlot::Slot9,
PcrSlot::Slot10,
PcrSlot::Slot11,
PcrSlot::Slot12,
PcrSlot::Slot13,
PcrSlot::Slot14,
PcrSlot::Slot15,
],
)
.build()
.expect("Failed to create PcrSekectinList for second pcr_read call"),
)
.expect("Call 2 to pcr_read failed");
let (_count, _read_pcr_selection_3, read_pcrs_3) = context
.pcr_read(
PcrSelectionListBuilder::new()
.with_selection(
HashingAlgorithm::Sha256,
&[
PcrSlot::Slot16,
PcrSlot::Slot17,
PcrSlot::Slot18,
PcrSlot::Slot19,
PcrSlot::Slot20,
PcrSlot::Slot21,
PcrSlot::Slot22,
PcrSlot::Slot23,
],
)
.build()
.expect("Failed to create PcrSekectinList for third pcr_read call"),
)
.expect("Call 3 to pcr_read failed");
vec![read_pcrs_1, read_pcrs_2, read_pcrs_3]
.iter()
.enumerate()
.for_each(|(idx, dl)| {
assert_eq!(dl.len(), 8);
let d = pcr_data
.pcr_bank(HashingAlgorithm::Sha256)
.expect("PcrData did not contain expected PcrBank")
.into_iter()
.skip(idx * 8)
.take(8);
assert_eq!(d.len(), 8);
dl.value()
.iter()
.zip(d)
.for_each(|(actual, (_, expected))| {
assert_eq!(actual, expected);
})
})
} | rust_cleaned_test_functions.jsonl/47441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2840
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
5082,
6443,
5705,
368,
341,
262,
1077,
5206,
2266,
284,
1855,
15147,
39904,
12316,
1428,
262,
1077,
281,
5082,
23672,
2019,
284,
393,
5082,
11177,
852,
3297,
486,
931,
741,
286,
659,
4197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pull_request_time() {
const NUM_REPS: usize = 2 * CRDS_UNIQUE_PUBKEY_CAPACITY;
let mut rng = rand::thread_rng();
let pubkeys: Vec<_> = repeat_with(Pubkey::new_unique).take(NUM_REPS).collect();
let mut node = CrdsGossipPull::default();
let mut requests = HashMap::new();
let now = timestamp();
for k in 0..NUM_REPS {
let pubkey = pubkeys[rng.gen_range(0, pubkeys.len())];
let now = now + k as u64;
node.mark_pull_request_creation_time(pubkey, now);
*requests.entry(pubkey).or_default() = now;
}
assert!(node.pull_request_time.len() <= CRDS_UNIQUE_PUBKEY_CAPACITY);
// Assert that timestamps match most recent request.
for (pk, ts) in &node.pull_request_time {
assert_eq!(*ts, requests[pk]);
}
// Assert that most recent pull timestamps are maintained.
let max_ts = requests
.iter()
.filter(|(pk, _)| !node.pull_request_time.contains(*pk))
.map(|(_, ts)| *ts)
.max()
.unwrap();
let min_ts = requests
.iter()
.filter(|(pk, _)| node.pull_request_time.contains(*pk))
.map(|(_, ts)| *ts)
.min()
.unwrap();
assert!(max_ts <= min_ts);
} | rust_cleaned_test_functions.jsonl/112074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 700
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65693,
7893,
3009,
368,
341,
286,
733,
15943,
2192,
5012,
25,
22301,
284,
220,
17,
353,
12617,
5936,
90330,
1088,
4493,
4784,
92153,
280,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
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... | 3 |
#[test]
fn test_from_string_d() {
let d: Duration = DurationString::try_from(String::from("1d")).unwrap().into();
assert_eq!(d, Duration::from_secs(86_400));
} | rust_cleaned_test_functions.jsonl/97549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
3904,
814,
368,
341,
286,
1077,
294,
25,
21045,
284,
21045,
703,
486,
1539,
5673,
2242,
486,
1499,
445,
16,
67,
15197,
15454,
1005,
18122,
543,
286,
2060,
10714,
10297,
67,
11,
21045,
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 |
#[test]
fn test_bitv_set_difference() {
let mut a = BitvSet::new();
let mut b = BitvSet::new();
assert!(a.insert(1));
assert!(a.insert(3));
assert!(a.insert(5));
assert!(a.insert(200));
assert!(a.insert(500));
assert!(b.insert(3));
assert!(b.insert(200));
let expected = [1, 5, 500];
let actual = a.difference(&b).collect::<Vec<uint>>();
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/119308 | {
"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,
13996,
85,
2602,
47525,
368,
341,
286,
1077,
5206,
264,
284,
6495,
85,
1649,
486,
931,
543,
286,
1077,
5206,
293,
284,
6495,
85,
1649,
486,
931,
1428,
286,
2060,
10297,
64,
7030,
7,
16,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mint() {
let mut context = get_context(accounts(0));
testing_env!(context.build());
let mut contract = Contract::new_default_meta(accounts(0).into());
testing_env!(context
.storage_usage(env::storage_usage())
.attached_deposit(MINT_STORAGE_COST)
.predecessor_account_id(accounts(0))
.build());
let token_id = "0".to_string();
let token = contract.nft_mint(token_id.clone(), accounts(0), sample_token_metadata());
assert_eq!(token.token_id, token_id);
assert_eq!(token.owner_id, accounts(0));
assert_eq!(token.metadata.unwrap(), sample_token_metadata());
assert_eq!(token.approved_account_ids.unwrap(), HashMap::new());
} | rust_cleaned_test_functions.jsonl/36146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
396,
368,
341,
414,
1077,
5206,
2266,
284,
633,
8467,
91868,
7,
15,
1106,
414,
7497,
15879,
10297,
2147,
13239,
1423,
414,
1077,
5206,
5116,
284,
19185,
486,
931,
9993,
13381,
91868,
7,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incomplete_competition() {
let input = "Allegoric Alaskians;Blithering Badgers;win\n".to_string() +
"Devastating Donkeys;Allegoric Alaskians;win\n" +
"Courageous Californians;Blithering Badgers;loss\n" +
"Allegoric Alaskians;Courageous Californians;win";
let expected = "Team | MP | W | D | L | P\n".to_string() +
"Allegoric Alaskians | 3 | 2 | 0 | 1 | 6\n" +
"Blithering Badgers | 2 | 1 | 0 | 1 | 3\n" +
"Devastating Donkeys | 1 | 1 | 0 | 0 | 3\n" +
"Courageous Californians | 2 | 0 | 0 | 2 | 0";
assert_eq!(tournament::tally(&input), expected);
} | rust_cleaned_test_functions.jsonl/21170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
14737,
2965,
55767,
368,
341,
262,
1077,
1946,
284,
330,
2101,
1937,
26359,
1674,
1073,
5380,
26,
4923,
2485,
287,
11461,
10637,
26,
7526,
1699,
3263,
983,
3904,
368,
3610,
394,
330,
14592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_pattern_in_declaration_removed_1() {
test("var [] = [];", "");
test("let [] = [];", "");
test("const [] = [];", "");
test("var {} = [];", "");
} | rust_cleaned_test_functions.jsonl/473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
21260,
1243,
77926,
68248,
62,
16,
368,
341,
262,
1273,
445,
947,
3056,
284,
3056,
32503,
14498,
262,
1273,
445,
1149,
3056,
284,
3056,
32503,
14498,
262,
1273,
445,
1024,
3056,
284,
3056,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_list_phys() {
let mut exec = fasync::TestExecutor::new().expect("failed to create an executor");
let test_values = test_setup();
let service_fut = serve_monitor_requests(
test_values.monitor_req_stream,
test_values.phys.clone(),
test_values.ifaces.clone(),
test_values.watcher_service,
test_values.dev_proxy,
);
pin_mut!(service_fut);
assert_variant!(exec.run_until_stalled(&mut service_fut), Poll::Pending);
// Request the list of available PHYs.
let list_fut = test_values.monitor_proxy.list_phys();
pin_mut!(list_fut);
assert_variant!(exec.run_until_stalled(&mut list_fut), Poll::Pending);
// Progress the service loop.
assert_variant!(exec.run_until_stalled(&mut service_fut), Poll::Pending);
// The future to list the PHYs should complete and no PHYs should be present.
assert_variant!(exec.run_until_stalled(&mut list_fut),Poll::Ready(Ok(phys)) => {
assert!(phys.is_empty())
});
// Add a PHY to the PhyMap.
let (phy, _req_stream) = fake_phy();
test_values.phys.insert(0, phy);
// Request the list of available PHYs.
let list_fut = test_values.monitor_proxy.list_phys();
pin_mut!(list_fut);
assert_variant!(exec.run_until_stalled(&mut list_fut), Poll::Pending);
// Progress the service loop.
assert_variant!(exec.run_until_stalled(&mut service_fut), Poll::Pending);
// The future to list the PHYs should complete and the PHY should be present.
assert_variant!(exec.run_until_stalled(&mut list_fut), Poll::Ready(Ok(phys)) => {
assert_eq!(vec![0u16], phys);
});
// Remove the PHY from the map.
test_values.phys.remove(&0);
// Request the list of available PHYs.
let list_fut = test_values.monitor_proxy.list_phys();
pin_mut!(list_fut);
assert_variant!(exec.run_until_stalled(&mut list_fut), Poll::Pending);
// Progress the service loop.
assert_variant!(exec.run_until_stalled(&mut service_fut), Poll::Pending);
// The future to list the PHYs should complete and no PHYs should be present.
assert_variant!(exec.run_until_stalled(&mut list_fut), Poll::Ready(Ok(phys)) => {
assert!(phys.is_empty())
});
} | rust_cleaned_test_functions.jsonl/20585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1083
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
69319,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
1273,
9146,
284,
1273,
21363,
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_new_file() {
let (at, mut ucmd) = at_and_ucmd!();
let filename = "new_file_that_does_not_exist_yet";
ucmd.args(&["-s", "8", filename])
.succeeds()
.no_stdout()
.no_stderr();
assert!(at.file_exists(filename));
assert_eq!(at.read_bytes(filename), vec![b'\0'; 8]);
} | rust_cleaned_test_functions.jsonl/77099 | {
"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,
5921,
2458,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
3899,
284,
330,
931,
2458,
70197,
96374,
7913,
35906,
4178,
295,
876,
262,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fin_wait_1_fin_fin() {
let mut s = socket_fin_wait_1();
recv!(s, [TcpRepr {
control: TcpControl::Fin,
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
..RECV_TEMPL
}]);
send!(s, TcpRepr {
control: TcpControl::Fin,
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
..SEND_TEMPL
});
assert_eq!(s.state, State::Closing);
sanity!(s, socket_closing());
} | rust_cleaned_test_functions.jsonl/1736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39737,
18760,
62,
16,
39737,
39737,
368,
341,
286,
1077,
5206,
274,
284,
7575,
39737,
18760,
62,
16,
543,
286,
27006,
10297,
82,
11,
508,
77536,
693,
649,
341,
310,
2524,
25,
64876,
3273,
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_box_filter_handles_empty_images() {
let _ = box_filter(&GrayImage::new(0, 0), 3, 3);
let _ = box_filter(&GrayImage::new(1, 0), 3, 3);
let _ = box_filter(&GrayImage::new(0, 1), 3, 3);
} | rust_cleaned_test_functions.jsonl/35600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10194,
8727,
68017,
15124,
13283,
368,
341,
286,
1077,
716,
284,
3745,
8727,
2099,
28174,
1906,
486,
931,
7,
15,
11,
220,
15,
701,
220,
18,
11,
220,
18,
317,
286,
1077,
716,
284,
3745,
8727,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reader_prefix_seek() {
let dir = tempfile::TempDir::new().unwrap();
let builder = TestEngineBuilder::new().path(dir.path());
let db = builder.build().unwrap().kv_engine().get_sync_db();
let cf = engine_rocks::util::get_cf_handle(&db, CF_WRITE).unwrap();
let region = make_region(1, vec![], vec![]);
let mut engine = RegionEngine::new(&db, ®ion);
// Put some tombstones into the DB.
for i in 1..100 {
let commit_ts = (i * 2 + 1).into();
let mut k = vec![b'z'];
k.extend_from_slice(Key::from_raw(b"k1").append_ts(commit_ts).as_encoded());
use engine_rocks::raw::Writable;
engine.db.delete_cf(cf, &k).unwrap();
}
engine.flush();
#[allow(clippy::useless_vec)]
for (k, scan_mode, tombstones) in vec![
(b"k0", Some(ScanMode::Forward), 99),
(b"k0", None, 0),
(b"k1", Some(ScanMode::Forward), 99),
(b"k1", None, 99),
(b"k2", Some(ScanMode::Forward), 0),
(b"k2", None, 0),
] {
let mut reader = MvccReader::new(engine.snapshot(), scan_mode, false);
let (k, ts) = (Key::from_raw(k), 199.into());
reader.seek_write(&k, ts).unwrap();
assert_eq!(reader.statistics.write.seek_tombstone, tombstones);
}
} | rust_cleaned_test_functions.jsonl/125636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22306,
13974,
74473,
368,
341,
286,
1077,
5419,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
7363,
284,
3393,
4571,
3297,
486,
931,
1005,
2343,
14161,
3875,
1423,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_group_angle_brackets() {
let tokens = TokenStream::from_iter(vec![
TokenTree::Ident(Ident::new("Option", Span::call_site())),
TokenTree::Punct(Punct::new('<', Spacing::Alone)),
TokenTree::Group(Group::new(Delimiter::None, quote! { Vec<u8> })),
TokenTree::Punct(Punct::new('>', Spacing::Alone)),
]);
snapshot!(tokens as Type, @r###"
Type::Path {
path: Path {
segments: [
PathSegment {
ident: "Option",
arguments: PathArguments::AngleBracketed {
args: [
Type(Type::Group {
elem: Type::Path {
path: Path {
segments: [
PathSegment {
ident: "Vec",
arguments: PathArguments::AngleBracketed {
args: [
Type(Type::Path {
path: Path {
segments: [
PathSegment {
ident: "u8",
arguments: None,
},
],
},
}),
],
},
},
],
},
},
}),
],
},
},
],
},
}
"###);
} | rust_cleaned_test_functions.jsonl/45552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1751
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
21727,
17682,
18382,
368,
341,
1066,
262,
1077,
11211,
284,
9660,
3027,
486,
1499,
11723,
25592,
90515,
286,
9660,
6533,
486,
28301,
7,
28301,
486,
931,
445,
5341,
497,
11903,
486,
6659,
245... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duplicate_last_index() {
let num_shreds = 2;
let num_entries = max_ticks_per_n_shreds(num_shreds, None);
let slot = 1;
let (mut shreds, _) = make_slot_entries(slot, 0, num_entries);
// Mark both as last shred
shreds[0].set_last_in_slot();
shreds[1].set_last_in_slot();
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
blockstore.insert_shreds(shreds, None, false).unwrap();
assert!(blockstore.get_duplicate_slot(slot).is_some());
} | rust_cleaned_test_functions.jsonl/9584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
12195,
3560,
368,
341,
286,
1077,
1629,
3712,
53369,
284,
220,
17,
280,
286,
1077,
1629,
26092,
284,
1932,
49961,
5678,
1089,
3712,
53369,
8068,
3712,
53369,
11,
2240,
317,
286,
1077,
9446,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flags_from_vec_11() {
let (flags, subcommand, argv) =
flags_from_vec(svec!["deno", "fmt", "script_1.ts", "script_2.ts"]);
assert_eq!(
flags,
DenoFlags {
allow_write: true,
allow_read: true,
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(
argv,
svec![
"deno",
PRETTIER_URL,
"script_1.ts",
"script_2.ts",
"--write"
]
);
} | rust_cleaned_test_functions.jsonl/112840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
5673,
13251,
62,
16,
16,
368,
341,
262,
1077,
320,
11161,
11,
1186,
5631,
11,
10213,
8,
4035,
414,
8042,
5673,
13251,
1141,
4083,
0,
1183,
5183,
78,
497,
330,
12501,
497,
330,
2282,
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_example_10() {
let input: &str = "b";
let valid: usize = count_common_chars(&input);
assert_eq!(valid, 1);
} | rust_cleaned_test_functions.jsonl/120252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
62,
16,
15,
368,
341,
286,
1077,
1946,
25,
609,
495,
284,
330,
65,
876,
286,
1077,
2697,
25,
22301,
284,
1760,
21107,
37418,
2099,
1355,
317,
286,
2060,
10714,
10297,
1891,
11,
220,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_initialize_coin_price_before_run() {
let _pool = ConstPool::new();
let text = r"
/// price: btc_usdt 100
script {
use 0x1::Coins;
use 0x1::Coins::{BTC, USDT};
fun main() {
let price = Coins::get_price<BTC, USDT>();
assert(price == 100, 1);
}
}
";
let res = execute_script(
MoveFile::with_content(script_path(), text),
vec![stdlib_mod("coins.move")],
"dfinance",
"0x3",
vec![],
)
.unwrap()
.last()
.unwrap();
assert!(res.effects().resources().is_empty());
} | rust_cleaned_test_functions.jsonl/43929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40889,
75718,
9040,
23708,
14007,
368,
341,
262,
1077,
716,
10285,
284,
24522,
10551,
486,
931,
1428,
262,
1077,
1467,
284,
435,
698,
2575,
3349,
25,
86037,
11306,
8047,
220,
16,
15,
15,
198,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log_append_multiple() {
let l = Log::<Operation>::default();
let o = [Operation::Read, Operation::Write(119)];
l.append(&o, 1, |_o: Operation, _i: usize| {});
assert_eq!(l.head.load(Ordering::Relaxed), 0);
assert_eq!(l.tail.load(Ordering::Relaxed), 2);
} | rust_cleaned_test_functions.jsonl/101050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
26041,
45233,
368,
341,
286,
1077,
326,
284,
2835,
27638,
8432,
6831,
2258,
543,
286,
1077,
297,
284,
508,
8432,
486,
4418,
11,
16730,
486,
7985,
7,
16,
16,
24,
12587,
286,
326,
2057,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_coset_zero() {
assert_eq!(coset_hash(FieldElement::zero(), 1), FieldElement::zero());
assert_eq!(coset_hash(FieldElement::zero(), 2), FieldElement::zero());
assert_eq!(coset_hash(FieldElement::zero(), 512), FieldElement::zero());
assert_eq!(coset_hash(FieldElement::zero(), 1024), FieldElement::zero());
} | rust_cleaned_test_functions.jsonl/127881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
61192,
295,
19359,
368,
341,
1789,
286,
2060,
10714,
10297,
9407,
295,
8950,
57788,
1691,
486,
14154,
1507,
220,
16,
701,
8601,
1691,
486,
14154,
1423,
286,
2060,
10714,
10297,
9407,
295,
89... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_common_field_shapes() {
use self::Shape::*;
use crate::util::string_hashmap;
{
let f1 = string_hashmap! {
"a" => Integer,
"b" => Bool,
"c" => Integer,
"d" => StringT,
};
let f2 = string_hashmap! {
"a" => Integer,
"c" => Floating,
"d" => Null,
"e" => Any,
};
assert_eq!(
common_field_shapes(f1, f2),
string_hashmap! {
"a" => Integer,
"b" => Optional(Box::new(Bool)),
"c" => Floating,
"d" => Optional(Box::new(StringT)),
"e" => Any,
}
);
}
} | rust_cleaned_test_functions.jsonl/28787 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21107,
5013,
71315,
368,
341,
262,
990,
656,
486,
12301,
56162,
262,
990,
17717,
486,
1314,
486,
917,
8950,
2186,
280,
262,
341,
286,
1077,
282,
16,
284,
914,
8950,
2186,
0,
341,
310,
330,
64,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_null_offset_nulls() {
let array =
StringArray::from(vec![Some("a"), Some("bc"), None, Some("defh")]).data();
let array = array.slice(1, 3);
let arrays = vec![&array];
let mut mutable = MutableArrayData::new(arrays, true, 0);
mutable.extend(0, 1, 3);
mutable.extend_nulls(1);
let result = mutable.freeze();
let result = StringArray::from(Arc::new(result));
let expected = StringArray::from(vec![None, Some("defh"), None]);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/102343 | {
"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,
3904,
15162,
6917,
15162,
82,
368,
341,
286,
1077,
1334,
4035,
310,
923,
1857,
486,
1499,
25592,
20703,
8373,
445,
64,
3975,
4329,
445,
8904,
3975,
2240,
11,
4329,
445,
750,
71,
899,
10697,
691,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_timeout() {
let addr = next_test_ip4();
let listener = t!(TcpListener::bind(&addr));
let mut stream = t!(TcpStream::connect(&("localhost", addr.port())));
t!(stream.set_read_timeout(Some(Duration::from_millis(1000))));
let mut buf = [0; 10];
let start = Instant::now();
let kind = stream.read(&mut buf).err().expect("expected error").kind();
assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
assert!(start.elapsed() > Duration::from_millis(400));
drop(listener);
} | rust_cleaned_test_functions.jsonl/7078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
20537,
368,
341,
286,
1077,
10789,
284,
1790,
4452,
10385,
19,
543,
286,
1077,
11446,
284,
259,
10297,
77536,
2743,
486,
7666,
2099,
6214,
3237,
286,
1077,
5206,
4269,
284,
259,
10297,
77536... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_merge_moving_order_independent() {
let mut left = Planet {
position: Vector::new(-9., 2.),
velocity: Vector::new(-7.,-2.),
mass: 24.,
};
let right = Planet {
position: Vector::new(1., -5.),
velocity: Vector::new(3., 6.),
mass: 8.,
};
let expected = Planet {
position: Vector::new(-6.5, 0.25),
velocity: Vector::new(-4.5, 0.),
mass: 32.,
};
left.merge(&right);
assert_eq!(left, expected);
} | rust_cleaned_test_functions.jsonl/70364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
717,
9130,
7869,
1243,
37555,
368,
341,
310,
1077,
5206,
2115,
284,
28835,
341,
394,
2309,
25,
4196,
486,
931,
4080,
24,
2572,
220,
17,
13,
1326,
394,
15435,
25,
4196,
486,
931,
4080,
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_lookup_hosts() {
let authority = create_example();
let mut catalog = Catalog::new();
catalog.upsert(authority.origin().clone().into(), authority);
let mut io_loop = Core::new().unwrap();
let (stream, sender) = TestClientStream::new(Arc::new(catalog));
let client = DnsFuture::new(
stream,
Box::new(sender),
&io_loop.handle(),
NoopMessageFinalizer::new(),
);
let mut hosts = Hosts::default();
hosts.insert(
Name::from_str("www.example.com.").unwrap(),
RecordType::A,
Lookup::new(Arc::new(vec![RData::A(Ipv4Addr::new(10, 0, 1, 104))])),
);
let lookup = InnerLookupIpFuture::lookup(
vec![Name::from_str("www.example.com.").unwrap()],
LookupIpStrategy::default(),
CachingClient::new(0, client),
Some(Arc::new(hosts)),
);
let lookup = io_loop.run(lookup).unwrap();
assert_eq!(lookup.iter().next().unwrap(), Ipv4Addr::new(10, 0, 1, 104));
} | rust_cleaned_test_functions.jsonl/84128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
61129,
368,
341,
262,
1077,
11198,
284,
1855,
39304,
543,
262,
1077,
5206,
16403,
284,
31221,
486,
931,
543,
262,
16403,
17652,
6047,
48269,
487,
20248,
1005,
19982,
1005,
18122,
1507,
11198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expand_home_windows() {
let path = "~/.aws/config";
let environment = Env::from_slice(&[]);
assert_eq!(
expand_home(&path, &Some("C:\\Users\\name".to_string()), &environment)
.to_str()
.unwrap(),
"C:\\Users\\name\\.aws\\config"
);
} | rust_cleaned_test_functions.jsonl/5183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
21653,
58220,
368,
341,
286,
1077,
1815,
284,
51269,
11930,
8635,
14730,
876,
286,
1077,
4573,
284,
37039,
486,
1499,
26488,
2099,
56703,
286,
2060,
10714,
33673,
310,
9225,
21653,
2099,
2343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_crypto_auth_primitive() {
unsafe {
let s = crypto_auth_primitive();
let s = std::ffi::CStr::from_ptr(s).to_bytes();
assert!(s == crypto_auth_PRIMITIVE.as_bytes());
}
} | rust_cleaned_test_functions.jsonl/69761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78298,
14014,
84087,
368,
341,
262,
19860,
341,
286,
1077,
274,
284,
19028,
14014,
84087,
543,
286,
1077,
274,
284,
1460,
486,
53799,
486,
34,
2580,
486,
1499,
4348,
1141,
568,
983,
12524,
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 |
#[test]
fn test_of_input_string() {
let parent = dangerous::input("1234");
let sub = &parent.as_dangerous()[1..2];
assert_eq!(Span::from(sub).of(parent.clone()).unwrap(), sub);
let non_span = Span::from("1224");
assert_eq!(non_span.of(parent), None);
} | rust_cleaned_test_functions.jsonl/124296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3575,
5898,
3904,
368,
341,
262,
1077,
2681,
284,
11406,
486,
1355,
445,
16,
17,
18,
19,
3071,
262,
1077,
1186,
284,
609,
3765,
5357,
814,
4003,
782,
10116,
16,
496,
17,
935,
262,
2060,
10714,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_bpf_upgradeable_loader_upgrade_ix() {
let program_address = Pubkey::new_unique();
let buffer_address = Pubkey::new_unique();
let authority_address = Pubkey::new_unique();
let spill_address = Pubkey::new_unique();
let programdata_address = Pubkey::find_program_address(
&[program_address.as_ref()],
&bpf_loader_upgradeable::id(),
)
.0;
let instruction = bpf_loader_upgradeable::upgrade(
&program_address,
&buffer_address,
&authority_address,
&spill_address,
);
let mut message = Message::new(&[instruction], None);
assert_eq!(
parse_bpf_upgradeable_loader(
&message.instructions[0],
&AccountKeys::new(&message.account_keys, None)
)
.unwrap(),
ParsedInstructionEnum {
instruction_type: "upgrade".to_string(),
info: json!({
"authority": authority_address.to_string(),
"programDataAccount": programdata_address.to_string(),
"programAccount": program_address.to_string(),
"bufferAccount": buffer_address.to_string(),
"spillAccount": spill_address.to_string(),
"rentSysvar": sysvar::rent::ID.to_string(),
"clockSysvar": sysvar::clock::ID.to_string(),
}),
}
);
assert!(parse_bpf_upgradeable_loader(
&message.instructions[0],
&AccountKeys::new(&message.account_keys[0..6], None)
)
.is_err());
let keys = message.account_keys.clone();
message.instructions[0].accounts.pop();
assert!(parse_bpf_upgradeable_loader(
&message.instructions[0],
&AccountKeys::new(&keys, None)
)
.is_err());
} | rust_cleaned_test_functions.jsonl/23418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1016
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
880,
15897,
67794,
480,
22139,
67794,
62686,
368,
341,
286,
1077,
2025,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
4147,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prog() {
let prog = Prog { name: "util", vers: "0.1.0", yr: "2015" };
assert_eq!(prog.name, "util");
assert_eq!(prog.vers, "0.1.0");
assert_eq!(prog.yr, "2015");
} | rust_cleaned_test_functions.jsonl/1076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60390,
368,
341,
262,
1077,
29271,
284,
1298,
70,
314,
829,
25,
330,
1314,
497,
5436,
25,
330,
15,
13,
16,
13,
15,
497,
42338,
25,
330,
17,
15,
16,
20,
1,
2605,
262,
2060,
10714,
10297,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sparse_update_eval() {
let projector = TileCoding::new(SHBuilder::default(), 4, 100);
let mut evaluator = VectorFunction::zeros(projector.dim(), 2);
assert_eq!(evaluator.n_outputs(), 2);
assert_eq!(evaluator.weights.len(), 200);
let features = projector.project(&vec![5.0]);
let _ = evaluator.update(&features, Vector::from_vec(vec![20.0, 50.0]));
let out = evaluator.evaluate(&features).unwrap();
assert!((out[0] - 20.0).abs() < 1e-6);
assert!((out[1] - 50.0).abs() < 1e-6);
} | rust_cleaned_test_functions.jsonl/26872 | {
"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,
71123,
8882,
21296,
368,
341,
286,
1077,
67985,
284,
20744,
77513,
486,
931,
3759,
39,
3297,
486,
2258,
1507,
220,
19,
11,
220,
16,
15,
15,
317,
286,
1077,
5206,
69810,
284,
4196,
5152,
486,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run_func_does_not_exist() {
let map = HashMap::new();
let func = HashMap::<String, Box<EvalFunc>>::new();
match Query::parse("Hello $hi()".to_owned())
.unwrap()
.eval(&map, &func) {
Ok(_) => unreachable!(),
Err(e) => {
match e {
EvalError::FunctionNotFound(_) => (),
}
}
}
} | rust_cleaned_test_functions.jsonl/19218 | {
"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,
14007,
9596,
96374,
7913,
35906,
368,
1476,
286,
1077,
2415,
284,
10528,
486,
931,
1428,
286,
1077,
2915,
284,
10528,
27638,
703,
11,
8261,
23835,
831,
9626,
77595,
931,
1428,
286,
2432,
11361,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_check_unnecessary_braces_in_use_statement() {
check_not_applicable(
"
use a;
use a::{c, d::e};
",
check_unnecessary_braces_in_use_statement,
);
check_apply("use {b};", "use b;", check_unnecessary_braces_in_use_statement);
check_apply("use a::{c};", "use a::c;", check_unnecessary_braces_in_use_statement);
check_apply("use a::{self};", "use a;", check_unnecessary_braces_in_use_statement);
check_apply(
"use a::{c, d::{e}};",
"use a::{c, d::e};",
check_unnecessary_braces_in_use_statement,
);
} | rust_cleaned_test_functions.jsonl/71657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
4907,
94217,
17682,
2434,
1243,
15951,
37404,
368,
341,
286,
1779,
7913,
8191,
46114,
1006,
310,
6228,
310,
990,
264,
280,
310,
990,
264,
22964,
66,
11,
294,
486,
68,
2440,
286,
21796,
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_intersect() {
let segment1 = Segment {
point: (1., 1.),
vector: Vector2D { x: 2., y: 2. },
};
let segment2 = Segment {
point: (0., 2.),
vector: Vector2D { x: 3., y: 0. },
};
let intersect_point = segment1.intersects(&segment2);
assert_eq!(intersect_point, Some((2., 2.)));
} | rust_cleaned_test_functions.jsonl/110313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72747,
368,
341,
286,
1077,
10238,
16,
284,
37103,
341,
310,
1459,
25,
320,
16,
2572,
220,
16,
13,
1326,
310,
4621,
25,
4196,
17,
35,
314,
856,
25,
220,
17,
2572,
379,
25,
220,
17,
13,
115... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_zero_opmask_reg() {
for info in decoder_tests(false, false) {
if (info.decoder_options() & DecoderOptions::NO_INVALID_CHECK) != 0 {
continue;
}
let op_code = info.code().op_code();
if !op_code.require_op_mask_register() {
continue;
}
let mut bytes = to_vec_u8(info.hex_bytes()).unwrap();
let mut orig_instr;
{
let mut decoder = Decoder::new(info.bitness(), &bytes, info.decoder_options());
orig_instr = decoder.decode();
assert_eq!(orig_instr.code(), info.code());
}
let evex_index = get_evex_index(&bytes);
bytes[evex_index + 3] &= 0xF8;
{
let mut decoder = Decoder::new(info.bitness(), &bytes, info.decoder_options());
let instruction = decoder.decode();
assert_eq!(instruction.code(), Code::INVALID);
assert_ne!(decoder.last_error(), DecoderError::None);
}
{
let mut decoder = Decoder::new(info.bitness(), &bytes, info.decoder_options() | DecoderOptions::NO_INVALID_CHECK);
let instruction = decoder.decode();
assert_eq!(instruction.code(), info.code());
assert_eq!(instruction.op_mask(), Register::None);
orig_instr.set_op_mask(Register::None);
assert!(orig_instr.eq_all_bits(&instruction));
}
}
} | rust_cleaned_test_functions.jsonl/82768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
19359,
10287,
11258,
4920,
368,
341,
2023,
3546,
304,
24551,
32509,
3576,
11,
895,
8,
341,
197,
743,
320,
2733,
74047,
8743,
368,
609,
50472,
3798,
486,
8996,
15167,
11780,
8,
961,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_parse_valid_datetime() -> Result<()> {
let mut ctx = EvalContext::default();
let cases = vec![
("2019-09-16 10:11:12", "20190916101112", 0, false),
("2019-09-16 10:11:12", "190916101112", 0, false),
("2019-09-16 10:11:01", "19091610111", 0, false),
("2019-09-16 10:11:00", "1909161011", 0, false),
("2019-09-16 10:01:00", "190916101", 0, false),
("1909-12-10 00:00:00", "19091210", 0, false),
("2021-2023-02-29 10:00:00", "2021-20230229100000", 0, false),
("2019-09-16 01:00:00", "1909161", 0, false),
("2019-09-16 00:00:00", "190916", 0, false),
("2019-09-01 00:00:00", "19091", 0, false),
("2019-09-16 10:11:12.111", "190916101112.111", 3, false),
("2019-09-16 10:11:12.111", "20190916101112.111", 3, false),
("2019-09-16 10:11:12.67", "20190916101112.666", 2, true),
("2019-09-16 10:11:13.0", "20190916101112.999", 1, true),
("2019-09-16 00:00:00", "2019-09-16", 0, false),
("2019-09-16 10:11:12", "2019-09-16 10:11:12", 0, false),
("2019-09-16 10:11:12", "2019-09-16T10:11:12", 0, false),
("2019-09-16 10:11:12.7", "2019-09-16T10:11:12.66", 1, true),
("2019-09-16 10:11:13.0", "2019-09-16T10:11:12.99", 1, true),
("2021-2023-01-01 00:00:00.0", "2019-12-31 23:59:59.99", 1, true),
("2013-05-28 05:12:00", "1305280512.000000000000", 0, true),
("2013-05-28 05:12:00", "1305280512", 0, true),
(
"2021-2023-01-01 00:00:00.0",
" 2019-12-31 23:59:59.99 ",
1,
true,
),
(
"2021-2023-01-01 00:00:00.000000",
"2019-12-31 23:59:59.9999999",
6,
true,
),
(
"2021-2023-01-01 00:00:00.000000",
"2019-12(31-23.59.59.9999999",
6,
true,
),
(
"2021-2023-01-01 00:00:00.000000",
"2019-12(31-23.59.59.9999999",
6,
true,
),
(
"2021-2023-01-01 00:00:00.000000",
"2019-12(31 \t23.59.59.9999999",
6,
true,
),
(
"2019-12-31 23:59:59.999999",
"2019-12-31 23:59:59.9999999",
6,
false,
),
(
"2019-12-31 23:59:59.999",
"2019-12-31 23:59:59.999999",
3,
false,
),
(
"2019-12-31 23:59:59.999",
"2019*12&31T23(59)59.999999",
3,
false,
),
("0000-00-00 00:00:00", "00:00:00", 0, false),
];
for (expected, actual, fsp, round) in cases {
assert_eq!(
expected,
Time::parse_datetime(&mut ctx, actual, fsp, round)?.to_string()
);
}
let should_fail = vec![
("11-12-13 T 12:34:56", 0),
("11:12:13 T12:34:56", 0),
("11:12:13 T12:34:56.12", 7),
("11:12:13T25:34:56.12", 7),
("11:12:13T23:61:56.12", 7),
("11:12:13T23:59:89.12", 7),
("11121311121.1", 2),
("1201012736", 2),
("1201012736.0", 2),
("111213111.1", 2),
("11121311.1", 2),
("1112131.1", 2),
("111213.1", 2),
("111213.1", 2),
("11121.1", 2),
("1112", 2),
];
for (case, fsp) in should_fail {
assert!(Time::parse_datetime(&mut ctx, case, fsp, false).is_err());
}
Ok(())
} | rust_cleaned_test_functions.jsonl/40457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
28943,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
2258,
543,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
15,
16,
24,
12,
15,
24,
12,
16,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_enum_untagged() {
#[derive(Serialize)]
#[serde(untagged)]
enum E {
Unit,
Newtype(u32),
Tuple(u32, u32),
Array(Vec<u32>),
Struct { a: u32 },
Table(std::collections::HashMap<String, u32>),
}
let lua = Lua::new();
lua.context(|lua| {
let u = E::Unit;
let value = to_value(lua, &u).unwrap();
lua.globals().set("value", value).unwrap();
lua.load(r#"
assert(value == nil)
"#).exec().unwrap();
let n = E::Newtype(1);
let value = to_value(lua, &n).unwrap();
lua.globals().set("value", value).unwrap();
lua.load(r#"
assert(value == 1)
"#).exec().unwrap();
let t = E::Tuple(1, 2);
let value = to_value(lua, &t).unwrap();
lua.globals().set("value", value).unwrap();
lua.load(r#"
assert(value[1] == 1)
assert(value[2] == 2)
"#).exec().unwrap();
let t = E::Array(vec![10, 20, 30]);
let value = to_value(lua, &t).unwrap();
lua.globals().set("value", value).unwrap();
lua.load(r#"
assert(value[1] == 10)
assert(value[2] == 20)
assert(value[3] == 30)
"#).exec().unwrap();
let s = E::Struct { a: 1 };
let value = to_value(lua, &s).unwrap();
lua.globals().set("value", value).unwrap();
lua.load(r#"
assert(value["a"] == 1)
"#).exec().unwrap();
let s = E::Table(vec![("b".to_string(), 3)].into_iter().collect());
let value = to_value(lua, &s).unwrap();
lua.globals().set("value", value).unwrap();
lua.load(r#"
assert(value["b"] == 3)
"#).exec()
}).unwrap();
} | rust_cleaned_test_functions.jsonl/4216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
62,
3850,
96476,
368,
341,
286,
11506,
27098,
3759,
9050,
5563,
286,
11506,
47024,
7,
3850,
96476,
5563,
286,
7618,
468,
341,
310,
7954,
345,
310,
1532,
1313,
8154,
18,
17,
1326,
310,
246... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_map() {
let mut hash_map: TermHashMap = TermHashMap::new(18);
{
hash_map.mutate_or_create("abc", |opt_val: Option<u32>| {
assert_eq!(opt_val, None);
3u32
});
}
{
hash_map.mutate_or_create("abcd", |opt_val: Option<u32>| {
assert_eq!(opt_val, None);
4u32
});
}
{
hash_map.mutate_or_create("abc", |opt_val: Option<u32>| {
assert_eq!(opt_val, Some(3u32));
5u32
});
}
let mut vanilla_hash_map = HashMap::new();
let mut iter_values = hash_map.iter();
while let Some((key, addr, _)) = iter_values.next() {
let val: u32 = hash_map.heap.read(addr);
vanilla_hash_map.insert(key.to_owned(), val);
}
assert_eq!(vanilla_hash_map.len(), 2);
} | rust_cleaned_test_functions.jsonl/750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
5376,
368,
341,
286,
1077,
5206,
5175,
5376,
25,
17519,
18497,
284,
17519,
18497,
486,
931,
7,
16,
23,
317,
286,
341,
310,
5175,
5376,
744,
332,
349,
8734,
8657,
445,
13683,
497,
760,
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... | 2 |
#[test]
fn test_bytewise_fold_at_word_boundary_only_whitespace() {
new_ucmd!()
.args(&["-w2", "-s", "-b"])
.pipe_in(" ")
.succeeds()
.stdout_is(" \n ");
} | rust_cleaned_test_functions.jsonl/23311 | {
"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,
3710,
83,
24350,
61187,
3752,
13533,
54004,
18410,
86175,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
17,
497,
6523,
82,
497,
6523,
65,
14108,
286,
659,
13768,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_transform_list_indexes_into_element_ids() {
let actor: ActorID = "8f389df8fecb4ddc989102321af3578e".try_into().unwrap();
let remote_actor: ActorID = "9ba21574dc44411b8ce37bc6037a9687".try_into().unwrap();
let remote1: Change = UncompressedChange {
actor_id: remote_actor.clone(),
seq: 1,
start_op: 1,
time: 0,
message: None,
hash: None,
deps: Vec::new(),
operations: vec![Op {
action: protocol::OpType::Make(ObjType::list()),
key: "birds".into(),
obj: ObjectID::Root,
pred: Vec::new(),
insert: false,
}],
extra_bytes: Vec::new(),
}
.try_into()
.unwrap();
let remote2: Change = UncompressedChange {
actor_id: remote_actor.clone(),
seq: 2,
start_op: 2,
time: 0,
message: None,
hash: None,
deps: vec![remote1.hash],
operations: vec![Op {
action: protocol::OpType::Set("magpie".into()),
obj: ObjectID::from(remote_actor.op_id_at(1)),
key: ElementID::Head.into(),
insert: true,
pred: Vec::new(),
}],
extra_bytes: Vec::new(),
}
.try_into()
.unwrap();
let local1 = UncompressedChange {
actor_id: actor.clone(),
seq: 1,
message: None,
hash: None,
time: 0,
deps: vec![remote1.hash],
start_op: 2,
operations: vec![Op {
obj: ObjectID::from(remote_actor.op_id_at(1)),
action: protocol::OpType::Set("goldfinch".into()),
key: ElementID::Head.into(),
insert: true,
pred: Vec::new(),
}],
extra_bytes: Vec::new(),
};
let local2 = UncompressedChange {
actor_id: actor.clone(),
seq: 2,
message: None,
hash: None,
deps: Vec::new(),
time: 0,
start_op: 3,
operations: vec![Op {
obj: ObjectID::from(remote_actor.op_id_at(1)),
action: protocol::OpType::Set("wagtail".into()),
key: actor.op_id_at(2).into(),
insert: true,
pred: Vec::new(),
}],
extra_bytes: Vec::new(),
};
let local3 = UncompressedChange {
actor_id: actor.clone(),
seq: 3,
message: None,
hash: None,
deps: vec![remote2.hash],
time: 0,
start_op: 4,
operations: vec![
Op {
obj: ObjectID::from(remote_actor.op_id_at(1)),
action: protocol::OpType::Set("Magpie".into()),
key: remote_actor.op_id_at(2).into(),
insert: false,
pred: vec![remote_actor.op_id_at(2)],
},
Op {
obj: ObjectID::from(remote_actor.op_id_at(1)),
action: protocol::OpType::Set("Goldfinch".into()),
key: actor.op_id_at(2).into(),
insert: false,
pred: vec![actor.op_id_at(2)],
},
],
extra_bytes: Vec::new(),
};
let mut expected_change1 = UncompressedChange {
actor_id: actor.clone(),
seq: 1,
start_op: 2,
time: 0,
message: None,
hash: None,
deps: vec![remote1.hash],
operations: vec![Op {
obj: ObjectID::from(remote_actor.op_id_at(1)),
action: protocol::OpType::Set("goldfinch".into()),
key: ElementID::Head.into(),
insert: true,
pred: Vec::new(),
}],
extra_bytes: Vec::new(),
};
let mut expected_change2 = UncompressedChange {
actor_id: actor.clone(),
seq: 2,
start_op: 3,
time: 0,
message: None,
hash: None,
deps: Vec::new(),
operations: vec![Op {
obj: ObjectID::from(remote_actor.op_id_at(1)),
action: protocol::OpType::Set("wagtail".into()),
key: actor.op_id_at(2).into(),
insert: true,
pred: Vec::new(),
}],
extra_bytes: Vec::new(),
};
let mut expected_change3 = UncompressedChange {
actor_id: actor.clone(),
seq: 3,
start_op: 4,
time: 0,
message: None,
hash: None,
deps: Vec::new(),
operations: vec![
Op {
obj: ObjectID::from(remote_actor.op_id_at(1)),
action: protocol::OpType::Set("Magpie".into()),
key: remote_actor.op_id_at(2).into(),
pred: vec![remote_actor.op_id_at(2)],
insert: false,
},
Op {
obj: ObjectID::from(remote_actor.op_id_at(1)),
action: protocol::OpType::Set("Goldfinch".into()),
key: actor.op_id_at(2).into(),
pred: vec![actor.op_id_at(2)],
insert: false,
},
],
extra_bytes: Vec::new(),
};
let mut backend = Backend::init();
backend.apply_changes(vec![remote1.clone()]).unwrap();
backend.apply_local_change(local1).unwrap();
let backend_after_first = backend.clone();
let changes1 = backend_after_first.get_changes(&[remote1.hash]);
let change12 = *changes1.get(0).unwrap();
backend.apply_changes(vec![remote2.clone()]).unwrap();
backend.apply_local_change(local2).unwrap();
let backend_after_second = backend.clone();
let changes2 = backend_after_second.get_changes(&[remote2.hash, change12.hash]);
let change23 = *changes2.get(0).unwrap();
backend.apply_local_change(local3).unwrap();
let changes3 = backend.get_changes(&[remote2.hash, change23.hash]);
let change34 = changes3.get(0).unwrap().decode();
expected_change1.time = change12.time;
expected_change2.time = change23.time;
expected_change2.deps = vec![change12.hash];
expected_change3.time = change34.time;
expected_change3.deps = vec![remote2.hash, change23.hash];
assert_changes_equal(change34, expected_change3);
assert_eq!(change12, &expected_change1.try_into().unwrap());
assert_changes_equal(change23.decode(), expected_change2.clone());
assert_eq!(change23, &expected_change2.try_into().unwrap());
} | rust_cleaned_test_functions.jsonl/22978 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18449,
2019,
50161,
45514,
7894,
8077,
368,
341,
262,
1077,
12089,
25,
24718,
915,
284,
330,
23,
69,
18,
23,
24,
2940,
23,
76526,
65,
19,
631,
66,
24,
23,
24,
16,
15,
17,
18,
17,
16,
2577,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_get_signature_statuses() {
let bob_pubkey = solana_sdk::pubkey::new_rand();
let RpcHandler {
io,
mut meta,
blockhash,
alice,
confirmed_block_signatures,
..
} = start_rpc_handler_with_tx(&bob_pubkey);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getSignatureStatuses","params":[["{}"]]}}"#,
confirmed_block_signatures[0]
);
let res = io.handle_request_sync(&req, meta.clone());
let expected_res: transaction::Result<()> = Ok(());
let json: Value = serde_json::from_str(&res.unwrap()).unwrap();
let result: Option<TransactionStatus> =
serde_json::from_value(json["result"]["value"][0].clone())
.expect("actual response deserialization");
let result = result.as_ref().unwrap();
assert_eq!(expected_res, result.status);
assert_eq!(None, result.confirmations);
// Test getSignatureStatus request on unprocessed tx
let tx = system_transaction::transfer(&alice, &bob_pubkey, 10, blockhash);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getSignatureStatuses","params":[["{}"]]}}"#,
tx.signatures[0]
);
let res = io.handle_request_sync(&req, meta.clone());
let json: Value = serde_json::from_str(&res.unwrap()).unwrap();
let result: Option<TransactionStatus> =
serde_json::from_value(json["result"]["value"][0].clone())
.expect("actual response deserialization");
assert!(result.is_none());
// Test getSignatureStatus request on a TransactionError
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getSignatureStatuses","params":[["{}"]]}}"#,
confirmed_block_signatures[1]
);
let res = io.handle_request_sync(&req, meta.clone());
let expected_res: transaction::Result<()> = Err(TransactionError::InstructionError(
0,
InstructionError::Custom(1),
));
let json: Value = serde_json::from_str(&res.unwrap()).unwrap();
let result: Option<TransactionStatus> =
serde_json::from_value(json["result"]["value"][0].clone())
.expect("actual response deserialization");
assert_eq!(expected_res, result.as_ref().unwrap().status);
meta.config.enable_rpc_transaction_history = false;
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getSignatureStatuses","params":[["{}"], {{"searchTransactionHistory": true}}]}}"#,
confirmed_block_signatures[1]
);
let res = io.handle_request_sync(&req, meta);
assert_eq!(
res,
Some(
r#"{"jsonrpc":"2.0","error":{"code":-32011,"message":"Transaction history is not available from this node"},"id":1}"#.to_string(),
)
);
} | rust_cleaned_test_functions.jsonl/3036 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
39859,
83702,
368,
341,
286,
1077,
35192,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
79961,
3050,
341,
310,
6399,
345,
310,
5206,
8823,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_once_or_up_to_none_large() {
let occurence: Occurrences = Occurrences::OnceOrMore;
occurence.check(core::u16::MAX).unwrap();
} | rust_cleaned_test_functions.jsonl/45928 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7630,
8734,
8237,
2346,
31488,
45228,
368,
341,
286,
1077,
2983,
86937,
25,
19927,
33246,
284,
19927,
33246,
486,
12522,
2195,
7661,
280,
286,
2983,
86937,
9093,
47867,
486,
84,
16,
21,
486,
10586... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_batch_normalize() {
let mut p = ExtendedPoint::from(AffinePoint {
u: Fq([
0xc0115cb656ae4839,
0x623dc3ff81d64c26,
0x5868e739b5794f2c,
0x23bd4fbb18d39c9c,
]),
v: Fq([
0x7588ee6d6dd40deb,
0x9d6d7a23ebdb7c4c,
0x46462e26d4edb8c7,
0x10b4c1517ca82e9b,
]),
}).mul_by_cofactor();
let mut v = vec![];
for _ in 0..10 {
v.push(p);
p = p.double();
}
for p in &v {
assert!(p.is_on_curve_vartime());
}
let expected: std::vec::Vec<_> = v.iter().map(|p| AffinePoint::from(*p)).collect();
let result1: std::vec::Vec<_> = batch_normalize(&mut v).collect();
for i in 0..10 {
assert!(expected[i] == result1[i]);
assert!(v[i].is_on_curve_vartime());
assert!(AffinePoint::from(v[i]) == expected[i]);
}
let result2: std::vec::Vec<_> = batch_normalize(&mut v).collect();
for i in 0..10 {
assert!(expected[i] == result2[i]);
assert!(v[i].is_on_curve_vartime());
assert!(AffinePoint::from(v[i]) == expected[i]);
}
} | rust_cleaned_test_functions.jsonl/103799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 663
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
80807,
368,
341,
262,
1077,
5206,
281,
284,
40565,
2609,
486,
1499,
4346,
542,
482,
2609,
341,
286,
575,
25,
434,
80,
8956,
310,
220,
15,
8148,
15,
16,
16,
20,
7221,
21,
20,
21,
5918,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_challenge_token() {
let mut user_data = [0; NETCODE_USER_DATA_BYTES];
for i in 0..user_data.len() {
user_data[i] = i as u8;
}
let client_id = 5;
let challenge_sequence = 0xFED;
let mut challenge_key = crypto::generate_key();
let challenge_packet =
ChallengePacket::generate(client_id, &user_data, challenge_sequence, &challenge_key)
.unwrap();
let decoded = challenge_packet.decode(&challenge_key).unwrap();
assert_eq!(decoded.client_id, client_id);
for i in 0..user_data.len() {
assert_eq!(user_data[i], decoded.user_data[i]);
}
unsafe {
#[allow(unused_variables)]
let lock = crate::common::test::FFI_LOCK.lock().unwrap();
use crate::capi;
let mut capi_scratch = [0; NETCODE_CHALLENGE_TOKEN_BYTES];
capi_scratch.copy_from_slice(&challenge_packet.token_data);
let decode = capi::netcode_decrypt_challenge_token(
capi_scratch.as_mut_ptr(),
capi_scratch.len() as i32,
challenge_sequence,
challenge_key.as_mut_ptr(),
);
assert_eq!(decode, 1);
let mut native_token: capi::netcode_challenge_token_t = ::std::mem::uninitialized();
let serialize = capi::netcode_read_challenge_token(
capi_scratch.as_mut_ptr(),
capi_scratch.len() as i32,
&mut native_token,
);
assert_eq!(serialize, 1);
assert_eq!(native_token.client_id, client_id);
for i in 0..user_data.len() {
assert_eq!(user_data[i], native_token.user_data[i]);
}
}
} | rust_cleaned_test_functions.jsonl/18959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 799
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
87406,
6458,
368,
341,
262,
1077,
5206,
1196,
1769,
284,
508,
15,
26,
24977,
14866,
9107,
7896,
40705,
935,
262,
369,
600,
304,
220,
15,
496,
872,
1769,
19406,
368,
341,
286,
1196,
1769,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_aggregation_non_mem_star() {
let rng = &mut ChaChaRng::from_seed([0u8; 32]);
for _ in 0..10 {
let int_size_bits = 256;
let mut acc = Accumulator::setup::<RSAGroup, _>(rng, int_size_bits);
// regular add
let xs = (0..5)
.map(|_| rng.gen_prime(int_size_bits))
.collect::<Vec<_>>();
for x in &xs {
acc.add(x);
}
let x = rng.gen_prime(int_size_bits);
let pi = acc.non_mem_wit_create_star(&x);
assert!(acc.ver_non_mem_star(&x, &pi), "invalid ver_non_mem_star");
}
} | rust_cleaned_test_functions.jsonl/96052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
34442,
21637,
12976,
31681,
368,
341,
286,
1077,
28422,
284,
609,
6984,
27721,
95971,
49,
968,
486,
1499,
33809,
2561,
15,
84,
23,
26,
220,
18,
17,
10149,
286,
369,
716,
304,
220,
15,
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... | 3 |
#[test]
fn test_g1_projective_group() {
let mut rng = ark_std::test_rng();
let a: G1Projective = rng.gen();
let b: G1Projective = rng.gen();
group_test(a, b);
} | rust_cleaned_test_functions.jsonl/65018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
16,
16352,
533,
6288,
368,
341,
262,
1077,
5206,
28422,
284,
55217,
15656,
486,
1944,
66849,
543,
262,
1077,
264,
25,
479,
16,
7849,
533,
284,
28422,
22822,
543,
262,
1077,
293,
25,
479,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_allocating_memory_reduces_subnet_available_memory() {
with_setup(
SubnetType::Application,
|exec_env, _, _, routing_table, subnet_records| {
let wasm_binary = wabt::wat2wasm(MEMORY_ALLOCATION_WAT).unwrap();
let tmpdir = tempfile::Builder::new().prefix("test").tempdir().unwrap();
let wasm_embedder = WasmtimeEmbedder::new(EmbeddersConfig::new(), no_op_logger());
let execution_state = wasm_embedder
.create_execution_state(
wasm_binary,
tmpdir.path().into(),
&EmbeddersConfig::default(),
)
.unwrap();
let system_state = SystemStateBuilder::default()
.freeze_threshold(NumSeconds::from(0))
.build();
let mut canister = CanisterState {
system_state,
execution_state: Some(execution_state),
scheduler_state: SchedulerState::default(),
};
let input_message = CanisterInputMessage::Ingress(
IngressBuilder::default()
.method_name("test_without_trap".to_string())
.build(),
);
let subnet_available_memory_bytes_num = 1 << 30;
let subnet_available_memory =
SubnetAvailableMemory::new(subnet_available_memory_bytes_num);
canister.system_state.memory_allocation =
MemoryAllocation::try_from(NumBytes::new(1 << 30)).unwrap();
exec_env.execute_canister_message(
canister,
MAX_NUM_INSTRUCTIONS,
input_message,
mock_time(),
routing_table,
subnet_records,
subnet_available_memory.clone(),
subnet_test_id(0x101), // NNS subnet
);
// The canister allocates 10 wasm pages in the heap and 10 wasm pages of stable
// memory.
let new_memory_allocated = 20 * WASM_PAGE_SIZE_IN_BYTES as i64;
assert_eq!(
subnet_available_memory_bytes_num - new_memory_allocated,
subnet_available_memory.get()
);
},
);
} | rust_cleaned_test_functions.jsonl/56221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14802,
1095,
19195,
1288,
1054,
1603,
95681,
26962,
19195,
368,
341,
262,
448,
21363,
1006,
286,
3719,
4711,
929,
486,
4988,
345,
286,
760,
11748,
15879,
11,
8358,
8358,
29058,
5237,
11,
51457,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffer_bitand_different_sizes() {
let buf1 = Buffer::from([1_u8, 1_u8]);
let buf2 = Buffer::from([0b01001110]);
let _buf3 = (&buf1 | &buf2).unwrap();
} | rust_cleaned_test_functions.jsonl/20571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
13996,
437,
82741,
32159,
368,
341,
286,
1077,
6607,
16,
284,
10312,
486,
1499,
2561,
16,
7300,
23,
11,
220,
16,
7300,
23,
2558,
286,
1077,
6607,
17,
284,
10312,
486,
1499,
2561,
15,
65,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq2_get_b() {
use ff::Field;
let mut a = Fq2::one();
a.mul_by_nonresidue();
let mut b = a.inverse().unwrap();
let c = b;
b.double();
b.add_assign(&c);
print!("B coeff in Fq2 = {}\n", b);
} | rust_cleaned_test_functions.jsonl/100940 | {
"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,
761,
80,
17,
3062,
880,
368,
341,
262,
990,
25539,
486,
1877,
401,
262,
1077,
5206,
264,
284,
434,
80,
17,
486,
603,
543,
262,
264,
53141,
3710,
21637,
416,
60607,
543,
262,
1077,
5206,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_link_ctor() {
assert_eq!(
GiDocgen::from_str("[ctor@Gtk.Box.new]"),
Ok(GiDocgen::Constructor {
namespace: Some("Gtk".to_string()),
type_: "Box".to_string(),
name: "new".to_string(),
})
);
assert_eq!(
GiDocgen::from_str("[ctor@Button.new_with_label]"),
Ok(GiDocgen::Constructor {
namespace: None,
type_: "Button".to_string(),
name: "new_with_label".to_string(),
})
);
} | rust_cleaned_test_functions.jsonl/78477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
54185,
368,
341,
286,
2060,
10714,
33673,
310,
15392,
9550,
4370,
486,
1499,
2895,
10937,
4904,
31,
45103,
54484,
4618,
60,
4461,
310,
7622,
6699,
72,
9550,
4370,
486,
13288,
341,
394,
4473,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cleanup() {
let tmpdir = tempfile::tempdir().unwrap();
{
let mut tmpfile = tempfile::tempfile_in(&tmpdir).unwrap();
write!(tmpfile, "abcde").unwrap();
}
let num_files = fs::read_dir(&tmpdir).unwrap().count();
assert!(num_files == 0);
} | rust_cleaned_test_functions.jsonl/100759 | {
"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,
42444,
368,
341,
262,
1077,
4174,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
341,
286,
1077,
5206,
4174,
1192,
284,
54819,
486,
3888,
1192,
1243,
2099,
5173,
3741,
568,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_field_df_example() {
// df -B1 | numfmt --header --field 2-4 --to=si
new_ucmd!()
.args(&["--header", "--field", "2-4", "--to=si"])
.pipe_in_fixture("df_input.txt")
.succeeds()
.stdout_is_fixture("df_expected.txt");
} | rust_cleaned_test_functions.jsonl/46022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
10894,
39304,
368,
341,
262,
442,
6764,
481,
33,
16,
760,
1629,
12501,
1177,
2708,
1177,
2566,
220,
17,
12,
19,
1177,
983,
28,
6321,
198,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stdin_number_non_blank() {
for same_param in vec!["-b", "--number-nonblank"] {
new_ucmd!()
.arg(same_param)
.arg("-")
.pipe_in("\na\nb\n\n\nc")
.succeeds()
.stdout_only("\n 1\ta\n 2\tb\n\n\n 3\tc");
}
} | rust_cleaned_test_functions.jsonl/90939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
5500,
21637,
56103,
368,
341,
262,
369,
1852,
4090,
304,
7486,
0,
1183,
12,
65,
497,
14482,
4082,
98700,
10189,
1341,
341,
286,
501,
68887,
2277,
0,
741,
310,
659,
858,
1141,
373,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_compare_version() {
assert_eq!(compare_version("0.0.1", "0.0.2"), 1);
assert_eq!(compare_version("0.0.3", "0.0.1"), -1);
assert_eq!(compare_version("1.2.3", "1.2.3"), 0);
assert_eq!(compare_version("0.2.1", "0.1.1"), -1);
assert_eq!(compare_version("0.2.1", "3.1.1"), 1);
assert_eq!(compare_version("4.2.1", "4.1.1"), -1);
assert_eq!(compare_version("0.0.0", "0.0.12"), 1);
assert_eq!(compare_version("0.1.2", "0.1.2"), 0);
assert_eq!(compare_version("1.0.0", "0.0.0"), -1);
assert_eq!(compare_version("1.1.2", "1.2.0"), 1);
assert_eq!(compare_version("0.1.8", "0.2.0"), 1);
assert_eq!(compare_version("1", "2"), 1);
} | rust_cleaned_test_functions.jsonl/49961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32235,
9438,
368,
341,
286,
2060,
10714,
10297,
18948,
9438,
445,
15,
13,
15,
13,
16,
497,
330,
15,
13,
15,
13,
17,
3975,
220,
16,
317,
286,
2060,
10714,
10297,
18948,
9438,
445,
15,
13,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_module_imported_memories_limit() {
let limits = ModuleLimits {
imported_memories: 0,
..Default::default()
};
let mut module = Module::default();
module.memory_plans.push(MemoryPlan {
style: MemoryStyle::Static { bound: 0 },
memory: Memory {
minimum: 0,
maximum: None,
shared: false,
memory64: false,
},
pre_guard_size: 0,
offset_guard_size: 0,
});
assert!(limits.validate(&module).is_ok());
module.num_imported_memories = 1;
assert_eq!(
limits.validate(&module).map_err(|e| e.to_string()),
Err("imported memories count of 1 exceeds the limit of 0".into())
);
} | rust_cleaned_test_functions.jsonl/48861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
18434,
291,
12976,
2433,
14763,
368,
341,
286,
1077,
13388,
284,
13711,
94588,
341,
310,
24928,
12976,
2433,
25,
220,
15,
345,
310,
5241,
3675,
486,
2258,
741,
286,
3634,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_introduce_var_last_expr() {
covers!(test_introduce_var_last_expr);
check_assist(
introduce_variable,
"
fn foo() {
bar(<|>1 + 1<|>)
}",
"
fn foo() {
let <|>var_name = 1 + 1;
bar(var_name)
}",
);
check_assist(
introduce_variable,
"
fn foo() {
<|>bar(1 + 1)<|>
}",
"
fn foo() {
let <|>var_name = bar(1 + 1);
var_name
}",
)
} | rust_cleaned_test_functions.jsonl/108755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
47845,
4612,
12195,
21915,
368,
341,
286,
14521,
10297,
1944,
4042,
47845,
4612,
12195,
21915,
317,
286,
1779,
12083,
380,
1006,
310,
19131,
14635,
345,
310,
6228,
8822,
15229,
368,
341,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_serialization_params_fail_read() {
let toml_file: tempfile::NamedTempFile = tempfile::NamedTempFile::new().ok().unwrap();
let reader: Box<dyn Read> = Box::new(std::fs::File::open(toml_file.path()).unwrap());
// Try to write unexisting file
assert!(deserialize::<UserConfig>(reader).is_err());
} | rust_cleaned_test_functions.jsonl/16004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
25602,
2022,
6745,
22121,
6443,
368,
341,
286,
1077,
311,
1014,
2458,
25,
54819,
486,
15810,
12151,
1703,
284,
54819,
486,
15810,
12151,
1703,
486,
931,
1005,
562,
1005,
15454,
543,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_huge_request() {
let env = init_cluster(1);
let mut s = String::new();
for _ in 0..100000 {
s.push('a');
}
let r = Client::to(0, env.clone()).set_rep("k1", &s, 1);
assert!(r.is_ok());
let r = Client::to(0, env.clone()).set_rep("k2", &s, 2);
assert!(r.is_ok());
let r = Client::to(0, env.clone()).set_rep("k3", &s, 10);
assert!(r.is_ok());
let r = Client::to(0, env.clone()).set_rep("k4", &s, 100);
assert!(r.is_ok());
let r = Client::to(0, env.clone()).set_rep("k5", &s, 1000);
assert!(r.is_ok());
let x = Client::to(0, env.clone()).get("k5").unwrap();
assert_eq!(x.0.unwrap().len(), 100_000_000);
} | rust_cleaned_test_functions.jsonl/62221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
4733,
7893,
368,
341,
262,
1077,
6105,
284,
2930,
28441,
7,
16,
317,
1066,
262,
1077,
5206,
274,
284,
923,
486,
931,
543,
262,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
15,
15,
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_onchain_to_onchain_claim() {
// on downstream peer's remote commitment tx.
// channel.
// gets broadcast.
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
// Create some initial channels
let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let chan_2 = create_announced_chan_between_nodes(&nodes, 1, 2, InitFeatures::known(), InitFeatures::known());
// Ensure all nodes are at the same height
let node_max_height = nodes.iter().map(|node| node.blocks.lock().unwrap().len()).max().unwrap() as u32;
connect_blocks(&nodes[0], node_max_height - nodes[0].best_block_info().1);
connect_blocks(&nodes[1], node_max_height - nodes[1].best_block_info().1);
connect_blocks(&nodes[2], node_max_height - nodes[2].best_block_info().1);
send_payment(&nodes[0], &vec!(&nodes[1], &nodes[2])[..], 8000000);
send_payment(&nodes[0], &vec!(&nodes[1], &nodes[2])[..], 8000000);
let (payment_preimage, _payment_hash, _payment_secret) = route_payment(&nodes[0], &vec!(&nodes[1], &nodes[2]), 3000000);
let commitment_tx = get_local_commitment_txn!(nodes[2], chan_2.2);
check_spends!(commitment_tx[0], chan_2.3);
nodes[2].node.claim_funds(payment_preimage);
check_added_monitors!(nodes[2], 1);
let updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert_eq!(updates.update_fulfill_htlcs.len(), 1);
assert!(updates.update_fail_malformed_htlcs.is_empty());
mine_transaction(&nodes[2], &commitment_tx[0]);
check_closed_broadcast!(nodes[2], true);
check_added_monitors!(nodes[2], 1);
check_closed_event!(nodes[2], 1, ClosureReason::CommitmentTxConfirmed);
let c_txn = nodes[2].tx_broadcaster.txn_broadcasted.lock().unwrap().clone();
assert_eq!(c_txn.len(), 3);
assert_eq!(c_txn[0], c_txn[2]);
assert_eq!(commitment_tx[0], c_txn[1]);
check_spends!(c_txn[1], chan_2.3);
check_spends!(c_txn[2], c_txn[1]);
assert_eq!(c_txn[1].input[0].witness.clone().last().unwrap().len(), 71);
assert_eq!(c_txn[2].input[0].witness.clone().last().unwrap().len(), ACCEPTED_HTLC_SCRIPT_WEIGHT);
assert!(c_txn[0].output[0].script_pubkey.is_v0_p2wsh()); // revokeable output
assert_eq!(c_txn[0].lock_time, 0); // Success tx
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42};
connect_block(&nodes[1], &Block { header, txdata: vec![c_txn[1].clone(), c_txn[2].clone()]});
check_added_monitors!(nodes[1], 1);
let events = nodes[1].node.get_and_clear_pending_events();
assert_eq!(events.len(), 2);
match events[0] {
Event::ChannelClosed { reason: ClosureReason::CommitmentTxConfirmed, .. } => {}
_ => panic!("Unexpected event"),
}
match events[1] {
Event::PaymentForwarded { fee_earned_msat, claim_from_onchain_tx } => {
assert_eq!(fee_earned_msat, Some(1000));
assert_eq!(claim_from_onchain_tx, true);
},
_ => panic!("Unexpected event"),
}
{
let mut b_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
// ChannelMonitor: claim tx
assert_eq!(b_txn.len(), 1);
check_spends!(b_txn[0], chan_2.3);
b_txn.clear();
}
check_added_monitors!(nodes[1], 1);
let msg_events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(msg_events.len(), 3);
match msg_events[0] {
MessageSendEvent::BroadcastChannelUpdate { .. } => {},
_ => panic!("Unexpected event"),
}
match msg_events[1] {
MessageSendEvent::HandleError { action: ErrorAction::SendErrorMessage { .. }, node_id: _ } => {},
_ => panic!("Unexpected event"),
}
match msg_events[2] {
MessageSendEvent::UpdateHTLCs { ref node_id, updates: msgs::CommitmentUpdate { ref update_add_htlcs, ref update_fulfill_htlcs, ref update_fail_htlcs, ref update_fail_malformed_htlcs, .. } } => {
assert!(update_add_htlcs.is_empty());
assert!(update_fail_htlcs.is_empty());
assert_eq!(update_fulfill_htlcs.len(), 1);
assert!(update_fail_malformed_htlcs.is_empty());
assert_eq!(nodes[0].node.get_our_node_id(), *node_id);
},
_ => panic!("Unexpected event"),
};
// Broadcast A's commitment tx on B's chain to see if we are able to claim inbound HTLC with our HTLC-Success tx
let commitment_tx = get_local_commitment_txn!(nodes[0], chan_1.2);
mine_transaction(&nodes[1], &commitment_tx[0]);
check_closed_event!(nodes[1], 1, ClosureReason::CommitmentTxConfirmed);
let b_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(b_txn.len(), 3);
check_spends!(b_txn[1], chan_1.3);
check_spends!(b_txn[2], b_txn[1]);
check_spends!(b_txn[0], commitment_tx[0]);
assert_eq!(b_txn[0].input[0].witness.clone().last().unwrap().len(), OFFERED_HTLC_SCRIPT_WEIGHT);
assert!(b_txn[0].output[0].script_pubkey.is_v0_p2wpkh()); // direct payment
assert_eq!(b_txn[0].lock_time, 0); // Success tx
check_closed_broadcast!(nodes[1], true);
check_added_monitors!(nodes[1], 1);
} | rust_cleaned_test_functions.jsonl/16907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4470,
8819,
2346,
4470,
8819,
84969,
368,
341,
1572,
197,
322,
389,
51352,
14397,
594,
8699,
15155,
9854,
624,
11120,
197,
322,
5496,
624,
1572,
197,
322,
5221,
12899,
382,
10217,
26023,
1645,
183... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_update_default_vote_policy() {
let council = vec![accounts(0), accounts(1)];
let mut policy = default_policy(council);
assert_eq!(
WeightKind::RoleWeight,
policy.default_vote_policy.weight_kind
);
assert_eq!(U128(0), policy.default_vote_policy.quorum);
assert_eq!(
WeightOrRatio::Ratio(1, 2),
policy.default_vote_policy.threshold
);
let new_default_vote_policy = VotePolicy {
weight_kind: WeightKind::TokenWeight,
quorum: U128(100),
threshold: WeightOrRatio::Ratio(1, 4),
};
policy.update_default_vote_policy(&new_default_vote_policy);
assert_eq!(
new_default_vote_policy.weight_kind,
policy.default_vote_policy.weight_kind
);
assert_eq!(
new_default_vote_policy.quorum,
policy.default_vote_policy.quorum
);
assert_eq!(
new_default_vote_policy.threshold,
policy.default_vote_policy.threshold
);
} | rust_cleaned_test_functions.jsonl/132767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 558
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
9993,
54360,
22773,
368,
341,
286,
1077,
14833,
284,
7486,
20703,
26206,
7,
15,
701,
9618,
7,
16,
12587,
286,
1077,
5206,
4842,
284,
1638,
22773,
1337,
6690,
626,
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_sort() {
let a = Int32Chunked::new_from_slice("a", &[1, 9, 3, 2]);
let b = a
.sort(false)
.into_iter()
.map(|opt| opt.unwrap())
.collect::<Vec<_>>();
assert_eq!(b, [1, 2, 3, 9]);
let a = Utf8Chunked::new_from_slice("a", &["b", "a", "c"]);
let a = a.sort(false);
let b = a.into_iter().collect::<Vec<_>>();
assert_eq!(b, [Some("a"), Some("b"), Some("c")]);
} | rust_cleaned_test_functions.jsonl/22180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
28304,
291,
486,
931,
5673,
26488,
445,
64,
497,
44590,
16,
11,
220,
24,
11,
220,
18,
11,
220,
17,
2558,
286,
1077,
293,
284,
264,
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_all_parameters_blake2sp() {
let mut params = blake2sp::Params::new();
params
.hash_length(18)
// Make sure a shorter key properly overwrites a longer one.
.key(b"not the real key")
.key(b"bar");
// Check the State API.
assert_eq!(
"947d4c671e2794f5e1a57daeca97bb46ed66",
¶ms.to_state().update(b"foo").finalize().to_hex()
);
// Check the all-at-once API.
assert_eq!(
"947d4c671e2794f5e1a57daeca97bb46ed66",
¶ms.hash(b"foo").to_hex()
);
} | rust_cleaned_test_functions.jsonl/10644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
18263,
13141,
726,
17,
2154,
368,
341,
262,
1077,
5206,
3628,
284,
1501,
726,
17,
2154,
486,
4870,
486,
931,
543,
262,
3628,
198,
286,
659,
8296,
5118,
7,
16,
23,
340,
286,
442,
7405,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_conversion_no_metadata() {
let sr = meta_search::SearchRequest {
key: Some("key".to_string()),
resource_type: Some(meta_search::ResourceType::Dataset as i32),
conditions: vec![],
pagination: None,
};
let spec: SearchSpec = sr.try_into().unwrap();
let query = spec.filter;
let expected = mongodb::bson::doc! {
"resource_type" : meta_search::ResourceType::Dataset as i32,
"key": "key"
};
assert_eq!(super::DEFAULT_PAGE, spec.page);
assert_eq!(super::DEFAULT_PAGE_SIZE, spec.page_size);
assert_eq!(expected, query);
} | rust_cleaned_test_functions.jsonl/113862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
64132,
6536,
22220,
368,
341,
286,
1077,
18962,
284,
8823,
10716,
486,
5890,
1900,
341,
310,
1376,
25,
4329,
445,
792,
3263,
983,
3904,
14702,
310,
5101,
1819,
25,
4329,
45119,
10716,
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_set_b() {
let mut cpu: CPU = CPU::new();
let pc = cpu.pc;
cpu = cpu.set_b(Register { value: 0 });
cpu.memory.write_64bit(1, 10);
cpu = execute_set(cpu, pc, 0b001);
assert_eq!(cpu.pc.value, 9);
assert_eq!(cpu.f.value, 0);
assert_eq!(cpu.b.value, 10);
} | rust_cleaned_test_functions.jsonl/123553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
880,
368,
341,
286,
1077,
5206,
17319,
25,
13940,
284,
13940,
486,
931,
543,
286,
1077,
13312,
284,
17319,
53335,
401,
286,
17319,
284,
17319,
980,
880,
79203,
314,
897,
25,
220,
15,
1625,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_auto_gc_a_round_without_rewind() {
// First region starts with empty and last region ends with empty.
let regions = vec![
(b"".to_vec(), b"1".to_vec(), 1),
(b"1".to_vec(), b"2".to_vec(), 2),
(b"3".to_vec(), b"4".to_vec(), 3),
(b"7".to_vec(), b"".to_vec(), 4),
];
test_auto_gc(
regions,
vec![233],
vec![(1, 233), (2, 233), (3, 233), (4, 233)],
);
// First region doesn't starts with empty and last region doesn't ends with empty.
let regions = vec![
(b"0".to_vec(), b"1".to_vec(), 1),
(b"1".to_vec(), b"2".to_vec(), 2),
(b"3".to_vec(), b"4".to_vec(), 3),
(b"7".to_vec(), b"8".to_vec(), 4),
];
test_auto_gc(
regions,
vec![233],
vec![(1, 233), (2, 233), (3, 233), (4, 233)],
);
} | rust_cleaned_test_functions.jsonl/4820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27740,
49423,
4306,
29896,
39904,
1288,
19154,
368,
341,
286,
442,
5512,
5537,
8471,
448,
4287,
323,
1537,
5537,
10335,
448,
4287,
624,
286,
1077,
13604,
284,
7486,
90515,
310,
320,
65,
69355,
983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_smoke() {
use rand::Rng;
let mut rng = rand::thread_rng();
let learning_rate = 0.01;
let (image_depth, image_rows, image_cols) = (3, 9, 9);
let image_dimensions = vec![image_depth, image_rows, image_cols];
let output_dimensions = vec![1, 2, 2];
let input_size = image_dimensions.iter().product();
let output_size = output_dimensions.iter().product();
let initializer = initializer::he();
let activation = activation::relu();
let mut l1 = Conv::new(
(16, image_depth, 3, 3),
(2, 2),
&initializer,
Some(activation),
);
let mut l2 = Conv::new((1, 16, 2, 2), (2, 2), &initializer, None);
for _ in 0..8 {
let input = Array::from((
image_dimensions.clone(),
(0..input_size)
.map(|_| rng.gen_range(-1.0..1.0))
.collect::<Vec<Float>>(),
));
let target = Array::from((
output_dimensions.clone(),
(0..output_size)
.map(|i| input[i] / 2.0)
.collect::<Vec<Float>>(),
));
let r1 = l1.forward(input);
let r2 = l2.forward(r1);
let error = (&target - &r2).powf(2.0);
error.backward(None);
let mut parameters = l1.parameters();
parameters.append(&mut l2.parameters());
for parameter in parameters {
let gradient = parameter.gradient().to_owned().unwrap();
parameter.stop_tracking();
*parameter = &*parameter - &(&gradient * learning_rate);
parameter.start_tracking();
*parameter.gradient_mut() = None;
}
}
} | rust_cleaned_test_functions.jsonl/106562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 990
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15874,
4740,
368,
341,
286,
990,
10382,
486,
49,
968,
280,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
1428,
286,
1077,
6832,
9246,
284,
220,
15,
13,
15,
16,
401,
286,
1077,
320,
180... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_query() {
let perms1 = Permissions {
read: UnaryPermission {
global_state: PermissionState::Granted,
..Default::default()
},
write: UnaryPermission {
global_state: PermissionState::Granted,
..Default::default()
},
net: UnaryPermission {
global_state: PermissionState::Granted,
..Default::default()
},
env: PermissionState::Granted,
run: PermissionState::Granted,
plugin: PermissionState::Granted,
hrtime: PermissionState::Granted,
};
let perms2 = Permissions {
read: UnaryPermission {
global_state: PermissionState::Prompt,
granted_list: resolve_fs_allowlist(&[PathBuf::from("/foo")]),
..Default::default()
},
write: UnaryPermission {
global_state: PermissionState::Prompt,
granted_list: resolve_fs_allowlist(&[PathBuf::from("/foo")]),
..Default::default()
},
net: UnaryPermission {
global_state: PermissionState::Prompt,
granted_list: ["127.0.0.1:8000".to_string()].iter().cloned().collect(),
..Default::default()
},
env: PermissionState::Prompt,
run: PermissionState::Prompt,
plugin: PermissionState::Prompt,
hrtime: PermissionState::Prompt,
};
#[rustfmt::skip]
{
assert_eq!(perms1.query_read(&None), PermissionState::Granted);
assert_eq!(perms1.query_read(&Some(&Path::new("/foo"))), PermissionState::Granted);
assert_eq!(perms2.query_read(&None), PermissionState::Prompt);
assert_eq!(perms2.query_read(&Some(&Path::new("/foo"))), PermissionState::Granted);
assert_eq!(perms2.query_read(&Some(&Path::new("/foo/bar"))), PermissionState::Granted);
assert_eq!(perms1.query_write(&None), PermissionState::Granted);
assert_eq!(perms1.query_write(&Some(&Path::new("/foo"))), PermissionState::Granted);
assert_eq!(perms2.query_write(&None), PermissionState::Prompt);
assert_eq!(perms2.query_write(&Some(&Path::new("/foo"))), PermissionState::Granted);
assert_eq!(perms2.query_write(&Some(&Path::new("/foo/bar"))), PermissionState::Granted);
assert_eq!(perms1.query_net_url(&None).unwrap(), PermissionState::Granted);
assert_eq!(perms1.query_net_url(&Some("http://127.0.0.1:8000")).unwrap(), PermissionState::Granted);
assert_eq!(perms2.query_net_url(&None).unwrap(), PermissionState::Prompt);
assert_eq!(perms2.query_net_url(&Some("http://127.0.0.1:8000")).unwrap(), PermissionState::Granted);
assert_eq!(perms1.query_env(), PermissionState::Granted);
assert_eq!(perms2.query_env(), PermissionState::Prompt);
assert_eq!(perms1.query_run(), PermissionState::Granted);
assert_eq!(perms2.query_run(), PermissionState::Prompt);
assert_eq!(perms1.query_plugin(), PermissionState::Granted);
assert_eq!(perms2.query_plugin(), PermissionState::Prompt);
assert_eq!(perms1.query_hrtime(), PermissionState::Granted);
assert_eq!(perms2.query_hrtime(), PermissionState::Prompt);
};
} | rust_cleaned_test_functions.jsonl/121180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
368,
341,
262,
1077,
82282,
16,
284,
53357,
341,
414,
1349,
25,
86951,
14966,
341,
286,
3644,
4387,
25,
18135,
1397,
486,
55481,
345,
286,
5241,
3675,
486,
2258,
741,
414,
1153,
414,
3270,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate_all_controllers() {
let mut controllers = Default::default();
let h: *const c_void = std::ptr::null();
unsafe {
cgroup_init();
let mut ret = cgroup_get_all_controller_begin(&h as *const *const c_void, &mut controllers);
assert!(ret == 0);
while ret == 0 {
println!("{}",
CStr::from_ptr(controllers.name.as_ptr()).to_string_lossy().into_owned());
println!("{}", controllers.num_cgroups);
ret = cgroup_get_all_controller_next(&h as *const *const c_void, &mut controllers);
}
if ret != ECGEOF {
println!("{}",
CStr::from_ptr(cgroup_strerror(ret)).to_string_lossy().into_owned());
}
assert!(ret == ECGEOF);
ret = cgroup_get_all_controller_end(&h as *const *const c_void);
if ret != 0 {
println!("{}",
CStr::from_ptr(cgroup_strerror(ret)).to_string_lossy().into_owned());
}
assert!(ret == 0);
}
} | rust_cleaned_test_functions.jsonl/131015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
5705,
10260,
7273,
368,
341,
262,
1077,
5206,
26225,
284,
7899,
486,
2258,
543,
262,
1077,
305,
25,
353,
1024,
272,
37775,
284,
1460,
486,
3505,
486,
2921,
1428,
262,
19860,
341,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_find() {
let v: &[isize] = &[1, 3, 9, 27, 103, 14, 11];
assert_eq!(*v.iter().find(|&&x| x & 1 == 0).unwrap(), 14);
assert_eq!(*v.iter().find(|&&x| x % 3 == 0).unwrap(), 3);
assert!(v.iter().find(|&&x| x % 12 == 0).is_none());
} | rust_cleaned_test_functions.jsonl/25932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
368,
341,
262,
1077,
348,
25,
44590,
285,
551,
60,
284,
44590,
16,
11,
220,
18,
11,
220,
24,
11,
220,
17,
22,
11,
220,
16,
15,
18,
11,
220,
16,
19,
11,
220,
16,
16,
935,
262,
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... | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.