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_insert_equals() {
let mut cl = Cmdline::new(100);
assert_eq!(cl.insert("a=", "b"), Err(Error::HasEquals));
assert_eq!(cl.insert("a", "b="), Err(Error::HasEquals));
assert_eq!(cl.insert("a=", "b "), Err(Error::HasEquals));
assert_eq!(cl.insert("=a", "b"), Err(Error::HasEquals));
assert_eq!(cl.insert("a", "=b"), Err(Error::HasEquals));
assert_eq!(cl.as_str(), "");
} | rust_cleaned_test_functions.jsonl/29215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
61664,
368,
341,
286,
1077,
5206,
1185,
284,
40210,
1056,
486,
931,
7,
16,
15,
15,
317,
286,
2060,
10714,
10297,
564,
7030,
445,
64,
21369,
330,
65,
3975,
15495,
37396,
486,
10281,
4315,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_guild_channel_guild_id() {
assert_eq!(
GuildChannel::Category(guild_category()).guild_id(),
Some(GuildId(321))
);
assert_eq!(
GuildChannel::Text(guild_text()).guild_id(),
Some(GuildId(321))
);
assert_eq!(
GuildChannel::Voice(guild_voice()).guild_id(),
Some(GuildId(321))
);
assert_eq!(
GuildChannel::Stage(guild_stage()).guild_id(),
Some(GuildId(321))
);
} | rust_cleaned_test_functions.jsonl/54433 | {
"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,
1889,
1498,
14571,
1889,
1498,
842,
368,
341,
286,
2060,
10714,
33673,
310,
32492,
9629,
486,
6746,
92103,
11847,
6011,
57877,
842,
3148,
310,
4329,
6699,
1498,
764,
7,
18,
17,
16,
1171,
286,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fuel_required() {
assert_eq!(fuel_required(12), 2);
assert_eq!(fuel_required(14), 2);
assert_eq!(fuel_required(1969), 654);
assert_eq!(fuel_required(100_756), 33_583);
} | rust_cleaned_test_functions.jsonl/37466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
4000,
18743,
368,
341,
286,
2060,
10714,
10297,
63375,
18743,
7,
16,
17,
701,
220,
17,
317,
286,
2060,
10714,
10297,
63375,
18743,
7,
16,
19,
701,
220,
17,
317,
286,
2060,
10714,
10297,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rw() {
let e: Element = Element::parse(File::open("tests/data/rw.xml").unwrap()).unwrap();
let mut buf = Vec::new();
e.write(&mut buf);
let e2 = Element::parse(Cursor::new(buf)).unwrap();
assert_eq!(e, e2);
} | rust_cleaned_test_functions.jsonl/15711 | {
"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,
49566,
368,
1476,
262,
1077,
384,
25,
8543,
284,
8543,
486,
6400,
19821,
486,
2508,
445,
23841,
13167,
7382,
86,
9028,
1827,
15454,
6011,
15454,
1428,
262,
1077,
5206,
6607,
284,
11312,
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_mov_reg_memindex() {
assert_emit!(0x48, 0x89, 0x54, 0x88, 0x0c;
emit_mov_reg_memindex(MachineMode::Ptr, RDX, RAX, RCX, 4, 12));
assert_emit!(0x89, 0x54, 0x88, 0x0c;
emit_mov_reg_memindex(MachineMode::Int32, RDX, RAX, RCX, 4, 12));
assert_emit!(0x88, 0x54, 0x88, 0x0c;
emit_mov_reg_memindex(MachineMode::Int8, RDX, RAX, RCX, 4, 12));
assert_emit!(0x4f, 0x89, 0x6c, 0xfe, 0x10;
emit_mov_reg_memindex(MachineMode::Ptr, R13, R14, R15, 8, 16));
} | rust_cleaned_test_functions.jsonl/85480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55798,
4920,
12976,
1252,
368,
341,
286,
2060,
69082,
10297,
15,
87,
19,
23,
11,
220,
15,
87,
23,
24,
11,
220,
15,
87,
20,
19,
11,
220,
15,
87,
23,
23,
11,
220,
15,
87,
15,
66,
280,
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_column_writer_small_write_batch_size() {
for i in vec![1, 2, 5, 10, 11, 1023] {
let props = WriterProperties::builder().set_write_batch_size(i).build();
column_roundtrip_random::<Int32Type>(
"test_col_writer_rnd_5",
props,
1024,
::std::i32::MIN,
::std::i32::MAX,
10,
10,
);
}
} | rust_cleaned_test_functions.jsonl/30537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
28908,
31966,
9165,
14534,
2368,
368,
341,
286,
369,
600,
304,
7486,
20703,
16,
11,
220,
17,
11,
220,
20,
11,
220,
16,
15,
11,
220,
16,
16,
11,
220,
16,
15,
17,
18,
60,
341,
310,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_cli_deploy() {
solana_logger::setup();
let mut pathbuf = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
pathbuf.push("tests");
pathbuf.push("fixtures");
pathbuf.push("noop");
pathbuf.set_extension("so");
// Success case
let mut config = CliConfig::default();
let account_info_response = json!(Response {
context: RpcResponseContext { slot: 1 },
value: Value::Null,
});
let mut mocks = HashMap::new();
mocks.insert(RpcRequest::GetAccountInfo, account_info_response);
let rpc_client = RpcClient::new_mock_with_mocks("".to_string(), mocks);
config.rpc_client = Some(rpc_client);
let default_keypair = Keypair::new();
config.signers = vec![&default_keypair];
config.command = CliCommand::Deploy {
program_location: pathbuf.to_str().unwrap().to_string(),
address: None,
use_deprecated_loader: false,
allow_excessive_balance: false,
};
config.output_format = OutputFormat::JsonCompact;
let result = process_command(&config);
let json: Value = serde_json::from_str(&result.unwrap()).unwrap();
let program_id = json
.as_object()
.unwrap()
.get("programId")
.unwrap()
.as_str()
.unwrap();
assert!(program_id.parse::<Pubkey>().is_ok());
// Failure case
config.command = CliCommand::Deploy {
program_location: "bad/file/location.so".to_string(),
address: None,
use_deprecated_loader: false,
allow_excessive_balance: false,
};
assert!(process_command(&config).is_err());
} | rust_cleaned_test_functions.jsonl/30955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 852
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
91890,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
5206,
1815,
5909,
284,
7933,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
4010,
286,
1815,
5909,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_url() {
let re = ResourceDef::new("/user/{id}/test");
let url = Uri::try_from("/user/2345/test").unwrap();
let mut path = Path::new(Url::new(url));
assert!(re.match_path(&mut path));
assert_eq!(path.get("id").unwrap(), "2345");
let url = Uri::try_from("/user/qwe%25/test").unwrap();
let mut path = Path::new(Url::new(url));
assert!(re.match_path(&mut path));
assert_eq!(path.get("id").unwrap(), "qwe%");
let url = Uri::try_from("/user/qwe%25rty/test").unwrap();
let mut path = Path::new(Url::new(url));
assert!(re.match_path(&mut path));
assert_eq!(path.get("id").unwrap(), "qwe%rty");
} | rust_cleaned_test_functions.jsonl/12756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
2903,
368,
341,
286,
1077,
312,
284,
11765,
2620,
486,
931,
4283,
872,
9388,
307,
4472,
1944,
3071,
286,
1077,
2515,
284,
17226,
486,
1539,
5673,
4283,
872,
14,
17,
18,
19,
20,
12697,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_string() {
let r = Registry::new();
let mut sw = StringWriter::new();
let mut ctx = Context::null();
let mut hlps = HashMap::new();
{
let mut rc = RenderContext::new(&mut ctx, &mut hlps, &mut sw);
let raw_string = RawString("<h1>hello world</h1>".to_string());
raw_string.render(&r, &mut rc).ok().unwrap();
}
assert_eq!(sw.to_string(), "<h1>hello world</h1>".to_string());
} | rust_cleaned_test_functions.jsonl/21861 | {
"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,
16067,
3904,
368,
341,
262,
1077,
435,
284,
32112,
486,
931,
543,
262,
1077,
5206,
2021,
284,
84787,
486,
931,
543,
262,
1077,
5206,
5635,
284,
9608,
486,
2921,
543,
262,
1077,
5206,
49586,
1690... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_query() {
use crate::*;
let string = "2020-01-01 02:02:02 +0800";
let timestamp = OffsetDateTime::parse(string, "%Y-%m-%d %H:%M:%S %z").unwrap();
let query = Query::select().expr(Expr::val(timestamp)).to_owned();
let formatted = "2020-01-01 02:02:02 +0800";
assert_eq!(
query.to_string(MysqlQueryBuilder),
format!("SELECT '{}'", formatted)
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
format!("SELECT '{}'", formatted)
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
format!("SELECT '{}'", formatted)
);
} | rust_cleaned_test_functions.jsonl/12494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
5738,
368,
341,
286,
990,
17717,
79304,
286,
1077,
914,
284,
330,
17,
15,
17,
15,
12,
15,
16,
12,
15,
16,
220,
15,
17,
25,
15,
17,
25,
15,
17,
488,
15,
23,
15,
15,
876,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arc_cyclic_two_refs() {
struct TwoRefs {
inner1: Weak<TwoRefs>,
inner2: Weak<TwoRefs>,
}
let two_refs = Arc::new_cyclic(|inner| {
assert_eq!(inner.strong_count(), 0);
assert!(inner.upgrade().is_none());
let inner1 = inner.clone();
let inner2 = inner1.clone();
TwoRefs { inner1, inner2 }
});
assert_eq!(Arc::strong_count(&two_refs), 1);
assert_eq!(Arc::weak_count(&two_refs), 2);
let two_refs1 = Weak::upgrade(&two_refs.inner1).unwrap();
assert!(Arc::ptr_eq(&two_refs, &two_refs1));
let two_refs2 = Weak::upgrade(&two_refs.inner2).unwrap();
assert!(Arc::ptr_eq(&two_refs, &two_refs2));
assert_eq!(Arc::strong_count(&two_refs), 3);
assert_eq!(Arc::weak_count(&two_refs), 2);
} | rust_cleaned_test_functions.jsonl/42737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62914,
666,
65304,
23241,
60638,
368,
341,
262,
2036,
9043,
82807,
341,
286,
9179,
16,
25,
41164,
3125,
1126,
82807,
12520,
286,
9179,
17,
25,
41164,
3125,
1126,
82807,
12520,
262,
456,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mat_times_identity_equals_mat() {
test_cases().iter().for_each(|test| {
let a_mat_times_identity = test.a_mat * Matrix2x2::identity();
let b_mat_times_identity = test.b_mat * Matrix2x2::identity();
assert_eq!(a_mat_times_identity, test.a_mat);
assert_eq!(b_mat_times_identity, test.b_mat);
})
} | rust_cleaned_test_functions.jsonl/128956 | {
"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,
16610,
22353,
46244,
61664,
16610,
368,
341,
286,
1273,
41427,
1005,
2015,
1005,
1958,
32046,
22428,
1944,
91,
341,
310,
1077,
264,
16610,
22353,
46244,
284,
1273,
5849,
16610,
353,
11631,
17,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiply_with_monic_monomial() {
// 9 + 2x + 75x^2 + 128x^3
let orig = UnivarPolynomial(FieldElementVector::from(vec![
FieldElement::from(9u64),
FieldElement::from(2u64),
FieldElement::from(75u64),
FieldElement::from(128u64),
]));
let monomial_degree = 0;
let new = orig.multiply_by_monic_monomial(monomial_degree);
assert_eq!(new, orig);
let monomial_degree = 1;
let new = orig.multiply_by_monic_monomial(monomial_degree);
assert_eq!(new.degree(), 4);
assert_eq!(new[0], FieldElement::zero());
assert_eq!(new[1], FieldElement::from(9u64));
assert_eq!(new[2], FieldElement::from(2u64));
assert_eq!(new[3], FieldElement::from(75u64));
assert_eq!(new[4], FieldElement::from(128u64));
let monomial_degree = 2;
let new = orig.multiply_by_monic_monomial(monomial_degree);
assert_eq!(new.degree(), 5);
assert_eq!(new[0], FieldElement::zero());
assert_eq!(new[1], FieldElement::zero());
assert_eq!(new[2], FieldElement::from(9u64));
assert_eq!(new[3], FieldElement::from(2u64));
assert_eq!(new[4], FieldElement::from(75u64));
assert_eq!(new[5], FieldElement::from(128u64));
// 1 + 4x^2 + 5x^3 + 18x^6
let orig = UnivarPolynomial(FieldElementVector::from(vec![
FieldElement::one(),
FieldElement::zero(),
FieldElement::from(4u64),
FieldElement::from(5u64),
FieldElement::zero(),
FieldElement::zero(),
FieldElement::from(18u64),
]));
let monomial_degree = 0;
let new = orig.multiply_by_monic_monomial(monomial_degree);
assert_eq!(new, orig);
let monomial_degree = 1;
let new = orig.multiply_by_monic_monomial(monomial_degree);
assert_eq!(new.degree(), 7);
assert_eq!(new[0], FieldElement::zero());
assert_eq!(new[1], FieldElement::one());
assert_eq!(new[2], FieldElement::zero());
assert_eq!(new[3], FieldElement::from(4));
assert_eq!(new[4], FieldElement::from(5));
assert_eq!(new[5], FieldElement::zero());
assert_eq!(new[6], FieldElement::zero());
assert_eq!(new[7], FieldElement::from(18));
let monomial_degree = 2;
let new = orig.multiply_by_monic_monomial(monomial_degree);
assert_eq!(new.degree(), 8);
assert_eq!(new[0], FieldElement::zero());
assert_eq!(new[1], FieldElement::zero());
assert_eq!(new[2], FieldElement::one());
assert_eq!(new[3], FieldElement::zero());
assert_eq!(new[4], FieldElement::from(4));
assert_eq!(new[5], FieldElement::from(5));
assert_eq!(new[6], FieldElement::zero());
assert_eq!(new[7], FieldElement::zero());
assert_eq!(new[8], FieldElement::from(18));
} | rust_cleaned_test_functions.jsonl/51319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
93054,
6615,
717,
14011,
717,
14274,
530,
368,
341,
286,
442,
220,
24,
488,
220,
17,
87,
488,
220,
22,
20,
87,
61,
17,
488,
220,
16,
17,
23,
87,
61,
18,
198,
286,
1077,
2713,
284,
1230,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_where_predicates() {
fn assert_bound(text: &str, bound: Option<TypeBound>) {
assert_eq!(text, bound.unwrap().syntax().text().to_string());
}
let file = SourceFile::parse(
r#"
fn foo()
where
T: Clone + Copy + Debug + 'static,
'a: 'b + 'c,
Iterator::Item: 'a + Debug,
Iterator::Item: Debug + 'a,
<T as Iterator>::Item: Debug + 'a,
for<'a> F: Fn(&'a str)
{}
"#,
)
.ok()
.unwrap();
let where_clause = file.syntax().descendants().find_map(WhereClause::cast).unwrap();
let mut predicates = where_clause.predicates();
let pred = predicates.next().unwrap();
let mut bounds = pred.type_bound_list().unwrap().bounds();
assert_eq!("T", pred.type_ref().unwrap().syntax().text().to_string());
assert_bound("Clone", bounds.next());
assert_bound("Copy", bounds.next());
assert_bound("Debug", bounds.next());
assert_bound("'static", bounds.next());
let pred = predicates.next().unwrap();
let mut bounds = pred.type_bound_list().unwrap().bounds();
assert_eq!("'a", pred.lifetime_token().unwrap().text());
assert_bound("'b", bounds.next());
assert_bound("'c", bounds.next());
let pred = predicates.next().unwrap();
let mut bounds = pred.type_bound_list().unwrap().bounds();
assert_eq!("Iterator::Item", pred.type_ref().unwrap().syntax().text().to_string());
assert_bound("'a", bounds.next());
let pred = predicates.next().unwrap();
let mut bounds = pred.type_bound_list().unwrap().bounds();
assert_eq!("Iterator::Item", pred.type_ref().unwrap().syntax().text().to_string());
assert_bound("Debug", bounds.next());
assert_bound("'a", bounds.next());
let pred = predicates.next().unwrap();
let mut bounds = pred.type_bound_list().unwrap().bounds();
assert_eq!("<T as Iterator>::Item", pred.type_ref().unwrap().syntax().text().to_string());
assert_bound("Debug", bounds.next());
assert_bound("'a", bounds.next());
let pred = predicates.next().unwrap();
let mut bounds = pred.type_bound_list().unwrap().bounds();
assert_eq!("for<'a> F", pred.type_ref().unwrap().syntax().text().to_string());
assert_bound("Fn(&'a str)", bounds.next());
} | rust_cleaned_test_functions.jsonl/101453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 860
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36814,
12830,
24821,
368,
341,
262,
5168,
2060,
19447,
7235,
25,
609,
495,
11,
6822,
25,
6959,
35506,
19568,
9231,
341,
286,
2060,
10714,
10297,
1318,
11,
6822,
55395,
1005,
56193,
1005,
1318,
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... | 1 |
#[test]
fn test_generate_enum_is_from_record_variant() {
check_assist(
generate_enum_is_method,
r#"
enum Variant {
Undefined,
Minor { foo: i32 }$0,
Major,
}"#,
r#"enum Variant {
Undefined,
Minor { foo: i32 },
Major,
}
impl Variant {
/// Returns `true` if the variant is [`Minor`].
///
/// [`Minor`]: Variant::Minor
#[must_use]
fn is_minor(&self) -> bool {
matches!(self, Self::Minor { .. })
}
}"#,
);
} | rust_cleaned_test_functions.jsonl/117715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
31054,
6892,
5673,
14192,
46112,
368,
341,
286,
1779,
12083,
380,
1006,
310,
6923,
31054,
6892,
9032,
345,
310,
435,
2,
698,
9018,
39292,
341,
262,
62370,
345,
262,
29793,
314,
15229,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_method_attr_filtering() {
check_ref_completion(
"method_attr_filtering",
r"
struct A {}
impl A {
#[inline]
fn the_method(&self) {
let x = 1;
let y = 2;
}
}
fn foo(a: A) {
a.<|>
}
",
);
} | rust_cleaned_test_functions.jsonl/53647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9032,
10422,
8727,
287,
368,
341,
286,
1779,
7793,
60164,
1006,
310,
330,
4393,
10422,
8727,
287,
756,
310,
435,
698,
310,
2036,
362,
5613,
310,
11605,
362,
341,
394,
11506,
5057,
921,
394,
5168... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_encoder_single_peer() {
let packet_size: u16 = 1280;
let data_size: usize = packet_size as usize * MAX_SYMBOLS_IN_BLOCK as usize;
let data = gen_data(data_size);
let encoder = match BlockEncoder::new(0, packet_size, data.clone(), None) {
Ok(succ) => succ,
Err(error) => panic!("Failed to create encoder: {}", error),
};
let blocks = encoder.generate_encoded_blocks();
match BlockDecoder::decode_data(&encoder.get_block_info(), blocks) {
Ok(recovered_data) => assert_eq!(arr_eq(&recovered_data, &data), true),
Err(error) => panic!("Failed to decode data: {}", error),
}
} | rust_cleaned_test_functions.jsonl/96423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
39068,
19487,
45159,
368,
341,
262,
1077,
10151,
2368,
25,
575,
16,
21,
284,
220,
16,
17,
23,
15,
280,
262,
1077,
821,
2368,
25,
22301,
284,
10151,
2368,
438,
22301,
353,
8334,
23598,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_conformance() {
let mut s1 = super::Strobe128::new(b"Conformance Test Protocol");
let mut s2 = strobe_rs::Strobe::new(b"Conformance Test Protocol".to_vec(), SecParam::B128);
let msg = vec![99; 1024];
s1.meta_ad(b"ms", false);
s1.meta_ad(b"g", true);
s1.ad(&msg, false);
s2.ad(
msg.clone(),
Some((OpFlags::A | OpFlags::M, b"msg".to_vec())),
false,
);
let mut prf1 = [0u8; 32];
s1.meta_ad(b"prf", false);
s1.prf(&mut prf1, false);
let prf2 = s2.prf(32, Some((OpFlags::A | OpFlags::M, b"prf".to_vec())), false);
assert_eq!(&prf1[..], &prf2[..]);
s1.meta_ad(b"key", false);
s1.key(&prf1, false);
s2.key(
prf2,
Some((OpFlags::A | OpFlags::M, b"key".to_vec())),
false,
);
let mut prf1 = [0u8; 32];
s1.meta_ad(b"prf", false);
s1.prf(&mut prf1, false);
let prf2 = s2.prf(32, Some((OpFlags::A | OpFlags::M, b"prf".to_vec())), false);
assert_eq!(&prf1[..], &prf2[..]);
} | rust_cleaned_test_functions.jsonl/90686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 684
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
11795,
368,
341,
286,
1077,
5206,
274,
16,
284,
2256,
486,
623,
32836,
16,
17,
23,
486,
931,
1883,
1,
1109,
11795,
3393,
24572,
797,
286,
1077,
5206,
274,
17,
284,
30411,
1371,
47115,
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_closure_on_error() {
assert_eq!(
eval_ok("{ undefined } onPanic: { |p| p description }").string_as_str(),
"Unbound variable: undefined"
);
} | rust_cleaned_test_functions.jsonl/15571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72823,
4470,
4096,
368,
341,
262,
2060,
10714,
33673,
286,
5603,
19817,
13976,
5614,
335,
389,
47,
31270,
25,
314,
760,
79,
91,
281,
4008,
335,
1827,
917,
11898,
2895,
3148,
286,
330,
1806,
1089... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_simple_addition() {
let five: Expression = Money::dollar(5).into();
let sum = &five + &five;
let bank = Bank::new();
let reduced = bank.reduce(sum, Dollar.into());
assert_eq!(Money::dollar(10), reduced);
} | rust_cleaned_test_functions.jsonl/115303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
2891,
680,
368,
341,
286,
1077,
4236,
25,
16378,
284,
17633,
486,
67,
21295,
7,
20,
568,
18122,
543,
286,
1077,
2629,
284,
609,
52670,
488,
609,
52670,
280,
286,
1077,
6073,
284,
8547,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_service_payload() {
let mut pld = BlePayload::new();
pld.add_service_payload([1, 2], &[2]);
assert_eq!(pld.as_ref(), &[4, 0x16, 1, 2, 2])
} | rust_cleaned_test_functions.jsonl/46340 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
12267,
32813,
368,
341,
286,
1077,
5206,
281,
507,
284,
38185,
29683,
486,
931,
543,
286,
281,
507,
1364,
12267,
32813,
2561,
16,
11,
220,
17,
1125,
44590,
17,
2558,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tweak_screen_shot_markdown() {
assert_eq!(
tweak_screen_shot_markdown(
""
),
""
);
} | rust_cleaned_test_functions.jsonl/105869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
13150,
17649,
81226,
18924,
2923,
368,
341,
262,
2060,
10714,
33673,
286,
51043,
17649,
81226,
18924,
2923,
1006,
310,
330,
20703,
7971,
32347,
220,
17,
15,
17,
15,
12,
15,
19,
12,
16,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_left_double() {
assert_condition_false!("9.1# < 2.1");
assert_condition_false!("9.1# < 9.1");
assert_condition!("9.1# < 19.1");
assert_condition_false!("9.1# < 2");
assert_condition_false!("9.1# < 9");
assert_condition!("9.1# < 19");
assert_condition_err!("9.1# < \"hello\"", 23);
assert_condition_false!("9.1# < 2.1#");
assert_condition_false!("9.1# < 9.1#");
assert_condition!("9.1# < 19.1#");
} | rust_cleaned_test_functions.jsonl/22662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9579,
24598,
368,
341,
310,
2060,
27656,
36015,
17223,
24,
13,
16,
2,
366,
220,
17,
13,
16,
797,
310,
2060,
27656,
36015,
17223,
24,
13,
16,
2,
366,
220,
24,
13,
16,
797,
310,
2060,
27656,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timestamp() {
let config: TestConfig = toml::from_str(TOML_TIMESTAMP_FORMAT).unwrap();
config.encoding.validate().unwrap();
let mut event = Event::from("Demo");
let timestamp = event
.as_mut_log()
.get(&event::log_schema().timestamp_key())
.unwrap()
.clone();
let timestamp = timestamp.as_timestamp().unwrap();
event
.as_mut_log()
.insert("another", Value::Timestamp(timestamp.clone()));
config.encoding.apply_rules(&mut event);
match event
.as_mut_log()
.get(&event::log_schema().timestamp_key())
.unwrap()
{
Value::Integer(_) => {}
e => panic!(
"Timestamp was not transformed into a Unix timestamp. Was {:?}",
e
),
}
match event.as_mut_log().get(&Atom::from("another")).unwrap() {
Value::Integer(_) => {}
e => panic!(
"Timestamp was not transformed into a Unix timestamp. Was {:?}",
e
),
}
} | rust_cleaned_test_functions.jsonl/30795 | {
"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,
23073,
368,
341,
286,
1077,
2193,
25,
3393,
2648,
284,
311,
1014,
486,
1499,
2895,
4140,
1898,
43,
47854,
14960,
568,
15454,
543,
286,
2193,
65118,
19520,
1005,
15454,
543,
286,
1077,
5206,
1538,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hardcoded_enum_deserialization() {
// We are testing separately also hardcoded snapshot deserialization for enums
// as these have a different behavior in terms of serialization/deserialization.
#[rustfmt::skip]
let v1_hardcoded_snapshot: &[u8] = &[
0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
let v2_hardcoded_snapshot: &[u8] = &[
0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
let unexpected_v1_hardcoded_snapshot: &[u8] = &[
0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
let invalid_v1_hardcoded_snapshot: &[u8] = &[
// Invalid enum variant number.
0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
let mut vm = VersionMap::new();
vm.new_version().set_type_version(TestState::type_id(), 2);
let mut snapshot_blob = v1_hardcoded_snapshot;
let mut restored_state =
<TestState as Versionize>::deserialize(&mut snapshot_blob, &vm, 1).unwrap();
assert_eq!(restored_state, TestState::Zero);
snapshot_blob = v2_hardcoded_snapshot;
restored_state = <TestState as Versionize>::deserialize(&mut snapshot_blob, &vm, 2).unwrap();
assert_eq!(restored_state, TestState::Zero);
snapshot_blob = unexpected_v1_hardcoded_snapshot;
// TODO: This must be fixed.
restored_state = <TestState as Versionize>::deserialize(&mut snapshot_blob, &vm, 1).unwrap();
assert_eq!(restored_state, TestState::Two(5));
// This snapshot contains a non-existent enum variant.
snapshot_blob = invalid_v1_hardcoded_snapshot;
assert_eq!(
<TestState as Versionize>::deserialize(&mut snapshot_blob, &vm, 1).unwrap_err(),
VersionizeError::Deserialize("Unknown variant_index 3".to_owned())
);
} | rust_cleaned_test_functions.jsonl/11256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 819
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77712,
65530,
31054,
15768,
50563,
368,
341,
262,
442,
1205,
525,
7497,
25156,
1083,
92959,
16295,
939,
50563,
369,
70717,
198,
262,
442,
438,
1493,
614,
264,
2155,
7709,
304,
3793,
315,
47443,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rot13_all() {
let plain = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
let encrypted = encrypt_rot13(plain);
assert_eq!(encrypted, "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM");
let decrypted = decrypt_rot13(&encrypted);
assert_eq!(plain, decrypted);
} | rust_cleaned_test_functions.jsonl/8403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38256,
16,
18,
5705,
368,
341,
286,
1077,
14396,
284,
330,
67512,
75902,
876,
286,
1077,
24455,
284,
29625,
38256,
16,
18,
7,
20772,
626,
286,
2060,
10714,
10297,
36444,
11,
330,
62813,
64467,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_behaviour_disconnect_one() {
// use the dummy protocols handler.
let handler_proto = DummyProtocolsHandler {
keep_alive: KeepAlive::Yes,
};
let mut swarm1 = new_test_swarm::<_, ()>(handler_proto.clone());
let mut swarm2 = new_test_swarm::<_, ()>(handler_proto);
let addr1: Multiaddr = multiaddr::Protocol::Memory(rand::random::<u64>()).into();
let addr2: Multiaddr = multiaddr::Protocol::Memory(rand::random::<u64>()).into();
swarm1.listen_on(addr1.clone()).unwrap();
swarm2.listen_on(addr2.clone()).unwrap();
let swarm1_id = *swarm1.local_peer_id();
let num_connections = 10;
for _ in 0..num_connections {
swarm1.dial(addr2.clone()).unwrap();
}
let mut state = State::Connecting;
let mut disconnected_conn_id = None;
executor::block_on(future::poll_fn(move |cx| loop {
let poll1 = Swarm::poll_next_event(Pin::new(&mut swarm1), cx);
let poll2 = Swarm::poll_next_event(Pin::new(&mut swarm2), cx);
match state {
State::Connecting => {
if swarms_connected(&swarm1, &swarm2, num_connections) {
disconnected_conn_id = {
let conn_id = swarm2.behaviour.inject_connection_established
[num_connections / 2]
.1;
swarm2.behaviour.inner().next_action.replace(
NetworkBehaviourAction::CloseConnection {
peer_id: swarm1_id,
connection: CloseConnection::One(conn_id),
},
);
Some(conn_id)
};
state = State::Disconnecting;
}
}
State::Disconnecting => {
for s in &[&swarm1, &swarm2] {
assert_eq!(s.behaviour.inject_disconnected.len(), 0);
assert_eq!(
s.behaviour.inject_connection_established.len(),
num_connections
);
assert_eq!(s.behaviour.inject_connected.len(), 1);
}
if [&swarm1, &swarm2]
.iter()
.all(|s| s.behaviour.inject_connection_closed.len() == 1)
{
let conn_id = swarm2.behaviour.inject_connection_closed[0].1;
assert_eq!(Some(conn_id), disconnected_conn_id);
return Poll::Ready(());
}
}
}
if poll1.is_pending() && poll2.is_pending() {
return Poll::Pending;
}
}))
} | rust_cleaned_test_functions.jsonl/32741 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1771
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43241,
8897,
67972,
11667,
368,
341,
1789,
286,
442,
990,
279,
17292,
31785,
7013,
624,
286,
1077,
7013,
37689,
284,
50567,
12423,
22018,
3050,
341,
310,
2506,
58850,
25,
13655,
32637,
486,
9454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_new_master_req_handler() {
let backend = Arc::new(Mutex::new(MockMasterReqHandler {}));
let mut handler = MasterReqHandler::new(backend).unwrap();
assert!(handler.get_tx_raw_fd() >= 0);
assert!(handler.as_raw_fd() >= 0);
handler.check_state().unwrap();
assert_eq!(handler.error, None);
handler.set_failed(libc::EAGAIN);
assert_eq!(handler.error, Some(libc::EAGAIN));
handler.check_state().unwrap_err();
} | rust_cleaned_test_functions.jsonl/77507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
24582,
17644,
10183,
368,
341,
286,
1077,
19163,
284,
19689,
486,
931,
3189,
9371,
486,
931,
66436,
18041,
27234,
3050,
99007,
286,
1077,
5206,
7013,
284,
10824,
27234,
3050,
486,
931,
7,
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_modulo_and_remainder() {
let mut p = Polar::new();
qeval(&mut p, "1 mod 1 == 0");
qeval(&mut p, "1 rem 1 == 0");
qeval(&mut p, "1 mod -1 == 0");
qeval(&mut p, "1 rem -1 == 0");
qeval(&mut p, "0 mod 1 == 0");
qeval(&mut p, "0 rem 1 == 0");
qeval(&mut p, "0 mod -1 == 0");
qeval(&mut p, "0 rem -1 == 0");
let res = var(&mut p, "1 mod 0.0 = x", "x")[0].clone();
if let Value::Number(Numeric::Float(x)) = res {
assert!(x.is_nan());
} else {
panic!();
}
let res = var(&mut p, "1 rem 0.0 = x", "x")[0].clone();
if let Value::Number(Numeric::Float(x)) = res {
assert!(x.is_nan());
} else {
panic!();
}
qeval(&mut p, "-1 rem 5 == -1");
qeval(&mut p, "-1 mod 5 == 4");
qeval(&mut p, "13 mod 4 == 1");
qeval(&mut p, "13 rem 4 == 1");
qeval(&mut p, "-13 mod 4 == 3");
qeval(&mut p, "-13 rem 4 == -1");
qeval(&mut p, "13 mod -4 == -3");
qeval(&mut p, "13 rem -4 == 1");
qeval(&mut p, "-13 mod -4 == -1");
qeval(&mut p, "-13 rem -4 == -1");
qeval(&mut p, "13.4 mod 1 == 0.40000000000000036");
qeval(&mut p, "13.4 rem 1 == 0.40000000000000036");
qeval(&mut p, "-13.4 mod 1 == 0.5999999999999996");
qeval(&mut p, "-13.4 rem 1 == -0.40000000000000036");
} | rust_cleaned_test_functions.jsonl/97639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
8763,
8378,
86607,
1107,
368,
341,
262,
1077,
5206,
281,
284,
55896,
486,
931,
543,
262,
2804,
14170,
2099,
6984,
281,
11,
330,
16,
1463,
220,
16,
621,
220,
15,
797,
262,
2804,
14170,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_convert_pipe_expression() {
let b = ast::BaseNode::default();
let pkg = parse_package(
"f = (piped=<-, a) => a + piped
3 |> f(a: 2)",
);
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::Variable(Box::new(VariableAssgn::new(
Identifier {
loc: b.location.clone(),
name: Symbol::from("f@main"),
},
Expression::Function(Box::new(FunctionExpr {
loc: b.location.clone(),
typ: type_info(),
params: vec![
FunctionParameter {
loc: b.location.clone(),
is_pipe: true,
key: Identifier {
loc: b.location.clone(),
name: Symbol::from("piped"),
},
default: None,
},
FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: Symbol::from("a"),
},
default: None,
},
],
body: Block::Return(ReturnStmt {
loc: b.location.clone(),
argument: Expression::Binary(Box::new(BinaryExpr {
loc: b.location.clone(),
typ: type_info(),
operator: ast::Operator::AdditionOperator,
left: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: Symbol::from("a"),
}),
right: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: Symbol::from("piped"),
}),
})),
}),
vectorized: None,
})),
b.location.clone(),
))),
Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Call(Box::new(CallExpr {
loc: b.location.clone(),
typ: type_info(),
pipe: Some(Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 3,
})),
callee: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: Symbol::from("f@main"),
}),
arguments: vec![Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: Symbol::from("a"),
},
value: Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 2,
}),
}],
})),
}),
],
}],
};
let got = test_convert(pkg).unwrap();
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/132524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
41862,
28068,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
4715,
26328,
1006,
310,
330,
69,
284,
320,
79,
31721,
38698,
36519,
264,
8,
589... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_merge_desc_no_release_branch() {
let desc = make_merge_desc(
(String::from("Yay, I made a change (#99)"), String::from("")),
"abcdef",
99,
"other_branch",
"source_branch",
"release/",
);
assert_eq!(desc.0, "source_branch->other_branch: Yay, I made a change");
assert_eq!(desc.1, "(cherry-picked from abcdef, PR #99)");
} | rust_cleaned_test_functions.jsonl/93153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
20888,
10986,
6536,
24577,
28031,
368,
341,
286,
1077,
6560,
284,
1281,
20888,
10986,
1006,
310,
320,
703,
486,
1499,
445,
56,
352,
11,
358,
1865,
264,
2297,
29083,
24,
24,
8,
3975,
923,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_active_scan_scheduling() {
let exec = fasync::TestExecutor::new().expect("failed to create an executor");
let mut m = MockObjects::new(&exec);
let mut me = m.make_mlme();
me.make_client_station();
let scan_req = fidl_mlme::ScanRequest {
scan_type: fidl_mlme::ScanTypes::Active,
probe_delay: 5,
..scan_req()
};
let scan_txn_id = scan_req.txn_id;
me.on_sme_scan(scan_req);
assert_eq!(me.ctx.device.channel().primary, SCAN_CHANNEL_PRIMARY);
// another by scanner for delayed sending of probe request
let (_, channel_event) =
m.time_stream.try_next().unwrap().expect("Should have scheduled a timed event");
assert_variant!(channel_event.event, super::TimedEvent::ChannelScheduler);
let (_, probe_delay_event) =
m.time_stream.try_next().unwrap().expect("Should have scheduled a timed event");
assert_variant!(probe_delay_event.event, super::TimedEvent::ScannerProbeDelay(_));
me.handle_timed_event(probe_delay_event.id, probe_delay_event.event);
// Verify that probe delay is sent.
assert_eq!(m.fake_device.wlan_queue.len(), 1);
#[rustfmt::skip]
assert_eq!(&m.fake_device.wlan_queue[0].0[..], &[
// Mgmt header:
0b0100_00_00, 0b00000000, // FC
0, 0, // Duration
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // addr1
7, 7, 7, 7, 7, 7, // addr2
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // addr3
0x10, 0, // Sequence Control
// IEs
0, 4, // SSID id and length
115, 115, 105, 100, // SSID
1, 6, // supp_rates id and length
12, 24, 48, 54, 96, 108, // supp_rates
][..]);
m.fake_device.wlan_queue.clear();
assert_eq!(me.ctx.device.channel().primary, SCAN_CHANNEL_PRIMARY);
me.handle_timed_event(channel_event.id, channel_event.event);
assert_eq!(me.ctx.device.channel(), MAIN_CHANNEL);
let msg =
m.fake_device.next_mlme_msg::<fidl_mlme::ScanEnd>().expect("error reading SCAN.end");
assert_eq!(msg.txn_id, scan_txn_id);
assert_eq!(msg.code, fidl_mlme::ScanResultCode::Success);
} | rust_cleaned_test_functions.jsonl/32102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12930,
28857,
643,
44356,
368,
341,
286,
1077,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
5206,
296,
284,
14563,
11543,
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_parse_create_keys_response() {
let _setup = SetupMocks::init();
let builder = create_keys();
let (for_did, for_verkey) = builder.parse_response(&CREATE_KEYS_RESPONSE.to_vec()).unwrap();
assert_eq!(for_did, "U5LXs4U7P9msh647kToezy");
assert_eq!(for_verkey, "FktSZg8idAVzyQZrdUppK6FTrfAzW3wWVzAjJAfdUvJq");
} | rust_cleaned_test_functions.jsonl/18562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8657,
12631,
9655,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
7363,
284,
1855,
12631,
1428,
286,
1077,
320,
1958,
814,
307,
11,
369,
26042,
792,
8,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_bool() {
// Verifies is_truthy as well
assert_eq!(is_truthy(SYMBOL_TRUE.symbol), true);
assert_eq!(is_truthy(SYMBOL_FALSE.symbol), false);
assert_eq!(is_truthy(SYMBOL_NONE.symbol), false);
assert_eq!(is_truthy(VALUE_ERR), false);
assert_eq!(is_truthy(f64::to_bits(1.0)), true);
assert_eq!(is_truthy(f64::to_bits(3.0)), true);
assert_eq!(is_truthy(f64::to_bits(0.0)), false);
assert_eq!(is_truthy(f64::to_bits(-0.0)), false);
// ToDo Nan = false
} | rust_cleaned_test_functions.jsonl/109919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
22159,
368,
341,
197,
197,
322,
6250,
9606,
374,
49186,
88,
438,
1632,
198,
197,
6948,
10714,
10297,
285,
49186,
88,
3759,
56,
19480,
14044,
39209,
701,
830,
317,
197,
6948,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_query_3() {
// query checks if schema of scanning is not changed by aggregation
let _ = scan_foods_csv()
.groupby(vec![col("calories")])
.agg(vec![col("fats_g").max()])
.collect()
.unwrap();
} | rust_cleaned_test_functions.jsonl/14664 | {
"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,
49646,
5738,
62,
18,
368,
341,
286,
442,
3239,
12341,
421,
10802,
315,
35101,
374,
537,
5497,
553,
51629,
198,
286,
1077,
716,
284,
8569,
761,
9065,
14020,
741,
310,
659,
4074,
1694,
25592,
2070... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_completions() {
let input = BashCompletionInput::from("democli src/li");
let completions = input.complete_file();
assert_eq!(vec!["src/lib.rs"], completions);
} | rust_cleaned_test_functions.jsonl/103208 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
2965,
10819,
908,
368,
341,
286,
1077,
1946,
284,
38530,
33190,
2505,
486,
1499,
445,
27431,
509,
742,
2286,
88381,
3071,
286,
1077,
3459,
908,
284,
1946,
42928,
2458,
1428,
286,
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 |
#[test]
fn test_getenv_big() {
let mut s = "".to_string();
let mut i = 0;
while i < 100 {
s.push_str("aaaaaaaaaa");
i += 1;
}
let n = make_rand_name();
setenv(&n, &s);
debug!("{}", s.clone());
assert_eq!(getenv(&n), Some(s));
} | rust_cleaned_test_functions.jsonl/72105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3160,
36386,
368,
341,
286,
1077,
5206,
274,
284,
44907,
983,
3904,
543,
286,
1077,
5206,
600,
284,
220,
15,
280,
286,
1393,
600,
366,
220,
16,
15,
15,
341,
310,
274,
2552,
2895,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_args() {
exec! {
"echo",
args: ["Hello world!"],
log: true,
stdout: b"Hello world!\n",
stderr: []
};
} | rust_cleaned_test_functions.jsonl/72682 | {
"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,
8384,
368,
341,
262,
3883,
0,
341,
286,
330,
3047,
756,
286,
2827,
25,
4383,
9707,
1879,
0,
8097,
286,
1487,
25,
830,
3554,
286,
20075,
25,
293,
1,
9707,
1879,
14771,
77,
756,
286,
26436,
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 |
#[test]
fn test_used_in_match_expr() {
check_assist(
inline_local_variable,
"
fn foo() {
let a<|> = 1 > 0;
match a {}
}",
"
fn foo() {
<|>match 1 > 0 {}
}",
);
} | rust_cleaned_test_functions.jsonl/60334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27803,
1243,
10708,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
6228,
8822,
15229,
368,
341,
262,
1077,
264,
27,
91,
29,
284,
220,
16,
861,
220,
15,
280,
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_into_string_w() {
let d: String = DurationString::try_from(String::from("1w")).unwrap().into();
assert_eq!(d, "1w");
} | rust_cleaned_test_functions.jsonl/97557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
3904,
1670,
368,
341,
286,
1077,
294,
25,
923,
284,
21045,
703,
486,
1539,
5673,
2242,
486,
1499,
445,
16,
86,
15197,
15454,
1005,
18122,
543,
286,
2060,
10714,
10297,
67,
11,
330,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_attachment_type() {
assert!(matches!(
AttachmentType::from(Path::new("./dogs/corgis/kona.png")),
AttachmentType::Path(_)
));
assert!(matches!(
AttachmentType::from(Path::new("./cats/copycat.png")),
AttachmentType::Path(_)
));
assert!(matches!(
AttachmentType::from("./mascots/crabs/ferris.png"),
AttachmentType::Path(_)
));
assert!(matches!(
AttachmentType::from("https://test.url/test.jpg"),
AttachmentType::Image(_)
))
} | rust_cleaned_test_functions.jsonl/5092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40868,
1819,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
55748,
929,
486,
1499,
33030,
486,
931,
13988,
80034,
2899,
1775,
285,
14109,
6721,
3508,
30154,
310,
55748,
929,
486,
1820,
2490,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lifetimes_type_alias() {
check(
r#"
type Foo<'a, T> where T: 'a$0 = &'a T;
"#,
expect![[r#"
'a LifetimeParam FileId(0) 9..11 9..11
FileId(0) 25..27
FileId(0) 31..33
"#]],
);
} | rust_cleaned_test_functions.jsonl/60666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
907,
333,
6889,
1819,
35947,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1313,
33428,
18291,
64,
11,
350,
29,
1380,
350,
25,
364,
64,
3,
15,
284,
30136,
64,
350,
280,
57676,
345,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_equivalence() {
for code in [EX1, EX2, EX3] {
let tree = get_tree(code);
for order in [Order::Pre, Order::Post] {
generate_traversals(&tree, order);
}
}
} | rust_cleaned_test_functions.jsonl/126935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41443,
88790,
368,
341,
286,
369,
2038,
304,
508,
3257,
16,
11,
4063,
17,
11,
4063,
18,
60,
341,
310,
1077,
4916,
284,
633,
11663,
15842,
317,
310,
369,
1973,
304,
508,
4431,
486,
4703,
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... | 3 |
#[test]
fn test_get_runtime_properties_missing_element() {
let root = Element::from_reader(ONLY_ROOT_NODE.as_bytes()).unwrap();
assert!(Unreal4ContextRuntimeProperties::from_xml(&root).is_none());
} | rust_cleaned_test_functions.jsonl/28091 | {
"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,
3062,
33232,
25158,
40447,
7894,
368,
341,
262,
1077,
3704,
284,
8543,
486,
1499,
22306,
7,
31092,
16197,
19218,
5357,
12524,
6011,
15454,
543,
262,
2060,
10297,
1806,
7951,
19,
1972,
15123,
7903,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_core_graphics_font() {
let font0 = SystemSource::new()
.select_by_postscript_name(TEST_FONT_POSTSCRIPT_NAME)
.unwrap()
.load()
.unwrap();
let core_text_font = font0.native_font();
let core_graphics_font = core_text_font.copy_to_CGFont();
let font1 = Font::from_core_graphics_font(core_graphics_font);
assert_eq!(font1.postscript_name().unwrap(), TEST_FONT_POSTSCRIPT_NAME);
} | rust_cleaned_test_functions.jsonl/98159 | {
"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,
5673,
15467,
84385,
17451,
368,
341,
286,
1077,
3301,
15,
284,
739,
3608,
486,
931,
741,
310,
659,
1742,
3710,
6333,
2282,
1269,
50320,
39532,
20506,
24787,
4708,
340,
310,
659,
15454,
741,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hoge() {
let shape_ref: &[usize] = &[2, 5, 5, 14];
let tensor = Tensor::new(shape_ref);
println!("{}", tensor);
} | rust_cleaned_test_functions.jsonl/51228 | {
"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,
1523,
40532,
368,
341,
286,
1077,
6083,
7793,
25,
44590,
51878,
60,
284,
44590,
17,
11,
220,
20,
11,
220,
20,
11,
220,
16,
19,
4821,
286,
1077,
15626,
284,
26036,
486,
931,
25933,
7793,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_fail() {
// certain bytes causes failure. `zero` is a list of byte indices to
// zero out that should cause failure.
fn test_zero<I: IpAddr>(src: I, dst: I, succeeds: bool, zero: &[usize], err: ParseError) {
let mut buf = [1, 2, 3, 4, 0, 8, 0, 0];
if succeeds {
assert!(UdpPacket::parse(&buf[..], src, dst).is_ok());
}
for idx in zero {
buf[*idx] = 0;
}
assert_eq!(UdpPacket::parse(&buf[..], src, dst).unwrap_err(), err);
}
// destination port of 0 is disallowed
test_zero(
TEST_SRC_IPV4,
TEST_DST_IPV4,
true,
&[2, 3],
ParseError::Format,
);
// length of 0 is disallowed in IPv4
test_zero(
TEST_SRC_IPV4,
TEST_DST_IPV4,
true,
&[4, 5],
ParseError::Format,
);
// missing checksum is disallowed in IPv6; this won't succeed ahead of
// time because the checksum bytes are already zero
test_zero(TEST_SRC_IPV6, TEST_DST_IPV6, false, &[], ParseError::Format);
// 2^32 overflows on 32-bit platforms
#[cfg(target_pointer_width = "64")]
{
// total length of 2^32 or greater is disallowed in IPv6
let mut buf = vec![0u8; 1 << 32];
(&mut buf[..8]).copy_from_slice(&[0, 0, 1, 2, 0, 0, 0xFF, 0xE4]);
assert_eq!(
UdpPacket::parse(&buf[..], TEST_SRC_IPV6, TEST_DST_IPV6).unwrap_err(),
ParseError::Format
);
}
} | rust_cleaned_test_functions.jsonl/78660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 954
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
22121,
368,
341,
1789,
286,
442,
3654,
5820,
11137,
7901,
13,
1565,
14154,
63,
374,
264,
1140,
315,
4922,
14937,
311,
198,
286,
442,
7168,
700,
429,
1265,
5240,
7901,
624,
286,
5168,
1273... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lines_with_endings() {
fn lines(s: &str) -> Vec<&str> {
LinesWithEndings::from(s).collect()
}
assert!(lines("").is_empty());
assert_eq!(lines("f"), vec!["f"]);
assert_eq!(lines("foo"), vec!["foo"]);
assert_eq!(lines("foo\n"), vec!["foo\n"]);
assert_eq!(lines("foo\nbar"), vec!["foo\n", "bar"]);
assert_eq!(lines("foo\nbar\n"), vec!["foo\n", "bar\n"]);
assert_eq!(lines("foo\r\nbar"), vec!["foo\r\n", "bar"]);
assert_eq!(lines("foo\r\nbar\r\n"), vec!["foo\r\n", "bar\r\n"]);
assert_eq!(lines("\nfoo"), vec!["\n", "foo"]);
assert_eq!(lines("\n\n\n"), vec!["\n", "\n", "\n"]);
} | rust_cleaned_test_functions.jsonl/18637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18323,
6615,
6213,
819,
368,
341,
286,
5168,
5128,
1141,
25,
609,
495,
8,
1464,
11312,
52244,
495,
29,
341,
310,
38233,
2354,
3727,
819,
486,
1499,
1141,
568,
17384,
741,
286,
555,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_highlights_a_sql_query_within_go() -> Result<(), Error> {
let src = r#"package main
const MySqlQuery = `
SELECT * FROM my_table
`
"#;
let document = index_language("go", src)?;
insta::assert_snapshot!(dump_document(&document, src));
Ok(())
} | rust_cleaned_test_functions.jsonl/84247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22680,
13826,
4306,
18063,
5738,
72385,
25515,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
2286,
284,
435,
55543,
1722,
1887,
271,
1024,
25725,
2859,
284,
22074,
4858,
353,
4295,
847,
5237,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multiple_rules() {
assert_eq!(
parse_str_to_rules("pass in proto tcp; drop out proto udp;"),
Ok(vec![
filter::Rule {
action: filter::Action::Pass,
direction: filter::Direction::Incoming,
quick: false,
proto: filter::SocketProtocol::Tcp,
src_subnet: None,
src_subnet_invert_match: false,
src_port_range: filter::PortRange { start: 0, end: 0 },
dst_subnet: None,
dst_subnet_invert_match: false,
dst_port_range: filter::PortRange { start: 0, end: 0 },
nic: 0,
log: false,
keep_state: true,
},
filter::Rule {
action: filter::Action::Drop,
direction: filter::Direction::Outgoing,
quick: false,
proto: filter::SocketProtocol::Udp,
src_subnet: None,
src_subnet_invert_match: false,
src_port_range: filter::PortRange { start: 0, end: 0 },
dst_subnet: None,
dst_subnet_invert_match: false,
dst_port_range: filter::PortRange { start: 0, end: 0 },
nic: 0,
log: false,
keep_state: true,
},
])
);
} | rust_cleaned_test_functions.jsonl/29476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 948
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
21407,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
2895,
2346,
21407,
445,
6385,
304,
18433,
28051,
26,
5943,
700,
18433,
49219,
26,
4461,
310,
7622,
25592,
90515,
394,
4051,
486,
11337,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unknown_attribute_integer_value() {
let schemaReplicant = SchemaReplicant::default();
let negative = r#"[:find ?x :where [?x _ -1]]"#;
let zero = r#"[:find ?x :where [?x _ 0]]"#;
let one = r#"[:find ?x :where [?x _ 1]]"#;
let two = r#"[:find ?x :where [?x _ 2]]"#;
// Can't match boolean; no need to filter it out.
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, negative);
assert_eq!(allegrosql, "SELECT DISTINCT `Causets00`.e AS `?x` FROM `causets` AS `Causets00` WHERE `Causets00`.v = -1");
assert_eq!(args, vec![]);
// Excludes booleans.
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, zero);
assert_eq!(allegrosql, "SELECT DISTINCT `Causets00`.e AS `?x` FROM `causets` AS `Causets00` WHERE (`Causets00`.v = 0 AND `Causets00`.value_type_tag <> 1)");
assert_eq!(args, vec![]);
// Excludes booleans.
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, one);
assert_eq!(allegrosql, "SELECT DISTINCT `Causets00`.e AS `?x` FROM `causets` AS `Causets00` WHERE (`Causets00`.v = 1 AND `Causets00`.value_type_tag <> 1)");
assert_eq!(args, vec![]);
// Can't match boolean; no need to filter it out.
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, two);
assert_eq!(allegrosql, "SELECT DISTINCT `Causets00`.e AS `?x` FROM `causets` AS `Causets00` WHERE `Causets00`.v = 2");
assert_eq!(args, vec![]);
} | rust_cleaned_test_functions.jsonl/90699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 631
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
16791,
31725,
3142,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
12539,
18327,
35237,
486,
2258,
1428,
262,
1077,
8225,
284,
435,
55543,
3447,
3903,
937,
87,
549,
2870,
508,
30,
87,
716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_branch_diff() {
let block_manager = BlockManager::new();
let a = create_block("A", NULL_BLOCK_IDENTIFIER, 0);
let b = create_block("B", "A", 1);
let c = create_block("C", "A", 1);
let d = create_block("D", "C", 2);
let e = create_block("E", "D", 3);
block_manager.put(vec![a.clone(), b.clone()]).unwrap();
block_manager.put(vec![c.clone()]).unwrap();
block_manager.put(vec![d.clone(), e.clone()]).unwrap();
let mut branch_diff_iter = block_manager.branch_diff("C", "B").unwrap();
assert_eq!(branch_diff_iter.next(), Some(c.clone()));
assert_eq!(branch_diff_iter.next(), None);
let mut branch_diff_iter2 = block_manager.branch_diff("B", "E").unwrap();
assert_eq!(branch_diff_iter2.next(), Some(b.clone()));
assert_eq!(branch_diff_iter2.next(), None);
let mut branch_diff_iter3 = block_manager.branch_diff("C", "E").unwrap();
assert_eq!(branch_diff_iter3.next(), None);
let mut branch_diff_iter4 = block_manager.branch_diff("E", "C").unwrap();
assert_eq!(branch_diff_iter4.next(), Some(e.clone()));
assert_eq!(branch_diff_iter4.next(), Some(d.clone()));
assert_eq!(branch_diff_iter4.next(), None);
// Test that it will return an error if a block is missing
assert!(block_manager.branch_diff("E", "X").is_err());
// Test that it will return an error result if the tip is unkown
assert!(
block_manager.branch_diff("X", "E").is_err(),
"Branch Diff with an unknown tip will cause an error"
);
} | rust_cleaned_test_functions.jsonl/10254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 744
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28031,
15850,
368,
341,
286,
1077,
2504,
12144,
284,
8362,
2043,
486,
931,
1428,
286,
1077,
264,
284,
1855,
7113,
445,
32,
497,
1770,
18756,
49554,
11,
220,
15,
317,
286,
1077,
293,
284,
1855,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_imports() {
use crate::{func, imports};
fn foo(_ctx: &mut Ctx, a: i32) -> i32 {
a
}
let _import_object = imports! {
"env" => {
"foo" => func!(foo),
},
};
} | rust_cleaned_test_functions.jsonl/61387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18434,
82,
368,
341,
286,
990,
17717,
22964,
2830,
11,
15202,
2315,
286,
5168,
15229,
2490,
3773,
25,
609,
6984,
356,
3998,
11,
264,
25,
600,
18,
17,
8,
1464,
600,
18,
17,
341,
310,
264,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stc64() {
let mut prng = Stc64::new();
for _ in 0..6 {
println!("{}", prng.next_long());
}
assert_ne!(prng.next_long(), prng.next_long());
} | rust_cleaned_test_functions.jsonl/54528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
66,
21,
19,
368,
341,
286,
1077,
5206,
548,
968,
284,
794,
66,
21,
19,
486,
931,
543,
286,
369,
716,
304,
220,
15,
496,
21,
341,
310,
13751,
79878,
548,
968,
4529,
17799,
1423,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_make() {
let bound = Bound { max: 5, min: 0 };
let preset = FRESH;
let effects = [];
let factory = ProjectorFactory::build(&bound, &preset, &effects);
for number in 0..5 {
let dye = factory.make(number);
println!("[{}]: {}", number, dye("some"));
}
// let preset=ATLAS;
} | rust_cleaned_test_functions.jsonl/37068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
368,
341,
286,
1077,
6822,
284,
37176,
314,
1932,
25,
220,
20,
11,
1308,
25,
220,
15,
2605,
286,
1077,
42921,
284,
434,
21221,
280,
286,
1077,
6239,
284,
5907,
286,
1077,
8633,
284,
578... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_small(){
let mut data = parse(EXEMPLE2);
let result = parse(RESULT2);
let mut count = 0;
step(&mut data,&mut count);
step(&mut data,&mut count);
assert_eq!(data,result);
} | rust_cleaned_test_functions.jsonl/43114 | {
"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,
31966,
3032,
286,
1077,
5206,
821,
284,
4715,
25409,
2716,
9515,
17,
317,
286,
1077,
1102,
284,
4715,
7,
14098,
17,
317,
286,
1077,
5206,
1760,
284,
220,
15,
280,
286,
3019,
2099,
6984,
821,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_checked() {
let a = PrimitiveArray::from([Some(11111i128), Some(11100i128), None, Some(22200i128)])
.to(DataType::Decimal(5, 2));
let b = PrimitiveArray::from([Some(22222i128), Some(22200i128), None, Some(11100i128)])
.to(DataType::Decimal(5, 2));
let result = checked_add(&a, &b).unwrap();
let expected =
PrimitiveArray::from([Some(33333i128), Some(33300i128), None, Some(33300i128)])
.to(DataType::Decimal(5, 2));
assert_eq!(result, expected);
// Testing trait
let result = a.checked_add(&b).unwrap();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/6878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
56456,
368,
341,
286,
1077,
264,
284,
51460,
1857,
486,
1499,
2561,
8373,
7,
16,
16,
16,
16,
16,
72,
16,
17,
23,
701,
4329,
7,
16,
16,
16,
15,
15,
72,
16,
17,
23,
701,
2240,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_into_message_components_with_too_many_keys() {
const TOO_MANY_KEYS: usize = 257;
for key_flags in [
KeyFlags::WRITABLE | KeyFlags::SIGNER,
KeyFlags::SIGNER,
// skip writable_non_signer_keys because it isn't used for creating header values
KeyFlags::empty(),
] {
let test_keys = CompiledKeys {
payer: None,
key_meta_map: BTreeMap::from_iter(
(0..TOO_MANY_KEYS).map(|_| (Pubkey::new_unique(), key_flags.into())),
),
};
assert_eq!(
test_keys.try_into_message_components(),
Err(CompileError::AccountIndexOverflow)
);
}
} | rust_cleaned_test_functions.jsonl/52067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
45514,
6462,
23258,
6615,
2346,
78,
22101,
12631,
368,
341,
286,
733,
92576,
97374,
51251,
25,
22301,
284,
220,
17,
20,
22,
401,
286,
369,
1376,
14130,
304,
2278,
310,
5309,
9195,
486,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_c_str_null_terminated() {
assert!(!c_str_null_terminated(b"foobar"));
assert!(!c_str_null_terminated(b""));
assert!(c_str_null_terminated(b"\0"));
assert!(c_str_null_terminated(b"hallo\0"));
} | rust_cleaned_test_functions.jsonl/117737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2895,
15162,
62,
68659,
368,
341,
286,
2060,
0,
3471,
66,
2895,
15162,
62,
68659,
1883,
1,
50267,
4010,
286,
2060,
0,
3471,
66,
2895,
15162,
62,
68659,
1883,
1,
4010,
286,
2060,
10297,
66... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_field_range() {
assert_eq!(Single(0).to_index_pair(10), None);
assert_eq!(Single(1).to_index_pair(10), Some((0, 1)));
assert_eq!(Single(10).to_index_pair(10), Some((9, 10)));
assert_eq!(Single(11).to_index_pair(10), None);
assert_eq!(Single(-1).to_index_pair(10), Some((9, 10)));
assert_eq!(Single(-10).to_index_pair(10), Some((0, 1)));
assert_eq!(Single(-11).to_index_pair(10), None);
assert_eq!(LeftInf(0).to_index_pair(10), None);
assert_eq!(LeftInf(1).to_index_pair(10), Some((0, 1)));
assert_eq!(LeftInf(8).to_index_pair(10), Some((0, 8)));
assert_eq!(LeftInf(10).to_index_pair(10), Some((0, 10)));
assert_eq!(LeftInf(11).to_index_pair(10), Some((0, 10)));
assert_eq!(LeftInf(-1).to_index_pair(10), Some((0, 10)));
assert_eq!(LeftInf(-8).to_index_pair(10), Some((0, 3)));
assert_eq!(LeftInf(-9).to_index_pair(10), Some((0, 2)));
assert_eq!(LeftInf(-10).to_index_pair(10), Some((0, 1)));
assert_eq!(LeftInf(-11).to_index_pair(10), None);
assert_eq!(RightInf(0).to_index_pair(10), Some((0, 10)));
assert_eq!(RightInf(1).to_index_pair(10), Some((0, 10)));
assert_eq!(RightInf(8).to_index_pair(10), Some((7, 10)));
assert_eq!(RightInf(10).to_index_pair(10), Some((9, 10)));
assert_eq!(RightInf(11).to_index_pair(10), None);
assert_eq!(RightInf(-1).to_index_pair(10), Some((9, 10)));
assert_eq!(RightInf(-8).to_index_pair(10), Some((2, 10)));
assert_eq!(RightInf(-9).to_index_pair(10), Some((1, 10)));
assert_eq!(RightInf(-10).to_index_pair(10), Some((0, 10)));
assert_eq!(RightInf(-11).to_index_pair(10), Some((0, 10)));
assert_eq!(Both(0, 0).to_index_pair(10), None);
assert_eq!(Both(0, 1).to_index_pair(10), Some((0, 1)));
assert_eq!(Both(0, 10).to_index_pair(10), Some((0, 10)));
assert_eq!(Both(0, 11).to_index_pair(10), Some((0, 10)));
assert_eq!(Both(1, -1).to_index_pair(10), Some((0, 10)));
assert_eq!(Both(1, -9).to_index_pair(10), Some((0, 2)));
assert_eq!(Both(1, -10).to_index_pair(10), Some((0, 1)));
assert_eq!(Both(1, -11).to_index_pair(10), None);
assert_eq!(Both(-9, -9).to_index_pair(10), Some((1, 2)));
assert_eq!(Both(-9, -8).to_index_pair(10), Some((1, 3)));
assert_eq!(Both(-9, 0).to_index_pair(10), None);
assert_eq!(Both(-9, 1).to_index_pair(10), None);
assert_eq!(Both(-9, 2).to_index_pair(10), Some((1, 2)));
assert_eq!(Both(-1, 0).to_index_pair(10), None);
assert_eq!(Both(11, 20).to_index_pair(10), None);
assert_eq!(Both(-11, -11).to_index_pair(10), None);
} | rust_cleaned_test_functions.jsonl/82618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5013,
9698,
368,
341,
286,
2060,
10714,
10297,
10888,
7,
15,
568,
983,
3560,
14445,
7,
16,
15,
701,
2240,
317,
286,
2060,
10714,
10297,
10888,
7,
16,
568,
983,
3560,
14445,
7,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_image() {
let result = parser(vec![
DeltaOp {
insert: Value::String(String::from("asd\n")),
attributes: None,
},
DeltaOp {
insert: json!({
"savvy_image": "path/to/image"
}),
attributes: Some(json!({"alt": "WeChat Image_20210616141455.png"})),
},
DeltaOp {
insert: Value::String(String::from("\n")),
attributes: Some(json!({"list": "ordered"})),
},
DeltaOp {
insert: Value::String(String::from("sss\n")),
attributes: None,
},
]);
assert_eq!(result, String::from("<p>asd</p><ol><li><img src=\"path/to/image\" alt=\"WeChat Image_20210616141455.png\"></li></ol><p>sss</p>"));
} | rust_cleaned_test_functions.jsonl/33075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
368,
341,
286,
1077,
1102,
284,
6729,
25592,
90515,
310,
24957,
7125,
341,
394,
5656,
25,
5162,
486,
703,
2242,
486,
1499,
445,
79102,
1699,
30154,
394,
8201,
25,
2240,
345,
310,
1153,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rate_limiter_bandwidth() {
// rate limiter with limit of 1000 bytes/s
let mut l = RateLimiter::new(1000, 0, 1000, 0, 0, 0).unwrap();
// limiter should not be blocked
assert!(!l.is_blocked());
// raw FD for this disabled should be valid
assert!(l.as_raw_fd() > 0);
assert!(l.consume(u64::max_value(), TokenType::Ops));
// do full 1000 bytes
assert!(l.consume(1000, TokenType::Bytes));
// try and fail on another 100
assert!(!l.consume(100, TokenType::Bytes));
assert!(l.is_blocked());
// wait half the timer period
thread::sleep(Duration::from_millis(REFILL_TIMER_INTERVAL_MS / 2));
// limiter should still be blocked
assert!(l.is_blocked());
// wait the other half of the timer period
thread::sleep(Duration::from_millis(REFILL_TIMER_INTERVAL_MS / 2));
// the timer_fd should have an event on it by now
assert!(l.event_handler().is_ok());
// limiter should now be unblocked
assert!(!l.is_blocked());
// try and succeed on another 100 bytes this time
assert!(l.consume(100, TokenType::Bytes));
} | rust_cleaned_test_functions.jsonl/15889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9246,
907,
17700,
45344,
3098,
368,
341,
286,
442,
4379,
4568,
2015,
448,
3930,
315,
220,
16,
15,
15,
15,
5820,
2687,
198,
286,
1077,
5206,
326,
284,
19775,
43,
17700,
486,
931,
7,
16,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_special_groupby_schemas() -> Result<()> {
let df = df![
"a" => [1, 2, 3, 4, 5],
"b" => [1, 2, 3, 4, 5],
]?;
let out = df
.clone()
.lazy()
.groupby_rolling(
[],
RollingGroupOptions {
index_column: "a".into(),
period: Duration::parse("2i"),
offset: Duration::parse("0i"),
closed_window: ClosedWindow::Left,
},
)
.agg([col("b").sum().alias("sum")])
.select([col("a"), col("sum")])
.collect()?;
assert_eq!(
out.column("sum")?
.i32()?
.into_no_null_iter()
.collect::<Vec<_>>(),
&[3, 5, 7, 9, 5]
);
let out = df
.lazy()
.groupby_dynamic(
[],
DynamicGroupOptions {
index_column: "a".into(),
every: Duration::parse("2i"),
period: Duration::parse("2i"),
offset: Duration::parse("0i"),
truncate: false,
include_boundaries: false,
closed_window: ClosedWindow::Left,
},
)
.agg([col("b").sum().alias("sum")])
.select([col("a"), col("sum")])
.collect()?;
assert_eq!(
out.column("sum")?
.i32()?
.into_no_null_iter()
.collect::<Vec<_>>(),
&[1, 5, 9]
);
Ok(())
} | rust_cleaned_test_functions.jsonl/5217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 878
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41629,
6288,
1694,
643,
31126,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
6764,
90515,
286,
330,
64,
1,
589,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
1259,
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... | 8 |
#[test]
fn test_encode_packet_with_options() {
let mut packet = PacketUdp::new();
packet.header.set_version(1);
packet.header.set_type(MessageType::Confirmable);
packet.header.code = MessageClass::Request(RequestType::Get);
packet.header.message_id = 33950;
packet.set_token(vec![0x51, 0x55, 0x77, 0xE8]);
packet.add_option(CoapOption::UriPath, b"Hi".to_vec());
packet.add_option(CoapOption::UriPath, b"Test".to_vec());
packet.add_option(CoapOption::UriQuery, b"a=1".to_vec());
assert_eq!(
packet.to_bytes().unwrap(),
vec![
0x44, 0x01, 0x84, 0x9e, 0x51, 0x55, 0x77, 0xe8, 0xb2, 0x48,
0x69, 0x04, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x3d, 0x31
]
);
} | rust_cleaned_test_functions.jsonl/92790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 443
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
21078,
6615,
8743,
368,
341,
286,
1077,
5206,
10151,
284,
28889,
52,
9796,
486,
931,
543,
286,
10151,
17093,
980,
9438,
7,
16,
317,
286,
10151,
17093,
980,
1819,
29359,
929,
486,
16728,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collect_accounts() {
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let pubkey = Pubkey::new_rand();
let instructions = vec![CompiledInstruction::new(0, &(), vec![0, 1])];
let tx0 = Transaction::new_with_compiled_instructions(
&[&keypair0],
&[pubkey],
Hash::default(),
vec![native_loader::id()],
instructions,
);
let instructions = vec![CompiledInstruction::new(0, &(), vec![0, 1])];
let tx1 = Transaction::new_with_compiled_instructions(
&[&keypair1],
&[pubkey],
Hash::default(),
vec![native_loader::id()],
instructions,
);
let txs = vec![tx0, tx1];
let loaders = vec![Ok(()), Ok(())];
let account0 = Account::new(1, 0, &Pubkey::default());
let account1 = Account::new(2, 0, &Pubkey::default());
let account2 = Account::new(3, 0, &Pubkey::default());
let instruction_accounts0 = vec![account0, account2.clone()];
let instruction_loaders0 = vec![];
let instruction_credits0 = vec![0, 2];
let loaded0 = Ok((
instruction_accounts0,
instruction_loaders0,
instruction_credits0,
));
let instruction_accounts1 = vec![account1, account2.clone()];
let instruction_loaders1 = vec![];
let instruction_credits1 = vec![2, 3];
let loaded1 = Ok((
instruction_accounts1,
instruction_loaders1,
instruction_credits1,
));
let loaded = vec![loaded0, loaded1];
let accounts = collect_accounts(&txs, &loaders, &loaded);
assert_eq!(accounts.len(), 3);
assert!(accounts.contains_key(&keypair0.pubkey()));
assert!(accounts.contains_key(&keypair1.pubkey()));
assert!(accounts.contains_key(&pubkey));
assert_eq!(accounts.get(&keypair0.pubkey()).unwrap().1, 0);
assert_eq!(accounts.get(&keypair1.pubkey()).unwrap().1, 0);
// Accounts referenced more than once need to pass the accumulated credits of additional
// references on to store
assert_eq!(accounts.get(&pubkey).unwrap().1, 3);
} | rust_cleaned_test_functions.jsonl/118952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1091
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
55665,
368,
341,
286,
1077,
1376,
12670,
15,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
1376,
12670,
16,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
95116,
284,
22611,
792,
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_all_workspace() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.1.0"
[dependencies]
bar = { path = "bar" }
[workspace]
"#,
)
.file("src/main.rs", "#[test] fn foo_test() {}")
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
.file("bar/src/lib.rs", "#[test] fn bar_test() {}")
.build();
p.cargo("test --all")
.with_stdout_contains("test foo_test ... ok")
.with_stdout_contains("test bar_test ... ok")
.run();
} | rust_cleaned_test_functions.jsonl/95370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
75560,
368,
341,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
98228,
73494,
75,
756,
310,
435,
2,
698,
310,
508,
4987,
921,
310,
829,
284,
330,
7975,
698,
310,
2319,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_password_callback() {
let mut password_queried = false;
let key = include_bytes!("../test/rsa-encrypted.pem");
Rsa::private_key_from_pem_callback(key, |password| {
password_queried = true;
password[..6].copy_from_slice(b"mypass");
Ok(6)
})
.unwrap();
assert!(password_queried);
} | rust_cleaned_test_functions.jsonl/6925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
10122,
12519,
368,
341,
286,
1077,
5206,
3552,
11280,
261,
1122,
284,
895,
280,
286,
1077,
1376,
284,
2924,
12524,
17223,
1244,
1944,
14,
60869,
12,
36444,
49373,
797,
286,
431,
9081,
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_fn_signature_with_docs() {
let info = call_info(
r#"
/// Adds one to the number given.
///
/// # Examples
///
/// ```
/// let five = 5;
///
/// assert_eq!(6, my_crate::add_one(5));
/// ```
pub fn add_one(x: i32) -> i32 {
x + 1
}
pub fn do() {
add_one(<|>
}"#,
);
assert_eq!(info.parameters(), ["x: i32"]);
assert_eq!(info.active_parameter, Some(0));
assert_eq!(info.label(), "pub fn add_one(x: i32) -> i32");
assert_eq!(
info.doc().map(|it| it.into()),
Some(
r#"Adds one to the number given.
# Examples
```
let five = 5;
assert_eq!(6, my_crate::add_one(5));
```"#
.to_string()
)
);
} | rust_cleaned_test_functions.jsonl/55355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
39859,
6615,
49692,
368,
341,
286,
1077,
3546,
284,
1618,
3109,
1006,
310,
435,
2,
698,
2575,
24475,
825,
311,
279,
1372,
2661,
624,
15374,
2575,
671,
25311,
198,
15374,
2575,
41233,
2575,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sigmoid_activation() {
fn f(x: f32) -> f32 {
1.0 / (1.0 + x.exp())
}
let activation = Activation::Sigmoid;
assert_eq!(
activation.calculate_value(&array![[0.0]]).unwrap(),
&array![[f(0.0)]]
);
assert_eq!(
activation.calculate_value(&array![[0.0, 1.0]]).unwrap(),
&array![[f(0.0), f(1.0)]]
);
assert_eq!(
activation.calculate_value(&array![[0.0], [1.0]]).unwrap(),
&array![[f(0.0)], [f(1.0)]]
);
assert_eq!(
activation
.calculate_value(&array![[0.0, 1.0], [2.0, 3.0]])
.unwrap(),
&array![[f(0.0), f(1.0)], [f(2.0), f(3.0)]]
);
} | rust_cleaned_test_functions.jsonl/65369 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 491
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
52111,
52404,
368,
341,
286,
5168,
282,
2075,
25,
282,
18,
17,
8,
1464,
282,
18,
17,
341,
310,
220,
16,
13,
15,
608,
320,
16,
13,
15,
488,
856,
13754,
2398,
286,
456,
286,
1077,
15099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_file_and_writer() {
let file_spec_bar = FileSpec::default()
.directory(self::test_utils::dir())
.suppress_timestamp()
.discriminant("bar");
let file_spec_foo = file_spec_bar.clone().discriminant("foo");
let w = FileLogWriter::builder(file_spec_bar.clone())
.format(detailed_format)
.try_build()
.unwrap();
{
let handle = Logger::try_with_str("info")
.unwrap()
.log_to_file_and_writer(file_spec_foo, Box::new(w))
.format(detailed_format)
.start()
.unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
error!("This is an error message");
warn!("This is a warning");
info!("This is an info message");
debug!("This is a debug message - you must not see it!");
trace!("This is a trace message - you must not see it!");
handle.validate_logs(&[
("ERROR", "test_default_file_and_writer", "error"),
("WARN", "test_default_file_and_writer", "warning"),
("INFO", "test_default_file_and_writer", "info"),
]);
}
let w = FileLogWriter::builder(file_spec_bar)
.format(detailed_format)
.append()
.try_build()
.unwrap();
w.validate_logs(&[
("ERROR", "test_default_file_and_writer", "error"),
("WARN", "test_default_file_and_writer", "warning"),
("INFO", "test_default_file_and_writer", "info"),
]);
} | rust_cleaned_test_functions.jsonl/105185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 707
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
2458,
8378,
28908,
368,
341,
262,
1077,
1034,
13594,
14388,
284,
2887,
8327,
486,
2258,
741,
286,
659,
23037,
1193,
486,
1944,
17309,
486,
3741,
2398,
286,
659,
96960,
23073,
741,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_fulfill_htlc_bolt2_incorrect_htlc_id() {
//BOLT 2 Requirement: A receiving node: if the id does not correspond to an HTLC in its current commitment transaction MUST fail the channel.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let our_payment_preimage = route_payment(&nodes[0], &[&nodes[1]], 100000).0;
nodes[1].node.claim_funds(our_payment_preimage);
check_added_monitors!(nodes[1], 1);
let events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
let mut update_fulfill_msg: msgs::UpdateFulfillHTLC = {
match events[0] {
MessageSendEvent::UpdateHTLCs { node_id: _ , updates: msgs::CommitmentUpdate { ref update_add_htlcs, ref update_fulfill_htlcs, ref update_fail_htlcs, ref update_fail_malformed_htlcs, ref update_fee, .. } } => {
assert!(update_add_htlcs.is_empty());
assert_eq!(update_fulfill_htlcs.len(), 1);
assert!(update_fail_htlcs.is_empty());
assert!(update_fail_malformed_htlcs.is_empty());
assert!(update_fee.is_none());
update_fulfill_htlcs[0].clone()
},
_ => panic!("Unexpected event"),
}
};
update_fulfill_msg.htlc_id = 1;
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &update_fulfill_msg);
assert!(nodes[0].node.list_channels().is_empty());
let err_msg = check_closed_broadcast!(nodes[0], true).unwrap();
assert_eq!(err_msg.data, "Remote tried to fulfill/fail an HTLC we couldn't find");
check_added_monitors!(nodes[0], 1);
check_closed_event!(nodes[0], 1, ClosureReason::ProcessingError { err: err_msg.data });
} | rust_cleaned_test_functions.jsonl/16934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 747
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
761,
86516,
49086,
17257,
880,
6181,
17,
1243,
19928,
49086,
17257,
842,
368,
341,
197,
322,
33,
35320,
220,
17,
75938,
25,
362,
12308,
2436,
25,
743,
279,
877,
1558,
537,
7866,
311,
458,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_retain() {
let vs = [ 1i32, 2, 3, 4 ];
let mut v = Soa2::new();
v.push_all(&vs, &vs);
v.retain(|(&x, _)| x % 2i32 == 0);
assert_eq!(v.as_slices(), (&[2, 4][..], &[2, 4][..]));
} | rust_cleaned_test_functions.jsonl/121402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21695,
466,
368,
341,
262,
1077,
6165,
284,
508,
220,
16,
72,
18,
17,
11,
220,
17,
11,
220,
18,
11,
220,
19,
9747,
262,
1077,
5206,
348,
284,
2055,
64,
17,
486,
931,
543,
262,
348,
2552,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector_1() {
let m = &[0x86, 0xd0, 0x99, 0x74, 0x84, 0x0b, 0xde, 0xd2, 0xa5, 0xca];
let k = Key([
0x42, 0x90, 0xbc, 0xb1, 0x54, 0x17, 0x35, 0x31, 0xf3, 0x14, 0xaf, 0x57, 0xf3, 0xbe,
0x3b, 0x50, 0x06, 0xda, 0x37, 0x1e, 0xce, 0x27, 0x2a, 0xfa, 0x1b, 0x5d, 0xbd, 0xd1,
0x10, 0x0a, 0x10, 0x07,
]);
let n = Nonce([0xcd, 0x7c, 0xf6, 0x7b, 0xe3, 0x9c, 0x79, 0x4a]);
let ad = &[0x87, 0xe2, 0x29, 0xd4, 0x50, 0x08, 0x45, 0xa0, 0x79, 0xc0];
let c_expected = &[
0xe3, 0xe4, 0x46, 0xf7, 0xed, 0xe9, 0xa1, 0x9b, 0x62, 0xa4, 0x67, 0x7d, 0xab, 0xf4,
0xe3, 0xd2, 0x4b, 0x87, 0x6b, 0xb2, 0x84, 0x75, 0x38, 0x96, 0xe1, 0xd6,
];
let c = seal(m, Some(ad), &n, &k);
assert_eq!(&c[..], c_expected);
} | rust_cleaned_test_functions.jsonl/71680 | {
"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,
12247,
62,
16,
368,
341,
1789,
286,
1077,
296,
284,
44590,
15,
87,
23,
21,
11,
220,
15,
9703,
15,
11,
220,
15,
87,
24,
24,
11,
220,
15,
87,
22,
19,
11,
220,
15,
87,
23,
19,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reexported_enum_name_conversion() {
let _ = Affinity::Downstream;
let _ = RectHeightStyle::IncludeLineSpacingBottom;
let _ = RectWidthStyle::Max;
let _ = TextAlign::End;
let _ = TextDirection::LTR;
} | rust_cleaned_test_functions.jsonl/64496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1533,
291,
31054,
1269,
64132,
368,
341,
262,
1077,
716,
284,
9748,
13489,
486,
4454,
4027,
280,
262,
1077,
716,
284,
11920,
3640,
2323,
486,
22283,
2460,
27026,
11279,
280,
262,
1077,
716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mktemp_quiet() {
let scene = TestScenario::new(util_name!());
scene
.ucmd()
.arg("-p")
.arg("/definitely/not/exist/I/promise")
.arg("-q")
.fails()
.no_stdout()
.no_stderr();
scene
.ucmd()
.arg("-d")
.arg("-p")
.arg("/definitely/not/exist/I/promise")
.arg("-q")
.fails()
.no_stdout()
.no_stderr();
} | rust_cleaned_test_functions.jsonl/38030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64861,
3888,
11280,
3891,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
5231,
262,
6109,
198,
286,
659,
1754,
2277,
741,
286,
659,
858,
13645,
79,
1138,
286,
659,
858,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accounts_db_cache_clean() {
let (accounts_db, keys, slots, _) = setup_accounts_db_cache_clean(10, None);
accounts_db.flush_accounts_cache(true, None);
assert_eq!(accounts_db.accounts_cache.num_slots(), 0);
let mut uncleaned_roots = accounts_db
.accounts_index
.clear_uncleaned_roots(None)
.into_iter()
.collect::<Vec<_>>();
uncleaned_roots.sort_unstable();
assert_eq!(uncleaned_roots, slots);
assert_eq!(
accounts_db.accounts_cache.fetch_max_flush_root(),
*slots.last().unwrap()
);
// cleaned due to later updates
for slot in &slots {
if let ScanStorageResult::Stored(slot_account) = accounts_db.scan_account_storage(
*slot as Slot,
|_| Some(0),
|slot_account: &Arc<RwLock<Pubkey>>, loaded_account: LoadedAccount| {
*slot_account.write().unwrap() = *loaded_account.pubkey();
},
) {
assert_eq!(*slot_account.read().unwrap(), keys[*slot as usize]);
} else {
panic!("Everything should have been flushed")
}
}
} | rust_cleaned_test_functions.jsonl/1420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 663
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
8685,
11529,
19573,
368,
341,
286,
1077,
320,
26206,
8685,
11,
6894,
11,
15711,
11,
27439,
284,
6505,
55665,
8685,
11529,
19573,
7,
16,
15,
11,
2240,
626,
1789,
286,
9618,
8685,
23038,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nipopow_lowest_common_ancestor_diverging_autolykos_v1() {
let popow_algos = NipopowAlgos::default();
for size in [10, 100, 200] {
let stream = block_stream(None);
let chain_0: Vec<_> = stream.take(size).collect();
let branch_point = chain_0[size / 2].clone();
let mut chain_1 = chain_0[..(size / 2)].to_vec();
chain_1.extend(block_stream(Some(branch_point.clone())).take(size / 2));
let chain_0_headers: Vec<_> = chain_0.iter().map(|b| &b.header).collect();
let chain_1_headers: Vec<_> = chain_1.iter().map(|b| &b.header).collect();
assert_eq!(
popow_algos.lowest_common_ancestor(&chain_0_headers, &chain_1_headers),
Some(branch_point.header.clone())
);
}
} | rust_cleaned_test_functions.jsonl/133992 | {
"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,
1089,
79382,
363,
23767,
477,
21107,
62,
66878,
16237,
95296,
32808,
5730,
56678,
2273,
16,
368,
341,
286,
1077,
2420,
363,
8418,
34073,
284,
451,
79382,
363,
2101,
34073,
486,
2258,
543,
286,
369... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unclosed_string() {
let mut reader = Lexer::from_str("\"abc");
assert_err(&mut reader, ParseError::UnclosedString, 1, 1);
} | rust_cleaned_test_functions.jsonl/101133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76576,
9259,
3904,
368,
341,
286,
1077,
5206,
6604,
284,
85082,
486,
1499,
2895,
38915,
13683,
797,
286,
2060,
9266,
2099,
6984,
6604,
11,
14775,
1454,
486,
63718,
9259,
703,
11,
220,
16,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_try_from_put_vsock() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
let body = "{ \
\"vsock_id\": \"string\", \
\"guest_cid\": 0, \
\"uds_path\": \"string\" \
}";
sender
.write_all(http_request("PUT", "/vsock", Some(&body)).as_bytes())
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
} | rust_cleaned_test_functions.jsonl/106589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
15557,
2273,
13199,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
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_stdin_larger_than_128_bytes() {
let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg("larger_than_2056_bytes.txt").run();
let mut stdout_splitted = result.stdout.split(" ");
let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap();
let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap();
assert!(result.success);
assert_eq!(cksum, 945881979);
assert_eq!(bytes_cnt, 2058);
} | rust_cleaned_test_functions.jsonl/69427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
907,
41776,
51613,
62,
16,
17,
23,
12524,
368,
341,
262,
1077,
39464,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
1428,
262,
1077,
1102,
284,
575,
8710,
21186,
445,
26897,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cancel_works() {
new_test_ext().execute_with(|| {
let creator_initial_balance = 100;
let payment_amount = 40;
let expected_incentive_amount = payment_amount / INCENTIVE_PERCENTAGE as u128;
// should be able to create a payment with available balance
assert_ok!(Payment::pay(
Origin::signed(PAYMENT_CREATOR),
PAYMENT_RECIPENT,
CURRENCY_ID,
payment_amount,
None
));
assert_eq!(
PaymentStore::<Test>::get(PAYMENT_CREATOR, PAYMENT_RECIPENT),
Some(PaymentDetail {
asset: CURRENCY_ID,
amount: payment_amount,
incentive_amount: expected_incentive_amount,
state: PaymentState::Created,
resolver_account: RESOLVER_ACCOUNT,
fee_detail: Some((FEE_RECIPIENT_ACCOUNT, 0)),
})
);
// the payment amount should be reserved
assert_eq!(
Tokens::free_balance(CURRENCY_ID, &PAYMENT_CREATOR),
creator_initial_balance - payment_amount - expected_incentive_amount
);
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0);
// cancel should succeed when caller is the recipent
assert_ok!(Payment::cancel(Origin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR));
assert_eq!(
last_event(),
crate::Event::<Test>::PaymentCancelled {
from: PAYMENT_CREATOR,
to: PAYMENT_RECIPENT
}
.into()
);
// the payment amount should be released back to creator
assert_eq!(
Tokens::free_balance(CURRENCY_ID, &PAYMENT_CREATOR),
creator_initial_balance
);
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0);
// should be released from storage
assert_eq!(PaymentStore::<Test>::get(PAYMENT_CREATOR, PAYMENT_RECIPENT), None);
});
} | rust_cleaned_test_functions.jsonl/111983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28895,
11498,
82,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
19919,
15809,
29396,
284,
220,
16,
15,
15,
280,
197,
10217,
8160,
13471,
284,
220,
19,
15,
280,
197,
1021... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_example_4() {
let input: &str = "a\na\na\na";
let valid: usize = get_unique_chars(&input).len();
assert_eq!(valid, 1);
} | rust_cleaned_test_functions.jsonl/120246 | {
"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,
39304,
62,
19,
368,
341,
286,
1077,
1946,
25,
609,
495,
284,
330,
64,
1699,
64,
1699,
64,
1699,
64,
876,
286,
1077,
2697,
25,
22301,
284,
633,
21218,
37418,
2099,
1355,
568,
2892,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_optopt_missing() {
let args = vec!["blah".to_string()];
match Options::new()
.optopt("t", "test", "testing", "TEST")
.parse(&args)
{
Ok(ref m) => {
assert!(!m.opt_present("test"));
assert!(!m.opt_present("t"));
}
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/52359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15032,
2912,
40447,
368,
341,
262,
1077,
2827,
284,
7486,
0,
1183,
70614,
3263,
983,
3904,
33800,
262,
2432,
14566,
486,
931,
741,
286,
659,
2912,
2912,
445,
83,
497,
330,
1944,
497,
330,
8840,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_real_as_uint() {
test_none_with_ctx_and_extra(cast_real_as_uint);
// in_union
let cs = vec![
(-10.0, 0u64),
(i64::MIN as f64, 0),
(10.0, 10u64),
(i64::MAX as f64, (1u64 << 63)),
];
for (input, expect) in cs {
let mut ctx = EvalContext::default();
let rtf = make_ret_field_type_1(true);
let ia = make_implicit_args(true);
let extra = make_extra(&rtf, &ia);
let r = cast_real_as_uint(&mut ctx, &extra, &Some(Real::new(input).unwrap()));
let r = r.map(|x| x.map(|x| x as u64));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
// no clip to zero
let cs = vec![
(10.5, 11u64, false),
(10.4, 10u64, false),
(
((1u64 << 63) + (1u64 << 62)) as f64,
((1u64 << 63) + (1u64 << 62)),
false,
),
(u64::MAX as f64, u64::MAX, false),
((u64::MAX as f64) * 2f64, u64::MAX, true),
(-1f64, -1f64 as i64 as u64, true),
];
for (input, expect, overflow) in cs {
let mut ctx = make_ctx_about_overflow_truncate_should_clip_to_zero(true, false, false);
let ia = make_implicit_args(false);
let rtf = make_ret_field_type_1(true);
let extra = make_extra(&rtf, &ia);
let r = cast_real_as_uint(&mut ctx, &extra, &Real::new(input).ok());
let r = r.map(|x| x.map(|x| x as u64));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
check_overflow(&ctx, overflow, log.as_str())
}
// should clip to zero
let cs: Vec<(f64, u64, bool)> = vec![
(-1f64, 0, true),
(i64::MIN as f64, 0, true),
];
for (input, expect, overflow) in cs {
let mut ctx = make_ctx_about_overflow_truncate_should_clip_to_zero(true, false, true);
let ia = make_implicit_args(false);
let rft = make_ret_field_type_1(true);
let extra = make_extra(&rft, &ia);
let r = cast_real_as_uint(&mut ctx, &extra, &Some(Real::new(input).unwrap()));
let r = r.map(|x| x.map(|x| x as u64));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
check_overflow(&ctx, overflow, log.as_str())
}
} | rust_cleaned_test_functions.jsonl/101765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1480
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
11898,
15807,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
15266,
11898,
15807,
626,
286,
442,
304,
51621,
198,
286,
1077,
10532,
284,
7486,
90515,
3374,
310,
10293,
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... | 4 |
#[test]
fn test_colors() {
let salmon = rgb(250, 128, 114);
assert_eq!(salmon.to_css(), "rgb(250, 128, 114)");
} | rust_cleaned_test_functions.jsonl/69876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33670,
368,
341,
286,
1077,
40320,
284,
17993,
7,
17,
20,
15,
11,
220,
16,
17,
23,
11,
220,
16,
16,
19,
626,
286,
2060,
10714,
10297,
19222,
1645,
2389,
25924,
1507,
330,
16509,
7,
17,
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 |
#[test]
fn test_interval_bidirectional() {
let anchor = Interval::starting_at(Moment(Local.ymd(2017, 04, 25).and_hms(9, 10, 11)),
Grain::Second);
let mut bidirectional = BidirectionalWalker::new()
.forward_with(anchor, |prev| prev + PeriodComp::days(1))
.backward_with(anchor - PeriodComp::days(1),
|prev| prev - PeriodComp::days(1));
assert_eq!(Moment(Local.ymd(2017, 04, 25).and_hms(9, 10, 11)),
bidirectional.forward.next().unwrap().start);
assert_eq!(Moment(Local.ymd(2017, 04, 26).and_hms(9, 10, 11)),
bidirectional.forward.next().unwrap().start);
assert_eq!(Moment(Local.ymd(2017, 04, 24).and_hms(9, 10, 11)),
bidirectional.backward.next().unwrap().start);
assert_eq!(Moment(Local.ymd(2017, 04, 23).and_hms(9, 10, 11)),
bidirectional.backward.next().unwrap().start);
} | rust_cleaned_test_functions.jsonl/56547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20541,
62509,
44670,
368,
341,
286,
1077,
17105,
284,
40584,
486,
39289,
3752,
3189,
12913,
42718,
13,
1600,
67,
7,
17,
15,
16,
22,
11,
220,
15,
19,
11,
220,
17,
20,
568,
437,
1523,
1011,
7,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resource_block_resource_relations_can_only_appear_after_on() {
let p = Polar::new();
p.register_constant(sym!("Repo"), term!("unimportant"))
.unwrap();
expect_error(
&p,
r#"resource Repo {
roles = ["owner"];
relations = { parent: Org };
"parent" if "owner";
}"#,
r#"Repo: resource relation "parent" can only appear in a rule body following the keyword 'on'."#,
);
} | rust_cleaned_test_functions.jsonl/31744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17962,
7113,
17962,
94221,
27421,
18410,
21093,
8015,
19844,
4470,
368,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
9929,
34967,
62512,
17223,
25243,
3975,
4647,
17223,
359,
15333,
545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_elapsed_compute() {
let metrics = ExecutionPlanMetricsSet::new();
assert!(metrics.clone_inner().elapsed_compute().is_none());
let partition = 1;
let elapsed_compute = MetricBuilder::new(&metrics).elapsed_compute(partition);
elapsed_compute.add_duration(Duration::from_nanos(1234));
let elapsed_compute = MetricBuilder::new(&metrics).elapsed_compute(partition + 1);
elapsed_compute.add_duration(Duration::from_nanos(6));
assert_eq!(metrics.clone_inner().elapsed_compute().unwrap(), 1240);
} | rust_cleaned_test_functions.jsonl/28183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73737,
57028,
368,
341,
286,
1077,
16734,
284,
30928,
20485,
27328,
1649,
486,
931,
543,
286,
2060,
10297,
43262,
15997,
34345,
1005,
53118,
57028,
1005,
285,
31488,
5231,
286,
1077,
16658,
284,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log_exec_zero() {
let l = Log::<Operation>::default();
let o = [Operation::Read];
let mut f = |op: Operation, i: usize| {
assert_eq!(op, Operation::Read);
assert_eq!(i, 1);
};
let mut g = |_op: Operation, _i: usize| {
assert!(false);
};
l.append(&o, 1, |_o: Operation, _i: usize| {});
l.exec(1, &mut f);
l.exec(1, &mut g);
} | rust_cleaned_test_functions.jsonl/101056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
18430,
19359,
368,
341,
286,
1077,
326,
284,
2835,
27638,
8432,
6831,
2258,
543,
286,
1077,
297,
284,
508,
8432,
486,
4418,
935,
286,
1077,
5206,
282,
284,
760,
453,
25,
16730,
11,
600,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dual_vec_log() {
let res = DualVec64::<2>::new(1.2, StaticVec::new_vec([1.0, 1.0])).log(4.2);
assert!((res.re - 0.127045866345188).abs() < 1e-12);
assert!((res.eps[0] - 0.580685888982970).abs() < 1e-12);
assert!((res.eps[1] - 0.580685888982970).abs() < 1e-12);
} | rust_cleaned_test_functions.jsonl/28598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96772,
13251,
5224,
368,
341,
262,
1077,
592,
284,
33659,
10050,
21,
19,
27638,
17,
6831,
931,
7,
16,
13,
17,
11,
23105,
10050,
486,
931,
13251,
2561,
16,
13,
15,
11,
220,
16,
13,
15,
54697,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mm_shuffle() {
assert_eq!(_MM_SHUFFLE!(0, 1, 1, 3), 0b00_01_01_11);
assert_eq!(_MM_SHUFFLE!(3, 1, 1, 0), 0b11_01_01_00);
assert_eq!(_MM_SHUFFLE!(1, 2, 2, 1), 0b01_10_10_01);
} | rust_cleaned_test_functions.jsonl/41665 | {
"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,
35599,
73484,
368,
341,
197,
6948,
10714,
0,
2490,
8035,
6834,
8825,
867,
10297,
15,
11,
220,
16,
11,
220,
16,
11,
220,
18,
701,
220,
15,
65,
15,
15,
62,
15,
16,
62,
15,
16,
62,
16,
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_rsplitn_char_iterator() {
let data = "\nMäry häd ä little lämb\nLittle lämb\n";
let mut split: Vec<&str> = data.rsplitn(4, ' ').collect();
split.reverse();
assert_eq!(split, ["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
let mut split: Vec<&str> = data.rsplitn(4, |c: char| c == ' ').collect();
split.reverse();
assert_eq!(split, ["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
// Unicode
let mut split: Vec<&str> = data.rsplitn(4, 'ä').collect();
split.reverse();
assert_eq!(split, ["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
let mut split: Vec<&str> = data.rsplitn(4, |c: char| c == 'ä').collect();
split.reverse();
assert_eq!(split, ["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
} | rust_cleaned_test_functions.jsonl/17656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
6960,
77,
9232,
13491,
368,
341,
262,
1077,
821,
284,
2917,
77,
44,
2305,
884,
305,
30875,
12709,
2632,
30005,
3096,
1699,
38103,
30005,
3096,
1699,
3302,
262,
1077,
5206,
6718,
25,
11312,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul() {
let vec = Vec3::new(0.0, 1.0, 2.0);
assert_eq!(vec * 5.0, Vec3::new(0.0, 5.0, 10.0));
assert_eq!(5.0 * vec, Vec3::new(0.0, 5.0, 10.0));
} | rust_cleaned_test_functions.jsonl/39248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
286,
1077,
7486,
284,
11312,
18,
486,
931,
7,
15,
13,
15,
11,
220,
16,
13,
15,
11,
220,
17,
13,
15,
317,
286,
2060,
10714,
10297,
4083,
353,
220,
20,
13,
15,
11,
11312,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subsystem_interior_null() {
let log = OsLog::new("com.example.oslog\0test", "category");
log.with_level(Level::Debug, "Hi");
} | rust_cleaned_test_functions.jsonl/102884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
8948,
15318,
2462,
15162,
368,
341,
286,
1077,
1487,
284,
15433,
2201,
486,
931,
445,
874,
7724,
9291,
839,
59,
15,
1944,
497,
330,
5471,
797,
286,
1487,
18164,
8274,
30263,
486,
7939,
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 |
#[test]
fn test_pr_merge_ignore_space_change() {
let git = TempGit::new();
let github = MockGithub::new();
let contents_base = "
if (true) {
do_something();
}
";
let contents_master = "
try {
if (true) {
do_something();
}
} catch ( ... ) {
aha();
}
";
let contents_10 = "
if (true) {
do_something();
}
";
let contents_10_final = "try {
if (true) {
do_something();
}
} catch ( ... ) {
aha();
}";
// base contents
git.add_repo_file("file.cpp", contents_base, "base");
// setup a release branch: make change in space length
git.run_git(&["checkout", "-b", "release/1.0"]);
git.add_repo_file("file.cpp", contents_10, "a change on 1.0");
git.run_git(&["push", "-u", "origin", "release/1.0"]);
// make a new commit on master
git.run_git(&["checkout", "master"]);
git.add_repo_file("file.cpp", contents_master, "final change");
let commit1 = git.git.current_commit().unwrap();
// pretend this came from a PR
let mut pr = github::PullRequest::new();
pr.number = 123;
pr.merged = Some(true);
pr.merge_commit_sha = Some(commit1.clone());
pr.head = github::BranchRef::new("my-feature-branch");
pr.base = github::BranchRef::new("master");
pr.assignees = vec![github::User::new("user1"), github::User::new("user2")];
let pr = pr;
let mut new_pr = github::PullRequest::new();
new_pr.number = 456;
let new_pr = new_pr;
github.mock_create_pull_request(
"the-owner",
"the-repo",
"master->1.0: final change",
&format!("(cherry-picked from {}, PR #123)", commit1),
"my-feature-branch-1.0",
"release/1.0",
Ok(new_pr),
);
github.mock_assign_pull_request(
"the-owner",
"the-repo",
456,
vec!["user1".into(), "user2".into()],
Ok(()),
);
github.mock_comment_pull_request(
"the-owner",
"the-repo",
456,
"Cherry-pick required option `ignore-space-change`. Please verify correctness.",
Ok(()),
);
let created_pr = pr_merge::merge_pull_request(&git.git, &github, "the-owner", "the-repo", &pr, "release/1.0", "release/")
.unwrap();
assert_eq!(456, created_pr.number);
assert_eq!(contents_10_final, git.run_git(&["cat-file", "blob", "my-feature-branch-1.0:file.cpp"]));
} | rust_cleaned_test_functions.jsonl/30544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1087
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
20888,
58493,
14663,
15947,
368,
341,
262,
1077,
16345,
284,
19944,
46562,
486,
931,
543,
262,
1077,
31004,
284,
14563,
78717,
486,
931,
1428,
262,
1077,
8794,
7651,
284,
6228,
333,
320,
186... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ttl_expired() {
// Receive an IP packet with an expired TTL. Check to make sure that we
// respond with the appropriate ICMP message.
test_receive_ip_packet::<Ipv4, _, _, _, _>(
|builder| {
builder.ipv4_builder().forward(true);
},
&mut [0u8; 128],
DUMMY_CONFIG_V4.remote_ip,
1,
IpProto::Udp.into(),
&["send_icmpv4_ttl_expired", "send_icmp_error_message"],
Some((IcmpTimeExceeded::default(), Icmpv4TimeExceededCode::TtlExpired)),
// Ensure packet is truncated to the right length.
|packet| assert_eq!(packet.original_packet().bytes().len(), 84),
);
test_receive_ip_packet::<Ipv6, _, _, _, _>(
|builder| {
builder.ipv6_builder().forward(true);
},
&mut [0u8; 128],
DUMMY_CONFIG_V6.remote_ip,
1,
IpProto::Udp.into(),
&["send_icmpv6_ttl_expired", "send_icmp_error_message"],
Some((IcmpTimeExceeded::default(), Icmpv6TimeExceededCode::HopLimitExceeded)),
// Ensure packet is truncated to the right length.
|packet| assert_eq!(packet.original_packet().bytes().len(), 168),
);
} | rust_cleaned_test_functions.jsonl/65671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 697
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87157,
80221,
368,
341,
286,
442,
37422,
458,
6790,
10151,
448,
458,
26391,
78532,
13,
4248,
311,
1281,
2704,
429,
582,
198,
286,
442,
5889,
448,
279,
8311,
83988,
1943,
624,
286,
1273,
38557,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_noff() -> Result<()> {
let guard = fixture().prepare(
"local",
r#"
origin <<EOF
git checkout master
git merge feature --no-ff
git branch -D feature
EOF
"#,
)?;
let git = Git::try_from(Repository::open(guard.working_directory())?)?;
let plan = get_trim_plan(&git, &test_default_param())?;
assert_eq!(
plan.to_delete,
set! {
ClassifiedBranch::MergedLocal(LocalBranch::new("refs/heads/feature")),
},
);
Ok(())
} | rust_cleaned_test_functions.jsonl/97314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
1847,
368,
1464,
5714,
71698,
341,
262,
1077,
7616,
284,
12507,
1005,
13609,
1006,
286,
330,
2438,
756,
286,
435,
2,
698,
286,
6238,
1115,
23483,
198,
310,
16345,
27264,
7341,
198,
310,
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... | 5 |
#[test]
fn test_good_country_code() {
match lookup("DEU") {
None => panic!("was expecting a country"),
Some(country) => {
assert_eq!(country.short_code, "DE");
assert_eq!(country.country_code, 276);
}
}
} | rust_cleaned_test_functions.jsonl/43781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44781,
28106,
4136,
368,
341,
286,
2432,
18615,
445,
1150,
52,
899,
341,
310,
2240,
589,
21975,
17223,
16123,
22331,
264,
3146,
4461,
310,
4329,
55764,
8,
589,
341,
394,
2060,
10714,
10297,
11141,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cvttsd2si() {
assert_emit!(0xf2, 0x0f, 0x2c, 0xc8; cvttsd2si(0, RCX, XMM0));
assert_emit!(0xf2, 0x44, 0x0f, 0x2c, 0xfb; cvttsd2si(0, R15, XMM3));
assert_emit!(0xf2, 0x41, 0x0f, 0x2c, 0xe0; cvttsd2si(0, RSP, XMM8));
assert_emit!(0xf2, 0x48, 0x0f, 0x2c, 0xc8; cvttsd2si(1, RCX, XMM0));
assert_emit!(0xf2, 0x4c, 0x0f, 0x2c, 0xfb; cvttsd2si(1, R15, XMM3));
assert_emit!(0xf2, 0x49, 0x0f, 0x2c, 0xe0; cvttsd2si(1, RSP, XMM8));
} | rust_cleaned_test_functions.jsonl/85501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
9708,
2576,
67,
17,
6321,
368,
341,
286,
2060,
69082,
10297,
15,
5848,
17,
11,
220,
15,
87,
15,
69,
11,
220,
15,
87,
17,
66,
11,
220,
15,
8148,
23,
26,
5544,
83,
2576,
67,
17,
6321,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_deprecation_strategy() {
let input = "
#[derive(GraphQLQuery)]
#[graphql(
schema_path = \"x\",
query_path = \"x\",
deprecated = \"foo\",
)]
struct MyQuery;
";
let parsed = syn::parse_str(input).unwrap();
match extract_deprecation_strategy(&parsed) {
Ok(_) => panic!("parsed unexpectedly"),
Err(e) => assert_eq!(&format!("{}", e), DEPRECATION_ERROR),
};
} | rust_cleaned_test_functions.jsonl/21432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
2259,
69593,
49308,
368,
341,
286,
1077,
1946,
284,
6228,
286,
11506,
27098,
63779,
3588,
2859,
5563,
286,
11506,
38294,
1006,
310,
10802,
2638,
284,
7245,
87,
83515,
310,
3239,
2638,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.