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_rpn() {
let expression = "1 + 2 - 3 * (-4 - 5 * 100)";
let rpn = Vec::to_rpn(expression).unwrap();
assert_eq!(&rpn, "1 2 + 3 -4 5 100 * - * -");
assert_eq!(Vec::eval_rpn::<i64>(&rpn).unwrap(), 1515);
} | rust_cleaned_test_functions.jsonl/23390 | {
"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,
1710,
19958,
368,
341,
286,
1077,
7493,
284,
330,
16,
488,
220,
17,
481,
220,
18,
353,
10293,
19,
481,
220,
20,
256,
353,
220,
16,
15,
15,
24023,
16885,
286,
1077,
435,
19958,
284,
11312,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_csv_module() {
let db = Connection::open_in_memory().unwrap();
csvtab::load_module(&db).unwrap();
db.execute_batch("CREATE VIRTUAL TABLE vtab USING csv(filename='test.csv', header=yes)")
.unwrap();
{
let mut s = db.prepare("SELECT rowid, * FROM vtab").unwrap();
{
let headers = s.column_names();
assert_eq!(vec!["rowid", "colA", "colB", "colC"], headers);
}
let ids: Result<Vec<i32>> = s
.query(NO_PARAMS)
.unwrap()
.map(|row| row.get::<_, i32>(0))
.collect();
let sum = ids.unwrap().iter().sum::<i32>();
assert_eq!(sum, 15);
}
db.execute_batch("DROP TABLE vtab").unwrap();
} | rust_cleaned_test_functions.jsonl/12353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14020,
10750,
368,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
1005,
15454,
543,
286,
13147,
6192,
486,
1078,
10750,
2099,
1999,
568,
15454,
543,
286,
2927,
7769,
14534,
445,
22599,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_construction_fail_to_construct_multisig_actor_with_0_signers() {
let msig = Address::new_id(1000);
let mut rt = construct_runtime(msig);
let zero_signer_params = ConstructorParams {
signers: Vec::new(),
num_approvals_threshold: 1,
unlock_duration: 1,
start_epoch: 0,
};
rt.expect_validate_caller_addr(vec![*INIT_ACTOR_ADDR]);
rt.set_caller(*INIT_ACTOR_CODE_ID, *INIT_ACTOR_ADDR);
expect_abort(
ExitCode::ErrIllegalArgument,
rt.call::<MultisigActor>(
Method::Constructor as u64,
&RawBytes::serialize(&zero_signer_params).unwrap(),
),
);
rt.verify();
} | rust_cleaned_test_functions.jsonl/84343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
3024,
22121,
2346,
64803,
26290,
285,
343,
54818,
6615,
62,
15,
11172,
388,
368,
341,
262,
1077,
9829,
343,
284,
9177,
486,
931,
842,
7,
16,
15,
15,
15,
317,
262,
1077,
5206,
16677,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_id() {
let seat_ids: Vec<_> = as_input(INPUT).iter().map(|seat| seat_id(seat)).collect();
assert_eq!(seat_ids, vec![357, 567, 119, 820]);
} | rust_cleaned_test_functions.jsonl/84694 | {
"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,
2602,
842,
368,
341,
286,
1077,
10723,
8077,
25,
11312,
32399,
29,
284,
438,
5898,
57911,
568,
2015,
1005,
2186,
22428,
43058,
91,
10723,
842,
10478,
266,
4579,
17384,
1428,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_variant_to_string() {
let ident = token::str_to_ident("principal_skinner");
let var = codemap::respan(codemap::DUMMY_SP, ast::Variant_ {
name: ident,
attrs: Vec::new(),
kind: ast::TupleVariantKind(Vec::new()),
id: 0,
disr_expr: None,
vis: ast::Public,
});
let varstr = variant_to_string(&var);
assert_eq!(&varstr,&"pub principal_skinner".to_string());
} | rust_cleaned_test_functions.jsonl/54213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46112,
2346,
3904,
368,
341,
286,
1077,
3524,
284,
3950,
486,
495,
2346,
38399,
445,
66450,
33811,
4382,
3071,
286,
1077,
762,
284,
20329,
42040,
486,
416,
848,
1337,
347,
42040,
486,
35,
58673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partial_write() {
let mut array = [0u8; 2];
partial_write(&mut array[..], 0x102);
assert_eq!(&array[..], &[0x1, 0x2][..]);
} | rust_cleaned_test_functions.jsonl/125082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
9165,
368,
341,
262,
1077,
5206,
1334,
284,
508,
15,
84,
23,
26,
220,
17,
935,
262,
7130,
9165,
2099,
6984,
1334,
95874,
1125,
220,
15,
87,
16,
15,
17,
317,
262,
2060,
10714,
0,
2099,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cast_null_array_to_int32() {
let array = Arc::new(NullArray::new(6)) as ArrayRef;
let expected = Int32Array::from(vec![None; 6]);
let cast_type = DataType::Int32;
let cast_array = cast(&array, &cast_type).expect("cast failed");
let cast_array = as_primitive_array::<Int32Type>(&cast_array);
assert_eq!(cast_array.data_type(), &cast_type);
assert_eq!(cast_array, &expected);
} | rust_cleaned_test_functions.jsonl/45439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
15162,
3858,
2346,
4042,
18,
17,
368,
341,
286,
1077,
1334,
284,
19689,
486,
931,
7,
3280,
1857,
486,
931,
7,
21,
593,
438,
2910,
3945,
401,
286,
1077,
3601,
284,
1333,
18,
17,
1857,
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_excludes() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
te.assert_output(
&["--exclude", "*.foo"],
"one
one/two
one/two/C.Foo2
one/two/three
one/two/three/directory_foo
e1 e2
symlink",
);
te.assert_output(
&["--exclude", "*.foo", "--exclude", "*.Foo2"],
"one
one/two
one/two/three
one/two/three/directory_foo
e1 e2
symlink",
);
te.assert_output(
&["--exclude", "*.foo", "--exclude", "*.Foo2", "foo"],
"one/two/three/directory_foo",
);
te.assert_output(
&["--exclude", "one/two", "foo"],
"a.foo
one/b.foo",
);
te.assert_output(
&["--exclude", "one/**/*.foo"],
"a.foo
e1 e2
one
one/two
one/two/C.Foo2
one/two/three
one/two/three/directory_foo
symlink",
);
} | rust_cleaned_test_functions.jsonl/10889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 557
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
7396,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
1013,
3713,
7645,
1006,
286,
609,
1183,
313,
32413,
497,
59128,
7975,
8097,
286,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_same() {
let h1 = STR_POOL.intern("asd", Arc::from);
let h2 = STR_POOL.intern("123", Arc::from);
assert_ne!(h1, h2);
assert_eq!(h1.get(), "asd");
assert_eq!(h2.get(), "123");
} | rust_cleaned_test_functions.jsonl/38595 | {
"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,
7913,
33574,
368,
341,
286,
1077,
305,
16,
284,
12152,
51924,
6403,
932,
445,
79102,
497,
19689,
486,
1499,
317,
286,
1077,
305,
17,
284,
12152,
51924,
6403,
932,
445,
16,
17,
18,
497,
19689,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_counters() {
let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest = Guest::new(Box::new(focal));
let api_socket = temp_api_path(&guest.tmp_dir);
let mut cmd = GuestCommand::new(&guest);
cmd.args(&["--cpus", "boot=1"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", direct_kernel_boot_path().to_str().unwrap()])
.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE])
.default_disks()
.args(&["--net", guest.default_net_string().as_str()])
.args(&["--api-socket", &api_socket])
.capture_output();
let mut child = cmd.spawn().unwrap();
let r = std::panic::catch_unwind(|| {
guest.wait_vm_boot(None).unwrap();
let orig_counters = get_counters(&api_socket);
guest
.ssh_command("dd if=/dev/zero of=test count=8 bs=1M")
.unwrap();
let new_counters = get_counters(&api_socket);
// Check that all the counters have increased
assert!(new_counters > orig_counters);
});
let _ = child.kill();
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/26174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 634
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85632,
368,
341,
286,
1077,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
286,
1077,
8640,
284,
26215,
486,
931,
67758,
486,
931,
955,
3683,
1106,
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... | 2 |
#[test]
fn test_i2c_mock_multiple() {
let expectations = [
Transaction::write(0xaa, vec![1, 2]),
Transaction::read(0xbb, vec![3, 4]),
];
let mut i2c = Mock::new(&expectations);
i2c.write(0xaa, &vec![1, 2]).unwrap();
let mut v = vec![0u8; 2];
i2c.read(0xbb, &mut v).unwrap();
assert_eq!(v, vec![3, 4]);
i2c.done();
} | rust_cleaned_test_functions.jsonl/49254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
17,
66,
34134,
45233,
368,
341,
286,
1077,
16665,
284,
2278,
310,
17869,
486,
4934,
7,
15,
43300,
11,
7486,
20703,
16,
11,
220,
17,
17036,
310,
17869,
486,
878,
7,
15,
48939,
11,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_openbsd_conf() {
let mut config = resolv_conf::Config::new();
config.set_domain(String::from("example.com"));
config.set_search(vec!["example.com".into()]);
config.nameservers = vec![
ScopedIp::V4(Ipv4Addr::new(8, 8, 8, 8)),
];
config.lookup_file_bind = true;
assert_eq!(config, parse_file("tests/resolv.conf-openbsd"));
} | rust_cleaned_test_functions.jsonl/121165 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11311,
51835,
16059,
368,
341,
262,
1077,
5206,
2193,
284,
592,
35315,
16059,
486,
2648,
486,
931,
543,
262,
2193,
980,
20111,
2242,
486,
1499,
445,
8687,
905,
4010,
262,
2193,
980,
10716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_self_key() {
KeysManagerTest::new(ALICE)
.set_key_weight(ALICE, Weight::new(10))
.assert_success_status_and_commit()
.assert_keys(vec![(ALICE, Weight::new(10))]);
} | rust_cleaned_test_functions.jsonl/96211 | {
"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,
8882,
25637,
3097,
368,
341,
262,
24133,
2043,
2271,
486,
931,
46232,
5487,
340,
286,
659,
746,
3097,
15876,
46232,
5487,
11,
16516,
486,
931,
7,
16,
15,
1171,
286,
659,
2207,
18632,
4773,
8378,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_day14_clear_bit() {
assert_eq!(0, clr_bit(1, 0));
assert_eq!(5, clr_bit(5, 1));
assert_eq!(5, clr_bit(7, 1));
} | rust_cleaned_test_functions.jsonl/54733 | {
"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,
16763,
16,
19,
21811,
13996,
368,
341,
286,
2060,
10714,
10297,
15,
11,
62127,
13996,
7,
16,
11,
220,
15,
1106,
286,
2060,
10714,
10297,
20,
11,
62127,
13996,
7,
20,
11,
220,
16,
1106,
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 |
#[test]
fn test_profile() {
lazy_static! {
static ref PROFILED: Mutex<Vec<(String, Duration)>> = Mutex::new(Vec::new());
}
fn profiler(s: &str, d: Duration) {
let mut profiled = PROFILED.lock().unwrap();
profiled.push((s.to_owned(), d));
}
let mut db = Connection::open_in_memory().unwrap();
db.profile(Some(profiler));
db.execute_batch("PRAGMA application_id = 1").unwrap();
db.profile(None);
db.execute_batch("PRAGMA application_id = 2").unwrap();
let profiled = PROFILED.lock().unwrap();
assert_eq!(profiled.len(), 1);
assert_eq!(profiled[0].0, "PRAGMA application_id = 1");
} | rust_cleaned_test_functions.jsonl/32211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13789,
368,
341,
286,
15678,
25360,
0,
341,
310,
1099,
2053,
70950,
35,
25,
66215,
50439,
28706,
703,
11,
21045,
54229,
284,
66215,
486,
931,
49923,
486,
931,
1423,
286,
456,
286,
5168,
87497,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_groupby_sort() {
let df = df! {
"a" => ["a", "b", "a", "b", "b", "c"],
"b" => [1, 2, 3, 4, 5, 6]
}
.unwrap();
let out = df
.clone()
.lazy()
.groupby([col("a")])
.agg([col("b").sort(false).first()])
.collect()
.unwrap()
.sort(["a"], false)
.unwrap();
assert_eq!(
Vec::from(out.column("b").unwrap().i32().unwrap()),
[Some(1), Some(2), Some(6)]
);
let out = df
.lazy()
.groupby([col("a")])
.agg([col("b").sort(false).last()])
.collect()
.unwrap()
.sort(["a"], false)
.unwrap();
assert_eq!(
Vec::from(out.column("b").unwrap().i32().unwrap()),
[Some(3), Some(5), Some(6)]
);
} | rust_cleaned_test_functions.jsonl/140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
6288,
1694,
18435,
368,
341,
262,
1077,
6764,
284,
6764,
0,
341,
286,
330,
64,
1,
589,
4383,
64,
497,
330,
65,
497,
330,
64,
497,
330,
65,
497,
330,
65,
497,
330,
66,
8097,
286,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_public_exponent_1() {
let e: u32 = 600010331;
let n: u32 = 654955584;
let r = compute_public_exponent(e, n);
assert!(r == 4070099);
} | rust_cleaned_test_functions.jsonl/16186 | {
"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,
57028,
27074,
2702,
1146,
62,
16,
368,
341,
286,
1077,
384,
25,
575,
18,
17,
284,
220,
21,
15,
15,
15,
16,
15,
18,
18,
16,
280,
286,
1077,
308,
25,
575,
18,
17,
284,
220,
21,
20,
19,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arena_alloc_nested() {
struct Inner {
value: u8,
}
struct Outer<'a> {
inner: &'a Inner,
}
enum EI<'e> {
I(Inner),
O(Outer<'e>),
}
struct Wrap<'a>(TypedArena<EI<'a>>);
impl<'a> Wrap<'a> {
fn alloc_inner<F: Fn() -> Inner>(&self, f: F) -> &Inner {
let r: &EI = self.0.alloc(EI::I(f()));
if let &EI::I(ref i) = r {
i
} else {
panic!("mismatch");
}
}
fn alloc_outer<F: Fn() -> Outer<'a>>(&self, f: F) -> &Outer {
let r: &EI = self.0.alloc(EI::O(f()));
if let &EI::O(ref o) = r {
o
} else {
panic!("mismatch");
}
}
}
let arena = Wrap(TypedArena::new());
let result = arena.alloc_outer(|| Outer {
inner: arena.alloc_inner(|| Inner { value: 10 }),
});
assert_eq!(result.inner.value, 10);
} | rust_cleaned_test_functions.jsonl/336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 726
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
30527,
14802,
66279,
368,
341,
286,
2036,
36356,
341,
310,
897,
25,
575,
23,
345,
286,
456,
286,
2036,
55197,
18291,
64,
29,
341,
310,
9179,
25,
30136,
64,
36356,
345,
286,
456,
286,
7618,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_reader_content() {
let raw = "
<plist> \
<dict> \
<key>userName</key> \
<string>SOMEUSER</string> \
<key>computerName</key> \
<string>SOMECOMPUTER</string> \
</dict> \
</plist> \
";
let info_res = ComputerInfo::new(Cursor::new(raw.as_bytes()), "someuuid".to_string());
let info = info_res.unwrap();
assert_eq!(info.computer_name, "SOMECOMPUTER");
assert_eq!(info.uuid, "someuuid");
} | rust_cleaned_test_functions.jsonl/86816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
22306,
7495,
368,
341,
286,
1077,
7112,
284,
6228,
27,
39934,
29,
3044,
220,
366,
8477,
29,
3044,
262,
366,
792,
29,
28841,
522,
792,
29,
3044,
262,
366,
917,
25837,
11408,
6448,
522,
91... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slot_hash_expiry() {
solana_logger::setup_with_default(RUST_LOG_FILTER);
solana_sdk::slot_hashes::set_entries_for_tests_only(64);
let slots_per_epoch = 2048;
let node_stakes = vec![60, 40];
let validator_keys = vec![
"28bN3xyvrP4E8LwEgtLjhnkb7cY4amQb6DrYAbAYjgRV4GAGgkVM2K7wnxnAS7WDneuavza7x21MiafLu1HkwQt4",
"2saHBBoTkLMmttmPQP8KfBkcCw45S5cwtV3wTdGCscRC8uxdgvHxpHiWXKx4LvJjNJtnNcbSv5NdheokFFqnNDt8",
]
.iter()
.map(|s| (Arc::new(Keypair::from_base58_string(s)), true))
.collect::<Vec<_>>();
let node_vote_keys = vec![
"3NDQ3ud86RTVg8hTy2dDWnS4P8NfjhZ2gDgQAJbr3heaKaUVS1FW3sTLKA1GmDrY9aySzsa4QxpDkbLv47yHxzr3",
"46ZHpHE6PEvXYPu3hf9iQqjBk2ZNDaJ9ejqKWHEjxaQjpAGasKaWKbKHbP3646oZhfgDRzx95DH9PCBKKsoCVngk",
]
.iter()
.map(|s| Arc::new(Keypair::from_base58_string(s)))
.collect::<Vec<_>>();
let vs = validator_keys
.iter()
.map(|(kp, _)| kp.pubkey())
.collect::<Vec<_>>();
let (a_pubkey, b_pubkey) = (vs[0], vs[1]);
// We want B to not vote (we are trying to simulate its votes not landing until it gets to the
// minority fork)
let mut validator_configs =
make_identical_validator_configs(&ValidatorConfig::default_for_test(), node_stakes.len());
validator_configs[1].voting_disabled = true;
let mut config = ClusterConfig {
cluster_lamports: 100_000,
node_stakes,
validator_configs,
validator_keys: Some(validator_keys),
node_vote_keys: Some(node_vote_keys),
slots_per_epoch,
stakers_slot_offset: slots_per_epoch,
skip_warmup_slots: true,
..ClusterConfig::default()
};
let mut cluster = LocalCluster::new(&mut config, SocketAddrSpace::Unspecified);
let mut common_ancestor_slot = 8;
let a_ledger_path = cluster.ledger_path(&a_pubkey);
let b_ledger_path = cluster.ledger_path(&b_pubkey);
info!("Killing B");
let mut b_info = cluster.exit_node(&b_pubkey);
// Let A run for a while until we get to the common ancestor
info!("Letting A run until common_ancestor_slot");
loop {
if let Some((last_vote, _)) = last_vote_in_tower(&a_ledger_path, &a_pubkey) {
if last_vote >= common_ancestor_slot {
break;
}
}
sleep(Duration::from_millis(100));
}
// doesn't know anything past that)
{
info!("Copying A's ledger to B");
std::fs::remove_dir_all(&b_info.info.ledger_path).unwrap();
let mut opt = fs_extra::dir::CopyOptions::new();
opt.copy_inside = true;
fs_extra::dir::copy(&a_ledger_path, &b_ledger_path, &opt).unwrap();
// remove A's tower in B's new copied ledger
info!("Removing A's tower in B's ledger dir");
remove_tower(&b_ledger_path, &a_pubkey);
// load A's tower and save it as B's tower
info!("Loading A's tower");
if let Some(mut a_tower) = restore_tower(&a_ledger_path, &a_pubkey) {
a_tower.node_pubkey = b_pubkey;
// Update common_ancestor_slot because A is still running
if let Some(s) = a_tower.last_voted_slot() {
common_ancestor_slot = s;
info!("New common_ancestor_slot {}", common_ancestor_slot);
} else {
panic!("A's tower has no votes");
}
info!("Increase lockout by 6 confirmation levels and save as B's tower");
a_tower.increase_lockout(6);
save_tower(&b_ledger_path, &a_tower, &b_info.info.keypair);
info!("B's new tower: {:?}", a_tower.tower_slots());
} else {
panic!("A's tower is missing");
}
// Get rid of any slots past common_ancestor_slot
info!("Removing extra slots from B's blockstore");
let blockstore = open_blockstore(&b_ledger_path);
purge_slots(&blockstore, common_ancestor_slot + 1, 100);
}
info!(
"Run A on majority fork until it reaches slot hash expiry {}",
solana_sdk::slot_hashes::get_entries()
);
let mut last_vote_on_a;
// Keep A running for a while longer so the majority fork has some decent size
loop {
last_vote_on_a = wait_for_last_vote_in_tower_to_land_in_ledger(&a_ledger_path, &a_pubkey);
if last_vote_on_a
>= common_ancestor_slot + 2 * (solana_sdk::slot_hashes::get_entries() as u64)
{
let blockstore = open_blockstore(&a_ledger_path);
info!(
"A majority fork: {:?}",
AncestorIterator::new(last_vote_on_a, &blockstore).collect::<Vec<Slot>>()
);
break;
}
sleep(Duration::from_millis(100));
}
// Kill A and restart B with voting. B should now fork off
info!("Killing A");
let a_info = cluster.exit_node(&a_pubkey);
info!("Restarting B");
b_info.config.voting_disabled = false;
cluster.restart_node(&b_pubkey, b_info, SocketAddrSpace::Unspecified);
// B will fork off and accumulate enough lockout
info!("Allowing B to fork");
loop {
let blockstore = open_blockstore(&b_ledger_path);
let last_vote = wait_for_last_vote_in_tower_to_land_in_ledger(&b_ledger_path, &b_pubkey);
let mut ancestors = AncestorIterator::new(last_vote, &blockstore);
if let Some(index) = ancestors.position(|x| x == common_ancestor_slot) {
if index > 7 {
info!(
"B has forked for enough lockout: {:?}",
AncestorIterator::new(last_vote, &blockstore).collect::<Vec<Slot>>()
);
break;
}
}
sleep(Duration::from_millis(1000));
}
info!("Kill B");
b_info = cluster.exit_node(&b_pubkey);
info!("Resolve the partition");
{
// Here we let B know about the missing blocks that A had produced on its partition
let a_blockstore = open_blockstore(&a_ledger_path);
let b_blockstore = open_blockstore(&b_ledger_path);
copy_blocks(last_vote_on_a, &a_blockstore, &b_blockstore);
}
// Now restart A and B and see if B is able to eventually switch onto the majority fork
info!("Restarting A & B");
cluster.restart_node(&a_pubkey, a_info, SocketAddrSpace::Unspecified);
cluster.restart_node(&b_pubkey, b_info, SocketAddrSpace::Unspecified);
info!("Waiting for B to switch to majority fork and make a root");
cluster_tests::check_for_new_roots(
16,
&[cluster.get_contact_info(&a_pubkey).unwrap().clone()],
"test_slot_hashes_expiry",
);
} | rust_cleaned_test_functions.jsonl/105128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27563,
8950,
96509,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
6615,
9993,
2785,
8553,
8419,
23728,
317,
262,
2048,
3362,
61783,
486,
21537,
91616,
486,
746,
26092,
5478,
32509,
18410,
7,
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... | 8 |
#[test]
fn test_seed_stake_delegation_and_deactivation() {
panoptes_logger::setup();
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let test_validator = TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr));
let rpc_client =
RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed());
let validator_keypair = keypair_from_seed(&[0u8; 32]).unwrap();
let mut config_validator = CliConfig::recent_for_tests();
config_validator.json_rpc_url = test_validator.rpc_url();
config_validator.signers = vec![&validator_keypair];
request_and_confirm_airdrop(
&rpc_client,
&config_validator,
&config_validator.signers[0].pubkey(),
100_000,
)
.unwrap();
check_recent_balance(100_000, &rpc_client, &config_validator.signers[0].pubkey());
let stake_address = Pubkey::create_with_seed(
&config_validator.signers[0].pubkey(),
"hi there",
&stake::program::id(),
)
.expect("bad seed");
// which is nice ;)
config_validator.command = CliCommand::CreateStakeAccount {
stake_account: 0,
seed: Some("hi there".to_string()),
staker: None,
withdrawer: None,
lockup: Lockup::default(),
amount: SpendAmount::Some(50_000),
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
from: 0,
};
process_command(&config_validator).unwrap();
// Delegate stake
config_validator.command = CliCommand::DelegateStake {
stake_account_pubkey: stake_address,
vote_account_pubkey: test_validator.vote_account_address(),
stake_authority: 0,
force: true,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::default(),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
};
process_command(&config_validator).unwrap();
// Deactivate stake
config_validator.command = CliCommand::DeactivateStake {
stake_account_pubkey: stake_address,
stake_authority: 0,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::default(),
nonce_account: None,
nonce_authority: 0,
memo: None,
seed: None,
fee_payer: 0,
};
process_command(&config_validator).unwrap();
} | rust_cleaned_test_functions.jsonl/45360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33809,
1261,
726,
2259,
87566,
8378,
2259,
23002,
368,
341,
262,
7215,
2912,
288,
27413,
486,
15188,
1428,
262,
1077,
28337,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
262,
1077,
28337,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_num_trees() {
assert_eq!(Solution::num_trees(1), 1);
assert_eq!(Solution::num_trees(2), 2);
assert_eq!(Solution::num_trees(3), 5);
} | rust_cleaned_test_functions.jsonl/95109 | {
"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,
4273,
75791,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
2413,
75791,
7,
16,
701,
220,
16,
317,
286,
2060,
10714,
10297,
36842,
486,
2413,
75791,
7,
17,
701,
220,
17,
317,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_repositories() {
run_async_test(async {
ffx_config::set(
(CONFIG_KEY_REPOSITORIES, ConfigLevel::User),
json!({
// Parse a normal repository.
"repo-name": {
"type": "pm",
"path": "foo/bar/baz",
},
"repo%2Ename": {
"type": "pm",
"path": "foo/bar/baz",
},
"repo%25name": {
"type": "pm",
"path": "foo/bar/baz",
},
}),
)
.await
.unwrap();
assert_eq!(
get_repositories().await,
hashmap! {
"repo-name".into() => RepositorySpec::Pm {
path: "foo/bar/baz".into(),
},
"repo.name".into() => RepositorySpec::Pm {
path: "foo/bar/baz".into(),
},
"repo%name".into() => RepositorySpec::Pm {
path: "foo/bar/baz".into(),
},
}
);
});
} | rust_cleaned_test_functions.jsonl/98269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 970
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1288,
17286,
368,
341,
286,
1598,
28346,
4452,
18285,
341,
310,
282,
8298,
5332,
486,
746,
1006,
394,
320,
24652,
6600,
2192,
61943,
42737,
11,
5532,
4449,
486,
1474,
1326,
394,
2951,
0,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_after_editing_end_of_code() {
let mut parser = Parser::new();
parser.set_language(get_language("javascript")).unwrap();
let mut code = b"x * (100 + abc);".to_vec();
let mut tree = parser.parse(&code, None).unwrap();
assert_eq!(
tree.root_node().to_sexp(),
concat!(
"(program (expression_statement (binary_expression ",
"(identifier) ",
"(parenthesized_expression (binary_expression (number) (identifier))))))",
)
);
let position = code.len() - 2;
perform_edit(
&mut tree,
&mut code,
&Edit {
position,
deleted_length: 0,
inserted_text: b".d".to_vec(),
},
);
let mut recorder = ReadRecorder::new(&code);
let tree = parser
.parse_with(&mut |i, _| recorder.read(i), Some(&tree))
.unwrap();
assert_eq!(
tree.root_node().to_sexp(),
concat!(
"(program (expression_statement (binary_expression ",
"(identifier) ",
"(parenthesized_expression (binary_expression (number) (member_expression (identifier) (property_identifier)))))))"
)
);
assert_eq!(recorder.strings_read(), vec![" * ", "abc.d)",]);
} | rust_cleaned_test_functions.jsonl/7387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 590
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
19844,
13156,
287,
6213,
3575,
4136,
368,
341,
262,
1077,
5206,
6729,
284,
21102,
486,
931,
543,
262,
6729,
980,
29021,
5433,
29021,
445,
14073,
15197,
15454,
1428,
262,
1077,
5206,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_instructions_consumption_based_on_data_size_on_system_subnet() {
with_test_replica_logger(|log| {
let subnet_type = SubnetType::System;
let dst: u32 = 0;
let mut payload: Vec<u8> = dst.to_le_bytes().to_vec();
payload.extend(random_payload());
let mut double_size_payload: Vec<u8> = payload.clone();
double_size_payload.extend(random_payload());
let instructions_consumed_without_data = get_num_instructions_consumed(
log.clone(),
"write_bytes",
dst.to_le_bytes().to_vec(),
MAX_NUM_INSTRUCTIONS,
subnet_type,
)
.unwrap();
{
// Number of instructions consumed for copying the payload is zero.
let consumed_instructions = get_num_instructions_consumed(
log.clone(),
"write_bytes",
payload,
MAX_NUM_INSTRUCTIONS,
subnet_type,
)
.unwrap()
- instructions_consumed_without_data;
assert_eq!(consumed_instructions.get(), 0);
}
{
// Number of instructions consumed for copying the payload is zero.
let consumed_instructions = get_num_instructions_consumed(
log,
"write_bytes",
double_size_payload,
MAX_NUM_INSTRUCTIONS,
subnet_type,
)
.unwrap()
- instructions_consumed_without_data;
assert_eq!(consumed_instructions.get(), 0);
}
})
} | rust_cleaned_test_functions.jsonl/72785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1034
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
82427,
69870,
560,
66679,
4470,
1769,
2368,
4470,
17687,
95681,
368,
341,
286,
448,
4452,
25533,
15317,
27413,
22428,
839,
91,
341,
310,
1077,
51457,
1819,
284,
3719,
4711,
929,
486,
2320,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cached_executors_stats() {
#[derive(Debug, Default, PartialEq)]
struct ComparableStats {
hits: u64,
misses: u64,
evictions: HashMap<Pubkey, u64>,
insertions: u64,
replacements: u64,
one_hit_wonders: u64,
}
impl From<&executor_cache::Stats> for ComparableStats {
fn from(stats: &executor_cache::Stats) -> Self {
let executor_cache::Stats {
hits,
misses,
evictions,
insertions,
replacements,
one_hit_wonders,
} = stats;
ComparableStats {
hits: hits.load(Relaxed),
misses: misses.load(Relaxed),
evictions: evictions.clone(),
insertions: insertions.load(Relaxed),
replacements: replacements.load(Relaxed),
one_hit_wonders: one_hit_wonders.load(Relaxed),
}
}
}
const CURRENT_EPOCH: Epoch = 0;
let mut cache = CachedExecutors::new(2, CURRENT_EPOCH);
let mut expected_stats = ComparableStats::default();
let program_id1 = Pubkey::new_unique();
let program_id2 = Pubkey::new_unique();
let executor: Arc<dyn Executor> = Arc::new(TestExecutor {});
// make sure we're starting from where we think we are
assert_eq!(ComparableStats::from(&cache.stats), expected_stats,);
// insert some executors
cache.put(&[(&program_id1, executor.clone())]);
cache.put(&[(&program_id2, executor.clone())]);
expected_stats.insertions += 2;
assert_eq!(ComparableStats::from(&cache.stats), expected_stats);
// replace a one-hit-wonder executor
cache.put(&[(&program_id1, executor.clone())]);
expected_stats.replacements += 1;
expected_stats.one_hit_wonders += 1;
assert_eq!(ComparableStats::from(&cache.stats), expected_stats);
// hit some executors
cache.get(&program_id1);
cache.get(&program_id1);
cache.get(&program_id2);
expected_stats.hits += 3;
assert_eq!(ComparableStats::from(&cache.stats), expected_stats);
// miss an executor
cache.get(&Pubkey::new_unique());
expected_stats.misses += 1;
assert_eq!(ComparableStats::from(&cache.stats), expected_stats);
// evict an executor
cache.put(&[(&Pubkey::new_unique(), executor.clone())]);
expected_stats.insertions += 1;
expected_stats.evictions.insert(program_id2, 1);
assert_eq!(ComparableStats::from(&cache.stats), expected_stats);
// make sure stats are cleared in new_from_parent
assert_eq!(
ComparableStats::from(
&CachedExecutors::new_from_parent_bank_executors(&cache, CURRENT_EPOCH).stats
),
ComparableStats::default()
);
assert_eq!(
ComparableStats::from(
&CachedExecutors::new_from_parent_bank_executors(&cache, CURRENT_EPOCH + 1).stats
),
ComparableStats::default()
);
} | rust_cleaned_test_functions.jsonl/28967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1631
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64369,
18430,
9475,
15381,
368,
341,
286,
11506,
27098,
42618,
11,
7899,
11,
55039,
5563,
286,
2036,
58106,
16635,
341,
310,
12983,
25,
575,
21,
19,
345,
310,
42294,
25,
575,
21,
19,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validating_types() {
assert!(validate_type::<String>(json!("test")).is_some());
assert!(validate_type::<String>(json!(1)).is_none());
assert!(validate_type::<String>(json!(false)).is_none());
assert!(validate_type::<String>(json!(true)).is_none());
assert!(validate_type::<String>(json!({"test": "whatever"})).is_none());
assert!(validate_type::<String>(json!(["test", "test2"])).is_none());
assert!(validate_type::<bool>(json!(true)).is_some());
assert!(validate_type::<bool>(json!(false)).is_some());
assert!(validate_type::<bool>(json!("true")).is_some());
assert!(validate_type::<bool>(json!("false")).is_some());
assert!(validate_type::<bool>(json!(1)).is_none());
assert!(validate_type::<bool>(json!("test")).is_none());
assert!(validate_type::<bool>(json!({"test": "whatever"})).is_none());
assert!(validate_type::<bool>(json!(["test", "test2"])).is_none());
assert!(validate_type::<u64>(json!(2)).is_some());
assert!(validate_type::<u64>(json!(100)).is_some());
assert!(validate_type::<u64>(json!("100")).is_some());
assert!(validate_type::<u64>(json!("0")).is_some());
assert!(validate_type::<u64>(json!(true)).is_none());
assert!(validate_type::<u64>(json!("test")).is_none());
assert!(validate_type::<u64>(json!({"test": "whatever"})).is_none());
assert!(validate_type::<u64>(json!(["test", "test2"])).is_none());
assert!(validate_type::<PathBuf>(json!("/")).is_some());
assert!(validate_type::<PathBuf>(json!("test")).is_some());
assert!(validate_type::<PathBuf>(json!(true)).is_none());
assert!(validate_type::<PathBuf>(json!({"test": "whatever"})).is_none());
assert!(validate_type::<PathBuf>(json!(["test", "test2"])).is_none());
} | rust_cleaned_test_functions.jsonl/10095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 852
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
1095,
9763,
368,
341,
286,
2060,
10297,
7067,
1819,
27638,
703,
2235,
2236,
17223,
1944,
15197,
285,
61855,
1423,
286,
2060,
10297,
7067,
1819,
27638,
703,
2235,
2236,
10297,
16,
4579,
285,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_arg_matches_always() {
let argv = vec!["lsd", "--color", "always"];
let matches = app::build().get_matches_from_safe(argv).unwrap();
assert_eq!(
Some(ColorOption::Always),
ColorOption::from_arg_matches(&matches)
);
} | rust_cleaned_test_functions.jsonl/86426 | {
"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,
5673,
6057,
38344,
8418,
2284,
368,
341,
286,
1077,
10213,
284,
7486,
0,
1183,
4730,
67,
497,
14482,
3423,
497,
330,
32122,
6332,
286,
1077,
9071,
284,
906,
486,
5834,
1005,
455,
38344,
5673,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_persist_last_update_time() {
block_on(async {
let config = config_generator();
let mut state_machine = StateMachine::new_stub(&config, make_test_app_set()).await;
state_machine.start_update_check(CheckOptions::default()).await;
let storage = state_machine.storage_ref.lock().await;
storage.get_int(LAST_UPDATE_TIME).await.unwrap();
assert_eq!(true, storage.committed());
});
} | rust_cleaned_test_functions.jsonl/94229 | {
"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,
620,
4975,
12195,
8882,
3009,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2193,
284,
2193,
25813,
543,
310,
1077,
5206,
1584,
38695,
284,
3234,
21605,
486,
931,
62781,
2099,
1676,
11,
1281,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_paste_2() {
let result = parser(vec![
DeltaOp {
insert: Value::String(String::from("Your import fails because the ")),
attributes: Some(json!({"color": "#242729"})),
},
DeltaOp {
insert: Value::String(String::from("FromStr")),
attributes: Some(
json!({"code": true, "background": "var(--black-075)", "color": "#242729"}),
),
},
DeltaOp {
insert: Value::String(String::from(" trait is now ")),
attributes: Some(json!({"color": "#242729"})),
},
DeltaOp {
insert: Value::String(String::from("std::str::FromStr")),
attributes: Some(json!({
"background": "var(--black-075)",
"code": true,
"color": "var(--black-800)",
"link": "https://doc.rust-lang.org/std/str/trait.FromStr.html"
})),
},
DeltaOp {
insert: Value::String(String::from("\n")),
attributes: None,
},
]);
assert_eq!(result, String::from("<p><span style=\"color: #242729; \">Your import fails because the </span><code style=\"background-color: var(--black-075); color: #242729; \">FromStr</code><span style=\"color: #242729; \"> trait is now </span><a href=\"https://doc.rust-lang.org/std/str/trait.FromStr.html\" rel=\"noopener noreferrer\" target=\"_blank\" title=\"https://doc.rust-lang.org/std/str/trait.FromStr.html\" style=\"background-color: var(--black-075); color: var(--black-800); \"><code>std::str::FromStr</code></a></p>"));
} | rust_cleaned_test_functions.jsonl/33073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 895
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
620,
5525,
62,
17,
368,
341,
1789,
286,
1077,
1102,
284,
6729,
25592,
90515,
310,
24957,
7125,
341,
394,
5656,
25,
5162,
486,
703,
2242,
486,
1499,
445,
7771,
1159,
14525,
1576,
279,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_redundant_conf_change_by_snapshot() {
let mut cluster = new_node_cluster(0, 4);
cluster.cfg.raft_store.raft_log_gc_count_limit = 5;
cluster.cfg.raft_store.merge_max_log_gap = 4;
cluster.cfg.raft_store.raft_log_gc_tick_interval = ReadableDuration::millis(20);
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
// Add voter 2 and learner 3.
cluster.run_conf_change();
pd_client.must_add_peer(1, new_peer(2, 2));
pd_client.must_add_peer(1, new_peer(3, 3));
cluster.must_put(b"k1", b"v1");
must_get_equal(&cluster.get_engine(2), b"k1", b"v1");
must_get_equal(&cluster.get_engine(3), b"k1", b"v1");
fail::cfg("apply_on_conf_change_3_1", "pause").unwrap();
cluster.pd_client.must_add_peer(1, new_peer(4, 4));
let filter = Box::new(
RegionPacketFilter::new(1, 3)
.direction(Direction::Recv)
.msg_type(MessageType::MsgAppend),
);
cluster.sim.wl().add_recv_filter(3, filter);
cluster.pd_client.must_remove_peer(1, new_peer(4, 4));
(0..10).for_each(|_| cluster.must_put(b"k2", b"v2"));
sleep_ms(50);
cluster.sim.wl().clear_recv_filters(3);
sleep_ms(100);
// Use a filter to capture messages sent from 3 to 4.
let (tx, rx) = mpsc::sync_channel(128);
let cb = Arc::new(move |msg: &RaftMessage| {
if msg.get_message().get_to() == 4 {
let _ = tx.send(());
}
}) as Arc<dyn Fn(&RaftMessage) + Send + Sync>;
let filter = Box::new(
RegionPacketFilter::new(1, 3)
.direction(Direction::Send)
.msg_type(MessageType::MsgRequestVote)
.when(Arc::new(AtomicBool::new(false)))
.set_msg_callback(cb),
);
cluster.sim.wl().add_send_filter(3, filter);
fail::cfg("apply_on_conf_change_3_1", "off").unwrap();
cluster.must_transfer_leader(1, new_peer(3, 3));
assert!(rx.try_recv().is_err());
fail::remove("apply_on_conf_change_3_1");
} | rust_cleaned_test_functions.jsonl/23137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 951
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1054,
303,
517,
16059,
15947,
3710,
53265,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
19,
317,
262,
10652,
30481,
13,
2944,
14809,
13,
2944,
5224,
49423,
3180... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_derivative_const() {
for i in 1..255 {
let input = (i as ValueType + 56.0) / 16.3251;
let mut method = TestingMethod::new(i, input).unwrap();
test_const(&mut method, input, 0.0);
}
} | rust_cleaned_test_functions.jsonl/108499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
95930,
13610,
368,
341,
197,
2023,
600,
304,
220,
16,
496,
17,
20,
20,
341,
298,
10217,
1946,
284,
320,
72,
438,
55545,
488,
220,
20,
21,
13,
15,
8,
608,
220,
16,
21,
13,
18,
17,
20,
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... | 2 |
#[test]
fn test_day_12() {
let input = input();
assert_eq!(part_1(&input), 378);
assert_eq!(part_2(&input), 204);
} | rust_cleaned_test_functions.jsonl/16029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
62,
16,
17,
368,
341,
286,
1077,
1946,
284,
1946,
543,
286,
2060,
10714,
10297,
4480,
62,
16,
2099,
1355,
701,
220,
18,
22,
23,
317,
286,
2060,
10714,
10297,
4480,
62,
17,
2099,
1355,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_add_learner() -> Result<()> {
let l = default_logger();
let mut n1 = new_test_raft(1, vec![1], 10, 1, new_storage(), &l);
n1.add_learner(2)?;
assert_eq!(*n1.prs().learner_ids().iter().next().unwrap(), 2);
assert!(n1.prs().learner_ids().contains(&2));
Ok(())
} | rust_cleaned_test_functions.jsonl/30341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
62,
93595,
368,
1464,
5714,
71698,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
308,
16,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
1125,
220,
16,
15,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_empty_fees() {
init!("ledger");
let fees = get_ledger_fees().unwrap();
println!("fees: {}", fees);
::utils::libindy::anoncreds::tests::create_and_write_test_schema(::utils::constants::DEFAULT_SCHEMA_ATTRS);
} | rust_cleaned_test_functions.jsonl/10491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
761,
5516,
368,
341,
286,
2930,
17223,
50704,
797,
286,
1077,
12436,
284,
633,
38367,
1389,
761,
5516,
1005,
15454,
543,
286,
13751,
17223,
1859,
288,
25,
24689,
12436,
317,
286,
3504,
6031... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_append_for_progress_snapshot() {
setup_for_test();
let mut r = new_test_raft(1, vec![1, 2], 10, 1, new_storage());
r.become_candidate();
r.become_leader();
r.read_messages();
r.mut_prs().get_mut(2).unwrap().become_snapshot(10);
for _ in 0..10 {
r.append_entry(&mut [new_entry(0, 0, SOME_DATA)]);
do_send_append(&mut r, 2);
assert_eq!(r.read_messages().len(), 0);
}
} | rust_cleaned_test_functions.jsonl/107142 | {
"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,
13565,
26041,
5478,
27200,
53265,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
1125,
220,
16,
15,
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... | 2 |
#[test]
fn test_set_tsc_khz() {
let kvm = Kvm::new().unwrap();
let vm = kvm.create_vm().unwrap();
let vcpu = vm.create_vcpu(0).unwrap();
let freq = vcpu.get_tsc_khz().unwrap();
if !(kvm.check_extension(Cap::GetTscKhz) && kvm.check_extension(Cap::TscControl)) {
assert!(vcpu.set_tsc_khz(0).is_err());
} else {
assert!(vcpu.set_tsc_khz(freq - 500000).is_ok());
assert_eq!(vcpu.get_tsc_khz().unwrap(), freq - 500000);
assert!(vcpu.set_tsc_khz(freq + 500000).is_ok());
assert_eq!(vcpu.get_tsc_khz().unwrap(), freq + 500000);
}
} | rust_cleaned_test_functions.jsonl/92524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
528,
2388,
4698,
37259,
368,
341,
286,
1077,
94748,
284,
730,
7338,
486,
931,
1005,
15454,
543,
286,
1077,
10995,
284,
94748,
2520,
39008,
1005,
15454,
543,
286,
1077,
348,
16475,
284,
10995... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pragma_repeated_measurement() {
let mut circuit = Circuit::new();
circuit += DefinitionBit::new("ro".to_string(), 1, true);
circuit += PauliX::new(0);
circuit += PragmaRepeatedMeasurement::new("ro".to_string(), 20, Some(HashMap::new()));
let (_b, _f, _c, output_bit_registers, _co) = call_circuit(&circuit, empty_regs(), 2).unwrap();
assert!(output_bit_registers.contains_key("ro"));
let out_reg = output_bit_registers.get("ro").unwrap();
assert_eq!(out_reg.len(), 20);
for reg in out_reg.iter() {
assert_eq!(reg.len(), 2);
assert!(reg[0] || !reg[0]);
assert!(reg[1] || !reg[1]);
}
} | rust_cleaned_test_functions.jsonl/40994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
4101,
1728,
1288,
41954,
87342,
368,
341,
262,
1077,
5206,
16224,
284,
27218,
486,
931,
543,
262,
16224,
1421,
19709,
8344,
486,
931,
445,
299,
3263,
983,
3904,
1507,
220,
16,
11,
830,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_as() {
use glam::DQuat;
assert_approx_eq!(
DQuat::from_rotation_ypr(1.0, 2.0, 3.0),
Quat::from_rotation_ypr(1.0, 2.0, 3.0).as_f64()
);
assert_approx_eq!(
Quat::from_rotation_ypr(1.0, 2.0, 3.0),
DQuat::from_rotation_ypr(1.0, 2.0, 3.0).as_f32()
);
} | rust_cleaned_test_functions.jsonl/64488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
368,
341,
286,
990,
41012,
486,
35,
2183,
266,
280,
286,
2060,
90425,
10714,
33673,
310,
422,
2183,
266,
486,
1499,
44813,
4178,
649,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
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_insert_field_without_name_ref() {
let mut buf = vec![];
InsertWithoutNameRef::new("key", "value")
.encode(&mut buf)
.unwrap();
let mut table = build_table_with_size(0);
let mut enc = Cursor::new(&buf);
let mut dec = vec![];
assert!(on_encoder_recv(&mut table.inserter(), &mut enc, &mut dec).is_ok());
assert_eq!(
table.decoder(1).get_relative(0),
Ok(&HeaderField::new("key", "value"))
);
let mut dec_cursor = Cursor::new(&dec);
assert_eq!(
InsertCountIncrement::decode(&mut dec_cursor),
Ok(Some(InsertCountIncrement(1)))
);
} | rust_cleaned_test_functions.jsonl/37416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
5013,
39904,
1269,
7793,
368,
341,
286,
1077,
5206,
6607,
284,
7486,
0,
15078,
286,
17101,
26040,
675,
3945,
486,
931,
445,
792,
497,
330,
957,
1138,
310,
659,
6180,
2099,
6984,
6607,
340... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_gtest() {
let t = "[ OK ] TestName.Test (115 ms)";
let p = GTestParser {};
let _r = p.try_parse_str(t).unwrap();
// assert_eq!(
// "07-01 14:13:14.446 225 295 I ThermalEngine: Sensor:batt_therm:29000 mC"
} | rust_cleaned_test_functions.jsonl/53440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1889,
1944,
368,
341,
262,
1077,
259,
284,
10545,
981,
10402,
2279,
3393,
675,
8787,
320,
16,
16,
20,
9829,
24023,
262,
1077,
281,
284,
479,
2271,
6570,
9321,
262,
1077,
716,
81,
284,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jmp() {
let mut r = Register::new();
jmp(0x10, &mut r);
assert_eq!(r.get_PC(), 0x10);
} | rust_cleaned_test_functions.jsonl/14229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
1307,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
90369,
7,
15,
87,
16,
15,
11,
609,
6984,
435,
317,
262,
2060,
10714,
10297,
81,
670,
39797,
1507,
220,
15,
87,
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 |
#[test]
fn test_dequeue_is_atomic() {
let mut sender = Sender::open("data/dequeue-is-atomic").unwrap();
let dataset = data_lots_of_data().take(100_000).collect::<Vec<_>>();
futures::executor::block_on(async move {
let mut receiver = Receiver::open("data/dequeue-is-atomic").unwrap();
let dataset_iter = dataset.iter();
let mut i = 0u64;
for data in dataset_iter {
sender.try_send(data).unwrap();
// Try not to poll the future to the end.
// TODO maybe you need something a bit more convincing than
let incomplete =
futures::future::select(Box::pin(receiver.recv()), Box::pin(async {})).await;
drop(incomplete); // need to force this explicitly.
let received = receiver.recv().await.unwrap();
assert_eq!(&*received, data, "at sample {}", i);
i += 1;
received.commit().unwrap();
}
});
} | rust_cleaned_test_functions.jsonl/95821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
4584,
6892,
51367,
368,
341,
286,
1077,
5206,
4646,
284,
54610,
486,
2508,
445,
691,
22549,
4584,
30430,
12,
6618,
1827,
15454,
543,
286,
1077,
10337,
284,
821,
907,
2412,
3575,
1769,
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... | 2 |
#[test]
fn test_buffer_exact_size() {
let mut buffer = [0; 32];
let value = CommandBuilder::create_execute(&mut buffer[..8], true)
.named("+GMR")
.finish()
.unwrap();
assert_eq!(core::str::from_utf8(value).unwrap(), "AT+GMR\r\n");
let value = CommandBuilder::create_set(&mut buffer[..19], true)
.named("+CWRECONNCFG")
.with_int_parameter(15)
.finish()
.unwrap();
assert_eq!(
core::str::from_utf8(value).unwrap(),
"AT+CWRECONNCFG=15\r\n"
);
let value = CommandBuilder::create_query(&mut buffer[..14], true)
.named("+UART_CUR")
.finish()
.unwrap();
assert_eq!(core::str::from_utf8(value).unwrap(), "AT+UART_CUR?\r\n");
} | rust_cleaned_test_functions.jsonl/116954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
71084,
2368,
368,
341,
286,
1077,
5206,
4147,
284,
508,
15,
26,
220,
18,
17,
935,
286,
1077,
897,
284,
7348,
3297,
486,
3182,
44329,
2099,
6984,
4147,
95874,
23,
1125,
830,
340,
310,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_logout_and_recv_logout_with_high_msg_seq_num() {
define_dictionary!(
Heartbeat,
Logon,
Logout,
ResendRequest,
SequenceReset,
TestRequest,
);
//Connect and Logon.
let (mut test_server, mut client, connection) =
TestStream::setup_test_server_and_logon(build_dictionary());
//Begin Logout.
client.logout(connection);
let _ = test_server.recv_message::<Logout>();
//Respond with Logout containing high MsgSeqNum.
let mut message = new_fixt_message!(Logout);
message.msg_seq_num = 15;
test_server.send_message(message);
//Make sure client requests missing messages.
let message = test_server.recv_message::<ResendRequest>();
assert_eq!(message.msg_seq_num, 3);
assert_eq!(message.begin_seq_no, 2);
assert!(message.end_seq_no == 0 || message.end_seq_no == 15);
//Tell client about missing messages.
let mut message = new_fixt_message!(SequenceReset);
message.gap_fill_flag = true;
message.msg_seq_num = 2;
message.new_seq_no = 16;
test_server.send_message(message);
let _ = engine_poll_message!(client, connection, SequenceReset);
//Make sure client automatically attempts to logout again after being caught up.
let _ = test_server.recv_message::<Logout>();
//Finish logging out cleanly.
let mut message = new_fixt_message!(Logout);
message.msg_seq_num = 16;
test_server.send_message(message);
engine_poll_event!(client,EngineEvent::ConnectionTerminated(terminated_connection,reason) => {
assert_eq!(terminated_connection,connection);
assert!(if let ConnectionTerminatedReason::LocalRequested = reason { true } else { false });
});
} | rust_cleaned_test_functions.jsonl/21 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
69386,
8378,
36118,
69386,
6615,
22680,
6483,
14486,
4273,
368,
341,
262,
6979,
42605,
33673,
286,
17965,
22227,
345,
286,
2835,
263,
345,
286,
46285,
345,
286,
1800,
408,
1900,
345,
286,
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... | 3 |
#[test]
fn test_param_spec_int_builder() {
let pspec = ParamSpecInt::builder("name")
.blurb("Simple int parameter")
.minimum(-2)
.build();
assert_eq!(pspec.name(), "name");
assert_eq!(pspec.nick(), "name");
assert_eq!(pspec.blurb(), "Simple int parameter");
assert_eq!(pspec.flags(), ParamFlags::READWRITE);
} | rust_cleaned_test_functions.jsonl/116384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
13594,
4042,
28532,
368,
341,
286,
1077,
4726,
992,
284,
6991,
8327,
1072,
486,
17850,
445,
606,
1138,
310,
659,
2024,
9048,
445,
16374,
526,
5733,
1138,
310,
659,
37988,
4080,
17,
340,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolving_multiple_deps() {
let mut reg = registry(vec!(pkg!("foo"), pkg!("bar"), pkg!("baz")));
let res = resolve(pkg_id("root"), vec![dep("foo"), dep("baz")],
&mut reg).unwrap();
assert_that(&res, contains(names(["root", "foo", "baz"])).exactly());
} | rust_cleaned_test_functions.jsonl/34731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
19648,
45233,
76489,
368,
341,
262,
1077,
5206,
1217,
284,
19424,
25592,
10297,
30069,
17223,
7975,
3975,
24793,
17223,
2257,
3975,
24793,
17223,
42573,
17621,
262,
1077,
592,
284,
8830,
68780,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_per_step() {
let test_rate = |items_per_second| {
let mut est = Estimate::new();
let mut current_time = est.start_time;
let mut current_value = 0;
for _ in 0..est.buf.len() {
current_value += items_per_second;
current_time += Duration::from_secs(1);
est.record_step(current_value, current_time);
}
let avg_seconds_per_step = est.seconds_per_step();
assert!(avg_seconds_per_step > 0.0);
assert!(avg_seconds_per_step.is_finite());
let expected_rate = 1.0 / items_per_second as f64;
let absolute_error = (avg_seconds_per_step - expected_rate).abs();
assert!(
absolute_error < f64::EPSILON,
"Expected rate: {}, actual: {}, absolute error: {}",
expected_rate,
avg_seconds_per_step,
absolute_error
);
};
test_rate(1);
test_rate(1_000);
test_rate(1_000_000);
test_rate(1_000_000_000);
test_rate(1_000_000_001);
test_rate(100_000_000_000);
test_rate(1_000_000_000_000);
test_rate(100_000_000_000_000);
test_rate(1_000_000_000_000_000);
} | rust_cleaned_test_functions.jsonl/123005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 719
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
5678,
11946,
368,
341,
286,
1077,
1273,
9246,
284,
760,
3615,
5678,
29644,
91,
341,
310,
1077,
5206,
1788,
284,
72715,
486,
931,
543,
310,
1077,
5206,
1482,
3009,
284,
1788,
4962,
3009,
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... | 2 |
#[test]
fn test_set_outpoints_partial_claiming() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 59000000, InitFeatures::supported(), InitFeatures::supported());
let payment_preimage_1 = route_payment(&nodes[1], &vec!(&nodes[0])[..], 3_000_000).0;
let payment_preimage_2 = route_payment(&nodes[1], &vec!(&nodes[0])[..], 3_000_000).0;
let remote_txn = nodes[1].node.channel_state.lock().unwrap().by_id.get_mut(&chan.2).unwrap().channel_monitor().get_latest_local_commitment_txn();
assert_eq!(remote_txn.len(), 3);
assert_eq!(remote_txn[0].output.len(), 4);
assert_eq!(remote_txn[0].input.len(), 1);
assert_eq!(remote_txn[0].input[0].previous_output.txid, chan.3.txid());
check_spends!(remote_txn[1], remote_txn[0].clone());
check_spends!(remote_txn[2], remote_txn[0].clone());
// Connect blocks on node A to advance height towards TEST_FINAL_CLTV
let prev_header_100 = connect_blocks(&nodes[1].block_notifier, 100, 0, false, Default::default());
// Provide node A with both preimage
nodes[0].node.claim_funds(payment_preimage_1, 3_000_000);
nodes[0].node.claim_funds(payment_preimage_2, 3_000_000);
check_added_monitors!(nodes[0], 2);
nodes[0].node.get_and_clear_pending_events();
nodes[0].node.get_and_clear_pending_msg_events();
// Connect blocks on node A commitment transaction
let header = BlockHeader { version: 0x20000000, prev_blockhash: prev_header_100, merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
nodes[0].block_notifier.block_connected(&Block { header, txdata: vec![remote_txn[0].clone()] }, 101);
// Verify node A broadcast tx claiming both HTLCs
{
let mut node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(node_txn.len(), 4);
check_spends!(node_txn[0], remote_txn[0].clone());
check_spends!(node_txn[1], chan.3.clone());
check_spends!(node_txn[2], node_txn[1]);
check_spends!(node_txn[3], node_txn[1]);
assert_eq!(node_txn[0].input.len(), 2);
node_txn.clear();
}
nodes[0].node.get_and_clear_pending_msg_events();
// Connect blocks on node B
connect_blocks(&nodes[1].block_notifier, 135, 0, false, Default::default());
// Verify node B broadcast 2 HTLC-timeout txn
let partial_claim_tx = {
let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(node_txn.len(), 3);
check_spends!(node_txn[1], node_txn[0].clone());
check_spends!(node_txn[2], node_txn[0].clone());
assert_eq!(node_txn[1].input.len(), 1);
assert_eq!(node_txn[2].input.len(), 1);
node_txn[1].clone()
};
nodes[1].node.get_and_clear_pending_msg_events();
let header = BlockHeader { version: 0x20000000, prev_blockhash: header.bitcoin_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
nodes[0].block_notifier.block_connected(&Block { header, txdata: vec![partial_claim_tx.clone()] }, 102);
{
let mut node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(node_txn.len(), 1);
check_spends!(node_txn[0], remote_txn[0].clone());
assert_eq!(node_txn[0].input.len(), 1); //dropped HTLC
node_txn.clear();
}
nodes[0].node.get_and_clear_pending_msg_events();
nodes[0].block_notifier.block_disconnected(&header, 102);
{
let mut node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(node_txn.len(), 1);
check_spends!(node_txn[0], remote_txn[0].clone());
assert_eq!(node_txn[0].input.len(), 2); //resurrected HTLC
node_txn.clear();
}
//// Disconnect one more block and then reconnect multiple no transaction should be generated
nodes[0].block_notifier.block_disconnected(&header, 101);
connect_blocks(&nodes[1].block_notifier, 15, 101, false, prev_header_100);
{
let mut node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(node_txn.len(), 0);
node_txn.clear();
}
} | rust_cleaned_test_functions.jsonl/28350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1671
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
6068,
7706,
52068,
84969,
287,
368,
341,
49106,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1855,
5084,
18343,
82,
7,
17,
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_ts_set() {
let s = TsSet::new(vec![]);
assert_eq!(s, TsSet::Empty);
assert!(!s.contains(1.into()));
let s = TsSet::vec(vec![]);
assert_eq!(s, TsSet::Empty);
let s = TsSet::from_u64s(vec![1, 2]);
assert_eq!(s, TsSet::Vec(vec![1.into(), 2.into()].into()));
assert!(s.contains(1.into()));
assert!(s.contains(2.into()));
assert!(!s.contains(3.into()));
let s2 = TsSet::vec(vec![1.into(), 2.into()]);
assert_eq!(s2, s);
let big_ts_list: Vec<TimeStamp> =
(0..=TS_SET_USE_VEC_LIMIT as u64).map(Into::into).collect();
let s = TsSet::new(big_ts_list.clone());
assert_eq!(
s,
TsSet::Set(Arc::new(big_ts_list.clone().into_iter().collect()))
);
assert!(s.contains(1.into()));
assert!(s.contains((TS_SET_USE_VEC_LIMIT as u64).into()));
assert!(!s.contains((TS_SET_USE_VEC_LIMIT as u64 + 1).into()));
let s = TsSet::vec(big_ts_list.clone());
assert_eq!(s, TsSet::Vec(big_ts_list.into()));
} | rust_cleaned_test_functions.jsonl/31983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 607
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25023,
2602,
368,
341,
286,
1077,
274,
284,
25076,
1649,
486,
931,
25592,
0,
56703,
286,
2060,
10714,
10297,
82,
11,
25076,
1649,
486,
3522,
317,
286,
2060,
0,
3471,
82,
8786,
7,
16,
39860,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_root_print() {
let template = compile("{ @root }");
let context = "Hello World!";
let context = ::serde_json::to_value(&context).unwrap();
let template_registry = other_templates();
let formatter_registry = formatters();
let string = template
.render(&context, &template_registry, &formatter_registry)
.unwrap();
assert_eq!("Hello World!", &string);
} | rust_cleaned_test_functions.jsonl/76686 | {
"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,
12993,
10064,
368,
341,
286,
1077,
3811,
284,
19192,
13976,
569,
2888,
335,
797,
286,
1077,
2266,
284,
330,
9707,
4337,
26782,
286,
1077,
2266,
284,
3504,
47024,
9455,
486,
983,
3142,
2099,
2147,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hypergeometric_invalid_params() {
assert!(Hypergeometric::new(100, 101, 5).is_err());
assert!(Hypergeometric::new(100, 10, 101).is_err());
assert!(Hypergeometric::new(100, 101, 101).is_err());
assert!(Hypergeometric::new(100, 10, 5).is_ok());
} | rust_cleaned_test_functions.jsonl/133920 | {
"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,
93416,
709,
23375,
31433,
6745,
368,
341,
286,
2060,
10297,
73946,
709,
23375,
486,
931,
7,
16,
15,
15,
11,
220,
16,
15,
16,
11,
220,
20,
568,
285,
9266,
1423,
286,
2060,
10297,
73946,
709,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rlp_list_length_overflow() {
let data: Vec<u8> = vec![0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00];
let rlp = Rlp::new(&data);
let as_val: Result<String, DecoderError> = rlp.val_at(0);
assert_eq!(Err(DecoderError::RlpIsTooShort), as_val);
} | rust_cleaned_test_functions.jsonl/96997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
13545,
2019,
5118,
79073,
368,
341,
10217,
821,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
9020,
11,
220,
15,
9020,
11,
220,
15,
9020,
11,
220,
15,
9020,
11,
220,
15,
9020,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_point_addition_too_many_points() -> std::result::Result<(), PrecompileFailure> {
let mut input = vec![];
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
input.extend_from_slice(&constants::RISTRETTO_BASEPOINT_POINT.compress().to_bytes());
let cost: u64 = 1;
match Curve25519Add::execute(&input, cost) {
Ok((_, _out)) => {
panic!("Test not expected to work");
}
Err(e) => {
assert_eq!(
e,
PrecompileFailure::Error {
exit_status: ExitError::Other(
"input cannot be greater than 320 bytes (10 compressed points)".into()
)
}
);
Ok(())
}
}
} | rust_cleaned_test_functions.jsonl/59619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 639
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
2891,
680,
2346,
78,
22101,
12928,
368,
1464,
1460,
486,
1382,
486,
2077,
68843,
4968,
20433,
17507,
29,
341,
197,
10217,
5206,
1946,
284,
7486,
0,
15078,
197,
22427,
15831,
5673,
26488,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_deserialize_transaction_bad() {
let serialized_bad = vec![0u8; 3];
let deserialized;
unsafe {
deserialized = deserialize_transaction(serialized_bad.as_ptr(), serialized_bad.len());
}
assert_eq!(deserialized, ptr::null_mut());
} | rust_cleaned_test_functions.jsonl/121327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
28884,
34199,
368,
341,
286,
1077,
32916,
34199,
284,
7486,
20703,
15,
84,
23,
26,
220,
18,
935,
286,
1077,
939,
67577,
280,
286,
19860,
341,
310,
939,
67577,
284,
35240,
28884,
294... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_to_u32() {
let a = [0x12u8, 0x34, 0x56, 0x78];
let x = array_to_u32(&a);
assert_eq!(x, 0x78563412);
} | rust_cleaned_test_functions.jsonl/40665 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
2346,
7300,
18,
17,
368,
341,
262,
1077,
264,
284,
508,
15,
87,
16,
17,
84,
23,
11,
220,
15,
87,
18,
19,
11,
220,
15,
87,
20,
21,
11,
220,
15,
87,
22,
23,
4821,
262,
1077,
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_request_from_settings() {
const NIGHT_MODE_ENABLED: bool = true;
let mut night_mode_settings = NightModeSettings::EMPTY;
night_mode_settings.night_mode_enabled = Some(NIGHT_MODE_ENABLED);
let request = to_request(night_mode_settings);
let mut night_mode_info = NightModeInfo::empty();
night_mode_info.night_mode_enabled = Some(NIGHT_MODE_ENABLED);
assert_eq!(request, Request::SetNightModeInfo(night_mode_info));
} | rust_cleaned_test_functions.jsonl/27934 | {
"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,
7893,
5673,
10853,
368,
341,
286,
733,
75031,
8414,
29276,
25,
1807,
284,
830,
401,
286,
1077,
5206,
3729,
7302,
10853,
284,
12826,
3636,
6086,
486,
32858,
280,
286,
3729,
7302,
10853,
1253,
491,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_channel_name() {
assert_eq!(Channel::Group(group()).name(), Some("a group"));
let mut group_no_name = group();
group_no_name.name = None;
assert!(Channel::Group(group_no_name).name().is_none());
assert_eq!(
Channel::Guild(GuildChannel::Category(guild_category())).name(),
Some("category")
);
assert_eq!(
Channel::Guild(GuildChannel::Text(guild_text())).name(),
Some("text")
);
assert_eq!(
Channel::Guild(GuildChannel::Voice(guild_voice())).name(),
Some("voice")
);
assert_eq!(
Channel::Guild(GuildChannel::Stage(guild_stage())).name(),
Some("stage")
);
assert!(Channel::Private(private()).name().is_none());
} | rust_cleaned_test_functions.jsonl/54432 | {
"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,
14571,
1269,
368,
341,
286,
2060,
10714,
10297,
9629,
486,
2808,
17690,
6011,
606,
1507,
4329,
445,
64,
1874,
4010,
286,
1077,
5206,
1874,
6536,
1269,
284,
1874,
543,
286,
1874,
6536,
1269,
2644,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pinned_version_channel() {
let test_cases = [
("stable", false),
("latest", false),
("dev", false),
("X.Y.Z", true),
("f.l.u.v.i.o", true),
];
for case in test_cases {
assert_eq!(is_pinned_version_channel(case.0), case.1);
}
} | rust_cleaned_test_functions.jsonl/40586 | {
"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,
6892,
620,
20561,
9438,
14571,
368,
341,
286,
1077,
1273,
41427,
284,
2278,
310,
3489,
27992,
497,
895,
1326,
310,
3489,
19350,
497,
895,
1326,
310,
3489,
3583,
497,
895,
1326,
310,
3489,
55,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_call_hierarchy_in_different_files() {
check_hierarchy(
r#"
//- /lib.rs
mod foo;
use foo::callee;
fn caller() {
call<|>ee();
}
//- /foo/mod.rs
pub fn callee() {}
"#,
"callee FN_DEF FileId(2) [0; 18) [7; 13)",
&["caller FN_DEF FileId(1) [26; 55) [29; 35) : [[44; 50)]"],
&[],
);
} | rust_cleaned_test_functions.jsonl/35204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
95043,
1243,
82741,
10931,
368,
341,
286,
1779,
95043,
1006,
310,
435,
2,
698,
310,
78406,
608,
2740,
25638,
198,
310,
1463,
15229,
280,
310,
990,
15229,
486,
86476,
401,
310,
5168,
19865,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nocurses_just_press_enter() -> Result<()> {
let mut p = spawn_bash(Some(20))?;
p.execute(&prompt_string_nocurses(), "Select a network")?;
p.send_line(" ")?;
p.exp_string("Patrician Pad")?;
p.wait_for_prompt()?;
Ok(())
} | rust_cleaned_test_functions.jsonl/87582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
509,
56857,
62,
4250,
38938,
37480,
368,
1464,
5714,
71698,
341,
262,
1077,
5206,
281,
284,
18042,
880,
988,
65405,
7,
17,
15,
593,
37445,
262,
281,
7769,
2099,
40581,
3904,
1089,
509,
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... | 6 |
#[test]
fn test_el_attr_id() {
let doc = Document::from("<a class='link' id=linkilink>hi there</a>");
let sel = doc.select("a");
let el = sel.first().unwrap();
assert_eq!(el.attr("id"), Some("linkilink".to_string()));
} | rust_cleaned_test_functions.jsonl/66009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21602,
10422,
842,
368,
341,
286,
1077,
4629,
284,
11789,
486,
1499,
9639,
64,
536,
1131,
2080,
6,
877,
28,
2080,
321,
766,
29,
6023,
1052,
522,
64,
15084,
286,
1077,
11806,
284,
4629,
9712,
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_str() {
let selections = &[
"Ice Cream",
"Vanilla Cupcake",
"Chocolate Muffin",
"A Pile of sweet, sweet mustard",
];
assert_eq!(
Select::new().default(0).items(&selections[..]).items,
selections
);
} | rust_cleaned_test_functions.jsonl/17346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
368,
341,
286,
1077,
37399,
284,
609,
9640,
310,
330,
51330,
29700,
756,
310,
330,
45224,
6241,
10861,
47384,
756,
310,
330,
92964,
386,
1362,
258,
756,
310,
330,
32,
393,
457,
315,
10226,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_allowed_domains() {
setup_tests(
Some(vec![
"https://api.brigade.sh".to_string(),
"https://postman-echo.com".to_string(),
]),
None,
);
} | rust_cleaned_test_functions.jsonl/75796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
42155,
70199,
368,
341,
286,
6505,
32509,
1006,
310,
4329,
25592,
90515,
394,
330,
2428,
1110,
2068,
948,
14408,
1021,
2395,
3263,
983,
3904,
3148,
394,
330,
2428,
1110,
2203,
1515,
12,
3047... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stamper() {
let stamper = Stamper::new(7u64);
assert_eq!(stamper.stamp(), 7u64);
assert_eq!(stamper.stamp(), 8u64);
let stamper_clone = stamper.clone();
assert_eq!(stamper.stamp(), 9u64);
assert_eq!(stamper.stamp(), 10u64);
assert_eq!(stamper_clone.stamp(), 11u64);
} | rust_cleaned_test_functions.jsonl/90953 | {
"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,
1261,
309,
712,
368,
341,
286,
1077,
357,
309,
712,
284,
68080,
712,
486,
931,
7,
22,
84,
21,
19,
317,
286,
2060,
10714,
10297,
267,
309,
712,
91596,
1507,
220,
22,
84,
21,
19,
317,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply_unattributed_TuringString_with_string_value() {
let mut cc = ConjoiningGerunds::default();
let schemaReplicant = SchemaReplicant::default();
let x = ToUpper::from_valid_name("?x");
let knownCauset = KnownCauset::for_schemaReplicant(&schemaReplicant);
cc.apply_parsed_TuringString(knownCauset, TuringString {
source: None,
instanton: TuringStringNonValuePlace::ToUpper(x.clone()),
attribute: TuringStringNonValuePlace::Placeholder,
value: TuringStringValuePlace::Constant("hello".into()),
causetx: TuringStringNonValuePlace::Placeholder,
});
let d0_e = QualifiedAlias::new("all_Causets00".to_string(), CausetsCausetIndex::Instanton);
let d0_v = QualifiedAlias::new("all_Causets00".to_string(), CausetsCausetIndex::Value);
assert!(!cc.is_known_empty());
assert_eq!(cc.from, vec![SourceAlias(CausetsBlock::AllCausets, "all_Causets00".to_string())]);
// ?x must be a ref.
assert_eq!(cc.known_type(&x).unwrap(), MinkowskiValueType::Ref);
assert_eq!(cc.CausetIndex_ConstrainedEntss.get(&x).unwrap(), &vec![d0_e.clone()]);
// Our 'where' gerunds are two:
// - Causets0.v = 'hello'
// - Causets0.value_type_tag = string
// TODO: implement expand_type_tags.
assert_eq!(cc.wheres, vec![
CausetIndexConstraint::Equals(d0_v, CausetQValue::MinkowskiType(MinkowskiType::typed_string("hello"))),
CausetIndexConstraint::has_unit_type("all_Causets00".to_string(), MinkowskiValueType::String),
].into());
} | rust_cleaned_test_functions.jsonl/32591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 777
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
4907,
44113,
2774,
1139,
1677,
703,
6615,
3904,
3142,
368,
341,
286,
1077,
5206,
12527,
284,
1200,
65205,
65397,
42950,
486,
2258,
543,
286,
1077,
10802,
18327,
35237,
284,
12539,
18327,
3523... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffered_writer_inner_flushes() {
let mut w = BufferedWriter::with_capacity(3, MemWriter::new());
w.write([0, 1]).unwrap();
assert_eq!(&[], w.get_ref().get_ref());
let w = w.unwrap();
assert_eq!(&[0, 1], w.get_ref());
} | rust_cleaned_test_functions.jsonl/115533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
291,
28908,
34345,
39213,
288,
368,
341,
286,
1077,
5206,
289,
284,
63129,
486,
4197,
35603,
7,
18,
11,
13550,
6492,
486,
931,
1423,
286,
289,
3836,
2561,
15,
11,
220,
16,
10697,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_paths() {
assert_eq!(Solution::find_paths(2, 2, 2, 0, 0), 6);
assert_eq!(Solution::find_paths(1, 3, 3, 0, 1), 12);
} | rust_cleaned_test_functions.jsonl/10410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
24152,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
3903,
24152,
7,
17,
11,
220,
17,
11,
220,
17,
11,
220,
15,
11,
220,
15,
701,
220,
21,
317,
286,
2060,
10714,
10297,
36842,
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_cache() {
let cached = PathBuf::from("test-spirv/test-macro.vert.spv");
if cached.exists() {
std::fs::remove_file(&cached).unwrap();
}
let mut compiler = CompilerBuilder::new()
.with_include_dir("test-spirv")
.with_macro("MY_MACRO", Some("1"))
.build()
.unwrap();
let result =
compiler.compile_from_file("test-spirv/test-macro.vert", ShaderKind::Vertex, true);
assert!(result.is_ok());
assert!(cached.exists());
// Cleanup
std::fs::remove_file(cached).unwrap();
} | rust_cleaned_test_functions.jsonl/24872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11529,
368,
341,
286,
1077,
20579,
284,
7933,
15064,
486,
1499,
445,
1944,
1331,
5565,
85,
12697,
1448,
49507,
57765,
8572,
85,
797,
286,
421,
20579,
12076,
368,
341,
310,
1460,
486,
3848,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_raw_colocated() {
let hw = RefCell::new(CpuHardware::new());
unsafe {
let buf1 = Buffer::raw(&hw, 1);
let buf2 = Buffer::raw_colocated(&buf1, 2);
assert!(ptr::eq(buf2.hardware, &hw));
assert_eq!(buf2.size, 2);
assert!(!ptr::eq(buf2.handle, buf1.handle));
}
} | rust_cleaned_test_functions.jsonl/78619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
10211,
509,
657,
368,
341,
286,
1077,
31256,
284,
8550,
3599,
486,
931,
3025,
5584,
66862,
486,
931,
1423,
286,
19860,
341,
310,
1077,
6607,
16,
284,
10312,
486,
1041,
2099,
27827,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_option() {
let decoder = EventsDecoder::<TestRuntime>::new(
Metadata::default(),
EventTypeRegistry::new(),
);
let value = Some(0u8);
let input = value.encode();
let mut output = Vec::<u8>::new();
let mut errors = Vec::<RuntimeError>::new();
decoder
.decode_raw_bytes(
&[EventArg::Option(Box::new(EventArg::Primitive(
"u8".to_string(),
)))],
&mut &input[..],
&mut output,
&mut errors,
)
.unwrap();
assert_eq!(output, vec![1, 0]);
} | rust_cleaned_test_functions.jsonl/14533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
9672,
368,
341,
286,
1077,
24551,
284,
17627,
20732,
27638,
2271,
15123,
6831,
931,
1006,
310,
33589,
486,
2258,
3148,
310,
63128,
15603,
486,
931,
3148,
286,
3475,
286,
1077,
897,
284,
432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize() {
let message = Message::default();
let versioned_msg = VersionedMessage::V0(message.clone());
assert_eq!(message.serialize(), versioned_msg.serialize());
} | rust_cleaned_test_functions.jsonl/94120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
368,
341,
286,
1077,
1943,
284,
4856,
486,
2258,
543,
286,
1077,
2319,
291,
6483,
284,
6079,
291,
2052,
486,
53,
15,
7333,
15997,
1423,
286,
2060,
10714,
10297,
1994,
33969,
1507,
2319,
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 |
#[test]
fn test_bare_array_qualified_property_trailing_dot_is_not_allowed() {
let input = "A(1).Suit$.";
let eol_reader = EolReader::from(input);
let mut parser = word_p();
let (_, err) = parser.parse(eol_reader).expect_err("Should not parse");
assert_eq!(err, QError::syntax_error("Expected: end of name expr"));
} | rust_cleaned_test_functions.jsonl/102689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
546,
3858,
62,
36335,
16638,
3547,
14277,
30941,
6892,
7913,
42155,
368,
341,
503,
1077,
1946,
284,
330,
32,
7,
16,
568,
62898,
12947,
876,
503,
1077,
384,
337,
22306,
284,
468,
337,
5062,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fn_from_latin_gost779b_ua_1() {
assert_eq!(
Gost779B::new(Language::Ua).from_latin(TRANSLIT_UA),
SOURCE_UA
);
} | rust_cleaned_test_functions.jsonl/76343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
5673,
907,
14768,
1889,
535,
22,
22,
24,
65,
62,
4284,
62,
16,
368,
341,
262,
2060,
10714,
33673,
286,
479,
535,
22,
22,
24,
33,
486,
931,
83670,
486,
52,
64,
568,
1499,
907,
14768,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_test_success() {
let test = Patch::Test {
value: json!(123),
path: Path::new("/a/b"),
};
let root = json!({
"a": {
"b": 123,
"c": 234,
},
"b": [1],
});
apply_single(root, test).unwrap();
} | rust_cleaned_test_functions.jsonl/52519 | {
"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,
4452,
18632,
368,
341,
286,
1077,
1273,
284,
30412,
486,
2271,
341,
310,
897,
25,
2951,
10297,
16,
17,
18,
1326,
310,
1815,
25,
7933,
486,
931,
4283,
64,
3470,
4461,
286,
3634,
286,
1077,
3704... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_updates_not_fast_forward_with_force() {
let settings = testutils::user_settings();
let temp_dir = tempfile::tempdir().unwrap();
let mut setup = set_up_push_repos(&settings, &temp_dir);
let mut tx = setup.jj_repo.start_transaction("test");
let new_commit =
testutils::create_random_commit(&settings, &setup.jj_repo).write_to_repo(tx.mut_repo());
setup.jj_repo = tx.commit();
let result = git::push_updates(
&setup.jj_repo.store().git_repo().unwrap(),
"origin",
&[GitRefUpdate {
qualified_name: "refs/heads/main".to_string(),
force: true,
new_target: Some(new_commit.id().clone()),
}],
);
assert_eq!(result, Ok(()));
// Check that the ref got updated in the source repo
let source_repo = git2::Repository::open(&setup.source_repo_dir).unwrap();
let new_target = source_repo
.find_reference("refs/heads/main")
.unwrap()
.target();
let new_oid = Oid::from_bytes(new_commit.id().as_bytes()).unwrap();
assert_eq!(new_target, Some(new_oid));
} | rust_cleaned_test_functions.jsonl/96074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
57829,
7913,
35743,
32121,
6615,
40739,
368,
341,
262,
1077,
5003,
284,
1273,
6031,
486,
872,
10853,
543,
262,
1077,
2730,
4334,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_circuit_empty_service_id() {
let state = setup_splinter_state();
let peer_connector = setup_peer_connector();
let orchestrator = setup_orchestrator();
// set up key registry
let mut key_registry = StorageKeyRegistry::new("memory".to_string()).unwrap();
let key_info = KeyInfo::builder(b"test_signer_a".to_vec(), "node_a".to_string()).build();
key_registry.save_key(key_info).unwrap();
let admin_shared = AdminServiceShared::new(
"node_a".into(),
orchestrator,
peer_connector,
Box::new(MockAuthInquisitor),
state,
Box::new(HashVerifier),
Box::new(key_registry),
Box::new(AllowAllKeyPermissionManager),
"memory",
)
.unwrap();
let mut circuit = setup_test_circuit();
let mut service_ = SplinterService::new();
service_.set_service_id("".to_string());
service_.set_service_type("type_a".to_string());
service_.set_allowed_nodes(RepeatedField::from_vec(vec!["node_a".to_string()]));
circuit.set_roster(RepeatedField::from_vec(vec![service_]));
if let Ok(_) = admin_shared.validate_create_circuit(&circuit, b"test_signer_a", "node_a") {
panic!("Should have been invalid due to service's id being empty");
}
} | rust_cleaned_test_functions.jsonl/124171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 642
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
666,
37268,
15124,
12267,
842,
368,
341,
286,
1077,
1584,
284,
6505,
643,
500,
2245,
4387,
543,
286,
1077,
14397,
76393,
284,
6505,
45159,
76393,
543,
286,
1077,
65128,
850,
284,
6505,
8734... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_network_handshake() {
let first = "127.0.0.1:17230".parse().unwrap();
let second = "127.0.0.1:17231".parse().unwrap();
let e1 = TestEvents::with_addr(first);
let e2 = TestEvents::with_addr(second);
let c1 = connect_message(first);
let c2 = connect_message(second);
let mut e1 = e1.spawn();
let mut e2 = e2.spawn();
e1.connect_with(second);
assert_eq!(e2.wait_for_connect(), c1);
e2.connect_with(first);
assert_eq!(e1.wait_for_connect(), c2);
e1.disconnect_with(second);
assert_eq!(e1.wait_for_disconnect(), second);
e2.disconnect_with(first);
assert_eq!(e2.wait_for_disconnect(), first);
} | rust_cleaned_test_functions.jsonl/76323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
23194,
29661,
368,
341,
262,
1077,
1156,
284,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
16,
22,
17,
18,
15,
3263,
6400,
1005,
15454,
543,
262,
1077,
2086,
284,
330,
16,
17,
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_else_edit_after_if() {
check_edit(
"else",
r#"fn quux() { if true { () } $0 }"#,
r#"fn quux() { if true { () } else {
$0
} }"#,
);
} | rust_cleaned_test_functions.jsonl/33421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62628,
13156,
19844,
11119,
368,
341,
286,
1779,
13156,
1006,
310,
330,
1503,
756,
310,
435,
55543,
8822,
922,
2200,
368,
314,
421,
830,
314,
1719,
335,
400,
15,
335,
57676,
345,
310,
435,
55543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bool_set() {
{
let bs = BoolSet::<&str>::new_with_default(true);
assert_eq!(bs.get("a"), true);
}
{
let bs = BoolSet::<&str>::new_with_default(false);
assert_eq!(bs.get("a"), false);
}
{
let mut bs = BoolSet::<&str>::new_with_default(true);
bs.insert("a", true);
assert_eq!(bs.get("a"), true);
assert_eq!(bs.get("b"), true);
}
{
let mut bs = BoolSet::<&str>::new_with_default(false);
bs.insert("a", true);
assert_eq!(bs.get("a"), true);
assert_eq!(bs.get("b"), false);
}
{
let mut bs = BoolSet::<&str>::new_with_default(false);
bs.insert("a", true);
assert_eq!(bs.get("a"), true);
assert_eq!(bs.get("b"), false);
let mut other = BoolSet::<&str>::new_with_default(false);
other.insert("a", false);
other.insert("b", true);
bs.update(&other);
assert_eq!(bs.get("a"), false);
assert_eq!(bs.get("b"), true);
}
} | rust_cleaned_test_functions.jsonl/48633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 687
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
2602,
368,
341,
286,
341,
310,
1077,
17065,
284,
12608,
1649,
27638,
5,
495,
6831,
931,
6615,
9993,
3715,
317,
310,
2060,
10714,
10297,
1279,
670,
445,
64,
3975,
830,
317,
286,
456,
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_remove_balance_from_coldkey_account_failed() {
new_test_ext().execute_with(|| {
let coldkey_account_id = 434324; // Random
let ammount = 10000; // Arbitrary
let result = Subtensor::remove_balance_from_coldkey_account(&coldkey_account_id, ammount);
assert_eq!(result, false);
});
} | rust_cleaned_test_functions.jsonl/17172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
29396,
5673,
666,
813,
792,
13500,
35060,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
9255,
792,
13500,
842,
284,
220,
19,
18,
19,
18,
17,
19,
26,
442,
10612,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_drop_clear() {
static mut drops: uint = 0;
struct Elem;
impl Drop for Elem {
fn drop(&mut self) {
unsafe { drops += 1; }
}
}
let mut ring = RingBuf::new();
ring.push_back(Elem);
ring.push_front(Elem);
ring.push_back(Elem);
ring.push_front(Elem);
ring.clear();
assert_eq!(unsafe {drops}, 4);
drop(ring);
assert_eq!(unsafe {drops}, 4);
} | rust_cleaned_test_functions.jsonl/26219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
21811,
368,
341,
286,
1099,
5206,
21025,
25,
2622,
284,
220,
15,
280,
286,
2036,
78768,
280,
286,
11605,
15733,
369,
78768,
341,
310,
5168,
5943,
2099,
6984,
656,
8,
341,
394,
19860,
314,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_album_id() {
let url = Url::parse("http://www.up-front-works.jp/release/detail/EPCE-7387/").unwrap();
assert_eq!(parse_album_id(&url).unwrap(), "EPCE-7387");
let url = Url::parse("http://www.up-front-works.jp/artist/").unwrap();
assert!(parse_album_id(&url).is_err());
} | rust_cleaned_test_functions.jsonl/134380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
53241,
842,
368,
341,
286,
1077,
2515,
284,
22840,
486,
6400,
445,
1254,
1110,
2136,
17652,
63626,
12,
18525,
32228,
88648,
40823,
14,
9197,
2104,
12,
22,
18,
23,
22,
14,
1827,
15454,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_snapshot_download() {
solana_logger::setup_with_default(RUST_LOG_FILTER);
// First set up the cluster with 1 node
let snapshot_interval_slots = 50;
let num_account_paths = 3;
let leader_snapshot_test_config =
setup_snapshot_validator_config(snapshot_interval_slots, num_account_paths);
let validator_snapshot_test_config =
setup_snapshot_validator_config(snapshot_interval_slots, num_account_paths);
let stake = 10_000;
let mut config = ClusterConfig {
node_stakes: vec![stake],
cluster_lamports: 1_000_000,
validator_configs: make_identical_validator_configs(
&leader_snapshot_test_config.validator_config,
1,
),
..ClusterConfig::default()
};
let mut cluster = LocalCluster::new(&mut config, SocketAddrSpace::Unspecified);
// Get slot after which this was generated
let snapshot_package_output_path = &leader_snapshot_test_config
.validator_config
.snapshot_config
.as_ref()
.unwrap()
.snapshot_package_output_path;
trace!("Waiting for snapshot");
let (archive_filename, archive_snapshot_hash) =
wait_for_next_snapshot(&cluster, snapshot_package_output_path);
trace!("found: {:?}", archive_filename);
download_snapshot(
&cluster.entry_point_info.rpc,
validator_snapshot_test_config.snapshot_archives_dir.path(),
archive_snapshot_hash,
false,
snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
&mut None,
)
.unwrap();
cluster.add_validator(
&validator_snapshot_test_config.validator_config,
stake,
Arc::new(Keypair::new()),
None,
SocketAddrSpace::Unspecified,
);
} | rust_cleaned_test_functions.jsonl/107507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 781
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53265,
35939,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
6615,
9993,
2785,
8553,
8419,
23728,
317,
262,
442,
5512,
738,
705,
279,
10652,
448,
220,
16,
2436,
198,
262,
1077,
16295,
20541,
54161,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run() -> Result<()> {
set_rustflags();
let test_filter = TestFilterBuilder::any(RunIgnored::Default);
let test_list = FIXTURE_TARGETS.make_test_list(&test_filter, &TargetRunner::empty());
let config =
NextestConfig::from_sources(&workspace_root(), None).expect("loaded fixture config");
let profile = config
.profile(NextestConfig::DEFAULT_PROFILE)
.expect("default config is valid");
let runner = TestRunnerBuilder::default().build(
&test_list,
&profile,
SignalHandler::noop(),
TargetRunner::empty(),
);
let (instance_statuses, run_stats) = execute_collect(&runner);
for (name, expected) in &*EXPECTED_TESTS {
let test_binary = FIXTURE_TARGETS
.test_artifacts
.get(*name)
.unwrap_or_else(|| panic!("unexpected test name {}", name));
for fixture in expected {
let instance_value =
&instance_statuses[&(test_binary.binary_path.as_path(), fixture.name)];
let valid = match &instance_value.status {
InstanceStatus::Skipped(_) => fixture.status.is_ignored(),
InstanceStatus::Finished(run_statuses) => {
// This test should not have been retried since retries aren't configured.
assert_eq!(
run_statuses.len(),
1,
"test {} should have been run exactly once",
fixture.name
);
let run_status = run_statuses.last_status();
run_status.result == fixture.status.to_test_status(1)
}
};
if !valid {
panic!(
"for test {}, mismatch in status: expected {:?}, actual {:?}",
fixture.name, fixture.status, instance_value.status
);
}
}
}
assert!(!run_stats.is_success(), "run should be marked failed");
Ok(())
} | rust_cleaned_test_functions.jsonl/96341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1010
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
368,
1464,
5714,
71698,
341,
262,
738,
1710,
590,
11161,
1428,
262,
1077,
1273,
8727,
284,
3393,
5632,
3297,
486,
3767,
2785,
359,
43337,
3018,
486,
3675,
317,
262,
1077,
1273,
2019,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_transfer_A_to_X() {
//TAX
let code = vec![0xAA];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.A = 0xF1;
nes.next(&mut memory).unwrap();
assert_eq!(0xF1, nes.X);
} | rust_cleaned_test_functions.jsonl/38718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
1566,
2346,
6859,
368,
341,
286,
442,
51,
2954,
198,
286,
1077,
2038,
284,
7486,
20703,
15,
60051,
935,
286,
1077,
5206,
308,
288,
284,
356,
5584,
486,
931,
543,
286,
1077,
5206,
4938,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_preimage_circuit_linkage() {
let mut rng = ark_std::test_rng();
// Set the parameters of this circuit
let k1 = Fr::from(1337u32);
let k2 = Fr::from(0xdeadbeefu32);
let domain_str1 = *b"goodbye my coney island babyyyyy";
let domain_str2 = *b"goodbye my one true loveeeeeeeee";
// Generate the CRSs and then prove on the above parameters. single1 is the circuit that
let pk_single1 = HashPreimageCircuit::gen_crs::<F, _>(&mut rng, 1);
let pk_single2 = HashPreimageCircuit::gen_crs::<F, _>(&mut rng, 2);
let pk_double = HashPreimageCircuit::gen_crs::<F, _>(&mut rng, 3);
let (mut public_inputs_single1, proof_single1) =
HashPreimageCircuit::prove(&mut rng, &pk_single1, 1, k1, k2, domain_str1);
let (mut public_inputs_single2, proof_single2) =
HashPreimageCircuit::prove(&mut rng, &pk_single2, 2, k1, k2, domain_str1);
let (mut public_inputs_double, proof_double) =
HashPreimageCircuit::prove(&mut rng, &pk_double, 3, k1, k2, domain_str2);
// Verify the proofs
let pvk_single1 = ark_groth16::prepare_verifying_key(&pk_single1.vk);
let pvk_single2 = ark_groth16::prepare_verifying_key(&pk_single2.vk);
let pvk_double = ark_groth16::prepare_verifying_key(&pk_double.vk);
assert!(
ark_groth16::verify_proof(&pvk_single1, &proof_single1, &public_inputs_single1)
.unwrap()
);
assert!(
ark_groth16::verify_proof(&pvk_single2, &proof_single2, &public_inputs_single2)
.unwrap()
);
assert!(
ark_groth16::verify_proof(&pvk_double, &proof_double, &public_inputs_double).unwrap()
);
// Now do a GS-over-canon-Groth16 and verify that. This does not hide k1 or k2
let crs = GS_CRS::<F>::generate_crs(&mut rng);
let prepared_input_single1 =
ark_groth16::prepare_inputs(&pvk_single1, &public_inputs_single1).unwrap();
let prepared_input_single2 =
ark_groth16::prepare_inputs(&pvk_single2, &public_inputs_single2).unwrap();
let prepared_input_double =
ark_groth16::prepare_inputs(&pvk_double, &public_inputs_double).unwrap();
let (xcoms, ycoms, gs_proofs) = prove_canon_g16_equations(
&[
(&proof_single1, &pk_single1.vk, &prepared_input_single1),
(&proof_single2, &pk_single2.vk, &prepared_input_single2),
(&proof_double, &pk_double.vk, &prepared_input_double),
],
&crs,
&mut rng,
);
assert!(verify_canon_g16_equations::<F>(
&[
(&pk_single1.vk, &prepared_input_single1),
(&pk_single2.vk, &prepared_input_single2),
(&pk_double.vk, &prepared_input_double)
],
(&xcoms, &ycoms, &gs_proofs),
&crs
));
// aᵢWᵢ where aᵢ are the inputs and Wᵢ are the group elements representing input wires)
public_inputs_single1[0] = Fr::zero();
public_inputs_single1[1] = Fr::zero();
public_inputs_single2[0] = Fr::zero();
public_inputs_single2[1] = Fr::zero();
public_inputs_double[0] = Fr::zero();
public_inputs_double[1] = Fr::zero();
let prepared_input_single1 =
ark_groth16::prepare_inputs(&pvk_single1, &public_inputs_single1).unwrap();
let prepared_input_single2 =
ark_groth16::prepare_inputs(&pvk_single2, &public_inputs_single2).unwrap();
let prepared_input_double =
ark_groth16::prepare_inputs(&pvk_double, &public_inputs_double).unwrap();
// Do a llet crs = GS_CRS::<F>::generate_crs(&mut rng);
let (xcoms, ycoms, gs_proofs) = prove_linked_g16_equations(
&[
(&proof_single1, &pk_single1.vk, &prepared_input_single1),
(&proof_single2, &pk_single2.vk, &prepared_input_single2),
(&proof_double, &pk_double.vk, &prepared_input_double),
],
&[k1, k2],
&crs,
&mut rng,
);
// Verify the linked proof
assert!(verify_linked_g16_equations::<F>(
&[
(&pk_single1.vk, &prepared_input_single1),
(&pk_single2.vk, &prepared_input_single2),
(&pk_double.vk, &prepared_input_double)
],
(&xcoms, &ycoms, &gs_proofs),
&crs
));
} | rust_cleaned_test_functions.jsonl/62166 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
1805,
666,
37268,
7233,
424,
368,
341,
286,
1077,
5206,
28422,
284,
55217,
15656,
486,
1944,
66849,
1428,
286,
442,
2573,
279,
5029,
315,
419,
16224,
198,
286,
1077,
595,
16,
284,
2869,
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_encode_with_several_attributes_success() {
static TEST_CREDENTIAL_DATA: &str =
r#"{"address2":["101 Wilson Lane"],
"zip":["87121"],
"state":["UT"],
"city":["SLC"],
"address1":["101 Tela Lane"]
}"#;
let results_json = encode_attributes(TEST_CREDENTIAL_DATA).unwrap();
let results : Value = serde_json::from_str(&results_json).unwrap();
let address2 : &Value = &results["address2"];
assert_eq!(encode("101 Wilson Lane").unwrap(), address2["encoded"]);
assert_eq!("101 Wilson Lane", address2["raw"]);
let state : &Value = &results["state"];
assert_eq!(encode("UT").unwrap(), state["encoded"]);
assert_eq!("UT", state["raw"]);
let zip : &Value = &results["zip"];
assert_eq!("87121", zip["encoded"]);
assert_eq!("87121", zip["raw"]);
} | rust_cleaned_test_functions.jsonl/104609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
6615,
3453,
17539,
18240,
18632,
368,
1476,
23459,
286,
1099,
13602,
920,
81509,
7896,
25,
609,
495,
4035,
310,
435,
55543,
4913,
4995,
17,
36799,
16,
15,
16,
17426,
26018,
8097,
310,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decoder_decode_version_invalid() {
let buffer = "RTSP/2.0! 200 OK\r\n\
\r\n";
let mut decoder = Decoder::new();
let (result, bytes_decoded) = decoder.decode(buffer);
assert_ne!(bytes_decoded, buffer.len());
assert_eq!(
result,
DecodeResult::Error(DecodeError::Version(VersionDecodeError::Invalid))
);
} | rust_cleaned_test_functions.jsonl/123063 | {
"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,
49843,
15227,
9438,
31433,
368,
341,
286,
1077,
4147,
284,
330,
5350,
4592,
14,
17,
13,
15,
0,
220,
17,
15,
15,
10402,
12016,
1699,
5661,
2549,
1124,
81,
1699,
876,
286,
1077,
5206,
24551,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enclave_proc_command_send_single() {
let (mut sock0, mut sock1) = UnixStream::pair().unwrap();
let cmd = EnclaveProcessCommandType::Describe;
let args: std::option::Option<&EmptyArgs> = None;
let result0 = enclave_proc_command_send_single::<EmptyArgs>(cmd, args, &mut sock0);
assert!(result0.is_ok());
let result1 = receive_from_stream::<EnclaveProcessCommandType>(&mut sock1);
assert!(result1.is_ok());
assert_eq!(result1.unwrap(), EnclaveProcessCommandType::Describe);
} | rust_cleaned_test_functions.jsonl/79720 | {
"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,
6205,
40533,
24436,
10811,
13565,
19487,
368,
341,
286,
1077,
320,
6984,
11087,
15,
11,
5206,
11087,
16,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5439,
284,
2925,
40533,
7423,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_noto_serif() {
run_test(
&TEST_DATA,
"directwrite/good-noto-serif.hi",
"noto/NotoSerifDevanagari-Regular.ttf",
&[JOINER_GLYPH_INDEX],
1514,
);
} | rust_cleaned_test_functions.jsonl/91199 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2072,
75861,
333,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
19798,
4934,
4846,
1386,
29169,
78,
27566,
860,
72,
756,
503,
330,
1921,
78,
20290,
2072,
31745,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lfn_checksum_overflow() {
lfn_checksum(&[
0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8,
]);
} | rust_cleaned_test_functions.jsonl/29720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
8822,
64038,
79073,
368,
341,
286,
326,
8822,
64038,
2099,
9640,
310,
220,
15,
9264,
84,
23,
11,
220,
15,
9264,
84,
23,
11,
220,
15,
9264,
84,
23,
11,
220,
15,
9264,
84,
23,
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_expr_cast() {
use ast::TypeName;
use ast::TypeSpecifier::TypedefName;
use parser::expression;
let env = &mut Env::new();
env.add_typename("U64");
assert_eq!(
expression("(U64)foo", env),
Ok(CastExpression {
type_name: TypeName {
specifiers: vec![TypedefName(ident("U64")).into()],
declarator: None,
}
.into(),
expression: ident("foo"),
}
.into())
);
} | rust_cleaned_test_functions.jsonl/107558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21915,
5303,
368,
341,
262,
990,
11763,
486,
39429,
280,
262,
990,
11763,
486,
929,
87297,
486,
12834,
4219,
675,
280,
262,
990,
6729,
486,
28099,
401,
262,
1077,
6105,
284,
609,
6984,
37039,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_example_2_1() {
let input = r#"[1,2,3]"#;
let input = parse_inputstring(&input);
let answer = sum_numbers_json(&input, 2);
assert_eq!(answer, 6);
} | rust_cleaned_test_functions.jsonl/97874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
62,
17,
62,
16,
368,
341,
286,
1077,
1946,
284,
435,
2,
36864,
16,
11,
17,
11,
18,
19177,
2,
280,
286,
1077,
1946,
284,
4715,
5898,
917,
2099,
1355,
317,
286,
1077,
4226,
284,
2629,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_map_in_place_zero_sized() {
let v = vec![(), ()];
#[derive(PartialEq, Debug)]
struct ZeroSized;
assert_eq!(v.map_in_place(|_| ZeroSized), [ZeroSized, ZeroSized]);
} | rust_cleaned_test_functions.jsonl/97506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
1243,
34548,
19359,
643,
1506,
368,
341,
262,
1077,
348,
284,
7486,
20703,
1507,
1719,
935,
262,
11506,
27098,
5304,
20894,
27312,
11,
11091,
5563,
262,
2036,
18306,
50,
1506,
280,
262,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_solicited_success() {
match metadata_solicited(
b"METADATA \"mbox\" (/shared/vendor/vendorname \"asdf\" \
/private/comment/a \"bbb\")\r\n",
) {
Ok((i, Response::MailboxData(MailboxDatum::MetadataSolicited { mailbox, values }))) => {
assert_eq!(mailbox, "mbox");
assert_eq!(i, b"\r\n");
assert_eq!(values.len(), 2);
assert_eq!(values[0].entry, "/shared/vendor/vendorname");
assert_eq!(
values[0]
.value
.as_ref()
.expect("None value is not expected"),
"asdf"
);
assert_eq!(values[1].entry, "/private/comment/a");
assert_eq!(
values[1]
.value
.as_ref()
.expect("None value is not expected"),
"bbb"
);
}
_ => panic!("Correct METADATA response is not parsed properly."),
}
} | rust_cleaned_test_functions.jsonl/4873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 711
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
91104,
18632,
368,
341,
286,
2432,
11160,
643,
91104,
1006,
310,
293,
1,
44875,
39119,
7245,
76,
2011,
2105,
46225,
6100,
35663,
35663,
606,
7245,
76615,
2105,
3044,
1060,
608,
1996,
73980,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stack_processor_flag() {
let code = vec![0x08, 0x28]; //push pull
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.C = 1;
nes.Z = 1;
nes.V = 1;
nes.N = 0;
nes.I = 0;
nes.next(&mut memory).unwrap();
nes.C = 0;
nes.Z = 0;
nes.V = 0;
nes.N = 0;
nes.I = 0;
assert_eq!(0xFC, nes.SP);
nes.next(&mut memory).unwrap();
assert_eq!(0xFD, nes.SP);
assert_eq!(1, nes.C);
assert_eq!(1, nes.Z);
assert_eq!(1, nes.V);
assert_eq!(0, nes.N);
assert_eq!(0, nes.I);
} | rust_cleaned_test_functions.jsonl/38725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
50127,
10933,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
87,
15,
23,
11,
220,
15,
87,
17,
23,
5265,
442,
9077,
6815,
198,
286,
1077,
5206,
308,
288,
284,
356,
5584,
486,
931,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_toupperc() {
assert_eq!(b'A', toupperc(b'A'));
assert_eq!(b'A', toupperc(b'a'));
assert_eq!(b'B', toupperc(b'b'));
} | rust_cleaned_test_functions.jsonl/92478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
283,
602,
2962,
368,
341,
262,
2060,
10714,
10297,
65,
51274,
516,
14776,
602,
2962,
1883,
51274,
6336,
262,
2060,
10714,
10297,
65,
51274,
516,
14776,
602,
2962,
1883,
25184,
6336,
262,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_make_absolute_full_url_no_protocol() {
crate::history::clear();
crate::history::append("gemini://typed-hole.org");
let url = "//typed-hole.org/foo";
let expected_url = Url::parse("gemini://typed-hole.org/foo").unwrap();
let absolute_url = Gemini {
source: String::from(url),
}
.to_absolute_url()
.unwrap();
assert_eq!(expected_url, absolute_url);
} | rust_cleaned_test_functions.jsonl/49238 | {
"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,
28230,
50874,
16372,
2903,
6536,
34880,
368,
341,
262,
17717,
486,
18844,
486,
7422,
1428,
262,
17717,
486,
18844,
486,
5090,
445,
34103,
6591,
1110,
44181,
86593,
2659,
797,
262,
1077,
2515,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gcd() {
fn check(a: usize, b: usize, c: usize) {
let big_a: BigUint = FromPrimitive::from_usize(a).unwrap();
let big_b: BigUint = FromPrimitive::from_usize(b).unwrap();
let big_c: BigUint = FromPrimitive::from_usize(c).unwrap();
assert_eq!(big_a.gcd(&big_b), big_c);
}
check(10, 2, 2);
check(10, 3, 1);
check(0, 3, 3);
check(3, 3, 3);
check(56, 42, 14);
} | rust_cleaned_test_functions.jsonl/90136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
4385,
368,
341,
286,
5168,
1779,
2877,
25,
22301,
11,
293,
25,
22301,
11,
272,
25,
22301,
8,
341,
310,
1077,
2409,
4306,
25,
6164,
21570,
284,
5542,
33313,
486,
1499,
11306,
551,
2877,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.