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_periodic_config() {
let fp = std::fs::File::open("tests/fixtures/20-periodic-sample.toml").unwrap();
let mut bufrd = std::io::BufReader::new(fp);
let mut content = vec![];
bufrd.read_to_end(&mut content).unwrap();
let frag: fragments::ConfigFragment = toml::from_slice(&content).unwrap();
let cfg = inputs::ConfigInput::merge_fragments(vec![frag]);
let strategy = StrategyPeriodic::new(cfg.updates).unwrap();
assert_eq!(strategy.schedule.total_length_minutes(), 3145);
} | rust_cleaned_test_functions.jsonl/37969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20818,
292,
5332,
368,
341,
286,
1077,
12007,
284,
1460,
486,
3848,
486,
1703,
486,
2508,
445,
23841,
94275,
14,
17,
15,
98081,
292,
83879,
73494,
75,
1827,
15454,
543,
286,
1077,
5206,
1031,
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_clone_shared_drops_when_all_refs_are_gone() {
let mock_handle = Box::into_raw(Box::new(MockGarbageCollector::default()));
let count = Arc::new(AtomicUsize::new(1));
let value = RefCounter::new(count.clone());
{
let shared1 =
SharedGeneric::<RefCounter, MockGarbageCollector, MockNode<RefCounter>>::new(
mock_handle,
value,
);
set_drop_command(&shared1, mock_ptr(2));
let _shared2 = shared1;
}
assert_eq!(
count.load(Ordering::Relaxed),
1,
"contents were dropped on the main thread"
);
// Drop command should have been pushed into drop queue
let queue_len = unsafe { (*mock_handle).queue.len() };
assert_eq!(queue_len, 1, "Drop command was not enqueued");
// It was our drop command that was pushed
let drop_command = unsafe { (*mock_handle).queue.pop().unwrap() };
assert_eq!(drop_command, mock_ptr(2), "Drop command is invalid");
} | rust_cleaned_test_functions.jsonl/48711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
20405,
814,
3702,
47636,
5705,
60638,
56855,
1889,
603,
368,
341,
286,
1077,
7860,
10630,
284,
8261,
486,
18122,
16067,
67758,
486,
931,
66436,
43930,
20652,
53694,
486,
2258,
7392,
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_error_big_number() {
assert_eq!(error_message(&BIG_NUMBER_ERROR.code_num), BIG_NUMBER_ERROR.message);
assert_eq!(error_message(&INVALID_PROOF_CREDENTIAL_DATA.code_num), INVALID_PROOF_CREDENTIAL_DATA.message);
assert_eq!(error_message(&INDY_SUBMIT_REQUEST_ERR.code_num), INDY_SUBMIT_REQUEST_ERR.message);
assert_eq!(error_message(&BUILD_CREDENTIAL_DEF_REQ_ERR.code_num), BUILD_CREDENTIAL_DEF_REQ_ERR.message);
assert_eq!(error_message(&NO_POOL_OPEN.code_num), NO_POOL_OPEN.message);
} | rust_cleaned_test_functions.jsonl/19303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
36386,
5500,
368,
341,
286,
2060,
10714,
10297,
841,
6462,
2099,
67017,
19364,
5414,
10210,
4273,
701,
36854,
19364,
5414,
6698,
317,
286,
2060,
10714,
10297,
841,
6462,
2099,
46859,
5756,
124... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_node_type() {
assert!(is_node_type(T_ROOT, T_ROOT));
assert!(is_node_type(T_ROOT, T_ROOT));
assert!(! is_node_type(T_LEAF, T_ROOT));
assert!(! is_node_type(0, T_ROOT));
} | rust_cleaned_test_functions.jsonl/77484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
5084,
1819,
368,
341,
262,
2060,
10297,
285,
5084,
1819,
4140,
16197,
11,
350,
16197,
1106,
262,
2060,
10297,
285,
5084,
1819,
4140,
16197,
11,
350,
16197,
1106,
262,
2060,
0,
3471,
374,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolving_multiple_deps() {
let reg = registry(vec![pkg!("foo"), pkg!("bar"), pkg!("baz")]);
let res = resolve(&pkg_id("root"), vec![dep("foo"), dep("baz")], ®).unwrap();
assert_same(&res, &names(&["root", "foo", "baz"]));
} | rust_cleaned_test_functions.jsonl/48304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
19648,
45233,
76489,
368,
341,
262,
1077,
1217,
284,
19424,
25592,
20703,
30069,
17223,
7975,
3975,
24793,
17223,
2257,
3975,
24793,
17223,
42573,
899,
2558,
262,
1077,
592,
284,
8830,
2099,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_origin() {
let mut cors = Cors::new()
.allowed_origin("https://www.example.com")
.finish(test::ok_service());
let req = TestRequest::with_header("Origin", "https://www.example.com")
.method(Method::GET)
.to_srv_request();
let resp = test::call_service(&mut cors, req);
assert_eq!(resp.status(), StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
34043,
368,
341,
286,
1077,
5206,
43911,
284,
52518,
486,
931,
741,
310,
659,
20967,
34043,
445,
2428,
1110,
2136,
7724,
905,
1138,
310,
659,
30150,
8623,
486,
562,
12267,
5231,
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_net_config() {
let net_id = "id";
let host_dev_name = "dev";
let guest_mac = "01:23:45:67:89:0b";
let net_if = create_netif(net_id, host_dev_name, guest_mac);
assert_eq!(
*net_if.guest_mac().unwrap(),
MacAddr::parse_str(guest_mac).unwrap()
);
assert_eq!(net_if.allow_mmds_requests(), false);
} | rust_cleaned_test_functions.jsonl/112435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19722,
5332,
368,
341,
286,
1077,
4179,
842,
284,
330,
307,
876,
286,
1077,
3468,
10433,
1269,
284,
330,
3583,
876,
286,
1077,
8640,
22802,
284,
330,
15,
16,
25,
17,
18,
25,
19,
20,
25,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simulate_shoot_2x2_with_rocket_launcher() {
let world = with_unit_health(
with_unit_health(
with_unit_health(
with_unit_health(
with_unit_position(
with_unit_position(
with_my_unit_with_weapon(example_world_with_team_size(2), WeaponType::RocketLauncher),
EXAMPLE_MY_UNIT_ID,
Vec2::new(4.5, 1.0)
),
EXAMPLE_MY_UNIT_ID_1,
Vec2::new(3.5, 1.9)
),
EXAMPLE_OPPONENT_UNIT_ID, 50
),
EXAMPLE_MY_UNIT_ID, 50
),
EXAMPLE_MY_UNIT_ID_1, 80
),
EXAMPLE_OPPONENT_UNIT_ID_1, 80
);
let my_unit = world.get_unit(EXAMPLE_MY_UNIT_ID);
let opponent_unit = world.get_unit(EXAMPLE_OPPONENT_UNIT_ID);
let direction = (opponent_unit.center() - my_unit.center()).normalized();
let weapon = my_unit.weapon.as_ref().unwrap();
let number_of_directions = 11;
let shoot_result = simulate_shoot(EXAMPLE_MY_UNIT_ID, my_unit.center(), direction,
opponent_unit.id, opponent_unit.position(), weapon.params.min_spread, &weapon.typ,
&weapon.params.bullet, &weapon.params.explosion, &world, number_of_directions, &mut None);
assert_eq!(shoot_result, ShootResult { player_score: 12100, opponent_score: 22000, teammates_damage: 880, unit_damage: 550 });
} | rust_cleaned_test_functions.jsonl/125079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 832
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18314,
6334,
3712,
1905,
62,
17,
87,
17,
6615,
26608,
3996,
79277,
368,
341,
262,
1077,
1879,
284,
448,
14832,
45727,
1006,
286,
448,
14832,
45727,
1006,
310,
448,
14832,
45727,
1006,
394,
448,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_or_reg_addr() {
let compiled = compile("SET HL 100\nSET B 255\nWRITE64 B\nSET A 1000\nOR A (100)");
let out_cpu = test_program(compiled);
assert_eq!(out_cpu.hl.value, 100);
assert_eq!(out_cpu.a.value, 1023);
assert_eq!(out_cpu.b.value, 255);
assert_eq!(out_cpu.c.value, 0);
assert_eq!(out_cpu.f.value, 0);
} | rust_cleaned_test_functions.jsonl/63176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
4920,
7387,
368,
341,
262,
1077,
19697,
284,
19192,
445,
5884,
52487,
220,
16,
15,
15,
1699,
5884,
425,
220,
17,
20,
20,
1699,
32781,
21,
19,
425,
1699,
5884,
362,
220,
16,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sqlite(){
let pg = Platform::sqlite();
let mut query = Select::new();
query.from(&"users".to_string());
let filter = Filter::new("username", EQ, &"Hello".to_string());
query.add_filter(&filter);
let sql = pg.build_select(&query, &BuildMode::Debug);
println!("{}", sql);
let expected = r#"
SELECT
FROM users
WHERE username = 'Hello'
"#;
assert_eq!(sql.sql.trim(), expected.trim());
} | rust_cleaned_test_functions.jsonl/47696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18063,
632,
3032,
262,
1077,
17495,
284,
17458,
486,
37042,
543,
262,
1077,
5206,
3239,
284,
8427,
486,
931,
543,
262,
3239,
6387,
2099,
1,
4218,
3263,
983,
3904,
1423,
262,
1077,
4051,
284,
123... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sequence_number() {
let path = DBPath::new("_rust_rocksdb_test_sequence_number");
{
let db = DB::open_default(&path).unwrap();
assert_eq!(db.latest_sequence_number(), 0);
let _ = db.put(b"key", b"value");
assert_eq!(db.latest_sequence_number(), 1);
}
} | rust_cleaned_test_functions.jsonl/91348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23735,
5500,
368,
341,
262,
1077,
1815,
284,
5952,
1820,
486,
931,
16975,
35788,
26608,
14553,
1999,
4452,
23735,
5500,
797,
262,
341,
286,
1077,
2927,
284,
5952,
486,
2508,
9993,
2099,
2343,
568,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_int_from_str_fail() {
assert!(Value::int_from_str("q-9223$37(203)[]M807").is_err());
} | rust_cleaned_test_functions.jsonl/86198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 60
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
4042,
5673,
2895,
22121,
368,
341,
262,
2060,
10297,
1130,
486,
396,
5673,
2895,
445,
80,
12,
24,
17,
17,
18,
3,
18,
22,
7,
17,
15,
18,
8,
1294,
44,
23,
15,
22,
1827,
285,
9266,
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 |
#[test]
fn test_sign_rfc6979_verify_random() {
let mut rng = ThreadRng256 {};
for _ in 0..ITERATIONS {
let msg = rng.gen_uniform_u8x32();
let sk = SecKey::gensk(&mut rng);
let pk = sk.genpk();
let sign = sk.sign_rfc6979::<Sha256>(&msg);
assert!(pk.verify_vartime::<Sha256>(&msg, &sign));
}
} | rust_cleaned_test_functions.jsonl/81727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
1710,
8316,
21,
24,
22,
24,
35638,
22644,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
20375,
286,
369,
716,
304,
220,
15,
496,
24733,
21792,
341,
310,
1077,
3750,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hdu_iterator() {
duplicate_test_file(|filename| {
let mut f = FitsFile::open(filename).unwrap();
let mut counter = 0;
for _ in f.iter() {
counter += 1;
}
assert_eq!(counter, 2);
});
} | rust_cleaned_test_functions.jsonl/119002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
1054,
13491,
368,
341,
286,
22513,
4452,
2458,
22428,
8404,
91,
341,
310,
1077,
5206,
282,
284,
78245,
1703,
486,
2508,
10961,
568,
15454,
543,
310,
1077,
5206,
5546,
284,
220,
15,
401,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_affine_transform() {
let affine0 = Affine([[2., 5.], [0., -2.]], [11., 3.]);
let affine1 = Affine([[4., -9.], [-1., PI]], [0., -8.]);
let transformed = affine1.transform(&affine0);
approx_eq!(f64, 3., transformed.0[0][0]);
approx_eq!(f64, 5. * PI - 18., transformed.0[0][1]);
approx_eq!(f64, 2., transformed.0[1][0]);
approx_eq!(f64, -2. * PI, transformed.0[1][1]);
approx_eq!(f64, -29., transformed.1[0]);
approx_eq!(f64, 19., transformed.1[1]);
let transformed = affine0.transform(&affine1);
approx_eq!(f64, 8., transformed.0[0][0]);
approx_eq!(f64, 38., transformed.0[0][1]);
approx_eq!(f64, -2., transformed.0[1][0]);
approx_eq!(f64, -5. - 2. * PI, transformed.0[1][1]);
approx_eq!(f64, 17., transformed.1[0]);
approx_eq!(f64, 3. * PI - 19., transformed.1[1]);
} | rust_cleaned_test_functions.jsonl/102302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
482,
18449,
368,
341,
286,
1077,
68809,
15,
284,
9748,
482,
27119,
17,
2572,
220,
20,
13,
1125,
508,
15,
2572,
481,
17,
13,
20492,
508,
16,
16,
2572,
220,
18,
13,
2558,
286,
1077,
688... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part_1() {
assert!(run(INPUT, false) == 112);
let results = run(include_str!("../../input/17.txt"), false);
println!("{}", results);
assert!(results == 310);
} | rust_cleaned_test_functions.jsonl/125517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
62,
16,
368,
341,
286,
2060,
10297,
6108,
57911,
11,
895,
8,
621,
220,
16,
16,
17,
317,
286,
1077,
3059,
284,
1598,
77863,
2895,
17223,
2748,
1355,
14,
16,
22,
3909,
3975,
895,
317,
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 |
#[test]
fn test_first_empty() {
let v: Vec<Value> = Vec::new();
let result = first(&to_value(&v).unwrap(), &HashMap::new());
assert!(result.is_ok());
assert_eq!(result.ok().unwrap(), to_value("").unwrap());
} | rust_cleaned_test_functions.jsonl/62043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
15124,
368,
341,
286,
1077,
348,
25,
11312,
48325,
29,
284,
11312,
486,
931,
1428,
286,
1077,
1102,
284,
1156,
2099,
983,
3142,
2099,
85,
568,
15454,
1507,
609,
18497,
486,
931,
1423,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_read_pages() -> Result<(), Error> {
let mut pager = open_test_pager()?;
let total_pages = 20;
// Test creating and reading multiple pages to assert
// that the pager read the correct offset.
for i in 0..total_pages {
let page_number: PageNumber = pager.allocate_page();
let page_data = [i; PAGE_SIZE];
pager.write_page(page_number, &page_data)?;
let mut page = [0; PAGE_SIZE];
pager.read_page(page_number, &mut page)?;
assert_eq!(page_data, page);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/127401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
6443,
21655,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
52588,
284,
1787,
4452,
620,
1409,
368,
69493,
286,
1077,
2790,
21655,
284,
220,
17,
15,
401,
286,
442,
3393,
6825,
323... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_filter_parser_less() {
let mut input = Cursor::new("x < 42ft".as_bytes());
let mut parser = Parser::make(&mut input).expect("Should create parser");
let less = parser.parse().expect("Less");
assert_eq!(less.to_string(), "x < 42ft");
} | rust_cleaned_test_functions.jsonl/125358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
18517,
50747,
368,
972,
286,
1077,
5206,
1946,
284,
28067,
486,
931,
445,
87,
366,
220,
19,
17,
723,
3263,
300,
12524,
6201,
286,
1077,
5206,
6729,
284,
21102,
486,
6927,
2099,
6984,
1946,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_all_notifications() {
block_on(async {
let (client, mut session) = test_helpers::authenticated_client("notificationsuserid").await;
loop {
let notifications = client
.list_notifications(&mut session, Some(5), None)
.await
.expect("Failed to fetch notifications");
if notifications.notifications.len() == 0 {
return;
}
let ids: Vec<&str> = notifications
.notifications
.iter()
.map(|notification| &*notification.id)
.collect();
client
.delete_notifications(&mut session, ids.as_ref())
.await
.expect("Failed to delete notifications");
}
});
} | rust_cleaned_test_functions.jsonl/50267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 439
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
5705,
67546,
368,
341,
262,
2504,
4470,
18285,
341,
286,
1077,
320,
2972,
11,
5206,
3797,
8,
284,
1273,
54473,
486,
57707,
8179,
445,
38188,
20085,
1827,
11421,
401,
286,
6337,
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... | 2 |
#[test]
fn test_empty_email_not_added() {
let (_b, app, middle) = app();
let mut req = req(Method::Get, "/api/v1/me");
let user = {
let conn = app.diesel_database.get().unwrap();
let user = new_user("papaya").create_or_update(&conn).unwrap();
sign_in_as(&mut req, &user);
user
};
let body =
r#"{"user":{"email":"","name":"Papayo Papaya","login":"papaya","avatar":"https://avatars0.githubusercontent.com","url":"https://github.com/papaya","kind":null}}"#;
let json = bad_resp!(
middle.call(
req.with_path(&format!("/api/v1/users/{}", user.id))
.with_method(Method::Put)
.with_body(body.as_bytes()),
)
);
assert!(
json.errors[0].detail.contains("empty email rejected"),
"{:?}",
json.errors
);
let body =
r#"{"user":{"email":null,"name":"Papayo Papaya","login":"papaya","avatar":"https://avatars0.githubusercontent.com","url":"https://github.com/papaya","kind":null}}"#;
let json = bad_resp!(
middle.call(
req.with_path(&format!("/api/v1/users/{}", user.id))
.with_method(Method::Put)
.with_body(body.as_bytes()),
)
);
assert!(
json.errors[0].detail.contains("empty email rejected"),
"{:?}",
json.errors
);
} | rust_cleaned_test_functions.jsonl/29159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 673
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
9172,
7913,
37653,
368,
341,
262,
1077,
5453,
65,
11,
906,
11,
6149,
8,
284,
906,
543,
262,
1077,
5206,
4232,
284,
4232,
35419,
486,
1949,
11,
3521,
2068,
5457,
16,
50899,
797,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_to_bytes_withdraw() {
let withdraw = Withdraw::new(
ACCOUNT_ID,
*ALICE,
*BOB,
TOKEN_ID,
(*AMOUNT).clone(),
(*FEE).clone(),
NONCE,
None,
);
let bytes = withdraw.get_bytes();
assert_eq!(hex::encode(bytes), "03000000642a0a81e257a2f5d6ed4f07b81dbda09f107bd02621abaed8712072e918632259780e587698ef58da000500000000000000000000000000bc614e7d0300000014");
} | rust_cleaned_test_functions.jsonl/130121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
2346,
12524,
6615,
7633,
368,
341,
286,
1077,
14798,
284,
67381,
486,
931,
1006,
310,
62358,
3450,
345,
310,
353,
969,
5487,
345,
310,
353,
4677,
33,
345,
310,
43574,
3450,
345,
310,
4609... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_i32x4_packed_comparisons() {
let a = I32x4::new(59, 1, 5, 63);
let b = I32x4::new(-59, 1, 5, 104);
assert_eq!(a.packed_eq(b), U32x4::new(0, !0, !0, 0));
} | rust_cleaned_test_functions.jsonl/66193 | {
"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,
5318,
18,
17,
87,
19,
620,
11191,
2965,
1732,
19379,
368,
341,
262,
1077,
264,
284,
358,
18,
17,
87,
19,
486,
931,
7,
20,
24,
11,
220,
16,
11,
220,
20,
11,
220,
21,
18,
317,
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_bitv_set_symmetric_difference() {
let mut a = BitvSet::new();
let mut b = BitvSet::new();
assert!(a.insert(1));
assert!(a.insert(3));
assert!(a.insert(5));
assert!(a.insert(9));
assert!(a.insert(11));
assert!(b.insert(3));
assert!(b.insert(9));
assert!(b.insert(14));
assert!(b.insert(220));
let expected = [1, 5, 11, 14, 220];
let actual = a.symmetric_difference(&b).collect::<Vec<uint>>();
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/119309 | {
"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,
13996,
85,
2602,
26825,
15903,
47525,
368,
341,
286,
1077,
5206,
264,
284,
6495,
85,
1649,
486,
931,
543,
286,
1077,
5206,
293,
284,
6495,
85,
1649,
486,
931,
1428,
286,
2060,
10297,
64,
7030,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec3mask_not() {
assert_eq!((!Vec3AMask::new(false, false, false)).bitmask(), 0b111);
assert_eq!((!Vec3AMask::new(true, true, true)).bitmask(), 0b000);
assert_eq!((!Vec3AMask::new(true, false, true)).bitmask(), 0b010);
assert_eq!((!Vec3AMask::new(false, true, false)).bitmask(), 0b101);
} | rust_cleaned_test_functions.jsonl/23500 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
11258,
7913,
368,
341,
262,
2060,
10714,
0,
1188,
0,
10050,
18,
1402,
1073,
486,
931,
3576,
11,
895,
11,
895,
4579,
4489,
11258,
1507,
220,
15,
65,
16,
16,
16,
317,
262,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_runner() {
let cfg = Config::istanbul();
let compiled = COMPILED.find("GreeterTest").expect("could not find contract");
let vicinity = new_vicinity();
let backend = new_backend(&vicinity, Default::default());
let precompiles = PRECOMPILES_MAP.clone();
let evm = Executor::new(12_000_000, &cfg, &backend, &precompiles);
super::test_runner(evm, compiled);
} | rust_cleaned_test_functions.jsonl/71184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54828,
368,
341,
310,
1077,
13286,
284,
5532,
486,
8944,
16110,
543,
310,
1077,
19697,
284,
7682,
1893,
13639,
2658,
445,
64747,
1404,
2271,
1827,
17119,
445,
28077,
537,
1477,
5116,
797,
310,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_and_read_with_compression() -> Result<()> {
let mut write_df = df!(
"i64" => &[1, 2],
"f64" => &[0.1, 0.2],
"utf8" => &["a", "b"]
)?;
let compressions = vec![
None,
Some(write::Compression::Deflate),
Some(write::Compression::Snappy),
];
for compression in compressions.into_iter() {
let mut buf: Cursor<Vec<u8>> = Cursor::new(Vec::new());
AvroWriter::new(&mut buf)
.with_compression(compression)
.finish(&mut write_df)?;
buf.set_position(0);
let read_df = AvroReader::new(buf).finish()?;
assert!(write_df.frame_equal(&read_df));
}
Ok(())
} | rust_cleaned_test_functions.jsonl/23142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
8378,
6443,
6615,
2965,
4011,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
3270,
10894,
284,
6764,
33673,
310,
330,
72,
21,
19,
1,
589,
44590,
16,
11,
220,
17,
1259,
310,
330,
69,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_pathstep_from_parser() {
for data in TEST_PATH_STEP_BUFFER {
let hex = hex::decode(data).expect("");
let mut parser = BinaryParser::from(hex.clone());
let pathset = PathStep::from_parser(&mut parser, None).unwrap();
assert_eq!(pathset.as_ref(), hex);
}
} | rust_cleaned_test_functions.jsonl/77241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
9520,
5673,
18517,
368,
341,
286,
369,
821,
304,
13602,
7944,
39968,
14394,
341,
310,
1077,
12371,
284,
12371,
486,
18196,
2592,
568,
17119,
13056,
310,
1077,
5206,
6729,
284,
17718,
6570,
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... | 2 |
#[test]
fn test_ipv6_reassembly_not_needed() {
let mut ctx = DummyCtx::<Ipv6>::default();
let mut cache = IpPacketFragmentCache::<Ipv6>::default();
// Test that we panic if we call `fragment_data` on a packet that has no
// fragment data.
let builder = get_ipv6_builder();
let mut buffer =
Buf::new(vec![1, 2, 3, 4, 5], ..).encapsulate(builder).serialize_vec_outer().unwrap();
let packet = buffer.parse::<Ipv6Packet<_>>().unwrap();
assert_matches::assert_matches!(
cache.process_fragment::<_, &[u8]>(&mut ctx, packet),
FragmentProcessingState::InvalidFragment
);
} | rust_cleaned_test_functions.jsonl/52571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49378,
21,
1288,
14993,
7913,
57426,
368,
341,
286,
1077,
5206,
5635,
284,
50567,
23684,
27638,
80656,
21,
6831,
2258,
543,
286,
1077,
5206,
6500,
284,
35033,
16679,
9488,
8233,
27638,
80656,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_types_with_tokens_aliased_to_match_rules() {
let node_types = get_node_types(InputGrammar {
name: String::new(),
extra_symbols: Vec::new(),
external_tokens: Vec::new(),
expected_conflicts: Vec::new(),
variables_to_inline: Vec::new(),
word_token: None,
supertype_symbols: vec![],
variables: vec![
Variable {
name: "a".to_string(),
kind: VariableType::Named,
rule: Rule::seq(vec![Rule::named("b"), Rule::named("c")]),
},
Variable {
name: "b".to_string(),
kind: VariableType::Named,
rule: Rule::seq(vec![Rule::named("c"), Rule::string("B"), Rule::named("c")]),
},
Variable {
name: "c".to_string(),
kind: VariableType::Named,
rule: Rule::choice(vec![
Rule::string("C"),
// with no children.
Rule::alias(Rule::string("D"), "b".to_string(), true),
]),
},
],
});
assert_eq!(
node_types.iter().map(|n| &n.kind).collect::<Vec<_>>(),
&["a", "b", "c", "B", "C"]
);
assert_eq!(
node_types[1],
NodeInfoJSON {
kind: "b".to_string(),
named: true,
subtypes: None,
children: Some(FieldInfoJSON {
multiple: true,
required: false,
types: vec![NodeTypeJSON {
kind: "c".to_string(),
named: true,
}]
}),
fields: Some(BTreeMap::new()),
}
);
} | rust_cleaned_test_functions.jsonl/8325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
9763,
6615,
28838,
62,
7956,
1475,
2346,
10708,
21407,
368,
341,
286,
1077,
2436,
9763,
284,
633,
5084,
9763,
29773,
97178,
341,
310,
829,
25,
923,
486,
931,
3148,
310,
4960,
55752,
25,
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_scrambling_clear() {
let mut p = PacketInfo::null_packet();
p.set_scrambling(packet::SCRAMBLING_CLEAR);
assert_eq!(p.scrambling(), packet::SCRAMBLING_CLEAR);
} | rust_cleaned_test_functions.jsonl/47188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
2396,
9695,
21811,
368,
341,
286,
1077,
5206,
281,
284,
28889,
1731,
486,
2921,
21078,
543,
286,
281,
980,
13171,
2396,
9695,
37441,
486,
3540,
33905,
9389,
1718,
39280,
317,
286,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_paragraph_insert_json() {
let run = Run::new().add_text("Hello");
let ins = Insert::new(run);
let p = Paragraph::new().add_insert(ins);
assert_eq!(
serde_json::to_string(&p).unwrap(),
r#"{"id":"12345678","children":[{"type":"insert","data":{"children":[{"type":"run","data":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"vertAlign":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null,"spacing":null,"fonts":null,"textBorder":null,"del":null,"ins":null},"children":[{"type":"text","data":{"preserveSpace":true,"text":"Hello"}}]}}],"author":"unnamed","date":"1970-01-01T00:00:00Z"}}],"property":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"vertAlign":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null,"spacing":null,"fonts":null,"textBorder":null,"del":null,"ins":null},"style":null,"numberingProperty":null,"alignment":null,"indent":null,"lineHeight":null,"keepNext":false,"keepLines":false,"pageBreakBefore":false,"windowControl":false,"outlineLvl":null,"divId":null},"hasNumbering":false}"#
);
} | rust_cleaned_test_functions.jsonl/50380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96713,
17678,
9455,
368,
341,
286,
1077,
1598,
284,
6452,
486,
931,
1005,
718,
4326,
445,
9707,
797,
286,
1077,
1640,
284,
17101,
486,
931,
38772,
317,
286,
1077,
281,
284,
49351,
486,
931,
1005... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sosemanuk_ecrypt_set_2_vector_63() {
let key = "3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F".from_hex().unwrap();
let nonce = "00000000000000000000000000000000".from_hex().unwrap();
let input = [0u8; 64];
let expected_output_hex = "7D755F30A2B747A50D7D28147EDF0B3E3FAB6856A7373C7306C00D1D4076969354D7AB4343C0115E7839502C5C699ED06DB119968AEBFD08D8B968A7161D613F";
let expected_output = expected_output_hex.from_hex().unwrap();
let mut output = [0u8; 64];
let mut sosemanuk = Sosemanuk::new(key.as_ref(), nonce.as_ref());
sosemanuk.process(&input, &mut output);
let expected: &[u8] = expected_output.as_ref();
assert!(output.as_ref() == expected);
} | rust_cleaned_test_functions.jsonl/106133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
960,
1515,
3101,
36844,
3571,
2602,
62,
17,
12247,
62,
21,
18,
368,
341,
286,
1077,
1376,
284,
330,
18,
37,
18,
37,
18,
37,
18,
37,
18,
37,
18,
37,
18,
37,
18,
37,
18,
37,
18,
37,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quaternion() {
let quaternion = Quaternion::new(2f32, 3f32, 4f32, 5f32);
let matrix_short = Matrix4::from(quaternion);
let matrix_long = Matrix3::from(quaternion);
let matrix_long = Matrix4::from(matrix_long);
assert_ulps_eq!(matrix_short, matrix_long);
} | rust_cleaned_test_functions.jsonl/105492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
16351,
368,
341,
310,
1077,
66775,
284,
24801,
486,
931,
7,
17,
69,
18,
17,
11,
220,
18,
69,
18,
17,
11,
220,
19,
69,
18,
17,
11,
220,
20,
69,
18,
17,
626,
310,
1077,
6172,
16673,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_oneof() {
let msg = r#"message A
{
optional int32 a1 = 1;
oneof a_oneof {
string a2 = 2;
int32 a3 = 3;
bytes a4 = 4;
}
repeated bool a5 = 5;
}"#;
let mess = parse_opt(msg, |p| p.next_message_opt());
assert_eq!(1, mess.oneofs.len());
assert_eq!(3, mess.oneofs[0].fields.len());
} | rust_cleaned_test_functions.jsonl/70457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
1055,
368,
341,
286,
1077,
3750,
284,
435,
55543,
1994,
362,
198,
262,
341,
286,
10101,
526,
18,
17,
264,
16,
284,
220,
16,
280,
286,
825,
1055,
264,
11667,
1055,
341,
310,
914,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hashmap_backend_set_get() {
let interp = crate::interpreter().expect("init");
// given
let mut backend = Memory::new();
let env_name = "308a3d98-2f87-46fd-b996-ae471a76b64e";
let env_value = "value";
// when
backend
.put(&interp, env_name.as_bytes(), Some(env_value.as_bytes()))
.unwrap();
let value = backend.get(&interp, env_name.as_bytes());
// then
assert_eq!(
Some(env_value.as_bytes()),
value.unwrap().try_into::<Option<&[u8]>>().unwrap()
);
} | rust_cleaned_test_functions.jsonl/68938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
2186,
40011,
2602,
3062,
368,
341,
286,
1077,
47271,
284,
17717,
486,
90554,
1005,
17119,
445,
2327,
797,
286,
442,
2661,
198,
286,
1077,
5206,
19163,
284,
13850,
486,
931,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_instructions() {
let context = Context::create();
let module = context.create_module("testing");
let builder = context.create_builder();
let void_type = context.void_type();
let i64_type = context.i64_type();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let fn_type = void_type.fn_type(&[f32_ptr_type.into(), f32_type.into()], false);
let function = module.add_function("free_f32", fn_type, None);
let basic_block = context.append_basic_block(&function, "entry");
builder.position_at_end(&basic_block);
let arg1 = function.get_first_param().unwrap().into_pointer_value();
let arg2 = function.get_nth_param(1).unwrap().into_float_value();
assert!(arg1.get_first_use().is_none());
assert!(arg2.get_first_use().is_none());
let f32_val = f32_type.const_float(::std::f64::consts::PI);
let store_instruction = builder.build_store(arg1, f32_val);
let ptr_val = builder.build_ptr_to_int(arg1, i64_type, "ptr_val");
let ptr = builder.build_int_to_ptr(ptr_val, f32_ptr_type, "ptr");
let icmp = builder.build_int_compare(IntPredicate::EQ, ptr_val, ptr_val, "icmp");
let f32_sum = builder.build_float_add(arg2, f32_val, "f32_sum");
let fcmp = builder.build_float_compare(FloatPredicate::OEQ, f32_sum, arg2, "fcmp");
let free_instruction = builder.build_free(arg1);
let return_instruction = builder.build_return(None);
assert_eq!(store_instruction.get_opcode(), Store);
assert_eq!(ptr_val.as_instruction().unwrap().get_opcode(), PtrToInt);
assert_eq!(ptr.as_instruction().unwrap().get_opcode(), IntToPtr);
assert_eq!(icmp.as_instruction().unwrap().get_opcode(), ICmp);
assert_eq!(ptr.as_instruction().unwrap().get_icmp_predicate(), None);
assert_eq!(icmp.as_instruction().unwrap().get_icmp_predicate().unwrap(), IntPredicate::EQ);
assert_eq!(f32_sum.as_instruction().unwrap().get_opcode(), FAdd);
assert_eq!(fcmp.as_instruction().unwrap().get_opcode(), FCmp);
assert_eq!(f32_sum.as_instruction().unwrap().get_fcmp_predicate(), None);
assert_eq!(icmp.as_instruction().unwrap().get_fcmp_predicate(), None);
assert_eq!(fcmp.as_instruction().unwrap().get_fcmp_predicate().unwrap(), FloatPredicate::OEQ);
assert_eq!(free_instruction.get_opcode(), Call);
assert_eq!(return_instruction.get_opcode(), Return);
// test instruction cloning
let instruction_clone = return_instruction.clone();
assert_eq!(instruction_clone.get_opcode(), return_instruction.get_opcode());
assert_ne!(instruction_clone, return_instruction);
// test copying
let instruction_clone_copy = instruction_clone;
assert_eq!(instruction_clone, instruction_clone_copy);
} | rust_cleaned_test_functions.jsonl/92682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1074
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82427,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
8840,
797,
262,
1077,
7363,
284,
2266,
2520,
28532,
1428,
262,
1077,
737,
1819,
284,
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_to_timespec() {
let _reset = set_time_zone();
let time = Timespec::new(1234567890, 54321);
let utc = at_utc(time);
assert_eq!(utc.to_timespec(), time);
assert_eq!(utc.to_local().to_timespec(), time);
} | rust_cleaned_test_functions.jsonl/7339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
22353,
992,
368,
341,
286,
1077,
716,
9716,
284,
738,
3009,
28692,
1428,
286,
1077,
882,
284,
8523,
992,
486,
931,
7,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
11,
220,
20,
19,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_root_path() {
assert!(Path::new("a\\b\\c").root_path() == None);
assert!(Path::new("\\a\\b\\c").root_path() == Some(Path::new("\\")));
assert!(Path::new("C:a").root_path() == Some(Path::new("C:")));
assert!(Path::new("C:\\a").root_path() == Some(Path::new("C:\\")));
assert!(Path::new("\\\\a\\b\\c").root_path() == Some(Path::new("\\\\a\\b")));
assert!(Path::new("\\\\?\\a\\b").root_path() == Some(Path::new("\\\\?\\a")));
assert!(Path::new("\\\\?\\C:\\a").root_path() == Some(Path::new("\\\\?\\C:\\")));
assert!(Path::new("\\\\?\\UNC\\a\\b\\c").root_path() ==
Some(Path::new("\\\\?\\UNC\\a\\b")));
assert!(Path::new("\\\\.\\a\\b").root_path() == Some(Path::new("\\\\.\\a")));
} | rust_cleaned_test_functions.jsonl/102772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12993,
2638,
368,
341,
286,
2060,
10297,
1820,
486,
931,
445,
64,
3422,
65,
3422,
66,
1827,
2888,
2638,
368,
621,
2240,
317,
286,
2060,
10297,
1820,
486,
931,
29710,
64,
3422,
65,
3422,
66,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_include_numbers() {
check_word_count(
"testing, 1, 2 testing",
vec![("testing", 2),
("1", 1),
("2", 1)]);
} | rust_cleaned_test_functions.jsonl/109971 | {
"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,
37878,
32964,
368,
341,
262,
1779,
13533,
3180,
1006,
286,
330,
8840,
11,
220,
16,
11,
220,
17,
7497,
756,
286,
7486,
20703,
445,
8840,
497,
220,
17,
1326,
1797,
3489,
16,
497,
220,
16,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sublist_at_start() {
assert_eq!(Comparison::Sublist, sublist(&[1, 2, 3], &[1, 2, 3, 4, 5]));
} | rust_cleaned_test_functions.jsonl/68277 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 62
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
1607,
3752,
4906,
368,
341,
262,
2060,
10714,
10297,
33487,
486,
3136,
1607,
11,
93893,
2099,
58,
16,
11,
220,
17,
11,
220,
18,
1125,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_chunked_te() {
let bytes = BytesMut::new();
let mut enc = TransferEncoding::chunked(bytes);
{
assert!(!enc.encode(b"test").ok().unwrap());
assert!(enc.encode(b"").ok().unwrap());
}
assert_eq!(
enc.buf_mut().take().freeze(),
Bytes::from_static(b"4\r\ntest\r\n0\r\n\r\n")
);
} | rust_cleaned_test_functions.jsonl/96802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30539,
291,
38678,
368,
341,
286,
1077,
5820,
284,
30024,
51440,
486,
931,
543,
286,
1077,
5206,
3209,
284,
23200,
14690,
486,
25979,
291,
23158,
317,
286,
341,
310,
2060,
0,
3471,
954,
17313,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stake_create_and_split_single_signature() {
panoptes_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair: staker_keypair,
..
} = create_genesis_config_with_leader(
100_000_000_000,
&panoptes_sdk::pubkey::new_rand(),
1_000_000,
);
let staker_pubkey = staker_keypair.pubkey();
let bank_client = BankClient::new_shared(&Arc::new(Bank::new(&genesis_config)));
let stake_address =
Pubkey::create_with_seed(&staker_pubkey, "stake", &stake::program::id()).unwrap();
let authorized = Authorized::auto(&staker_pubkey);
let lamports = 1_000_000;
// Create stake account with seed
let message = Message::new(
&stake_instruction::create_account_with_seed(
&staker_pubkey, // from
&stake_address, // to
&staker_pubkey, // base
"stake", // seed
&authorized,
&Lockup::default(),
lamports,
),
Some(&staker_pubkey),
);
// only one signature required
bank_client
.send_and_confirm_message(&[&staker_keypair], message)
.expect("failed to create and delegate stake account");
// split the stake
let split_stake_address =
Pubkey::create_with_seed(&staker_pubkey, "split_stake", &stake::program::id()).unwrap();
// Test split
let message = Message::new(
&stake_instruction::split_with_seed(
&stake_address, // original
&staker_pubkey, // authorized
lamports / 2,
&split_stake_address, // new address
&staker_pubkey, // base
"split_stake", // seed
),
Some(&staker_keypair.pubkey()),
);
assert!(bank_client
.send_and_confirm_message(&[&staker_keypair], message)
.is_ok());
// w00t!
} | rust_cleaned_test_functions.jsonl/41422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 900
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
8657,
8378,
17052,
19487,
39859,
368,
341,
262,
7215,
2912,
288,
27413,
486,
15188,
1428,
262,
1077,
40788,
2648,
1731,
341,
286,
59366,
5332,
345,
286,
28337,
3097,
12670,
25,
357,
440... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_finalize() {
let proposals = vec![
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 1]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 2]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 3]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 4]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 5]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 6]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 7]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 8]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 9]),
ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 10]),
];
let window = ProposalWindow(2, 10);
let mut table = ProposalTable::new(window);
for (idx, id) in proposals.iter().skip(1).enumerate() {
let mut ids = HashSet::new();
ids.insert(id.clone());
table.insert((idx + 1) as u64, ids.clone());
}
let (removed_ids, mut view) = table.finalize(&ProposalView::default(), 1);
assert!(removed_ids.is_empty());
assert!(view.set().is_empty());
assert_eq!(view.gap(), &iter::once(proposals[1].clone()).collect());
// in window
for i in 2..=10usize {
let (removed_ids, new_view) = table.finalize(&view, i as u64);
let c = i + 1;
assert_eq!(
new_view.gap(),
&proposals[(c - 2 + 1)..=i].iter().cloned().collect()
);
let s = ::std::cmp::max(1, c.saturating_sub(10));
assert_eq!(
new_view.set(),
&proposals[s..=(c - 2)].iter().cloned().collect()
);
assert!(removed_ids.is_empty());
view = new_view;
}
// finalize 11
let (removed_ids, new_view) = table.finalize(&view, 11);
assert_eq!(removed_ids, iter::once(proposals[1].clone()).collect());
assert_eq!(new_view.set(), &proposals[2..=10].iter().cloned().collect());
assert!(new_view.gap().is_empty());
view = new_view;
// finalize 12
let (removed_ids, new_view) = table.finalize(&view, 12);
assert_eq!(removed_ids, iter::once(proposals[2].clone()).collect());
assert_eq!(new_view.set(), &proposals[3..=10].iter().cloned().collect());
assert!(new_view.gap().is_empty());
} | rust_cleaned_test_functions.jsonl/17683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70616,
368,
341,
262,
1077,
24258,
284,
7486,
90515,
286,
65890,
12472,
764,
486,
931,
2561,
15,
84,
23,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_extract_summary_description() {
#[derive(Schema)]
struct JavadocComments;
assert_eq!(
extract_doc_from_attrs(&JavadocComments::schema().attrs),
(
Some("Javadoc summary".to_string()),
Some(
"Maybe there's another name for these... ... but Java \
is the first place I saw these types of comments."
.to_string()
)
)
);
/**
* Javadoc summary
*
* Skip that blank.
*/
#[derive(Schema)]
struct JavadocCommentsWithABlank;
assert_eq!(
extract_doc_from_attrs(&JavadocCommentsWithABlank::schema().attrs),
(
Some("Javadoc summary".to_string()),
Some("Skip that blank.".to_string())
)
);
/** Terse Javadoc summary */
#[derive(Schema)]
struct JavadocCommentsTerse;
assert_eq!(
extract_doc_from_attrs(&JavadocCommentsTerse::schema().attrs),
(Some("Terse Javadoc summary".to_string()), None)
);
/// Rustdoc summary
/// Did other folks do this or what this an invention I can right-
/// fully ascribe to Rust?
#[derive(Schema)]
struct RustdocComments;
assert_eq!(
extract_doc_from_attrs(&RustdocComments::schema().attrs),
(
Some("Rustdoc summary".to_string()),
Some(
"Did other folks do this or what this an invention \
I can right-fully ascribe to Rust?"
.to_string()
)
)
);
/// Rustdoc summary
/// Skip that blank.
#[derive(Schema)]
struct RustdocCommentsWithABlank;
assert_eq!(
extract_doc_from_attrs(&RustdocCommentsWithABlank::schema().attrs),
(
Some("Rustdoc summary".to_string()),
Some("Skip that blank.".to_string())
)
);
/// Just a Rustdoc summary
#[derive(Schema)]
struct JustTheRustdocSummary;
assert_eq!(
extract_doc_from_attrs(&JustTheRustdocSummary::schema().attrs),
(Some("Just a Rustdoc summary".to_string()), None)
);
/**
* Just a Javadoc summary
*/
#[derive(Schema)]
struct JustTheJavadocSummary;
assert_eq!(
extract_doc_from_attrs(&JustTheJavadocSummary::schema().attrs),
(Some("Just a Javadoc summary".to_string()), None)
);
/// Summary
/// Text
/// More
/// Even
/// More
#[derive(Schema)]
struct SummaryDescriptionBreak;
assert_eq!(
extract_doc_from_attrs(&SummaryDescriptionBreak::schema().attrs),
(
Some("Summary".to_string()),
Some("Text More\nEven More".to_string())
)
);
} | rust_cleaned_test_functions.jsonl/39862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1686
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
27251,
11448,
368,
341,
1789,
286,
11506,
27098,
3759,
3416,
5563,
286,
2036,
619,
43425,
17373,
280,
286,
2060,
10714,
33673,
310,
8649,
18869,
5673,
39578,
2099,
41,
43425,
17373,
486,
1734... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bin_state_2d() {
assert_eq!(bin_state(&[0.0, 0.0], 16), vec![0, 0]);
assert_eq!(bin_state(&[0.99, 0.99], 16), vec![15, 15]);
assert_eq!(bin_state(&[1.0, 1.0], 16), vec![16, 16]);
assert_eq!(bin_state(&[0.0, 1.0], 16), vec![0, 16]);
assert_eq!(bin_state(&[-1.0, -1.0], 16), vec![-16, -16]);
assert_eq!(bin_state(&[0.0, 0.5], 16), vec![0, 8]);
assert_eq!(bin_state(&[0.5, 0.0], 16), vec![8, 0]);
assert_eq!(bin_state(&[0.5, 0.5], 16), vec![8, 8]);
} | rust_cleaned_test_functions.jsonl/57609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21816,
4387,
62,
17,
67,
368,
341,
286,
2060,
10714,
10297,
6863,
4387,
2099,
58,
15,
13,
15,
11,
220,
15,
13,
15,
1125,
220,
16,
21,
701,
7486,
20703,
15,
11,
220,
15,
2558,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sms_new_compressed() {
let mut sms = new_sms(
01239468786,
01239468999,
"The quick brown fox jumps over the lazy dog",
true,
)
.unwrap();
let bin_bundle = sms.to_cbor();
dbg!(bin_bundle.len());
dbg!(bp7::hexify(&bin_bundle));
assert_eq!(
dbg!(sms.msg()),
"The quick brown fox jumps over the lazy dog"
);
assert_eq!(dbg!(sms.src().unwrap()), "1239468786"); // leading zeros are stripped
assert_eq!(dbg!(sms.dst().unwrap()), "1239468999");
dbg!(sms.creation_timestamp());
} | rust_cleaned_test_functions.jsonl/14791 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58567,
5921,
2965,
14318,
368,
341,
286,
1077,
5206,
37929,
284,
501,
58567,
1006,
310,
220,
15,
16,
17,
18,
24,
19,
21,
23,
22,
23,
21,
345,
310,
220,
15,
16,
17,
18,
24,
19,
21,
23,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_ldrw_imm() {
assert_eq!(
decode_32(0xf8501b04),
Instruction::LDR_imm {
params: Reg2FullParams {
rt: Reg::R1,
rn: Reg::R0,
imm32: 0x4,
index: false,
add: true,
wback: true,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
31768,
71370,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
5848,
23,
20,
15,
16,
65,
15,
19,
1326,
286,
29051,
486,
43,
7687,
71370,
341,
310,
3628,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_smalls() {
let smalls_prime_chart:Vec<bool> = vec![false, true, true, false, true, false, true, false, false, false, true, false, true, false, false, false, true, false, true, false, false, false, true, false, false, false, false, false, true, false, true, false, false, false, false, false, true, false, false, false, true, false, true, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, true, false, true, false, false, false, false, false, true, false, false, false, true, false, true, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false];
for checking in 1..((smalls_prime_chart.len())+1) {
let divisor = finds_if_number_is_prime(checking.try_into().unwrap());
let mut primeiness = false;
if divisor != 1 {
primeiness = false;
}
else {
primeiness = true;
}
println!("{}", checking);
assert_eq!(smalls_prime_chart[(checking - 1)], primeiness);
}
} | rust_cleaned_test_functions.jsonl/4940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15874,
5583,
368,
341,
286,
1077,
2613,
82,
38217,
40961,
25,
10050,
17028,
29,
284,
7486,
20703,
3849,
11,
830,
11,
830,
11,
895,
11,
830,
11,
895,
11,
830,
11,
895,
11,
895,
11,
895,
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_parse_translate() {
let translate = match parse_translate(FileSpan::new(Rc::new(String::from("Translate 4 5.5 1.0")), Rc::new(String::from("input")))).unwrap().1 {
Transformation::Translate(t) => t,
_ => panic!()
};
assert_eq!(translate.x.value, 4.0);
assert_eq!(translate.y.value, 5.5);
assert_eq!(translate.z.value, 1.0);
} | rust_cleaned_test_functions.jsonl/68348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
66381,
368,
341,
262,
1077,
14683,
284,
2432,
4715,
66381,
19821,
12485,
486,
931,
2785,
66,
486,
931,
2242,
486,
1499,
445,
27473,
220,
19,
220,
20,
13,
20,
220,
16,
13,
15,
35674,
814... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_publish_to_drops_new_message_when_queue_count_limit_reached() {
let client_id = ClientId::from("id1");
let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
let client_info = ClientInfo::new(client_id, socket, AuthId::from("authId1"));
let max_inflight = 2;
let max_queued = 2;
let topic = "topic/new";
let config = SessionConfig::new(
Duration::default(),
Duration::default(),
None,
max_inflight,
max_queued,
None,
QueueFullAction::DropNew,
);
let mut session = SessionState::new(client_info, config);
subscribe_to(topic, &mut session);
let publication = new_publication(topic, "payload");
assert_matches!(session.publish_to(publication.clone()), Ok(Some(_)));
assert_matches!(session.publish_to(publication.clone()), Ok(Some(_)));
assert_matches!(session.publish_to(publication.clone()), Ok(None));
assert_matches!(session.publish_to(publication), Ok(None));
let publication = new_publication(topic, "last message");
assert_matches!(session.publish_to(publication), Ok(None));
assert_eq!(session.waiting_to_be_acked.len(), 2);
assert_eq!(session.waiting_to_be_sent.len(), 2);
assert_matches!(
session
.waiting_to_be_sent
.iter()
.find(|p| p.payload == *"last message"),
None
);
} | rust_cleaned_test_functions.jsonl/65519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 748
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58779,
2346,
814,
3702,
5921,
6462,
47636,
10841,
3180,
14763,
1288,
3854,
368,
341,
286,
1077,
2943,
842,
284,
8423,
764,
486,
1499,
445,
307,
16,
797,
286,
1077,
7575,
284,
20954,
13986,
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_dlt_zero_terminated_string_less_data() {
let mut buf = BytesMut::with_capacity(4);
buf.extend_from_slice(b"id\0");
assert!(match dlt_zero_terminated_string(&buf, 4) {
Err(nom::Err::Incomplete(nom::Needed::Size(_))) => true,
_ => false,
});
buf.clear();
buf.extend_from_slice(b"id\0\0");
let expected: IResult<&[u8], &str> = Ok((b"", "id"));
assert_eq!(expected, dlt_zero_terminated_string(&buf, 4));
} | rust_cleaned_test_functions.jsonl/73194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
4832,
19359,
62,
68659,
3904,
50747,
1769,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
4197,
35603,
7,
19,
317,
286,
6607,
15831,
5673,
26488,
1883,
28700,
59,
15,
797,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_hook_transfer_from_emit_no_event() {
let mut service = TestService::new();
let recipient = Address::from_hex("0x666cdba6ae4f479f7164792b318b2a06c759833b").unwrap();
let ctx = {
let params = ServiceContextParams {
tx_hash: None,
nonce: None,
cycles_limit: CYCLE_LIMIT,
cycles_price: 1,
cycles_used: Rc::new(RefCell::new(0)),
caller: recipient.clone(),
height: 1,
timestamp: 0,
service_name: "service_name".to_owned(),
service_method: "service_method".to_owned(),
service_payload: "service_payload".to_owned(),
extra: Some(Bytes::from_static(b"governance")),
events: Rc::new(RefCell::new(vec![])),
};
ServiceContext::new(params)
};
let admin = TestService::admin();
service.hook_transfer_from(ctx.clone(), HookTransferFromPayload {
sender: admin.clone(),
recipient: recipient.clone(),
value: 24,
memo: "test".to_owned(),
});
assert_eq!(ctx.get_events().len(), 0);
let sender_balance = service_call!(service, get_balance, ctx.clone(), GetBalancePayload {
asset_id: TestService::genesis().id,
user: admin,
});
assert_eq!(sender_balance.balance, TestService::genesis().supply - 24);
let recipient_balance = service_call!(service, get_balance, ctx, GetBalancePayload {
asset_id: TestService::genesis().id,
user: recipient,
});
assert_eq!(recipient_balance.balance, 24);
} | rust_cleaned_test_functions.jsonl/32955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 815
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32005,
35403,
5673,
69082,
6536,
6748,
368,
341,
262,
1077,
5206,
2473,
284,
3393,
1860,
486,
931,
543,
262,
1077,
21713,
284,
9177,
486,
1499,
32655,
445,
15,
87,
21,
21,
21,
85301,
64,
21,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_bab_from_aba() {
let mut test_set = HashSet::new();
let mut babs = HashSet::new();
get_bab_from_aba("", &mut babs);
assert_eq!(test_set, babs);
get_bab_from_aba("zazbz", &mut babs);
test_set.insert("aza".to_string());
test_set.insert("bzb".to_string());
assert_eq!(test_set, babs);
} | rust_cleaned_test_functions.jsonl/1071 | {
"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,
3062,
880,
370,
5673,
62,
12004,
368,
341,
262,
1077,
5206,
1273,
2602,
284,
18931,
486,
931,
543,
262,
1077,
5206,
293,
3435,
284,
18931,
486,
931,
543,
262,
633,
880,
370,
5673,
62,
12004,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_file_path_from_git_file_meta_line() {
assert_eq!(
parse_file_meta_line("--- /dev/null", true, None),
("/dev/null".to_string(), FileEvent::Change)
);
for prefix in &DIFF_PREFIXES {
assert_eq!(
parse_file_meta_line(&format!("--- {}src/delta.rs", prefix), true, None),
("src/delta.rs".to_string(), FileEvent::Change)
);
}
assert_eq!(
parse_file_meta_line("--- src/delta.rs", true, None),
("src/delta.rs".to_string(), FileEvent::Change)
);
assert_eq!(
parse_file_meta_line("+++ src/delta.rs", true, None),
("src/delta.rs".to_string(), FileEvent::Change)
);
} | rust_cleaned_test_functions.jsonl/108155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2458,
2638,
5673,
68801,
2458,
13381,
6528,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
2458,
13381,
6528,
74083,
608,
3583,
19293,
497,
830,
11,
2240,
1326,
310,
88889,
3583,
19293,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_text_escaped_curly_braces() {
let mut ps = ParseStream::new("\\{{ text }}".to_string());
let parts = ps.parse_text().unwrap();
assert_eq!(ps.cursor, 11);
assert_eq!(parts.len(), 2);
assert!(if let Some(StringPart::Normal(s)) = parts.get(0) {
s == "\\{{"
} else {
false
});
assert!(if let Some(StringPart::Normal(s)) = parts.get(1) {
s == " text }}"
} else {
false
});
} | rust_cleaned_test_functions.jsonl/41141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4326,
62,
65826,
18956,
398,
17682,
2434,
368,
341,
286,
1077,
5206,
4726,
284,
14775,
3027,
486,
931,
29710,
2979,
1467,
3869,
3263,
983,
3904,
5231,
286,
1077,
5479,
284,
4726,
4632,
4326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_default_clears() {
#[deriving(Default)]
struct Foo {
b: int,
}
impl Clear for Foo {
fn clear(&mut self) {
self.b = 0;
}
}
let mut x = SingularField::some(Foo { b: 10 });
x.clear();
x.set_default();
assert_eq!(0, x.as_ref().unwrap().b);
x.as_mut().unwrap().b = 11;
// without clear
x.set_default();
assert_eq!(0, x.as_ref().unwrap().b);
} | rust_cleaned_test_functions.jsonl/36380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
9993,
21811,
82,
368,
341,
286,
11506,
1107,
2249,
87874,
5563,
286,
2036,
33428,
341,
310,
293,
25,
526,
345,
286,
555,
286,
11605,
12023,
369,
33428,
341,
310,
5168,
2797,
2099,
6984,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alloc_table_storage_with_one_table() {
#[derive(Default, Serialize, Deserialize)]
struct Person {
trusted: bool,
}
impl Record for Person {}
let mut db = Db::default();
db.create_table::<Person>();
assert!(db.table_info.len() == 1);
assert!(db.table_info[0].range == Range::<u32> { start: 2, end: 2 });
let r = db.alloc_table_storage(get_table_signature(std::any::type_name::<Person>()), 1);
assert!(r.unwrap() == Range::<u32> { start: 2, end: 3 });
assert!(db.table_info[0].range == Range::<u32> { start: 2, end: 3 });
} | rust_cleaned_test_functions.jsonl/74450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14802,
5237,
23310,
6615,
11667,
5237,
368,
341,
286,
11506,
27098,
87874,
11,
39900,
11,
48440,
5563,
286,
2036,
7357,
341,
310,
21789,
25,
1807,
345,
286,
456,
286,
11605,
13583,
369,
7357,
1008... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_location_to_spans() {
let src = r#"fn foo() {
let mut x: i32 = 1;
let y = x + 2;
let w = if true {
let z = 0;
z
} else {
3
};
let z = &mut x;
*z = 4;
let q = x
.leading_ones()
.trailing_zeros();
}"#;
let (input, _ranges) = test_utils::parse_ranges(src, [("`(", ")`")]).unwrap();
test_utils::compile_body(input, move |tcx, body_id, body_with_facts| {
let location_domain = LocationDomain::new(&body_with_facts.body);
let source_map = tcx.sess.source_map();
let spanner = Spanner::new(tcx, body_id, &body_with_facts.body);
let pairs: &[(_, &[&str])] = &[
// Variable assignment
((0, 0), &["let mut x: i32 = ", "1", ";"]),
// Expression RHS
((0, 3), &["let y = ", "x", ";"]),
((0, 4), &["let y = ", " + ", "x + 2", ";"]),
// If expression
((1, 2), &["let w = ", "true", ";"]),
((1, 3), &[
"let w = ",
"if ",
"true",
" {\n ",
"\n ",
"\n } else {\n ",
"\n }",
";",
]),
// Reference
((4, 1), &["let z = ", "&mut ", "&mut x", ";"]),
// Reference assignment
((4, 3), &[" = ", ";", "*z = 4"]),
// Method chain
((4, 4), &["let q = ", "x", ";"]),
((4, 5), &[
"let q = ",
"x\n .leading_ones()",
"\n .leading_ones()",
";",
]),
((5, 0), &[
"let q = ",
"x\n .leading_ones()\n .trailing_zeros()",
"\n .trailing_zeros()",
";",
]),
];
for ((i, j), outp) in pairs {
let loc = mir::Location {
block: BasicBlock::from_usize(*i),
statement_index: *j,
};
let spans =
spanner.location_to_spans(loc, &location_domain, EnclosingHirSpans::OuterOnly);
let desired = outp.iter().collect::<HashSet<_>>();
let actual = spans
.into_iter()
.map(|s| source_map.span_to_snippet(s).unwrap())
.collect::<HashSet<_>>();
compare_sets(&desired, &actual);
}
});
} | rust_cleaned_test_functions.jsonl/10107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13126,
2346,
10123,
596,
368,
341,
262,
1077,
2286,
284,
435,
55543,
8822,
15229,
368,
341,
220,
1077,
5206,
856,
25,
600,
18,
17,
284,
220,
16,
280,
220,
1077,
379,
284,
856,
488,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_vmm_seccomp() {
// Tests the behavior of a customized seccomp filter on the VMM.
let pid = unsafe { libc::fork() };
match pid {
0 => {
let boot_source_cfg: BootSourceConfig =
MockBootSourceConfig::new().with_default_boot_args().into();
let resources: VmResources = MockVmResources::new()
.with_boot_source(boot_source_cfg)
.into();
let mut event_manager = EventManager::new().unwrap();
// The customer "forgot" to whitelist the KVM_RUN ioctl.
let filter: BpfProgram = MockSeccomp::new().without_kvm_run().into();
let vmm = build_microvm_for_boot(&resources, &mut event_manager, &filter).unwrap();
// Give the vCPUs a chance to attempt KVM_RUN.
thread::sleep(Duration::from_millis(200));
// Should never get here.
vmm.lock().unwrap().stop(-1);
}
vmm_pid => {
// Parent process: wait for the vmm to exit.
let mut vmm_status: i32 = -1;
let pid_done = unsafe { libc::waitpid(vmm_pid, &mut vmm_status, 0) };
assert_eq!(pid_done, vmm_pid);
restore_stdin();
// The seccomp fault should have caused death by SIGSYS.
assert!(unsafe { libc::WIFSIGNALED(vmm_status) });
assert_eq!(unsafe { libc::WTERMSIG(vmm_status) }, libc::SIGSYS);
}
}
} | rust_cleaned_test_functions.jsonl/132808 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
3821,
3453,
638,
14435,
368,
341,
262,
442,
20150,
279,
7709,
315,
264,
31689,
511,
638,
14435,
4051,
389,
279,
647,
8035,
624,
262,
1077,
14814,
284,
19860,
314,
42142,
486,
44738,
368,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_compaction_guard() {
// Test comopaction guard disabled.
{
let config = DefaultCfConfig {
target_file_size_base: ReadableSize::mb(16),
enable_compaction_guard: false,
..Default::default()
};
let provider = Some(MockRegionInfoProvider::new(vec![]));
let cf_opts = build_cf_opt!(config, CF_DEFAULT, None /*cache*/, provider);
assert_eq!(
config.target_file_size_base.0,
cf_opts.get_target_file_size_base()
);
}
// Test compaction guard enabled but region info provider is missing.
{
let config = DefaultCfConfig {
target_file_size_base: ReadableSize::mb(16),
enable_compaction_guard: true,
..Default::default()
};
let provider: Option<MockRegionInfoProvider> = None;
let cf_opts = build_cf_opt!(config, CF_DEFAULT, None /*cache*/, provider);
assert_eq!(
config.target_file_size_base.0,
cf_opts.get_target_file_size_base()
);
}
// Test compaction guard enabled.
{
let config = DefaultCfConfig {
target_file_size_base: ReadableSize::mb(16),
enable_compaction_guard: true,
compaction_guard_min_output_file_size: ReadableSize::mb(4),
compaction_guard_max_output_file_size: ReadableSize::mb(64),
..Default::default()
};
let provider = Some(MockRegionInfoProvider::new(vec![]));
let cf_opts = build_cf_opt!(config, CF_DEFAULT, None /*cache*/, provider);
assert_eq!(
config.compaction_guard_max_output_file_size.0,
cf_opts.get_target_file_size_base()
);
}
} | rust_cleaned_test_functions.jsonl/2166 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1013
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
1311,
36796,
368,
341,
286,
442,
3393,
469,
453,
1311,
7616,
8386,
624,
286,
341,
310,
1077,
2193,
284,
7899,
34,
69,
2648,
341,
394,
2169,
2458,
2368,
7651,
25,
4457,
480,
1695,
486,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parent_node() {
let node = div();
let child = div();
node.append_child(&child);
assert!(node.parent_node().is_none());
assert_eq!(child.parent_node().unwrap().as_ref(), node.as_ref());
} | rust_cleaned_test_functions.jsonl/33754 | {
"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,
15960,
5084,
368,
341,
286,
1077,
2436,
284,
3429,
543,
286,
1077,
1682,
284,
3429,
543,
286,
2436,
2057,
17268,
2099,
3048,
317,
286,
2060,
10297,
3509,
8659,
5084,
1005,
285,
31488,
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 |
#[test]
fn test_multiple_params_should_concatenate_query_string_values_correctly() {
let params = TopGamesParams::new()
.with_offset(5)
.with_limit(10);
assert_eq!(params.into_query_string(), "?offset=5&limit=10");
} | rust_cleaned_test_functions.jsonl/53703 | {
"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,
45233,
6745,
43378,
57478,
31123,
5738,
3904,
9146,
31550,
398,
368,
341,
286,
1077,
3628,
284,
6909,
35807,
4870,
486,
931,
741,
394,
659,
4197,
6917,
7,
20,
340,
394,
659,
4197,
14763,
7,
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_swma() {
let candles = RandomCandles::default();
let src: Vec<ValueType> = candles.take(100).map(|x| x.close).collect();
let weights: Vec<Vec<ValueType>> = vec![
vec![1.0],
vec![1.0, 1.0],
vec![1.0, 2.0, 1.0],
vec![1.0, 2.0, 2.0, 1.0],
vec![1.0, 2.0, 3.0, 2.0, 1.0],
vec![1.0, 2.0, 3.0, 3.0, 2.0, 1.0],
vec![1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0],
vec![1.0, 2.0, 3.0, 4.0, 4.0, 3.0, 2.0, 1.0],
vec![1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 3.0, 2.0, 1.0],
vec![1.0, 2.0, 3.0, 4.0, 5.0, 5.0, 4.0, 3.0, 2.0, 1.0],
vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0],
vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0],
vec![
1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0,
],
];
weights.iter().for_each(|weights| {
let wsum: ValueType = weights.iter().sum();
let length = weights.len();
let mut ma = TestingMethod::new(length as PeriodType, src[0]).unwrap();
let mut conv = Conv::new(weights.clone(), src[0]).unwrap();
src.iter().enumerate().for_each(|(i, &x)| {
let wcv = weights
.iter()
.enumerate()
.fold(0.0, |sum, (j, &w)| sum + w * src[i.saturating_sub(j)]);
let value = ma.next(x);
let value2 = wcv / wsum;
let value3 = conv.next(x);
assert!(
(value2 - value).abs() < SIGMA,
"Got {}, should {} at {} with length {}",
value2,
value,
i,
length
);
assert!((value3 - value).abs() < SIGMA);
});
});
} | rust_cleaned_test_functions.jsonl/122821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 887
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32581,
1728,
368,
341,
197,
10217,
51205,
284,
10612,
34,
20125,
486,
2258,
1428,
197,
10217,
2286,
25,
11312,
48325,
929,
29,
284,
51205,
40161,
7,
16,
15,
15,
568,
2186,
22428,
87,
91,
856,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_current_directory() {
assert_diff_paths(".", "foo", Some("../."));
assert_diff_paths("foo", ".", Some("foo"));
assert_diff_paths("/foo", "/.", Some("foo"));
} | rust_cleaned_test_functions.jsonl/89905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11080,
14846,
368,
341,
286,
2060,
15850,
24152,
64217,
330,
7975,
497,
4329,
17409,
54136,
286,
2060,
15850,
24152,
445,
7975,
497,
68514,
4329,
445,
7975,
4010,
286,
2060,
15850,
24152,
4283,
7975... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_client_reset_control_stream() {
let (mut client, mut server) = connect();
server
.conn
.stream_reset_send(server.control_stream_id.unwrap(), Error::HttpNoError.code())
.unwrap();
let out = server.conn.process(None, now());
client.process(out.dgram(), now());
assert_closed(&client, &Error::HttpClosedCriticalStream);
} | rust_cleaned_test_functions.jsonl/101873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
18983,
13436,
12673,
368,
341,
286,
1077,
320,
6984,
2943,
11,
5206,
3538,
8,
284,
4564,
543,
286,
3538,
198,
310,
659,
5148,
198,
310,
659,
4027,
18983,
13565,
21421,
16406,
12673,
842,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_set_from_usizes() {
let usizes = vec![0, 2, 2, 3];
let a: BitSet = usizes.into_iter().collect();
let mut b = BitSet::new();
b.insert(0);
b.insert(2);
b.insert(3);
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/76221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
2602,
5673,
11306,
4756,
368,
341,
286,
1077,
601,
4756,
284,
7486,
20703,
15,
11,
220,
17,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
264,
25,
57227,
284,
601,
4756,
39860,
11723,
1005,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_slot_propagated_threshold_from_votes() {
let keypairs: HashMap<_, _> = iter::repeat_with(|| {
let vote_keypairs = ValidatorVoteKeypairs::new_rand();
(vote_keypairs.node_keypair.pubkey(), vote_keypairs)
})
.take(10)
.collect();
let new_vote_pubkeys: Vec<_> = keypairs
.values()
.map(|keys| keys.vote_keypair.pubkey())
.collect();
let new_node_pubkeys: Vec<_> = keypairs
.values()
.map(|keys| keys.node_keypair.pubkey())
.collect();
run_test_update_slot_propagated_threshold_from_votes(&keypairs, &new_vote_pubkeys, &[], 4);
// Adding the same node pubkey's instead of the corresponding
// vote pubkeys should be equivalent
run_test_update_slot_propagated_threshold_from_votes(&keypairs, &[], &new_node_pubkeys, 4);
// Adding the same node pubkey's in the same order as their
// reach the threshold any sooner.
run_test_update_slot_propagated_threshold_from_votes(
&keypairs,
&new_vote_pubkeys,
&new_node_pubkeys,
4,
);
// because now we are getting 2 new pubkeys on each
// we should have 4/10 validators voting
run_test_update_slot_propagated_threshold_from_votes(
&keypairs,
&new_vote_pubkeys[0..5],
&new_node_pubkeys[5..],
2,
);
} | rust_cleaned_test_functions.jsonl/11059 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
27563,
21663,
351,
657,
21858,
5673,
65116,
368,
341,
286,
1077,
1376,
77256,
25,
10528,
27,
6878,
716,
29,
284,
5367,
486,
30624,
6615,
79453,
341,
310,
1077,
6910,
3097,
77256,
284,
32566,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_park_timeout_unpark_called_other_thread() {
use std::old_io;
for _ in 0..10 {
let th = thread::current();
let _guard = thread::spawn(move || {
old_io::timer::sleep(Duration::milliseconds(50));
th.unpark();
});
thread::park_timeout(Duration::seconds(10_000_000));
}
} | rust_cleaned_test_functions.jsonl/109021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
838,
20537,
4907,
28736,
27859,
30456,
10814,
368,
341,
286,
990,
1460,
486,
813,
16939,
401,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
1077,
270,
284,
4516,
486,
3231,
1428,
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... | 3 |
#[test]
fn test_newtype_struct() {
#[derive(Tsify)]
struct Newtype(i32);
assert_eq!(Newtype::DECL, "export type Newtype = number;");
} | rust_cleaned_test_functions.jsonl/121071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
1313,
15126,
368,
341,
262,
11506,
27098,
4140,
82,
1437,
5563,
262,
2036,
1532,
1313,
1956,
18,
17,
626,
262,
2060,
10714,
10297,
3564,
1313,
486,
21817,
11,
330,
1533,
943,
1532,
1313,
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 |
#[test]
fn test_rev_reg_def_fails_for_cred_def_created_without_revocation() {
let wallet_name = "test_create_revocable_fails_with_no_tails_file";
init!("ledger");
let data = r#"["address1","address2","zip","city","state"]"#.to_string();
// revoc_reg_def will fail in libindy because cred_Def doesn't have revocation keys
let (_, _, cred_def_id, _, _, _) = ::utils::libindy::anoncreds::tests::create_and_store_credential_def(::utils::constants::DEFAULT_SCHEMA_ATTRS, false);
let did = settings::get_config_value(settings::CONFIG_INSTITUTION_DID).unwrap();
let rc = generate_rev_reg(&did, &cred_def_id, get_temp_dir_path(Some("path.txt")).to_str().unwrap(), 2);
assert_eq!(rc.unwrap_err().kind(), VcxErrorKind::LibindyInvalidStructure);
} | rust_cleaned_test_functions.jsonl/76654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38082,
4920,
7844,
761,
6209,
5478,
73475,
7844,
27288,
39904,
38082,
2276,
368,
341,
286,
1077,
15085,
1269,
284,
330,
1944,
8657,
38082,
509,
480,
761,
6209,
6615,
6536,
528,
6209,
2458,
876,
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_simple_bh() {
let rng = &mut test_rng();
let params = H::setup(rng).unwrap();
let _ = H::evaluate(¶ms, &[1, 2, 3]).unwrap();
} | rust_cleaned_test_functions.jsonl/112991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
90581,
368,
341,
286,
1077,
28422,
284,
609,
6984,
1273,
66849,
543,
286,
1077,
3628,
284,
472,
486,
15188,
87597,
568,
15454,
543,
286,
1077,
716,
284,
472,
486,
47291,
2099,
3519,
11,
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 |
#[test]
fn test_constrain_slopes() {
let constraint: Box<dyn SinglePartConstraint> = Box::new(ConstrainContinuousSlopes(3));
assert!(!constraint.is_active(&vec![], 10));
run_scale_free_test(&constraint, &[0, 1, 2, 1], 9, true);
run_scale_free_test(&constraint, &[0, 1, 2, 3], 9, false);
run_scale_free_test(&constraint, &[0, 1, 2, 3], 9, false);
run_scale_free_test(&constraint, &[0, 1, 2, 1, 0, -1, -2], 9, false);
} | rust_cleaned_test_functions.jsonl/74367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
77626,
643,
385,
20352,
368,
341,
286,
1077,
21568,
25,
8261,
92846,
11327,
5800,
17890,
29,
284,
8261,
486,
931,
7,
1109,
77626,
94780,
50,
385,
20352,
7,
18,
1106,
286,
2060,
0,
3471,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_comma() {
use ast::Expression::Comma;
use parser::expression;
let env = &mut Env::new();
assert_eq!(expression("a", env), Ok(ident("a")));
assert_eq!(
expression("a, a, a,a\n,a", env),
Ok(Comma(Box::new(vec![ident("a"); 5].into())).into())
);
} | rust_cleaned_test_functions.jsonl/107546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
1728,
368,
341,
262,
990,
11763,
486,
9595,
486,
1092,
1728,
280,
262,
990,
6729,
486,
28099,
401,
262,
1077,
6105,
284,
609,
6984,
37039,
486,
931,
1428,
262,
2060,
10714,
10297,
28099,
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_buffer_end_utf16be() {
let mut decoder = UTF_16BE.new_decoder_without_bom_handling();
let mut dest = [0u8; 4];
assert_eq!(
decoder.decode_to_utf8(&[0xD8, 0x00], &mut dest, false),
(CoderResult::InputEmpty, 2, 0, false)
);
let _ = decoder.decode_to_utf8(&[0xD8, 0x00], &mut dest, true);
} | rust_cleaned_test_functions.jsonl/90279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
6213,
39453,
16,
21,
1371,
368,
341,
286,
1077,
5206,
24551,
284,
20076,
62,
16,
21,
11594,
4618,
49843,
39904,
880,
316,
75642,
543,
286,
1077,
5206,
3201,
284,
508,
15,
84,
23,
26,
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_pool_available_deadline() {
let engine = TestEngineBuilder::new().build().unwrap();
let config = Config {
scheduler_concurrency: 1024,
scheduler_worker_pool_size: 1,
scheduler_pending_write_threshold: ReadableSize(100 * 1024 * 1024),
enable_async_apply_prewrite: false,
..Default::default()
};
let scheduler = Scheduler::new(
engine,
DummyLockManager,
ConcurrencyManager::new(1.into()),
&config,
Arc::new(AtomicBool::new(true)),
Arc::new(FlowController::empty()),
);
// Spawn a task that sleeps for 500ms to occupy the pool. The next request
// cannot run within 500ms.
scheduler
.get_sched_pool(CommandPri::Normal)
.pool
.spawn(async { thread::sleep(Duration::from_millis(500)) })
.unwrap();
let mut req = BatchRollbackRequest::default();
req.mut_context().max_execution_duration_ms = 100;
req.set_keys(vec![b"a".to_vec(), b"b".to_vec(), b"c".to_vec()].into());
let cmd: TypedCommand<()> = req.into();
let (cb, f) = paired_future_callback();
scheduler.run_cmd(cmd.cmd, StorageCallback::Boolean(cb));
assert!(matches!(
block_on(f).unwrap(),
Err(StorageError(box StorageErrorInner::DeadlineExceeded))
));
// A new request should not be blocked.
let mut req = BatchRollbackRequest::default();
req.set_keys(vec![b"a".to_vec(), b"b".to_vec(), b"c".to_vec()].into());
let cmd: TypedCommand<()> = req.into();
let (cb, f) = paired_future_callback();
scheduler.run_cmd(cmd.cmd, StorageCallback::Boolean(cb));
assert!(block_on(f).is_ok());
} | rust_cleaned_test_functions.jsonl/122794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 882
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15709,
26962,
53427,
1056,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
2193,
284,
5532,
341,
310,
28809,
3382,
15973,
25,
220,
16,
15,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_builder() {
use super::{MetadataBuilder, RecordBuilder};
let target = "myApp";
let metadata = MetadataBuilder::new().target(target).build();
let fmt_args = format_args!("hello");
let record_test = RecordBuilder::new()
.args(fmt_args)
.metadata(metadata)
.module_path(Some("foo"))
.file(Some("bar"))
.line(Some(30))
.build();
assert_eq!(record_test.metadata().target(), "myApp");
assert_eq!(record_test.module_path(), Some("foo"));
assert_eq!(record_test.file(), Some("bar"));
assert_eq!(record_test.line(), Some(30));
} | rust_cleaned_test_functions.jsonl/71739 | {
"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,
14192,
28532,
368,
341,
286,
990,
2256,
22964,
14610,
3297,
11,
13583,
3297,
2440,
286,
1077,
2169,
284,
330,
2408,
2164,
876,
286,
1077,
11160,
284,
33589,
3297,
486,
931,
1005,
5657,
8637,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mnt4753_phantom_merkle_root() {
let expected_root = generate_phantom_merkle_root_from_magic_string::<Fr, MNT4PoseidonHash>(
"This represents an empty Merkle Root for a MNT4753PoseidonHash based Merkle Tree.",
);
assert_eq!(expected_root, MNT4753_PHANTOM_MERKLE_ROOT);
} | rust_cleaned_test_functions.jsonl/5824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
717,
406,
19,
22,
20,
18,
9782,
30002,
717,
16754,
273,
12993,
368,
341,
286,
1077,
3601,
12993,
284,
6923,
9782,
30002,
717,
16754,
273,
12993,
5673,
54612,
3904,
27638,
22560,
11,
386,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_toggle() {
run_test!(|client, conn| {
// Issue a request to insert a new task; ensure it's not yet completed.
client.post("/todo")
.header(ContentType::Form)
.body("description=test_for_completion")
.dispatch();
let task = Task::all(&conn).unwrap()[0].clone();
assert_eq!(task.completed, false);
// Issue a request to toggle the task; ensure it is completed.
client.put(format!("/todo/{}", task.id.unwrap())).dispatch();
assert_eq!(Task::all(&conn).unwrap()[0].completed, true);
// Issue a request to toggle the task; ensure it's not completed again.
client.put(format!("/todo/{}", task.id.unwrap())).dispatch();
assert_eq!(Task::all(&conn).unwrap()[0].completed, false);
})
} | rust_cleaned_test_functions.jsonl/32833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48860,
368,
341,
262,
1598,
4452,
10297,
91,
2972,
11,
4534,
91,
341,
286,
442,
25226,
264,
1681,
311,
5656,
264,
501,
3383,
26,
5978,
432,
594,
537,
3602,
8145,
624,
286,
2943,
6542,
4283,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_distribute() {
let mut deps = mock_dependencies(&[]);
deps.querier.with_terraswap_pairs(&[
(&"uusdmirror0000".to_string(), &"MIRLP000".to_string()),
(&"uusdasset0000".to_string(), &"LP0000".to_string()),
(&"uusdasset0001".to_string(), &"LP0001".to_string()),
]);
let msg = InstantiateMsg {
base_denom: BASE_DENOM.to_string(),
token_code_id: TOKEN_CODE_ID,
distribution_schedule: vec![
(1800, 3600, Uint128::from(3600u128)),
(3600, 3600 + 3600, Uint128::from(7200u128)),
],
};
let info = mock_info("addr0000", &[]);
let _res = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap();
let msg = ExecuteMsg::PostInitialize {
owner: "owner0000".to_string(),
mirror_token: "mirror0000".to_string(),
mint_contract: "mint0000".to_string(),
staking_contract: "staking0000".to_string(),
commission_collector: "collector0000".to_string(),
oracle_contract: "oracle0000".to_string(),
terraswap_factory: "terraswapfactory".to_string(),
};
let _res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
// whitelist first item with weight 1.5
let msg = ExecuteMsg::Whitelist {
name: "apple derivative".to_string(),
symbol: "mAPPL".to_string(),
oracle_proxy: "oracleproxy0000".to_string(),
params: Params {
auction_discount: Decimal::percent(5),
min_collateral_ratio: Decimal::percent(150),
weight: Some(100u32),
mint_period: None,
min_collateral_ratio_after_ipo: None,
pre_ipo_price: None,
ipo_trigger_addr: None,
},
};
let info = mock_info("owner0000", &[]);
let _res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
//ensure temp oracle was stored
let tmp_oracle = read_tmp_oracle(&deps.storage).unwrap();
assert_eq!(tmp_oracle.to_string(), "oracleproxy0000");
let mut token_inst_res = MsgInstantiateContractResponse::new();
token_inst_res.set_contract_address("asset0000".to_string());
let reply_msg = Reply {
id: 1,
result: ContractResult::Ok(SubMsgExecutionResponse {
events: vec![],
data: Some(token_inst_res.write_to_bytes().unwrap().into()),
}),
};
let _res = reply(deps.as_mut(), mock_env(), reply_msg).unwrap();
//ensure asset token was stored
let tmp_asset = read_tmp_asset(&deps.storage).unwrap();
assert_eq!(tmp_asset.to_string(), "asset0000");
let reply_msg2 = Reply {
id: 2,
result: ContractResult::Ok(SubMsgExecutionResponse {
events: vec![],
data: None,
}),
};
let _res = reply(deps.as_mut(), mock_env(), reply_msg2).unwrap();
// Whitelist second item with weight 1
let msg = ExecuteMsg::Whitelist {
name: "google derivative".to_string(),
symbol: "mGOGL".to_string(),
oracle_proxy: "oracleproxy0000".to_string(),
params: Params {
auction_discount: Decimal::percent(5),
min_collateral_ratio: Decimal::percent(150),
weight: Some(100u32),
mint_period: None,
min_collateral_ratio_after_ipo: None,
pre_ipo_price: None,
ipo_trigger_addr: None,
},
};
let info = mock_info("owner0000", &[]);
let _res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
let mut token_inst_res = MsgInstantiateContractResponse::new();
token_inst_res.set_contract_address("asset0001".to_string());
let reply_msg = Reply {
id: 1,
result: ContractResult::Ok(SubMsgExecutionResponse {
events: vec![],
data: Some(token_inst_res.write_to_bytes().unwrap().into()),
}),
};
let _res = reply(deps.as_mut(), mock_env(), reply_msg).unwrap();
//ensure asset token was stored
let tmp_asset = read_tmp_asset(&deps.storage).unwrap();
assert_eq!(tmp_asset.to_string(), "asset0001");
let reply_msg2 = Reply {
id: 2,
result: ContractResult::Ok(SubMsgExecutionResponse {
events: vec![],
data: None,
}),
};
let _res = reply(deps.as_mut(), mock_env(), reply_msg2).unwrap();
// height is not increased so zero amount will be minted
let msg = ExecuteMsg::Distribute {};
let info = mock_info("anyone", &[]);
let res = execute(deps.as_mut(), mock_env(), info, msg);
match res {
Err(StdError::GenericErr { msg, .. }) => {
assert_eq!(msg, "Cannot distribute mirror token before interval")
}
_ => panic!("DO NOT ENTER HERE"),
}
// one height increase
let msg = ExecuteMsg::Distribute {};
let env = mock_env_time(1_571_797_419u64 + 5400u64);
let info = mock_info("addr0000", &[]);
let res = execute(deps.as_mut(), env, info, msg).unwrap();
assert_eq!(
res.attributes,
vec![
attr("action", "distribute"),
attr("distribution_amount", "7200"),
]
);
// MIR -> 7200 * 3/5
// asset0000 -> 7200 * 1/5
// asset0001 -> 7200 * 1/5
assert_eq!(
res.messages,
vec![SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute {
contract_addr: "mirror0000".to_string(),
msg: to_binary(&Cw20ExecuteMsg::Send {
contract: "staking0000".to_string(),
amount: Uint128::from(7200u128),
msg: to_binary(&StakingCw20HookMsg::DepositReward {
rewards: vec![
("asset0000".to_string(), Uint128::from(7200u128 / 5)),
("asset0001".to_string(), Uint128::from(7200u128 / 5)),
("mirror0000".to_string(), Uint128::from(7200u128 * 3 / 5)),
],
})
.unwrap(),
})
.unwrap(),
funds: vec![],
}))],
);
let res = query(deps.as_ref(), mock_env(), QueryMsg::DistributionInfo {}).unwrap();
let distribution_info: DistributionInfoResponse = from_binary(&res).unwrap();
assert_eq!(
distribution_info,
DistributionInfoResponse {
weights: vec![
("asset0000".to_string(), 100),
("asset0001".to_string(), 100),
("mirror0000".to_string(), 300),
],
last_distributed: 1_571_802_819,
}
);
} | rust_cleaned_test_functions.jsonl/36375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3088
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
80133,
368,
341,
262,
1077,
5206,
48178,
284,
7860,
71841,
2099,
56703,
262,
48178,
13,
15959,
1268,
18164,
72493,
12784,
21726,
36430,
2099,
9640,
286,
15899,
1,
84,
355,
13849,
28812,
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... | 2 |
#[test]
fn test_black_pawn_capture() {
let position = PositionBuilder::new()
.side_to_move(Color::Black)
.place(Square::F4, Piece::BlackPawn, Color::Black)
.place(Square::F3, Piece::BlackPawn, Color::Black)
.place(Square::E3, Piece::Bishop, Color::White)
.place(Square::E5, Piece::Knight, Color::White)
.place(Square::G3, Piece::Rook, Color::White)
.build();
let mut moves = Vec::new();
MoveGenerator::new().moves_from(
Kind::All,
&mut moves,
&position,
Color::Black,
Square::F4,
);
assert_targets(&[Square::E3, Square::G3], &moves);
// Cannot capture own piece
let position = PositionBuilder::new()
.side_to_move(Color::Black)
.place(Square::F4, Piece::BlackPawn, Color::Black)
.place(Square::F3, Piece::BlackPawn, Color::Black)
.place(Square::E3, Piece::Bishop, Color::Black)
.build();
let mut moves = Vec::new();
MoveGenerator::new().moves_from(
Kind::All,
&mut moves,
&position,
Color::Black,
Square::F4,
);
assert_targets(&[], &moves);
let position = PositionBuilder::new()
.side_to_move(Color::Black)
.place(Square::F2, Piece::BlackPawn, Color::Black)
.place(Square::F1, Piece::Rook, Color::Black)
.place(Square::E1, Piece::Queen, Color::White)
.build();
let mut moves = Vec::new();
MoveGenerator::new().moves_from(
Kind::All,
&mut moves,
&position,
Color::Black,
Square::F2,
);
assert_targets(&[Square::E1], &moves);
assert_eq!(4, moves.len(), "moves={:?}", &moves);
let move_kinds: BTreeSet<_> = moves.iter().map(|m| m.kind).collect();
let mut expected_kinds = BTreeSet::new();
expected_kinds.insert(MoveKind::PromotionCaptureKnight);
expected_kinds.insert(MoveKind::PromotionCaptureBishop);
expected_kinds.insert(MoveKind::PromotionCaptureRook);
expected_kinds.insert(MoveKind::PromotionCaptureQueen);
assert_eq!(None, expected_kinds.symmetric_difference(&move_kinds).next());
} | rust_cleaned_test_functions.jsonl/134607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 900
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40272,
620,
6379,
55148,
368,
341,
262,
1077,
2309,
284,
12380,
3297,
486,
931,
741,
414,
659,
2929,
2346,
17134,
15028,
486,
14417,
340,
414,
659,
2007,
3759,
5151,
486,
37,
19,
11,
28930,
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_get_out_of_bounds() {
let a = Buffer::from(vec![1, 2, 3, 4, 5]);
a.get(123); // should panic
} | rust_cleaned_test_functions.jsonl/37700 | {
"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,
3062,
6068,
3575,
36878,
368,
341,
286,
1077,
264,
284,
10312,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
2558,
286,
264,
670,
7,
16,
17,
18,
1215,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_canister_balance() {
let cycles_amount = 100;
let max_num_instructions = NumInstructions::from(1 << 30);
let cycles_account_manager = CyclesAccountManagerBuilder::new()
.with_max_num_instructions(max_num_instructions)
.build();
let mut system_state =
get_new_running_system_state(Cycles::from(cycles_amount), SubnetType::Application);
system_state
.call_context_manager_mut()
.unwrap()
.new_call_context(
CallOrigin::CanisterUpdate(canister_test_id(33), CallbackId::from(5)),
Cycles::from(50),
);
let api = get_system_api(get_update_api_type(), system_state, cycles_account_manager);
// Check cycles balance.
assert_eq!(api.ic0_canister_cycle_balance().unwrap(), cycles_amount);
} | rust_cleaned_test_functions.jsonl/109061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
1571,
29396,
368,
341,
286,
1077,
24484,
13471,
284,
220,
16,
15,
15,
280,
286,
1077,
1932,
4273,
82427,
284,
16212,
55291,
486,
1499,
7,
16,
1115,
220,
18,
15,
317,
286,
1077,
24484,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_category_iterate_indices() {
let ax = Category::new(vec!["A", "B", "C"]);
let actual: Vec<usize> = ax.indices().collect();
let expected = vec![0, 1, 2, 3];
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/27587 | {
"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,
11847,
11723,
349,
18333,
368,
341,
262,
1077,
3859,
284,
10054,
486,
931,
25592,
0,
1183,
32,
497,
330,
33,
497,
330,
34,
15049,
262,
1077,
5042,
25,
11312,
90244,
29,
284,
3859,
57928,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_en_passant_black() {
let mut builder = PositionBuilder::new();
builder
.side_to_move(Color::Black)
.place(Square::A4, Piece::BlackPawn, Color::Black)
.place(Square::B4, Piece::WhitePawn, Color::White)
.en_passant_target(Some(Square::B3));
let moves = MoveGenerator::new().moves(&builder.build());
assert_eq!(2, moves.len(), "moves={:?}", moves);
assert_eq!(
true,
moves.contains(&Move {
kind: MoveKind::EnPassantCapture,
from: Square::A4,
to: Square::B3,
})
);
} | rust_cleaned_test_functions.jsonl/134611 | {
"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,
6205,
15464,
517,
40272,
368,
341,
262,
1077,
5206,
7363,
284,
12380,
3297,
486,
931,
543,
262,
7363,
198,
414,
659,
2929,
2346,
17134,
15028,
486,
14417,
340,
414,
659,
2007,
3759,
5151,
486,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simd_is_basic_latin_c0() {
let input: [u16; 16] = [
0x61, 0x62, 0x63, 0x81, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74,
0x75, 0x76,
];
let first = unsafe { load8_unaligned(input.as_ptr()) };
let second = unsafe { load8_unaligned(input.as_ptr().add(8)) };
assert!(!simd_is_basic_latin(first | second));
} | rust_cleaned_test_functions.jsonl/30495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18314,
67,
6892,
34729,
907,
14768,
666,
15,
368,
341,
286,
1077,
1946,
25,
508,
84,
16,
21,
26,
220,
16,
21,
60,
284,
2278,
310,
220,
15,
87,
21,
16,
11,
220,
15,
87,
21,
17,
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_variable() {
assert_leaf! {
parsers [ var ]
"$it" -> 0..3 { Variable(tag(1, 3)) }
}
assert_leaf! {
parsers [ var ]
"$name" -> 0..5 { Variable(tag(1, 5)) }
}
} | rust_cleaned_test_functions.jsonl/46723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14635,
368,
341,
286,
2060,
38909,
0,
341,
310,
87073,
508,
762,
5133,
310,
5201,
275,
1,
1464,
220,
15,
496,
18,
314,
12407,
19343,
7,
16,
11,
220,
18,
593,
456,
286,
555,
286,
2060,
38909,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vect_div() {
let vec1 = vec![1.0, 2.0, 3.0, 4.0];
let vec2 = vec![1.0, 2.0, 3.0, 4.0];
let vectors = Vectors::new(vec1, vec2).unwrap();
let vec_div = vectors.div();
assert_eq!(vec_div, vec![1.0, 1.0, 1.0, 1.0])
} | rust_cleaned_test_functions.jsonl/60425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59402,
16237,
368,
341,
286,
1077,
7486,
16,
284,
7486,
20703,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
11,
220,
19,
13,
15,
935,
286,
1077,
7486,
17,
284,
7486,
20703,
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_ascii() {
assert_eq!(65u8.to_ascii().to_byte(), 65u8);
assert_eq!(65u8.to_ascii().to_char(), 'A');
assert_eq!('A'.to_ascii().to_char(), 'A');
assert_eq!('A'.to_ascii().to_byte(), 65u8);
assert_eq!('A'.to_ascii().to_lower().to_char(), 'a');
assert_eq!('Z'.to_ascii().to_lower().to_char(), 'z');
assert_eq!('a'.to_ascii().to_upper().to_char(), 'A');
assert_eq!('z'.to_ascii().to_upper().to_char(), 'Z');
assert_eq!('@'.to_ascii().to_lower().to_char(), '@');
assert_eq!('['.to_ascii().to_lower().to_char(), '[');
assert_eq!('`'.to_ascii().to_upper().to_char(), '`');
assert_eq!('{'.to_ascii().to_upper().to_char(), '{');
assert!('0'.to_ascii().is_digit());
assert!('9'.to_ascii().is_digit());
assert!(!'/'.to_ascii().is_digit());
assert!(!':'.to_ascii().is_digit());
assert!((0x1fu8).to_ascii().is_control());
assert!(!' '.to_ascii().is_control());
assert!((0x7fu8).to_ascii().is_control());
assert!("banana".chars().all(|c| c.is_ascii()));
assert!(!"ประเทศไทย中华Việt Nam".chars().all(|c| c.is_ascii()));
} | rust_cleaned_test_functions.jsonl/4325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50238,
368,
341,
286,
2060,
10714,
10297,
21,
20,
84,
23,
2389,
50238,
1005,
983,
19737,
1507,
220,
21,
20,
84,
23,
317,
286,
2060,
10714,
10297,
21,
20,
84,
23,
2389,
50238,
1005,
983,
9232,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exclusive_simple_arrays() {
let a = schema_for!(Vec<u32>).schema.into();
let b = schema_for!(Vec<f32>).schema.into();
assert!(schemas_mutually_exclusive(&a, &b));
assert!(schemas_mutually_exclusive(&b, &a));
} | rust_cleaned_test_functions.jsonl/53303 | {
"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,
2702,
8336,
30015,
68983,
368,
341,
286,
1077,
264,
284,
10802,
5478,
10297,
10050,
34837,
18,
17,
71524,
17349,
39860,
543,
286,
1077,
293,
284,
10802,
5478,
10297,
10050,
63895,
18,
17,
71524,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enums() {
noodle!(serialize, deserialize,
enum TestA {}
);
// Basic enum
noodle!(serialize, deserialize,
#[derive(PartialEq)]
enum TestB {
Apples,
Bananas,
}
);
test_serdes!(TestB, TestB::Apples);
test_serdes!(TestB, TestB::Bananas);
// Enum with a discriminant
noodle!(serialize, deserialize,
#[derive(PartialEq)]
enum TestC {
Apples = 6,
Bananas
}
);
test_serdes!(TestC, TestC::Apples);
test_serdes!(TestC, TestC::Bananas);
// level to test attribute handling
noodle!(serialize, deserialize,
/// Big doc comment here
/// with many lines
/// you know?
#[derive(PartialEq)]
enum TestD {
#[cfg(test)]
Apples {},
Cars,
Bananas {
/* comment
*/
#[cfg(test)]
x: u32,
/// doc comment
z: i32
},
// Another comment
Cake(),
Weird(,),
Cakes(u32),
Foopie(i8, i32,),
Testing(i128, i64),
Arrayz([u8; 4]),
Lotsotuple(i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8,i8),
}
);
test_serdes!(TestD, TestD::Apples {});
test_serdes!(TestD, TestD::Cars);
test_serdes!(TestD, TestD::Bananas { x: 932923, z: -348192 });
test_serdes!(TestD, TestD::Cake());
test_serdes!(TestD, TestD::Weird());
test_serdes!(TestD, TestD::Cakes(0x13371337));
test_serdes!(TestD, TestD::Foopie(-9, 19));
test_serdes!(TestD, TestD::Testing(0xc0c0c0c0c0c0c0c0c0c0c0, -10000));
test_serdes!(TestD, TestD::Arrayz([9; 4]));
test_serdes!(TestD, TestD::Lotsotuple(0,0,0,0,0,5,0,0,0,0,0,0,0,9,0,0));
// Enum with a discriminant
noodle!(serialize, deserialize,
#[derive(PartialEq)]
enum TestE<'a> {
Bananas(Cow<'a, str>),
Scoops,
}
);
test_serdes!(TestE, TestE::Bananas(Cow::Borrowed("asdf")));
test_serdes!(TestE, TestE::Scoops);
} | rust_cleaned_test_functions.jsonl/7081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1560
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
6237,
368,
341,
1789,
286,
45795,
273,
10297,
24166,
11,
35240,
345,
310,
7618,
3393,
32,
5613,
286,
3475,
286,
442,
14625,
7618,
198,
286,
45795,
273,
10297,
24166,
11,
35240,
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... | 1 |
#[test]
fn test_small_https() {
assert!(test_logger());
let tune = FutioTunables::new();
let req = get_request("https://www.usa.gov").unwrap();
let dl = debugv!(fetch(req, tune)).unwrap();
let dl = dl.clone(); // for coverage only
assert!(dl.res_body().is_ram());
assert!(!dl.res_body().is_empty());
} | rust_cleaned_test_functions.jsonl/6189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
26817,
368,
341,
262,
2060,
10297,
1944,
27413,
1423,
262,
1077,
25240,
284,
42547,
815,
51,
359,
4788,
486,
931,
543,
262,
1077,
4232,
284,
633,
7893,
445,
2428,
1110,
2136,
21916,
64,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_wrong_magic_number() {
let mut module = ZERO_BOUND_HEADER.to_vec();
module[0] = 0x00;
let mut c = RetainingConsumer::new();
let p = Parser::new(&module, &mut c);
assert_matches!(p.parse(), Err(State::HeaderIncorrect));
} | rust_cleaned_test_functions.jsonl/85733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
75198,
54612,
5500,
368,
341,
286,
1077,
5206,
4688,
284,
54593,
73644,
20330,
2389,
13251,
543,
286,
4688,
58,
15,
60,
284,
220,
15,
87,
15,
15,
280,
286,
1077,
5206,
272,
284,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_addition() {
assert_eq!(Cycles::from(0) + Cycles::from(0), Cycles::from(0));
assert_eq!(
Cycles::from(0) + Cycles::from(std::u128::MAX),
Cycles::from(std::u128::MAX)
);
assert_eq!(
Cycles::from(std::u128::MAX) + Cycles::from(std::u128::MAX),
Cycles::from(std::u128::MAX)
);
assert_eq!(
Cycles::from(std::u128::MAX) + Cycles::from(10),
Cycles::from(std::u128::MAX)
);
} | rust_cleaned_test_functions.jsonl/55718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
680,
368,
341,
286,
2060,
10714,
10297,
34,
15805,
486,
1499,
7,
15,
8,
488,
356,
15805,
486,
1499,
7,
15,
701,
356,
15805,
486,
1499,
7,
15,
1106,
286,
2060,
10714,
33673,
310,
356,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_splitters() {
let entity_graph = entity_graph_from(vec![
FactorioEntity::new_resource(
&Position::new(0.5, -1.5),
Direction::South,
&EntityName::IronOre.to_string(),
),
FactorioEntity::new_electric_mining_drill(&Position::new(0.5, -1.5), Direction::South),
FactorioEntity::new_transport_belt(&Position::new(0.5, 0.5), Direction::South),
FactorioEntity::new_transport_belt(&Position::new(1.5, 0.5), Direction::South),
FactorioEntity::new_splitter(&Position::new(1., 1.5), Direction::South),
FactorioEntity::new_transport_belt(&Position::new(0.5, 2.5), Direction::South),
FactorioEntity::new_transport_belt(&Position::new(1.5, 2.5), Direction::South),
])
.unwrap();
assert_eq!(
entity_graph.graphviz_dot(),
r#"digraph {
0 [ label = "iron-ore: mining-drill at [0.5, -1.5]" ]
1 [ label = "transport-belt at [0.5, 0.5]" ]
2 [ label = "transport-belt at [1.5, 0.5]" ]
3 [ label = "splitter at [1, 1.5]" ]
4 [ label = "transport-belt at [0.5, 2.5]" ]
5 [ label = "transport-belt at [1.5, 2.5]" ]
0 -> 1 [ label = "1" ]
1 -> 3 [ label = "1" ]
2 -> 3 [ label = "1" ]
3 -> 4 [ label = "1" ]
3 -> 5 [ label = "1" ]
}
"#,
);
let flow_graph = FlowGraph::new(Arc::new(entity_graph));
flow_graph.update().unwrap();
assert_eq!(
flow_graph.graphviz_dot(),
r#"digraph {
0 [ label = "iron-ore electric-mining-drill at [0.5, -1.5]" ]
1 [ label = "transport-belt at [0.5, 0.5]" ]
2 [ label = "splitter at [1, 1.5]" ]
3 [ label = "transport-belt at [0.5, 2.5]" ]
4 [ label = "transport-belt at [1.5, 2.5]" ]
0 -> 1 [ label = "Single([(\"iron-ore\", 0.5)])" ]
1 -> 2 [ label = "Double([(\"iron-ore\", 0.25)], [(\"iron-ore\", 0.25)])" ]
2 -> 3 [ label = "Double([(\"iron-ore\", 0.125)], [(\"iron-ore\", 0.125)])" ]
2 -> 4 [ label = "Double([(\"iron-ore\", 0.125)], [(\"iron-ore\", 0.125)])" ]
}
"#,
);
} | rust_cleaned_test_functions.jsonl/74004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1062
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
500,
28063,
368,
341,
286,
1077,
5387,
14738,
284,
5387,
14738,
5673,
25592,
90515,
310,
37729,
815,
3030,
486,
931,
17962,
1006,
394,
609,
3812,
486,
931,
7,
15,
13,
20,
11,
481,
16,
13,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stop_ap_invalid_config() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
let test_values = test_setup(&mut exec);
let fake_ap = FakeAp { start_succeeds: true, stop_succeeds: true, exit_succeeds: true };
let mut iface_manager = create_iface_manager_with_ap(&test_values, fake_ap);
{
let fut = iface_manager
.stop_ap(TEST_SSID.as_bytes().to_vec(), TEST_PASSWORD.as_bytes().to_vec());
pin_mut!(fut);
assert_variant!(exec.run_until_stalled(&mut fut), Poll::Ready(Ok(())));
}
assert!(!iface_manager.aps.is_empty());
} | rust_cleaned_test_functions.jsonl/62713 | {
"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,
19039,
21093,
31433,
5332,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
1273,
9146,
284,
1273,
213... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_plain_decode_int32() {
let data = vec![42, 18, 52];
let data_bytes = Int32Type::to_byte_array(&data[..]);
let mut buffer = vec![0; 3];
test_plain_decode::<Int32Type>(
ByteBufferPtr::new(data_bytes),
3,
-1,
&mut buffer[..],
&data[..],
);
} | rust_cleaned_test_functions.jsonl/38504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41015,
15227,
4042,
18,
17,
368,
341,
286,
1077,
821,
284,
7486,
20703,
19,
17,
11,
220,
16,
23,
11,
220,
20,
17,
935,
286,
1077,
821,
12524,
284,
1333,
18,
17,
929,
486,
983,
19737,
3858,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_root_subscribe() {
let exit = Arc::new(AtomicBool::new(false));
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Bank::new_for_tests(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let optimistically_confirmed_bank =
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks);
let subscriptions = Arc::new(RpcSubscriptions::new_for_tests(
&exit,
bank_forks,
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests())),
optimistically_confirmed_bank,
));
let (rpc, mut receiver) = rpc_pubsub_service::test_connection(&subscriptions);
let sub_id = rpc.root_subscribe().unwrap();
subscriptions
.control
.assert_subscribed(&SubscriptionParams::Root);
subscriptions.notify_roots(vec![2, 1, 3]);
for expected_root in 1..=3 {
let response = receiver.recv();
let expected_res_str =
serde_json::to_string(&serde_json::to_value(expected_root).unwrap()).unwrap();
let expected = format!(
r#"{{"jsonrpc":"2.0","method":"rootNotification","params":{{"result":{},"subscription":0}}}}"#,
expected_res_str
);
assert_eq!(expected, response);
}
rpc.root_unsubscribe(sub_id).unwrap();
subscriptions
.control
.assert_unsubscribed(&SubscriptionParams::Root);
} | rust_cleaned_test_functions.jsonl/14341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 749
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
12993,
88935,
368,
341,
286,
1077,
4869,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
1106,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_attributes() {
let mut expected_map = AttrMap::new();
expected_map.insert("test".to_string(), "foobar".to_string());
expected_map.insert("abc".to_string(), "def".to_string());
assert_eq!(
attributes().parse("test=\"foobar\" abc=\"def\""),
Ok((expected_map, ""))
);
assert_eq!(attributes().parse(""), Ok((AttrMap::new(), "")))
} | rust_cleaned_test_functions.jsonl/134144 | {
"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,
21039,
18240,
368,
341,
286,
1077,
5206,
3601,
5376,
284,
50943,
2227,
486,
931,
543,
286,
3601,
5376,
7030,
445,
1944,
3263,
983,
3904,
1507,
330,
50267,
3263,
983,
3904,
1423,
286,
3601,
5376,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_enum_ctx_id() {
#[derive(PartialEq, Debug, DekuRead, DekuWrite)]
#[deku(ctx = "my_id: u8", id = "my_id")]
enum EnumId {
#[deku(id = "1")]
VarA(u8),
#[deku(id = "2")]
VarB,
}
#[derive(PartialEq, Debug, DekuRead, DekuWrite)]
struct StructEnumId {
my_id: u8,
data: u8,
#[deku(ctx = "*my_id")]
enum_from_id: EnumId,
}
let test_data = [0x01_u8, 0xff, 0xab];
let ret_read = StructEnumId::try_from(test_data.as_ref()).unwrap();
assert_eq!(
StructEnumId {
my_id: 0x01,
data: 0xff,
enum_from_id: EnumId::VarA(0xab),
},
ret_read
);
let ret_write: Vec<u8> = ret_read.try_into().unwrap();
assert_eq!(ret_write, test_data)
} | rust_cleaned_test_functions.jsonl/81456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
31054,
15147,
842,
368,
341,
262,
11506,
27098,
5304,
20894,
27312,
11,
11091,
11,
74463,
84,
4418,
11,
74463,
84,
7985,
5563,
262,
11506,
450,
12133,
7502,
284,
330,
2408,
842,
25,
575,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.