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_decimal_null() {
let a = create_decimal_array(&[Some(8_887_000_000), None, Some(-8_887_000_000)]);
let b = create_decimal_array(&[Some(8_887_000_000), None, Some(-8_887_000_000)]);
test_equal(a.as_ref(), b.as_ref(), true);
let b = create_decimal_array(&[Some(8_887_000_000), Some(-8_887_000_000), None]);
test_equal(a.as_ref(), b.as_ref(), false);
let b = create_decimal_array(&[Some(15_887_000_000), None, Some(-8_887_000_000)]);
test_equal(a.as_ref(), b.as_ref(), false);
} | rust_cleaned_test_functions.jsonl/46955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
15162,
368,
341,
286,
1077,
264,
284,
1855,
74429,
3858,
2099,
58,
8373,
7,
23,
62,
23,
23,
22,
62,
15,
15,
15,
62,
15,
15,
15,
701,
2240,
11,
4329,
4080,
23,
62,
23,
23,
22,
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_block_impacted_by_ray() {
let mut map = chunk_map();
assert_eq!(
block_impacted_by_ray(&map, vec3(0.0, 65.0, 0.0), vec3(0.0, -1.0, 0.0), 5.0),
Some(RayImpact {
block: BlockPosition::new(0, 64, 0),
pos: position!(0.0, 65.0, 0.0),
face: Side::TOP,
})
);
assert_eq!(
block_impacted_by_ray(&map, vec3(0.0, 65.0, 0.0), vec3(0.0, 1.0, 0.0), 256.0),
None
);
assert_eq!(
block_impacted_by_ray(&map, vec3(0.0, 70.0, 0.0), vec3(0.0, -1.0, 0.0), 5.0),
None
);
map.set_block_at(BlockPosition::new(1, 65, 1), Block::Stone)
.unwrap();
assert_eq!(
block_impacted_by_ray(&map, vec3(0.0, 66.0, 0.0), vec3(1.0, -1.0, 1.0), 5.0),
Some(RayImpact {
block: BlockPosition::new(1, 65, 1),
pos: position!(1.0, 65.0, 1.0),
face: Side::WEST, // This should be three faces—see the TODO above
})
);
} | rust_cleaned_test_functions.jsonl/130412 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 680
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
36788,
22167,
3710,
72690,
368,
341,
286,
1077,
5206,
2415,
284,
11879,
5376,
1428,
286,
2060,
10714,
33673,
310,
2504,
36788,
22167,
3710,
72690,
2099,
2186,
11,
7486,
18,
7,
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_none_if_disabled() {
let expected = None;
let actual = ModuleRenderer::new("container")
// For a custom config
.config(toml::toml! {
[container]
disabled = true
})
// Run the module and collect the output
.collect();
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/23794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31488,
11119,
51401,
368,
341,
286,
1077,
3601,
284,
2240,
280,
286,
1077,
5042,
284,
13711,
11541,
486,
931,
445,
3586,
1138,
310,
442,
1752,
264,
2526,
2193,
198,
310,
659,
1676,
1155,
316,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_parse() {
let fmt = "Hello, my name is %s and I'm %d years old";
let expected = Ok(CFormatString {
format_parts: vec![
(0, CFormatPart::Literal("Hello, my name is ".to_string())),
(
18,
CFormatPart::Spec(CFormatSpec {
format_type: CFormatType::String(CFormatPreconversor::Str),
format_char: 's',
chars_consumed: 2,
mapping_key: None,
min_field_width: None,
precision: None,
flags: CConversionFlags::empty(),
}),
),
(20, CFormatPart::Literal(" and I'm ".to_string())),
(
29,
CFormatPart::Spec(CFormatSpec {
format_type: CFormatType::Number(CNumberType::Decimal),
format_char: 'd',
chars_consumed: 2,
mapping_key: None,
min_field_width: None,
precision: None,
flags: CConversionFlags::empty(),
}),
),
(31, CFormatPart::Literal(" years old".to_string())),
],
});
let result = fmt.parse::<CFormatString>();
assert_eq!(
result, expected,
"left = {:#?} \n\n\n right = {:#?}",
result, expected
);
} | rust_cleaned_test_functions.jsonl/37690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 994
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
21039,
368,
341,
286,
1077,
8879,
284,
330,
9707,
11,
847,
829,
374,
1018,
82,
323,
358,
2776,
1018,
67,
1635,
2310,
876,
286,
1077,
3601,
284,
7622,
3025,
4061,
703,
341,
310,
3561,
332... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_profile() {
let base_path = expand_tilde(&PathBuf::from("~/data")).unwrap();
let last_offset_file = PathBuf::from("consumer.offset");
let profile_path = get_base_dir().join(PROFILE_FULL);
let profile_file = Config::load(&profile_path);
if let Err(err) = &profile_file {
println!("{:?}", err);
};
assert!(profile_file.is_ok());
let expected = Profile {
data: Data {
base_path: base_path.clone(),
last_offset_file: base_path.join(last_offset_file.clone()),
},
database: Database {
ip_or_host: "localhost".to_owned(),
port: Some(3306),
user: "root".to_owned(),
password: Some("root".to_owned()),
},
filters: Some(Filters::Exclude {
exclude_dbs: vec!["mysql".to_owned(), "sys".to_owned()],
}),
fluvio: Some(Fluvio {
topic: "rust-mysql-cdc".to_owned(),
}),
};
let profile = profile_file.as_ref().unwrap().profile();
assert_eq!(profile, &expected);
assert_eq!(
profile.last_offset_file(),
&base_path.join(last_offset_file)
);
assert_eq!(profile.ip_or_host(), Some("localhost".to_owned()));
assert_eq!(profile.port(), 3306);
assert_eq!(profile.user(), Some("root".to_owned()));
assert_eq!(profile.password(), Some("root".to_owned()));
assert_eq!(profile.topic(), "rust-mysql-cdc".to_owned());
} | rust_cleaned_test_functions.jsonl/99223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 830
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
13789,
368,
341,
286,
1077,
2331,
2638,
284,
9225,
528,
34276,
2099,
1820,
15064,
486,
1499,
50919,
691,
15197,
15454,
543,
286,
1077,
1537,
6917,
2458,
284,
7933,
15064,
486,
1499,
445,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vec143_2() -> Result<()> {
zebra_test::init();
let transaction = ZIP143_2.zcash_deserialize_into::<Transaction>()?;
let value = hex::decode("2f6e04963b4c0100")?.zcash_deserialize_into::<Amount<_>>()?;
let lock_script = Script(hex::decode("0153")?);
let input_ind = 1;
let hasher = SigHasher::new(
&transaction,
HashType::SINGLE,
NetworkUpgrade::Overwinter,
Some((input_ind, transparent::Output { value, lock_script })),
);
assert_hash_eq!("03000080", hasher, hash_header);
assert_hash_eq!("7082c403", hasher, hash_groupid);
assert_hash_eq!(
"92b8af1f7e12cb8de105af154470a2ae0a11e64a24a514a562ff943ca0f35d7f",
hasher,
hash_prevouts
);
assert_hash_eq!(
"0000000000000000000000000000000000000000000000000000000000000000",
hasher,
hash_sequence
);
assert_hash_eq!(
"edc32cce530f836f7c31c53656f859f514c3ff8dcae642d3e17700fdc6e829a4",
hasher,
hash_outputs
);
assert_hash_eq!(
"f59e41b40f3a60be90bee2be11b0956dfff06a6d8e22668c4f215bd87b20d514",
hasher,
hash_joinsplits
);
assert_hash_eq!("97b0e4e4", hasher, hash_lock_time);
assert_hash_eq!("c705fc05", hasher, hash_expiry_height);
assert_hash_eq!("03000000", hasher, hash_hash_type);
assert_hash_eq!(
"378af1e40f64e125946f62c2fa7b2fecbcb64b6968912a6381ce3dc166d56a1d62f5a8d7",
hasher,
hash_input_prevout
);
assert_hash_eq!("0153", hasher, hash_input_script_code);
assert_hash_eq!("2f6e04963b4c0100", hasher, hash_input_amount);
assert_hash_eq!("e8c7203d", hasher, hash_input_sequence);
let hash = hasher.sighash();
let expected = "23652e76cb13b85a0e3363bb5fca061fa791c40c533eccee899364e6e60bb4f7";
let result = hash.as_bytes();
let result = hex::encode(result);
let span = tracing::span!(
tracing::Level::ERROR,
"compare_final",
expected.len = expected.len(),
buf.len = result.len()
);
let _guard = span.enter();
assert_eq!(expected, result);
Ok(())
} | rust_cleaned_test_functions.jsonl/58441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
16,
19,
18,
62,
17,
368,
1464,
5714,
71698,
341,
286,
1147,
50213,
4452,
486,
2327,
1428,
286,
1077,
7745,
284,
56674,
16,
19,
18,
62,
17,
3938,
41271,
15768,
9050,
45514,
27638,
8070,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_add_block_listener() -> Result<(), String> {
let keypair = identity::ed25519::Keypair::generate();
let block = Block::new(
HashDigest::new(b"Hello World!"),
1u128,
Vec::new(),
&keypair,
);
let mut chain = Blockchain::new(&keypair);
let called = Rc::new(Cell::new(false));
chain
.add_block_listener({
let called = called.clone();
let block = block.clone();
move |b: Block| {
assert_eq!(block, b);
called.set(true);
}
})
.add_block(block);
assert!(called.get()); // called is still false
Ok(())
} | rust_cleaned_test_functions.jsonl/47214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
7113,
46493,
368,
1464,
5714,
68843,
923,
29,
341,
286,
1077,
1376,
12670,
284,
9569,
486,
291,
17,
20,
20,
16,
24,
486,
6608,
1082,
1310,
486,
19366,
543,
286,
1077,
2504,
284,
8362,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fib2() {
test(vec![1, 1], vec![1, 1, 2, 3, 5, 8, 13, 21, 34, 55]);
} | rust_cleaned_test_functions.jsonl/47927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 64
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
579,
17,
368,
341,
286,
1273,
25592,
20703,
16,
11,
220,
16,
1125,
7486,
20703,
16,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
20,
11,
220,
23,
11,
220,
16,
18,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_valid_cast_to_string_after_parse() {
init();
for (raw_schema, _) in VALID_EXAMPLES.iter() {
let schema = Schema::parse_str(raw_schema).unwrap();
Schema::parse_str(schema.canonical_form().as_str()).unwrap();
}
} | rust_cleaned_test_functions.jsonl/69026 | {
"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,
8337,
5303,
2346,
3904,
19844,
21039,
368,
341,
262,
2930,
543,
262,
369,
320,
1041,
25371,
11,
27439,
304,
43291,
4966,
18918,
50,
19471,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_response_attestation_service_failure_no_retries() {
// build a faulty request
let service: AttestationService = AttestationService::new_with_retries(attestation_service::constants::ATTESTATION_SERVICE_URL, 0);
let quote = String::from("Wrong quote");
let as_response = service.get_report(quote.clone());
assert!(as_response.unwrap_err().downcast::<AttestationServiceErr>().is_ok());
} | rust_cleaned_test_functions.jsonl/124220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9655,
13356,
63978,
12267,
43618,
6536,
1288,
4543,
368,
341,
286,
442,
1936,
264,
57571,
1681,
198,
286,
1077,
2473,
25,
2411,
1944,
367,
1860,
284,
2411,
1944,
367,
1860,
486,
931,
6615,
1288,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nested_pattern_string_error() {
let tokens = util::tok::tokenize("\"not matched\"")
.into_iter()
.map(|t| t.1);
let err = nested::EParser::new()
.parse(tokens.into_iter())
.unwrap_err();
match err {
ParseError::UnrecognizedToken { token, expected: _ } => {
assert_eq!(token.1, Tok::String("not matched"));
}
_ => {
panic!("Unexpected error: {:?}", err);
}
}
} | rust_cleaned_test_functions.jsonl/27441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
21260,
3904,
4096,
368,
341,
262,
1077,
11211,
284,
4094,
486,
29594,
486,
5839,
551,
38915,
1921,
18054,
2105,
1138,
286,
659,
18122,
11723,
741,
286,
659,
2186,
22428,
83,
91,
259,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bit_and() {
let cases = vec![
(Some(123), Some(321), Some(65)),
(Some(-123), Some(321), Some(257)),
(None, Some(1), None),
(Some(1), None, None),
(None, None, None),
];
for (lhs, rhs, expected) in cases {
let output = RpnFnScalarEvaluator::new()
.push_param(lhs)
.push_param(rhs)
.evaluate(ScalarFuncSig::BitAndSig)
.unwrap();
assert_eq!(output, expected);
}
} | rust_cleaned_test_functions.jsonl/29753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
8378,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
8373,
7,
16,
17,
18,
701,
4329,
7,
18,
17,
16,
701,
4329,
7,
21,
20,
6965,
310,
320,
8373,
4080,
16,
17,
18,
701,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_code_with_tabwidth8() {
let mut reader = Reader::from_string("<<code>>", "1\t2\n1234567\t8\n12345678\t9");
reader.set_tabwidth(8);
let mut reader = Lexer::new(reader);
assert_tok(
&mut reader,
TokenKind::LitInt("1".into(), IntBase::Dec, IntSuffix::Int),
1,
1,
);
assert_tok(
&mut reader,
TokenKind::LitInt("2".into(), IntBase::Dec, IntSuffix::Int),
1,
9,
);
assert_tok(
&mut reader,
TokenKind::LitInt("1234567".into(), IntBase::Dec, IntSuffix::Int),
2,
1,
);
assert_tok(
&mut reader,
TokenKind::LitInt("8".into(), IntBase::Dec, IntSuffix::Int),
2,
9,
);
assert_tok(
&mut reader,
TokenKind::LitInt("12345678".into(), IntBase::Dec, IntSuffix::Int),
3,
1,
);
assert_tok(
&mut reader,
TokenKind::LitInt("9".into(), IntBase::Dec, IntSuffix::Int),
3,
17,
);
assert_end(&mut reader, 3, 18);
} | rust_cleaned_test_functions.jsonl/101130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 737
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4136,
6615,
17344,
3098,
23,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
1499,
3904,
445,
2442,
1851,
2452,
497,
330,
16,
4955,
17,
1699,
16,
17,
18,
19,
20,
21,
22,
4955,
23,
1699,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_execute_redeem_fails_with_unauthorized_vault() {
run_test(|| {
Redeem::get_redeem_request_from_id.mock_safe(|_| {
MockResult::Return(Ok(RedeemRequest {
vault: BOB,
opentime: 0,
amount_polka_btc: 0,
amount_btc: 0,
amount_dot: 0,
premium_dot: 0,
redeemer: ALICE,
btc_address: H160([0; 20]),
}))
});
assert_err!(
Redeem::execute_redeem(
Origin::signed(CAROL),
H256([0u8; 32]),
H256Le::zero(),
0,
Vec::default(),
Vec::default()
),
Error::UnauthorizedVault
);
})
} | rust_cleaned_test_functions.jsonl/26924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
1288,
450,
336,
761,
6209,
6615,
4907,
19084,
2273,
945,
368,
341,
262,
1598,
4452,
79453,
341,
286,
72131,
336,
486,
455,
1288,
450,
336,
7893,
5673,
842,
15068,
34067,
22428,
35395,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_line_number_format_regex_6() {
assert_eq!(
parse_line_number_format("__{nm:<3}@@---{np:_>4}**"),
vec![
LineNumberPlaceholderData {
prefix: "__",
placeholder: Some("nm"),
alignment_spec: Some("<"),
width: Some(3),
suffix: "@@---{np:_>4}**",
},
LineNumberPlaceholderData {
prefix: "@@---",
placeholder: Some("np"),
alignment_spec: Some(">"),
width: Some(4),
suffix: "**",
}
]
)
} | rust_cleaned_test_functions.jsonl/54576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6528,
5500,
8955,
41832,
62,
21,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
6528,
5500,
8955,
58406,
90,
19638,
31252,
18,
92,
19191,
4421,
90,
6199,
22035,
29,
19,
92,
334,
4461,
310,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_multicast_ip_to_ethernet_mac() {
let ipv4 = Ipv4Addr::new([224, 1, 1, 1]);
let mac = Mac::from(&MulticastAddr::new(ipv4).unwrap());
assert_eq!(mac, Mac::new([0x01, 0x00, 0x5e, 0x1, 0x1, 0x1]));
let ipv4 = Ipv4Addr::new([224, 129, 1, 1]);
let mac = Mac::from(&MulticastAddr::new(ipv4).unwrap());
assert_eq!(mac, Mac::new([0x01, 0x00, 0x5e, 0x1, 0x1, 0x1]));
let ipv4 = Ipv4Addr::new([225, 1, 1, 1]);
let mac = Mac::from(&MulticastAddr::new(ipv4).unwrap());
assert_eq!(mac, Mac::new([0x01, 0x00, 0x5e, 0x1, 0x1, 0x1]));
let ipv6 = Ipv6Addr::new([0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3]);
let mac = Mac::from(&MulticastAddr::new(ipv6).unwrap());
assert_eq!(mac, Mac::new([0x33, 0x33, 0, 0, 0, 3]));
let ipv6 = Ipv6Addr::new([0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3]);
let mac = Mac::from(&MulticastAddr::new(ipv6).unwrap());
assert_eq!(mac, Mac::new([0x33, 0x33, 0, 0, 0, 3]));
let ipv6 = Ipv6Addr::new([0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3]);
let mac = Mac::from(&MulticastAddr::new(ipv6).unwrap());
assert_eq!(mac, Mac::new([0x33, 0x33, 1, 0, 0, 3]));
} | rust_cleaned_test_functions.jsonl/19937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 720
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
26290,
35446,
10385,
2346,
57757,
13845,
22802,
368,
341,
286,
1077,
45475,
19,
284,
358,
30168,
19,
13986,
486,
931,
2561,
17,
17,
19,
11,
220,
16,
11,
220,
16,
11,
220,
16,
2558,
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_format_python() {
let mut logentry = LogEntry {
message: Annotated::new("hello, %s!".to_string().into()),
params: Annotated::new(Value::Array(vec![Annotated::new(Value::String(
"world".to_string(),
))])),
..LogEntry::default()
};
normalize_logentry(&mut logentry, &mut Meta::default());
assert_eq_dbg!(logentry.formatted.as_str(), Some("hello, world!"));
} | rust_cleaned_test_functions.jsonl/84674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
55869,
368,
341,
262,
1077,
5206,
1487,
4085,
284,
2835,
5874,
341,
286,
1943,
25,
1527,
87029,
486,
931,
445,
14990,
11,
1018,
82,
92993,
983,
3904,
1005,
18122,
14702,
286,
3628,
25,
152... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_render_transformation_values() -> Result<(), Box<dyn std::error::Error>> {
let text =
"{{ camelcase values.full_name }},{{ constantcase values.full_name }},{{ kebabcase values.full_name }},{{ lowercase values.full_name }},{{ pascalcase values.full_name }},{{ snakecase values.full_name }},{{ uppercase values.full_name }},{{ capitalcase values.full_name }}";
let mut values = HashMap::new();
values.insert(String::from("full_name"), String::from("ThomasPöhlmann"));
let content: Context = Context {
name: String::from("Tmpo"),
repository: String::from("https://github.com/perryrh0dan/tmpo"),
username: String::from("perryrh0dan"),
email: String::from("thomaspoehlmann96@googlemail.com"),
values: values,
};
let result = render(text, &content);
assert_eq!(
result,
"thomasPöhlmann,THOMAS_PÖHLMANN,thomas-pöhlmann,thomaspöhlmann,ThomasPöhlmann,thomas_pöhlmann,THOMASPÖHLMANN,Thomas Pöhlmann"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/74629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22781,
7965,
1627,
9146,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
1467,
4035,
414,
47219,
49152,
5638,
2750,
21534,
1269,
335,
2137,
2979,
6783,
5638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_operators() -> Result<()> {
let testdata = arrow_testdata_path();
let path = format!("{}/csv/aggregate_test_100.csv", testdata);
let options = CsvReadOptions::new().schema_infer_max_records(100);
let logical_plan = LogicalPlanBuilder::scan_csv(&path, options, None)?
// filter clause needs the type coercion rule applied
.filter(col("c7").lt(lit(5_u8)))?
.project(vec![col("c1"), col("c2")])?
.aggregate(vec![col("c1")], vec![sum(col("c2"))])?
.sort(vec![col("c1").sort(true, true)])?
.limit(10)?
.build()?;
let plan = plan(&logical_plan)?;
// verify that the plan correctly casts u8 to i64
let expected = "BinaryExpr { left: Column { name: \"c7\" }, op: Lt, right: CastExpr { expr: Literal { value: UInt8(5) }, cast_type: Int64 } }";
assert!(format!("{:?}", plan).contains(expected));
Ok(())
} | rust_cleaned_test_functions.jsonl/15406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
25634,
2973,
368,
1464,
5714,
71698,
341,
286,
1077,
1273,
691,
284,
17921,
4452,
691,
2638,
543,
286,
1077,
1815,
284,
3561,
88928,
4472,
18104,
14,
59606,
4452,
62,
16,
15,
15,
11219,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_random_access_iterator() {
use iter::*;
let xs = [1, 2, 5, 10, 11];
let mut it = xs.iter();
assert_eq!(it.indexable(), 5);
assert_eq!(it.idx(0).unwrap(), &1);
assert_eq!(it.idx(2).unwrap(), &5);
assert_eq!(it.idx(4).unwrap(), &11);
assert!(it.idx(5).is_none());
assert_eq!(it.next().unwrap(), &1);
assert_eq!(it.indexable(), 4);
assert_eq!(it.idx(0).unwrap(), &2);
assert_eq!(it.idx(3).unwrap(), &11);
assert!(it.idx(4).is_none());
assert_eq!(it.next().unwrap(), &2);
assert_eq!(it.indexable(), 3);
assert_eq!(it.idx(1).unwrap(), &10);
assert!(it.idx(3).is_none());
assert_eq!(it.next().unwrap(), &5);
assert_eq!(it.indexable(), 2);
assert_eq!(it.idx(1).unwrap(), &11);
assert_eq!(it.next().unwrap(), &10);
assert_eq!(it.indexable(), 1);
assert_eq!(it.idx(0).unwrap(), &11);
assert!(it.idx(1).is_none());
assert_eq!(it.next().unwrap(), &11);
assert_eq!(it.indexable(), 0);
assert!(it.idx(0).is_none());
assert!(it.next().is_none());
} | rust_cleaned_test_functions.jsonl/75622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 651
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
12759,
13491,
368,
341,
286,
990,
5367,
56162,
286,
1077,
11943,
284,
508,
16,
11,
220,
17,
11,
220,
20,
11,
220,
16,
15,
11,
220,
16,
16,
935,
286,
1077,
5206,
432,
284,
11943,
19471... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tabstop_remaining_mode_slash() {
assert_eq!(next_tabstop(&[1, 5], 0, &RemainingMode::Slash), 1);
assert_eq!(next_tabstop(&[1, 5], 3, &RemainingMode::Slash), 2);
assert_eq!(next_tabstop(&[1, 5], 6, &RemainingMode::Slash), 4);
} | rust_cleaned_test_functions.jsonl/54569 | {
"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,
11257,
17344,
9495,
59244,
7302,
11886,
988,
368,
341,
286,
2060,
10714,
10297,
3600,
17344,
9495,
2099,
58,
16,
11,
220,
20,
1125,
220,
15,
11,
609,
54745,
3636,
486,
88004,
701,
220,
16,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_property() {
mock_mgp_once!(
mgp_vertex_get_property_context,
move |vertex, prop_name, memory, _| {
assert_eq!(vertex, null_mut());
assert_eq!(prop_name, c_str!("test").as_ptr());
assert_eq!(memory, null_mut());
mgp_error::MGP_ERROR_UNABLE_TO_ALLOCATE
}
);
with_dummy!(Vertex, |vertex: &Vertex| {
assert_eq!(
vertex.property(c_str!("test")).err().unwrap(),
Error::UnableToGetVertexProperty
);
});
} | rust_cleaned_test_functions.jsonl/28520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16638,
368,
341,
262,
7860,
717,
21888,
7630,
33673,
286,
13742,
79,
26611,
3062,
16638,
8467,
345,
286,
3271,
760,
12085,
11,
2004,
1269,
11,
4938,
11,
85137,
341,
310,
2060,
10714,
10297,
12085,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_exp() {
let mut interpreter = Interpreter::new();
let mut input = parse::parse_lua_source(
b"local a, b, c = nil, false, true
local d, e = 2, [[Hello]]
local f, g, h, i = not nil, not false, not true, not 5
local j, k = # [[hello]], -4.0
local l, m, n, o = 1 + 1, 2 - 1, 2 * 2, 7 / 2
local p, q, r, s = 'h'..'i', '4' ^ 4, true and false, true or false
local t = {a = false}\n",
)
.unwrap();
assert_eq!(interpreter.get_variable("a"), LuaValue::Nil);
assert_eq!(interpreter.get_variable("b"), LuaValue::Boolean(false));
assert_eq!(interpreter.get_variable("c"), LuaValue::Boolean(true));
assert_eq!(interpreter.get_variable("d"), LuaValue::Number(2.0));
assert_eq!(
interpreter.get_variable("e"),
LuaValue::String(format!("Hello"))
);
assert_eq!(interpreter.get_variable("f"), LuaValue::Boolean(true));
assert_eq!(interpreter.get_variable("g"), LuaValue::Boolean(true));
assert_eq!(interpreter.get_variable("h"), LuaValue::Boolean(false));
assert_eq!(interpreter.get_variable("i"), LuaValue::Boolean(false));
assert_eq!(interpreter.get_variable("j"), LuaValue::Number(5.0));
assert_eq!(interpreter.get_variable("k"), LuaValue::Number(-4.0));
assert_eq!(interpreter.get_variable("l"), LuaValue::Number(2.0));
assert_eq!(interpreter.get_variable("m"), LuaValue::Number(1.0));
assert_eq!(interpreter.get_variable("n"), LuaValue::Number(4.0));
assert_eq!(interpreter.get_variable("o"), LuaValue::Number(3.5));
assert_eq!(
interpreter.get_variable("p"),
LuaValue::String(format!("hi"))
);
assert_eq!(interpreter.get_variable("q"), LuaValue::Number(256.0));
assert_eq!(interpreter.get_variable("r"), LuaValue::Boolean(false));
assert_eq!(interpreter.get_variable("s"), LuaValue::Boolean(true));
assert_eq!(
interpreter
.get_variable("t")
.to_table()
.unwrap()
.get_value_by_name(format!("a"))
.unwrap()
.get_lua_value(),
LuaValue::Number(4.0)
);
} | rust_cleaned_test_functions.jsonl/118771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
14214,
368,
341,
286,
1077,
5206,
39299,
284,
82493,
486,
931,
543,
286,
1077,
5206,
1946,
284,
4715,
486,
6400,
76013,
10347,
1006,
310,
293,
1,
2438,
264,
11,
293,
11,
272,
284,
2092,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_qname() {
let pre_name = PrefixedName::new("foo");
assert_eq!(pre_name.to_string(), "foo".to_string());
assert_eq!(pre_name.as_curie(), Some("[:foo]".to_string()));
assert_eq!(pre_name.as_qname(), Some("foo".to_string()));
let pre_name = PrefixedName::with_prefix("rdf", "foo");
assert_eq!(pre_name.to_string(), "rdf:foo".to_string());
assert_eq!(pre_name.as_curie(), Some("[rdf:foo]".to_string()));
assert_eq!(pre_name.as_qname(), Some("rdf:foo".to_string()));
} | rust_cleaned_test_functions.jsonl/42259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
8976,
606,
368,
341,
286,
1077,
855,
1269,
284,
42588,
3286,
675,
486,
931,
445,
7975,
797,
286,
2060,
10714,
10297,
1726,
1269,
2389,
3904,
1507,
330,
7975,
3263,
983,
3904,
1423,
286,
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_read_btf_type_array() {
let endianness = Endianness::default();
let data: &[u8] = &[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
];
match unsafe { BtfType::read(data, endianness) } {
Ok(BtfType::Array(_, _)) => {}
Ok(t) => panic!("expected array type, got {:#?}", t),
Err(_) => panic!("unexpected error"),
}
} | rust_cleaned_test_functions.jsonl/98488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
880,
8935,
1819,
3858,
368,
341,
286,
1077,
835,
72,
82033,
284,
3972,
72,
82033,
486,
2258,
543,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
87,
15,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_open_line_string() {
let ls = line_string![(x: 0., y: 0.), (x: 1., y: 1.), (x:2., y: 2.)];
let want = vec![
Line::new(coord! { x: 0., y: 0. }, coord! { x: 1., y: 1. }),
Line::new(coord! { x: 1., y: 1. }, coord! { x: 2., y: 2. }),
];
assert_eq!(want, ls.lines_iter().collect::<Vec<_>>());
} | rust_cleaned_test_functions.jsonl/83533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
6528,
3904,
368,
341,
286,
1077,
19597,
284,
1555,
3904,
0,
9697,
87,
25,
220,
15,
2572,
379,
25,
220,
15,
24389,
320,
87,
25,
220,
16,
2572,
379,
25,
220,
16,
24389,
320,
87,
25,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_simulate_transaction_panic_on_unfrozen_bank() {
let rpc = RpcHandler::start();
let bank = rpc.working_bank();
let recent_blockhash = bank.confirmed_last_blockhash();
let RpcHandler {
meta,
io,
mint_keypair,
..
} = rpc;
let bob_pubkey = Pubkey::new_unique();
let tx = system_transaction::transfer(&mint_keypair, &bob_pubkey, 1234, recent_blockhash);
let tx_serialized_encoded = bs58::encode(serialize(&tx).unwrap()).into_string();
assert!(!bank.is_frozen());
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"simulateTransaction","params":["{}", {{"sigVerify": true}}]}}"#,
tx_serialized_encoded,
);
// should panic because `bank` is not frozen
let _ = io.handle_request_sync(&req, meta);
} | rust_cleaned_test_functions.jsonl/6310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
18314,
6334,
28884,
620,
31270,
4470,
4907,
69,
42240,
35733,
368,
341,
286,
1077,
35596,
284,
79961,
3050,
486,
2468,
543,
286,
1077,
6073,
284,
35596,
18282,
287,
35733,
543,
286,
1077,
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_http_request_chunked_payload_and_next_message() {
let mut buf = BytesMut::from(
"GET /test HTTP/1.1\r\n\
transfer-encoding: chunked\r\n\r\n",
);
let mut reader = MessageDecoder::<Request>::default();
let (req, pl) = reader.decode(&mut buf).unwrap().unwrap();
let mut pl = pl.unwrap();
assert!(req.chunked().unwrap());
buf.extend(
b"4\r\ndata\r\n4\r\nline\r\n0\r\n\r\n\
POST /test2 HTTP/1.1\r\n\
transfer-encoding: chunked\r\n\r\n"
.iter(),
);
let msg = pl.decode(&mut buf).unwrap().unwrap();
assert_eq!(msg.chunk().as_ref(), b"data");
let msg = pl.decode(&mut buf).unwrap().unwrap();
assert_eq!(msg.chunk().as_ref(), b"line");
let msg = pl.decode(&mut buf).unwrap().unwrap();
assert!(msg.eof());
let (req, _) = reader.decode(&mut buf).unwrap().unwrap();
assert!(req.chunked().unwrap());
assert_eq!(*req.method(), Method::POST);
assert!(req.chunked().unwrap());
} | rust_cleaned_test_functions.jsonl/22287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 583
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25888,
7893,
30539,
291,
32813,
8378,
11257,
6462,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
1006,
310,
330,
3806,
608,
1944,
10130,
14,
16,
13,
16,
12016,
1699,
5661,
1797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random() {
// not sure how to test this aside from just getting some values
let _n : usize = random();
let _f : f32 = random();
let _o : Option<Option<i8>> = random();
let _many : ((),
(usize,
isize,
Option<(u32, (bool,))>),
(u8, i8, u16, i16, u32, i32, u64, i64),
(f32, (f64, (f64,)))) = random();
} | rust_cleaned_test_functions.jsonl/23586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
368,
341,
286,
442,
537,
2704,
1246,
311,
1273,
419,
15663,
504,
1101,
3709,
1045,
2750,
198,
286,
1077,
716,
77,
549,
22301,
284,
4194,
543,
286,
1077,
716,
69,
549,
282,
18,
17,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_readoptions_max_bytes_for_level_multiplier() {
let mut cf_opts = ColumnFamilyOptions::new();
cf_opts.set_max_bytes_for_level_multiplier(8);
assert_eq!(cf_opts.get_max_bytes_for_level_multiplier(), 8);
} | rust_cleaned_test_functions.jsonl/34131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2875,
6345,
12524,
5478,
8274,
51800,
368,
341,
262,
1077,
5206,
24111,
32354,
284,
9332,
15192,
3798,
486,
931,
543,
262,
24111,
32354,
980,
6345,
12524,
5478,
8274,
51800,
7,
23,
317,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_wait_exit() {
let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test");
match unsafe{fork()}.expect("Error: Fork Failed") {
Child => unsafe { _exit(12); },
Parent { child } => {
assert_eq!(waitpid(child, None), Ok(WaitStatus::Exited(child, 12)));
},
}
} | rust_cleaned_test_functions.jsonl/102292 | {
"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,
18760,
16880,
368,
341,
262,
1077,
716,
76,
284,
17717,
486,
37,
10647,
1245,
22867,
21003,
1005,
17119,
445,
38099,
2684,
70498,
553,
2441,
1273,
3071,
1066,
262,
2432,
19860,
90,
44738,
368,
781... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_json_add_fields() {
let mut script = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
script.push("resources/tests/scripts");
let script_dir = script.clone();
script.push("json_parse.lua");
let config = ProgrammableFilterConfig {
scripts_directory: Some(script_dir),
script: Some(script),
forwards: Vec::new(),
config_path: Some("filters.json_parse".to_string()),
tags: Default::default(),
};
let mut cs = ProgrammableFilter::new(config);
let expected_log = metric::LogLine::new("identity", "{\"foo\": \"bar\"}")
.insert_field("foo", "bar");
let orig_log = metric::LogLine::new("identity", "{\"foo\": \"bar\"}");
let orig_event = metric::Event::new_log(orig_log);
let expected_event = metric::Event::new_log(expected_log);
let mut events = Vec::new();
let res = cs.process(orig_event, &mut events);
assert!(res.is_ok());
assert!(!events.is_empty());
assert_eq!(events.len(), 1);
assert_eq!(events[0], expected_event);
} | rust_cleaned_test_functions.jsonl/41377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 609
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9455,
2891,
12132,
368,
341,
310,
1077,
5206,
5316,
284,
7933,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
4010,
310,
5316,
2552,
445,
12745,
62468,
39372,
797,
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... | 1 |
#[test]
fn test_bitwise_or() {
let bitmap1 = Bitmap::from(Buffer::from([0b01101010]));
let bitmap2 = Bitmap::from(Buffer::from([0b01001110]));
assert_eq!(
Bitmap::from(Buffer::from([0b01101110])),
(&bitmap1 | &bitmap2).unwrap()
);
} | rust_cleaned_test_functions.jsonl/118648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
4482,
8734,
368,
341,
286,
1077,
19746,
16,
284,
17533,
486,
1499,
55574,
486,
1499,
2561,
15,
65,
15,
16,
16,
15,
16,
15,
16,
15,
14382,
286,
1077,
19746,
17,
284,
17533,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_publicationtype_fromstr() {
use std::str::FromStr;
assert_eq!(
PublicationType::from_str("Paperback").unwrap(),
PublicationType::Paperback
);
assert_eq!(
PublicationType::from_str("Hardback").unwrap(),
PublicationType::Hardback
);
assert_eq!(
PublicationType::from_str("PDF").unwrap(),
PublicationType::Pdf
);
assert_eq!(
PublicationType::from_str("HTML").unwrap(),
PublicationType::Html
);
assert_eq!(
PublicationType::from_str("XML").unwrap(),
PublicationType::Xml
);
assert_eq!(
PublicationType::from_str("Epub").unwrap(),
PublicationType::Epub
);
assert_eq!(
PublicationType::from_str("Mobi").unwrap(),
PublicationType::Mobi
);
assert_eq!(
PublicationType::from_str("AZW3").unwrap(),
PublicationType::Azw3
);
assert_eq!(
PublicationType::from_str("DOCX").unwrap(),
PublicationType::Docx
);
assert_eq!(
PublicationType::from_str("FictionBook").unwrap(),
PublicationType::FictionBook
);
assert!(PublicationType::from_str("PNG").is_err());
assert!(PublicationType::from_str("Latex").is_err());
assert!(PublicationType::from_str("azw3").is_err());
assert!(PublicationType::from_str("Fiction Book").is_err());
} | rust_cleaned_test_functions.jsonl/46241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 608
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
367,
1313,
5673,
495,
368,
341,
262,
990,
1460,
486,
495,
486,
3830,
2580,
280,
262,
2060,
10714,
33673,
286,
56894,
929,
486,
1499,
2895,
445,
30898,
1419,
1827,
15454,
3148,
286,
56894,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_tip_multi_deltas_success() {
let (mut db, _dir) = create_test_db();
let contract_address = [7u8; 32].into();
let key_type_a = Stype::Delta(1);
let dk_a = DeltaKey { contract_address, key_type: key_type_a };
let v_a = b"Enigma_a";
let key_type_b = Stype::Delta(2);
let dk_b = DeltaKey { contract_address, key_type: key_type_b };
let v_b = b"Enigma_b";
db.create(&dk_a, &v_a[..]).unwrap();
db.create(&dk_b, &v_b[..]).unwrap();
let (accepted_key, accepted_val): (DeltaKey, Vec<u8>) = db.get_tip(&contract_address).unwrap();
assert_eq!(accepted_key, dk_b);
assert_eq!(accepted_val, v_b);
} | rust_cleaned_test_functions.jsonl/48690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
48014,
25133,
814,
71906,
18632,
368,
341,
286,
1077,
320,
6984,
2927,
11,
716,
3741,
8,
284,
1855,
4452,
8685,
1428,
286,
1077,
5116,
6744,
284,
508,
22,
84,
23,
26,
220,
18,
17,
936,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_too_large() {
let mut cl = Cmdline::new(4);
assert_eq!(cl.insert("hello", "world"), Err(Error::TooLarge));
assert_eq!(cl.insert("a", "world"), Err(Error::TooLarge));
assert_eq!(cl.insert("hello", "b"), Err(Error::TooLarge));
assert!(cl.insert("a", "b").is_ok());
assert_eq!(cl.insert("a", "b"), Err(Error::TooLarge));
assert_eq!(cl.insert_str("a"), Err(Error::TooLarge));
assert_eq!(cl.as_str(), "a=b");
let mut cl = Cmdline::new(10);
assert!(cl.insert("ab", "ba").is_ok()); // adds 5 length
assert_eq!(cl.insert("c", "da"), Err(Error::TooLarge));
assert!(cl.insert("c", "d").is_ok());
} | rust_cleaned_test_functions.jsonl/29218 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
2346,
78,
45228,
368,
341,
286,
1077,
5206,
1185,
284,
40210,
1056,
486,
931,
7,
19,
317,
286,
2060,
10714,
10297,
564,
7030,
445,
14990,
497,
330,
14615,
3975,
15495,
37396,
486,
31246,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vextq_s8() {
unsafe {
let a: [i8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let b: [i8; 16] = [
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 31, 32,
];
let e: [i8; 16] = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19];
let r = vextq_s8(transmute(a), transmute(b), 3);
assert!(cmp_arm(r, transmute(e)));
}
} | rust_cleaned_test_functions.jsonl/33021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
427,
80,
643,
23,
368,
341,
286,
19860,
341,
310,
1077,
264,
25,
508,
72,
23,
26,
220,
16,
21,
60,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tokenize_short2() {
let mut tokenizer = Tokenizer::new().unwrap();
let tokens: Vec<&str> = tokenizer.tokenize_str("ここでは").unwrap();
assert_eq!(tokens, vec!["ここ", "で", "は"]);
} | rust_cleaned_test_functions.jsonl/61448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86508,
16673,
17,
368,
341,
286,
1077,
5206,
45958,
284,
9660,
3135,
486,
931,
1005,
15454,
543,
286,
1077,
11211,
25,
11312,
52244,
495,
29,
284,
45958,
96790,
2895,
445,
125695,
76081,
1827,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sniffing() {
let mut modules = AsyncFunctionSignature::sniff_dart_signatures(TEST_DART_SRC)
.into_iter()
.sorted_by(|l, r| l.0.cmp(&r.0));
let (name, sigs) = modules.next().unwrap();
assert_eq!(name, "api2");
let mut sigs = sigs.into_iter().sorted_by(|l, r| l.name.cmp(&r.name));
let sig = sigs.next().unwrap();
assert_eq!(sig.name, "getTheByte");
assert_eq!(
sig.ffi_call_name,
"async_bindgen_dart_call__api2__get_the_byte"
);
assert_eq!(
sig.ffi_return_name,
"async_bindgen_dart_return__api2__get_the_byte"
);
assert_eq!(sig.output, "int");
assert!(sig.inputs.is_empty());
assert!(sigs.next().is_none());
let (name, sigs) = modules.next().unwrap();
assert_eq!(name, "async_api");
let mut sigs = sigs.into_iter().sorted_by(|l, r| l.name.cmp(&r.name));
let sig = sigs.next().unwrap();
assert_eq!(sig.name, "fooBar");
assert_eq!(
sig.ffi_call_name,
"async_bindgen_dart_call__async_api__foo_bar"
);
assert_eq!(
sig.ffi_return_name,
"async_bindgen_dart_return__async_api__foo_bar"
);
assert_eq!(sig.output, "ffi.Pointer<MyType>");
let mut inputs = sig.inputs.into_iter();
let input = inputs.next().unwrap();
assert_eq!(input.name, "x");
assert_eq!(input.r#type, "int");
let input = inputs.next().unwrap();
assert_eq!(input.name, "y");
assert_eq!(input.r#type, "double");
assert!(inputs.next().is_none());
let sig = sigs.next().unwrap();
assert_eq!(sig.name, "sub");
assert_eq!(sig.ffi_call_name, "async_bindgen_dart_call__async_api__sub");
assert_eq!(
sig.ffi_return_name,
"async_bindgen_dart_return__async_api__sub"
);
assert_eq!(sig.output, "int");
let mut inputs = sig.inputs.into_iter();
let input = inputs.next().unwrap();
assert_eq!(input.name, "x");
assert_eq!(input.r#type, "int");
let input = inputs.next().unwrap();
assert_eq!(input.name, "y");
assert_eq!(input.r#type, "int");
assert!(inputs.next().is_none());
assert!(sigs.next().is_none());
assert!(modules.next().is_none());
} | rust_cleaned_test_functions.jsonl/120155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28022,
3092,
287,
368,
341,
286,
1077,
5206,
13454,
284,
21433,
5152,
25088,
486,
9613,
3092,
814,
471,
11172,
2789,
50320,
1557,
2992,
29409,
340,
310,
659,
18122,
11723,
741,
310,
659,
28298,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dead() {
let x = Cc::new(5);
let y = x.downgrade();
drop(x);
assert!(y.upgrade().is_none());
} | rust_cleaned_test_functions.jsonl/110849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53427,
368,
341,
286,
1077,
856,
284,
356,
66,
486,
931,
7,
20,
317,
286,
1077,
379,
284,
856,
18148,
6937,
543,
286,
5943,
2075,
317,
286,
2060,
10297,
88,
17652,
6937,
1005,
285,
31488,
1423... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_find_self_refs() {
check(
r#"
struct Foo { bar: i32 }
impl Foo {
fn foo(self) {
let x = self$0.bar;
if true {
let _ = match () {
() => self,
};
}
}
}
"#,
expect![[r#"
self SelfParam FileId(0) 47..51 47..51
FileId(0) 71..75 Read
FileId(0) 152..156 Read
"#]],
);
} | rust_cleaned_test_functions.jsonl/60663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
25637,
60638,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
33428,
314,
3619,
25,
600,
18,
17,
555,
6383,
33428,
341,
262,
5168,
15229,
1193,
8,
341,
286,
1077,
856,
284,
656,
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_kafka_producer_success() {
let kafka: Kafka = Kafka::default();
assert_eq!(kafka_producer(kafka, TEST_BUFFER.to_string()), STREAM_SUCCESS);
} | rust_cleaned_test_functions.jsonl/81755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
21883,
2540,
28938,
18632,
368,
341,
286,
1077,
67852,
25,
57025,
284,
57025,
486,
2258,
543,
286,
2060,
10714,
10297,
74,
21883,
2540,
28938,
5969,
21883,
11,
13602,
14394,
2389,
3904,
11858,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_chmod_symlink_non_existing_file_recursive() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let non_existing = "test_chmod_symlink_non_existing_file_recursive";
let test_symlink = "test_chmod_symlink_non_existing_file_recursive_symlink";
let test_directory = "test_chmod_symlink_non_existing_file_directory";
at.mkdir(test_directory);
at.symlink_file(
non_existing,
&format!("{}/{}", test_directory, test_symlink),
);
// this should succeed
scene
.ucmd()
.arg("-R")
.arg("755")
.arg(test_directory)
.succeeds()
.no_stderr()
.no_stdout();
let expected_stdout = &format!(
// spell-checker:disable-next-line
"mode of '{}' retained as 0755 (rwxr-xr-x)\nneither symbolic link '{}/{}' nor referent has been changed",
test_directory, test_directory, test_symlink
);
// '-v': this should succeed without stderr
scene
.ucmd()
.arg("-R")
.arg("-v")
.arg("755")
.arg(test_directory)
.succeeds()
.stdout_contains(expected_stdout)
.no_stderr();
// '-vf': this should be the same than with just '-v'
scene
.ucmd()
.arg("-R")
.arg("-v")
.arg("-f")
.arg("755")
.arg(test_directory)
.succeeds()
.stdout_contains(expected_stdout)
.no_stderr();
} | rust_cleaned_test_functions.jsonl/127214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 736
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2593,
58530,
44243,
21637,
62630,
2458,
66242,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
401,
262,
1077,
247... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_value_of_trait() {
let build_version = format!("{} {}", cli::version(), cli::build_git_sha());
let matches = cli::make_app(&build_version).get_matches_from(vec![
"delivery",
"checkout",
"branch",
"--for",
"griffindor",
]);
let cmd_matches = matches
.subcommand_matches(cli::checkout::SUBCOMMAND_NAME)
.unwrap();
// A simple argument
assert_eq!("griffindor", value_of(&cmd_matches, "pipeline"));
assert_eq!("", value_of(&cmd_matches, "not_for"));
let matches = cli::make_app(&build_version).get_matches_from(vec![
"delivery",
"checkout",
"branch",
"--pipeline",
"hufflepuff",
]);
let cmd_matches = matches
.subcommand_matches(cli::checkout::SUBCOMMAND_NAME)
.unwrap();
// A simple argument
assert_eq!("hufflepuff", value_of(&cmd_matches, "pipeline"));
assert_eq!("", value_of(&cmd_matches, "not_pipeline"));
} | rust_cleaned_test_functions.jsonl/68782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 585
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
3575,
78491,
368,
341,
286,
1077,
1936,
9438,
284,
3561,
17223,
6257,
24689,
21348,
486,
4366,
1507,
21348,
486,
5834,
68801,
48836,
5231,
286,
1077,
9071,
284,
21348,
486,
6927,
8191,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_as_decimal() {
test_none_with_ctx_and_extra(cast_json_as_decimal);
// TODO: add test case that make Decimal::from_str failed
let cs: Vec<(Json, bool, bool, Decimal)> = vec![
(
Json::from_i64(10).unwrap(),
false,
false,
Decimal::from_f64(10f64).unwrap(),
),
(
Json::from_i64(i64::MAX).unwrap(),
false,
false,
Decimal::from_f64(i64::MAX as f64).unwrap(),
),
(
Json::from_i64(i64::MIN).unwrap(),
false,
false,
Decimal::from_f64(i64::MIN as f64).unwrap(),
),
(Json::from_u64(0).unwrap(), false, false, Decimal::zero()),
(
Json::from_u64(i64::MAX as u64).unwrap(),
false,
false,
Decimal::from_f64(i64::MAX as f64).unwrap(),
),
(
Json::from_u64(u64::MAX).unwrap(),
false,
false,
Decimal::from_f64(u64::MAX as f64).unwrap(),
),
(
Json::from_f64(i64::MAX as f64).unwrap(),
false,
false,
Decimal::from_f64(i64::MAX as f64).unwrap(),
),
(
Json::from_f64(i64::MIN as f64).unwrap(),
false,
false,
Decimal::from_f64(i64::MIN as f64).unwrap(),
),
(
Json::from_f64(u64::MAX as f64).unwrap(),
false,
false,
Decimal::from_f64(u64::MAX as f64).unwrap(),
),
(
Json::from_string("10.0".to_string()).unwrap(),
false,
false,
Decimal::from_bytes(b"10.0").unwrap().unwrap(),
),
(
Json::from_string("-10.0".to_string()).unwrap(),
false,
false,
Decimal::from_bytes(b"-10.0").unwrap().unwrap(),
),
(
Json::from_string("9999999999999999999".to_string()).unwrap(),
false,
false,
Decimal::from_bytes(b"9999999999999999999")
.unwrap()
.unwrap(),
),
(
Json::from_string("-9999999999999999999".to_string()).unwrap(),
false,
false,
Decimal::from_bytes(b"-9999999999999999999")
.unwrap()
.unwrap(),
),
(
Json::from_bool(true).unwrap(),
false,
false,
Decimal::from_f64(1f64).unwrap(),
),
(
Json::from_bool(false).unwrap(),
false,
false,
Decimal::zero(),
),
(Json::none().unwrap(), false, false, Decimal::zero()),
];
test_as_decimal_helper(
cs,
|ctx, extra, _, val| cast_json_as_decimal(ctx, extra, val.map(|x| x.as_ref())),
|x| x.to_string(),
"cast_json_as_decimal",
);
} | rust_cleaned_test_functions.jsonl/1988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
11898,
74429,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
9455,
11898,
74429,
626,
286,
442,
5343,
25,
912,
1273,
1142,
429,
1281,
26728,
486,
1499,
2895,
4641,
198,
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_lint_duplicate_top_level_assign() {
let m = module(
r#"
load("file", "foo", "no3", "no4")
no1 = 1
no1 = 4
no1 += 8
foo = foo # Starlark reexport
no3 = no3
no3 = no3
no4 = no4 + 1
def no2(): pass
def no2():
x = 1
x += 1
return x
"#,
);
let mut res = Vec::new();
duplicate_top_level_assignment(&m, &mut res);
let mut res = res.map(|x| match &x.problem {
Incompatibility::DuplicateTopLevelAssign(x, _) => x,
_ => panic!("Unexpected lint"),
});
res.sort();
assert_eq!(res, &["no1", "no1", "no2", "no3", "no4"])
} | rust_cleaned_test_functions.jsonl/87709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
396,
70434,
10426,
8274,
20688,
368,
341,
286,
1077,
296,
284,
4688,
1006,
310,
435,
2,
698,
1078,
445,
1192,
497,
330,
7975,
497,
330,
2152,
18,
497,
330,
2152,
19,
1138,
2152,
16,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_row_formatter_with_bytes_and_inodes() {
let options = Options {
columns: vec![Column::Size, Column::Itotal],
block_size: BlockSize::Bytes(100),
..Default::default()
};
let row = Row {
file: Some("/path/to/file".to_string()),
fs_device: "my_device".to_string(),
fs_type: "my_type".to_string(),
fs_mount: "my_mount".to_string(),
bytes: 100,
bytes_used: 25,
bytes_avail: 75,
bytes_usage: Some(0.25),
#[cfg(target_os = "macos")]
bytes_capacity: Some(0.5),
inodes: 10,
inodes_used: 2,
inodes_free: 8,
inodes_usage: Some(0.2),
};
let fmt = RowFormatter::new(&row, &options);
assert_eq!(fmt.get_values(), vec!("1", "10"));
} | rust_cleaned_test_functions.jsonl/110421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
73965,
6615,
12524,
8378,
1243,
2539,
368,
341,
286,
1077,
2606,
284,
14566,
341,
310,
8147,
25,
7486,
20703,
2933,
486,
1695,
11,
9332,
486,
2132,
2370,
1259,
310,
2504,
2368,
25,
8362,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_bool() {
let tests = &[(true, "true"), (false, "false")];
test_encode_ok(tests);
test_pretty_encode_ok(tests);
} | rust_cleaned_test_functions.jsonl/29818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
22159,
368,
341,
262,
1077,
7032,
284,
609,
9697,
1866,
11,
330,
1866,
3975,
320,
3849,
11,
330,
3849,
899,
935,
262,
1273,
11224,
19817,
8623,
82,
317,
262,
1273,
620,
21322,
11224,
19817... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rejects_malformed_json() {
let json = json!({
"version": "1",
"content": [{
"host_match": "example.com",
"host_replacement": "example.com",
"path_prefix_match": "/test/",
"path_prefix_replacement": "/test",
}]
});
assert_error_contains!(
serde_json::from_str::<Rule>(json["content"][0].to_string().as_str()).unwrap_err(),
"paths should both be a prefix match or both be a literal match",
);
assert_error_contains!(
serde_json::from_str::<RuleConfig>(json.to_string().as_str()).unwrap_err(),
"paths should both be a prefix match or both be a literal match",
);
let json = json!({
"version": "1",
"content": [{
"host_match": "example.com",
"host_replacement": "example.com",
"path_prefix_match": "test",
"path_prefix_replacement": "/test",
}]
});
assert_error_contains!(
serde_json::from_str::<Rule>(json["content"][0].to_string().as_str()).unwrap_err(),
"paths must start with",
);
assert_error_contains!(
serde_json::from_str::<RuleConfig>(json.to_string().as_str()).unwrap_err(),
"paths must start with",
);
} | rust_cleaned_test_functions.jsonl/57423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 804
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
583,
82,
717,
278,
10155,
9455,
368,
341,
286,
1077,
2951,
284,
2951,
0,
2262,
310,
330,
4366,
788,
330,
16,
756,
310,
330,
1796,
788,
18396,
394,
330,
3790,
10708,
788,
1060,
330,
8687,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_not_c() {
let compiled = bitwise::compile_not("C".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b01011011);
} | rust_cleaned_test_functions.jsonl/100594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
7913,
666,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
7913,
445,
34,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
262,
2060,
10714,
10297,
5084... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sample_and_hold_sync() {
let spec = "input x: UInt8\noutput y: UInt8 := x.hold().defaults(to: 0)";
assert_eq!(0, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110711 | {
"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,
17491,
8378,
65824,
23008,
368,
341,
286,
1077,
1398,
284,
330,
1355,
856,
25,
22275,
23,
1699,
3006,
379,
25,
22275,
23,
1669,
856,
860,
813,
1005,
26756,
12186,
25,
220,
15,
24023,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_binary_point_vars_select() -> Result<(), PlonkError> {
test_binary_point_vars_select_helper::<FqEd354, Param254>()?;
test_binary_point_vars_select_helper::<FqEd377, Param377>()?;
test_binary_point_vars_select_helper::<FqEd381, Param381>()?;
test_binary_point_vars_select_helper::<FqEd381b, Param381b>()?;
test_binary_point_vars_select_helper::<Fq377, Param761>()
} | rust_cleaned_test_functions.jsonl/33786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
6085,
11168,
13051,
368,
1464,
5714,
68843,
1818,
263,
74,
1454,
29,
341,
286,
1273,
31761,
6085,
11168,
13051,
10418,
27638,
37,
80,
2715,
18,
20,
19,
11,
6991,
17,
20,
19,
13555,
37445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_single() {
match Variant::VLong(1).plus(Variant::VSingle(2.0)).unwrap() {
Variant::VSingle(result) => assert_eq!(result, 3.0),
_ => panic!("assertion failed"),
}
} | rust_cleaned_test_functions.jsonl/84548 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
368,
341,
394,
2432,
39292,
486,
53,
6583,
7,
16,
568,
7138,
12410,
15341,
486,
53,
10888,
7,
17,
13,
15,
4579,
15454,
368,
341,
503,
39292,
486,
53,
10888,
4456,
8,
589,
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... | 2 |
#[test]
fn test_cdc_batch_size_limit() {
let mut suite = TestSuite::new(1);
// Prewrite
let start_ts = block_on(suite.cluster.pd_client.get_tso()).unwrap();
let mut m1 = Mutation::default();
let k1 = b"k1".to_vec();
m1.set_op(Op::Put);
m1.key = k1.clone();
m1.value = vec![0; 6 * 1024 * 1024];
let mut m2 = Mutation::default();
let k2 = b"k2".to_vec();
m2.set_op(Op::Put);
m2.key = k2.clone();
m2.value = b"v2".to_vec();
suite.must_kv_prewrite(1, vec![m1, m2], k1.clone(), start_ts);
// Commit
let commit_ts = block_on(suite.cluster.pd_client.get_tso()).unwrap();
suite.must_kv_commit(1, vec![k1, k2], start_ts, commit_ts);
let req = suite.new_changedata_request(1);
let (mut req_tx, event_feed_wrap, receive_event) =
new_event_feed(suite.get_region_cdc_client(1));
block_on(req_tx.send((req, WriteFlags::default()))).unwrap();
let mut events = receive_event(false).events.to_vec();
assert_eq!(events.len(), 1, "{:?}", events.len());
match events.remove(0).event.unwrap() {
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 1);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Committed, "{:?}", e.get_type());
assert_eq!(e.key, b"k1", "{:?}", e.key);
}
other => panic!("unknown event {:?}", other),
}
let mut entries = vec![];
while entries.len() < 2 {
match receive_event(false).events.remove(0).event.unwrap() {
Event_oneof_event::Entries(es) => {
entries.extend(es.entries.into_iter());
}
other => panic!("unknown event {:?}", other),
}
}
assert_eq!(entries.len(), 2, "{:?}", entries);
let e = &entries[0];
assert_eq!(e.get_type(), EventLogType::Committed, "{:?}", e.get_type());
assert_eq!(e.key, b"k2", "{:?}", e.key);
let e = &entries[1];
assert_eq!(
e.get_type(),
EventLogType::Initialized,
"{:?}",
e.get_type()
);
// Prewrite
let start_ts = block_on(suite.cluster.pd_client.get_tso()).unwrap();
let mut m3 = Mutation::default();
let k3 = b"k3".to_vec();
m3.set_op(Op::Put);
m3.key = k3.clone();
m3.value = vec![0; 7 * 1024 * 1024];
let mut m4 = Mutation::default();
let k4 = b"k4".to_vec();
m4.set_op(Op::Put);
m4.key = k4;
m4.value = b"v4".to_vec();
suite.must_kv_prewrite(1, vec![m3, m4], k3, start_ts);
let mut events = receive_event(false).events.to_vec();
assert_eq!(events.len(), 1, "{:?}", events);
match events.pop().unwrap().event.unwrap() {
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 2);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Prewrite, "{:?}", e.get_type());
assert_eq!(e.key, b"k4", "{:?}", e.key);
let e = &es.entries[1];
assert_eq!(e.get_type(), EventLogType::Prewrite, "{:?}", e.get_type());
assert_eq!(e.key, b"k3", "{:?}", e.key);
}
other => panic!("unknown event {:?}", other),
}
event_feed_wrap.replace(None);
suite.stop();
} | rust_cleaned_test_functions.jsonl/90361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1616
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
7628,
14534,
2368,
14763,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
16,
626,
262,
442,
393,
52473,
198,
262,
1077,
1191,
25023,
284,
2504,
4470,
89516,
40501,
556,
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... | 5 |
#[test]
fn test_tpu_send_transaction() {
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let test_validator =
TestValidator::with_no_fees(mint_pubkey, None, SocketAddrSpace::Unspecified);
let rpc_client = Arc::new(RpcClient::new_with_commitment(
test_validator.rpc_url(),
CommitmentConfig::processed(),
));
let tpu_client = TpuClient::new(
rpc_client.clone(),
&test_validator.rpc_pubsub_url(),
TpuClientConfig::default(),
)
.unwrap();
let recent_blockhash = rpc_client.get_recent_blockhash().unwrap().0;
let tx =
system_transaction::transfer(&mint_keypair, &Pubkey::new_unique(), 42, recent_blockhash);
assert!(tpu_client.send_transaction(&tx));
let timeout = Duration::from_secs(5);
let now = Instant::now();
let signatures = vec![tx.signatures[0]];
loop {
assert!(now.elapsed() < timeout);
let statuses = rpc_client.get_signature_statuses(&signatures).unwrap();
if statuses.value.get(0).is_some() {
return;
}
}
} | rust_cleaned_test_functions.jsonl/64275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
5584,
13565,
28884,
368,
341,
262,
1077,
28337,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
262,
1077,
28337,
34014,
792,
284,
28337,
3097,
12670,
47773,
792,
543,
262,
1077,
1273,
649... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_type_of() -> Result<(), Box<EvalAltResult>> {
#[derive(Clone)]
struct TestStruct {
x: INT,
}
let mut engine = Engine::new();
#[cfg(not(feature = "only_i32"))]
assert_eq!(engine.eval::<String>("type_of(60 + 5)")?, "i64");
#[cfg(feature = "only_i32")]
assert_eq!(engine.eval::<String>("type_of(60 + 5)")?, "i32");
#[cfg(not(feature = "no_float"))]
assert_eq!(engine.eval::<String>("type_of(1.0 + 2.0)")?, "f64");
#[cfg(not(feature = "no_index"))]
assert_eq!(
engine.eval::<String>(r#"type_of([true, 2, "hello"])"#)?,
"array"
);
#[cfg(not(feature = "no_object"))]
assert_eq!(
engine.eval::<String>(r#"type_of(#{a:true, "":2, "z":"hello"})"#)?,
"map"
);
#[cfg(not(feature = "no_object"))]
{
engine.register_type_with_name::<TestStruct>("Hello");
engine.register_fn("new_ts", || TestStruct { x: 1 });
assert_eq!(engine.eval::<String>("type_of(new_ts())")?, "Hello");
}
assert_eq!(engine.eval::<String>(r#"type_of("hello")"#)?, "string");
#[cfg(not(feature = "only_i32"))]
assert_eq!(engine.eval::<String>("let x = 123; type_of(x)")?, "i64");
#[cfg(feature = "only_i32")]
assert_eq!(engine.eval::<String>("let x = 123; type_of(x)")?, "i32");
Ok(())
} | rust_cleaned_test_functions.jsonl/53457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 648
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
3575,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
11506,
27098,
65297,
5563,
262,
2036,
3393,
9422,
341,
286,
856,
25,
9221,
345,
262,
555,
262,
1077,
5206,
4712,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_encode_response() {
let mut buf = [0; 1];
let response = NonSupportedCommandParams { cr_bit: true, non_supported_command: 8 };
let expected = [
0b00100011,
];
assert!(response.encode(&mut buf[..]).is_ok());
assert_eq!(buf, expected);
} | rust_cleaned_test_functions.jsonl/67134 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
9655,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
26,
220,
16,
935,
286,
1077,
2033,
284,
11581,
34636,
4062,
4870,
314,
1560,
13996,
25,
830,
11,
2477,
57885,
10811,
25,
220,
23,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_partition_agg() {
let df = df! {
"foo" => &[1, 1, 2, 2, 3],
"bar" => &[1.0, 1.0, 2.0, 2.0, 3.0]
}
.unwrap();
let out = df
.lazy()
.groupby(vec![col("foo")])
.agg(vec![col("bar").mean()])
.sort("foo", false)
.collect()
.unwrap();
assert_eq!(
Vec::from(out.column("bar_mean").unwrap().f64().unwrap()),
&[Some(1.0), Some(2.0), Some(3.0)]
);
let out = scan_foods_csv()
.groupby(vec![col("category")])
.agg(vec![col("calories").list()])
.sort("category", false)
.collect()
.unwrap();
dbg!(&out);
let cat_agg_list = out.select_at_idx(1).unwrap();
let fruit_series = cat_agg_list.list().unwrap().get(0).unwrap();
let fruit_list = fruit_series.i64().unwrap();
dbg!(fruit_list);
assert_eq!(
Vec::from(fruit_list),
&[
Some(60),
Some(30),
Some(50),
Some(30),
Some(60),
Some(130),
Some(50),
]
)
} | rust_cleaned_test_functions.jsonl/14683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 784
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
43840,
83534,
368,
341,
286,
1077,
6764,
284,
6764,
0,
341,
310,
330,
7975,
1,
589,
44590,
16,
11,
220,
16,
11,
220,
17,
11,
220,
17,
11,
220,
18,
1259,
310,
330,
2257,
1,
589,
4459... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_color_error() {
assert!(matches!(
EmbedBuilder::new().color(0).build().unwrap_err().kind(),
EmbedErrorType::ColorZero
));
assert!(matches!(
EmbedBuilder::new().color(u32::MAX).build().unwrap_err().kind(),
EmbedErrorType::ColorNotRgb { color }
if *color == u32::MAX
));
} | rust_cleaned_test_functions.jsonl/50084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6714,
4096,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
37068,
3297,
486,
931,
1005,
3423,
7,
15,
568,
5834,
1005,
15454,
9266,
1005,
15314,
3148,
310,
37068,
1454,
929,
486,
1636,
17999,
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... | 2 |
#[test]
fn test_joint_val() {
use crate::iterable::dummy::Mat;
use ark_bls12_381::Fr;
let a = [
MatrixElement::EOL,
MatrixElement::Element((Fr::from(1u64), 1)),
MatrixElement::EOL,
MatrixElement::Element((Fr::from(2u64), 0)),
];
let b = [
MatrixElement::EOL,
MatrixElement::Element((Fr::from(1u64), 1)),
MatrixElement::EOL,
MatrixElement::Element((Fr::from(2u64), 0)),
];
let c = [
MatrixElement::EOL,
MatrixElement::Element((Fr::from(1u64), 1)),
MatrixElement::EOL,
MatrixElement::Element((Fr::from(2u64), 0)),
];
let a_stream = Mat(&a, 2);
let b_stream = Mat(&b, 2);
let c_stream = Mat(&c, 2);
let joint_a = JointValStream::new(&a_stream, &b_stream, &c_stream, 2, 2);
assert_eq!(joint_a.len(), joint_a.iter().count());
let mut joint_a_it = joint_a.iter();
assert_eq!(joint_a_it.next(), Some(Fr::from(1u64)));
assert_eq!(joint_a_it.next(), Some(Fr::from(2u64)));
assert_eq!(joint_a_it.next(), None);
} | rust_cleaned_test_functions.jsonl/6890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 512
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53158,
6189,
368,
341,
262,
990,
17717,
486,
2015,
480,
486,
31390,
486,
11575,
280,
262,
990,
55217,
880,
4730,
16,
17,
62,
18,
23,
16,
486,
22560,
401,
262,
1077,
264,
284,
2278,
286,
11631,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_data_descriptors() {
let value = vec![
UntaggedValue::row(indexmap! {
"h1".into() => Value::from("Ecuador")
}),
UntaggedValue::row(indexmap! {
"h2".into() => Value::from("Ecuador")
}),
UntaggedValue::row(indexmap! {
"h3".into() => Value::from("Ecuador")
}),
UntaggedValue::row(indexmap! {
"h1".into() => Value::from("Ecuador"),
"h4".into() => Value::from("Ecuador"),
}),
];
assert_eq!(
value
.iter()
.map(|v| v.data_descriptors().len())
.collect::<Vec<_>>(),
vec![1, 1, 1, 2]
);
} | rust_cleaned_test_functions.jsonl/124315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1769,
15768,
25705,
368,
341,
286,
1077,
897,
284,
7486,
90515,
310,
15098,
96476,
1130,
486,
651,
7195,
2186,
0,
341,
394,
330,
71,
16,
3263,
18122,
368,
589,
5162,
486,
1499,
445,
36,
49262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_41() {
assert_eq!(Solution::first_missing_positive(vec![2,2]), 1);
assert_eq!(Solution::first_missing_positive(vec![12,11,10,9,8,7,6,5,4,3,2]), 1);
assert_eq!(Solution::first_missing_positive(vec![2,2,2,2,2,2,2]), 1);
assert_eq!(Solution::first_missing_positive(vec![3,4,-1,1]), 2);
assert_eq!(Solution::first_missing_positive(vec![2,1,0]), 3);
assert_eq!(Solution::first_missing_positive(vec![7,8,9,11,12]), 1);
assert_eq!(Solution::first_missing_positive(vec![7,8,1,2,3,3,3,3,3,3,3,-5,-7,1234]), 4);
} | rust_cleaned_test_functions.jsonl/75799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
19,
16,
368,
972,
286,
2060,
10714,
10297,
36842,
486,
3896,
40447,
54160,
25592,
20703,
17,
11,
17,
9719,
220,
16,
736,
286,
2060,
10714,
10297,
36842,
486,
3896,
40447,
54160,
25592,
20703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_err_on_diff_nonce() {
let mut s = StreamXChaCha20Poly1305::new(&SecretKey::from(KEY), &Nonce::from([0u8; 24]));
let cipher1: [u8; 23] = [
252u8, 164u8, 0u8, 196u8, 27u8, 198u8, 8u8, 57u8, 216u8, 118u8, 134u8, 104u8, 156u8,
45u8, 71u8, 161u8, 199u8, 28u8, 79u8, 145u8, 19u8, 239u8, 4u8,
];
let mut plain_out1 = [0u8; 23 - ABYTES];
assert!(s.open_chunk(&cipher1, None, &mut plain_out1).is_err());
} | rust_cleaned_test_functions.jsonl/75566 | {
"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,
9266,
4470,
15850,
48508,
368,
341,
286,
1077,
5206,
274,
284,
9203,
55,
95971,
95971,
17,
15,
38164,
16,
18,
15,
20,
486,
931,
2099,
19773,
1592,
486,
1499,
37076,
701,
609,
90528,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pkcs8_encrypted() {
env_logger::init().unwrap_or(());
println!("test");
decode_secret_key(PKCS8_ENCRYPTED, Some(b"blabla")).unwrap();
} | rust_cleaned_test_functions.jsonl/76371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33321,
4837,
23,
13781,
14026,
368,
341,
286,
6105,
27413,
486,
2327,
1005,
15454,
8734,
7,
1423,
286,
13751,
17223,
1944,
797,
286,
16895,
21962,
3097,
5304,
42,
6412,
23,
6300,
42917,
1479,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_noto_sans() {
run_test(
&TEST_DATA,
"harfbuzz/good-noto-sans.kn",
"noto/NotoSansKannada-Regular.ttf",
&[JOINER_GLYPH_INDEX],
80,
);
} | rust_cleaned_test_functions.jsonl/91182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2072,
643,
596,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
12982,
10798,
8889,
4846,
1386,
29169,
78,
1331,
596,
5202,
77,
756,
503,
330,
1921,
78,
20290,
2072,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_overrides() {
// Take the lock so changing the environment doesn't cause races.
let _env_lock = ENV_LOCK.lock().unwrap();
// Test first that we can override each environment.
for env in &Environment::ALL {
env::set_var(CONFIG_ENV, env.to_string());
check_config!(RocketConfig::parse(format!(r#"
[{}]
address = "::1"
"#, GLOBAL_ENV_NAME), TEST_CONFIG_FILENAME), {
default_config(*env).address("::1")
});
check_config!(RocketConfig::parse(format!(r#"
[{}]
database = "mysql"
"#, GLOBAL_ENV_NAME), TEST_CONFIG_FILENAME), {
default_config(*env).extra("database", "mysql")
});
check_config!(RocketConfig::parse(format!(r#"
[{}]
port = 3980
"#, GLOBAL_ENV_NAME), TEST_CONFIG_FILENAME), {
default_config(*env).port(3980)
});
}
} | rust_cleaned_test_functions.jsonl/35253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 785
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
15431,
18245,
368,
341,
286,
442,
11778,
279,
5296,
773,
10018,
279,
4573,
3171,
944,
5240,
20588,
624,
286,
1077,
716,
3160,
9818,
284,
32791,
27661,
21003,
1005,
15454,
1428,
286,
442,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_insert_nodes() {
let pool = create_connection_pool_and_migrate();
let registry = DieselRegistry::new(pool);
registry
.insert_node(get_node_1())
.expect("Unable to insert node");
let node = registry
.fetch_node(&get_node_1().identity)
.expect("Failed to fetch node")
.expect("Node not found");
assert_eq!(node, get_node_1());
if registry.insert_node(get_node_1()).is_ok() {
panic!("Should have returned an error because of duplicate endpoint")
}
} | rust_cleaned_test_functions.jsonl/106287 | {
"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,
17678,
14896,
368,
341,
286,
1077,
7314,
284,
1855,
15866,
15709,
8378,
717,
34479,
543,
286,
1077,
19424,
284,
53794,
15603,
486,
931,
41838,
626,
286,
19424,
198,
310,
659,
4208,
5084,
5433,
508... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read_bytes_mut_small() {
const INITIAL: &[u8] = b"abcdef";
let rbuf = Box::new(BytesMut::from(vec![0; 4]));
const EXPECT: &[u8] = b"cdef";
let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
let mut aiocb = AioCb::from_boxed_mut_slice( f.as_raw_fd(),
2, //offset
rbuf,
0, //priority
SigevNotify::SigevNone,
LioOpcode::LIO_NOP);
aiocb.read().unwrap();
let err = poll_aio(&mut aiocb);
assert_eq!(err, Ok(()));
assert_eq!(aiocb.aio_return().unwrap() as usize, EXPECT.len());
let buffer = aiocb.boxed_mut_slice().unwrap();
assert_eq!(buffer.borrow(), EXPECT);
} | rust_cleaned_test_functions.jsonl/90416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
12524,
29523,
31966,
368,
341,
262,
733,
56854,
25,
44590,
84,
23,
60,
284,
293,
1,
41202,
876,
262,
1077,
435,
5909,
284,
8261,
486,
931,
76423,
51440,
486,
1499,
25592,
20703,
15,
26,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_middleware() {
let mut srv = init_service(
App::new().service(
web::resource("/test")
.name("test")
.wrap(md)
.route(web::get().to(|| HttpResponse::Ok())),
),
);
let req = TestRequest::with_uri("/test").to_request();
let resp = call_service(&mut srv, req);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(header::CONTENT_TYPE).unwrap(),
HeaderValue::from_static("0001")
);
} | rust_cleaned_test_functions.jsonl/4935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
11603,
368,
341,
286,
1077,
5206,
43578,
284,
2930,
12267,
1006,
310,
1845,
486,
931,
1005,
7936,
1006,
394,
3482,
486,
9233,
4283,
1944,
1138,
503,
659,
606,
445,
1944,
1138,
503,
659,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_or_with_one_like_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let query = Operator::Or(
vec![
Operator::Like(
TagName::PlainTagName(name1.clone()),
TargetValue::Unencrypted(value1.clone())
)
]
);
let json = query.to_string();
let expected = format!(r#"{{"$or":[{{"~{}":{{"$like":"{}"}}}}]}}"#, base64::encode(&name1), value1);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
11667,
25535,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
3239,
284,
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_meta_in_external() {
assert_matches!(
from_json_value(
json!(
{"version": "1",
"content":
{"/meta/" : {},
"/": {
"meta/foo": "host-path"}
}
}
)
),
Err(CreationManifestError::ExternalContentInMetaDirectory{path: s})
=> assert_eq!(s, "meta/foo"));
} | rust_cleaned_test_functions.jsonl/101414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13381,
1243,
47432,
368,
341,
286,
2060,
38344,
33673,
310,
504,
9455,
3142,
1006,
394,
2951,
33673,
503,
5212,
4366,
788,
330,
16,
756,
3824,
330,
1796,
4660,
3824,
314,
3115,
5490,
11225,
549,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let rect = Rectangle::new(5.0, 10.0, 20.0, 30.0);
assert_eq!(rect.x, 5.0);
assert_eq!(rect.y, 10.0);
assert_eq!(rect.width, 20.0);
assert_eq!(rect.height, 30.0);
} | rust_cleaned_test_functions.jsonl/17814 | {
"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,
5921,
368,
341,
286,
1077,
7608,
284,
19280,
486,
931,
7,
20,
13,
15,
11,
220,
16,
15,
13,
15,
11,
220,
17,
15,
13,
15,
11,
220,
18,
15,
13,
15,
626,
286,
2060,
10714,
10297,
2851,
1993,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_root_and_add_votes() {
let mut heaviest_subtree_fork_choice = setup_forks();
let stake = 100;
let (bank, vote_pubkeys) = bank_utils::setup_bank_and_vote_pubkeys(1, stake);
// Vote for slot 2
heaviest_subtree_fork_choice.add_votes(
[(vote_pubkeys[0], (1, Hash::default()))].iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
);
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot().0, 4);
// Set a root
heaviest_subtree_fork_choice.set_root((1, Hash::default()));
// verify this fork is now the best fork
heaviest_subtree_fork_choice.add_votes(
[(vote_pubkeys[0], (3, Hash::default()))].iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
);
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot().0, 6);
assert_eq!(
heaviest_subtree_fork_choice
.stake_voted_at(&(1, Hash::default()))
.unwrap(),
0
);
assert_eq!(
heaviest_subtree_fork_choice
.stake_voted_at(&(3, Hash::default()))
.unwrap(),
stake
);
for slot in &[1, 3] {
assert_eq!(
heaviest_subtree_fork_choice
.stake_voted_subtree(&(*slot, Hash::default()))
.unwrap(),
stake
);
}
// Set a root at last vote
heaviest_subtree_fork_choice.set_root((3, Hash::default()));
// Check new leaf 7 is still propagated properly
heaviest_subtree_fork_choice
.add_new_leaf_slot((7, Hash::default()), Some((6, Hash::default())));
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot().0, 7);
} | rust_cleaned_test_functions.jsonl/85863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 983
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
12993,
8378,
2891,
65116,
368,
341,
286,
1077,
5206,
566,
98362,
5228,
9344,
761,
669,
31936,
284,
6505,
761,
73302,
543,
286,
1077,
18279,
284,
220,
16,
15,
15,
280,
286,
1077,
320,
17033... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_too_large() {
// from playground
serialize_and_deserialize_uper(
8,
&[0x12],
&BasicConstrainedSmall {
abc: BitVec::from_all_bytes(vec![0x12]),
},
);
} | rust_cleaned_test_functions.jsonl/50179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
78,
45228,
368,
341,
262,
442,
504,
41615,
198,
262,
24235,
8378,
15768,
9050,
62,
3466,
1006,
286,
220,
23,
345,
286,
44590,
15,
87,
16,
17,
1259,
286,
609,
15944,
1109,
57727,
25307,
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_remove_published_txs() {
let network = Network::LocalNet;
let consensus_constants = network.create_consensus_constants();
let tx1 = Arc::new(tx!(MicroTari(10_000), fee: MicroTari(50), inputs:2, outputs: 1).0);
let tx2 = Arc::new(tx!(MicroTari(10_000), fee: MicroTari(20), inputs:3, outputs: 1).0);
let tx3 = Arc::new(tx!(MicroTari(10_000), fee: MicroTari(100), inputs:2, outputs: 1).0);
let tx4 = Arc::new(tx!(MicroTari(10_000), fee: MicroTari(30), inputs:4, outputs: 1).0);
let tx5 = Arc::new(tx!(MicroTari(10_000), fee: MicroTari(50), inputs:3, outputs: 1).0);
let tx6 = Arc::new(tx!(MicroTari(10_000), fee: MicroTari(75), inputs:2, outputs: 1).0);
let mut unconfirmed_pool = UnconfirmedPool::new(UnconfirmedPoolConfig {
storage_capacity: 10,
weight_tx_skip_count: 3,
});
unconfirmed_pool
.insert_txs(vec![tx1.clone(), tx2.clone(), tx3.clone(), tx4.clone(), tx5.clone()])
.unwrap();
// utx6 should not be added to unconfirmed_pool as it is an unknown transactions that was included in the block
// by another node
let snapshot_txs = unconfirmed_pool.snapshot();
assert_eq!(snapshot_txs.len(), 5);
assert!(snapshot_txs.contains(&tx1));
assert!(snapshot_txs.contains(&tx2));
assert!(snapshot_txs.contains(&tx3));
assert!(snapshot_txs.contains(&tx4));
assert!(snapshot_txs.contains(&tx5));
let published_block = create_orphan_block(
0,
vec![(*tx1).clone(), (*tx3).clone(), (*tx5).clone()],
&consensus_constants,
);
let _ = unconfirmed_pool.remove_published_and_discard_double_spends(&published_block);
assert_eq!(
unconfirmed_pool.has_tx_with_excess_sig(&tx1.body.kernels()[0].excess_sig),
false
);
assert_eq!(
unconfirmed_pool.has_tx_with_excess_sig(&tx2.body.kernels()[0].excess_sig),
true
);
assert_eq!(
unconfirmed_pool.has_tx_with_excess_sig(&tx3.body.kernels()[0].excess_sig),
false
);
assert_eq!(
unconfirmed_pool.has_tx_with_excess_sig(&tx4.body.kernels()[0].excess_sig),
true
);
assert_eq!(
unconfirmed_pool.has_tx_with_excess_sig(&tx5.body.kernels()[0].excess_sig),
false
);
assert_eq!(
unconfirmed_pool.has_tx_with_excess_sig(&tx6.body.kernels()[0].excess_sig),
false
);
assert!(unconfirmed_pool.check_status());
} | rust_cleaned_test_functions.jsonl/27096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
69524,
17805,
82,
368,
341,
286,
1077,
3922,
284,
8141,
486,
7319,
6954,
280,
286,
1077,
23869,
55642,
284,
3922,
2520,
31971,
13626,
55642,
543,
286,
1077,
9854,
16,
284,
19689,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_get_version() {
let bob_pubkey = Pubkey::new_rand();
let (io, meta, ..) = start_rpc_handler_with_tx(&bob_pubkey);
let req = format!(r#"{{"jsonrpc":"2.0","id":1,"method":"getVersion"}}"#);
let res = io.handle_request_sync(&req, meta);
let expected = json!({
"jsonrpc": "2.0",
"result": {
"solana-core": VERSION
},
"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!(expected, result);
} | rust_cleaned_test_functions.jsonl/20313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
9438,
368,
341,
286,
1077,
35192,
34014,
792,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
320,
815,
11,
8823,
11,
5241,
8,
284,
1191,
60799,
10183,
6615,
17805,
2099,
47086,
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_get_trace() {
// Test getting a stack trace from a real running program using system Ruby
let cmd = RubyScript::new("./ci/ruby-programs/infinite.rb");
let pid = cmd.id() as Pid;
let mut getter = initialize(pid, true, None).unwrap();
std::thread::sleep(std::time::Duration::from_millis(50));
let trace = getter.get_trace();
assert!(trace.is_ok());
assert_eq!(trace.unwrap().pid, Some(pid));
} | rust_cleaned_test_functions.jsonl/90833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
23575,
368,
341,
286,
442,
3393,
3709,
264,
5611,
11655,
504,
264,
1931,
4303,
2025,
1667,
1849,
23726,
198,
286,
1077,
5439,
284,
23726,
5910,
486,
931,
13988,
5855,
7382,
20028,
9838,
5077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_access_indexed_object_returned_from_function_call() {
let b = ast::BaseNode::default();
let pkg =
Parser::new("f()[3]").parse_single_package("path".to_string(), "foo.flux".to_string());
let got = test_convert(pkg).unwrap();
let symbols = collect_symbols(&got);
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Index(Box::new(IndexExpr {
loc: b.location.clone(),
typ: type_info(),
array: Expression::Call(Box::new(CallExpr {
loc: b.location.clone(),
typ: type_info(),
pipe: None,
callee: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["f"].clone(),
}),
arguments: Vec::new(),
})),
index: Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 3,
}),
})),
})],
}],
};
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/131383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1046
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
12759,
3560,
291,
5314,
12511,
291,
5673,
9174,
13429,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
4035,
310,
21102,
486,
931,
445,
69,
10116,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compression() {
let client = TestClient::new();
let uncompressed =
b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit \
anim id est laborum.";
let compressed: ResultOfCompressZstd = client.request(
"utils.compress_zstd",
ParamsOfCompressZstd {
uncompressed: base64::encode(uncompressed),
level: Some(21),
}
).unwrap();
assert_eq!(
compressed.compressed,
"KLUv/QCAdQgAJhc5GJCnsA2AIm2tVzjno88mHb3Ttx9b8fXHHDAAMgAyAMUsVo6Pi3rPTDF2WDl510aHTwt44hrUxb\
n5oF6iUfiUiRbQhYo/PSM2WvKYt/hMIOQmuOaY/bmJQoRky46EF+cEd+Thsep5Hloo9DLCSwe1vFwcqIHycEKlMqBSo\
+szAiIBhkukH5kSIVlFukEWNF2SkIv6HBdPjFAjoUliCPjzKB/4jK91X95rTAKoASkPNqwUEw2Gkscdb3lR8YRYOR+P\
0sULCqzPQ8mQFJWnBSyP25mWIY2bFEUSJiGsWD+9NBqLhIAGDggQkLMbt5Y1aDR4uLKqwJXmQFPg/XTXIL7LCgspIF1\
YYplND4Uo"
);
let decompressed: ResultOfDecompressZstd = client.request(
"utils.decompress_zstd",
ParamsOfDecompressZstd {
compressed: compressed.compressed
}
).unwrap();
let decompressed = base64::decode(&decompressed.decompressed).unwrap();
assert_eq!(decompressed, uncompressed);
} | rust_cleaned_test_functions.jsonl/87456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 843
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
4011,
368,
341,
262,
1077,
2943,
284,
3393,
2959,
486,
931,
543,
262,
1077,
92382,
4035,
286,
293,
1,
32783,
26342,
23655,
2444,
27212,
11,
35140,
57924,
30060,
11,
10923,
653,
79122,
18965,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_column_duration() {
let fields = vec![field_type(FieldTypeTp::Duration)];
let duration = Duration::parse(b"10:11:12", 0).unwrap();
let data = vec![Datum::Null, Datum::Dur(duration)];
test_colum_datum(fields, data);
} | rust_cleaned_test_functions.jsonl/24365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
25454,
368,
341,
286,
1077,
5043,
284,
7486,
20703,
2566,
1819,
57788,
929,
62241,
486,
12945,
12587,
286,
1077,
8090,
284,
21045,
486,
6400,
1883,
1,
16,
15,
25,
16,
16,
25,
16,
17,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bank_parent_account_spend() {
let (genesis_config, mint_keypair) = create_genesis_config(2);
let key1 = Keypair::new();
let key2 = Keypair::new();
let parent = Arc::new(Bank::new(&genesis_config));
let tx =
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_config.hash());
assert_eq!(parent.process_transaction(&tx), Ok(()));
let bank = new_from_parent(&parent);
let tx = system_transaction::transfer(&key1, &key2.pubkey(), 1, genesis_config.hash());
assert_eq!(bank.process_transaction(&tx), Ok(()));
assert_eq!(parent.get_signature_status(&tx.signatures[0]), None);
} | rust_cleaned_test_functions.jsonl/2579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
15960,
13500,
643,
3740,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
17,
317,
286,
1077,
1376,
16,
284,
6569,
1082,
1310,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_classes_1() {
check_output_default(
"class DevonshireCream {\n\
serveOn() {\n\
return \"Scones\";\n\
}\n\
}\n\
\n\
print DevonshireCream;",
"LoxClass(DevonshireCream)",
)
} | rust_cleaned_test_functions.jsonl/111847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16833,
62,
16,
368,
341,
286,
1779,
7645,
9993,
1006,
310,
330,
1040,
59334,
14909,
98781,
28152,
77,
5661,
2290,
8683,
1925,
368,
28152,
77,
5661,
338,
470,
7245,
50,
443,
288,
2105,
17882,
77,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_twiddle_all_0s() {
let mut to_test = [0; 8];
twiddle(&mut to_test);
assert_eq!(to_test, [0, 0, 0, 0, 0, 0, 0, 0]);
} | rust_cleaned_test_functions.jsonl/54021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54178,
3310,
5705,
62,
15,
82,
368,
341,
286,
1077,
5206,
311,
4452,
284,
508,
15,
26,
220,
23,
935,
286,
4384,
3310,
2099,
6984,
311,
4452,
317,
286,
2060,
10714,
10297,
983,
4452,
11,
508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partial_isa_subclass_superclass() -> TestResult {
let p = Polar::new();
p.load_str(
r#"f(x: PostSubclass) if g(x);
g(_: Post);"#,
)?;
let mut q = p.new_query_from_term(term!(call!("f", [sym!("x")])), false);
let mut next_binding = || loop {
match q.next_event().unwrap() {
QueryEvent::Result { bindings, .. } => return bindings,
QueryEvent::ExternalIsSubclass {
call_id,
left_class_tag,
right_class_tag,
} => {
q.question_result(call_id, left_class_tag.0.starts_with(&right_class_tag.0))
.unwrap();
}
_ => panic!("not bindings"),
}
};
assert_partial_expression!(
next_binding(),
"x",
"_this matches PostSubclass{} and _this matches Post{}"
);
assert_query_done!(q);
Ok(())
} | rust_cleaned_test_functions.jsonl/63010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 604
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
6892,
64,
5228,
1040,
38886,
1040,
368,
1464,
3393,
2077,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
5104,
2895,
1006,
310,
435,
55543,
69,
2075,
25,
3877,
3136,
1040,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_kv_service() {
let (mut server, client) = new_kv_server();
server.start();
let uuid = Uuid::new_v4().as_bytes().to_vec();
let mut head = WriteHead::new();
head.set_uuid(uuid.clone());
let mut m = Mutation::new();
m.op = Mutation_OP::Put;
m.set_key(vec![1]);
m.set_value(vec![1]);
let mut batch = WriteBatch::new();
batch.set_commit_ts(123);
batch.mut_mutations().push(m);
let mut open = OpenRequest::new();
open.set_uuid(uuid.clone());
let mut close = CloseRequest::new();
close.set_uuid(uuid.clone());
// Write an engine before it is opened.
// Only send the write head here to avoid other gRPC errors.
let resp = send_write_head(&client, &head).unwrap();
assert!(resp.get_error().has_engine_not_found());
// Close an engine before it it opened.
let resp = client.close(&close).unwrap();
assert!(resp.get_error().has_engine_not_found());
client.open(&open).unwrap();
let resp = send_write(&client, &head, &batch).unwrap();
assert!(!resp.has_error());
let resp = send_write(&client, &head, &batch).unwrap();
assert!(!resp.has_error());
let resp = client.close(&close).unwrap();
assert!(!resp.has_error());
server.shutdown();
} | rust_cleaned_test_functions.jsonl/127170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97066,
12267,
368,
341,
262,
1077,
320,
6984,
3538,
11,
2943,
8,
284,
501,
97066,
12015,
543,
262,
3538,
4962,
1428,
262,
1077,
16040,
284,
547,
2423,
486,
931,
2273,
19,
1005,
300,
12524,
1005,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_0217_example_2() {
let nums = vec![1, 2, 3, 4];
let result = false;
assert_eq!(Solution::contains_duplicate(nums), result);
} | rust_cleaned_test_functions.jsonl/47675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
17,
16,
22,
39304,
62,
17,
368,
341,
286,
1077,
10307,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
1077,
1102,
284,
895,
401,
286,
2060,
10714,
10297,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rent_eager_across_epoch_without_gap_under_multi_epoch_cycle() {
let leader_pubkey = solana_sdk::pubkey::new_rand();
let leader_lamports = 3;
let mut genesis_config =
create_genesis_config_with_leader(5, &leader_pubkey, leader_lamports).genesis_config;
genesis_config.cluster_type = ClusterType::MainnetBeta;
const SLOTS_PER_EPOCH: u64 = MINIMUM_SLOTS_PER_EPOCH as u64;
const LEADER_SCHEDULE_SLOT_OFFSET: u64 = SLOTS_PER_EPOCH * 3 - 3;
genesis_config.epoch_schedule =
EpochSchedule::custom(SLOTS_PER_EPOCH, LEADER_SCHEDULE_SLOT_OFFSET, false);
let mut bank = Arc::new(Bank::new(&genesis_config));
assert_eq!(DEFAULT_SLOTS_PER_EPOCH, 432_000);
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (0, 0));
assert_eq!(bank.rent_collection_partitions(), vec![(0, 0, 432_000)]);
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (0, 1));
assert_eq!(bank.rent_collection_partitions(), vec![(0, 1, 432_000)]);
for _ in 2..32 {
bank = Arc::new(new_from_parent(&bank));
}
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (0, 31));
assert_eq!(bank.rent_collection_partitions(), vec![(30, 31, 432_000)]);
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (1, 0));
assert_eq!(bank.rent_collection_partitions(), vec![(31, 32, 432_000)]);
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (1, 1));
assert_eq!(bank.rent_collection_partitions(), vec![(32, 33, 432_000)]);
bank = Arc::new(Bank::new_from_parent(&bank, &Pubkey::default(), 1000));
bank = Arc::new(Bank::new_from_parent(&bank, &Pubkey::default(), 1001));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (31, 9));
assert_eq!(
bank.rent_collection_partitions(),
vec![(1000, 1001, 432_000)]
);
bank = Arc::new(Bank::new_from_parent(&bank, &Pubkey::default(), 431_998));
bank = Arc::new(Bank::new_from_parent(&bank, &Pubkey::default(), 431_999));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (13499, 31));
assert_eq!(
bank.rent_collection_partitions(),
vec![(431_998, 431_999, 432_000)]
);
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (13500, 0));
assert_eq!(bank.rent_collection_partitions(), vec![(0, 0, 432_000)]);
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (13500, 1));
assert_eq!(bank.rent_collection_partitions(), vec![(0, 1, 432_000)]);
} | rust_cleaned_test_functions.jsonl/2539 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1664
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
2204,
1409,
14718,
2128,
20682,
39904,
51790,
58228,
25133,
20682,
39079,
368,
341,
286,
1077,
7653,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
7653,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_por_circuit_poseidon_base_2_private_root() {
test_por_circuit_private_root::<TreeBase<PoseidonHasher, U2>>(1_886);
} | rust_cleaned_test_functions.jsonl/108260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76628,
666,
37268,
33201,
90456,
7651,
62,
17,
26249,
12993,
368,
341,
262,
1273,
76628,
666,
37268,
26249,
12993,
27638,
6533,
3978,
21604,
960,
90456,
6370,
261,
11,
547,
17,
25526,
16,
62,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_add_remove() {
let mut pts = ::math::Points::new();
for x in 0u32 .. 10 {
for y in 0u32 .. 10 {
for z in 0 .. 10 {
pts.add(Vec3::new(x as f32, y as f32, z as f32));
}
}
}
let mut o = ::math::Octree::new();
for i in 1 .. pts.len() + 1 {
o.add(i as u32, &pts);
}
for i in 1 .. pts.len() + 1 {
o.remove(i as u32, &pts);
}
} | rust_cleaned_test_functions.jsonl/80200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
18193,
368,
341,
10217,
5206,
29993,
284,
3504,
10374,
486,
11411,
486,
931,
543,
2023,
856,
304,
220,
15,
84,
18,
17,
5241,
220,
16,
15,
341,
197,
2023,
379,
304,
220,
15,
84,
18,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_h2_content_length() {
use actix_http::http::{
header::{HeaderName, HeaderValue},
StatusCode,
};
let openssl = ssl_acceptor().unwrap();
let mut srv = TestServer::new(move || {
openssl
.clone()
.map_err(|e| println!("Openssl error: {}", e))
.and_then(
HttpService::build()
.h2(|req: Request| {
let indx: usize = req.uri().path()[1..].parse().unwrap();
let statuses = [
StatusCode::NO_CONTENT,
StatusCode::CONTINUE,
StatusCode::SWITCHING_PROTOCOLS,
StatusCode::PROCESSING,
StatusCode::OK,
StatusCode::NOT_FOUND,
];
future::ok::<_, ()>(Response::new(statuses[indx]))
})
.map_err(|_| ()),
)
});
let header = HeaderName::from_static("content-length");
let value = HeaderValue::from_static("0");
{
for i in 0..4 {
let req = srv
.request(http::Method::GET, srv.surl(&format!("/{}", i)))
.send();
let response = srv.block_on(req).unwrap();
assert_eq!(response.headers().get(&header), None);
let req = srv
.request(http::Method::HEAD, srv.surl(&format!("/{}", i)))
.send();
let response = srv.block_on(req).unwrap();
assert_eq!(response.headers().get(&header), None);
}
for i in 4..6 {
let req = srv
.request(http::Method::GET, srv.surl(&format!("/{}", i)))
.send();
let response = srv.block_on(req).unwrap();
assert_eq!(response.headers().get(&header), Some(&value));
}
}
} | rust_cleaned_test_functions.jsonl/102545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
17,
7495,
5118,
368,
341,
262,
990,
1160,
941,
25888,
486,
1254,
74843,
286,
4247,
22964,
4047,
675,
11,
12104,
1130,
1583,
286,
53403,
345,
262,
2605,
262,
1077,
80733,
284,
33537,
35728,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_clone_from_slice() {
#[derive(Clone, Debug, Eq, PartialEq)]
struct X(u32);
let s: &[X] = &[X(1), X(2), X(3)];
let r: Rc<[X]> = Rc::from(s);
assert_eq!(&r[..], s);
} | rust_cleaned_test_functions.jsonl/4673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
5673,
26488,
368,
341,
286,
11506,
27098,
65297,
11,
11091,
11,
33122,
11,
55039,
5563,
286,
2036,
1599,
8154,
18,
17,
626,
286,
1077,
274,
25,
44590,
55,
60,
284,
44590,
55,
7,
16,
701... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_deps_rec() {
let protos = protos();
let mut map = HashMap::new();
for proto in protos {
add_deps_rec(&proto, &proto, &mut map);
}
assert_eq!(map, {
let mut map = HashMap::new();
map.insert("a".into(), {
let mut set = HashSet::new();
set.insert("a".into());
set
});
map.insert("b".into(), {
let mut set = HashSet::new();
set.insert("a".into());
set.insert("b".into());
set
});
map.insert("c".into(), {
let mut set = HashSet::new();
set.insert("a".into());
set.insert("b".into());
set.insert("c".into());
set
});
map.insert("d".into(), {
let mut set = HashSet::new();
set.insert("a".into());
set.insert("c".into());
set.insert("d".into());
set
});
map
});
} | rust_cleaned_test_functions.jsonl/8977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 691
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
76489,
7080,
368,
341,
286,
1077,
1724,
436,
284,
1724,
436,
543,
286,
1077,
5206,
2415,
284,
10528,
486,
931,
543,
286,
369,
18433,
304,
1724,
436,
341,
310,
912,
76489,
7080,
2099,
15110... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_idempotent_quickcheck_bug2() {
let mut m: TMap = Map::new();
m.apply(map::Op::Up {
dot: Dot::new(32, 5),
key: 0,
op: map::Op::Up {
dot: Dot::new(32, 5),
key: 0,
op: mvreg::Op::Put {
clock: VClock::new(),
val: 0,
},
},
});
let m_snapshot = m.clone();
// m ^ m
m.merge(m_snapshot.clone());
// m ^ m = m
assert_eq!(m, m_snapshot);
} | rust_cleaned_test_functions.jsonl/61632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
842,
3262,
63532,
82094,
2028,
73232,
17,
368,
341,
262,
1077,
5206,
296,
25,
350,
2227,
284,
5027,
486,
931,
1428,
262,
296,
13045,
9147,
486,
7125,
486,
2324,
341,
286,
12756,
25,
31262,
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_continuously_stream_transactions() {
// Create a new streaming service client and listener
let (streaming_service_client, streaming_service_listener) =
new_streaming_service_client_listener_pair();
// Note the request we expect to receive on the streaming service side
let known_version = 101;
let known_epoch = 2;
let include_events = false;
let target = None;
let expected_request =
StreamRequest::ContinuouslyStreamTransactions(ContinuouslyStreamTransactionsRequest {
known_version,
known_epoch,
include_events,
target: target.clone(),
});
// Spawn a new server thread to handle any continuous transaction stream requests
let _handler = spawn_service_and_expect_request(streaming_service_listener, expected_request);
// Send a continuous transaction stream request and verify we get a data stream listener
let response = block_on(streaming_service_client.continuously_stream_transactions(
known_version,
known_epoch,
include_events,
target,
));
assert_ok!(response);
} | rust_cleaned_test_functions.jsonl/125043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68948,
65635,
12673,
68182,
368,
341,
262,
442,
4230,
264,
501,
16842,
2473,
2943,
323,
11446,
198,
262,
1077,
320,
4027,
287,
12267,
8179,
11,
16842,
12267,
46493,
8,
4035,
286,
501,
12673,
287,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_index() {
let index_name = "test_delete_index";
let mut client = make_client();
clean_db(&mut client, index_name);
{
let result = client
.index(index_name, "test_type")
.with_doc(&TestDocument::new().with_int_field(1))
.send();
assert!(result.is_ok());
}
{
let result = client.delete_index(index_name);
info!("DELETE INDEX RESULT: {:?}", result);
assert!(result.is_ok());
let result_wrapped = result.unwrap();
assert!(result_wrapped.acknowledged);
}
} | rust_cleaned_test_functions.jsonl/69580 | {
"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,
11353,
3560,
368,
341,
286,
1077,
1922,
1269,
284,
330,
1944,
11353,
3560,
876,
286,
1077,
5206,
2943,
284,
1281,
8179,
1428,
286,
4240,
8685,
2099,
6984,
2943,
11,
1922,
1269,
317,
286,
341,
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_fold_comparison4() {
fold_same("[] == false"); // true
fold_same("[] == true"); // false
fold_same("[0] == false"); // true
fold_same("[0] == true"); // false
fold_same("[1] == false"); // false
fold_same("[1] == true"); // true
fold_same("({}) == false"); // false
fold_same("({}) == true"); // true
} | rust_cleaned_test_functions.jsonl/122191 | {
"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,
61187,
90797,
19,
368,
341,
262,
11555,
33574,
445,
1294,
621,
895,
5038,
442,
830,
198,
262,
11555,
33574,
445,
1294,
621,
830,
5038,
442,
895,
198,
262,
11555,
33574,
10937,
15,
60,
621,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_raft_message_with_context() {
let mut msg_buf = BatchMessageBuffer::new(Arc::new(Config::default()));
for i in 0..2 {
let context_len = msg_buf.cfg.max_grpc_send_msg_len as usize;
let context = vec![0; context_len];
let mut msg = RaftMessage::default();
msg.set_region_id(1);
let mut region_epoch = RegionEpoch::default();
region_epoch.conf_ver = 1;
region_epoch.version = 0x123456;
msg.set_region_epoch(region_epoch);
msg.set_start_key(b"12345".to_vec());
msg.set_end_key(b"67890".to_vec());
msg.mut_message().set_snapshot(Snapshot::default());
msg.mut_message().set_commit(0);
if i != 0 {
msg.mut_message().set_context(context.into());
}
msg_buf.push(msg);
}
assert!(msg_buf.full());
} | rust_cleaned_test_functions.jsonl/108725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 494
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
62,
2944,
6462,
6615,
8467,
368,
341,
286,
1077,
5206,
3750,
10363,
284,
33904,
2052,
4095,
486,
931,
4346,
1287,
486,
931,
33687,
486,
2258,
7392,
286,
369,
600,
304,
220,
15,
496,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_decode_invalid_transaction() {
// This transaction will not pass sanitization
let unsanitary_transaction = EncodedTransaction::Binary(
"ju9xZWuDBX4pRxX2oZkTjxU5jB4SSTgEGhX8bQ8PURNzyzqKMPPpNvWihx8zUe\
FfrbVNoAaEsNKZvGzAnTDy5bhNT9kt6KFCTBixpvrLCzg4M5UdFUQYrn1gdgjX\
pLHxcaShD81xBNaFDgnA2nkkdHnKtZt4hVSfKAmw3VRZbjrZ7L2fKZBx21CwsG\
hD6onjM2M3qZW5C8J6d1pj41MxKmZgPBSha3MyKkNLkAGFASK"
.to_string(),
UiTransactionEncoding::Base58,
);
assert!(unsanitary_transaction.decode().is_none());
} | rust_cleaned_test_functions.jsonl/39011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
31433,
28884,
368,
341,
286,
442,
1096,
7745,
686,
537,
1494,
19812,
2022,
198,
286,
1077,
6975,
276,
44806,
28884,
284,
10751,
6737,
8070,
486,
21338,
1006,
310,
330,
8613,
24,
87,
81756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_building_and_parsing() {
let index = 4816;
let timestamp = 54658;
let prev = String::from("ngiurengoiurehgbiuergneoigjoierhg");
let sign_key = String::from("0000");
let content = String::from("Some string");
let new_block = BlockGen {
index: index.clone(),
timestamp: timestamp.clone(),
sign_key: sign_key.clone(),
prev: prev.clone(),
content: content.clone()
};
let new_block = new_block.to_bytes();
let complete = parser::parse_payload(&new_block);
let parsed = BlockGen::parse(complete).unwrap();
assert_eq!(index, parsed.index);
assert_eq!(timestamp, parsed.timestamp);
assert_eq!(sign_key, parsed.sign_key);
assert_eq!(prev, parsed.prev);
assert_eq!(content, parsed.content);
} | rust_cleaned_test_functions.jsonl/62815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82397,
8378,
620,
28598,
368,
341,
286,
1077,
1922,
284,
220,
19,
23,
16,
21,
280,
286,
1077,
11441,
284,
220,
20,
19,
21,
20,
23,
280,
286,
1077,
7872,
284,
923,
486,
1499,
445,
968,
72,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_messages_update_status() {
let _setup = SetupMocks::init();
AgencyMockDecrypted::set_next_decrypted_response(constants::GET_MESSAGES_DECRYPTED_RESPONSE);
let status = CString::new("MS-103").unwrap().into_raw();
let json = CString::new(r#"[{"pairwiseDID":"QSrw8hebcvQxiwBETmAaRs","uids":["mgrmngq"]}]"#).unwrap().into_raw();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_messages_update_status(cb.command_handle,
status,
json,
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(TimeoutUtils::some_medium()).unwrap();
} | rust_cleaned_test_functions.jsonl/35825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23428,
8882,
4773,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
16379,
11571,
4900,
14026,
486,
746,
11257,
13783,
14026,
9655,
80368,
486,
3806,
69485,
2881,
42917,
147... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.